public ServerSelector(ServerInfo theServerInfo, UserPreferences thePreferences, bool blnAllowCustomServerUpdate, TextVariables theTextVariables)
 {
     TheServerInfo = theServerInfo;
     TheUserPreferences = thePreferences;
     AllowCustomServerUpdate = blnAllowCustomServerUpdate;
     TheTextVariables = theTextVariables;
 }
 public TextualServerControl(ServerInfo theServerInfo, UserPreferences thePreferences, bool blnAllowCustomServerUpdate, TextVariables theTextVariables)
 {
     TheServerInfo = theServerInfo;
     TheUserPreferences = thePreferences;
     AllowCustomServerUpdate = blnAllowCustomServerUpdate;
     TheTextVariables = theTextVariables;
 }
Example #3
0
 public Patcher(TextVariables theVariables, UserPreferences theUserPreferences)
 {
     myVariables       = theVariables;
     hashmd5           = new MD5CryptoServiceProvider();
     myUserPreferences = theUserPreferences;
 }
Example #4
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);
        }
 public Patcher(TextVariables theVariables, UserPreferences theUserPreferences)
 {
     myVariables = theVariables;
     hashmd5 = new MD5CryptoServiceProvider();
     myUserPreferences = theUserPreferences;
 }
        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);
        }
            public UIText()
            {
                //load the user's locale
                UserPreferences myPreferences = new UserPreferences();
                string strLocale = myPreferences.UserLocale;

                if (string.IsNullOrEmpty(strLocale))
                {
                    //default the english
                    strLocale = "en-gb";
                }

                //load the XML
                StreamResourceInfo info = null;
                Uri myXML = new Uri("/lang_internal/" + strLocale + ".xml", UriKind.RelativeOrAbsolute);
                try
                {
                    info = Application.GetResourceStream(myXML);
                }
                catch
                {
                    //load english
                    info = Application.GetResourceStream(new Uri("/lang_internal/en-gb.xml", UriKind.RelativeOrAbsolute));
                }
                XmlReader read = XmlReader.Create(info.Stream);
                XElement theLang = XElement.Load(read);
                this.CheckingForUpdates = theLang.Element("CheckingForUpdates").Value + "...";
                this.Done = theLang.Element("Done").Value;
                this.LoadingLanguages = theLang.Element("LoadingLanguages").Value + "...";
                this.LoadingServers = theLang.Element("LoadingServers").Value + "...";
                this.LoadingSkins = theLang.Element("LoadingSkins").Value + "...";
                this.UpdateFound = theLang.Element("UpdateFound").Value;
            }