public RdcVersion GetRdcVersion() { uint currentVersion, minimumCompatibleAppVersion; var hr = _rdcLibrary.GetRDCVersion(out currentVersion, out minimumCompatibleAppVersion); if (hr != 0) { throw new RdcException("Failed to get the rdc version", hr); } if (currentVersion >= (uint)int.MaxValue) { throw new InvalidCastException("The CurrentVersion is higher than int.MaxValue. This shouldn't happen. If it happens we have bigger problems."); } if (minimumCompatibleAppVersion >= (uint)int.MaxValue) { throw new InvalidCastException("The minimumCompatibleAppVersion is higher than int.MaxValue. This shouldn't happen. If it happens we have bigger problems."); } return(new RdcVersion { CurrentVersion = (int)currentVersion, MinimumCompatibleAppVersion = (int)minimumCompatibleAppVersion }); }
public RdcVersion GetRdcVersion() { uint currentVersion, minimumCompatibileAppVersion; var hr = _rdcLibrary.GetRDCVersion(out currentVersion, out minimumCompatibileAppVersion); if (hr != 0) { throw new RdcException("Failed to get the rdc version", hr); } return(new RdcVersion { CurrentVersion = currentVersion, MinimumCompatibleAppVersion = minimumCompatibileAppVersion }); }
/// <summary> /// Interrogates the RDC library version on this local machine. /// </summary> /// <returns>Current and minimum supported version.</returns> public static RdcVersion GetRdcVersion() { // Create our instance to the RdcLibrary // COM interface. IRdcLibrary rdcLibrary = (IRdcLibrary) new RdcLibrary(); uint currentVersion = 0; uint minimumCompatibleAppVersion = 0; // Retrieve the RDC version. int hr = rdcLibrary.GetRDCVersion( out currentVersion, out minimumCompatibleAppVersion); if (hr != 0) { throw new RdcException("Failed to retrieve the version of the RDC server."); } // Build our managed RdcVersion object. return(new RdcVersion(currentVersion, minimumCompatibleAppVersion)); }
/// <summary> /// Performs a version check of the local RDC environment against /// a provided RDC version (server\client). /// </summary> /// <param name="version">Version to compare against</param> public void CheckVersion(RdcVersion version) { uint currentVersion = 0; uint minimumCompatibleAppVersion = 0; // lookup the RDC version int hr = rdcLibrary.GetRDCVersion( out currentVersion, out minimumCompatibleAppVersion); if (hr == 0) { if (currentVersion < version.MinimumCompatibleAppVersion) { throw new RdcException("Incompatible: The RDC library is too old."); } else if (minimumCompatibleAppVersion > version.CurrentVersion) { throw new RdcException("Incompatible: The RDC library is newer than expected."); } } }