internal WeixinToolkitSettings(WeixinExtraXml xml, BaseAppSetting appsetting)
        {
            fCurrent = this;

            fEngine = new MessageEngine();
            if (xml.Weixin.Normal != null)
            {
                fNormalDefault = new DefaultEngine(xml.Weixin.Normal.DefaultMessage);

                fAuthConfig = new WeixinAuthConfig();
                string authFileName = Path.Combine(appsetting.XmlPath, @"Weixin\Auth.xml");
                if (File.Exists(authFileName))
                    fAuthConfig.ReadXmlFromFile(authFileName);
            }
            else if (xml.Weixin.CorpApps != null)
            {
                fCorpDefault = new Dictionary<int, DefaultEngine>();
                foreach (var item in xml.Weixin.CorpApps)
                    fCorpDefault.Add(item.AppId, new DefaultEngine(item.DefaultMessage));

                fCorpAuthConfig = new WeixinCorpAuthConfig();
                string authFileName = Path.Combine(appsetting.XmlPath, @"Weixin\CorpAuth.xml");
                if (File.Exists(authFileName))
                    fCorpAuthConfig.ReadXmlFromFile(authFileName);
            }
            else
                TkDebug.ThrowImpossibleCode(this);

            if (xml.Weixin.MessageLog != null)
                fLog = xml.Weixin.MessageLog.CreateObject();

        }
Exemplo n.º 2
0
        internal WeixinToolkitSettings(WeixinExtraXml xml, BaseAppSetting appsetting)
        {
            fCurrent = this;

            fEngine = new MessageEngine();
            if (xml.Weixin.Normal != null)
            {
                fNormalDefault = new DefaultEngine(xml.Weixin.Normal.DefaultMessage);

                fAuthConfig = new WeixinAuthConfig();
                string authFileName = Path.Combine(appsetting.XmlPath, @"Weixin\Auth.xml");
                if (File.Exists(authFileName))
                {
                    fAuthConfig.ReadXmlFromFile(authFileName);
                }
            }
            else if (xml.Weixin.CorpApps != null)
            {
                fCorpDefault = new Dictionary <int, DefaultEngine>();
                foreach (var item in xml.Weixin.CorpApps)
                {
                    fCorpDefault.Add(item.AppId, new DefaultEngine(item.DefaultMessage));
                }

                fCorpAuthConfig = new WeixinCorpAuthConfig();
                string authFileName = Path.Combine(appsetting.XmlPath, @"Weixin\CorpAuth.xml");
                if (File.Exists(authFileName))
                {
                    fCorpAuthConfig.ReadXmlFromFile(authFileName);
                }
            }
            else
            {
                TkDebug.ThrowImpossibleCode(this);
            }

            if (xml.Weixin.MessageLog != null)
            {
                fLog = xml.Weixin.MessageLog.CreateObject();
            }
        }