/// <summary>
        /// エクスポートメニュー項目がクリックされた時に通を受け取る。
        /// </summary>
        /// <param name="sender">送信元オブジェクト</param>
        /// <param name="e">イベントオブジェクト</param>
        private void OnMenuItemExportClick(object sender, EventArgs e)
        {
            if (saveFileDialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                string path = saveFileDialog.FileName;

                GeneratorSetting setting = new GeneratorSetting(1, 1);
                setting.ExportSetting.ExportFilePath = saveFileDialog.FileName;
                setting.ExportSetting.CharaChipSize  = AppData.Instance.GeneratorSetting.ExportSetting.CharaChipSize;
                Character.CopyTo(setting.GetCharacter(0));

                CharaChipExporter.ExportCharaChip(setting);

                MessageBox.Show(this, Resources.MessageExported, Resources.DialogTitleInformation);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, Resources.DialogTitleError);
            }
        }
Example #2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        private AppData()
        {
            materialLists = new MaterialList[] {
                new MaterialList(MaterialType.Accessories, Properties.Resources.NameAccessories),
                new MaterialList(MaterialType.HairStyles, Properties.Resources.NameHairStyles),
                new MaterialList(MaterialType.Eyes, Properties.Resources.NameEyes),
                new MaterialList(MaterialType.Heads, Properties.Resources.NameHeads),
                new MaterialList(MaterialType.Bodies, Properties.Resources.NameBodies),
                new MaterialList(MaterialType.HeadAccessories, Properties.Resources.NameHeadAccessories),
            };
            materialTable = new Dictionary <PartsType, MaterialType>();
            materialTable.Add(PartsType.Accessory1, MaterialType.Accessories);
            materialTable.Add(PartsType.Accessory2, MaterialType.Accessories);
            materialTable.Add(PartsType.Accessory3, MaterialType.Accessories);
            materialTable.Add(PartsType.Body, MaterialType.Bodies);
            materialTable.Add(PartsType.Eye, MaterialType.Eyes);
            materialTable.Add(PartsType.HairStyle, MaterialType.HairStyles);
            materialTable.Add(PartsType.Head, MaterialType.Heads);
            materialTable.Add(PartsType.HeadAccessory1, MaterialType.HeadAccessories);
            materialTable.Add(PartsType.HeadAccessory2, MaterialType.HeadAccessories);

            GeneratorSetting = new GeneratorSetting();

            templates = new Dictionary <string, Character>();
        }
Example #3
0
        private static void Generate(GeneratorSetting setting)
        {
            CodeSerializer.ResetDirectory(setting.OutputDirectory);

            GenerateStructAndParent(setting.OutputDirectory, "Tags", "TagName", NameGetter.GetTags());
            GenerateStructAndParent(setting.OutputDirectory, "Layers", "LayerName", NameGetter.GetLayers());
            GenerateStructAndParent(setting.OutputDirectory, "Scenes", "SceneName", NameGetter.GetScenes());
            GenerateStructAndParent(setting.OutputDirectory, "SortingLayers", "SortingLayerName",
                                    NameGetter.GetSortingLayers());

            AssetDatabase.Refresh();
        }
Example #4
0
        static bool Prefix(GeneratorSetting generatorSetting, HoldableSpawnPoint spawnPoint, int seed, ref Bomb __result)
        {
            var gameplayState = SceneManager.Instance.GameplayState;

            __result = gameplayState.GetValue <BombGenerator>("bombGenerator").CreateBomb(generatorSetting, spawnPoint, seed, BombTypeEnum.Default);

            if (modsLoading == 0)
            {
                gameplayState.Bombs.Add(__result);
            }

            return(false);
        }
