//----------------------------------------- // private function dealing with naming //----------------------------------------- // return the local output file name, i.e. without directory private string GetOutputFileName() { string outputFileName; string inputFileName = Path.GetFileName(options.Input); switch (options.InputType) { case FileType.BAML: { return(inputFileName); } case FileType.EXE: { inputFileName = inputFileName.Remove(inputFileName.LastIndexOf('.')) + ".resources.dll"; return(inputFileName); } case FileType.DLL: { return(inputFileName); } case FileType.RESOURCES: { // get the output file name outputFileName = inputFileName; // get to the last dot seperating filename and extension int lastDot = outputFileName.LastIndexOf('.'); int secondLastDot = outputFileName.LastIndexOf('.', lastDot - 1); if (secondLastDot > 0) { string cultureName = outputFileName.Substring(secondLastDot + 1, lastDot - secondLastDot - 1); if (LocBamlConst.IsValidCultureName(cultureName)) { string extension = outputFileName.Substring(lastDot); string frontPart = outputFileName.Substring(0, secondLastDot + 1); outputFileName = frontPart + options.CultureInfo.Name + extension; } else { //Input is in invariant culture string extension = outputFileName.Substring(lastDot); string frontPart = outputFileName.Substring(0, lastDot + 1); outputFileName = frontPart + options.CultureInfo.Name + extension; } } return(outputFileName); } default: { throw new NotSupportedException(); } } }
public IBamlResourceWriter CreateBamlResourceWriter(Stream output) { switch (FileFormat) { case FileFormat.MsCsv: return(new MsBamlResourceCsvWriter(LocBamlConst.GetDelimiter(TranslationFileType), output)); case FileFormat.EasyBamlCsv: return(new BamlResourceCsvWriter(LocBamlConst.GetDelimiter(TranslationFileType), output)); case FileFormat.Resx: return(new BamlResourceResxWriter(output)); default: throw new ArgumentOutOfRangeException(); } }