Ejemplo n.º 1
0
        public void UpdateFile(RefFilename filename, string text)
        {
            VariableStore.Instance.RemoveAllVariablesFromFile(filename);
            Instance.DeferedPostInitializationListNext.Clear();

            ModCK3Library.ClearFile(filename);

            LoadingCK3Library = ModCK3Library;

            var c = GetContextFromDirectory(filename);

            try
            {
                var results = FileTokenizer.Instance.LoadText(text, filename, c);

                ModCK3Library.Add(results, c);
            }
            catch (Exception e)
            {
            }

            try
            {
                for (var i = 0; i < Instance.DeferedPostInitializationListNext.Count; i++)
                {
                    var scriptObject = Instance.DeferedPostInitializationListNext[i];
                    scriptObject.Initialize();
                }
            }
            catch (Exception e)
            {
            }

            try
            {
                LoadingCK3Library.RecalculateGroups();

                do
                {
                    Instance.DeferedPostInitializationList     = Instance.DeferedPostInitializationListNext;
                    Instance.DeferedPostInitializationListNext = new List <ScriptObject>();
                    for (var i = 0; i < Instance.DeferedPostInitializationList.Count; i++)
                    {
                        var scriptObject = Instance.DeferedPostInitializationList[i];
                        scriptObject.PostInitialize(null, null);
                    }

                    Instance.DeferedPostInitializationList.Clear();
                } while (Instance.DeferedPostInitializationListNext.Count > 0);
            }
            catch (Exception e)
            {
            }


            ScriptObject.ClearCachedScriptedEffects();
        }
Ejemplo n.º 2
0
        public void LoadMod(string mod, IProgressFeedback progressFeedback)
        {
            ModCK3Library        = new ScriptLibrary();
            ModCK3Library.Parent = BaseCK3Library;
            ModCK3Library.Name   = mod;

            LoadingCK3Library = ModCK3Library;
            LoadCK3Scripts(ModCK3Library, progressFeedback, false, false);

            PostInitialize(progressFeedback);

            RePostProcessUntilComplete();

            ScriptObject.ClearCachedScriptedEffects();
        }
Ejemplo n.º 3
0
        public void CreateOrLoadMod(string mod, IProgressFeedback progressFeedback)
        {
            if (Directory.Exists(Globals.CK3ModPath + mod + "/"))
            {
                LoadMod(mod, progressFeedback);
                return;
            }

            Directory.CreateDirectory(Globals.CK3ModPath + mod + "/");
            ModCK3Library        = new ScriptLibrary();
            ModCK3Library.Parent = BaseCK3Library;
            ModCK3Library.Name   = mod;

            PostInitialize(progressFeedback);
            ScriptObject.ClearCachedScriptedEffects();
        }
Ejemplo n.º 4
0
        public void Init(IProgressFeedback progressFeedback)
        {
            Wipe();

            SchemaManager.Instance.Init();
            BaseCK3Library       = new ScriptLibrary();
            BaseCK3Library.Name  = "Base";
            ModCK3Library        = new ScriptLibrary();
            ModCK3Library.Parent = BaseCK3Library;
            LoadingCK3Library    = BaseCK3Library;

            EnumManager.Instance.Load();
            LoadCK3Scripts(BaseCK3Library, progressFeedback);
            ScriptObject.ClearCachedScriptedEffects();

            ProcessBaseFileBehaviour(progressFeedback);

            SchemaManager.Instance.SaveBinary();
        }