protected async Task <string> FindAvailableNumberedFileNameAsync(string desiredName) { var fileNameExtension = IOPath.GetExtension(desiredName) ?? string.Empty; var fileNameWithoutExtension = IOPath.GetFileNameWithoutExtension(desiredName); return(await StorageItemNameGenerator.FindAvailableNumberedNameAsync(desiredName, Owner, number => $"{fileNameWithoutExtension} ({number}){fileNameExtension}")); }
private static void WriteDiagnosticResults(ImmutableArray <Tuple <ProjectId, Diagnostic> > diagnostics, string fileName) { var orderedDiagnostics = diagnostics .OrderBy(i => i.Item2.Id) .ThenBy(i => i.Item2.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase) .ThenBy(i => i.Item2.Location.SourceSpan.Start) .ThenBy(i => i.Item2.Location.SourceSpan.End); var uniqueLines = new HashSet <string>(); StringBuilder completeOutput = new StringBuilder(); StringBuilder uniqueOutput = new StringBuilder(); foreach (var diagnostic in orderedDiagnostics) { string message = diagnostic.Item2.ToString(); string uniqueMessage = $"{diagnostic.Item1}: {diagnostic.Item2}"; completeOutput.AppendLine(message); if (uniqueLines.Add(uniqueMessage)) { uniqueOutput.AppendLine(message); } } string directoryName = Path.GetDirectoryName(fileName); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); string extension = Path.GetExtension(fileName); string uniqueFileName = Path.Combine(directoryName, $"{fileNameWithoutExtension}-Unique{extension}"); File.WriteAllText(fileName, completeOutput.ToString(), Encoding.UTF8); File.WriteAllText(uniqueFileName, uniqueOutput.ToString(), Encoding.UTF8); }
ICommandOutput SetupEnvironmentForAdd() { var directory = HostEnvironment.CurrentDirectory; var fromDirectory = string.IsNullOrEmpty(From) ? null : FileSystem.GetDirectory(From); if (fromDirectory != null && fromDirectory.Exists) { if (SysPath.GetExtension(Name).EqualsNoCase(".wrap") && SysPath.IsPathRooted(Name) && FileSystem.GetDirectory(SysPath.GetDirectoryName(Name)) != fromDirectory) { return(new Error("You provided both -From and -Name, but -Name is a path. Try removing the -From parameter.")); } directory = fromDirectory; _userSpecifiedRepository = new FolderRepository(directory, FolderRepositoryOptions.Default); } if (SysPath.GetExtension(Name).EqualsNoCase(".wrap") && directory.GetFile(SysPath.GetFileName(Name)).Exists) { var originalName = Name; Name = PackageNameUtility.GetName(SysPath.GetFileNameWithoutExtension(Name)); Version = PackageNameUtility.GetVersion(SysPath.GetFileNameWithoutExtension(originalName)).ToString(); return(new Warning("The requested package contained '.wrap' in the name. Assuming you pointed to a file name and meant a package named '{0}' with version qualifier '{1}'.", Name, Version)); } return(null); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determine the BEP type from the given type; otherwise, infer it from the pathname /// extension/server. /// </summary> /// <param name="type">The type string.</param> /// <param name="pathname">The pathname.</param> /// ------------------------------------------------------------------------------------ private static BackendProviderType GetType(string type, string pathname) { if (!string.IsNullOrEmpty(type)) { switch (type.ToLowerInvariant()) { case "xml": return(BackendProviderType.kXML); default: return(BackendProviderType.kInvalid); } } string ext = SysPath.GetExtension(pathname); if (!string.IsNullOrEmpty(ext)) { ext = ext.ToLowerInvariant(); switch (ext) // Includes period. { case LcmFileHelper.ksFwDataXmlFileExtension: return(BackendProviderType.kXML); } } return(BackendProviderType.kXML); }
private static string ValidateRequest(RequestBody request) { if (request.Planilha == null) { return($"Campo {nameof(RequestBody.Planilha)} obrigatório."); } if (request.Template == null) { return($"Campo {nameof(RequestBody.Template)} obrigatório."); } var planilhaExtensions = new[] { ".xlsx", ".xls", ".csv" }; var templateExtensions = new[] { ".docx", ".doc" }; var fileExtension = Path.GetExtension(request.Planilha.FileName).ToLowerInvariant(); if (!planilhaExtensions.Contains(fileExtension)) { return($"Campo {nameof(RequestBody.Planilha)} inválido."); } fileExtension = Path.GetExtension(request.Template.FileName).ToLowerInvariant(); if (!templateExtensions.Contains(fileExtension)) { return($"Campo {nameof(RequestBody.Template)} inválido."); } return(null); }
/// <summary> /// connects to workbook specified /// </summary> /// <param name="workbookPath"></param> /// <returns></returns> private OleDbConnection OpenDbConnection(string workbookPath) { OleDbConnection conn = null; try { if (Path.GetExtension(workbookPath) == ".xls") { conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + workbookPath + "; Extended Properties= \"Excel 8.0;HDR=Yes;IMEX=2\""); } else if (Path.GetExtension(workbookPath) == ".xlsx") { conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + workbookPath + "; Extended Properties='Excel 12.0;HDR=YES;IMEX=1;';"); } conn.Open(); } catch (Exception ex) { //TODO: HANDLE THE EXCEPTION throw; } return(conn); }
public static FileType GetFileTypeByFileName(string fileName) { string fileExt = Path.GetExtension(fileName); if (fileExt == String.Empty) { return(TextFileType); } foreach (string sectionName in _FileTypeMap.Keys) { string extList = AppConfig.Ini.Get(sectionName, "Extensions", ""); foreach (string ext in extList.Split(' ')) { if (String.Compare(fileExt, ext, true) == 0) { return(_FileTypeMap[sectionName]); } } } return(TextFileType); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Cleans the name of the project given the project type. (e.g. For an XML type, this /// will ensure that the name is rooted and ends with the correct extension) /// </summary> /// <param name="type">The type of the project.</param> /// <param name="name">The name of the project.</param> /// <returns>The cleaned up name with the appropriate extension</returns> /// ------------------------------------------------------------------------------------ private static string CleanUpNameForType(BackendProviderType type, string name) { if (string.IsNullOrEmpty(name)) { return(null); } string ext; switch (type) { case BackendProviderType.kXML: ext = LcmFileHelper.ksFwDataXmlFileExtension; break; default: return(name); } if (!SysPath.IsPathRooted(name)) { string sProjName = (SysPath.GetExtension(name) == ext) ? SysPath.GetFileNameWithoutExtension(name) : name; name = SysPath.Combine(SysPath.Combine(FwDirectoryFinder.ProjectsDirectory, sProjName), name); } // If the file doesn't have the expected extension and exists with the extension or // does not exist without it, we add the expected extension. if (SysPath.GetExtension(name) != ext && (FileUtils.SimilarFileExists(name + ext) || !FileUtils.SimilarFileExists(name))) { name += ext; } return(name); }
private string GenerateUniqueFileName(string path) { string fileNameNoExtension = Path.GetFileNameWithoutExtension(path); string fileExtension = Path.GetExtension(path); int numberToAppend = 0; string regexPattern = fileNameNoExtension + "\\d*\\" + fileExtension; foreach (SerializedProperty elementProperty in galleryImagesProp.FindPropertyRelative("value")) { var elementFileName = elementProperty.FindPropertyRelative("fileName").stringValue; if (System.Text.RegularExpressions.Regex.IsMatch(elementFileName, regexPattern)) { string numberString = elementFileName.Substring(fileNameNoExtension.Length); numberString = numberString.Substring(0, numberString.Length - fileExtension.Length); int number; if (!Int32.TryParse(numberString, out number)) { number = 0; } if (numberToAppend <= number) { numberToAppend = number + 1; } } } if (numberToAppend > 0) { fileNameNoExtension += numberToAppend.ToString(); } return(fileNameNoExtension + fileExtension); }
/********* ** Private methods *********/ /// <summary>Load the source image to apply to the target asset.</summary> /// <param name="fromAsset">The local path to the source image file.</param> /// <param name="width">The width of the loaded image.</param> /// <param name="height">The height of the loaded image.</param> /// <param name="rawData">The raw image data, if supported for the image file type.</param> /// <param name="fullTexture">The full texture instance, if <paramref name="rawData"/> is null.</param> private void LoadSourceImage(string fromAsset, out int width, out int height, out IRawTextureData?rawData, out Texture2D?fullTexture) { // disable raw data for .xnb files (which SMAPI can't read as raw data) bool canUseRawData = !string.Equals(PathHelper.GetExtension(fromAsset), ".xnb", StringComparison.OrdinalIgnoreCase); // disable raw data if PyTK is installed if (canUseRawData && EditImagePatch.EnablePyTkLegacyMode) { // PyTK intercepts Texture2D file loads to rescale them (e.g. for HD portraits), // but doesn't support IRawTextureData loads yet. We can't just check if the // current file has a '.pytk.json' rescale file though, since PyTK may still // rescale it if the original asset or another edit gets rescaled. canUseRawData = false; this.Monitor.LogOnce("Enabled compatibility mode for PyTK 1.23.0 or earlier. This won't cause any issues, but may impact performance.", LogLevel.Warn); } // load image if (canUseRawData) { rawData = this.ContentPack.ModContent.Load <IRawTextureData>(fromAsset); fullTexture = null; width = rawData.Width; height = rawData.Height; } else { rawData = null; fullTexture = this.ContentPack.ModContent.Load <Texture2D>(fromAsset); width = fullTexture.Width; height = fullTexture.Height; } }
private void PrepareRename(Component component) { try { // Get file info string filePath = component.FullFileName; string fileName = Path.GetFileNameWithoutExtension(filePath); string extention = Path.GetExtension(filePath); string partNumber = component.PartNumber; string description = component.Description; string directory = Path.GetDirectoryName(filePath); if (description != string.Empty) { description = " " + description; } // Check whether the PartNumber+Description = filename string newFileName = partNumber + description; Library.CheckFileName(ref newFileName); if (fileName == newFileName) { return; } else { // Replace the references ReplaceCheck(System.IO.Path.Combine(directory, fileName + extention), System.IO.Path.Combine(directory, newFileName + extention)); } } catch (Exception ex) { MessageBox.Show(ex.Message, System.Reflection.MethodBase.GetCurrentMethod().Name, MessageBoxButton.OK); } }
private IContentType SniffContentType(ITextBuffer diskBuffer) { // try and sniff the content type from a double extension, and if we can't // do that then default to HTML. IContentType contentType = null; ITextDocument textDocument; if (diskBuffer.Properties.TryGetProperty <ITextDocument>(typeof(ITextDocument), out textDocument)) { if (Path.GetExtension(textDocument.FilePath).Equals(PhpConstants.PhpFileExtension, StringComparison.OrdinalIgnoreCase) || Path.GetExtension(textDocument.FilePath).Equals(PhpConstants.Php5FileExtension, StringComparison.OrdinalIgnoreCase)) { var path = Path.GetFileNameWithoutExtension(textDocument.FilePath); if (path.IndexOf('.') != -1) { string subExt = Path.GetExtension(path).Substring(1); var fileExtRegistry = _compModel.GetService <IFileExtensionRegistryService>(); contentType = fileExtRegistry.GetContentTypeForExtension(subExt); } } } return(contentType); }
public static List <string> ListAasxPaths() { var variable = "SAMPLE_AASX_DIR"; var sampleAasxDir = System.Environment.GetEnvironmentVariable(variable); if (sampleAasxDir == null) { throw new InvalidOperationException( $"The environment variable {variable} has not been set. " + "Did you set it manually to the directory containing sample AASXs? " + "Otherwise, run the test through Test.ps1?"); } if (!Directory.Exists(sampleAasxDir)) { throw new InvalidOperationException( $"The directory containing the sample AASXs does not exist or is not a directory: " + $"{sampleAasxDir}; did you download the samples with DownloadSamples.ps1?"); } var result = Directory.GetFiles(sampleAasxDir) .Where(p => Path.GetExtension(p) == ".aasx") .ToList(); result.Sort(); return(result); }
public static string FindAvailableName(string path, Func <string, bool> exists) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (exists == null) { throw new ArgumentNullException(nameof(exists)); } var extension = Path.GetExtension(path); string baseFileName = null; int tries = 0; while (exists(path) && ++tries < 10000) { if (baseFileName == null) { baseFileName = Path.ChangeExtension(path, null); } path = baseFileName + " (" + tries + ")" + (extension ?? ""); } return(path); }
private void OnDeserialized(StreamingContext context) { if (this.galleryGIFLocators == null && this.galleryImageLocators != null) { List <GalleryImageLocator> gifLocators = new List <GalleryImageLocator>(); List <GalleryImageLocator> galleryLocators = new List <GalleryImageLocator>(); foreach (var locator in this.galleryImageLocators) { string imageExtension = Path.GetExtension(locator.fileName); if (imageExtension.ToUpper() == ".GIF") { gifLocators.Add(locator); } else { galleryLocators.Add(locator); } } this.galleryImageLocators = galleryLocators.ToArray(); this.galleryGIFLocators = gifLocators.ToArray(); } }
private void browseBtn_CLick(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Ebook Files(*.pdf, *.PDF, *.epub, *.EPUB)| *.pdf; *.PDF;*.epub; *.EPUB"; bool?dialogResult = openFileDialog.ShowDialog(this); if (dialogResult.Value) { string filePath = openFileDialog.FileName; string fileExtension = Path.GetExtension(filePath).ToLower(); BrowserEvent?.Invoke(filePath, fileExtension); this.Close(); //if (fileExtension.Equals(".pdf")) //{ // pdfReadingScreen.LoadData(filePath, this); // ShelfGrid.Visibility = Visibility.Collapsed; // pdfReadingScreen.Visibility = Visibility.Visible; //} //else if (fileExtension.Equals(".epub")) //{ // epubReadingScreen.ReadFile(filePath); // ShelfGrid.Visibility = Visibility.Collapsed; // epubReadingScreen.Visibility = Visibility.Visible; //} //else //{ // notthing //} } }
/// <summary> /// Create a new <see cref="Font"/> from a path. /// </summary> /// <param name="path">The path of the font.</param> public Font(string path) { Slug = Utility.ToSlug(PathIO.GetFileNameWithoutExtension(path)); Path = path; File = PathIO.GetFileName(path); Format = PathIO.GetExtension(path).Replace(".", string.Empty); }
public override string Operate(string origin) { string name = origin; Regex regex = new Regex(@"^[\d-]+$"); var args = Args as MoveArgs; var option = args.Option; string result = name; if (option == 0) { string isbn = name.Substring(0, 13); if (regex.IsMatch(isbn)) { result = name.Substring(14) + " " + isbn; } } else if (option == 1) { string extension = Path.GetExtension(name); string isbn = name.Substring(name.Length - 13 - extension.Length, 13); if (regex.IsMatch(isbn)) { result = isbn + " " + name.Substring(0, name.Length - isbn.Length - extension.Length - 1) + extension; } } return(result); }
private bool TransmitVirtualizedFileIfItExists() { Extension fileExtension = Extension.TrySelect(Path.GetExtension(this.Context.Request.Path).OrIfNullOrEmpty(Extension.html).ToLower(), null); VirtualFileAssembler fileAssembler = this.createFileAssembler(fileExtension); if (fileExtension == null || !fileAssembler.RequestedFileIsVirtual()) { return(false); } fileAssembler.GetFileContents(); if (this.checkForMissingFiles(fileAssembler)) { return(false); } this.Response.AddHeader("content-type", fileExtension.MimeType); if (this.checkForIfNoneMatch(fileAssembler)) { return(true); } this.respondWithContent(fileAssembler); return(true); }
public ReferenceModel GetLibraryInfoFromPath(string path) { try { var extension = Path.GetExtension(path)?.ToLowerInvariant() ?? string.Empty; if (string.IsNullOrEmpty(extension)) { return(null); } // LoadTypeLibrary will attempt to open files in the host, so only attempt on possible COM servers. if (TypeLibraryExtensions.Contains(extension)) { var type = _libraryProvider.LoadTypeLibrary(path); return(new ReferenceModel(path, type, _libraryProvider)); } return(new ReferenceModel(path)); } catch { // Most likely this is unloadable. If not, it we can't fail here because it could have come from the Apply // button in the AddRemoveReferencesDialog. Wait for it... :-P return(new ReferenceModel(path, true)); } }
private AntlrClassGenerationTaskInternal CreateBuildTaskWrapper() { var wrapper = new AntlrClassGenerationTaskInternal(); IList <string> sourceCodeFiles = null; if (this.SourceCodeFiles != null) { sourceCodeFiles = new List <string>(SourceCodeFiles.Length); foreach (ITaskItem taskItem in SourceCodeFiles) { sourceCodeFiles.Add(taskItem.ItemSpec); } } if (this.TokensFiles != null && this.TokensFiles.Length > 0) { Directory.CreateDirectory(OutputPath); HashSet <string> copied = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (ITaskItem taskItem in TokensFiles) { string fileName = taskItem.ItemSpec; if (!File.Exists(fileName)) { Log.LogError("The tokens file '{0}' does not exist.", fileName); continue; } string vocabName = Path.GetFileNameWithoutExtension(fileName); if (!copied.Add(vocabName)) { Log.LogWarning("The tokens file '{0}' conflicts with another tokens file in the same project.", fileName); continue; } string target = Path.Combine(OutputPath, Path.GetFileName(fileName)); if (!Path.GetExtension(target).Equals(".tokens", StringComparison.OrdinalIgnoreCase)) { Log.LogError("The destination for the tokens file '{0}' did not have the correct extension '.tokens'.", target); continue; } File.Copy(fileName, target, true); File.SetAttributes(target, File.GetAttributes(target) & ~FileAttributes.ReadOnly); } } wrapper.AntlrToolPath = AntlrToolPath; wrapper.SourceCodeFiles = sourceCodeFiles; wrapper.TargetLanguage = TargetLanguage; wrapper.OutputPath = OutputPath; wrapper.RootNamespace = RootNamespace; wrapper.GeneratedSourceExtension = GeneratedSourceExtension; wrapper.LanguageSourceExtensions = LanguageSourceExtensions; wrapper.DebugGrammar = DebugGrammar; wrapper.ProfileGrammar = ProfileGrammar; return(wrapper); }
public static bool IsImage(string file) { var ext = PathClass.GetExtension(file)? .ToUpperInvariant() .Replace(".", ""); return(ImageExtensions.Contains(ext)); }
private ICollection <string> FilesWithMechanismToImportToExistingComponent(ICollection <string> fileNames) { return(fileNames .Where(filename => Path.GetExtension(filename) != null && ComponentTypesForExtension.TryGetValue(Path.GetExtension(filename), out var componentTypes) && componentTypes.All(componentType => ComponentTypesWithImportMechanismToExistingComponent.Contains(componentType))) .ToHashSet()); }
protected bool HasMatchingFileExtension(string filename, QualifiedModuleName module) { var fileExtension = Path.GetExtension(filename); return(fileExtension != null && ComponentTypesForExtension.TryGetValue(fileExtension, out var componentTypes) && componentTypes.Contains(module.ComponentType)); }
public ActionResult ExecuteConsoleApp(string arg) { var inputDirectory = Path.Combine(_env.ContentRootPath, PathToDataDirectory); var outputDirectory = Path.Combine(inputDirectory, "__Output"); var arguments = Path.GetFullPath(Path.Combine(_env.ContentRootPath, "artifacts/js/vectormap-utils/dx.vectormaputils.node.js")) + " " + inputDirectory; if (Request.Query.ContainsKey("file")) { arguments += Request.Query["file"]; } arguments += " --quiet --output " + outputDirectory + " --settings " + Path.Combine(inputDirectory, "_settings.js") + " --process-file-content " + Path.Combine(inputDirectory, "_processFileContent.js"); var isJson = Request.Query.ContainsKey("json"); if (isJson) { arguments += " --json"; } try { Directory.CreateDirectory(outputDirectory); using (var process = StartProcess(PathToNode, arguments)) { if (!process.WaitForExit(NodeScriptTimeout)) { process.Kill(); } } var result = Directory.GetFiles(outputDirectory, isJson ? "*.json" : "*.js").Select(file => { var text = ReadTextFile(file); var variable = (string)null; if (!isJson) { var k = text.IndexOf("="); if (k > 0) { variable = text.Substring(0, k).Trim(); text = text.Substring(k + 1, text.Length - k - 2).Trim(); } } return(new { file = Path.GetFileNameWithoutExtension(file) + Path.GetExtension(file), variable = variable, content = JsonConvert.DeserializeObject(text) }); }).ToArray(); return(Content(JsonConvert.SerializeObject(result), "application/json")); } finally { Directory.Delete(outputDirectory, true); } }
private ICollection <string> DocumentFiles(Dictionary <string, string> moduleNames) { return(moduleNames .Select(kvp => kvp.Key) .Where(filename => Path.GetExtension(filename) != null && ComponentTypesForExtension.TryGetValue(Path.GetExtension(filename), out var componentTypes) && componentTypes.Contains(ComponentType.Document)) .ToHashSet()); }
public static ItemTypes GetFileType(string fullPath) { var ext = Path.GetExtension(fullPath).ToLower(); if (TypesMap.ContainsKey(ext)) { return(TypesMap[ext]); } return(ItemTypes.File); }
private AntlrClassGenerationTaskInternal CreateBuildTaskWrapper(AppDomain domain) { AntlrClassGenerationTaskInternal wrapper = (AntlrClassGenerationTaskInternal)domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(AntlrClassGenerationTaskInternal).FullName); IList <string> sourceCodeFiles = null; if (this.SourceCodeFiles != null) { sourceCodeFiles = new List <string>(SourceCodeFiles.Length); foreach (ITaskItem taskItem in SourceCodeFiles) { sourceCodeFiles.Add(taskItem.ItemSpec); } } if (this.TokensFiles != null && this.TokensFiles.Length > 0) { HashSet <string> copied = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (ITaskItem taskItem in TokensFiles) { string fileName = taskItem.ItemSpec; if (!File.Exists(fileName)) { Log.LogError("The tokens file '{0}' does not exist.", fileName); continue; } string vocabName = Path.GetFileNameWithoutExtension(fileName); if (!copied.Add(vocabName)) { Log.LogWarning("The tokens file '{0}' conflicts with another tokens file in the same project.", fileName); continue; } string target = Path.Combine(OutputPath, Path.GetFileName(fileName)); if (!Path.GetExtension(target).Equals(".tokens", StringComparison.OrdinalIgnoreCase)) { Log.LogError("The destination for the tokens file '{0}' did not have the correct extension '.tokens'.", target); continue; } File.Copy(fileName, target, true); File.SetAttributes(target, File.GetAttributes(target) & ~FileAttributes.ReadOnly); } } wrapper.AntlrToolPath = AntlrToolPath; wrapper.SourceCodeFiles = sourceCodeFiles; wrapper.LibPaths = LibPaths; wrapper.Language = Language; wrapper.OutputPath = OutputPath; wrapper.RootNamespace = RootNamespace; wrapper.GeneratedSourceExtension = GeneratedSourceExtension; return(wrapper); }
IEnumerator _loadAssetAsync(AssetBundle bundle, float devicePixelRatio) { var extension = Path.GetExtension(this.assetName); var name = Path.GetFileNameWithoutExtension(this.assetName); var upper = devicePixelRatio.ceil(); for (var scale = upper; scale >= 1; scale--) { var assetName = name + "@" + scale + extension; Object asset; if (bundle == null) { ResourceRequest request = Resources.LoadAsync(assetName); yield return(request); asset = request.asset; } else { AssetBundleRequest request = bundle.LoadAssetAsync(assetName); yield return(request); asset = request.asset; } if (asset != null) { if (bundle == null) { Resources.UnloadAsset(asset); } else { bundle.Unload(asset); } yield return(new AssetBundleImageKey( bundle, assetName, scale: scale )); yield break; } } yield return(new AssetBundleImageKey( bundle, this.assetName, scale: 1.0f )); }
private string GetAutosaveFormatString() { if (MapFile == null || Path.GetFileNameWithoutExtension(MapFile) == null) { return(null); } var we = Path.GetFileNameWithoutExtension(MapFile); var ex = Path.GetExtension(MapFile); return(we + ".auto.{0}" + ex); }