Example #5
0
        static bool Prefix(GeneratorSetting generatorSetting, HoldableSpawnPoint spawnPoint, int seed, ref Bomb __result)
        {
            var gameplayState = SceneManager.Instance.GameplayState;
            var bombGenerator = gameplayState.GetValue <BombGenerator>("bombGenerator");

            ((log4net.Repository.Hierarchy.Logger)bombGenerator.GetValue <ILog>("logger").Logger).Level = Level.Notice;

            __result = bombGenerator.CreateBomb(generatorSetting, spawnPoint, seed, BombTypeEnum.Default);
            bombQueue.Enqueue(__result);

            if (modsLoading == 0)
            {
                gameplayState.Bombs.Add(__result);
            }

            return(false);
        }
    string resolveMissionID(string targetID, out string failureMessage)
    {
        failureMessage = null;
        ModManager     modManager = ModManager.Instance;
        List <Mission> missions   = modManager.ModMissions;

        Mission mission = missions.FirstOrDefault(x => Regex.IsMatch(x.name, "mod_.+_" + Regex.Escape(targetID), RegexOptions.CultureInvariant | RegexOptions.IgnoreCase));

        if (mission == null)
        {
            failureMessage = $"Unable to find a mission with an ID of \"{targetID}\".";
            return(null);
        }

        List <string> availableMods = GameInfo.GetAvailableModuleInfo().Where(x => x.IsMod).Select(y => y.ModuleId).ToList();

        if (MultipleBombs.Installed())
        {
            availableMods.Add("Multiple Bombs");
        }
        HashSet <string>         missingMods = new HashSet <string>();
        List <ModuleInformation> modules     = ComponentSolverFactory.GetModuleInformation().ToList();

        GeneratorSetting     generatorSetting = mission.GeneratorSetting;
        List <ComponentPool> componentPools   = generatorSetting.ComponentPools;

        foreach (ComponentPool componentPool in componentPools)
        {
            List <string> modTypes = componentPool.ModTypes;
            if (modTypes == null || modTypes.Count == 0)
            {
                continue;
            }
            foreach (string mod in modTypes.Where(x => !availableMods.Contains(x)))
            {
                missingMods.Add(modules.FirstOrDefault(x => x.moduleID == mod)?.moduleDisplayName ?? mod);
            }
        }
        if (missingMods.Count > 0)
        {
            failureMessage = $"Mission \"{targetID}\" was found, however, the following mods are not installed / loaded: {string.Join(", ", missingMods.OrderBy(x => x).ToArray())}";
            return(null);
        }

        return(mission.name);
    }
Example #7
0
 /// <summary>
 /// ファイル出力モード
 /// </summary>
 private static void RunGenerate()
 {
     try
     {
         GeneratorSettingReader reader = new GeneratorSettingReader();
         foreach (string path in filePaths)
         {
             GeneratorSetting setting = reader.Read(path);
             CharaChipExporter.ExportCharaChip(setting);
         }
         MessageBox.Show(Properties.Resources.MessageExported,
                         Properties.Resources.DialogTitleInformation);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, Properties.Resources.DialogTitleError);
     }
 }
