/[gr2lib]/trunk/gr2lib/core/coreclasses/apiversion/granny2apiversion.cs
ViewVC logotype

Diff of /trunk/gr2lib/core/coreclasses/apiversion/granny2apiversion.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 93 by william, Sat Jul 17 05:09:00 2010 UTC revision 191 by william, Sat Jul 24 06:31:50 2010 UTC
# Line 5  using System.Text; Line 5  using System.Text;
5  using gr2lib.core.typedefs;  using gr2lib.core.typedefs;
6  using gr2lib.core.exceptions;  using gr2lib.core.exceptions;
7  using gr2lib.core.interfaces;  using gr2lib.core.interfaces;
8    using System.ComponentModel;
9    
10  namespace gr2lib.core.apiversion  namespace gr2lib.core.apiversion
11  {  {
12      #region public class VersionType      #region public class VersionType
13        /// <summary>
14        /// Iversiontype inteface
15        /// </summary>
16      public interface Iversiontype      public interface Iversiontype
17      {      {
18          granny_int32x major { get; }          /// <summary>
19          granny_int32x minor { get; }          /// get/set the major
20          granny_int32x customization { get; }          /// </summary>
21          granny_int32x build { get; }          int major { get; set; }
22          string version { get; }          /// <summary>
23            /// get/set the minor
24            /// </summary>
25            int minor { get; set; }
26            /// <summary>
27            /// get/set the customization
28            /// </summary>
29            int customization { get; set; }
30            /// <summary>
31            /// get/set the build
32            /// </summary>
33            int build { get; set; }
34            //string version { get; }
35      }      }
36        /// <summary>
37        /// versiontype class
38        /// </summary>
39      public class versiontype : Iversiontype      public class versiontype : Iversiontype
40      {      {
41          /// <summary>          /// <summary>
# Line 33  namespace gr2lib.core.apiversion Line 51  namespace gr2lib.core.apiversion
51          /// <summary>          /// <summary>
52          /// versiontype construction: major.minor.customization.build          /// versiontype construction: major.minor.customization.build
53          /// </summary>          /// </summary>
54          public versiontype(granny_int32x major, granny_int32x minor, granny_int32x customization, granny_int32x build)          public versiontype(int major, int minor, int customization, int build)
55          {          {
56              this.major = major;              this.major = major;
57              this.minor = minor;              this.minor = minor;
# Line 47  namespace gr2lib.core.apiversion Line 65  namespace gr2lib.core.apiversion
65          {          {
66              string[] _version = version.Split('.');              string[] _version = version.Split('.');
67                            
68              this.major = _version[0];              this.major = Convert.ToInt32(_version[0]);
69              this.minor = _version[1];              this.minor = Convert.ToInt32(_version[1]);
70              this.customization = _version[2];              this.customization = Convert.ToInt32(_version[2]);
71              this.build = _version[3];              this.build = Convert.ToInt32(_version[3]);
72          }          }
73          /// <summary>          /// <summary>
74          /// Gets this version in format: major.minor.customization.build          /// Gets this version in format: major.minor.customization.build
# Line 65  namespace gr2lib.core.apiversion Line 83  namespace gr2lib.core.apiversion
83          /// <summary>          /// <summary>
84          /// Returns a string representation of the Granny2 API Version in format (major.minor.customization.build)          /// Returns a string representation of the Granny2 API Version in format (major.minor.customization.build)
85          /// </summary>          /// </summary>
86          public string version { get { return string.Format("{0}.{1}.{2}.{3}", major, minor, customization, build); } }          private string version { get { return string.Format("{0}.{1}.{2}.{3}", major, minor, customization, build); } }
87          private granny_int32x _major;          private int _major;
88          /// <summary>          /// <summary>
89          /// Returns the Major of the Granny2 API Version (X.0.0.0)          /// Returns the Major of the Granny2 API Version (X.0.0.0)
90          /// </summary>          /// </summary>
91          public granny_int32x major { get { return _major; } private set { _major = value; } }          [RefreshPropertiesAttribute(RefreshProperties.All)]        
92            public int major { get { return _major; } set { _major = value; } }
93    
94          private granny_int32x _minor;          private int _minor;
95          /// <summary>          /// <summary>
96          /// Returns the Minor of the Granny2 API Version (0.X.0.0)          /// Returns the Minor of the Granny2 API Version (0.X.0.0)
97          /// </summary>          /// </summary>
98          public granny_int32x minor { get { return _minor; } private set { _minor = value; } }          [RefreshPropertiesAttribute(RefreshProperties.All)]        
99            public int minor { get { return _minor; } set { _minor = value; } }
100    
101          private granny_int32x _customization;          private int _customization;
102          /// <summary>          /// <summary>
103          /// Returns the Customization of the Granny2 API Version - Customization (0.0.X.0)          /// Returns the Customization of the Granny2 API Version - Customization (0.0.X.0)
104          /// </summary>          /// </summary>
105          public granny_int32x customization { get { return _customization; } private set { _customization = value; } }          [RefreshPropertiesAttribute(RefreshProperties.All)]          
106            public int customization { get { return _customization; } set { _customization = value; } }
107    
108          private granny_int32x _build;          private int _build;
109          /// <summary>          /// <summary>
110          /// Returns the Build of the Granny2 API Version (0.0.0.X)          /// Returns the Build of the Granny2 API Version (0.0.0.X)
111          /// </summary>          /// </summary>
112          public granny_int32x build { get { return _build; } private set { _build = value; } }          [RefreshPropertiesAttribute(RefreshProperties.All)]  
113            public int build { get { return _build; } set { _build = value; } }
114          #endregion          #endregion
115      }      }
116      #endregion      #endregion
# Line 110  namespace gr2lib.core.apiversion Line 132  namespace gr2lib.core.apiversion
132                                               apiversiontype.GrannyProductCustomization,                                               apiversiontype.GrannyProductCustomization,
133                                               apiversiontype.GrannyProductBuildNumber);                                               apiversiontype.GrannyProductBuildNumber);
134    
135              granny2apiloader _loader = new granny2apiloader();              granny2apiloader _loader = new granny2apiloader(true);
136              this._apiversion = new versiontype();              this._apiversion = new versiontype();
137              this._apiversionsmatch = this.GrannyVersionsMatch();              this._apiversionsmatch = this.GrannyVersionsMatch();
138              this.GetGrannyVersion();              this.GetGrannyVersion();
139    
140          }          }
141          /// <summary>          /// <summary>
142            /// Default granny2apiversion Constructor: Expect Granny2 API -> 2.7.0.30 (allow disable looking for granny api)
143            /// </summary>
144            public granny2apiversion(bool checkforgrannyapi)
145            {
146                if (checkforgrannyapi)
147                {
148                    this._expectedapiversion = new versiontype(
149                                                     apiversiontype.GrannyProductMajorVersion,
150                                                     apiversiontype.GrannyProductMinorVersion,
151                                                     apiversiontype.GrannyProductCustomization,
152                                                     apiversiontype.GrannyProductBuildNumber);
153    
154                    granny2apiloader _loader = new granny2apiloader(checkforgrannyapi);
155                    this._apiversion = new versiontype();
156                    this._apiversionsmatch = this.GrannyVersionsMatch();
157                    this.GetGrannyVersion();
158                }
159    
160            }
161            /// <summary>
162          /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build          /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build
163          /// </summary>          /// </summary>
164          public granny2apiversion(granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)          public granny2apiversion(granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)
# Line 127  namespace gr2lib.core.apiversion Line 169  namespace gr2lib.core.apiversion
169                                   ExpectedCustomization,                                   ExpectedCustomization,
170                                   ExpectedBuildNumber);                                   ExpectedBuildNumber);
171    
172              granny2apiloader _loader = new granny2apiloader();              granny2apiloader _loader = new granny2apiloader(true);
173              this._apiversion = new versiontype();              this._apiversion = new versiontype();
174              this._apiversionsmatch = this.GrannyVersionsMatch();              this._apiversionsmatch = this.GrannyVersionsMatch();
175              this.GetGrannyVersion();              this.GetGrannyVersion();
176          }          }
177          /// <summary>          /// <summary>
178            /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build
179            /// </summary>
180            public granny2apiversion(bool checkforgrannyapi, granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)
181            {
182                if (checkforgrannyapi)
183                {
184                    this._expectedapiversion = new versiontype(
185                                         ExpectedMajorVersion,
186                                         ExpectedMinorVersion,
187                                         ExpectedCustomization,
188                                         ExpectedBuildNumber);
189    
190                    granny2apiloader _loader = new granny2apiloader(checkforgrannyapi);
191                    this._apiversion = new versiontype();
192                    this._apiversionsmatch = this.GrannyVersionsMatch();
193                    this.GetGrannyVersion();
194                }
195            }
196            /// <summary>
197          /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")          /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")
198          /// </summary>          /// </summary>
199          public granny2apiversion(string ExceptedVersion)          public granny2apiversion(string ExceptedVersion)
200          {          {
201              this._expectedapiversion = new versiontype(ExceptedVersion);              this._expectedapiversion = new versiontype(ExceptedVersion);
202    
203              granny2apiloader _loader = new granny2apiloader();              granny2apiloader _loader = new granny2apiloader(true);
204              this._apiversion = new versiontype();              this._apiversion = new versiontype();
205              this._apiversionsmatch = this.GrannyVersionsMatch();              this._apiversionsmatch = this.GrannyVersionsMatch();
206              this.GetGrannyVersion();              this.GetGrannyVersion();
207          }          }
208            /// <summary>
209            /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")
210            /// </summary>
211            public granny2apiversion(bool checkforgrannyapi,string ExceptedVersion)
212            {
213                if (checkforgrannyapi)
214                {
215                    this._expectedapiversion = new versiontype(ExceptedVersion);
216    
217                    granny2apiloader _loader = new granny2apiloader(checkforgrannyapi);
218                    this._apiversion = new versiontype();
219                    this._apiversionsmatch = this.GrannyVersionsMatch();
220                    this.GetGrannyVersion();
221                }
222            }
223    
224          #region APIVersion Support          #region APIVersion Support
225          private class apiversiontype          private class apiversiontype
# Line 158  namespace gr2lib.core.apiversion Line 234  namespace gr2lib.core.apiversion
234    
235          private bool GrannyVersionsMatch()          private bool GrannyVersionsMatch()
236          {          {
237              return gr2lib.core.coreapi.GrannyVersionsMatch(              return gr2lib.core.coreapi.VersionSupport.GrannyVersionsMatch(
238                  this._expectedapiversion.major,                  this._expectedapiversion.major,
239                  this._expectedapiversion.minor,                  this._expectedapiversion.minor,
240                  this._expectedapiversion.customization,                  this._expectedapiversion.customization,
# Line 171  namespace gr2lib.core.apiversion Line 247  namespace gr2lib.core.apiversion
247              granny_int32x customization = 0;              granny_int32x customization = 0;
248              granny_int32x build = 0;              granny_int32x build = 0;
249    
250              gr2lib.core.coreapi.GrannyGetVersion(              gr2lib.core.coreapi.VersionSupport.GrannyGetVersion(
251                  ref major,                  ref major,
252                  ref minor,                  ref minor,
253                  ref customization,                  ref customization,
# Line 182  namespace gr2lib.core.apiversion Line 258  namespace gr2lib.core.apiversion
258          }          }
259          private string GrannyGetVersionString()          private string GrannyGetVersionString()
260          {          {
261              return gr2lib.core.coreapi.GrannyGetVersionString();              return gr2lib.core.coreapi.VersionSupport.GrannyGetVersionString();
262          }          }
263          #endregion          #endregion
264    

Legend:
Removed from v.93  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.22