/[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 49 by william, Thu Jul 15 07:39:08 2010 UTC revision 60 by william, Thu Jul 15 08:28:43 2010 UTC
# Line 19  namespace gr2lib.core.apiversion Line 19  namespace gr2lib.core.apiversion
19    
20      public class versiontype : Iversiontype      public class versiontype : Iversiontype
21      {      {
22            /// <summary>
23            /// default versiontype construction: 0.0.0.0
24            /// </summary>
25          public versiontype()          public versiontype()
26          {          {
27              this.major = 0;              this.major = 0;
# Line 26  namespace gr2lib.core.apiversion Line 29  namespace gr2lib.core.apiversion
29              this.customization = 0;              this.customization = 0;
30              this.build = 0;              this.build = 0;
31          }          }
32            /// <summary>
33            /// versiontype construction: major.minor.customization.build
34            /// </summary>
35          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)
36          {          {
37              this.major = major;              this.major = major;
# Line 33  namespace gr2lib.core.apiversion Line 39  namespace gr2lib.core.apiversion
39              this.customization = customization;              this.customization = customization;
40              this.build = build;              this.build = build;
41          }          }
42            /// <summary>
43            /// versiontype construction: major.minor.customization.build (via string: "0.0.0.0")
44            /// </summary>
45            public versiontype(string version)
46            {
47                string[] _version = version.Split('.');
48                
49                this.major = _version[0];
50                this.minor = _version[1];
51                this.customization = _version[2];
52                this.build = _version[3];
53            }
54            /// <summary>
55            /// Gets this version in format: major.minor.customization.build
56            /// </summary>
57            /// <returns></returns>
58          public override string ToString()          public override string ToString()
59          {          {
60              return this.version;              return this.version;
# Line 83  namespace gr2lib.core.apiversion Line 104  namespace gr2lib.core.apiversion
104      /// </summary>      /// </summary>
105      public class granny2apiversion : igranny2apiversion      public class granny2apiversion : igranny2apiversion
106      {      {
107            /// <summary>
108            /// Default granny2apiversion Constructor: Expect Granny2 API -> 2.7.0.30
109            /// </summary>
110          public granny2apiversion()          public granny2apiversion()
111          {          {
112                this._expectedapiversion = new versiontype(
113                                                 apiversiontype.GrannyProductMajorVersion,
114                                                 apiversiontype.GrannyProductMinorVersion,
115                                                 apiversiontype.GrannyProductCustomization,
116                                                 apiversiontype.GrannyProductBuildNumber);
117    
118                granny2apiloader _loader = new granny2apiloader();
119                this._apiversion = new versiontype();
120                this._apiversionsmatch = this.GrannyVersionsMatch();
121                this.GetGrannyVersion();
122    
123            }
124            /// <summary>
125            /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build
126            /// </summary>
127            public granny2apiversion(granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)
128            {
129                this._expectedapiversion = new versiontype(
130                                     ExpectedMajorVersion,
131                                     ExpectedMinorVersion,
132                                     ExpectedCustomization,
133                                     ExpectedBuildNumber);
134    
135              granny2apiloader _loader = new granny2apiloader();              granny2apiloader _loader = new granny2apiloader();
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            /// <summary>
141            /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")
142            /// </summary>
143            public granny2apiversion(string ExceptedVersion)
144            {
145                this._expectedapiversion = new versiontype(ExceptedVersion);
146    
147                granny2apiloader _loader = new granny2apiloader();
148                this._apiversion = new versiontype();
149                this._apiversionsmatch = this.GrannyVersionsMatch();
150                this.GetGrannyVersion();
151            }
152    
153          #region APIVersion Support          #region APIVersion Support
154          private class apiversiontype          private class apiversiontype
155          {          {
# Line 104  namespace gr2lib.core.apiversion Line 164  namespace gr2lib.core.apiversion
164          private bool GrannyVersionsMatch()          private bool GrannyVersionsMatch()
165          {          {
166              return gr2lib.core.coreapi.GrannyVersionsMatch(              return gr2lib.core.coreapi.GrannyVersionsMatch(
167                  apiversiontype.GrannyProductMajorVersion,                  this._expectedapiversion.major,
168                  apiversiontype.GrannyProductMinorVersion,                  this._expectedapiversion.minor,
169                  apiversiontype.GrannyProductCustomization,                  this._expectedapiversion.customization,
170                  apiversiontype.GrannyProductBuildNumber);                  this._expectedapiversion.build);
171          }          }
172          private void GetGrannyVersion()          private void GetGrannyVersion()
173          {          {
# Line 142  namespace gr2lib.core.apiversion Line 202  namespace gr2lib.core.apiversion
202          /// Gets the Loaded Granny2 API Version          /// Gets the Loaded Granny2 API Version
203          /// </summary>          /// </summary>
204          public versiontype apiversion { get { return _apiversion; } }          public versiontype apiversion { get { return _apiversion; } }
205            private versiontype _expectedapiversion;
206          /// <summary>          /// <summary>
207          /// Gets the Expected Granny2 API Version          /// Gets the Expected Granny2 API Version
208          /// </summary>          /// </summary>
209          public versiontype expectedapiversion { get { return new versiontype(apiversiontype.GrannyProductMajorVersion, apiversiontype.GrannyProductMinorVersion, apiversiontype.GrannyProductCustomization, apiversiontype.GrannyProductBuildNumber); } }          public versiontype expectedapiversion { get { return _expectedapiversion; } }
210          #endregion          #endregion
211      }      }
212      #endregion      #endregion

Legend:
Removed from v.49  
changed lines
  Added in v.60

  ViewVC Help
Powered by ViewVC 1.1.22