Пример #1
0
        public bool IsResourceWellFormed(ExternalResourceReference extRef)
        {
            bool valid = false;

            try
            {
                if (extRef.ServerId != GetServerId())
                {
                    return(false);
                }
                if (!extRef.HasValidDisplayPath())
                {
                    return(false);
                }

                IDictionary <string, string> refMap = extRef.GetReferenceInformation();
                if (refMap.ContainsKey("VersionNumber"))
                {
                    valid = KeynoteDatabase.IsValidRevitVersion(refMap["VersionNumber"]);
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
            return(valid);
        }
Пример #2
0
        public void SetupKeynoteDatabaseBrowserData(ExternalResourceBrowserData browserData)
        {
            try
            {
                string folderPath    = browserData.FolderPath;
                string versionFolder = "RVT" + versionNumber;
                if (folderPath == "/")
                {
                    browserData.AddSubFolder("RVT2014");
                    browserData.AddSubFolder("RVT2015");
                    browserData.AddSubFolder("RVT2016");
                }
                else if (folderPath.EndsWith("/" + versionFolder))
                {
                    Dictionary <string, string> referenceMap = new Dictionary <string, string>();
                    referenceMap.Add("VersionNumber", versionNumber);
                    referenceMap.Add("ProjectName", "Test");
                    browserData.AddResource("Test Keynote.txt", KeynoteDatabase.GetCurrentVersion(), referenceMap);

                    Dictionary <string, string> referenceMap2 = new Dictionary <string, string>();
                    referenceMap2.Add("VersionNumber", versionNumber);
                    referenceMap2.Add("ProjectName", "LocalDB");
                    browserData.AddResource("KeynoteDB_local.txt", KeynoteDatabase.GetCurrentVersion(), referenceMap2);

                    Dictionary <string, string> referenceMap3 = new Dictionary <string, string>();
                    referenceMap3.Add("VersionNumber", versionNumber);
                    referenceMap3.Add("ProjectName", "CloudDB");
                    browserData.AddResource("KeynoteDB_cloud.txt", KeynoteDatabase.GetCurrentVersion(), referenceMap3);
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
Пример #3
0
        private string GetCurrentAvailableResourceVersion(ExternalResourceReference extResRef)
        {
            string databaseVersion = "";

            try
            {
                IDictionary <string, string> refMap = extResRef.GetReferenceInformation();
                if (refMap.ContainsKey("VersionNumber"))
                {
                    return(KeynoteDatabase.GetCurrentVersion());
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
            return(databaseVersion);
        }
Пример #4
0
        private void LoadKeynoteDataResource(ExternalResourceReference resourceReference, ExternalResourceLoadContent loadContent)
        {
            try
            {
                KeyBasedTreeEntriesLoadContent entriesContent = (KeyBasedTreeEntriesLoadContent)loadContent;
                if (null == entriesContent)
                {
                    throw new ArgumentException("Wrong type of ExternalResourceLoadContent (expecting a KeyBasedTreeEntriesLoadContent) for keynote data.", "loadContent");
                }

                entriesContent.Reset();
                IDictionary <string, string> refMap = resourceReference.GetReferenceInformation();
                if (refMap.ContainsKey("VersionNumber") && refMap.ContainsKey("ProjectName"))
                {
                    KeynoteDatabase.LoadKeynoteEntries(refMap, ref entriesContent);
                    entriesContent.BuildEntries();
                    loadContent.LoadStatus = ExternalResourceLoadStatus.Success;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }