示例#1
0
        /// <summary>
        /// Asynnchronously checks the files and compares them against the set of standard MD5 checksums
        /// </summary>
        /// <param name="theServerInfo">ServerInfo onject of the server to patch for</param>
        public void PatchClient(ServerInfo theServerInfo)
        {
            //cache the ol' server info
            cachedServerInfo = theServerInfo;

            if (string.IsNullOrEmpty(SWGANHPAth))
            {
                return;
            }
            //get a list of the custom TRE's
            ServiceMaker myServiceMaker = new ServiceMaker();

            LauncherData.LauncherDataClient myClient  = myServiceMaker.GetServiceClient();
            CustomeTreCallObject            theObject = new CustomeTreCallObject
            {
                TheClient = myClient,
                Server    = theServerInfo
            };

            myClient.BeginGetCustomTre(theServerInfo.ServerId, new AsyncCallback(FinishedGettingTRE), theObject);

            if (PatchStepFired != null)
            {
                PatchStepFired(this, new PatchingEventArgs(myVariables.GettingCustomTre, true));
            }
        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            ResetSettings();

            mySettings.SetNewPallette(myUserPrefs.CurrentPallette);
            mySettings.SetGhostFont(myUserPrefs.CurrentGhostFont.Name);

            if (lstLatestVersions.Count > 0)
            {
                //combine the patch notes
                string strPatchNotes = "";
                foreach (LauncherData.LauncherVersion theVersion in lstLatestVersions)
                {
                    strPatchNotes += theVersion.VersionNumber + " (" + theVersion.DateCreated.ToString("yyyy-MM-dd HH:mm:ss") + ")" + Environment.NewLine;
                    strPatchNotes += theVersion.PatchNotes + Environment.NewLine + Environment.NewLine;
                }

                this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
                {
                    lblMessage.Text          = myLocales.CurrentLocale.DownloadingUpdateOne + Environment.NewLine + myLocales.CurrentLocale.DownloadingUpdateTwo;
                    lblMessage.Text         += Environment.NewLine + Environment.NewLine + strPatchNotes;
                    brdMessageBox.Visibility = Visibility.Visible;

                    messageboxOK.Visibility                  = Visibility.Collapsed;
                    ServiceMaker myServiceMaker              = new ServiceMaker();
                    ApplicationUpdates myApplicationUpdates  = new ApplicationUpdates(myServiceMaker.GetServiceClient());
                    myApplicationUpdates.OnDownloadProgress += new EventHandler <ApplicationUpdates.DownloadProgressEventArgs>(myApplicationUpdates_OnDownloadProgress);
                    myApplicationUpdates.OnDownloadComplete += new EventHandler <ApplicationUpdates.DownloadCompleteEventArgs>(myApplicationUpdates_OnDownloadComplete);
                    myApplicationUpdates.UpdateToLatestVersion(this.Dispatcher, lstLatestVersions.First());
                    prgDownload.Visibility = Visibility.Visible;
                    prgDownload.Maximum    = lstLatestVersions.First().FileSize;
                    prgDownload.Value      = 0;
                }), System.Windows.Threading.DispatcherPriority.Normal);
            }
            else
            {
                if ((myUserPrefs.DefaultServer != Guid.Empty) && (myUserPrefs.DefaultServerInformation != null))
                {
                    //chek the game launcher, by default
                    scGameLauncher.IsChecked = true;
                }
                else
                {
                    scChooseGalaxy.IsChecked = true;
                }
            }
        }
示例#3
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);
        }