Example #8
0
        protected virtual void doGenerate(GeneratorSetting setting, string pid, int depth = 0)
        {
            if (string.IsNullOrWhiteSpace(pid) || setting == null)
                return;

            var acts = Service.Activities.List(pid, setting.Collection);

            if (setting.UseDateRange)
                setting.MaxResults = 100;

            var step = setting.MaxResults / (double)100;
            string nextPage = string.Empty;

            if(users == null)
                users = new Dictionary<string, bool>();

            users[pid] = true;

            while (step != 0) {

                var nextResults = 100;
                if (step-- < 1) {
                    nextResults = (int)((step + 1) * 100);
                    step = 0;
                }

                step = step == 0 && setting.UseDateRange ? 1 : step;

                acts.MaxResults = nextResults;
                acts.PageToken = nextPage;

                if (haveStater) {
                    Stater.MaxPosition = nextResults;
                    Stater.SetState("Load feeds ...");
                }

                Dictionary<Activity, ActivityCont> dicdate = null;

                try {
                    var feed = acts.Fetch();

                    if (dicdate == null)
                        dicdate = new Dictionary<Activity, ActivityCont>();
                    dicdate.Clear();

                    nextPage = null;
                    if (feed.Error == null) {
                        nextPage = feed.NextPageToken;
                        if (string.IsNullOrWhiteSpace(nextPage)) {
                            step = 0;
                            Stater.Position = Stater.MaxPosition;
                        }

                        if (haveStater) {
                            Stater.MaxPosition = feed.Items.Count;
                            Stater.SetState("Parsing ...");
                        }

                        foreach (var item in feed.Items) {

                            if (setting.UseDateRange && !InRange(setting.DateFrom, setting.DateTo, item.Published)) {
                                if (IsOutLeft(setting.DateFrom, item.Published)) {
                                    step = 0;
                                    break;
                                }
                                continue;
                            }

                            var ditem = dicdate[item] = new ActivityCont();

                            if (item.Object != null) {

                                if (item.Verb == "share" &&
                                        !string.IsNullOrWhiteSpace(item.Object.Id)) {
                                    try {
                                        ditem.Share = Service.Activities.Get(item.Object.Id).Fetch();
                                    }
                                    catch (Exception e) {
                                        WriteLog(e, this);
                                    }
                                }

                                if (item.Object.Replies.TotalItems > 0) {
                                    var plser = Service.Comments.List(item.Id);
                                    plser.MaxResults = setting.MaxComments;
                                    try {
                                        var listpl = plser.Fetch();

                                        ditem.Comments = listpl.Items;
                                    }
                                    catch (Exception e) {
                                        WriteLog(e, this);
                                    }
                                }

                                if (item.Object.Plusoners.TotalItems > 0) {
                                    var plser = Service.People.ListByActivity(item.Id, PeopleResource.Collection.Plusoners);
                                    plser.MaxResults = setting.MaxPluses;

                                    try {
                                        var listpl = plser.Fetch();

                                        ditem.Plusers = listpl.Items;
                                    }
                                    catch (Exception e) {
                                        WriteLog(e, this);
                                    }
                                }

                                if (item.Object.Resharers.TotalItems > 0) {
                                    var plser = Service.People.ListByActivity(item.Id, PeopleResource.Collection.Resharers);
                                    plser.MaxResults = setting.MaxReshares;

                                    try {
                                        var listpl = plser.Fetch();

                                        ditem.Sharers = listpl.Items;
                                    }
                                    catch (Exception e) {
                                        WriteLog(e, this);
                                    }
                                }
                            }

                            if (haveStater)
                                Stater.Inc();
                        }

                        GenerateLogs(dicdate, setting, loggers);

                        if (depth > 0) {

                            foreach (var ditem in dicdate) {
                                try {
                                    var share = ditem.Value.Share;
                                    if (share != null) {
                                        if (share.Actor != null &&
                                        !string.IsNullOrWhiteSpace(share.Actor.Id) &&
                                        !users.ContainsKey(share.Actor.Id)) {
                                            users[share.Actor.Id] = true;
                                            doGenerate(setting, share.Actor.Id, depth - 1);
                                        }
                                    }
                                }
                                catch (Exception e) {
                                    WriteLog(e, this);
                                }

                                try {
                                    var coms = ditem.Value.Comments;

                                    if (coms != null) {
                                        foreach (var sitem in coms) {
                                            if (!users.ContainsKey(sitem.Actor.Id)) {
                                                users[sitem.Actor.Id] = true;
                                                doGenerate(setting, sitem.Actor.Id, depth - 1);
                                            }
                                            if (haveStater)
                                                Stater.Inc();
                                        }
                                    }
                                }
                                catch (Exception e) {
                                    WriteLog(e, this);
                                }

                                try {
                                    var pluses = ditem.Value.Plusers;
                                    if (pluses != null) {
                                        foreach (var sitem in pluses) {
                                            if (!users.ContainsKey(sitem.Id)) {
                                                users[sitem.Id] = true;
                                                doGenerate(setting, sitem.Id, depth - 1);
                                            }
                                            if (haveStater)
                                                Stater.Inc();
                                        }
                                    }
                                }
                                catch (Exception e) {
                                    WriteLog(e, this);
                                }

                                try {
                                    var shares = ditem.Value.Sharers;
                                    if (shares != null) {
                                        foreach (var sitem in shares) {
                                            if (!users.ContainsKey(sitem.Id)) {
                                                users[sitem.Id] = true;
                                                doGenerate(setting, sitem.Id, depth - 1);
                                            }
                                            if (haveStater)
                                                Stater.Inc();
                                        }
                                    }
                                }
                                catch (Exception e) {
                                    WriteLog(e, this);
                                }
                            }

                            if (haveStater)
                                Stater.Inc();
                        }
                    }
                    else {
                        WriteLog(feed.Error.ToString(), this);
                    }
                }
                catch (Exception e) {
                    WriteLog(e, this);
                    e.ShowError();
                    step = 0;
                }
            }
        }
    static void HandleGeneratorSetting(GeneratorSetting generatorSetting, ObjectPool prefabPool)
    {
        bool frontFaceOnly  = generatorSetting.FrontFaceOnly;
        int  componentCount = generatorSetting.ComponentPools.Where(pool => pool.ModTypes == null || pool.ModTypes.Count == 0 || !(pool.ModTypes.Contains("Factory Mode") || pool.ModTypes[0].StartsWith("Multiple Bombs"))).Sum(pool => pool.Count) + 1;

        Dictionary <GameObject, int> bombcases = prefabPool.Objects
                                                 .Where(gameobject => gameobject != null && gameobject.GetComponent <KMBomb>() != null)
                                                 .ToDictionary(gameobject => gameobject, gameobject =>
        {
            if (!frontFaceOnly)
            {
                return(gameobject.GetComponent <KMBomb>().Faces.Select(face => face.Anchors.Count).Sum());
            }
            else
            {
                return(gameobject.GetComponent <KMBomb>().Faces[0].Anchors.Count);
            }
        });

        bombcases.Add(prefabPool.Default, !frontFaceOnly ? 12 : 6);

        // Generate a case using Case Generator
        if (Tweaks.CaseGeneratorSettingCache)
        {
            List <Vector2> caseSizes = new List <Vector2>();
            for (int x = 1; x <= componentCount; x++)
            {
                for (int y = 1; y <= componentCount; y++)
                {
                    if (x >= y)
                    {
                        caseSizes.Add(new Vector2(x, y));
                    }
                }
            }

            var caseSize = caseSizes
                           .Where(size => size.y / size.x >= 0.5f && size.x * size.y * (frontFaceOnly ? 1 : 2) >= componentCount)
                           .OrderBy(size => System.Math.Abs(size.x * size.y * (frontFaceOnly ? 1 : 2) - componentCount))
                           .ThenByDescending(size => size.y / size.x)
                           .FirstOrDefault();

            if (caseSize != default)
            {
                var caseGameObject = BombCaseGenerator.GenerateCase(caseSize, CaseParent.transform);

                bombcases.Add(caseGameObject, (int)(caseSize.x * caseSize.y * (frontFaceOnly ? 1 : 2)));

                if (previousGeneratedCase != null)
                {
                    bombcases.Remove(previousGeneratedCase);
                }

                previousGeneratedCase = caseGameObject;
            }
        }

        if (bombcases.Count == 0)
        {
            Debug.LogError("[BetterCasePicker] Unable to find any bomb cases to use");
            return;
        }

        var validBombCases = bombcases.Where(pair => pair.Value >= componentCount);
        var minBombCases   = !validBombCases.Any() ?
                             bombcases.Where(pair => pair.Value == bombcases.Max(pair2 => pair2.Value)) :
                             validBombCases.Where(pair => pair.Value == validBombCases.Min(pair2 => pair2.Value));

        prefabPool.Objects = minBombCases.Select(x => x.Key).ToList();
    }
