Ejemplo n.º 1
0
 public static string GenerateLocalPathString(LocalLongFullPath localLongFullPath)
 {
     if (localLongFullPath != null)
     {
         return(localLongFullPath.PathName);
     }
     return(string.Empty);
 }
Ejemplo n.º 2
0
 internal TransportAgent(string identity, bool enabled, int priority, string agentFactory, string assemblyPath) : base(new SimpleProviderPropertyBag())
 {
     this.propertyBag[SimpleProviderObjectSchema.Identity] = new TransportAgentObjectId(identity);
     this.Enabled  = enabled;
     this.Priority = priority;
     this.TransportAgentFactory = agentFactory;
     this.AssemblyPath          = LocalLongFullPath.Parse(assemblyPath);
     base.ResetChangeTracking();
 }
 // Token: 0x06000DCD RID: 3533 RVA: 0x000537E4 File Offset: 0x000519E4
 internal void Log(List <MeetingValidationResult> validationResults, IExchangePrincipal mailboxOwner, ExDateTime rangeStart, ExDateTime rangeEnd)
 {
     if (!this.logEnabled)
     {
         return;
     }
     LogDirectory.BufferedStream bufferedStream = null;
     try
     {
         lock (this.threadSafetyLock)
         {
             if (this.lastCRALogCleanupRun.AddDays(1.0) < ExDateTime.Now)
             {
                 this.DeleteOldCRALogFiles();
                 this.lastCRALogCleanupRun = ExDateTime.Now;
             }
         }
         CalendarRepairLogRootEntry calendarRepairLogRootEntry = CalendarRepairLogRootEntry.CreateInstance(mailboxOwner, rangeStart, rangeEnd, this.logSubject);
         validationResults.ForEach(new Action <MeetingValidationResult>(calendarRepairLogRootEntry.AddValidationResult));
         if (calendarRepairLogRootEntry.TotalInconsistentMeetings != 0)
         {
             if (!Directory.Exists(this.logPath))
             {
                 Microsoft.Exchange.Diagnostics.Log.CreateLogDirectory(this.logPath);
             }
             string arg      = LocalLongFullPath.ConvertInvalidCharactersInFileName(mailboxOwner.Alias);
             string fileName = string.Format("{0}-{1:MM-dd-yyyy}-{2}.log", arg, ExDateTime.UtcNow, Guid.NewGuid().ToString().Substring(0, 6));
             bufferedStream = new LogDirectory.BufferedStream(Path.Combine(this.logPath, LocalLongFullPath.ConvertInvalidCharactersInPathName(fileName)), 4096);
             try
             {
                 using (XmlWriter xmlWriter = XmlWriter.Create(bufferedStream, this.settings))
                 {
                     calendarRepairLogRootEntry.WriteXml(xmlWriter);
                 }
             }
             catch (ArgumentException arg2)
             {
                 CalendarRepairLogger.Tracer.TraceDebug <ArgumentException>((long)this.GetHashCode(), "CRA log creation failure:{0}", arg2);
             }
         }
     }
     catch (IOException arg3)
     {
         CalendarRepairLogger.Tracer.TraceDebug <IOException>((long)this.GetHashCode(), "IOException:{0}", arg3);
     }
     finally
     {
         if (bufferedStream != null)
         {
             bufferedStream.Close();
             bufferedStream = null;
         }
     }
 }
Ejemplo n.º 4
0
 // Token: 0x0600030A RID: 778 RVA: 0x000136DC File Offset: 0x000118DC
 internal ElcAuditLog(DatabaseInfo databaseInfo)
 {
     this.logSchema          = new LogSchema("Microsoft Exchange Mailbox Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Managed Folder Assistant", ElcAuditLog.Fields);
     this.logHeaderFormatter = new LogHeaderFormatter(this.logSchema);
     this.databaseInfo       = databaseInfo;
     if (!string.IsNullOrEmpty(databaseInfo.DatabaseName))
     {
         this.filenamePrefix = "Managed_Folder_Assistant[" + LocalLongFullPath.ConvertInvalidCharactersInFileName(databaseInfo.DatabaseName) + "]";
         return;
     }
     this.filenamePrefix = "Managed_Folder_Assistant[Database Guid " + databaseInfo.Guid + "]";
 }
