public static void BUYLSetContentLibraryPath(Autodesk.Revit.ApplicationServices.Application app) { if(BUYLTools.ContentLoader.GitContentLoader.CheckForContentRepositoryDirectory()) { if(app != null) { bool contained = false; IDictionary<string, string> libs = app.GetLibraryPaths(); if(libs.ContainsKey(BUYLTools.ContentLoader.GitContentLoader.buylContent)) { contained = true; } else { foreach (string item in libs.Keys) { if(libs[item] == BUYLTools.ContentLoader.GitContentLoader.pathToLocalContentRepository) { contained = true; break; } } } if(!contained) { libs.Add(BUYLTools.ContentLoader.GitContentLoader.buylContent, BUYLTools.ContentLoader.GitContentLoader.GetLibraryPath()); app.SetLibraryPaths(libs); } } } }
private void Stream(ArrayList data, Autodesk.Revit.ApplicationServices.Application app) { data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.Revit.ApplicationServices.Application))); data.Add(new Snoop.Data.Object("Cities", app.Cities)); data.Add(new Snoop.Data.Enumerable("Documents", app.Documents)); data.Add(new Snoop.Data.String("Language", app.Language.ToString())); data.Add(new Snoop.Data.Enumerable("Library Paths", app.GetLibraryPaths())); data.Add(new Snoop.Data.String("Shared Parameter File", app.SharedParametersFilename)); data.Add(new Snoop.Data.String("Family Template Path", app.FamilyTemplatePath)); data.Add(new Snoop.Data.String("Product", app.Product.ToString())); data.Add(new Snoop.Data.String("Recording journal filename", app.RecordingJournalFilename)); data.Add(new Snoop.Data.String("Version build", app.VersionBuild)); data.Add(new Snoop.Data.String("Version name", app.VersionName)); data.Add(new Snoop.Data.String("Version number", app.VersionNumber)); data.Add(new Snoop.Data.String("Current Accelerator", app.CurrentRevitServerAccelerator)); data.Add(new Snoop.Data.String("User Name", app.Username)); data.Add(new Snoop.Data.Double("Vertex Tolerance", app.VertexTolerance)); data.Add(new Snoop.Data.Object("Schema", Schema.ListSchemas())); data.Add(new Snoop.Data.Bool("IsArchitectureEnabled", app.IsArchitectureEnabled)); data.Add(new Snoop.Data.Bool("IsElectricalAnalysisEnabled", app.IsElectricalAnalysisEnabled)); data.Add(new Snoop.Data.Bool("IsElectricalEnabled", app.IsElectricalEnabled)); data.Add(new Snoop.Data.Bool("IsEnergyAnalysisEnabled", app.IsEnergyAnalysisEnabled)); data.Add(new Snoop.Data.Bool("IsMassingEnabled", app.IsMassingEnabled)); data.Add(new Snoop.Data.Bool("IsMechanicalAnalysisEnabled", app.IsMechanicalAnalysisEnabled)); data.Add(new Snoop.Data.Bool("IsMechanicalEnabled", app.IsMechanicalEnabled)); data.Add(new Snoop.Data.Bool("IsPipingAnalysisEnabled", app.IsPipingAnalysisEnabled)); data.Add(new Snoop.Data.Bool("IsPipingEnabled", app.IsPipingEnabled)); data.Add(new Snoop.Data.Bool("IsStructuralAnalysisEnabled", app.IsStructuralAnalysisEnabled)); data.Add(new Snoop.Data.Bool("IsStructureEnabled", app.IsStructureEnabled)); data.Add(new Snoop.Data.Bool("IsSystemsEnabled", app.IsSystemsEnabled)); }
// Helper function - find the given file name in the set of Revit library paths. public string findFile(Autodesk.Revit.ApplicationServices.Application rvtApp, string fileName) { IDictionary<string, string> paths = rvtApp.GetLibraryPaths(); IEnumerator<KeyValuePair<string, string>> iter = paths.GetEnumerator(); string filePath = null; // loop through each path in the collection. while ((iter.MoveNext())) { string path = iter.Current.Value; //libPaths += ControlChars.Tab + path + ";" + ControlChars.NewLine; filePath = SearchFile(path, fileName); if ((filePath != null)) { return filePath; } } filePath = SearchFile(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), fileName); if ((filePath != null)) { return filePath; } return null; }