Example #1
0
        private void CheckLastVersion()
        {
            if (string.IsNullOrEmpty(config.Repository))
            {
                return;
            }

            Log.Print("Checking for updates.");

            if (!UnityModManager.HasNetworkConnection())
            {
                Log.Print("No network connection or firewall blocked.");
                return;
            }

            try
            {
                using (var wc = new WebClient())
                {
                    wc.Encoding = System.Text.Encoding.UTF8;
                    wc.DownloadStringCompleted += LastVersion_DownloadStringCompleted;
                    wc.DownloadStringAsync(new Uri(config.Repository));
                }
            }
            catch (Exception e)
            {
                Log.Print(e.Message);
                Log.Print($"Error checking update.");
            }
        }
Example #2
0
 public static void CheckUpdate(UnityModManager.ModEntry modEntry)
 {
     status = Status.checkUpdateing;
     if (!UnityModManager.HasNetworkConnection())
     {
         status = Status.networkError;
         return;
     }
     DateFile.instance.StartCoroutine(HasNewerVersion(modEntry, checkUpdateUrl));
 }
Example #3
0
 public static void CheckUpdate(UnityModManager.ModEntry modEntry)
 {
     status = Status.checkUpdateing;
     if (!UnityModManager.HasNetworkConnection())
     {
         status = Status.networkError;
         return;
     }
     SingletonObject.getInstance <YieldHelper>().StartYield(HasNewerVersion(modEntry, checkUpdateUrl));
 }
Example #4
0
        private void CheckModUpdates()
        {
            if (selectedGame == null)
            {
                return;
            }

            if (!UnityModManager.HasNetworkConnection())
            {
                return;
            }

            if (!repositories.ContainsKey(selectedGame))
            {
                repositories.Add(selectedGame, new HashSet <UnityModManager.Repository.Release>());
            }

            var urls = new HashSet <string>();

            foreach (var mod in mods)
            {
                if (!string.IsNullOrEmpty(mod.Repository))
                {
                    urls.Add(mod.Repository);
                }
            }

            if (urls.Count > 0)
            {
                foreach (var url in urls)
                {
                    try
                    {
                        using (var wc = new WebClient())
                        {
                            wc.Encoding = System.Text.Encoding.UTF8;
                            wc.DownloadStringCompleted += (sender, e) => { ModUpdates_DownloadStringCompleted(sender, e, selectedGame, url); };
                            wc.DownloadStringAsync(new Uri(url));
                        }
                    }
                    catch (Exception e)
                    {
                        Log.Print(e.Message);
                        Log.Print($"Error checking updates on '{url}'.");
                    }
                }
            }
        }