public void SimpleJSONTest() { Directory.CreateDirectory(OutputPath); string targetPath = Path.Combine(OutputPath, nameof(SimpleJSONTest) + ".json"); BsipaManifest manifest = new BsipaManifest() { Id = "TestPlugin", Name = "Test Plugin", Author = "Zingabopp", Version = "1.0.0", GameVersion = "1.14.0", Description = "Description of a test plugin." }; manifest.DependsOn = ParseUtil.ParseDictString(new string[] { "TestDepend1|^2.0.1;TestDepend2|^1.0.0" }, "DependsOn"); manifest.Validate(false); File.WriteAllText(targetPath, manifest.ToJson()); }
private void WriteManifest(BsipaManifest manifest, string path) { try { FileInfo fileInfo = new FileInfo(path); path = fileInfo.FullName; if (!fileInfo.Directory.Exists) { Logger.LogMessage(MessageImportance.High, $"Creating manifest target directory '${fileInfo.Directory.FullName}'..."); } fileInfo.Directory.Create(); File.WriteAllText(path, manifest.ToJson()); } catch (Exception ex) { throw new IOException($"Failed to write manifest to '${path}': {ex.Message}"); } }