private void ProcessFile(FileInfo file) { Int32 nofNames; using (ResourceSource source = OpenSource(file, out nofNames)) { if (source == null) { return; } // now process it Int32 i = 1; foreach (ResourceType type in source.AllTypes) { foreach (ResourceName name in type.Names) { foreach (ResourceLang lang in name.Langs) { try { // such as it is, you need to load ALL the resource data to determine its type as ResourceType is unreliable ResourceData data = lang.Data; if (ShouldExportData(data)) { // one directory per file // get the path of the file relative to the root directory being searched String relativeName = file.FullName.Substring(Options.SourceDirectory.FullName.Length); if (relativeName.StartsWith("\\")) { relativeName = relativeName.Substring(1); } String directory = Path.Combine(Options.ExportDirectory.FullName, relativeName); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } //////////////////////////////// String fileName; if (Options.ExportLongNames || name.Langs.Count > 1) { fileName = Miscellaneous.FSSafeResPath(lang.ResourcePath); } else { fileName = Miscellaneous.FSSafeResPath(type.Identifier.FriendlyName.Replace("\"", "") + "-" + name.Identifier.FriendlyName.Replace("\"", "")); } fileName = Path.Combine(directory, fileName) + data.RecommendedExtension; fileName = Miscellaneous.GetUnusedFileName(fileName); data.Save(fileName); } } catch (Exception ex) { Log.Add(LogSeverity.Error, "Couldn't save " + file.FullName + lang.ResourcePath + ", Exception: " + ex.Message); } } //lang OnMinorProgressChanged(i++, nofNames, name.Identifier.FriendlyName); } //name } //type Log.Add(LogSeverity.Info, "Processed " + file.FullName + " OK"); } //using }