/// <summary> /// Loads the specified schema if it exists, saving it otherwise, and sets it as Current /// </summary> /// <param name="schemaName"></param> /// <returns></returns> public SchemaDefinition SetSchema(string schemaName, bool useExisting = true) { string filePath = SchemaNameToFilePath(schemaName); lock (FileLock.Named(filePath)) { if (!useExisting && File.Exists(filePath)) { if (BackupExisting) { string backUpPath = SchemaNameToFilePath("{0}_{1}_{2}"._Format(schemaName, DateTime.UtcNow.ToJulianDate(), 4.RandomLetters())); File.Move(filePath, backUpPath); } else { File.Delete(filePath); } } SchemaDefinition schema = LoadSchema(schemaName); CurrentSchema = schema; return(schema); } }