public void Load() { mDefaultJson = ExtractTextRange(mPath, "<StonehearthEditor>", "</StonehearthEditor>"); var schemaText = ExtractTextRange(mPath, "<StonehearthEditorSchema>", "</StonehearthEditorSchema>"); if (schemaText.Length > 0) { try { mSchema = JsonSchemaTools.ParseSchema(schemaText, Application.StartupPath + "/schemas/encounters/tmp.json"); } catch (System.Exception e) { MessageBox.Show("Encounter type specifies a schema, but it isn't valid.\nFile: " + mPath + "\nError: " + e.Message); } } }
public void Load() { ParseGenericEncounterScripts(MainForm.kModsDirectoryPath + "/stonehearth/services/server/game_master/controllers"); var defaultSchemaPath = Application.StartupPath + "/schemas/encounters/encounter.json"; using (StreamReader sr = new StreamReader(defaultSchemaPath, System.Text.Encoding.UTF8)) { mDefaultSchema = JsonSchemaTools.ParseSchema(sr.ReadToEnd(), defaultSchemaPath); } // get the game master index location foreach (Module module in ModuleDataManager.GetInstance().GetAllModules()) { ModuleFile gmIndex = module.GetAliasFile("data:gm_index"); if (gmIndex != null) { string folder = JsonHelper.NormalizeSystemPath(System.IO.Path.GetDirectoryName(gmIndex.ResolvedPath)); ParseEncounterScripts(module.Name, folder); ParseNodeGraph(module.Name, folder); } } }