Ejemplo n.º 1
0
        private void AboutForm_Load(object sender, EventArgs e)
        {
            lblUpdateCheck.Text = "新しいバージョンがあるかチェックしています...";

            // バージョンチェック
            Action versionCheckTask = () =>
            {
                var updateInfo = UpdateUtils.checkSoftwareUpdate();

                Action updateAction = () =>
                {
                    lblUpdateCheck.Text      = updateInfo.CheckResultMessage;
                    lblUpdateCheck.ForeColor = updateInfo.CheckResultMessageColor;
                    if (updateInfo.IsReleaseNewVersion)
                    {
                        UpdateUtils.showUpdateConfirmMessage(updateInfo.NewFileVersion);
                    }
                };
                if (this.IsHandleCreated)
                {
                    this.BeginInvoke(updateAction);
                }
            };

            LinearAudioPlayer.WorkerThread.EnqueueTask(versionCheckTask);
        }
Ejemplo n.º 2
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            var message1 = "AimSequences have been split to With*AimAnimation.\n"
                           + "The following actors have been updated and might need manual adjustments:\n"
                           + UpdateUtils.FormatMessageList(aimAnimLocations.Select(n => n.Item1 + " (" + n.Item2 + ")"));

            if (aimAnimLocations.Any())
            {
                yield return(message1);
            }

            aimAnimLocations.Clear();

            var message2 = "ReloadPrefixes have been removed.\n"
                           + "Instead, grant a condition on reloading via Armament.ReloadingCondition to enable\n"
                           + "an alternate sprite body (with reloading sequences) on the following actors:\n"
                           + UpdateUtils.FormatMessageList(reloadPrefixLocations.Select(n => n.Item1 + " (" + n.Item2 + ")"));

            if (reloadPrefixLocations.Any())
            {
                yield return(message2);
            }

            reloadPrefixLocations.Clear();
        }
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            var message = "You must define a set of Locomotor traits on the World actor for the different\n"
                          + "movement classes used in your mod (e.g. Infantry, Vehicles, Tanks, Ships, etc)\n"
                          + "and replace any definitions/overrides of the following properties on each\n"
                          + "actor with a Locomotor field referencing the appropriate locomotor type.\n\n"
                          + "The standard Locomotor definition contains the following fields:\n"
                          + UpdateUtils.FormatMessageList(locomotorFields) + "\n\n";

            if (subterraneanUsed)
            {
                message += "Actors using the subterranean logic should reference a SubterraneanLocomotor\n"
                           + "instance that extends Locomotor with additional fields:\n"
                           + UpdateUtils.FormatMessageList(subterraneanFields) + "\n\n";
            }

            if (jumpjetUsed)
            {
                message += "Actors using the jump-jet logic should reference a JumpjetLocomotor\n"
                           + "instance that extends Locomotor with additional fields:\n"
                           + UpdateUtils.FormatMessageList(jumpjetFields) + "\n\n";
            }

            message += "Condition definitions have been automatically migrated.\n"
                       + "The following definitions reference fields that must be manually moved to Locomotors:\n"
                       + UpdateUtils.FormatMessageList(locations.Select(n => n.Item1 + " (" + n.Item2 + ")"));

            if (locations.Any())
            {
                yield return(message);
            }

            locations.Clear();
        }
Ejemplo n.º 4
0
 string BuildMessage(Tuple <string, string, string, List <string> > field)
 {
     return("The default value for {0}.{1} has been removed.\n".F(field.Item1, field.Item2) +
            "You may wish to explicitly define `{0}: {1}` on the `{2}` trait \n".F(field.Item2, field.Item3, field.Item1) +
            "definitions on the following actors (if they have not already been inherited from a parent).\n" +
            UpdateUtils.FormatMessageList(field.Item4));
 }
