public void Reset()
        {
            fsw.EnableRaisingEvents = false;
            Data = null;


            SearchPrefixes = null;
        }
        private void PortApply_Click(object sender, RoutedEventArgs e)
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            ArtemisINI data = LoadINI();

            if (data != null)
            {
                data.NetworkPort = Port;
                data.Save();
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }
 void LoadINIFile()
 {
     Reset();
     if (Configuration != null && !string.IsNullOrEmpty(Configuration.InstalledPath))
     {
         ini = ArtemisModLoader.Helpers.FileHelper.LocateExpectedFileInMod("artemis.ini", Configuration);
         if (string.IsNullOrEmpty(ini))
         {
             for (int i = Configuration.DependsOn.Count - 1; i >= 0; i--)
             {
                 foreach (ModConfiguration config in ActiveModConfigurations.Current.Configurations.Configurations)
                 {
                     if (config.ID == Configuration.DependsOn[i].Text)
                     {
                         ini = ArtemisModLoader.Helpers.FileHelper.LocateExpectedFileInMod("artemis.ini", config);
                         if (!string.IsNullOrEmpty(ini))
                         {
                             if (System.IO.File.Exists(ini))
                             {
                                 string targ = System.IO.Path.Combine(Configuration.InstalledPath, "artemis.ini");
                                 RussLibrary.Helpers.FileHelper.Copy(ini, targ);
                                 ini = targ;
                             }
                         }
                         break;
                     }
                 }
                 if (!string.IsNullOrEmpty(ini))
                 {
                     break;
                 }
             }
         }
         if (!string.IsNullOrEmpty(ini))
         {
             Data = new ArtemisINI(ini);
         }
         if (Data != null)
         {
             SetWatcher(Data.INIPath);
             Data.AcceptChanges();
         }
     }
 }
        ArtemisINI LoadINI()
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            ArtemisINI artemisData = null;
            string     INIPath     = System.IO.Path.Combine(Locations.ArtemisCopyPath, "artemis.ini");

            if (File.Exists(INIPath))
            {
                artemisData = new ArtemisINI(INIPath);
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
            return(artemisData);
        }
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            fsw.EnableRaisingEvents = false;
            OpenFileDialog diag = new OpenFileDialog();

            //TODO: put in language resource
            diag.Title = "Select Artemis.ini file";

            diag.InitialDirectory = Configuration.InstalledPath;
            diag.Filter           = "Artemis INI files(*artemis*.ini)|*artemis*.ini|INI files (*.ini)|*.ini|All files (*.*)|*.*";

            if (diag.ShowDialog() == true)
            {
                Reset();
                Data = new ArtemisINI(diag.FileName);
                SetWatcher(Data.INIPath);
                Data.AcceptChanges();
            }
        }
        void DoStartup()
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            ArtemisINI data = LoadINI();

            if (data != null)
            {
                Port = data.NetworkPort;
            }
            ImageBrush brsh = ArtemisModLoader.Helpers.FileHelper.GetRandomSkybox();

            if (brsh != null)
            {
                this.Background = brsh;
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }