private void AssemblyStore_OnNewAssemblyAdded(AssemblyTools.EventArgs.NewAssemblyAddedEventArgs args) { TreeViewItem assemblyNode = BuildTreeViewNodesForAssembly(args); assemblyNode.IsExpanded = true; NavigationTreeView.Items.Add(assemblyNode); }
private TreeViewItem BuildTreeViewNodesForAssembly(AssemblyTools.EventArgs.NewAssemblyAddedEventArgs args) { //build assembly node ILQPTreeViewItemTagData tagData = new ILQPTreeViewItemTagData() { AssemblyId = args.AssemblyId, NodeType = ILQPTreeViewNodeType.Assembly }; TreeViewItem assemblyNode = BuildTreeviewItem(args.AssemblyName, tagData); assemblyNode.Items.Add(BuildReferencesNodeForAssembly(args.AssemblyId)); foreach(TreeViewItem namespaceNode in BuildNamespaceNodes(args.AssemblyId)) { assemblyNode.Items.Add(namespaceNode); } return assemblyNode; }
/// <summary> /// Gets the MOP core version. /// </summary> /// <returns></returns> public static MopVersion GetCoreVersion() { return(AssemblyTools.GetAssemblyVersion(Assembly.GetExecutingAssembly())); }
private static int Main(string[] args) { GlobalInitializationOps.InitStatics(new GlobalInitializer(), "Development Utility", true); try { return(GlobalInitializationOps.ExecuteAppWithStandardExceptionHandling( () => { try { AppStatics.Init(); if (args.Length < 2) { throw new UserCorrectableException("You must specify the installation path as the first argument and the operation name as the second."); } // Create installations folder from template if necessary. var installationPath = args[0]; var templateFolderPath = getInstallationsFolderPath(installationPath, true); var message = ""; if (!Directory.Exists(templateFolderPath)) { message = "No installation-configuration template exists."; } else { var configurationFolderPath = getInstallationsFolderPath(installationPath, false); if (IoMethods.GetFilePathsInFolder(configurationFolderPath, searchOption: SearchOption.AllDirectories).Any()) { message = "Installation configuration already exists."; } else { IoMethods.CopyFolder(templateFolderPath, configurationFolderPath, false); Console.WriteLine("Created installation configuration from template."); } } if (args[1] == "CreateInstallationConfiguration") { if (message.Any()) { throw new UserCorrectableException(message); } return; } // Get installation. DevelopmentInstallation installation; try { installation = getInstallation(installationPath); } catch (Exception e) { throw new UserCorrectableException("The installation at \"" + installationPath + "\" is invalid.", e); } // Get operation. var operations = AssemblyTools.BuildSingletonDictionary <Operation, string>(Assembly.GetExecutingAssembly(), i => i.GetType().Name); var operationName = args[1]; if (!operations.ContainsKey(operationName)) { throw new UserCorrectableException(operationName + " is not a known operation."); } var operation = operations[operationName]; if (!operation.IsValid(installation)) { throw new UserCorrectableException("The " + operation.GetType().Name + " operation cannot be performed on this installation."); } operation.Execute(installation, args.Skip(2).ToImmutableArray(), new OperationResult()); } catch (Exception e) { Output.WriteTimeStampedError(e.ToString()); if (e is UserCorrectableException) { throw new DoNotEmailOrLogException(); } throw; } })); } finally { GlobalInitializationOps.CleanUpStatics(); } }
protected override Dictionary <TKey, Type> SerializedDataAsDict(IEnumerable <Type> serializedData) { return(AssemblyTools.BuildDictionaryFromEnumProperty <TKey>(serializedData)); }