public Initialize2 ( string sRootDir, IHelpTopicProvider helpTopicProvider, bool isLocal ) : void | ||
sRootDir | string | |
helpTopicProvider | IHelpTopicProvider | |
isLocal | bool | |
return | void |
private static string MoveCopyOrLeaveFile(string sFile, string subFolder, string sRootDirExternalLinks, IHelpTopicProvider helpTopicProvider, bool isLocal) { try { if (!Directory.Exists(subFolder)) { Directory.CreateDirectory(subFolder); } } catch (Exception e) { Logger.WriteEvent(String.Format("Error creating the directory: '{0}'", subFolder)); Logger.WriteError(e); return(sFile); } // Check whether the file is found within the directory. If so, just return. if (FileIsInExternalLinksFolder(sFile, sRootDirExternalLinks)) { return(sFile); } using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg()) { dlg.Initialize2(sFile, subFolder, helpTopicProvider, isLocal); if (dlg.ShowDialog() != DialogResult.OK) { return(null); // leave where it is. } return(PerformMoveCopyOrLeaveFile(sFile, subFolder, dlg.Choice)); } }
private static string[] MoveCopyOrLeaveFiles(string[] files, string subFolder, string sRootDirExternalLinks, IHelpTopicProvider helpTopicProvider, bool isLocal) { try { if (!Directory.Exists(subFolder)) Directory.CreateDirectory(subFolder); } catch (Exception e) { Logger.WriteEvent(string.Format("Error creating the directory: '{0}'", subFolder)); Logger.WriteError(e); return files; } // Check whether the file is found within the directory. if (files.All(f => FileIsInExternalLinksFolder(f, sRootDirExternalLinks))) return files; using (var dlg = new MoveOrCopyFilesDlg()) { dlg.Initialize2(subFolder, helpTopicProvider, isLocal); if (dlg.ShowDialog() == DialogResult.OK) { FileLocationChoice choice = dlg.Choice; return files.Select(f => PerformMoveCopyOrLeaveFile(f, subFolder, choice)).ToArray(); } return files; } }
private static string[] MoveCopyOrLeaveFiles(string[] files, string subFolder, string sRootDirExternalLinks, IHelpTopicProvider helpTopicProvider) { try { if (!Directory.Exists(subFolder)) { Directory.CreateDirectory(subFolder); } } catch (Exception e) { Logger.WriteEvent(string.Format("Error creating the directory: '{0}'", subFolder)); Logger.WriteError(e); return(files); } // Check whether the file is found within the directory. if (files.All(f => FileIsInExternalLinksFolder(f, sRootDirExternalLinks))) { return(files); } using (var dlg = new MoveOrCopyFilesDlg()) { dlg.Initialize2(subFolder, helpTopicProvider); if (dlg.ShowDialog() == DialogResult.OK) { FileLocationChoice choice = dlg.Choice; return(files.Select(f => PerformMoveCopyOrLeaveFile(f, subFolder, choice)).ToArray()); } return(files); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Checks to see whether the given file is located in the given root directory (or any /// subfolder of it) and if not prompts the user to allow FW to move, copy or leave the /// file. /// </summary> /// <param name="sFile">The fully-specified path name of the file.</param> /// <param name="sRootDir">The fully-specified path name of the external links root /// directory.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <returns>The fully specified path name of the file to use, which might be the same /// as the given path or it could be in its new location under the external links folder /// if the user elected to move or copy it.</returns> /// ------------------------------------------------------------------------------------ public static string MoveCopyOrLeaveFile(string sFile, string sRootDir, IHelpTopicProvider helpTopicProvider) { // Check whether the file is found within the directory. If so, just return. if (FileIsInExternalLinksFolder(sFile, sRootDir)) { return(sFile); } using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg()) { dlg.Initialize2(sFile, sRootDir, helpTopicProvider); if (dlg.ShowDialog() != DialogResult.OK) { return(null); // leave where it is. } return(PerformMoveCopyOrLeaveFile(sFile, sRootDir, dlg.Choice)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Checks to see whether the given file is located in the given root directory (or any /// subfolder of it) and if not prompts the user to allow FW to move, copy or leave the /// file. /// </summary> /// <param name="sFile">The fully-specified path name of the file.</param> /// <param name="sRootDir">The fully-specified path name of the external links root /// directory.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <returns>The fully specified path name of the file to use, which might be the same /// as the given path or it could be in its new location under the external links folder /// if the user elected to move or copy it.</returns> /// ------------------------------------------------------------------------------------ public static string MoveCopyOrLeaveFile(string sFile, string sRootDir, IHelpTopicProvider helpTopicProvider) { // Check whether the file is found within the directory. If so, just return. if (FileIsInExternalLinksFolder(sFile, sRootDir)) return sFile; using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg()) { dlg.Initialize2(sFile, sRootDir, helpTopicProvider); if (dlg.ShowDialog() != DialogResult.OK) return null; // leave where it is. return PerformMoveCopyOrLeaveFile(sFile, sRootDir, dlg.Choice); } }
private static string MoveCopyOrLeaveFile(string sFile, string subFolder, string sRootDirExternalLinks, IHelpTopicProvider helpTopicProvider, bool isLocal) { try { if (!Directory.Exists(subFolder)) Directory.CreateDirectory(subFolder); } catch (Exception e) { Logger.WriteEvent(String.Format("Error creating the directory: '{0}'", subFolder)); Logger.WriteError(e); return sFile; } // Check whether the file is found within the directory. If so, just return. if (FileIsInExternalLinksFolder(sFile, sRootDirExternalLinks)) return sFile; using (MoveOrCopyFilesDlg dlg = new MoveOrCopyFilesDlg()) { dlg.Initialize2(sFile, subFolder, helpTopicProvider, isLocal); if (dlg.ShowDialog() != DialogResult.OK) return null; // leave where it is. return PerformMoveCopyOrLeaveFile(sFile, subFolder, dlg.Choice); } }