示例#1
0
        public Update(UpdateType build)
        {
            UpdateType = build;

            Task.Run(() => SetVersion()).Wait();

            switch (UpdateType)
            {
            case UpdateType.MapleSeed:
                CurrentVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
                if (VersionStrings.Length == 2)
                {
                    LatestVersion = VersionStrings[0];
                }
                break;

            case UpdateType.MapleSeed2:
                CurrentVersion = Settings.Version;
                if (VersionStrings.Length == 2)
                {
                    LatestVersion = VersionStrings[1];
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            int currentVersion = int.Parse(CurrentVersion.Replace(".", ""));
            int latestVersion  = int.Parse(LatestVersion.Replace(".", ""));

            if (currentVersion != latestVersion)
            {
                TextLog.MesgLog.WriteLog($"[Version Mismatch] Latest Release: {LatestVersion}", Color.Gray);
            }

            if (currentVersion < latestVersion)
            {
                IsAvailable = true;
            }
        }