Beispiel #1
0
        public static void RunPathIntegration(string option)
        {
            switch (option)
            {
            case OPT_ADD:
            {
                string oldValue = ExplorerSystem.EnvironmentPath;

                string appFolder = RuntimeInfo.AppFolder;

                if (RuntimeInfo.IsAppFolderInPath)
                {
                    return;
                }


                bool appFolderInPath = oldValue.Split(ExplorerSystem.PATH_DELIM).Any(p => p == appFolder);

                string cd  = Environment.CurrentDirectory;
                string exe = Path.Combine(cd, RuntimeInfo.NAME_EXE);

                if (!appFolderInPath)
                {
                    string newValue = oldValue + ExplorerSystem.PATH_DELIM + cd;
                    ExplorerSystem.EnvironmentPath = newValue;
                }

                break;
            }

            case OPT_REM:
                ExplorerSystem.RemoveFromPath(RuntimeInfo.AppFolder);
                break;
            }
        }
        private SearchConfig()
        {
            // create cfg with default options if it doesn't exist
            if (!File.Exists(RuntimeInfo.ConfigLocation))
            {
                var f = File.Create(RuntimeInfo.ConfigLocation);
                f.Close();
            }

            var cfgFromFileMap = ExplorerSystem.ReadMap(RuntimeInfo.ConfigLocation);

            // EnginesStr = Read<string>(CFG_SEARCH_ENGINES, cfgFromFileMap);
            // PriorityEnginesStr = Read<string>(CFG_PRIORITY_ENGINES, cfgFromFileMap);
            Engines         = ReadMapKeyValue <SearchEngines>(CFG_SEARCH_ENGINES, cfgFromFileMap);
            PriorityEngines = ReadMapKeyValue <SearchEngines>(CFG_PRIORITY_ENGINES, cfgFromFileMap);
            ImgurAuth       = ReadMapKeyValue <string>(CFG_IMGUR_APIKEY, cfgFromFileMap);
            SauceNaoAuth    = ReadMapKeyValue <string>(CFG_SAUCENAO_APIKEY, cfgFromFileMap);
        }
Beispiel #3
0
        private static string FindExecutableLocation(string exe)
        {
            string path = ExplorerSystem.FindExectableInPath(exe);

            if (path == null)
            {
                string cd = Environment.CurrentDirectory;

                if (Try(cd, exe, out path))
                {
                    return(path);
                }


                // SPECIAL CASE: app folder is not in path, continuing past here causes a stack overflow
                // todo


                /*if (Try(AppFolder, exe, out path)) {
                 *      return path;
                 * }*/
            }
 internal void WriteToFile()
 {
     CliOutput.WriteInfo("Updating config");
     ExplorerSystem.WriteMap(ToMap(), RuntimeInfo.ConfigLocation);
     CliOutput.WriteInfo("Wrote to {0}", RuntimeInfo.ConfigLocation);
 }
Beispiel #5
0
 public static void Remove() => ExplorerSystem.RemoveFromPath(RuntimeInfo.AppFolder);