コード例 #1
0
        private void CleanEnvironment()
        {
            string fileLocation = Assembly.GetExecutingAssembly().Location;
            var    allFiles     = Directory.GetFiles(Path.GetDirectoryName(fileLocation), "CurrentConfig_*.xml").ToList();

            allFiles.Sort();

            foreach (var item in allFiles)
            {
                Config.LaunchConfig localConfig = null;
                if (File.Exists(item))
                {
                    localConfig = Config.LaunchConfig.LoadCurrentConfig(item);

                    try
                    {
                        File.Delete(item);
                    }
                    catch (Exception)
                    {
                    }
                }

                if (localConfig != null)
                {
                    var genericTool = Editors.EditorFactory.Inst.GetEditor(RuntimeInfo.Generic);
                    genericTool.CleanConfig(localConfig);
                }
            }
        }
コード例 #2
0
ファイル: LaunchConfig.cs プロジェクト: bofhbug/privateprj
        public static void SaveCurrentConfig(LaunchConfig config)
        {
            string currentConfigFile = RuntimeInfo.Inst.CurrentConfigFile;

            if (File.Exists(currentConfigFile))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(LaunchConfig));
                // A FileStream is needed to read the XML document.
                using (FileStream fs = new FileStream(currentConfigFile, FileMode.Open))
                {
                    serializer.Serialize(fs, config);
                }
            }
        }
コード例 #3
0
ファイル: LaunchConfig.cs プロジェクト: bofhbug/privateprj
        public static LaunchConfig LoadCurrentConfig(string configFile)
        {
            LaunchConfig retVal = null;

            if (File.Exists(configFile))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(LaunchConfig));
                // A FileStream is needed to read the XML document.
                using (var fs = new StreamReader(configFile))
                {
                    retVal = (LaunchConfig)serializer.Deserialize(fs);
                }
            }
            return(retVal);
        }