示例#1
0
 internal IEnumerator QueueProcess()
 {
     while (modRegisteredQueue.Count > 0)
     {
         yield return(ProcessQueueElement(modRegisteredQueue.Dequeue()));
     }
     Debug.Log(LOG + "All registered mod have been checked for newer versions. This update process is now complete.");
     ModUpdateLog.writeModUpdateLogFile();
 }
示例#2
0
 private void OnDestroy()
 {
     if ((modRegisteredForLateUpdateQueue.Count > 0) && this.enabled)
     {
         Debug.Log(LOG + "Starting late mod update deployement.");
         PerformLateUpdates();
     }
     ModUpdateLog.writeModUpdateLogFile();
 }
示例#3
0
 internal void Start()
 {
     if ((modRegisteredQueue.Count > 0) && this.enabled && !ConfigDeactivateThis.Value)
     {
         ModUpdateLog.readModUpdateLogFile();
         Debug.Log(LOG + "Checking updates for " + modRegisteredQueue.Count + " mod(s)...");
         StartCoroutine(ThunderAPI.GetPackages(LaunchQueueProcess));
     }
 }
 internal static void logModUpdate(ModUpdateLog modUpdateLog)
 {
     newModUpdateLogs.Add(modUpdateLog);
 }
 internal static bool checkIfSimilarUpdateAlreadyProceed(ModUpdateLog modUpdateLog)
 {
     return(oldModUpdateLogs.Contains(modUpdateLog));
 }
示例#6
0
        internal IEnumerator ProcessQueueElement(ModUpdateRequest modUpdateRequest)
        {
            Package pk;

            try { pk = Package.GetPackage(modUpdateRequest.packageName); }
            catch { yield break; }

            if ((pk.Versions == null) || pk.Versions.Length <= 0)
            {
                Debug.LogWarning(LOG + "Couldnt find versions for the package named '" + modUpdateRequest.packageName + "' in the package list. Update check will not be performed for that mod.");
                yield break;
            }
            else if (modUpdateRequest.currentVersion < pk.Versions[0].VersionNumber)
            {
                ModUpdateLog mul = new ModUpdateLog(modUpdateRequest.packageName, modUpdateRequest.currentVersion, pk.Versions[0].VersionNumber);

                if (ModUpdateLog.checkIfSimilarUpdateAlreadyProceed(mul))
                {
                    Debug.LogWarning(LOG + "Similar update already proceed last time. Maybe the modder forgot to change the version number ?");
                }
                else
                {
                    if (modUpdateRequest.flag.Equals(Flag.UpdateAlways))
                    {
                        yield return(StartPerformUpdate(modUpdateRequest, pk));
                    }
                    else if (modUpdateRequest.flag.Equals(Flag.UpdateIfSameDependencyOnlyElseWarnOnly))
                    {
                        bool sameDependencies;
                        try { sameDependencies = Package.EqualsDependecy(pk, modUpdateRequest.currentVersion); }
                        catch { yield break; }

                        if (!sameDependencies)
                        {
                            Debug.LogWarning(LOG + "An update for " + modUpdateRequest.packageName + " is available. Current version(" + modUpdateRequest.currentVersion.ToString() + "). Newest version (" + pk.Versions[0].VersionNumber.ToString() + ")."
                                             + System.Environment.NewLine + "However, the newest version uses a different dependency version. This mod specifie not to update automaticly in that case. Please go to " + pk.PackageUrl + " and update manually.");
                        }
                        else
                        {
                            yield return(StartPerformUpdate(modUpdateRequest, pk));
                        }
                    }
                    else if (modUpdateRequest.flag.Equals(Flag.UpdateIfSameDependencyOnlyElseWarnAndDeactivate))
                    {
                        if (Package.EqualsDependecy(pk, modUpdateRequest.currentVersion))
                        {
                            yield return(StartPerformUpdate(modUpdateRequest, pk));
                        }
                        else
                        {
                            Debug.LogWarning(LOG + "An update for " + modUpdateRequest.packageName + " is available. Current version(" + modUpdateRequest.currentVersion.ToString() + "). Newest version (" + pk.Versions[0].VersionNumber.ToString() + ")."
                                             + System.Environment.NewLine + "However, the newest version uses a different dependency version. This mod specifie not to update automaticly in that case and to deactivate the mod at the next game start. Please go to " + pk.PackageUrl + " and update manually.");

                            DeactivateMod(modUpdateRequest);
                        }
                    }
                    else if (modUpdateRequest.flag.Equals(Flag.WarnOnly))
                    {
                        Debug.LogWarning(LOG + "An update for " + modUpdateRequest.packageName + " is available. Current version(" + modUpdateRequest.currentVersion.ToString() + "). Newest version (" + pk.Versions[0].VersionNumber.ToString() + ")."
                                         + System.Environment.NewLine + "This mod specifie not to update automaticly. Please go to " + pk.PackageUrl + " and update manually.");
                    }
                    else if (modUpdateRequest.flag.Equals(Flag.WarnAndDeactivate))
                    {
                        Debug.LogWarning(LOG + "An update for " + modUpdateRequest.packageName + " is available. Current version(" + modUpdateRequest.currentVersion.ToString() + "). Newest version (" + pk.Versions[0].VersionNumber.ToString() + ")."
                                         + System.Environment.NewLine + "This mod specifie to deactivate the mod when you will close the game. Please go to " + pk.PackageUrl + " and reinstall manually.");
                        DeactivateMod(modUpdateRequest);
                    }
                }
                ModUpdateLog.logModUpdate(mul);
            }
            else if (pk.IsDeprecated)
            {
                Debug.LogWarning(LOG + pk.Name + "Has been flagged as deprecated. This means it doesnt work anymore. The mod will be deactivate when you will close the game except if you specified otherwise in the config file.");
                if (ConfigPerformDepreactedCheckAndRemove.Value)
                {
                    DeactivateMod(modUpdateRequest);
                }
            }
            else
            {
                Debug.Log(LOG + "The package (mod) named '" + modUpdateRequest.packageName + "' (" + modUpdateRequest.currentVersion.ToString() + ") is up to date.");
            }
        }