Example #10
0
        public GeneratorSetting Clone()
        {
            var item = new GeneratorSetting();

            var arr = this.GetType().GetProperties().ToArray();

            foreach (var prop in arr) {
                prop.SetValue(item, prop.GetValue(this, null), null);
            }

            return item;
        }
Example #11
0
        static bool Prefix(BombGenerator __instance, BombFace selectedFace, BombComponent bombComponentPrefab, GeneratorSetting settings)
        {
            var bomb = __instance.GetValue <Bomb>("bomb");
            var type = bombComponentPrefab.ComponentType;

            // Let the timer component spawn normally and record the bomb's information.
            if (type == ComponentTypeEnum.Timer)
            {
                allBombInfo.Add(bomb, new BombInfo(settings, selectedFace, __instance.GetValue <Random>("rand")));

                return(true);
            }

            // If we don't have information about a bomb, just let it go through.
            if (!allBombInfo.TryGetValue(bomb, out BombInfo bombInfo))
            {
                return(true);
            }

            // Once we're ready to instantiate the components, this allows us to call the original method again.
            if (bombInfo.EnableOriginal)
            {
                return(true);
            }

            // If the generator is trying to fill the bomb with empty components, clear the valid faces to skip over it.
            if (type == ComponentTypeEnum.Empty)
            {
                __instance.GetValue <List <BombFace> >("validBombFaces").Clear();
                return(false);
            }

            // Start loading any fake modules.
            if (bombComponentPrefab.GetComponent <FakeModule>() != null)
            {
                __instance.StartCoroutine(LoadModule(bombComponentPrefab, bombInfo));
            }
            else
            {
                bombInfo.Components.Add(bombComponentPrefab);
            }

            return(false);
        }