Ejemplo n.º 5
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (customPips && locations.Any())
            {
                yield return("Custom pip Images and Palettes are now defined on the individual With*PipsDecoration traits.\n" +
                             "You should review the following definitions and manually define the Image and Palette properties as required:\n" +
                             UpdateUtils.FormatMessageList(locations));
            }

            if (cargoCustomPips.Any() && cargoPipLocations.Any())
            {
                yield return("Some passenger types define custom cargo pips. Review the following definitions:\n" +
                             UpdateUtils.FormatMessageList(cargoPipLocations) +
                             "\nand, if required, add the following to the WithCargoPipsDecoration traits:\n" +
                             "CustomPipSequences:\n" + cargoCustomPips.Select(p => "\t{0}: {1}".F(p, PipReplacements[p])).JoinWith("\n"));
            }

            if (harvesterCustomPips.Any() && harvesterPipLocations.Any())
            {
                yield return("Review the following definitions:\n" +
                             UpdateUtils.FormatMessageList(harvesterPipLocations) +
                             "\nand, if required, add the following to the WithHarvesterPipsDecoration traits:\n" +
                             "ResourceSequences:\n" + harvesterCustomPips.Select(kv => "\t{0}: {1}".F(kv.Key, PipReplacements[kv.Value])).JoinWith("\n"));
            }

            customPips = false;
            locations.Clear();
            cargoPipLocations.Clear();
            harvesterPipLocations.Clear();
        }
Ejemplo n.º 6
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (captureManagerLocations.Any())
            {
                yield return("The Captures and Capturable traits now depend on the\n" +
                             "new CaptureManager trait. This trait has automatically been added\n" +
                             "in the following definitions:\n" + UpdateUtils.FormatMessageList(captureManagerLocations) +
                             "\nYou may wish to review these definitions and delete any redundant\n" +
                             "instances that have already been inherited from a parent template.");
            }

            if (sabotageLocations.Any())
            {
                yield return("The sabotage logic has been disabled by default, which affects\n" +
                             "the following definitions:\n" + UpdateUtils.FormatMessageList(sabotageLocations) +
                             "\nThe sabotage logic is now defined on the Captures trait, via the \n" +
                             "SabotageThreshold field. You may need to define additional capture types\n" +
                             "and Capturable traits if you wish to use multiple capture thresholds.");
            }

            if (externalDelayLocations.Any())
            {
                yield return("The following actors have had their capture delays reset to 15 seconds:\n" +
                             UpdateUtils.FormatMessageList(sabotageLocations) +
                             "\nThe capture delay is now defined on the Captures trait, via the\n" +
                             "CaptureDelay field. You may need to define additional capture types\n" +
                             "and Capturable traits if you wish to use multiple capture delays.");
            }

            captureManagerLocations.Clear();
            sabotageLocations.Clear();
            externalDelayLocations.Clear();
        }
Ejemplo n.º 7
0
        static bool CheckNeedUpdate(string[] args, UpdateRequest request)
        {
            if (Debugger.IsAttached)
            {
                return(true);
            }
            if (args.Contains("-runnow=1"))
            {
                return(true);
            }
            string programDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Updater\\V1.0.0");

            if (!AppDomain.CurrentDomain.BaseDirectory.StartsWith(programDataPath))
            {
                //不在program data下执行,就不执行升级操作
                Console.WriteLine("正在复制文件到:" + programDataPath);
                UpdateUtils.TryReplaceFile(AppDomain.CurrentDomain.BaseDirectory, programDataPath, new List <string> {
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Temp"),
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs")
                });
                FileInfo fi          = new FileInfo(Assembly.GetExecutingAssembly().Location);
                string   executePath = Path.Combine(programDataPath, fi.Name);
                //重新组织命令行参数
                var newArgs = args.ToList();
                newArgs.RemoveAll(x => x.StartsWith("-r") || x.StartsWith("-p"));
                newArgs.Add("-r=\"" + request.RootPath + "\"");
                newArgs.Add("-p=\"" + request.PackagePath + "\"");
                ProcessHelper.StartProcess(executePath, String.Join(" ", newArgs));
                return(false);
            }
            return(true);
        }
