source: trunk/CrypPlugins/WorkspaceManager/Model/ConnectionModel.cs @ 2280

Last change on this file since 2280 was 1905, checked in by kopal, 11 years ago

fixed problem with adding plugins with BigInteger/s

File size: 3.2 KB
Line 
1/*                             
2   Copyright 2010 Nils Kopal, Viktor M.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using System.Reflection;
22
23namespace WorkspaceManager.Model
24{
25    /// <summary>
26    /// Class to represent the Connection between two Connector Models
27    /// </summary>
28    [Serializable]
29    public class ConnectionModel : VisualElementModel
30    {
31
32        #region private members
33
34        /// <summary>
35        /// Name of the Connection type
36        /// </summary>
37        private string ConnectionTypeName = null;
38
39        /// <summary>
40        /// Name of the Connection assembly
41        /// </summary>
42        private string ConnectionTypeAssemblyName = null;
43
44        #endregion
45
46        #region public members
47
48        /// <summary>
49        /// The starting Point of this Connection Model
50        /// </summary>
51        public ConnectorModel From { get; set; }
52
53        /// <summary>
54        /// The ending Point of this Connection Model
55        /// </summary>
56        public ConnectorModel To { get; set; }
57
58        /// <summary>
59        /// Is the Connection active?
60        /// </summary>       
61        public bool Active { get; set; }
62
63        /// <summary>
64        /// The Type of the Wrapped IPlugin of this PluginModel
65        /// Depending on this the Plugin of this PluginModel will be instanciated
66        /// </summary>       
67        public Type ConnectionType
68        {
69            get
70            {
71                if (this.ConnectionTypeName != null)
72                {
73                    if (ConnectionTypeName.Equals("System.Numerics.BigInteger"))
74                    {
75                        return typeof(System.Numerics.BigInteger);
76                    }
77                    if (ConnectionTypeName.Equals("System.Numerics.BigInteger[]"))
78                    {
79                        return typeof(System.Numerics.BigInteger[]);
80                    }
81                    Assembly assembly = Assembly.Load(ConnectionTypeAssemblyName);
82                    Type t = assembly.GetType(ConnectionTypeName);
83                    return t;
84                }
85                else
86                {
87                    return null;
88                }
89            }
90            set
91            {
92                this.ConnectionTypeName = value.FullName;
93                this.ConnectionTypeAssemblyName = value.Assembly.GetName().Name;
94            }
95        }
96
97        /// <summary>
98        /// The WorkspaceModel of this ConnectionModel
99        /// </summary>
100        public WorkspaceModel WorkspaceModel { get; set; }
101
102        #endregion
103
104    }
105}
Note: See TracBrowser for help on using the repository browser.