Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }