UpdateSettings() public method

public UpdateSettings ( SettingsType theType, object theSetting ) : void
theType SettingsType
theSetting object
return void
Esempio n. 1
0
        public void MessageBoxOK(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(strSWGANHPath))
            {
                System.Windows.Forms.FolderBrowserDialog dia = new System.Windows.Forms.FolderBrowserDialog();

                if (dia.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    strSWGANHPath = dia.SelectedPath;
                }

                //add a slash if it needs one
                if (!strSWGANHPath.EndsWith("\\"))
                {
                    strSWGANHPath += "\\";
                }

                //save this one
                myUserPreferences.UpdateSettings(UserPreferences.SettingsType.ClientPath, strSWGANHPath);
            }

            if (!string.IsNullOrEmpty(strSWGANHPath))
            {
                PatchClient(cachedServerInfo);
            }
        }
Esempio n. 2
0
        private void InitiliseMyApp(Splash theSplashScreen)
        {
            //check for launcher updates first
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Launcher));
            }
            UserPreferences myPrefs        = new UserPreferences();
            ServiceMaker    myServiceMaker = new ServiceMaker();

            LauncherData.LauncherDataClient myClient = myServiceMaker.GetServiceClient();

            ApplicationUpdates myApplicationUpdates = new ApplicationUpdates(myClient);

            List <LauncherData.LauncherVersion> lstLatestVersions = myApplicationUpdates.UpdateAvailable(this.Dispatcher);

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Launcher, lstLatestVersions.Count, ""));
            }

            //and skins
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Skins));
            }
            UISettings mySettings = new UISettings();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Skins, mySettings.GetAvailableSkins.Count, ""));
            }

            //and now the languages
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Languages));
            }

            Locales myLocale = new Locales();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Languages, myLocale.NumberLoaded, ""));
            }

            //finally, load the servers
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Servers));
            }

            List <ServerInfo> lstServers = new List <ServerInfo>();


            try
            {
                List <LauncherData.ServerInfo> lstLiveServers = myClient.GetServers();



                var tmpServers = from ser in lstLiveServers
                                 select new ServerInfo
                {
                    Address      = ser.Address,
                    CharsCreated = ser.CharsCreated,
                    Description  = ser.Description,
                    LastUpdated  = ser.LastUpdated,
                    LauncherPort = ser.LauncherPort,
                    Population   = ser.Population,
                    Port         = ser.Port,
                    RSSFeedUrl   = ser.RSSFeedUrl,
                    ServerId     = ser.ServerId,
                    ServerName   = ser.ServerName
                };
                //update the preferecnes
                myPrefs.UpdateSettings(UserPreferences.SettingsType.CachedServers, tmpServers.ToList());
            }
            catch
            {
                //don't update the cached ones
            }

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Servers, lstServers.Count, ""));
            }

            //and get the list of standard TRE files
            try
            {
                List <LauncherData.StandardTre> lstLiveStandardTres = myClient.GetStandardTre();
                var tmpStandard = from stre in lstLiveStandardTres
                                  select new StandardTre
                {
                    Filename = stre.Filename,
                    MD5Hash  = stre.MD5Hash
                };

                myPrefs.UpdateSettings(UserPreferences.SettingsType.StandardTres, tmpStandard.ToList());
            }
            catch
            {
            }

            Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
            {
                MainWindow = new MainWindow(lstLatestVersions);
                MainWindow.Show();
            }), System.Windows.Threading.DispatcherPriority.Normal);
        }
        private void InitiliseMyApp(Splash theSplashScreen)
        {
            //check for launcher updates first
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Launcher));
            }
            UserPreferences myPrefs = new UserPreferences();
            ServiceMaker myServiceMaker = new ServiceMaker();
            LauncherData.LauncherDataClient myClient = myServiceMaker.GetServiceClient();

            ApplicationUpdates myApplicationUpdates = new ApplicationUpdates(myClient);

            List<LauncherData.LauncherVersion> lstLatestVersions = myApplicationUpdates.UpdateAvailable(this.Dispatcher);

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Launcher, lstLatestVersions.Count, ""));
            }

            //and skins
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Skins));
            }
            UISettings mySettings = new UISettings();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Skins, mySettings.GetAvailableSkins.Count, ""));
            }

            //and now the languages
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Languages));
            }

            Locales myLocale = new Locales();

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Languages, myLocale.NumberLoaded, ""));
            }

            //finally, load the servers
            if (SectionStarted != null)
            {
                SectionStarted(this, new LoadingSectionStarted(LoadingType.Servers));
            }

            List<ServerInfo> lstServers = new List<ServerInfo>();

            try
            {
                List<LauncherData.ServerInfo> lstLiveServers = myClient.GetServers();

                var tmpServers = from ser in lstLiveServers
                                 select new ServerInfo
                                 {
                                     Address = ser.Address,
                                     CharsCreated = ser.CharsCreated,
                                     Description = ser.Description,
                                     LastUpdated = ser.LastUpdated,
                                     LauncherPort = ser.LauncherPort,
                                     Population = ser.Population,
                                     Port = ser.Port,
                                     RSSFeedUrl = ser.RSSFeedUrl,
                                     ServerId = ser.ServerId,
                                     ServerName = ser.ServerName
                                 };
                //update the preferecnes
                myPrefs.UpdateSettings(UserPreferences.SettingsType.CachedServers, tmpServers.ToList());
            }
            catch
            {
                //don't update the cached ones
            }

            if (SectionLoaded != null)
            {
                SectionLoaded(this, new LoadingSectionCompleted(LoadingType.Servers, lstServers.Count, ""));
            }

            //and get the list of standard TRE files
            try
            {

                List<LauncherData.StandardTre> lstLiveStandardTres = myClient.GetStandardTre();
                var tmpStandard = from stre in lstLiveStandardTres
                                  select new StandardTre
                                  {
                                      Filename = stre.Filename,
                                      MD5Hash = stre.MD5Hash
                                  };

                myPrefs.UpdateSettings(UserPreferences.SettingsType.StandardTres, tmpStandard.ToList());

            }
            catch
            {

            }

            Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
            {
                MainWindow = new MainWindow(lstLatestVersions);
                MainWindow.Show();
            }), System.Windows.Threading.DispatcherPriority.Normal);
        }