コード例 #1
0
        public static ETS2SyncConfig LoadConfig(String assemblyPath, Boolean UseSettingsDir)
        {
            //ILog lg = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            string pd = assemblyPath;

            if (UseSettingsDir)
            {
                pd = System.IO.Path.Combine(pd, "Settings");
            }
            string fn = System.IO.Path.Combine(pd, "Settings.xml");
            //lg.Debug(String.Format("Using Path:'{0}'", fn));
            ETS2SyncConfig cfg;

            try
            {
                if (File.Exists(fn))
                {
                    ConfigXmlFile cxf = new ConfigXmlFile(fn, true);
                    cfg = cxf.Get <ETS2SyncConfig>();
                }
                else
                {
                    cfg = new ETS2SyncConfig();
                    ETS2SyncConfig.SaveConfig(Functions.GetAssemblyDirectory(), cfg);
                }
            }
            catch (Exception e)
            {
                cfg = new ETS2SyncConfig();
            }

            return(cfg);
        }
コード例 #2
0
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     ETS2SyncConfig.SaveConfig(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Rn.Config);
 }