private static void OutputHashes(string path, Encoding encoding, Dictionary <uint, string> dictionary, RunSettings runSettings) { using (FileStream inputStream = new FileStream(path, FileMode.Open)) { SubpFile subpFile = SubpFile.ReadSubpFile(inputStream, encoding, dictionary); //var rawHashes = new List<string>(); var subtitleIdHashSet = new HashSet <string>(); foreach (SubpEntry entry in subpFile.Entries) { ulong hash = entry.SubtitleIdHash; subtitleIdHashSet.Add(hash.ToString()); } WriteHashes(subtitleIdHashSet, path, "SubtitleId", "StrCode32", runSettings.gameId, runSettings.outputPath); } }//OutputHashes
private static void UnpackSubp(string path, Encoding encoding) { string fileDirectory = Path.GetDirectoryName(path); string fileName = Path.GetFileNameWithoutExtension(path); string outputFileName = fileName + ".xml"; string outputFilePath = Path.Combine(fileDirectory, outputFileName); using (FileStream inputStream = new FileStream(path, FileMode.Open)) using (XmlWriter outputWriter = XmlWriter.Create(outputFilePath, new XmlWriterSettings { NewLineHandling = NewLineHandling.Entitize, Indent = true })) { SubpFile subpFile = SubpFile.ReadSubpFile(inputStream, encoding); // TODO: Change XML Encoding XmlSerializer serializer = new XmlSerializer(typeof(SubpFile)); serializer.Serialize(outputWriter, subpFile); } }
private static void UnpackSubp(string path, Encoding encoding, Dictionary <uint, string> dictionary) { string fileDirectory = Path.GetDirectoryName(path); string fileName = Path.GetFileNameWithoutExtension(path); string outputFileName = fileName + ".xml"; string outputFilePath = Path.Combine(fileDirectory, outputFileName); using (FileStream inputStream = new FileStream(path, FileMode.Open)) using (XmlWriter outputWriter = XmlWriter.Create(outputFilePath, new XmlWriterSettings { NewLineHandling = NewLineHandling.Entitize, Indent = true, Encoding = encoding })) { SubpFile subpFile = SubpFile.ReadSubpFile(inputStream, encoding, dictionary); //tex TODO: think if it's better for user to sort by (unhashed) subTitleId // TODO: Change XML Encoding XmlSerializer serializer = new XmlSerializer(typeof(SubpFile)); serializer.Serialize(outputWriter, subpFile); } }