Ejemplo n.º 8
0
        private static async Task PerformOperation(DownloadRequestOptions o)
        {
            Logging.Log("Checking for updates...");

            CTAC   ctac  = new(o.ReportingSku, o.ReportingVersion, o.MachineType, o.FlightRing, o.FlightingBranchName, o.BranchReadinessLevel, o.CurrentBranch, o.ReleaseType, o.SyncCurrentVersionOnly, ContentType : o.ContentType);
            string token = string.Empty;

            if (!string.IsNullOrEmpty(o.Mail) && !string.IsNullOrEmpty(o.Password))
            {
                token = await MBIHelper.GenerateMicrosoftAccountTokenAsync(o.Mail, o.Password);
            }

            IEnumerable <UpdateData> data = await FE3Handler.GetUpdates(null, ctac, token, FileExchangeV3UpdateFilter.ProductRelease);

            data = data.Select(x => UpdateUtils.TrimDeltasFromUpdateData(x));

            foreach (UpdateData update in data)
            {
                await ProcessUpdateAsync(update, o.OutputFolder, o.MachineType, o.Language, o.Edition, true);

                //await BuildUpdateXml(update, o.MachineType);
            }
            Logging.Log("Completed.");
            if (Debugger.IsAttached)
            {
                Console.ReadLine();
            }
        }
Ejemplo n.º 9
0
 public string GetVersion()
 {
     if (AutoUpdate.Context != null)
         return UpdateUtils.GetVersion(AutoUpdate.Context);
     else
         return "";
 }
Ejemplo n.º 10
0
        public override void onAddCallBack <T>(T data)
        {
            if (data is UIData)
            {
                Debug.Log("Toast position: " + this.transform.localPosition);
                UIData uiData = data as UIData;
                // Child
                {
                    uiData.state.allAddCallBack(this);
                }
                dirty = true;
                return;
            }
            // Child
            if (data is UIData.State)
            {
                UIData.State state = data as UIData.State;
                // Update
                {
                    switch (state.getType())
                    {
                    case UIData.State.Type.Hide:
                    {
                        Hide hide = state as Hide;
                        UpdateUtils.makeUpdate <HideUpdate, Hide>(hide, this.transform);
                    }
                    break;

                    case UIData.State.Type.Appear:
                    {
                        Appear appear = state as Appear;
                        UpdateUtils.makeUpdate <AppearUpdate, Appear>(appear, this.transform);
                    }
                    break;

                    case UIData.State.Type.Show:
                    {
                        Show show = state as Show;
                        UpdateUtils.makeUpdate <ShowUpdate, Show>(show, this.transform);
                    }
                    break;

                    case UIData.State.Type.Disappear:
                    {
                        Disappear disappear = state as Disappear;
                        UpdateUtils.makeUpdate <DisappearUpdate, Disappear>(disappear, this.transform);
                    }
                    break;

                    default:
                        Logger.LogError("unknown type: " + state.getType());
                        break;
                    }
                }
                dirty = true;
                return;
            }
            Debug.LogError("Don't process: " + data + "; " + this);
        }
Ejemplo n.º 11
0
 public override void Entry(IModHelper helper)
 {
     updateData = helper.Data.ReadJsonFile <UpdateData>("manifest.json");
     if (UpdateUtils.isNewVersion(updateData))
     {
         Monitor.Log("You can update mod:" + updateData.contactDatas[0].websiteLink, LogLevel.Warn);
     }
 }
Ejemplo n.º 12
0
 string BuildMessage(TraitWrapper t)
 {
     return("Default notification values have been removed from {0}.\n".F(t.Trait) +
            "You may wish to explicitly define the following overrides:\n   " + t.Trait + ":\n" +
            UpdateUtils.FormatMessageList(t.Fields.Select(kv => "   " + kv.Key + ": " + kv.Value), separator: "  ") +
            "\non the following actors (if they have not already been inherited from a parent).\n" +
            UpdateUtils.FormatMessageList(t.Uses));
 }
