From 9f6ddde34c775f66054d78eacfd2354ecbfa4bc2 Mon Sep 17 00:00:00 2001 From: emb <> Date: Sat, 3 Jan 2015 22:47:53 -0600 Subject: [PATCH] Adding configuration GUI and sphinx documentation to repository. --- .hgignore | 11 +- Configuration/Configuration.sln | 28 + Configuration/Configuration/App.config | 6 + Configuration/Configuration/App.xaml | 42 ++ Configuration/Configuration/App.xaml.cs | 18 + .../Configuration/Assets/Icons/Add.png | Bin 0 -> 65838 bytes .../Configuration/Assets/Icons/Delete.png | Bin 0 -> 65838 bytes Configuration/Configuration/Builder.cs | 147 +++++ Configuration/Configuration/ConfFileParser.cs | 146 +++++ Configuration/Configuration/ConfFileSaver.cs | 58 ++ .../Configuration/Configuration.csproj | 182 ++++++ .../Converter/CollectionExistsConverter.cs | 23 + .../Converter/InverseBooleanConverter.cs | 24 + .../InverseBooleanToVisibilityConverter.cs | 25 + .../Converter/NullToVisibilityConverter.cs | 25 + Configuration/Configuration/MainWindow.xaml | 74 +++ .../Configuration/MainWindow.xaml.cs | 119 ++++ Configuration/Configuration/MenuParser.cs | 74 +++ .../Configuration/Properties/AssemblyInfo.cs | 55 ++ .../Properties/Resources.Designer.cs | 71 +++ .../Configuration/Properties/Resources.resx | 117 ++++ .../Properties/Settings.Designer.cs | 30 + .../Properties/Settings.settings | 7 + Configuration/Configuration/RelayCommand.cs | 65 ++ Configuration/Configuration/RetroFE.cs | 24 + .../Configuration/View/AddRemoveList.xaml | 75 +++ .../Configuration/View/AddRemoveList.xaml.cs | 80 +++ .../Configuration/View/Collection.xaml | 161 +++++ .../Configuration/View/Collection.xaml.cs | 65 ++ .../Configuration/View/ControlInput.xaml | 39 ++ .../Configuration/View/ControlInput.xaml.cs | 177 ++++++ .../Configuration/View/Launcher.xaml | 24 + .../Configuration/View/Launcher.xaml.cs | 39 ++ .../Configuration/View/MainSettings.xaml | 109 ++++ .../Configuration/View/MainSettings.xaml.cs | 53 ++ .../ViewModel/CollectionListVM.cs | 160 +++++ .../Configuration/ViewModel/CollectionVM.cs | 188 ++++++ .../Configuration/ViewModel/ControllerVM.cs | 93 +++ .../Configuration/ViewModel/LauncherListVM.cs | 129 ++++ .../Configuration/ViewModel/LauncherVM.cs | 73 +++ .../Configuration/ViewModel/MainVM.cs | 186 ++++++ Documentation/Manual/Configuration.rst | 478 +++++++++++++++ Documentation/Manual/Installation.rst | 26 + Documentation/Manual/Layouts.rst | 561 ++++++++++++++++++ Documentation/Manual/Makefile | 89 +++ Documentation/Manual/Overview.rst | 69 +++ Documentation/Manual/Troubleshooting.rst | 5 + Documentation/Manual/conf.py | 193 ++++++ Documentation/Manual/coordinates.png | Bin 0 -> 7529 bytes Documentation/Manual/easing.swf | Bin 0 -> 32198 bytes Documentation/Manual/index.rst | 17 + Documentation/Manual/make.bat | 113 ++++ .../Manual/sphinx_rtd_theme/__init__.py | 17 + .../Manual/sphinx_rtd_theme/breadcrumbs.html | 19 + .../Manual/sphinx_rtd_theme/footer.html | 32 + .../Manual/sphinx_rtd_theme/layout.html | 160 +++++ .../Manual/sphinx_rtd_theme/layout_old.html | 205 +++++++ .../Manual/sphinx_rtd_theme/search.html | 50 ++ .../Manual/sphinx_rtd_theme/searchbox.html | 7 + .../static/css/badge_only.css | 1 + .../sphinx_rtd_theme/static/css/theme.css | 4 + .../static/fonts/FontAwesome.otf | Bin 0 -> 62856 bytes .../static/fonts/fontawesome-webfont.eot | Bin 0 -> 38205 bytes .../static/fonts/fontawesome-webfont.svg | 414 +++++++++++++ .../static/fonts/fontawesome-webfont.ttf | Bin 0 -> 80652 bytes .../static/fonts/fontawesome-webfont.woff | Bin 0 -> 44432 bytes .../sphinx_rtd_theme/static/js/theme.js | 47 ++ .../Manual/sphinx_rtd_theme/theme.conf | 8 + .../Manual/sphinx_rtd_theme/versions.html | 37 ++ 69 files changed, 5572 insertions(+), 2 deletions(-) create mode 100644 Configuration/Configuration.sln create mode 100644 Configuration/Configuration/App.config create mode 100644 Configuration/Configuration/App.xaml create mode 100644 Configuration/Configuration/App.xaml.cs create mode 100644 Configuration/Configuration/Assets/Icons/Add.png create mode 100644 Configuration/Configuration/Assets/Icons/Delete.png create mode 100644 Configuration/Configuration/Builder.cs create mode 100644 Configuration/Configuration/ConfFileParser.cs create mode 100644 Configuration/Configuration/ConfFileSaver.cs create mode 100644 Configuration/Configuration/Configuration.csproj create mode 100644 Configuration/Configuration/Converter/CollectionExistsConverter.cs create mode 100644 Configuration/Configuration/Converter/InverseBooleanConverter.cs create mode 100644 Configuration/Configuration/Converter/InverseBooleanToVisibilityConverter.cs create mode 100644 Configuration/Configuration/Converter/NullToVisibilityConverter.cs create mode 100644 Configuration/Configuration/MainWindow.xaml create mode 100644 Configuration/Configuration/MainWindow.xaml.cs create mode 100644 Configuration/Configuration/MenuParser.cs create mode 100644 Configuration/Configuration/Properties/AssemblyInfo.cs create mode 100644 Configuration/Configuration/Properties/Resources.Designer.cs create mode 100644 Configuration/Configuration/Properties/Resources.resx create mode 100644 Configuration/Configuration/Properties/Settings.Designer.cs create mode 100644 Configuration/Configuration/Properties/Settings.settings create mode 100644 Configuration/Configuration/RelayCommand.cs create mode 100644 Configuration/Configuration/RetroFE.cs create mode 100644 Configuration/Configuration/View/AddRemoveList.xaml create mode 100644 Configuration/Configuration/View/AddRemoveList.xaml.cs create mode 100644 Configuration/Configuration/View/Collection.xaml create mode 100644 Configuration/Configuration/View/Collection.xaml.cs create mode 100644 Configuration/Configuration/View/ControlInput.xaml create mode 100644 Configuration/Configuration/View/ControlInput.xaml.cs create mode 100644 Configuration/Configuration/View/Launcher.xaml create mode 100644 Configuration/Configuration/View/Launcher.xaml.cs create mode 100644 Configuration/Configuration/View/MainSettings.xaml create mode 100644 Configuration/Configuration/View/MainSettings.xaml.cs create mode 100644 Configuration/Configuration/ViewModel/CollectionListVM.cs create mode 100644 Configuration/Configuration/ViewModel/CollectionVM.cs create mode 100644 Configuration/Configuration/ViewModel/ControllerVM.cs create mode 100644 Configuration/Configuration/ViewModel/LauncherListVM.cs create mode 100644 Configuration/Configuration/ViewModel/LauncherVM.cs create mode 100644 Configuration/Configuration/ViewModel/MainVM.cs create mode 100644 Documentation/Manual/Configuration.rst create mode 100644 Documentation/Manual/Installation.rst create mode 100644 Documentation/Manual/Layouts.rst create mode 100644 Documentation/Manual/Makefile create mode 100644 Documentation/Manual/Overview.rst create mode 100644 Documentation/Manual/Troubleshooting.rst create mode 100644 Documentation/Manual/conf.py create mode 100644 Documentation/Manual/coordinates.png create mode 100644 Documentation/Manual/easing.swf create mode 100644 Documentation/Manual/index.rst create mode 100644 Documentation/Manual/make.bat create mode 100644 Documentation/Manual/sphinx_rtd_theme/__init__.py create mode 100644 Documentation/Manual/sphinx_rtd_theme/breadcrumbs.html create mode 100644 Documentation/Manual/sphinx_rtd_theme/footer.html create mode 100644 Documentation/Manual/sphinx_rtd_theme/layout.html create mode 100644 Documentation/Manual/sphinx_rtd_theme/layout_old.html create mode 100644 Documentation/Manual/sphinx_rtd_theme/search.html create mode 100644 Documentation/Manual/sphinx_rtd_theme/searchbox.html create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/css/badge_only.css create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/css/theme.css create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/fonts/FontAwesome.otf create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/fonts/fontawesome-webfont.svg create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff create mode 100644 Documentation/Manual/sphinx_rtd_theme/static/js/theme.js create mode 100644 Documentation/Manual/sphinx_rtd_theme/theme.conf create mode 100644 Documentation/Manual/sphinx_rtd_theme/versions.html diff --git a/.hgignore b/.hgignore index 4453837..2e155dd 100644 --- a/.hgignore +++ b/.hgignore @@ -1,4 +1,11 @@ syntax: glob -Build/ *.orig -.git \ No newline at end of file +*.suo +.git +Build/ +Documentation/Documentation/* +Documentation/Artifacts/* +Documentation/Manual/_build/* +Configuration/Configuration/bin/** +Configuration/Configuration/obj/** + diff --git a/Configuration/Configuration.sln b/Configuration/Configuration.sln new file mode 100644 index 0000000..8011aba --- /dev/null +++ b/Configuration/Configuration.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configuration", "Configuration\Configuration.csproj", "{90F163C8-2147-46C9-8BF5-C51116856F62}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {90F163C8-2147-46C9-8BF5-C51116856F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90F163C8-2147-46C9-8BF5-C51116856F62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90F163C8-2147-46C9-8BF5-C51116856F62}.Debug|x86.ActiveCfg = Debug|x86 + {90F163C8-2147-46C9-8BF5-C51116856F62}.Debug|x86.Build.0 = Debug|x86 + {90F163C8-2147-46C9-8BF5-C51116856F62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90F163C8-2147-46C9-8BF5-C51116856F62}.Release|Any CPU.Build.0 = Release|Any CPU + {90F163C8-2147-46C9-8BF5-C51116856F62}.Release|x86.ActiveCfg = Release|x86 + {90F163C8-2147-46C9-8BF5-C51116856F62}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Configuration/Configuration/App.config b/Configuration/Configuration/App.config new file mode 100644 index 0000000..fad249e --- /dev/null +++ b/Configuration/Configuration/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Configuration/Configuration/App.xaml b/Configuration/Configuration/App.xaml new file mode 100644 index 0000000..a07c142 --- /dev/null +++ b/Configuration/Configuration/App.xaml @@ -0,0 +1,42 @@ + + + + + + + + + diff --git a/Configuration/Configuration/App.xaml.cs b/Configuration/Configuration/App.xaml.cs new file mode 100644 index 0000000..ce657d8 --- /dev/null +++ b/Configuration/Configuration/App.xaml.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Configuration +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + + } +} diff --git a/Configuration/Configuration/Assets/Icons/Add.png b/Configuration/Configuration/Assets/Icons/Add.png new file mode 100644 index 0000000000000000000000000000000000000000..cf2e43e49a108733d4ed14f45828cd27ee6471fd GIT binary patch literal 65838 zcmeHQU8r5f6+XU{Qm{{bYJKQKAA}YkiWD2f+LA^sB`rmYh)DW_gd#CmA=Hzz34=2sb}_o{Q}&TV}E{rAuJ3;2Z#7mRtQi4QNP z_4|WzF2F);fudgBe91PvhOfT*>Ro7E2g{dw+pkr z;_%_acc9;&AP>~xQCtgUyBO4C=FKxkA1#q*_S-su3fvn^zOUw-v8l;A1)MW zjR5E(==TEf$^HBH-%_^#r>Cb^Lm4&z+?^O)UMy0_k3Rb70_wQ=>8GFmYTflqmOp{V zi2Kh3bUC4-E0~9ZY(gttGwd6t(s4`zg;=(GViyBN*ghUO2B^VIZd$H2u@#}^ZH2%a zJ6GSgZ{M|0giXs?FDk;RQ>V5+_0&^e3`B8h1u>1f8Lj6`w-yh99-En&`E_cNdF7Q? z?m*r5b{oH7=CAz$?*bKb{9Xg$6UfHiIjLQ(0JqN4Uxu`>|VqZ2mB~8V$H4 zj)2kXr(!qHxDP(~;0S_fZlD7|{9<`Lg)h|rjq60mcxkdDMqoLsyNbmL6U#EqPS_2Fa_i&A*?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ztpt2AEk0nEv?DuLzHxqELXhX!KebtC#%?hQa7GmlvIYEsP4|jb)u+P7#N(mHGK{BHcQjIK{pvR&gvGYZ zxQa5w2Hc)TgD=uU-~T8p9R9d;i6@e;61uV5mcZ2ID}E841>m6$Ebi7cY1t9Nb_Id+S&cd=oC?oE?LNPj@22TWcubTLn;Wg+6yf;_y=J-SW0&aedm*El$z)G^!&$XrD|3fzC zI2{}baj>Ohwh$dC^0s*lJ%!_DRe{01dpy#W+1V2nz;V1O9{H-OyvFc>M&Fg!CD7bq z4!nI7USXFfaE|7AXfw99Pw=^hg8shTqg{E0H8q|y0<36FiMEF>6$Fa#=TRCTu%8F; z55!jYbgdOF4Ds;R`oVw~e?D@3Y>z{^AGS?i3%xuTy@8 zH&3{*wJ)a#6ePwGi@3Jo`GvcOwNwhLbSLVt6?OJbP7BbX3+0%Gb@)N;f=s;t4isS? zx8=zEF~ue;|A9|J=WS|7gtV z2dP|a*%%c8p5L(a5@U5yMQtdv5UZ>O_HzFYc`S<)((TVAF^LZU(N?ACb8adjD0%#<^^8t+wtRJ zRu0k@C7xpj(qg%GBZ0<-%>>2?mA)z>Z%zA6+(8CH*8 Xv2f+TS}RN+cGLG)ul&dN*8J}OKPM)m literal 0 HcmV?d00001 diff --git a/Configuration/Configuration/Assets/Icons/Delete.png b/Configuration/Configuration/Assets/Icons/Delete.png new file mode 100644 index 0000000000000000000000000000000000000000..27a3623fd53aa644dcd26502a2136afd3f169583 GIT binary patch literal 65838 zcmeHQZKz#UdOq`~48nB&^oJuu$&WJlqc}4~hC#&Y5HoQm4bsVoh=`pQ2}O!XNz)Ln z+9JUp5=xrFkU}b<41>%JA`(=@#u#JFcVdjui7{UF=F@A8H`i;7x6iY(o|Sj4v-Uar zeC%`fxw#kiUEgcH>wVsjwbuSPPu#imr{B8fx@#JZ#<%WRyzp-kKFaHxe}ey8Z~42O zjmCn;9Sd(;w(=W|TOWP-5#(N7f3Lmv+O0cw?6^C3p={CB#f>>Q+g-bM-F@Q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MS6%4s8y%47hl*SR%^mi@n}+oXyS`1bMMqrC^P$b$**?MN84CP;XRmg(7_XK^ z+!5eJYn!A!4JjZHgkR64^#T1nfPW%)x~KWW6&yNn;J}Y+30f6I!S^q3#SjVt-+im% z%OzFJC)X#f8RoDqeS}M(Gvr%Y;Kkh5`W$nZM=i$yWq$FK$Bkd$1O4r(4Oh}g^s#Sz8iY>?b~-F7J{2|=LVL6I2D@)W7lKBxTKqL zs%*m#Zh*Emm`C)p-j;sFQEzLNFW^==&r18|6E4*Dc7i}gVjVGqYa`xYcz9SxrLam5 zf`$#CIeKzhK&K&uV<)UbM_&@Hl;L&loC`&m$BjihhLo{%A@H@6SW~RU;nS)reia2D z)4UZc^i}ZLYxqUZR&LAEM>hZg`NN()d*;TTevm>#&Bg+01sHhLGPO*c072tsu%j5q z3VQ>DX$+=!3=dkY)b++2Z`^}L=H2{tHRVC@#;|A`gD|Z}+oKqJrYzW&F6{HqLMT_w zrQOURv2PlS>jdv(OPN~>#-QR{qd;KRL)+&ck847(j~V>lF?{bBO!1LcEA6U*r)2;Q z<2be*!y>SD3)4Qbyxv{m_Yvlayouts, ObservableCollection collections) + { + //todo :make paths relative + ConfFileParser ini = new ConfFileParser(RetroFE.GetAbsolutePath() + "/Settings.conf"); + + main.IsFullscreen = ToBool(ini.GetSetting("fullscreen")); + main.IsHorizontalStretch = ToBool(ini.GetSetting("horizontal")); + main.IsVerticalStretch = ToBool(ini.GetSetting("vertical")); + if (!main.IsHorizontalStretch) + { + main.HorizontalResolution = Convert.ToInt32(ini.GetSetting("horizontal")); + } + if (!main.IsVerticalStretch) + { + main.VerticalResolution = Convert.ToInt32(ini.GetSetting("vertical")); + } + + main.Layout = layouts.FirstOrDefault(row => row == ini.GetSetting("layout")); + + main.IsMouseHidden = ToBool(ini.GetSetting("hideMouse")); + main.IsParenthesisVisible = !ToBool(ini.GetSetting("showParenthesis")); + main.IsBracesVisible = !ToBool(ini.GetSetting("showSquareBrackets")); + string firstCollection = ini.GetSetting("firstCollection"); + if(firstCollection == "") + { + firstCollection = "Main"; + } + main.FirstCollection = collections.FirstOrDefault(row => row.Name == firstCollection); + main.IsVideoEnabled = ToBool(ini.GetSetting("videoEnable")); + main.VideoLoop = Convert.ToInt32(ini.GetSetting("videoLoop")); + main.IsInfiniteLoop = (main.VideoLoop == 0); + main.IsExitOnFirstBack = ToBool(ini.GetSetting("exitOnFirstPageBack")); + main.AttractModeTime = Convert.ToInt32(ini.GetSetting("attractModeTime")); + main.IsAttractModeEnabled = (main.AttractModeTime != 0); + } + + public void LoadController(ref ControllerVM vm) + { + //todo :make paths relative + ConfFileParser ini = new ConfFileParser(RetroFE.GetAbsolutePath() + "/Controls.conf"); + vm.ScrollNext = ini.GetSetting("nextItem"); + vm.ScrollPrevious = ini.GetSetting("previousItem"); + vm.PageUp = ini.GetSetting("pageUp"); + vm.PageDown = ini.GetSetting("pageDown"); + vm.SelectItem = ini.GetSetting("select"); + vm.Back = ini.GetSetting("back"); + vm.Quit = ini.GetSetting("quit"); + } + + public ObservableCollection LoadLaunchers() + { + //todo :make paths relative + ObservableCollection launchers = new ObservableCollection(); + + string[] files = Directory.GetFiles(RetroFE.GetAbsolutePath() + "/Launchers", "*.conf"); + + foreach (string file in files) + { + LauncherVM vm = new LauncherVM(); + ConfFileParser ini = new ConfFileParser(file); + + vm.Name = System.IO.Path.GetFileNameWithoutExtension(file); + vm.ExecutablePath = ini.GetSetting("executable"); + vm.Arguments = ini.GetSetting("arguments"); + launchers.Add(vm); + } + + return launchers; + } + + public ObservableCollection LoadCollections(ObservableCollection launchers) + { + //todo :make paths relative + ObservableCollection collections = new ObservableCollection(); + + string[] dirs = Directory.GetDirectories(RetroFE.GetAbsolutePath() + "/Collections"); + + foreach (string dir in dirs) + { + string settingsFile = Path.Combine(dir, "Settings.conf"); + string menuFile = Path.Combine(dir, "Menu.xml"); + CollectionVM vm = new CollectionVM(); + ConfFileParser ini = new ConfFileParser(settingsFile); + MenuParser mp = new MenuParser(); + string launcher = ini.GetSetting("launcher"); + vm.Name = System.IO.Path.GetFileNameWithoutExtension(dir); + vm.Launcher = launchers.FirstOrDefault(row => row.Name == launcher); + vm.ListPath = ini.GetSetting("list.path"); + vm.Layout = ini.GetSetting("layout"); + + if (vm.Layout == "") + { + vm.IsDefaultLayout = true; + } + vm.FileExtensions = ini.GetSetting("list.extensions"); + vm.MediaPathVideo = ini.GetSetting("media.video"); + vm.MediaPathTitle = ini.GetSetting("media.title"); + vm.MediaPathLogo = ini.GetSetting("media.logo"); + vm.MediaPathTitle = ini.GetSetting("media.title"); + vm.MediaPathSnap = ini.GetSetting("media.snap"); + vm.MediaPathBox = ini.GetSetting("media.box"); + vm.MediaPathCart = ini.GetSetting("media.cart"); + + //todo: read submenus + + vm.Submenus = mp.ReadCollections(menuFile); + collections.Add(vm); + } + + return collections; + } + public ObservableCollection LoadLayouts() + { + //todo :make paths relative + ObservableCollection layouts = new ObservableCollection(); + + string[] dirs = Directory.GetDirectories(RetroFE.GetAbsolutePath() + "/Layouts"); + + foreach (string dir in dirs) + { + string layout = System.IO.Path.GetFileNameWithoutExtension(dir); + layouts.Add(layout); + } + + return layouts; + } + + private bool ToBool(string value) + { + value = value.Trim().ToLower(); + + return (value == "yes" || value == "true" || value == "stretch"); + } + } +} diff --git a/Configuration/Configuration/ConfFileParser.cs b/Configuration/Configuration/ConfFileParser.cs new file mode 100644 index 0000000..2f7e90d --- /dev/null +++ b/Configuration/Configuration/ConfFileParser.cs @@ -0,0 +1,146 @@ +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; + +public class ConfFileParser +{ + private Dictionary keyPairs = new Dictionary(); + private String FilePath; + + /// + /// Opens the INI file at the given path and enumerates the values in the IniParser. + /// + /// Full path to INI file. + public ConfFileParser(String filePath) + { + TextReader iniFile = null; + String strLine = null; + + FilePath = filePath; + + if (File.Exists(filePath)) + { + try + { + iniFile = new StreamReader(filePath); + + strLine = iniFile.ReadLine(); + + while (strLine != null) + { + strLine = strLine.Trim(); + + if (strLine != "") + { + int commentStart = strLine.IndexOf("#"); + if(commentStart > 0) + { + strLine = strLine.Substring(0, commentStart-1); + } + + string[] propertyPair = strLine.Split(new char[] { '=' }, 2); + + if (propertyPair.Length > 1) + { + string key = propertyPair[0].Trim(); + string value = propertyPair[1].Trim(); + keyPairs.Add(key, value); + } + } + + strLine = iniFile.ReadLine(); + } + + } + catch (Exception ex) + { + throw ex; + } + finally + { + if (iniFile != null) + iniFile.Close(); + } + } + else + throw new FileNotFoundException("Unable to locate " + filePath); + + } + + /// + /// Returns the value for the given section, key pair. + /// + /// Section name. + /// Key name. + public String GetSetting(String settingName) + { + if(keyPairs.ContainsKey(settingName)) + return (String)keyPairs[settingName]; + + return ""; + } + + /// + /// Adds or replaces a setting to the table to be saved. + /// + /// Section to add under. + /// Key name to add. + /// Value of key. + public void AddSetting(String settingName, String settingValue) + { + keyPairs[settingName] = settingValue; + } + + /// + /// Remove a setting. + /// + /// Section to add under. + /// Key name to add. + public void DeleteSetting(String settingName) + { + if (keyPairs.ContainsKey(settingName)) + keyPairs.Remove(settingName); + } + + /// + /// Save settings to new file. + /// + /// New file path. + public void SaveSettings(String newFilePath) + { + String tmpValue = ""; + String strToSave = ""; + + foreach (string property in keyPairs.Keys) + { + tmpValue = (String)keyPairs[property]; + + if (tmpValue != null) + tmpValue = "=" + tmpValue; + + strToSave += (property + tmpValue + "\r\n"); + } + + strToSave += "\r\n"; + + try + { + TextWriter tw = new StreamWriter(newFilePath); + tw.Write(strToSave); + tw.Close(); + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// Save settings back to ini file. + /// + public void SaveSettings() + { + SaveSettings(FilePath); + } +} \ No newline at end of file diff --git a/Configuration/Configuration/ConfFileSaver.cs b/Configuration/Configuration/ConfFileSaver.cs new file mode 100644 index 0000000..bf9fbbd --- /dev/null +++ b/Configuration/Configuration/ConfFileSaver.cs @@ -0,0 +1,58 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Configuration +{ + class ConfFileSaver + { + public void AddOption(string key, string value) + { + Options.Add(key, value); + } + + public void AddOption(string key, bool value) + { + string strValue = (value) ? "yes" : "no"; + Options.Add(key, strValue); + } + + + public void AddOption(string key, int value) + { + string strValue = Convert.ToString(value); + + Options.Add(key, strValue); + } + + public void Save(string filePath) + { + TextWriter iniFile = null; + + try + { + iniFile = new StreamWriter(filePath); + + foreach (KeyValuePair option in Options) + { + iniFile.Write(option.Key + " = " + option.Value + Environment.NewLine); + } + + } + catch (Exception ex) + { + throw ex; + } + finally + { + if (iniFile != null) + iniFile.Close(); + } + } + + private Dictionary Options = new Dictionary(); + } +} diff --git a/Configuration/Configuration/Configuration.csproj b/Configuration/Configuration/Configuration.csproj new file mode 100644 index 0000000..537d00a --- /dev/null +++ b/Configuration/Configuration/Configuration.csproj @@ -0,0 +1,182 @@ + + + + + Debug + AnyCPU + {90F163C8-2147-46C9-8BF5-C51116856F62} + WinExe + Properties + Configuration + Configuration + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + ManagedMinimumRules.ruleset + true + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + ManagedMinimumRules.ruleset + true + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + + + + + + + + + + + + + + + + AddRemoveList.xaml + + + Collection.xaml + + + ControlInput.xaml + + + Launcher.xaml + + + MainSettings.xaml + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Configuration/Configuration/Converter/CollectionExistsConverter.cs b/Configuration/Configuration/Converter/CollectionExistsConverter.cs new file mode 100644 index 0000000..a24f94f --- /dev/null +++ b/Configuration/Configuration/Converter/CollectionExistsConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Windows.Data; + +namespace Configuration.Converter +{ + public class CollectionExistsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { +// if (targetType != typeof(bool)) +// throw new InvalidOperationException("The target is not a bool"); + return true; + // return !(bool)value; + } + + public object ConvertBack(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + } +} diff --git a/Configuration/Configuration/Converter/InverseBooleanConverter.cs b/Configuration/Configuration/Converter/InverseBooleanConverter.cs new file mode 100644 index 0000000..67f6c23 --- /dev/null +++ b/Configuration/Configuration/Converter/InverseBooleanConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Windows.Data; + +namespace Configuration.Converter +{ + [ValueConversion(typeof(bool), typeof(bool))] + public class InverseBooleanConverter: IValueConverter + { + public object Convert(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + if (targetType != typeof(bool)) + throw new InvalidOperationException("The target is not a bool"); + + return !(bool)value; + } + + public object ConvertBack(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + } +} diff --git a/Configuration/Configuration/Converter/InverseBooleanToVisibilityConverter.cs b/Configuration/Configuration/Converter/InverseBooleanToVisibilityConverter.cs new file mode 100644 index 0000000..595cd59 --- /dev/null +++ b/Configuration/Configuration/Converter/InverseBooleanToVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Windows; +using System.Windows.Data; + +namespace Configuration.Converter +{ + public class InverseBooleanToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + if (targetType != typeof(Visibility)) + throw new InvalidOperationException("The target is not a visibility type"); + + return (!(bool)value) ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + + } +} diff --git a/Configuration/Configuration/Converter/NullToVisibilityConverter.cs b/Configuration/Configuration/Converter/NullToVisibilityConverter.cs new file mode 100644 index 0000000..d255838 --- /dev/null +++ b/Configuration/Configuration/Converter/NullToVisibilityConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Windows; +using System.Windows.Data; + +namespace Configuration.Converter +{ + public class NullToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + if (targetType != typeof(Visibility)) + throw new InvalidOperationException("The target is not of type bool"); + + return ((object)value != null) ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, + System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + + } +} diff --git a/Configuration/Configuration/MainWindow.xaml b/Configuration/Configuration/MainWindow.xaml new file mode 100644 index 0000000..8c04d08 --- /dev/null +++ b/Configuration/Configuration/MainWindow.xaml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Configuration/Configuration/MainWindow.xaml.cs b/Configuration/Configuration/MainWindow.xaml.cs new file mode 100644 index 0000000..4ed668c --- /dev/null +++ b/Configuration/Configuration/MainWindow.xaml.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Configuration.ViewModel; +namespace Configuration +{ + /// + /// Interaction logic for MainWindow.xaml + /// + /// + + public partial class MainWindow : Window + { + private TabItem LastSelectedTabItem; + public MainWindow() + { + + InitializeComponent(); + if (!File.Exists(RetroFE.GetAbsolutePath() + "/Core/RetroFE.exe")) + { + MessageBox.Show("Could not find RetroFE executable. Exiting."); + Close(); + } + else + { + MessageBox.Show("This tool has not had a lot of testing. " + Environment.NewLine + Environment.NewLine + "Back up your files and use at your own risk before using this tool."); + ObservableCollection layouts = new ObservableCollection(); + LauncherListVM launcher = this.TryFindResource("LauncherConfig") as LauncherListVM; + CollectionListVM collection = this.TryFindResource("CollectionConfig") as CollectionListVM; + ControllerVM controller = this.TryFindResource("ControllerConfig") as ControllerVM; + MainVM main = this.TryFindResource("MainConfig") as MainVM; + Builder b = new Builder(); + + launcher.LauncherCollection = b.LoadLaunchers(); + collection.CollectionList = b.LoadCollections(launcher.LauncherCollection); + main.Layouts = b.LoadLayouts(); + b.LoadMain(ref main, main.Layouts, collection.CollectionList); + b.LoadController(ref controller); + } + } + + private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + TabControl control = sender as TabControl; + + if (LastSelectedTabItem != null) + { + LastSelectedTabItem.Focus(); + Save((string)LastSelectedTabItem.Header); + } + + if (control != null && control.SelectedValue != null) + { + LastSelectedTabItem = control.SelectedItem as TabItem; + } + } + + private void TabControl_FocusableChanged(object sender, DependencyPropertyChangedEventArgs e) + { + TabControl control = sender as TabControl; + + if(control.SelectedItem != null) + { + TabItem item = control.SelectedItem as TabItem; + item.Focus(); + Save((string)item.Header); + } + } + + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + if (ConfigurationTabControl.SelectedItem != null) + { + TabItem item = ConfigurationTabControl.SelectedItem as TabItem; + item.Focus(); + Save((string)item.Header); + } + + } + + private void Save(string tabItem) + { + if (tabItem == "General") + { + MainVM main = this.TryFindResource("MainConfig") as MainVM; + main.Save(); + } + else if (tabItem == "Controller") + { + ControllerVM vm = this.TryFindResource("ControllerConfig") as ControllerVM; + vm.Save(); + } + else if (tabItem == "Launchers") + { + LauncherListVM vm = this.TryFindResource("LauncherConfig") as LauncherListVM; + vm.Save(vm.SelectedLauncher); + } + else if (tabItem == "Collections") + { + CollectionListVM vm = this.TryFindResource("CollectionConfig") as CollectionListVM; + vm.Save(vm.SelectedCollection); + } + } + + } +} diff --git a/Configuration/Configuration/MenuParser.cs b/Configuration/Configuration/MenuParser.cs new file mode 100644 index 0000000..140608e --- /dev/null +++ b/Configuration/Configuration/MenuParser.cs @@ -0,0 +1,74 @@ +using System; +using System.IO; +using System.Collections; +using System.Collections.ObjectModel; +using System.Collections.Generic; +using System.Xml; + +public class MenuParser +{ + public ObservableCollection ReadCollections(string filePath) + { + + ObservableCollection list = new ObservableCollection(); + if (File.Exists(filePath)) + { + try + { + XmlReader reader = XmlReader.Create(filePath); + XmlDocument doc = new XmlDocument(); + reader.Read(); + doc.Load(reader); + + XmlNodeList items = doc.GetElementsByTagName("item"); + foreach (XmlNode item in items) + { + XmlAttribute name = item.Attributes["collection"]; + + if(name != null) + { + list.Add(name.Value); + } + } + } + catch (Exception ex) + { + throw ex; + } + } + + return list; + } + + /// + /// Save settings back to ini file. + /// + public void Save(ObservableCollection list, string filePath) + { + try + { + XmlDocument doc = new XmlDocument(); + XmlElement menu = doc.CreateElement("menu"); + + doc.AppendChild(menu); + + foreach (string item in list) + { + XmlElement node = doc.CreateElement("item"); + XmlAttribute attrib = doc.CreateAttribute("collection"); + attrib.Value = item; + menu.AppendChild(node); + node.AppendChild(attrib); + } + + doc.Save(filePath); + } + catch (Exception ex) + { + throw ex; + } + + +// SaveSettings(_FilePath); + } +} \ No newline at end of file diff --git a/Configuration/Configuration/Properties/AssemblyInfo.cs b/Configuration/Configuration/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c893c5f --- /dev/null +++ b/Configuration/Configuration/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Configuration")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Deere & Company")] +[assembly: AssemblyProduct("Configuration")] +[assembly: AssemblyCopyright("Copyright © Deere & Company 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Configuration/Configuration/Properties/Resources.Designer.cs b/Configuration/Configuration/Properties/Resources.Designer.cs new file mode 100644 index 0000000..744b8ff --- /dev/null +++ b/Configuration/Configuration/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Configuration.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Configuration.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Configuration/Configuration/Properties/Resources.resx b/Configuration/Configuration/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/Configuration/Configuration/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Configuration/Configuration/Properties/Settings.Designer.cs b/Configuration/Configuration/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c17d0c2 --- /dev/null +++ b/Configuration/Configuration/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Configuration.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Configuration/Configuration/Properties/Settings.settings b/Configuration/Configuration/Properties/Settings.settings new file mode 100644 index 0000000..8f2fd95 --- /dev/null +++ b/Configuration/Configuration/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Configuration/Configuration/RelayCommand.cs b/Configuration/Configuration/RelayCommand.cs new file mode 100644 index 0000000..b85758b --- /dev/null +++ b/Configuration/Configuration/RelayCommand.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +namespace Configuration +{ + public class RelayCommand : ICommand + { + #region Fields + + readonly Action _execute; + readonly Predicate _canExecute; + + #endregion // Fields + + #region Constructors + + /// + /// Creates a new command that can always execute. + /// + /// The execution logic. + public RelayCommand(Action execute) + : this(execute, null) + { + } + + /// + /// Creates a new command. + /// + /// The execution logic. + /// The execution status logic. + public RelayCommand(Action execute, Predicate canExecute) + { + if (execute == null) + throw new ArgumentNullException("execute"); + + _execute = execute; + _canExecute = canExecute; + } + + #endregion // Constructors + + #region ICommand Members + + public bool CanExecute(object parameters) + { + return _canExecute == null ? true : _canExecute(parameters); + } + + public event EventHandler CanExecuteChanged + { + add { CommandManager.RequerySuggested += value; } + remove { CommandManager.RequerySuggested -= value; } + } + + public void Execute(object parameters) + { + _execute(parameters); + } + + #endregion // ICommand Members + } +} diff --git a/Configuration/Configuration/RetroFE.cs b/Configuration/Configuration/RetroFE.cs new file mode 100644 index 0000000..c84b041 --- /dev/null +++ b/Configuration/Configuration/RetroFE.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; + +namespace Configuration +{ + class RetroFE + { + public static string GetAbsolutePath() + { + string path = Environment.GetEnvironmentVariable("RETROFE_PATH"); + + if (path == null) + { + path = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).Directory.FullName; + } + + return path; + } + } +} diff --git a/Configuration/Configuration/View/AddRemoveList.xaml b/Configuration/Configuration/View/AddRemoveList.xaml new file mode 100644 index 0000000..0dd0f88 --- /dev/null +++ b/Configuration/Configuration/View/AddRemoveList.xaml @@ -0,0 +1,75 @@ + + + /Assets/Icons/Add.png + /Assets/Icons/Delete.png + + + + + + + + + + + + + + + + + + + + + Name + + + + + + + + +