/[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 45 by william, Thu Jul 15 04:40:28 2010 UTC revision 93 by william, Sat Jul 17 05:09:00 2010 UTC
# Line 3  using System.Collections.Generic; Line 3  using System.Collections.Generic;
3  using System.Text;  using System.Text;
4    
5  using gr2lib.core.typedefs;  using gr2lib.core.typedefs;
6    using gr2lib.core.exceptions;
7    using gr2lib.core.interfaces;
8    
9  namespace gr2lib.core.apiversion  namespace gr2lib.core.apiversion
10  {  {
# Line 18  namespace gr2lib.core.apiversion Line 20  namespace gr2lib.core.apiversion
20    
21      public class versiontype : Iversiontype      public class versiontype : Iversiontype
22      {      {
23            /// <summary>
24            /// default versiontype construction: 0.0.0.0
25            /// </summary>
26          public versiontype()          public versiontype()
27          {          {
28              this.major = 0;              this.major = 0;
# Line 25  namespace gr2lib.core.apiversion Line 30  namespace gr2lib.core.apiversion
30              this.customization = 0;              this.customization = 0;
31              this.build = 0;              this.build = 0;
32          }          }
33            /// <summary>
34            /// versiontype construction: major.minor.customization.build
35            /// </summary>
36          public versiontype(granny_int32x major, granny_int32x minor, granny_int32x customization, granny_int32x build)          public versiontype(granny_int32x major, granny_int32x minor, granny_int32x customization, granny_int32x build)
37          {          {
38              this.major = major;              this.major = major;
# Line 32  namespace gr2lib.core.apiversion Line 40  namespace gr2lib.core.apiversion
40              this.customization = customization;              this.customization = customization;
41              this.build = build;              this.build = build;
42          }          }
43            /// <summary>
44            /// versiontype construction: major.minor.customization.build (via string: "0.0.0.0")
45            /// </summary>
46            public versiontype(string version)
47            {
48                string[] _version = version.Split('.');
49                
50                this.major = _version[0];
51                this.minor = _version[1];
52                this.customization = _version[2];
53                this.build = _version[3];
54            }
55            /// <summary>
56            /// Gets this version in format: major.minor.customization.build
57            /// </summary>
58            /// <returns></returns>
59          public override string ToString()          public override string ToString()
60          {          {
61              return this.version;              return this.version;
# Line 71  namespace gr2lib.core.apiversion Line 94  namespace gr2lib.core.apiversion
94      #endregion      #endregion
95    
96      #region public class Granny2APIVersion      #region public class Granny2APIVersion
     public interface igranny2apiversion  
     {  
         bool apiversionsmatch { get; }  
         versiontype apiversion { get; }  
         versiontype expectedapiversion { get; }  
     }  
97      /// <summary>      /// <summary>
98      /// Handle's the checking of the Loaded Granny2 API Version      /// Handle's the checking of the Loaded Granny2 API Version
99      /// </summary>      /// </summary>
100      public class granny2apiversion : igranny2apiversion      public class granny2apiversion : igranny2apiversion
101      {      {
102            /// <summary>
103            /// Default granny2apiversion Constructor: Expect Granny2 API -> 2.7.0.30
104            /// </summary>
105          public granny2apiversion()          public granny2apiversion()
106          {          {
107                this._expectedapiversion = new versiontype(
108                                                 apiversiontype.GrannyProductMajorVersion,
109                                                 apiversiontype.GrannyProductMinorVersion,
110                                                 apiversiontype.GrannyProductCustomization,
111                                                 apiversiontype.GrannyProductBuildNumber);
112    
113                granny2apiloader _loader = new granny2apiloader();
114                this._apiversion = new versiontype();
115                this._apiversionsmatch = this.GrannyVersionsMatch();
116                this.GetGrannyVersion();
117    
118            }
119            /// <summary>
120            /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build
121            /// </summary>
122            public granny2apiversion(granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)
123            {
124                this._expectedapiversion = new versiontype(
125                                     ExpectedMajorVersion,
126                                     ExpectedMinorVersion,
127                                     ExpectedCustomization,
128                                     ExpectedBuildNumber);
129    
130                granny2apiloader _loader = new granny2apiloader();
131              this._apiversion = new versiontype();              this._apiversion = new versiontype();
132              this._apiversionsmatch = this.GrannyVersionsMatch();              this._apiversionsmatch = this.GrannyVersionsMatch();
133              this.GetGrannyVersion();              this.GetGrannyVersion();
134          }            }
135            /// <summary>
136            /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")
137            /// </summary>
138            public granny2apiversion(string ExceptedVersion)
139            {
140                this._expectedapiversion = new versiontype(ExceptedVersion);
141    
142                granny2apiloader _loader = new granny2apiloader();
143                this._apiversion = new versiontype();
144                this._apiversionsmatch = this.GrannyVersionsMatch();
145                this.GetGrannyVersion();
146            }
147    
148          #region APIVersion Support          #region APIVersion Support
149          private class apiversiontype          private class apiversiontype
150          {          {
# Line 102  namespace gr2lib.core.apiversion Line 159  namespace gr2lib.core.apiversion
159          private bool GrannyVersionsMatch()          private bool GrannyVersionsMatch()
160          {          {
161              return gr2lib.core.coreapi.GrannyVersionsMatch(              return gr2lib.core.coreapi.GrannyVersionsMatch(
162                  apiversiontype.GrannyProductMajorVersion,                  this._expectedapiversion.major,
163                  apiversiontype.GrannyProductMinorVersion,                  this._expectedapiversion.minor,
164                  apiversiontype.GrannyProductCustomization,                  this._expectedapiversion.customization,
165                  apiversiontype.GrannyProductBuildNumber);                  this._expectedapiversion.build);
166          }          }
167          private void GetGrannyVersion()          private void GetGrannyVersion()
168          {          {
# Line 140  namespace gr2lib.core.apiversion Line 197  namespace gr2lib.core.apiversion
197          /// Gets the Loaded Granny2 API Version          /// Gets the Loaded Granny2 API Version
198          /// </summary>          /// </summary>
199          public versiontype apiversion { get { return _apiversion; } }          public versiontype apiversion { get { return _apiversion; } }
200            private versiontype _expectedapiversion;
201          /// <summary>          /// <summary>
202          /// Gets the Expected Granny2 API Version          /// Gets the Expected Granny2 API Version
203          /// </summary>          /// </summary>
204          public versiontype expectedapiversion { get { return new versiontype(apiversiontype.GrannyProductMajorVersion, apiversiontype.GrannyProductMinorVersion, apiversiontype.GrannyProductCustomization, apiversiontype.GrannyProductBuildNumber); } }          public versiontype expectedapiversion { get { return _expectedapiversion; } }
205          #endregion          #endregion
206      }      }
207      #endregion      #endregion

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

  ViewVC Help
Powered by ViewVC 1.1.22