Ejemplo n.º 13
0
        static void ApplyRules(ModData modData, IReadWritePackage mapPackage, IEnumerable <UpdateRule> rules)
        {
            var externalFilenames = new HashSet <string>();

            foreach (var rule in rules)
            {
                Console.WriteLine("{0}: {1}", rule.GetType().Name, rule.Name);
                var mapFiles    = new YamlFileSet();
                var manualSteps = new List <string>();

                Console.Write("   Updating map... ");

                try
                {
                    manualSteps = UpdateUtils.UpdateMap(modData, mapPackage, rule, out mapFiles, externalFilenames);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("FAILED");

                    Console.WriteLine();
                    Console.WriteLine("   The automated changes for this rule were not applied because of an error.");
                    Console.WriteLine("   After the issue reported below is resolved you should run the updater");
                    Console.WriteLine("   with SOURCE set to {0} to retry these changes", rule.GetType().Name);
                    Console.WriteLine();
                    Console.WriteLine("   The exception reported was:");
                    Console.WriteLine("     " + ex.ToString().Replace("\n", "\n     "));
                    continue;
                }

                // Files are saved after each successful automated rule update
                mapFiles.Save();
                Console.WriteLine("COMPLETE");

                if (manualSteps.Any())
                {
                    Console.WriteLine("   Manual changes are required to complete this update:");
                    foreach (var manualStep in manualSteps)
                    {
                        Console.WriteLine("    * " + manualStep.Replace("\n", "\n      "));
                    }
                }

                Console.WriteLine();
            }

            if (externalFilenames.Any())
            {
                Console.WriteLine("The following shared yaml files referenced by the map have been ignored:");
                Console.WriteLine(UpdateUtils.FormatMessageList(externalFilenames));
                Console.WriteLine("These files are assumed to have already been updated by the --update-mod command");
                Console.WriteLine();
            }

            Console.WriteLine("Semi-automated update complete.");
            Console.WriteLine("Please review the messages above for any manual actions that must be applied.");
        }
        public async void CheckUpdate()
        {
            //版本更新
            //var updateService = App.ContainerProvider.Resolve<IUpdateService>();
            UpdateInfo updateInfo = await _updateService.GetCurrentVersion();

            UpdateConfig.AlertFunc = new Action <Activity, string>(Complated);
            //
            UpdateUtils.Update(mainActivity, updateInfo);
        }
Ejemplo n.º 15
0
 public override void Entry(IModHelper helper)
 {
     updateData = helper.Data.ReadJsonFile <UpdateData>("manifest.json");
     if (UpdateUtils.isNewVersion(updateData))
     {
         Monitor.Log("You can update mod:" + updateData.contactDatas[0].websiteLink, LogLevel.Warn);
     }
     Config = helper.ReadConfig <Config>();
     helper.Events.Input.ButtonPressed += onButton;
 }
Ejemplo n.º 16
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (weaponsToUpdate.Any())
            {
                yield return("Add a ScreenShakeWarhead to the following weapons:\n" +
                             UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => $"Weapon `{x.Item1}`, used by trait `{x.Item2}` on actor {x.Item3}")));
            }

            weaponsToUpdate.Clear();
        }
Ejemplo n.º 17
0
 public override IEnumerable <string> AfterUpdate(ModData modData)
 {
     if (actors.Any())
     {
         yield return("Actor ids starting with '^' are now reserved for abstract\n" +
                      "inheritance templates, and will not be parsed by the game.\n" +
                      "Check the following definitions and rename them if they are not used for inheritance:\n" +
                      UpdateUtils.FormatMessageList(actors.Select(n => n.Key + " (" + n.Value.Select(v => v.Location.Filename).JoinWith(", ") + ")")));
     }
 }
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("You must define new Color fields on the following traits:\n" +
                             UpdateUtils.FormatMessageList(locations));
            }

            locations.Clear();
        }
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (weaponsToUpdate.Any())
            {
                yield return("Add a FlashPaletteEffectWarhead to the following weapons:\n" +
                             UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => "Weapon `{0}`, used by trait `{1}` on actor {2}".F(x.Item1, x.Item2, x.Item3))));
            }

            weaponsToUpdate.Clear();
        }
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("Please check and adjust the new auto-generated dimensions.\n" +
                             UpdateUtils.FormatMessageList(locations));
            }

            locations.Clear();
        }
