public static void EnsureLibraryRegistered(Program program, Schema.LibraryReference libraryReference, bool withReconciliation) { Schema.LoadedLibrary loadedLibrary = program.CatalogDeviceSession.ResolveLoadedLibrary(libraryReference.Name, false); if (loadedLibrary == null) { Schema.LoadedLibrary currentLibrary = program.ServerProcess.ServerSession.CurrentLibrary; try { Schema.Library library = program.Catalog.Libraries[libraryReference.Name]; if (!VersionNumber.Compatible(libraryReference.Version, library.Version)) { throw new Schema.SchemaException(Schema.SchemaException.Codes.LibraryVersionMismatch, libraryReference.Name, libraryReference.Version.ToString(), library.Version.ToString()); } RegisterLibrary(program, library.Name, withReconciliation); } finally { program.ServerProcess.ServerSession.CurrentLibrary = currentLibrary; } } else { Schema.Library library = program.Catalog.Libraries[libraryReference.Name]; if (!VersionNumber.Compatible(libraryReference.Version, library.Version)) { throw new Schema.SchemaException(Schema.SchemaException.Codes.LibraryVersionMismatch, libraryReference.Name, libraryReference.Version.ToString(), library.Version.ToString()); } } }
public override object InternalExecute(Program program, object[] arguments) { #if NILPROPOGATION if (arguments[0] == null) { return(null); } #endif Schema.LibraryReference reference = (Schema.LibraryReference)arguments[0]; return(reference.Version); }
public override object InternalExecute(Program program, object[] arguments) { #if NILPROPOGATION if (arguments[0] == null || arguments[1] == null) { return(null); } #endif Schema.LibraryReference library = (Schema.LibraryReference)arguments[0]; library.Version = (VersionNumber)arguments[1]; return(library); }