Пример #1
0
 internal static void OnUpdate2()
 {
     if (Update2 != null)
     {
         Update2.Invoke();
     }
 }
 public static int GetUpdateInfoIndexByLocale(Update2 Update, string Locale)
 {
     for (int i = 0; i < Update.UpdateCollection.Count; i++)
     {
         if (Update.UpdateCollection[i].LangCode.Contains(Locale))
         {
             return(i);
         }
     }
     return(0);
 }
Пример #3
0
 private void Close_Adm()
 {
     Update1.Hide();
     Delete1.Hide();
     акцияDataGridView.ReadOnly              = true;
     акцияDataGridView.AllowUserToAddRows    = false;
     акцияDataGridView.AllowUserToDeleteRows = false;
     Update2.Hide();
     Delete2.Hide();
     продажи_товаровDataGridView.ReadOnly              = true;
     продажи_товаровDataGridView.AllowUserToAddRows    = false;
     продажи_товаровDataGridView.AllowUserToDeleteRows = false;
 }
Пример #4
0
 private void Close_Adm()
 {
     Update1.Hide();
     Delete1.Hide();
     акцияDataGridView.ReadOnly              = true;
     акцияDataGridView.AllowUserToAddRows    = false;
     акцияDataGridView.AllowUserToDeleteRows = false;
     Update2.Hide();
     Delete2.Hide();
     товары_в_поставкахDataGridView.ReadOnly              = true;
     товары_в_поставкахDataGridView.AllowUserToAddRows    = false;
     товары_в_поставкахDataGridView.AllowUserToDeleteRows = false;
 }
        public static bool IsNewerVersionAvailable(Update2 CurrentUpdate)
        {
            var CurrentVersion = Vars.AppVer;
            var CurrentLatest  = new Version(CurrentUpdate.Latest);

            if (CurrentLatest > CurrentVersion)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
            public static bool IsNewerVersionAvailable(Update2 CurrentUpdate)
            {
                if (Vars.GitHubReleases)
                {
                    Log("This distribution of pmcenter is released via GitHub releases. Automatic updates are not supported yet.", LogLevel.Warning);
                    return(false);
                }
                var currentVersion = Vars.AppVer;
                var currentLatest  = new Version(CurrentUpdate.Latest);

                if (currentLatest > currentVersion)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
Пример #7
0
            /// <summary>
            /// Download update to filesystem and extract.
            /// You must run Conf.CheckForUpdatesAsync() in order to pass the latestUpdate argument.
            /// </summary>
            /// <param name="latestUpdate">The information of the latest update</param>
            /// <param name="localizationIndex">The target localization's index</param>
            /// <returns></returns>
            public static async Task DownloadUpdatesAsync(Update2 latestUpdate, int localizationIndex = 0)
            {
                Log("Starting update download... (pmcenter_update.zip)");
#pragma warning disable CA1062 // Validate arguments of public methods
                Log($"From address: {latestUpdate.UpdateCollection[localizationIndex].UpdateArchiveAddress}");
#pragma warning restore CA1062
                await DownloadFileAsync(
                    new Uri(latestUpdate.UpdateCollection[localizationIndex].UpdateArchiveAddress),
                    Path.Combine(Vars.AppDirectory, "pmcenter_update.zip")
                    ).ConfigureAwait(false);

                Log("Download complete. Extracting...");
                using (var zip = ZipFile.OpenRead(Path.Combine(Vars.AppDirectory, "pmcenter_update.zip")))
                {
                    foreach (var entry in zip.Entries)
                    {
                        Log($"Extracting: {Path.Combine(Vars.AppDirectory, entry.FullName)}");
                        entry.ExtractToFile(Path.Combine(Vars.AppDirectory, entry.FullName), true);
                    }
                }
                Log("Cleaning up temporary files...");
                File.Delete(Path.Combine(Vars.AppDirectory, "pmcenter_update.zip"));
            }
            public static int GetUpdateInfoIndexByLocale(Update2 Update, string Locale)
            {
                var indexes = new List <int>();

                for (int i = 0; i < Update.UpdateCollection.Count; i++)
                {
                    if (Update.UpdateCollection[i].LangCode.Contains(Locale))
                    {
                        indexes.Add(i);
                    }
                }
                if (indexes.Count == 0)
                {
                    return(0);
                }
                foreach (var i in indexes)
                {
                    if (Update.UpdateCollection[i].UpdateChannel == Vars.CurrentConf.UpdateChannel)
                    {
                        return(i);
                    }
                }
                return(indexes[0]);
            }
Пример #9
0
        internal static void InvokeUpdate2(object player)
        {
            var args = new UpdatedEventArgs((Player)player);

            Update2?.Invoke(null, args);
        }