Ejemplo n.º 21
0
 public string GetVersion()
 {
     if (AutoUpdate.Context != null)
     {
         return(UpdateUtils.GetVersion(AutoUpdate.Context));
     }
     else
     {
         return("");
     }
 }
 public string GetVersion()
 {
     if (mainActivity != null)
     {
         return(UpdateUtils.GetVersion(mainActivity));
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 23
0
 public void  testCompareVersion()
 {
     Assert.IsTrue(UpdateUtils.CompareVersion("1.0.12", "0.0.3"));
     Assert.IsFalse(UpdateUtils.CompareVersion("0.0.2", "0.0.2"));
     Assert.IsTrue(UpdateUtils.CompareVersion("0.2", "0.1.2"));
     Assert.IsFalse(UpdateUtils.CompareVersion("XXXX", "1.2.3"));
     Assert.IsFalse(UpdateUtils.CompareVersion("0.2", "0.2.2"));
     Assert.IsTrue(UpdateUtils.CompareVersion("0.2.2", "0.2"));
     Assert.IsTrue(UpdateUtils.CompareVersion("3", "2.4.18"));
     Assert.IsFalse(UpdateUtils.CompareVersion("1.1.2.123", "1.1.2."));
 }
Ejemplo n.º 24
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("The shadow palette overrides have been removed from the following locations:\n" +
                             UpdateUtils.FormatMessageList(locations) + "\n\n" +
                             "You may wish to inspect and change these.");
            }

            locations.Clear();
        }
Ejemplo n.º 25
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject, 0.1f);
     }
     else
     {
         instance = this;
     }
 }
Ejemplo n.º 26
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("The AttackSuicides trait has been removed from the following actors.\n" +
                             "You must manually define AttackFrontal, GrantConditionOnAttack, GrantConditionOnDeploy\n" +
                             "traits and create a dummy weapon to use for targeting:\n" +
                             UpdateUtils.FormatMessageList(locations));
            }

            locations.Clear();
        }
Ejemplo n.º 27
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("The way that decorations are positioned relative to the selection box has changed.\n" +
                             "Review the following definitions and define Margin properties as required:\n" +
                             UpdateUtils.FormatMessageList(locations.Select(
                                                               kv => kv.Key + ":\n" + UpdateUtils.FormatMessageList(kv.Value))));
            }

            locations.Clear();
        }
Ejemplo n.º 28
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("Some actor(s) defined a MinDamage of neither 'Heavy' nor 'Undamaged' on SmokeTrailWhenDamaged before update.\n" +
                             "Review the following definitions and add custom GrandConditionOnDamageState configs as required:\n" +
                             UpdateUtils.FormatMessageList(locations.Select(
                                                               kv => kv.Key + ":\n" + UpdateUtils.FormatMessageList(kv.Value))));
            }

            locations.Clear();
        }
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("The IgnoresVisibility flag has been removed from the targeting logic on the following actors:\n" +
                             UpdateUtils.FormatMessageList(locations) + "\n\n" +
                             "You may wish to enable TargetFrozenActors, or implement a custom Attack* trait like AttackSwallow\n" +
                             "if you require visibility to be completely ignored.");
            }

            locations.Clear();
        }
Ejemplo n.º 30
0
        public override IEnumerable <string> AfterUpdate(ModData modData)
        {
            if (locations.Any())
            {
                yield return("[D2k]ResourceRenderer has been added.\n" +
                             "You need to adjust the the field RenderTypes on trait [D2k]ResourceRenderer\n" +
                             "on the following actors:\n" +
                             UpdateUtils.FormatMessageList(locations));
            }

            locations.Clear();
        }