///-------------------------------------------------------------------------------- /// <summary>This method determines whether or not any metadata is /// different between the input instance and the current instance.</summary> /// /// <param name="inputDatabaseType">The databasetype to compare metadata.</param> ///-------------------------------------------------------------------------------- public bool IsIdenticalMetadata(DatabaseType inputDatabaseType) { if (DatabaseTypeName.GetString() != inputDatabaseType.DatabaseTypeName.GetString()) { return(false); } if (Description.GetString() != inputDatabaseType.Description.GetString()) { return(false); } #region protected #endregion protected return(true); }
internal void PrepareProperties() { // IMPORT PATH ImportPath = Path.GetFullPath(ImportPath); // SKIPPED PATHS // Skip file will be loaded in the PrepareFileSystemEntries. var paths = string.IsNullOrEmpty(SkippedPaths) ? new string[0] : SkippedPaths.Split(','); for (var i = 0; i < paths.Length; i++) { if (!Path.IsPathRooted(paths[i])) { paths[i] = Path.GetFullPath(Path.Combine(ImportPath, paths[i])); } if (!paths[i].StartsWith(ImportPath, StringComparison.CurrentCultureIgnoreCase)) { throw new ArgumentException("One or more paths are out of the ImportPath"); } paths[i] = paths[i].Substring(ImportPath.Length).Replace("\\", "/"); paths[i] = paths[i].Length == 0 || paths[i] == "/" ? "/Root" : "/Root" + paths[i]; } SkippedPathArray = paths; // OUTPUT DIRECTORY if (OutputPath == null) { OutputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "output"); } // DATA FILE: Ensure absolute path. Create parent directory if needed. if (DataFileName == null) { DataFileName = DefaultDataFileName; } if (!Path.IsPathRooted(DataFileName)) { DataFileName = Path.GetFullPath(Path.Combine(OutputPath, DataFileName)); } // INDEX FILE: Ensure absolute path. Create parent directory if needed. if (IndexFileName == null) { IndexFileName = DefaultIndexFileName; } if (!Path.IsPathRooted(IndexFileName)) { IndexFileName = Path.GetFullPath(Path.Combine(OutputPath, IndexFileName)); } // NAMESPACES AND CLASS NAMES // Split database typename to namespace and class name. if (DatabaseTypeName == null) { DatabaseTypeName = Path.GetFileNameWithoutExtension(DataFileName); } var segments = DatabaseTypeName.Split('.'); if (segments.Length > 1) { DatabaseClassName = segments.Last(); DatabaseNamespace = string.Join(".", segments.Take(segments.Length - 1)); } else { DatabaseClassName = segments[0]; } // Split index typename to namespace and class name. if (IndexTypeName == null) { IndexTypeName = Path.GetFileNameWithoutExtension(IndexFileName); } segments = IndexTypeName.Split('.'); if (segments.Length > 1) { IndexClassName = segments.Last(); IndexNamespace = string.Join(".", segments.Take(segments.Length - 1)); } else { IndexClassName = segments[0]; } // Ensure namespaces if (DatabaseNamespace == null) { DatabaseNamespace = IndexNamespace; } if (DatabaseNamespace == null) { DatabaseNamespace = DefaultNamespace; } if (IndexNamespace == null) { IndexNamespace = DatabaseNamespace; } }