Example #12
0
 public BombInfo(GeneratorSetting settings, BombFace timerFace, Random rand)
 {
     Settings  = settings;
     TimerFace = timerFace;
     Rand      = rand;
 }
Example #13
0
        static bool Prefix(BombGenerator __instance, BombFace selectedFace, BombComponent bombComponentPrefab, GeneratorSetting settings)
        {
            var bomb = __instance.GetValue <Bomb>("bomb");
            var type = bombComponentPrefab.ComponentType;

            // Let the timer component spawn normally and record the bomb's information.
            if (type == ComponentTypeEnum.Timer)
            {
                allBombInfo.Add(bomb, new BombInfo(settings, selectedFace, __instance.GetValue <Random>("rand")));

                void logCallback(string condition, string _, LogType __)
                {
                    if (!condition.StartsWith("[BombGenerator] Bomb component list: "))
                    {
                        return;
                    }

                    // Replace the Random object with a fake one, so that we can make the consistent RNG calls later.
                    __instance.SetValue("rand", new FakeRandom());

                    Application.logMessageReceived -= logCallback;
                }

                Application.logMessageReceived += logCallback;

                return(true);
            }

            // If we don't have information about a bomb, just let it go through.
            if (!allBombInfo.TryGetValue(bomb, out BombInfo bombInfo))
            {
                return(true);
            }

            // Once we're ready to instantiate the components, this allows us to call the original method again.
            if (bombInfo.EnableOriginal)
            {
                return(true);
            }

            // If the generator is trying to fill the bomb with empty components, clear the valid faces to skip over it.
            if (type == ComponentTypeEnum.Empty)
            {
                __instance.GetValue <List <BombFace> >("validBombFaces").Clear();
                return(false);
            }

            // Start loading any fake modules.
            if (bombComponentPrefab.GetComponent <FakeModule>() != null)
            {
                __instance.StartCoroutine(LoadModule(bombComponentPrefab, bombInfo));
            }
            else
            {
                bombInfo.Components.Add(bombComponentPrefab);
            }

            return(false);
        }
