Beispiel #1
0
        private void LoadProfile(string profile, bool isString)
        {
            lock (m_clientSync)
            {
                if (m_client == null)
                {
                    throw new Exception("client not initialized");
                }

                if (isString)
                {
                    if (!m_client.LoadProfileString(profile))
                    {
                        throw new Exception(String.Format("failed to load profile string '{0}'", profile));
                    }
                }
                else
                {
                    if (!m_client.LoadProfileFile(profile))
                    {
                        throw new Exception(String.Format("failed to load profile file '{0}'", profile));
                    }
                }
            }
        }
Beispiel #2
0
        private void LoadProfile(string profile, bool isString)
        {
            NativeMethods.EddieLibraryResult result;

            lock (clientSync)
            {
                if (openVPNClient == null)
                {
                    throw new Exception("client not initialized");
                }

                if (isString)
                {
                    result = openVPNClient.LoadProfileString(profile);

                    if (result.code != NativeMethods.ResultCode.SUCCESS)
                    {
                        string errMsg = string.Format("OpenVPNTunnel::LoadProfile(): Failed to load profile string. {0}", result.description);

                        EddieLogger.Error(errMsg);

                        throw new Exception(errMsg);
                    }
                }
                else
                {
                    result = openVPNClient.LoadProfileFile(profile);

                    if (result.code != NativeMethods.ResultCode.SUCCESS)
                    {
                        string errMsg = string.Format("OpenVPNTunnel::LoadProfile(): Failed to load profile file. {0}", result.description);

                        EddieLogger.Error(errMsg);

                        throw new Exception(errMsg);
                    }
                }
            }
        }