private static string MakeShortFileName(string longName, BuildDirectoryInfo dir) { if (IsoUtilities.IsValidFileName(longName)) { return(longName); } char[] shortNameChars = longName.ToUpper(CultureInfo.InvariantCulture).ToCharArray(); for (int i = 0; i < shortNameChars.Length; ++i) { if (!IsoUtilities.IsValidDChar(shortNameChars[i]) && shortNameChars[i] != '.' && shortNameChars[i] != ';') { shortNameChars[i] = '_'; } } string[] parts = IsoUtilities.SplitFileName(new string(shortNameChars)); if (parts[0].Length + parts[1].Length > 30) { parts[1] = parts[1].Substring(0, Math.Min(parts[1].Length, 3)); } if (parts[0].Length + parts[1].Length > 30) { parts[0] = parts[0].Substring(0, 30 - parts[1].Length); } string candidate = parts[0] + '.' + parts[1] + ';' + parts[2]; // TODO: Make unique return(candidate); }