示例#1
0
        public override void Tick()
        {
            if (fetcher == null || failed)
            {
                return;
            }
            CheckCurrentProgress();

            if (!fetcher.Check(SetStatus))
            {
                failed = true;
            }

            if (!fetcher.Done)
            {
                return;
            }
            if (ResourceList.GetFetchFlags() != 0)
            {
                ResourcePatcher patcher = new ResourcePatcher(fetcher, drawer);
                patcher.Run();
            }

            fetcher = null;
            GC.Collect();
            game.TryLoadTexturePack();
            GotoNextMenu(0, 0);
        }
示例#2
0
    private async Task RunApplyLiveOnlyMerge(StandardTestYaml testYaml)
    {
        IResourcePatcher patcher = new ResourcePatcher();

        var parameters = new CreatePatchParameters
        {
            ApplyResource = testYaml.Apply,
            LiveResource  = testYaml.Live,
        };

        if (testYaml.ResourceKind != null)
        {
            parameters.ResourceKind = await Manager.GetResourceKindAsync(
                testYaml.ResourceKind.ApiVersion,
                testYaml.ResourceKind.Kind);
        }

        var patch = patcher.CreateJsonPatch(parameters);

        var operations = new ResourceSerializers().Convert <List <PatchOperation> >(patch);

        var expected = testYaml.Patch.OrderBy(op => op.ToString()).ToList();

        operations = operations.OrderBy(op => op.ToString()).ToList();
        Assert.Equal(expected, operations);
    }