コード例 #1
0
        public Provider AddProvider(string providerCode, XmlElement xmlStorage)
        {
            if (Definitions.ContainsKey(providerCode) == false)
            {
                return(null);
            }

            XmlDocument xmlDefiniton = Definitions[providerCode];

            string providerClass = Utils.XmlGetAttributeString(xmlDefiniton.DocumentElement, "class", "");

            Provider provider = null;

            if (providerClass == "service")
            {
                provider = new Providers.Service();
            }
            else if (providerClass == "openvpn")
            {
                provider = new Providers.OpenVPN();
            }
            else
            {
                return(null);
            }

            if (provider != null)
            {
                provider.Definition = xmlDefiniton.DocumentElement;

                provider.OnInit();

                provider.OnLoad(xmlStorage);

                m_providers.Add(provider);

                if (provider.GetCode() == "AirVPN")
                {
                    Engine.Instance.AirVPN = provider as Providers.Service;
                }
            }

            return(provider);
        }
コード例 #2
0
        public Provider AddProvider(string providerCode, XmlElement xmlStorage)
        {
            if (Definitions.ContainsKey(providerCode) == false)
                return null;

            XmlDocument xmlDefiniton = Definitions[providerCode];

            string providerClass = Utils.XmlGetAttributeString(xmlDefiniton.DocumentElement, "class", "");

            Provider provider = null;

            if (providerClass == "service")
            {
                provider = new Providers.Service();
            }
            else if (providerClass == "openvpn")
            {
                provider = new Providers.OpenVPN();
            }
            else
                return null;

            if (provider != null)
            {
                provider.Definition = xmlDefiniton.DocumentElement;

                provider.OnInit();

                provider.OnLoad(xmlStorage);

                m_providers.Add(provider);

                if (provider.GetCode() == "AirVPN")
                    Engine.Instance.AirVPN = provider as Providers.Service;
            }

            return provider;
        }