Beispiel #1
0
    /// @brief Gets the current version of the OpenNI dll
    /// @return the version structure
    public NIVersion GetOpenNIDllVersion()
    {
        NIVersion ver = NIVersion.ZeroVersion;

        ver.InitFromOpenNIVersion(OpenNI.Version.Current);
        return(ver);
    }
Beispiel #2
0
 /// @copydoc NICheckVersion::ValidatePrerequisite
 /// <br>
 /// The implementation here will check the OpenNI dll version.
 public override void ValidatePrerequisite()
 {
     try
     {
         NIVersion ver = GetOpenNIDllVersion();
         if (m_minOpenNIVersion.CompareVersion(ref ver) < 0)
         {
             // we have an illegal version!
             throw new System.Exception("OpenNI version is too old (" + ver + ", need minimum " + m_minOpenNIVersion + ". Please install a new version. See documentation for more info");
         }
     }
     catch (System.Exception ex)
     {
         throw new System.Exception("Failed to get version with message " + ex.Message + ". This probably means that OpenNI is not installed or an old version is installed, please install a new version. See documentation for more info");
     }
 }
Beispiel #3
0
 /// @brief Method to make sure all prerequisites are met before running the toolkit.
 ///
 /// This method should be called before any class derived from dll a different package is
 /// created. Its goal is to throw a human readable exception if the prerequisites are not met
 /// to enable the developer to fix the situation (i.e. install the relevant prerequisite).
 /// The implementation here will check the the OpenNI toolkit.
 public override void ValidatePrerequisite()
 {
     // first we want to make sure the OpenNI package is ok
     NIOpenNICheckVersion.Instance.ValidatePrerequisite();
     try
     {
         NIVersion ver = NIOpenNICheckVersion.Instance.GetVersion();
         if (m_minOpenNIToolkitVersion.CompareVersion(ref ver) < 0)
         {
             // we have an illegal version!
             throw new System.Exception("NITE extensions require the OpenNI Unity toolkit to be installed. The toolkit is too old (" + ver.ToString() + ", need minimum " + m_minOpenNIToolkitVersion + ". Please install the new package.");
         }
     }
     catch (System.Exception ex)
     {
         throw new System.Exception("NITE extensions require the OpenNI Unity toolkit to be installed. Failed to get the version of the OpenNI Unity toolkit with message " + ex.Message + ". This probably means that toolkit is not installed or an old version is installed, please install a new version.");
     }
 }
 /// @brief Method to compare the current version to another version.
 /// @param other the other version
 /// @return 1 if the current version is newer, -1 if the other is newer and 0 if equal
 public int CompareVersion(ref NIVersion other)
 {
     if (other.m_major != m_major)
     {
         return(other.m_major < m_major ? -1 : 1);
     }
     if (other.m_minor != m_minor)
     {
         return(other.m_minor < m_minor ? -1 : 1);
     }
     if (other.m_maintenance != m_maintenance)
     {
         return(other.m_maintenance < m_maintenance ? -1 : 1);
     }
     if (other.m_build != m_build)
     {
         return(other.m_build < m_build ? -1 : 1);
     }
     return(0);
 }
 /// @brief Method to compare the current version to another version.
 /// @param other the other version
 /// @return 1 if the current version is newer, -1 if the other is newer and 0 if equal
 public int CompareVersion(ref NIVersion other)
 {
     if (other.m_major != m_major)
     {
         return other.m_major < m_major ? -1 : 1;
     }
     if (other.m_minor != m_minor)
     {
         return other.m_minor < m_minor ? -1 : 1;
     }
     if (other.m_maintenance != m_maintenance)
     {
         return other.m_maintenance < m_maintenance ? -1 : 1;
     }
     if (other.m_build != m_build)
     {
         return other.m_build < m_build ? -1 : 1;
     }
     return 0;
 }
Beispiel #6
0
 /// @brief Private constructor for singleton pattern.
 private NINITECheckVersion()
 {
     m_minOpenNIToolkitVersion = new NIVersion(0, 9, 0, 0);
     m_currentVersion          = new NIVersion(0, 9, 0, 0);
 }
Beispiel #7
0
 /// @brief Private constructor for singleton pattern.
 private NIOpenNICheckVersion()
 {
     m_minOpenNIVersion = new NIVersion(1, 3, 3, 1);
     m_currentVersion   = new NIVersion(0, 9, 0, 0);
 }
 /// @brief Private constructor for singleton pattern.
 private NIOpenNICheckVersion()
 {
     m_minOpenNIVersion = new NIVersion(1, 5, 2, 23);
     m_currentVersion = new NIVersion(0, 9, 7, 4);
 }
 /// @brief Private constructor for singleton pattern.
 private NIOpenNICheckVersion()
 {
     m_minOpenNIVersion = new NIVersion(1, 5, 2, 23);
     m_currentVersion   = new NIVersion(0, 9, 7, 4);
 }