Пример #1
0
        private static void Process(Argument arg)
        {
            if (arg.Help)
            {
                Console.WriteLine(DataString.Usage);
                return;
            }

            if (arg.Flag) 
            {
                Console.WriteLine(DataString.InvalidPath);
                return;
            }

            if (!CheckFile(arg.WeixinXml))
                return;
            if (!CheckFile(arg.ApplicationXml))
                return;

            if (!InitializeContext(arg))
                return;

            if (WeixinSettings.Current.Mode == WeixinMode.Normal)
                NormalUtil.DownSync();
            else
                CorpUtil.UpSync();

            //if (WeixinSettings.Current.Mode == WeixinMode.Normal)
            //    ProcessNormalMode(arg, xml);
            //else
            //    ProcessCorpMode(arg, xml);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Argument arg = new Argument(args);
            ToolApp.Initialize(false);
            Process(arg);

            Console.ReadKey();
        }
Пример #3
0
        private static bool InitializeContext(Argument arg)
        {
            WeixinXml xml = WeUtil.GetWeixinXml(arg.WeixinXml);
            new WeixinSettings(xml);
            ApplicationXml appXml = new ApplicationXml();
            appXml.ReadXmlFromFile(arg.ApplicationXml);
            if (appXml.Databases != null)
            {
                DbContextConfig config = appXml.Databases["Weixin"];
                if (config != null)
                {
                    ToolApp.AddContextConfig(config);
                    return true;
                }
            }

            Console.WriteLine(string.Format(ObjectUtil.SysCulture, 
                DataString.NoDbConfig, arg.ApplicationXml));
            return false;
        }