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); }
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); } } }