private void TryCallE14() { if (this.ownerServer != null && this.ownerServer.VersionNumber < Server.E15MinVersion) { string name = this.ownerServer.Name; string text = null; try { TriggerPrivateRpcClient triggerPrivateRpcClient = new TriggerPrivateRpcClient(name); triggerPrivateRpcClient.RunOabGenTask(((ADObjectId)this.DataObject.Identity).DistinguishedName); } catch (RpcException ex) { text = RpcUtility.MapRpcErrorCodeToMessage(ex.ErrorCode, name); } catch (COMException ex2) { text = ex2.Message; } if (text != null) { base.WriteError(new LocalizedException(Strings.ErrorOabGenFailedE14(this.DataObject.Identity.ToString(), name, text)), ErrorCategory.InvalidResult, this.Identity); } } }
private int CopyOabFiles(out string sourceLocation) { int num = 0; sourceLocation = null; string text = Path.Combine("\\\\" + this.sourceServer.Name, "ExchangeOAB"); Exception innerException = null; LocalizedString value; try { if (!Directory.Exists(text)) { return(num); } sourceLocation = Path.Combine(text, this.DataObject.Guid.ToString()); DirectoryInfo directoryInfo = new DirectoryInfo(sourceLocation); if (!directoryInfo.Exists) { return(num); } string text2 = Path.Combine("\\\\" + this.targetServer.Name, "ExchangeOAB"); if (!Directory.Exists(text2)) { try { TriggerPrivateRpcClient triggerPrivateRpcClient = new TriggerPrivateRpcClient(this.targetServer.Name); triggerPrivateRpcClient.CreateExchangeOabFolder(); } catch (RpcException ex) { base.WriteError(new LocalizedException(Strings.ErrorFailedToCreateExchangeOabFolder(this.targetServer.Name, ex.Message), ex), ErrorCategory.InvalidResult, this.Identity); return(num); } catch (COMException ex2) { base.WriteError(new LocalizedException(Strings.ErrorFailedToCreateExchangeOabFolder(this.targetServer.Name, ex2.Message), ex2), ErrorCategory.InvalidResult, this.Identity); return(num); } } string text3 = Path.Combine(text2, this.DataObject.Guid.ToString()); DirectoryInfo directoryInfo2 = new DirectoryInfo(text3); if (!directoryInfo2.Exists) { directoryInfo2.Create(); } FileInfo[] files = directoryInfo.GetFiles(); if (files.Length == 0) { return(num); } long num2 = 0L; long num3 = 0L; foreach (FileInfo fileInfo in files) { num2 += fileInfo.Length; } if (num2 == 0L) { return(num); } LocalizedString activity = Strings.CopyingOABFiles(this.DataObject.Name, this.targetServer.Name); foreach (FileInfo fileInfo2 in files) { LocalizedString statusDescription = Strings.CopyingFile(fileInfo2.Name); int percentCompleted = (int)(num3 * 100L / num2); base.WriteProgress(activity, statusDescription, percentCompleted); fileInfo2.CopyTo(Path.Combine(text3, fileInfo2.Name), true); num++; num3 += fileInfo2.Length; } return(num); } catch (PathTooLongException ex3) { innerException = ex3; value = Strings.ErrorPathTooLong; } catch (SecurityException ex4) { innerException = ex4; value = Strings.ErrorNotEnoughPermissions; } catch (UnauthorizedAccessException ex5) { innerException = ex5; value = Strings.ErrorNotEnoughPermissions; } catch (DirectoryNotFoundException ex6) { innerException = ex6; value = Strings.ErrorDirectoryNotFound; } catch (IOException ex7) { innerException = ex7; value = Strings.ErrorDirectoryNotEmpty; } base.WriteError(new InvalidOperationException(value, innerException), ErrorCategory.InvalidOperation, this.DataObject.Identity); return(0); }