예제 #1
0
        private static void ScanUpdateFeed(SerializablePatch result)
        {
            Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
            Version newestVersion  = new Version(result.Release.Version);
            string  forumUrl       = result.Release.TopicUrl;
            string  updateMessage  = result.Release.Message;
            string  installArgs    = result.Release.InstallerArgs;
            string  installerUrl   = result.Release.Url;
            string  additionalArgs = result.Release.AdditionalArgs;
            bool    canAutoInstall = (!String.IsNullOrEmpty(installerUrl) && !String.IsNullOrEmpty(installArgs));

            if (!String.IsNullOrEmpty(additionalArgs) && additionalArgs.Contains("%EVEMON_EXECUTABLE_PATH%"))
            {
                string appPath = Path.GetDirectoryName(Application.ExecutablePath);
                installArgs = String.Format(CultureConstants.DefaultCulture, "{0} {1}", installArgs, additionalArgs);
                installArgs = installArgs.Replace("%EVEMON_EXECUTABLE_PATH%", appPath);
            }

            // Is the program out of date ?
            if (newestVersion > currentVersion)
            {
                // Requests a notification to subscribers and quit
                EveClient.OnUpdateAvailable(forumUrl, installerUrl, updateMessage, currentVersion,
                                            newestVersion, canAutoInstall, installArgs);
                return;
            }

            if (result.FilesHaveChanged)
            {
                // Requests a notification to subscribers and quit
                EveClient.OnDataUpdateAvailable(forumUrl, result.ChangedDataFiles);
                return;
            }
        }