Example #14
0
        protected override void doGenerate(GeneratorSetting setting, string word, int depth)
        {
            if (string.IsNullOrWhiteSpace(word) || setting == null)
                return;

            curWord = word;

            var acts = Service.Activities.Search(word);

            if (setting.UseDateRange)
                setting.MaxResults = 20;

            var step = setting.MaxResults / (double)20;
            string nextPage = string.Empty;

            if (users == null)
                users = new Dictionary<string, bool>();

            users[word] = true;

            while (step != 0) {

                var nextResults = 20;
                if (step-- < 1) {
                    nextResults = (int)((step + 1) * 20);
                    step = 0;
                }

                step = step == 0 && setting.UseDateRange ? 1 : step;

                acts.MaxResults = nextResults;
                acts.PageToken = nextPage;
                acts.OrderBy = Google.Apis.Plus.v1.ActivitiesResource.OrderBy.Recent;

                if (haveStater) {
                    Stater.MaxPosition = nextResults;
                    Stater.SetState("Load feeds ...");
                }

                Dictionary<Activity, ActivityCont> dicdate = null;

                try {
                    var feed = acts.Fetch();

                    if (dicdate == null)
                        dicdate = new Dictionary<Activity, ActivityCont>();
                    dicdate.Clear();

                    nextPage = null;
                    if (feed.Error == null) {
                        nextPage = feed.NextPageToken;
                        if (string.IsNullOrWhiteSpace(nextPage)) {
                            step = 0;
                            Stater.Position = Stater.MaxPosition;
                        }

                        if (haveStater) {
                            Stater.MaxPosition = feed.Items.Count;
                            Stater.SetState("Parsing ...");
                        }

                        foreach (var item in feed.Items) {

                            if (setting.UseDateRange && !InRange(setting.DateFrom, setting.DateTo, item.Published)) {
                                if (IsOutLeft(setting.DateFrom, item.Published)) {
                                    step = 0;
                                    break;
                                }
                                continue;
                            }

                            var ditem = dicdate[item] = new ActivityCont();

                            if (haveStater)
                                Stater.Inc();
                        }

                        GenerateLogs(dicdate, setting, loggers);

                    }
                    else {
                        WriteLog(feed.Error.ToString(), this);
                    }
                }
                catch (Exception e) {
                    WriteLog(e, this);
                    e.ShowError();
                    step = 0;
                }
            }
        }
Example #15
0
        protected virtual void GenerateLogs(Dictionary<Activity, ActivityCont> data, 
            GeneratorSetting setting, Dictionary<Visualizers.Types, Appender> loggers)
        {
            if (haveStater)
                Stater.StateLabel = "Generation ...";

            if (haveStater) {
                Stater.MaxPosition = data.Count * loggers.Count;
                Stater.SetState("Generate logs ...", 0);
            }

            foreach (var log in loggers.Keys) {
                var rules = setting.Rules[log];

                foreach (var dicitem in data) {

                    setting.Methods[log](loggers, log, rules, dicitem);

                    //LogGen(loggers, log.Key, rules, dicitem);

                    if (haveStater)
                        Stater.Inc();
                }
            }
        }
Example #16
0
        private void Generate(string idProfile, StateControl sc, Visualizers.Types flags, Dictionary<Visualizers.Types, string> filenames)
        {
            var sett = new GeneratorSetting() {
                ProfileID = /*"101113754039426612780"*/idProfile,
                Rules = rules,
                VisLogs = (Visualizers.Types)flags,
                LogFiles = filenames,
                Methods = new Dictionary<Visualizers.Types, GeneratorLogsMeth> {
                    //UD
                    {Visualizers.Code_swarm, UDGenerator.LogGen},
                    {Visualizers.Gource, Generator.LogGen},
                    {Visualizers.Logstalgia, Generator.LogGen},
                    {Visualizers.Gephi, Generator.LogGen},
                },
                MaxResults = Convert.ToInt32(nudMaxRes.Value),
                MaxComments = Convert.ToInt32(nudMaxComment.Value),
                MaxPluses = Convert.ToInt32(nudMaxPlus.Value),
                MaxReshares = Convert.ToInt32(nudMaxReshare.Value),
                Deep = checkBox1.Checked ? Convert.ToInt32(nudDeep.Value) : 0
            };

            //UD
            if (checkBox2.Checked) {
                new FollowersGenerator(apikey.Text, sc).Run(sett);
            }
            else {
                if (checkBox1.Checked)
                    (Program.OAuth2 != null ? new RGenerator(Program.OAuth2, sc) : new RGenerator(apikey.Text, sc)).Run(sett);
                else
                    (Program.OAuth2 != null ? new RGenerator(Program.OAuth2, sc) : new Generator(apikey.Text, sc)).Run(sett);
            }
        }
