private static void AddWhitespace(string fromJsonPath, string toJsonPath) { VerifyFileExists(fromJsonPath); using (new ConsoleWatch($"Writing {fromJsonPath} with formatting to {toJsonPath}...", () => $"Done; {FileLength.MB(fromJsonPath)} => {FileLength.MB(toJsonPath)} ({FileLength.Percentage(fromJsonPath, toJsonPath)})")) { using (JsonTextReader reader = new JsonTextReader(new StreamReader(fromJsonPath))) using (JsonTextWriter writer = new JsonTextWriter(new StreamWriter(toJsonPath))) { writer.Formatting = Formatting.Indented; writer.WriteToken(reader); } } }
private static void Compress(string fromPath, string toPath, string toDictionaryPath) { VerifyFileExists(fromPath); using (new ConsoleWatch($"Compressing {fromPath}...", () => $"Done. {FileLength.MB(fromPath)} to {FileLength.MB(toPath)} + {FileLength.MB(toDictionaryPath)} dictionary ({FileLength.Percentage(fromPath, toPath, toDictionaryPath)})")) { WordCompressor.Compress(fromPath, toPath, toDictionaryPath); } }
private static void ToBion(string jsonPath, string bionPath, string dictionaryPath) { VerifyFileExists(jsonPath); using (new ConsoleWatch($"Converting {jsonPath} to {bionPath}...", () => $"Done. {FileLength.MB(jsonPath)} JSON to {FileLength.MB(bionPath)} BION{(String.IsNullOrEmpty(dictionaryPath) ? "" : $" + {FileLength.MB(dictionaryPath)} dictionary")} ({FileLength.Percentage(jsonPath, bionPath, dictionaryPath)})")) { JsonBionConverter.JsonToBion(jsonPath, bionPath, dictionaryPath); } }