protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); this.owaVersion = OwaVirtualDirectoryHelper.GetOwaAssemblyVersion(); this.owaCurrentFolder = Path.Combine(OwaVirtualDirectoryHelper.OwaPath, "Current"); this.owaVersionFolder = Path.Combine(OwaVirtualDirectoryHelper.OwaPath, this.owaVersion); try { UpdateOwaVirtualDirectory.XCopyEntireFoldersWithOverwrite(this.owaCurrentFolder, this.owaVersionFolder, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } catch (UnauthorizedAccessException ex) { throw new CopyDirectoriesException(this.owaCurrentFolder, this.owaVersionFolder, ex.Message, ex); } catch (IOException ex2) { throw new CopyDirectoriesException(this.owaCurrentFolder, this.owaVersionFolder, ex2.Message, ex2); } catch (NotSupportedException ex3) { throw new CopyDirectoriesException(this.owaCurrentFolder, this.owaVersionFolder, ex3.Message, ex3); } this.configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromRootOrgScopeSet(), 131, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\VirtualDirectoryTasks\\UpdateOWAVirtualDirectory.cs"); TaskLogger.LogExit(); }
private static void XCopyEntireFoldersWithOverwrite(string fromFolder, string toFolder, Task.TaskVerboseLoggingDelegate logger) { if (string.IsNullOrEmpty(fromFolder)) { throw new ArgumentNullException("fromFolder"); } if (string.IsNullOrEmpty(toFolder)) { throw new ArgumentNullException("toFolder"); } if (logger == null) { throw new ArgumentNullException("logger"); } logger(Strings.VerboseCopyDirectory("localhost", fromFolder, toFolder)); if (!Directory.Exists(fromFolder)) { return; } if (!Directory.Exists(toFolder)) { logger(Strings.VerboseCreateDirectory("localhost", toFolder)); Directory.CreateDirectory(toFolder); } foreach (string text in Directory.GetFiles(fromFolder)) { string text2 = Path.Combine(toFolder, Path.GetFileName(text)); logger(Strings.VerboseCopyFile("localhost", text, text2)); File.Copy(text, text2, true); } foreach (string text3 in Directory.GetDirectories(fromFolder)) { string toFolder2 = Path.Combine(toFolder, Path.GetFileName(text3)); UpdateOwaVirtualDirectory.XCopyEntireFoldersWithOverwrite(text3, toFolder2, logger); } }