Пример #1
0
        public static bool OpenConnection(string clusternodes, string stationNumber, string stationPassword, string user, string password, string client, string registrationType, string systemIdentifier)
        {
            Logger.Log.Info((object)"OpenConnection(): method called .");
            Logger.Log.Info((object)string.Format("OpenConnection( \n ClusterNodes: {0}, \n stationNumber: {1}, \n stationPassword: {2}, \n user: {3}, \n password: {4}, \n client: {5}, \n registrationType: {6},\n systemIdentifier: {7})", (object)clusternodes, (object)stationNumber, (object)stationPassword, (object)user, (object)password, (object)client, (object)registrationType, (object)systemIdentifier));
            ItacFunctions._imsapi         = (IMSApiDotNet)null;
            ItacFunctions._sessionContext = (IMSApiSessionContextStruct)null;
            ItacFunctions._stationNumber  = (string)null;
            bool flag;

            try
            {
                IMSApiDotNetBase.setProperty("itac.appid", "StationTestClient");
                IMSApiDotNetBase.setProperty("itac.artes.clusternodes", clusternodes);
                ItacFunctions._imsapi = IMSApiDotNet.loadLibrary();
                string str            = "";
                int    libraryVersion = ((IMSApiDotNetBase)ItacFunctions._imsapi).imsapiGetLibraryVersion(out str);
                if (libraryVersion != 0)
                {
                    ItacFunctions.printErrorText(libraryVersion);
                }
                Logger.Log.Info((object)str);
                int resultValue = ((IMSApiDotNetBase)ItacFunctions._imsapi).imsapiInit();
                if (resultValue != 0)
                {
                    Logger.Log.Error((object)"OpenConnection():IMSApi init failed!");
                    ItacFunctions.printErrorText(resultValue);
                    flag = false;
                }
                else if (!ItacFunctions.itacLogin(stationNumber, stationPassword, user, password, client, registrationType, systemIdentifier))
                {
                    Logger.Log.Error((object)"OpenConnection(): itacLogin failed!");
                    flag = false;
                }
                else
                {
                    ItacFunctions._stationNumber = stationNumber;
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                string str = ex.Source + " " + ex.Message;
                Logger.Log.Fatal((object)str);
            }
            Logger.Log.Info((object)string.Format("OpenConnection(): return with {0}", (object)flag));
            return(flag);
        }