Ejemplo n.º 5
0
        internal static string GetDefaultEdbFolderPath(ExchangeServer ownerServer, string databaseName)
        {
            string      text        = Path.Combine(ownerServer.DataPath.PathName, LocalLongFullPath.ConvertInvalidCharactersInFileName(databaseName));
            string      path        = string.Format("{0}{1}{2}", databaseName, "0000", ".edb");
            EdbFilePath edbFilePath = null;

            if (!EdbFilePath.TryParse(Path.Combine(text, path), out edbFilePath))
            {
                text = ownerServer.DataPath.PathName;
                if (!EdbFilePath.TryParse(Path.Combine(text, path), out edbFilePath))
                {
                    text = EdbFilePath.DefaultEdbFilePath;
                }
            }
            return(text);
        }
        private string GetParentFolderName(Item itemToLog)
        {
            string text = null;
            string key  = itemToLog.ParentId.ToBase64String();

            if (!CalendarDiagnosticLogFileWriter.parentFolderIdCache.ContainsKey(key))
            {
                using (Folder folder = Folder.Bind(itemToLog.Session, itemToLog.ParentId))
                {
                    text = LocalLongFullPath.ConvertInvalidCharactersInFileName(folder.DisplayName);
                    CalendarDiagnosticLogFileWriter.parentFolderIdCache.Add(key, text);
                    return(text);
                }
            }
            text = CalendarDiagnosticLogFileWriter.parentFolderIdCache[key];
            return(text);
        }
Ejemplo n.º 7
0
        protected override void InternalValidate()
        {
            if (this.transportService == null)
            {
                this.transportService = new TransportService?(this.GetDefaultTransportServiceRole());
            }
            string text;

            if (this.location == null || string.IsNullOrEmpty(this.location.PathName))
            {
                LocalLongFullPath agentLogPath = this.GetAgentLogPath(this.transportService.Value);
                text = ((agentLogPath != null) ? agentLogPath.PathName : string.Empty);
            }
            else
            {
                text = this.location.PathName;
            }
            bool flag  = File.Exists(text);
            bool flag2 = Directory.Exists(text);

            if (!flag && !flag2)
            {
                base.WriteError(new ArgumentException(Strings.AgentLogInvalidLocation(text), "Location"), ErrorCategory.InvalidArgument, null);
            }
            if (this.startTime.CompareTo(this.endTime) > 0)
            {
                base.WriteError(new ArgumentException(Strings.AgentLogInvalidTimeRange, "StartTime, EndTime"), ErrorCategory.InvalidArgument, null);
            }
            if (flag)
            {
                this.files = new string[]
                {
                    text
                };
            }
            else
            {
                this.files = Directory.GetFiles(text);
            }
            if (this.GetNextFileIndex() == -1)
            {
                base.WriteError(new ArgumentException(Strings.AgentLogNoLogsAtLocation(text), "Location"), ErrorCategory.InvalidArgument, null);
            }
        }
        public static bool CheckSeedingPath(string machineFqdn, string logFolderPath, string edbFilePath, string logPrefix)
        {
            LocalLongFullPath.Parse(logFolderPath);
            LocalLongFullPath.Parse(edbFilePath);
            string directoryName = Path.GetDirectoryName(edbFilePath);

            string[] array = new string[]
            {
                logFolderPath,
                directoryName
            };
            string[] array2 = new string[]
            {
                "LogFolderPath",
                "EdbFolderPath"
            };
            for (int i = 0; i < array.Length; i++)
            {
                if (WmiWrapper.IsFileExisting(machineFqdn, array[i]))
                {
                    throw new SeedingPathErrorException(Strings.SeedingErrorDirectoryIsFile(array2[i], array[i]));
                }
            }
            string text = Path.Combine(logFolderPath, logPrefix + ".log");

            if (WmiWrapper.IsDirectoryExisting(machineFqdn, text))
            {
                throw new SeedingPathErrorException(Strings.SeedingErrorFileIsDirectory("CopyLogFile", text));
            }
            if (WmiWrapper.IsDirectoryExisting(machineFqdn, edbFilePath))
            {
                throw new SeedingPathErrorException(Strings.SeedingErrorFileIsDirectory("CopyEdbFilePath", edbFilePath));
            }
            if (WmiWrapper.IsFileExisting(machineFqdn, edbFilePath))
            {
                throw new SeedingPathWarningException(Strings.SeedingEdbFileExists(edbFilePath));
            }
            if (WmiWrapper.IsFileExisting(machineFqdn, text))
            {
                throw new SeedingPathWarningException(Strings.SeedingLogFileExists(text));
            }
            return(true);
        }
        public override bool Verify()
        {
            string dirName = null;

            try
            {
                dirName = LocalLongFullPath.ParseFromPathNameAndFileName(base.PathName, this.logPrefix + ".log").PathName;
            }
            catch (ArgumentException ex)
            {
                TaskLogger.Trace("LogLocationAvailableCondition.Verify() caught exception '{0}': <Server '{1}', PathName '{2}'>", new object[]
                {
                    ex.Message,
                    base.ComputerName,
                    base.PathName
                });
                return(false);
            }
            bool flag = true;

            if (WmiWrapper.IsDirectoryExisting(base.ComputerName, dirName))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExistingInPath(base.ComputerName, base.PathName, new WmiWrapper.FileFilter(this.LogFileFilter)))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExisting(base.ComputerName, base.PathName))
            {
                flag = false;
            }
            TaskLogger.Trace("LogLocationAvailableCondition.Verify() returns {0}: <Server '{1}', PathName '{2}'>", new object[]
            {
                flag,
                base.ComputerName,
                base.PathName
            });
            return(flag);
        }
