/[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

--- trunk/gr2lib/core/coreclasses/apiversion/granny2apiversion.cs	2010/07/17 05:09:00	93
+++ trunk/gr2lib/core/coreclasses/apiversion/granny2apiversion.cs	2010/07/18 06:14:54	133
@@ -5,17 +5,18 @@
 using gr2lib.core.typedefs;
 using gr2lib.core.exceptions;
 using gr2lib.core.interfaces;
+using System.ComponentModel;
 
 namespace gr2lib.core.apiversion
 {
     #region public class VersionType
     public interface Iversiontype
     {
-        granny_int32x major { get; }
-        granny_int32x minor { get; }
-        granny_int32x customization { get; }
-        granny_int32x build { get; }
-        string version { get; }
+        int major { get; set; }
+        int minor { get; set; }
+        int customization { get; set; }
+        int build { get; set; }
+        //string version { get; }
     }
 
     public class versiontype : Iversiontype
@@ -33,7 +34,7 @@
         /// <summary>
         /// versiontype construction: major.minor.customization.build
         /// </summary>
-        public versiontype(granny_int32x major, granny_int32x minor, granny_int32x customization, granny_int32x build)
+        public versiontype(int major, int minor, int customization, int build)
         {
             this.major = major;
             this.minor = minor;
@@ -47,10 +48,10 @@
         {
             string[] _version = version.Split('.');
             
-            this.major = _version[0];
-            this.minor = _version[1];
-            this.customization = _version[2];
-            this.build = _version[3];
+            this.major = Convert.ToInt32(_version[0]);
+            this.minor = Convert.ToInt32(_version[1]);
+            this.customization = Convert.ToInt32(_version[2]);
+            this.build = Convert.ToInt32(_version[3]);
         }
         /// <summary>
         /// Gets this version in format: major.minor.customization.build
@@ -65,30 +66,34 @@
         /// <summary>
         /// Returns a string representation of the Granny2 API Version in format (major.minor.customization.build)
         /// </summary>
-        public string version { get { return string.Format("{0}.{1}.{2}.{3}", major, minor, customization, build); } }
-        private granny_int32x _major;
+        private string version { get { return string.Format("{0}.{1}.{2}.{3}", major, minor, customization, build); } }
+        private int _major;
+        [RefreshPropertiesAttribute(RefreshProperties.All)]  
         /// <summary>
         /// Returns the Major of the Granny2 API Version (X.0.0.0)
         /// </summary>
-        public granny_int32x major { get { return _major; } private set { _major = value; } }
+        public int major { get { return _major; } set { _major = value; } }
 
-        private granny_int32x _minor;
+        private int _minor;
+        [RefreshPropertiesAttribute(RefreshProperties.All)]  
         /// <summary>
         /// Returns the Minor of the Granny2 API Version (0.X.0.0)
         /// </summary>
-        public granny_int32x minor { get { return _minor; } private set { _minor = value; } }
+        public int minor { get { return _minor; } set { _minor = value; } }
 
-        private granny_int32x _customization;
+        private int _customization;
+        [RefreshPropertiesAttribute(RefreshProperties.All)]  
         /// <summary>
         /// Returns the Customization of the Granny2 API Version - Customization (0.0.X.0)
         /// </summary>
-        public granny_int32x customization { get { return _customization; } private set { _customization = value; } }
+        public int customization { get { return _customization; } set { _customization = value; } }
 
-        private granny_int32x _build;
+        private int _build;
+        [RefreshPropertiesAttribute(RefreshProperties.All)]  
         /// <summary>
         /// Returns the Build of the Granny2 API Version (0.0.0.X)
         /// </summary>
-        public granny_int32x build { get { return _build; } private set { _build = value; } }
+        public int build { get { return _build; } set { _build = value; } }
         #endregion
     }
     #endregion
@@ -110,13 +115,33 @@
                                              apiversiontype.GrannyProductCustomization,
                                              apiversiontype.GrannyProductBuildNumber);
 
-            granny2apiloader _loader = new granny2apiloader();
+            granny2apiloader _loader = new granny2apiloader(true);
             this._apiversion = new versiontype();
             this._apiversionsmatch = this.GrannyVersionsMatch();
             this.GetGrannyVersion();
  
         }
         /// <summary>
+        /// Default granny2apiversion Constructor: Expect Granny2 API -> 2.7.0.30 (allow disable looking for granny api)
+        /// </summary>
+        public granny2apiversion(bool checkforgrannyapi)
+        {
+            if (checkforgrannyapi)
+            {
+                this._expectedapiversion = new versiontype(
+                                                 apiversiontype.GrannyProductMajorVersion,
+                                                 apiversiontype.GrannyProductMinorVersion,
+                                                 apiversiontype.GrannyProductCustomization,
+                                                 apiversiontype.GrannyProductBuildNumber);
+
+                granny2apiloader _loader = new granny2apiloader(checkforgrannyapi);
+                this._apiversion = new versiontype();
+                this._apiversionsmatch = this.GrannyVersionsMatch();
+                this.GetGrannyVersion();
+            }
+
+        }
+        /// <summary>
         /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build
         /// </summary>
         public granny2apiversion(granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)
@@ -127,23 +152,57 @@
                                  ExpectedCustomization,
                                  ExpectedBuildNumber);
 
-            granny2apiloader _loader = new granny2apiloader();
+            granny2apiloader _loader = new granny2apiloader(true);
             this._apiversion = new versiontype();
             this._apiversionsmatch = this.GrannyVersionsMatch();
             this.GetGrannyVersion();
         }
         /// <summary>
+        /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build
+        /// </summary>
+        public granny2apiversion(bool checkforgrannyapi, granny_int32x ExpectedMajorVersion, granny_int32x ExpectedMinorVersion, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuildNumber)
+        {
+            if (checkforgrannyapi)
+            {
+                this._expectedapiversion = new versiontype(
+                                     ExpectedMajorVersion,
+                                     ExpectedMinorVersion,
+                                     ExpectedCustomization,
+                                     ExpectedBuildNumber);
+
+                granny2apiloader _loader = new granny2apiloader(checkforgrannyapi);
+                this._apiversion = new versiontype();
+                this._apiversionsmatch = this.GrannyVersionsMatch();
+                this.GetGrannyVersion();
+            }
+        }
+        /// <summary>
         /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")
         /// </summary>
         public granny2apiversion(string ExceptedVersion)
         {
             this._expectedapiversion = new versiontype(ExceptedVersion);
 
-            granny2apiloader _loader = new granny2apiloader();
+            granny2apiloader _loader = new granny2apiloader(true);
             this._apiversion = new versiontype();
             this._apiversionsmatch = this.GrannyVersionsMatch();
             this.GetGrannyVersion();
         }
+        /// <summary>
+        /// granny2apiversion Constructor: set Granny2 API -> major.minor.customization.build (via string: "0.0.0.0")
+        /// </summary>
+        public granny2apiversion(bool checkforgrannyapi,string ExceptedVersion)
+        {
+            if (checkforgrannyapi)
+            {
+                this._expectedapiversion = new versiontype(ExceptedVersion);
+
+                granny2apiloader _loader = new granny2apiloader(checkforgrannyapi);
+                this._apiversion = new versiontype();
+                this._apiversionsmatch = this.GrannyVersionsMatch();
+                this.GetGrannyVersion();
+            }
+        }
 
         #region APIVersion Support
         private class apiversiontype

 

  ViewVC Help
Powered by ViewVC 1.1.22