Пример #1
0
		private void AddExtensions(AddIn.Extension extension)
		{
			DefaultAddInTreeNode localRoot = CreateTreeNode(root, extension.Path);
			
			foreach (ICodon codon in extension.CodonCollection) {
				DefaultAddInTreeNode treeNode = CreateTreeNode(localRoot, codon.ID);
				if (treeNode.Codon != null) {
					throw new DuplicateCodonException(codon.ID);
				}
				treeNode.Codon              = codon;
				treeNode.ConditionCollection = (ConditionCollection)extension.Conditions[codon.ID];
			}
		}
        private static void InsertAddIns(StringCollection addInFiles)
        {
	        foreach (string addInFile in addInFiles) {
		        AddIn addIn = new AddIn();
		        try {
			        addIn.Initialize(addInFile);
			        addInTree.InsertAddIn(addIn);
		        } 

		        catch (Exception e) {
			        throw new AddInInitializeException(addInFile, e);
		        } 
	        }
        }
		/// <summary>
		/// Initialize all addIn object from addIn file collection, and insert them into the addIn tree.
		/// </summary>
		static void InsertAddIns(StringCollection addInFiles)
		{
			foreach (string addInFile in addInFiles) 
			{
				AddIn addIn = new AddIn();//先新建一个插件实例
				try 
				{
					addIn.Initialize(addInFile);//通过当前插件文件来初始化这个插件实例
					addInTree.InsertAddIn(addIn);//将这个初始化好的插件插入到插件树中
				}
				catch (Exception e) 
				{
					throw new Exception("初始化插件文件 " + addInFile + " 时出错 : \n" + e.Message, e);
				}
			}
			
		}
Пример #4
0
		/// <summary>
		///    <para>Returns the index of a <see cref="AddIn"/> in
		///       the <see cref="AddInCollection"/> .</para>
		/// </summary>
		/// <param name="value">The <see cref="AddIn"/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref="AddIn"/> of <paramref name="value"/> in the
		/// <see cref="AddInCollection"/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref="AddInCollection.Contains"/>
		public int IndexOf(AddIn value) 
		{
			return List.IndexOf(value);
		}
Пример #5
0
		/// <summary>
		/// <para>Gets a value indicating whether the
		///    <see cref="AddInCollection"/> contains the specified <see cref="AddIn"/>.</para>
		/// </summary>
		/// <param name="value">The <see cref="AddIn"/> to locate.</param>
		/// <returns>
		/// <para><see langword="true"/> if the <see cref="AddIn"/> is contained in the collection;
		///   otherwise, <see langword="false"/>.</para>
		/// </returns>
		/// <seealso cref="AddInCollection.IndexOf"/>
		public bool Contains(AddIn value) 
		{
			return List.Contains(value);
		}
Пример #6
0
		/// <summary>
		///    <para>Adds a <see cref="AddIn"/> with the specified value to the
		///    <see cref="AddInCollection"/> .</para>
		/// </summary>
		/// <param name="value">The <see cref="AddIn"/> to add.</param>
		/// <returns>
		///    <para>The index at which the new element was inserted.</para>
		/// </returns>
		public int Add(AddIn value) 
		{
			return List.Add(value);
		}
Пример #7
0
		/// <summary>
		///    <para> Removes a specific <see cref="AddIn"/> from the
		///    <see cref="AddInCollection"/> .</para>
		/// </summary>
		/// <param name="value">The <see cref="AddIn"/> to remove from the <see cref="AddInCollection"/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref="System.ArgumentException"><paramref name="value"/> is not found in the Collection. </exception>
		public void Remove(AddIn value) 
		{
			List.Remove(value);
		}
Пример #8
0
		/// <summary>
		/// Add a <see cref="AddIn"/> object to the tree, inserting all it's extensions.
		/// </summary>
		public void InsertAddIn(AddIn addIn)
		{
			addIns.Add(addIn);
			foreach (AddIn.Extension extension in addIn.Extensions) {
				//先根据一个如<Extension path = "/Workspace/Services">之类的extension.Path扩展路径创建一个节点
				DefaultAddInTreeNode currentNode = CreateTreeNode(root, extension.Path);
				//然后对该扩展路径下的代码子集合列表进行迭代,分别创建为currentNode的子节点,以构成一个树状结构		
				foreach (ICodon codon in extension.CodonCollection) 
				{
					DefaultAddInTreeNode currentChildNode = CreateTreeNode(currentNode, codon.ID);
					if (currentChildNode.Codon != null) 
					{
						throw new Exception("已经存在一个名为 : " + codon.ID + " 的代码子");
					}
					currentChildNode.Codon              = codon;
				}

			}
		}
Пример #9
0
		/// <summary>
		/// Removes an AddIn from the AddInTree.
		/// </summary>
		public void RemoveAddIn(AddIn addIn)
		{ // TODO : Implement the RemoveAddInMethod
			throw new ApplicationException("Implement ME!");
		}
Пример #10
0
		public void InsertAddIn(AddIn addIn)
		{
			addIns.Add(addIn);
			foreach (AddIn.Extension extension in addIn.Extensions) {
				AddExtensions(extension);
			}
		}
Пример #11
0
 /// <summary>
 ///    <para>Returns the index of a <see cref="AddIn"/> in
 ///       the <see cref="AddInCollection"/> .</para>
 /// </summary>
 /// <param name="value">The <see cref="AddIn"/> to locate.</param>
 /// <returns>
 /// <para>The index of the <see cref="AddIn"/> of <paramref name="value"/> in the
 /// <see cref="AddInCollection"/>, if found; otherwise, -1.</para>
 /// </returns>
 /// <seealso cref="AddInCollection.Contains"/>
 public int IndexOf(AddIn value)
 {
     return(List.IndexOf(value));
 }
Пример #12
0
 /// <summary>
 /// <para>Gets a value indicating whether the
 ///    <see cref="AddInCollection"/> contains the specified <see cref="AddIn"/>.</para>
 /// </summary>
 /// <param name="value">The <see cref="AddIn"/> to locate.</param>
 /// <returns>
 /// <para><see langword="true"/> if the <see cref="AddIn"/> is contained in the collection;
 ///   otherwise, <see langword="false"/>.</para>
 /// </returns>
 /// <seealso cref="AddInCollection.IndexOf"/>
 public bool Contains(AddIn value)
 {
     return(List.Contains(value));
 }
Пример #13
0
 /// <summary>
 ///    <para>Adds a <see cref="AddIn"/> with the specified value to the
 ///    <see cref="AddInCollection"/> .</para>
 /// </summary>
 /// <param name="value">The <see cref="AddIn"/> to add.</param>
 /// <returns>
 ///    <para>The index at which the new element was inserted.</para>
 /// </returns>
 public int Add(AddIn value)
 {
     return(List.Add(value));
 }
Пример #14
0
 /// <summary>
 ///    <para> Removes a specific <see cref="AddIn"/> from the
 ///    <see cref="AddInCollection"/> .</para>
 /// </summary>
 /// <param name="value">The <see cref="AddIn"/> to remove from the <see cref="AddInCollection"/> .</param>
 /// <returns><para>None.</para></returns>
 /// <exception cref="System.ArgumentException"><paramref name="value"/> is not found in the Collection. </exception>
 public void Remove(AddIn value)
 {
     List.Remove(value);
 }