Ejemplo n.º 10
0
        public override bool Verify()
        {
            string text = null;

            try
            {
                text = LocalLongFullPath.ParseFromPathNameAndFileName(base.PathName, "tmp.edb").PathName;
            }
            catch (ArgumentException ex)
            {
                TaskLogger.Trace("SystemPathAvailableCondition.Verify() caught exception '{0}': <Server '{1}', PathName '{2}'>", new object[]
                {
                    ex.Message,
                    base.ComputerName,
                    base.PathName
                });
                return(false);
            }
            bool flag = true;

            if (WmiWrapper.IsDirectoryExisting(base.ComputerName, text))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExisting(base.ComputerName, text))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExisting(base.ComputerName, base.PathName))
            {
                flag = false;
            }
            TaskLogger.Trace("SystemPathAvailableCondition.Verify() returns {0}: <Server '{1}', PathName '{2}'>", new object[]
            {
                flag,
                base.ComputerName,
                base.PathName
            });
            return(flag);
        }
Ejemplo n.º 11
0
 protected void PrepareFilePaths(string databaseName, bool recovery, Database dataObject)
 {
     if (null == dataObject.LogFolderPath)
     {
         dataObject.LogFolderPath = NewDatabaseTask <TDataObject> .GetDefaultLogFolderPath(databaseName, this.ownerServer.DataPath.PathName, (ADObjectId)this.ownerServer.Identity, this.ownerServerDatabases, new Task.TaskErrorLoggingDelegate(base.WriteError));
     }
     if (null == dataObject.SystemFolderPath)
     {
         dataObject.SystemFolderPath = dataObject.LogFolderPath;
     }
     if (null == dataObject.EdbFilePath)
     {
         string fileName = dataObject.Name + ".edb";
         try
         {
             dataObject.EdbFilePath = EdbFilePath.Parse(Path.Combine(LocalLongFullPath.ConvertInvalidCharactersInPathName(dataObject.LogFolderPath.PathName), LocalLongFullPath.ConvertInvalidCharactersInFileName(fileName)));
         }
         catch (ArgumentException exception)
         {
             base.WriteError(exception, ErrorCategory.InvalidOperation, dataObject);
         }
     }
 }
 public static string CheckAndCreateLogLocation(string logLocation)
 {
     using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\CalendarLogs"))
     {
         if (registryKey != null)
         {
             string text = registryKey.GetValue("LogLocation", string.Empty) as string;
             if (!string.IsNullOrEmpty(text))
             {
                 logLocation = text;
             }
         }
     }
     if (string.IsNullOrEmpty(logLocation))
     {
         throw new ArgumentException(Strings.LogLocationError("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\CalendarLogs", "LogLocation"));
     }
     logLocation = LocalLongFullPath.ConvertInvalidCharactersInPathName(logLocation);
     if (!Directory.Exists(logLocation))
     {
         Directory.CreateDirectory(logLocation);
     }
     return(logLocation);
 }