Example #17
0
        public static ExtendedMissionDetails ReadMission(Mission mission, bool removeComponentPools, out ComponentPool componentPool)
        {
            // todo: NESTING HELL. Fix
            componentPool = new ComponentPool();
            ExtendedMissionDetails missionDetails = new ExtendedMissionDetails();

            if (mission.GeneratorSetting != null)
            {
                GeneratorSetting generatorSetting = UnityEngine.Object.Instantiate(mission).GeneratorSetting;
                if (generatorSetting.ComponentPools != null)
                {
                    for (int i = generatorSetting.ComponentPools.Count - 1; i >= 0; i--)
                    {
                        ComponentPool pool = generatorSetting.ComponentPools[i];
                        if (pool.ModTypes != null && pool.ModTypes.Count > 0)
                        {
                            for (int j = pool.ModTypes.Count - 1; j >= 0; j--)
                            {
                                string modType = pool.ModTypes[j];
                                if (modType.StartsWith("Extended Settings"))
                                {
                                    int bracketIndex = modType.IndexOf('{');
                                    if (bracketIndex == -1)
                                    {
                                        Debug.LogFormat("[Extended Mission Settings] Encountered missing Json in mission {0}", mission);
                                        missionDetails.InvalidJson = true;
                                        continue;
                                    }
                                    string settings;
                                    settings = modType.Substring(bracketIndex).Trim();
                                    JObject o1;
                                    try {
                                        o1 = JObject.Parse(settings);
                                    }
                                    catch (Exception e) {
                                        Debug.LogFormat("[Extended Mission Settings] Encountered invalid Json in mission {0}: {1}", mission, settings);
                                        Debug.Log(e.Message);
                                        missionDetails.InvalidJson = true;
                                        continue;
                                    }
                                    foreach (var o in o1.Properties())
                                    {
                                        if (o.Value.Type == JTokenType.String || o.Value.Type == JTokenType.Integer)
                                        {
                                            DictionaryAdd(missionDetails.ExtendedSettings, o.Name.ToString(), o.Value.ToString());
                                        }
                                        else if (o.Value.Type == JTokenType.Array)
                                        {
                                            foreach (var p in o.Value)
                                            {
                                                DictionaryAdd(missionDetails.ExtendedSettings, o.Name.ToString(), p.ToString());
                                            }
                                        }
                                    }
                                    generatorSetting.ComponentPools[i].ModTypes.RemoveAt(j);
                                    if (removeComponentPools)
                                    {
                                        if (componentPool.ModTypes == null)
                                        {
                                            componentPool.ModTypes = new List <string>();
                                        }
                                        componentPool.ModTypes.Add(mission.GeneratorSetting.ComponentPools[i].ModTypes[j]);
                                        mission.GeneratorSetting.ComponentPools[i].ModTypes.RemoveAt(j);
                                    }
                                }
                            }
                            if (pool.ModTypes.Count == 0)
                            {
                                generatorSetting.ComponentPools.RemoveAt(i);
                                if (removeComponentPools)
                                {
                                    mission.GeneratorSetting.ComponentPools.RemoveAt(i);
                                }
                            }
                        }
                    }
                }
                missionDetails.GeneratorSetting = generatorSetting;
            }
            return(missionDetails);
        }