public void AddLibrary(int moduleId, JackrabbitLibrary library)
 {
     var contentItem = new ContentItem { ContentTypeId = this.JackrabbitFileContentType.ContentTypeId, ModuleID = moduleId,};
     FillContentItem(library, contentItem);
     this.contentController.AddContentItem(contentItem);
 }
        public void UpdateLibrary(JackrabbitLibrary library)
        {
            var contentItem = this.contentController.GetContentItem(library.Id);
            if (contentItem == null)
            {
                return;
            }

            FillContentItem(library, contentItem);
            this.contentController.UpdateContentItem(contentItem);
        }
 private static void FillContentItem(JackrabbitLibrary library, ContentItem contentItem)
 {
     contentItem.Content = library.LibraryName;
     contentItem.Metadata["FileType"] = library.FileType.ToString();
     contentItem.Metadata["Version"] = library.Version.ToString();
     contentItem.Metadata["Specificity"] = library.Specificity.ToString();
 }
        public JackrabbitLibraryInfo GetLibraryInfo(JackrabbitLibrary library)
        {
            var libraries = from l in JavaScriptLibraryController.Instance.GetLibraries()
                            where l.LibraryName.Equals(library.LibraryName, StringComparison.OrdinalIgnoreCase)
                            where l.Version >= library.Version
                            where library.Specificity == SpecificVersion.Latest
                            || (library.Specificity == SpecificVersion.LatestMajor && l.Version.Major == library.Version.Major)
                            || (library.Specificity == SpecificVersion.LatestMinor && l.Version.Major == library.Version.Major && l.Version.Minor == library.Version.Minor)
                            || ((int)library.Specificity == 3 && l.Version == library.Version)
                            orderby l.Version descending
                            select l;

            var matchingLibrary = libraries.FirstOrDefault();
            if (matchingLibrary == null)
            {
                return JackrabbitLibraryInfo.Null;
            }

            var path = GetLibraryPath(matchingLibrary);
            var provider = ScriptLocationToProviderName[matchingLibrary.PreferredScriptLocation];
            var priority = matchingLibrary.PackageID + (int)FileOrder.Js.DefaultPriority;

            return new JackrabbitLibraryInfo(path, provider, priority);
        }