Ejemplo n.º 13
0
        public static void GetMailboxServerPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            int    majorVersion = 0;
            string text         = inputRow["Version"] as string;

            if (text == "current")
            {
                majorVersion = Server.CurrentExchangeMajorVersion;
            }
            else
            {
                int.TryParse(text, out majorVersion);
            }
            DatabasePropertiesHelper.FilterRowsByAdminDisplayVersion(inputRow, dataTable, store, majorVersion, null);
            foreach (object obj in dataTable.Rows)
            {
                DataRow dataRow = (DataRow)obj;
                if (DBNull.Value != dataRow["DataPath"])
                {
                    LocalLongFullPath localLongFullPath = (LocalLongFullPath)dataRow["DataPath"];
                    dataRow["DataPath"] = localLongFullPath.PathName;
                }
            }
        }
        private string GetFullFileName(Item log)
        {
            string text           = LocalLongFullPath.ConvertInvalidCharactersInFileName(log.GetValueOrDefault <string>(ItemSchema.NormalizedSubject, string.Empty));
            int    num            = 0;
            string valueOrDefault = log.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass);

            if (!ObjectClass.IsMeetingInquiry(valueOrDefault))
            {
                num = log.GetValueOrDefault <int>(CalendarItemBaseSchema.AppointmentSequenceNumber, 0);
            }
            string text2 = string.Format("{0}.{1}.{2}.{3}", new object[]
            {
                log.LastModifiedTime.UtcTicks,
                num,
                this.GetParentFolderName(log),
                text
            });

            if (text2.Length > 120)
            {
                text2.Substring(0, 120 - ".msg".Length);
            }
            return(Path.Combine(this.outputDirectoryPath, text2 + ".msg"));
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (base.Fields.IsModified("MailboxSubmissionAgentLogMaxAge"))
     {
         this.DataObject.MailboxSubmissionAgentLogMaxAge = this.MailboxSubmissionAgentLogMaxAge;
     }
     if (base.Fields.IsModified("MailboxSubmissionAgentLogMaxDirectorySize"))
     {
         this.DataObject.MailboxSubmissionAgentLogMaxDirectorySize = this.MailboxSubmissionAgentLogMaxDirectorySize;
     }
     if (base.Fields.IsModified("MailboxSubmissionAgentLogMaxFileSize"))
     {
         this.DataObject.MailboxSubmissionAgentLogMaxFileSize = this.MailboxSubmissionAgentLogMaxFileSize;
     }
     if (base.Fields.IsModified("MailboxSubmissionAgentLogPath"))
     {
         this.DataObject.MailboxSubmissionAgentLogPath = this.MailboxSubmissionAgentLogPath;
     }
     if (base.Fields.IsModified("MailboxSubmissionAgentLogEnabled"))
     {
         this.DataObject.MailboxSubmissionAgentLogEnabled = this.MailboxSubmissionAgentLogEnabled;
     }
     if (base.Fields.IsModified("MailboxDeliveryAgentLogMaxAge"))
     {
         this.DataObject.MailboxDeliveryAgentLogMaxAge = this.MailboxDeliveryAgentLogMaxAge;
     }
     if (base.Fields.IsModified("MailboxDeliveryAgentLogMaxDirectorySize"))
     {
         this.DataObject.MailboxDeliveryAgentLogMaxDirectorySize = this.MailboxDeliveryAgentLogMaxDirectorySize;
     }
     if (base.Fields.IsModified("MailboxDeliveryAgentLogMaxFileSize"))
     {
         this.DataObject.MailboxDeliveryAgentLogMaxFileSize = this.MailboxDeliveryAgentLogMaxFileSize;
     }
     if (base.Fields.IsModified("MailboxDeliveryAgentLogPath"))
     {
         this.DataObject.MailboxDeliveryAgentLogPath = this.MailboxDeliveryAgentLogPath;
     }
     if (base.Fields.IsModified("MailboxDeliveryAgentLogEnabled"))
     {
         this.DataObject.MailboxDeliveryAgentLogEnabled = this.MailboxDeliveryAgentLogEnabled;
     }
     if (base.Fields.IsModified("MailboxDeliveryThrottlingLogEnabled"))
     {
         this.DataObject.MailboxDeliveryThrottlingLogEnabled = this.MailboxDeliveryThrottlingLogEnabled;
     }
     if (base.Fields.IsModified("MailboxDeliveryThrottlingLogMaxAge"))
     {
         this.DataObject.MailboxDeliveryThrottlingLogMaxAge = this.MailboxDeliveryThrottlingLogMaxAge;
     }
     if (base.Fields.IsModified("MailboxDeliveryThrottlingLogMaxDirectorySize"))
     {
         this.DataObject.MailboxDeliveryThrottlingLogMaxDirectorySize = this.MailboxDeliveryThrottlingLogMaxDirectorySize;
     }
     if (base.Fields.IsModified("MailboxDeliveryThrottlingLogMaxFileSize"))
     {
         this.DataObject.MailboxDeliveryThrottlingLogMaxFileSize = this.MailboxDeliveryThrottlingLogMaxFileSize;
     }
     if (base.Fields.IsModified("MailboxDeliveryThrottlingLogPath"))
     {
         this.DataObject.MailboxDeliveryThrottlingLogPath = this.MailboxDeliveryThrottlingLogPath;
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADOabVirtualDirectory adoabVirtualDirectory = (ADOabVirtualDirectory)base.PrepareDataObject();

            adoabVirtualDirectory.RequireSSL = this.RequireSSL;
            this.serverFQDN = base.OwningServer.Fqdn;
            string text;

            if (string.IsNullOrEmpty(base.WebSiteName))
            {
                if (base.Role == VirtualDirectoryRole.ClientAccess)
                {
                    text = IisUtility.GetWebSiteName(IisUtility.CreateAbsolutePath(IisUtility.AbsolutePathType.WebSiteRoot, this.serverFQDN, "/W3SVC/1/ROOT", null));
                }
                else
                {
                    text = "Exchange Back End";
                }
            }
            else
            {
                text = base.WebSiteName;
            }
            ADOabVirtualDirectory[] array = ((IConfigurationSession)base.DataSession).Find <ADOabVirtualDirectory>(base.OwningServer.Id, QueryScope.SubTree, null, null, 0);
            if (array != null && array.Length != 0)
            {
                ADOabVirtualDirectory[] array2 = array;
                int i = 0;
                while (i < array2.Length)
                {
                    ADOabVirtualDirectory adoabVirtualDirectory2 = array2[i];
                    string webSiteRootPath = null;
                    string text2           = null;
                    try
                    {
                        IisUtility.ParseApplicationRootPath(adoabVirtualDirectory2.MetabasePath, ref webSiteRootPath, ref text2);
                    }
                    catch (IisUtilityInvalidApplicationRootPathException ex)
                    {
                        base.WriteWarning(ex.Message);
                        goto IL_24E;
                    }
                    goto IL_D6;
IL_24E:
                    i++;
                    continue;
IL_D6:
                    string webSiteName = IisUtility.GetWebSiteName(webSiteRootPath);
                    if (string.Compare(webSiteName, text, false) == 0)
                    {
                        try
                        {
                            if (DirectoryEntry.Exists(adoabVirtualDirectory2.MetabasePath))
                            {
                                if (!this.Recovery)
                                {
                                    base.WriteError(new InvalidOperationException(Strings.ErrorOabVirtualDirectoryAlreadyExists(adoabVirtualDirectory2.Identity.ToString(), text, this.serverFQDN)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                                }
                                else
                                {
                                    base.WriteError(new InvalidOperationException(Strings.ErrorOabVirtualDirectoryAlreadyExistsWithRecovery(adoabVirtualDirectory2.Identity.ToString(), text, this.serverFQDN)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                                }
                            }
                            else if (!this.Recovery)
                            {
                                base.WriteError(new InvalidOperationException(Strings.ErrorOabVirtualDirectoryADObjectAlreadyExists(adoabVirtualDirectory2.Identity.ToString(), text, this.serverFQDN)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
                            }
                            else
                            {
                                array[0].CopyChangesFrom(adoabVirtualDirectory);
                                adoabVirtualDirectory = adoabVirtualDirectory2;
                                adoabVirtualDirectory.SetId(new ADObjectId(adoabVirtualDirectory.Server.DistinguishedName).GetDescendantId("Protocols", "HTTP", new string[]
                                {
                                    string.Format("{0} ({1})", this.Name, base.WebSiteName)
                                }));
                                adoabVirtualDirectory.MetabasePath = string.Format("IIS://{0}{1}/{2}", this.serverFQDN, IisUtility.FindWebSiteRootPath(base.WebSiteName, this.serverFQDN), this.Name);
                            }
                        }
                        catch (COMException exception)
                        {
                            base.WriteError(exception, ErrorCategory.ReadError, null);
                        }
                        goto IL_24E;
                    }
                    goto IL_24E;
                }
            }
            if (new VirtualDirectoryExistsCondition(this.serverFQDN, text, this.Name).Verify())
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorOabVirtualDirectoryIISObjectAlreadyExists(string.Format("{0}\\{1}", text, this.Name), text, this.serverFQDN)), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            this.isExistingFolder = true;
            this.isLocalServer    = this.IsLocalServer();
            if (string.IsNullOrEmpty(base.Path))
            {
                base.Path = System.IO.Path.Combine(base.OwningServer.InstallPath.PathName, (base.Role == VirtualDirectoryRole.ClientAccess) ? "FrontEnd\\HttpProxy\\OAB" : "ClientAccess\\OAB");
            }
            else
            {
                LocalLongFullPath localLongFullPath = null;
                try
                {
                    localLongFullPath = LocalLongFullPath.Parse(base.Path);
                }
                catch (ArgumentException ex2)
                {
                    base.WriteError(new ArgumentException(new LocalizedString(ex2.Message.ToString()), "Path"), ErrorCategory.InvalidArgument, base.OwningServer.Identity);
                    return(null);
                }
                base.Path = localLongFullPath.PathName;
            }
            if (base.Role == VirtualDirectoryRole.ClientAccess && adoabVirtualDirectory.InternalUrl == null)
            {
                if (this.isLocalServer)
                {
                    adoabVirtualDirectory.InternalUrl = new Uri(string.Format("http://{0}/{1}", ComputerInformation.DnsFullyQualifiedDomainName, "OAB"));
                }
                else
                {
                    base.WriteError(new ArgumentException(Strings.ErrorMissingInternalUrlInRemoteScenario, "InternalUrl"), ErrorCategory.InvalidArgument, base.OwningServer.Identity);
                }
            }
            TaskLogger.LogExit();
            return(adoabVirtualDirectory);
        }
Ejemplo n.º 17
0
        internal static NonRootLocalLongFullPath GetDefaultLogFolderPath(string databaseName, string serverDataPath, ADObjectId OwnerServerId, IEnumerable <Database> existingDatabases, Task.TaskErrorLoggingDelegate logError)
        {
            string        value         = LocalLongFullPath.ConvertInvalidCharactersInFileName(databaseName);
            StringBuilder stringBuilder = new StringBuilder(serverDataPath);

            stringBuilder.Append(Path.DirectorySeparatorChar.ToString()).Append(value);
            string text = null;
            NonRootLocalLongFullPath nonRootLocalLongFullPath = null;
            Exception ex = null;

            try
            {
                text = stringBuilder.ToString();
                nonRootLocalLongFullPath = NonRootLocalLongFullPath.Parse(text);
                nonRootLocalLongFullPath.ValidateDirectoryPathLength();
                for (int i = 0; i < 200; i++)
                {
                    bool flag = false;
                    foreach (Database database in existingDatabases)
                    {
                        if (nonRootLocalLongFullPath == database.LogFolderPath)
                        {
                            if (database.Servers != null && database.Servers.Length != 0)
                            {
                                foreach (ADObjectId adobjectId in database.Servers)
                                {
                                    if (OwnerServerId == adobjectId)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                            }
                            else if (OwnerServerId == database.Server)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        break;
                    }
                    text = string.Format(CultureInfo.InvariantCulture, "{0}{1}", new object[]
                    {
                        stringBuilder,
                        i + 1
                    });
                    nonRootLocalLongFullPath = NonRootLocalLongFullPath.Parse(text);
                    nonRootLocalLongFullPath.ValidateDirectoryPathLength();
                }
            }
            catch (ArgumentException ex2)
            {
                ex = ex2;
            }
            catch (FormatException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                nonRootLocalLongFullPath = null;
                if (logError != null)
                {
                    logError(new InvalidOperationException(Strings.ErrorFailToParseLocalLongFullPath(databaseName, DatabaseSchema.LogFolderPath.Name, text, ex.Message)), ErrorCategory.InvalidOperation, databaseName);
                }
            }
            return(nonRootLocalLongFullPath);
        }
Ejemplo n.º 18
0
 internal static string GetDefaultEdbFileName(string databaseName)
 {
     return(LocalLongFullPath.ConvertInvalidCharactersInFileName(databaseName + ".edb"));
 }
 public CalendarDiagnosticLogFileWriter(string logLocation, string displayName, string acceptedDomain)
 {
     this.outputDirectoryPath = Path.Combine(logLocation, LocalLongFullPath.ConvertInvalidCharactersInFileName(displayName));
     this.acceptedDomain      = acceptedDomain;
 }