Exemplo n.º 1
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            EV ev = new EV();
            ev.evPath(Path.GetDirectoryName(Application.ExecutablePath));

            ExportManager exportManager = new ExportManager();
            exportManager.Export();
        }
Exemplo n.º 2
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            EV ev = new EV();

            ev.evPath(Path.GetDirectoryName(Application.ExecutablePath));

            ExportManager exportManager = new ExportManager();

            exportManager.Export();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private bool Init()
        {
            try
            {
                outputDebugString(string.Format("{0} —— 开始Init初始化...", DateTime.Now));
                outputDebugString(string.Format("{0} —— 正在初始化sql连接...", DateTime.Now));

                // 初始化sql连接
                string fileName = Path.Combine(Application.StartupPath, "AutoExport.ini");
                string content = FileFolderHelper.FileToString(fileName);

                IniStructure m_inis = new IniStructure();
                m_inis = IniStructure.ReadIniWithContent(content);
                string connectString = m_inis.GetValue("General", "ConnString");
                conn = new SqlConnection(connectString);

                // 读取根目录路径
                outputDebugString(string.Format("{0} —— 正在初始化外部设置...", DateTime.Now));
                rootPath = m_inis.GetValue("General", "RootDir");

                // 读取导出表列表            
                string[] autoTableArray = m_inis.GetKeys("AutoExport");
                autoTableList.AddRange(autoTableArray);

                string[] customTableArray = m_inis.GetKeys("CustomExport");
                customTableList.AddRange(customTableArray);

                outputDebugString(string.Format("{0} —— 正在更新资源文件...", DateTime.Now));

                // 读取资源文件列表
                string[] fileArray = m_inis.GetKeys("Resource");
                fileList.AddRange(fileArray);

                // 读取自动导出表的配置信息
                string sqlString = string.Format("SELECT * FROM sys_export_table_cfg");
                configTable = GetDataTable(sqlString);

                // 更新资源文件
                if (Program.GSTEP != 2)
                    DownLoadResource();

                outputDebugString(string.Format("{0} —— 正在设置path...", DateTime.Now));

                // path更新
                EV ev = new EV();
                ev.evPath(Path.GetDirectoryName(Application.ExecutablePath));

                outputDebugString(string.Format("{0} —— 正在初始化lua虚拟机...", DateTime.Now));

                // 初始化lua虚拟机
                exportLua = new Lua();
                exportLua["Conn"] = conn;
                exportLua["RootDir"] = rootPath;
                string luaFile = Path.Combine(Application.StartupPath, "export.lua");
                exportLua.DoFile(luaFile);

                postExportLua = new Lua();
                postExportLua["___GIsServer"] = true;
                postExportLua["RootDir"] = rootPath;
                postExportLua["Conn"] = conn;
                postExportLua.RegisterFunction("GetDataTableRow", this, typeof(ExportManager).GetMethod("GetDataTableRow"));

                luaFile = Path.Combine(Application.StartupPath, "post_export.lua");
                postExportLua.DoFile(luaFile);


                outputDebugString(string.Format("{0} —— 完成所有初始化工作!", DateTime.Now));

                return true;

            }
            catch (Exception ex)
            {
                outputDebugStringError(string.Format("{0} —— 初始化init产生异常:{1}", DateTime.Now, ex.Message));
                return false;
            }            
        }
Exemplo n.º 4
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        private bool Init()
        {
            try
            {
                outputDebugString(string.Format("{0} —— 开始Init初始化...", DateTime.Now));
                outputDebugString(string.Format("{0} —— 正在初始化sql连接...", DateTime.Now));

                // 初始化sql连接
                string fileName = Path.Combine(Application.StartupPath, "AutoExport.ini");
                string content  = FileFolderHelper.FileToString(fileName);

                IniStructure m_inis = new IniStructure();
                m_inis = IniStructure.ReadIniWithContent(content);
                string connectString = m_inis.GetValue("General", "ConnString");
                conn = new SqlConnection(connectString);

                // 读取根目录路径
                outputDebugString(string.Format("{0} —— 正在初始化外部设置...", DateTime.Now));
                rootPath = m_inis.GetValue("General", "RootDir");

                // 读取导出表列表
                string[] autoTableArray = m_inis.GetKeys("AutoExport");
                autoTableList.AddRange(autoTableArray);

                string[] customTableArray = m_inis.GetKeys("CustomExport");
                customTableList.AddRange(customTableArray);

                outputDebugString(string.Format("{0} —— 正在更新资源文件...", DateTime.Now));

                // 读取资源文件列表
                string[] fileArray = m_inis.GetKeys("Resource");
                fileList.AddRange(fileArray);

                // 读取自动导出表的配置信息
                string sqlString = string.Format("SELECT * FROM sys_export_table_cfg");
                configTable = GetDataTable(sqlString);

                // 更新资源文件
                if (Program.GSTEP != 2)
                {
                    DownLoadResource();
                }

                outputDebugString(string.Format("{0} —— 正在设置path...", DateTime.Now));

                // path更新
                EV ev = new EV();
                ev.evPath(Path.GetDirectoryName(Application.ExecutablePath));

                outputDebugString(string.Format("{0} —— 正在初始化lua虚拟机...", DateTime.Now));

                // 初始化lua虚拟机
                exportLua            = new Lua();
                exportLua["Conn"]    = conn;
                exportLua["RootDir"] = rootPath;
                string luaFile = Path.Combine(Application.StartupPath, "export.lua");
                exportLua.DoFile(luaFile);

                postExportLua = new Lua();
                postExportLua["___GIsServer"] = true;
                postExportLua["RootDir"]      = rootPath;
                postExportLua["Conn"]         = conn;
                postExportLua.RegisterFunction("GetDataTableRow", this, typeof(ExportManager).GetMethod("GetDataTableRow"));

                luaFile = Path.Combine(Application.StartupPath, "post_export.lua");
                postExportLua.DoFile(luaFile);


                outputDebugString(string.Format("{0} —— 完成所有初始化工作!", DateTime.Now));

                return(true);
            }
            catch (Exception ex)
            {
                outputDebugStringError(string.Format("{0} —— 初始化init产生异常:{1}", DateTime.Now, ex.Message));
                return(false);
            }
        }