Example #1
0
        private static TwinCATSubSystemType GetTwinCATInstallationType(out string installationPath, out Version version)
        {
            installationPath = null;
            TwinCATSubSystemType none = TwinCATSubSystemType.None;
            string path = null;

            if (!TryGetTcRouterImagePath(out path))
            {
                throw new ApplicationException("TwinCAT not installed!");
            }
            string  str2     = null;
            string  str3     = null;
            Version version2 = null;
            Version version3 = null;

            TryGetTwinCAT2Path(out str2, out version2);
            TryGetTwinCAT3Path(out str3, out version3);
            if ((str2 != null) && path.StartsWith(str2, StringComparison.OrdinalIgnoreCase))
            {
                installationPath = str2;
                version          = version2;
                none             = TwinCATSubSystemType.Tc2;
            }
            else
            {
                if ((str3 == null) || !path.StartsWith(str3, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ApplicationException("TwinCAT is not installed!");
                }
                installationPath = str3;
                version          = version3;
                none             = TwinCATSubSystemType.Tc3;
            }
            return(none);
        }
Example #2
0
 static TcReg()
 {
     try
     {
         _tcInstallation = GetTwinCATInstallationType(out _tcInstallationPath, out _tcVersion);
     }
     catch (Exception)
     {
         _tcInstallation = TwinCATSubSystemType.None;
     }
 }