예제 #1
0
        /// <summary>
        /// Сохранить файл
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="fileName"></param>
        /// <param name="userIdentityid"></param>
        /// <param name="exportType"></param>
        /// <returns></returns>
        public async Task <ExportedFile> SaveExportedFile(Stream stream, string fileName, int userIdentityid,
                                                          EExportType exportType)
        {
            if (stream == null)
            {
                throw new Exception("Входной файл не определен");
            }

            var exchangeFileId = await SaveFile(stream, fileName, userIdentityid);

            using (var context = new ApplicationDbContext())
            {
                //создам сущность экспортируемого файла
                var exportedFile = new ExportedFile
                {
                    UnloadType   = exportType,
                    UnloadStatus = EUnloadStatus.InProcess,
                    ExchangeFile = await context.ExchangeFiles.FindAsync(exchangeFileId),
                    Organization =
                        context.Employee.Where(x => x.ApplicationUser.Id == userIdentityid)
                        .Select(x => x.Organization)
                        .FirstOrDefault()
                };
                context.ExportedFiles.Add(exportedFile);
                await context.SaveChangesAsync();

                return(exportedFile);
            }
        }
예제 #2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="T:System.Object"/> class.
            /// </summary>
            /// <param name="stringInfo">string from command line</param>
            /// <param name="project">The project from which files are exported.</param>
            public ExportInfo(string stringInfo, Project project) :
                this()
            {
                Regex r     = new Regex("(\\w+)(\\((\\w+)\\)){0,1}(\\[(\\w+)\\]){0,1}");
                Match match = r.Match(stringInfo);

                if (match != null)
                {
                    if (!String.IsNullOrEmpty(match.Groups[1].Value))
                    {
                        string  d         = match.Groups[1].Value;
                        Diagram nameMatch = project.Diagrams.Where(item => item.Caption == d).SingleOrDefault();
                        if (nameMatch != null)
                        {
                            Diagram = nameMatch;
                        }
                        else
                        {
                            int numMatch;
                            if (int.TryParse(d, out numMatch) &&
                                project.Diagrams.Count > numMatch)
                            {
                                Diagram = project.Diagrams[numMatch];
                            }
                        }
                    }

                    if (Diagram == null)
                    {
                        Console.WriteLine("Error: Could not found diagram {0}.", stringInfo);
                        return;
                    }

                    string g3 = match.Groups[3].Value;
                    if (!String.IsNullOrEmpty(g3))
                    {
                        Filename = g3;
                    }

                    string g4 = match.Groups[4].Value;
                    if (!String.IsNullOrEmpty(g4))
                    {
                        ExportType = EExportType.None;
                        if (g4.Contains('I') || g4.Contains('i'))
                        {
                            ExportType |= EExportType.Png;
                        }
                        if (g4.Contains('S') || g4.Contains('s'))
                        {
                            ExportType |= EExportType.Xsd;
                        }
                    }
                }
            }
예제 #3
0
        /// <summary>
        /// Calculate extension based on Export Type
        /// </summary>
        /// <param name="ExportType"></param>
        /// <returns></returns>
        private string CorrectExtension(EExportType ExportType)
        {
            // Set the correct extension based on type of export
            if (ExportType == EExportType.exportAsPDF)
            {
                return(".AAPKG");
            }

            if (ExportType == EExportType.exportAsCSV)
            {
                return(".CSV");
            }

            return("");
        }
예제 #4
0
        public static IExporter SelectExporter(EExportType type)
        {
            switch (type)
            {
            case EExportType.Unity:
                return(new UnityExporter());

            case EExportType.Lua:
                return(new LuaExporter());

            case EExportType.Js:
                return(new JsTsExporter(".js"));

            case EExportType.Ts:
                return(new JsTsExporter(".ts"));

            default:
                return(null);
            }
        }
예제 #5
0
        /// <summary>
        /// Backup GObjects to a Single File
        /// </summary>
        /// <param name="ExportType"></param>
        /// <param name="GalaxyObjects"></param>
        /// <param name="BackupFileName"></param>
        /// <returns></returns>
        public int BackupToFile(EExportType ExportType, IgObjects GalaxyObjects, String BackupFileName)
        {
            try
            {
                // first verify connection
                if (!this.Connected)
                {
                    throw new Exception("Galaxy not connected");
                }

                // Make sure we have the right extension on the backup file
                BackupFileName = System.IO.Path.ChangeExtension(BackupFileName, CorrectExtension(ExportType));

                // Check for file exists.  Bail if the file already exists and we don't want to overwrite
                if (CheckandLogFileExists(BackupFileName))
                {
                    return(0);
                }

                log.Info("Backing up to " + BackupFileName);

                // Perform the actual export
                GalaxyObjects.ExportObjects(ExportType, BackupFileName);

                if (GalaxyObjects.CommandResults.CompletelySuccessful != true)
                {
                    throw new Exception(GalaxyObjects.CommandResults.ToString());
                }
                else
                {
                    log.Info("Backup to " + BackupFileName + " succeeded.");
                }

                return(0);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                return(-1);
            }
        }
예제 #6
0
        /// <summary>
        /// Backup a Single GObject to a File
        /// </summary>
        /// <param name="ExportType"></param>
        /// <param name="GalaxyObject"></param>
        /// <param name="BackupFileName"></param>
        /// <returns></returns>
        public int BackupToFile(EExportType ExportType, IgObject GalaxyObject, String BackupFileName)
        {
            IgObjects GalaxyObjects;

            String[] SingleItemName = new String[1];

            try
            {
                // first verify connection
                if (!this.Connected)
                {
                    throw new Exception("Galaxy not connected");
                }

                SingleItemName[0] = GalaxyObject.Tagname;

                if (SingleItemName[0].Substring(0, 1) == "$")
                {
                    //Template
                    GalaxyObjects = this.Galaxy.QueryObjectsByName(EgObjectIsTemplateOrInstance.gObjectIsTemplate, ref SingleItemName);
                }
                else
                {
                    // Instance
                    GalaxyObjects = this.Galaxy.QueryObjectsByName(EgObjectIsTemplateOrInstance.gObjectIsInstance, ref SingleItemName);
                }

                if (GalaxyObjects.count > 0)
                {
                    return(BackupToFile(ExportType, GalaxyObjects, BackupFileName));
                }

                return(0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #7
0
        /// <summary>
        /// Backup GObjects to multiple files in a single folder
        /// </summary>
        /// <param name="ExportType"></param>
        /// <param name="GalaxyObjects"></param>
        /// <param name="BackupFolderName"></param>
        /// <returns></returns>
        public int BackupToFolder(EExportType ExportType, IgObjects GalaxyObjects, String BackupFolderName)
        {
            String[]  SingleItemName = new String[1];
            IgObjects SingleObject;
            String    BackupFileName;
            String    Extension;
            String    ConfigVersion;

            try
            {
                // first verify connection
                if (!this.Connected)
                {
                    throw new Exception("Galaxy not connected");
                }

                // Get Extension
                Extension = CorrectExtension(ExportType);

                //Create the Backup FOlder if it doesn't exist
                if (!System.IO.Directory.Exists(BackupFolderName))
                {
                    System.IO.Directory.CreateDirectory(BackupFolderName);
                }

                // Double check that we have the folder.  If it's missing then error out
                if (!System.IO.Directory.Exists(BackupFolderName))
                {
                    throw new Exception("Missing Directory " + BackupFolderName);
                }

                //Need to iterate through the the objects
                foreach (IgObject Item in GalaxyObjects)
                {
                    // Populate the single item array with the item's tagname
                    SingleItemName[0] = Item.Tagname;

                    //Default Config Version Text to Blank
                    ConfigVersion = "";

                    //If we require config version in the filename then figure it out then add it
                    if (_includeConfigVersion)
                    {
                        ConfigVersion = "-v" + Item.ConfigVersion.ToString();
                    }

                    // Calculate the appropriate backup filename
                    BackupFileName = BackupFolderName + "\\" + Item.Tagname + ConfigVersion + Extension;

                    // Check for file exists.  Bail if the file already exists and we don't want to overwrite
                    // In this section it is actually a bit redundant but we don't want to perform the Galaxy query if not necessary
                    if (CheckandLogFileExists(BackupFileName))
                    {
                        continue;
                    }

                    // Figure out if we're dealing with a Template or Instance
                    if (Item.Tagname.Substring(0, 1) == "$")
                    {
                        //Template
                        SingleObject = _galaxy.QueryObjectsByName(EgObjectIsTemplateOrInstance.gObjectIsTemplate, ref SingleItemName);
                    }
                    else
                    {
                        // Instance
                        SingleObject = _galaxy.QueryObjectsByName(EgObjectIsTemplateOrInstance.gObjectIsInstance, ref SingleItemName);
                    }

                    // Make sure we have an actual object in the collection
                    if (SingleObject.count > 0)
                    {
                        // Perform the actual backup
                        BackupToFile(ExportType, SingleObject, BackupFileName);
                    }
                }

                return(0);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
                return(-1);
            }
        }
예제 #8
0
파일: Program.cs 프로젝트: yuka800/lop-lib
        static int Main(string[] args)
        {
            // 设置默认的工作路径
            string   strMainModule = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            FileInfo fiMainModule  = new FileInfo(strMainModule);

            Environment.CurrentDirectory = fiMainModule.Directory.FullName;
            string        strRoot = "../../";
            DirectoryInfo dirRoot = new DirectoryInfo(strRoot);

            Environment.CurrentDirectory       = dirRoot.FullName;
            CFileList.Instance.RootDirectory   = Environment.CurrentDirectory;
            CGeneration.Instance.RootDirectory = Environment.CurrentDirectory;

            //
            if (args.Length == 1)
            {
                if (args[0] == "DES")
                {
                    ExportType = EExportType.DES;
                    CFileList.Instance.m_strFileList = dirRoot.FullName + @".\TableOut\Temp\FileList.des";
                }
                else if (args[0] == "PRO")
                {
                    ExportType = EExportType.PRO;
                    CFileList.Instance.m_strFileList = dirRoot.FullName + @".\FileList.pro";
                }
                else if (args[0] == "CPP")
                {
                    ExportType = EExportType.CPP;
                    CFileList.Instance.m_strFileList = dirRoot.FullName + @".\FileList.cpp";
                }
                else if (args[0] == "CSP")
                {
                    ExportType = EExportType.CSP;
                    CFileList.Instance.m_strFileList = dirRoot.FullName + @".\FileList.csp";
                }
                else if (args[0] == "LUA")
                {
                    ExportType = EExportType.LUA;
                    CFileList.Instance.m_strFileList = dirRoot.FullName + @".\FileList.lua";
                }
            }

            //
            if (ExportType == EExportType.ALL || ExportType == EExportType.DES)
            {
                Console.WriteLine("********** 检查数据表 **********");
                string   dataTableCheckExe = dirRoot.FullName + "/DesTable/DataTableCheck/DataTableCheck.exe";
                FileInfo fileinfo          = new FileInfo(dataTableCheckExe);
                System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                Info.FileName         = dataTableCheckExe;
                Info.UseShellExecute  = false;
                Info.WorkingDirectory = fileinfo.Directory.FullName;
                Info.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Hidden;
                var proc = System.Diagnostics.Process.Start(Info);
                proc.WaitForExit();
                if (proc.ExitCode != 0)
                {
                    Console.WriteLine("配置表异常,请运行\"Shared/SrcGen/DesTable/数据表检查.bat\"进行检查。");
                    Console.ReadLine();
                    return(1);
                }
            }

            //
            DirectoryInfo desDir1 = new DirectoryInfo(@".\TableOut\Temp\1_Protoext\");

            if (!desDir1.Exists)
            {
                desDir1.Create();
            }

            //
            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CPP || ExportType == EExportType.CSP || ExportType == EExportType.LUA)
            {
                Console.WriteLine("********** 拷贝 *.proto 文件 **********");
                DirectoryInfo srcDir    = null;
                List <string> protoList = new List <string>(); // 所有的proto文件

                //
                srcDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                srcDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\SpecialClient\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                srcDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\SpecialServer\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                srcDir = new DirectoryInfo(@".\TableGen\11_ExtendSystem\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                srcDir = new DirectoryInfo(@".\TableGen\11_ExtendSystem\SpecialClient\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                srcDir = new DirectoryInfo(@".\TableGen\11_ExtendSystem\SpecialServer\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                // 兼容老版文件目录
                srcDir = new DirectoryInfo(@".\TableGen\10_ProtobufDef\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                srcDir = new DirectoryInfo(@".\TableGen\11_ProtobufClt\");
                _CopyProtoFile(srcDir, desDir1, ref protoList);

                //
                DirectoryInfo desTableDir = new DirectoryInfo("./DesTable/DescTable");
                foreach (var fileInfo in desTableDir.GetFiles("*.xlsx", SearchOption.AllDirectories))
                {
                    protoList.Add(fileInfo.Name.Replace("xlsx", "proto").ToLower());
                }

                DirectoryInfo proTableDir = new DirectoryInfo("./ProTable");
                foreach (var fileInfo in proTableDir.GetFiles("*.xlsx", SearchOption.AllDirectories))
                {
                    protoList.Add(fileInfo.Name.Replace("xlsx", "proto").ToLower());
                }

                //
                FileInfo tmpFileInfo = null;

                tmpFileInfo = new FileInfo(@".\DesTable\DataTable\GlobalTable.xlsx");
                if (tmpFileInfo.Exists)
                {
                    protoList.Add("globalenum.proto");
                }

                tmpFileInfo = new FileInfo(@".\DesTable\DataTable\MailMsgTable.xlsx");
                if (tmpFileInfo.Exists)
                {
                    protoList.Add("mailidenum.proto");
                }

                // 清理 desDir1 中多余的 proto 文件
                foreach (FileInfo fileInfo in desDir1.GetFiles("*.proto", SearchOption.TopDirectoryOnly))
                {
                    if (!protoList.Contains(fileInfo.Name.ToLower()))
                    {
                        fileInfo.Delete();
                    }
                }
            }

            //
            CFileList.Instance.ReadFileList();

            //
            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CPP || ExportType == EExportType.CSP || ExportType == EExportType.LUA)
            {
                string csPeDir  = @".\TableOut\Temp\1_Protoext\C#";
                string ccPeDir  = @".\TableOut\Temp\1_Protoext\C++";
                string goPeDir  = @".\TableOut\Temp\1_Protoext\GO";
                string luaPeDir = @".\TableOut\Temp\1_Protoext\Lua";

                if (!Directory.Exists(csPeDir))
                {
                    Directory.CreateDirectory(csPeDir);
                }
                if (!Directory.Exists(ccPeDir))
                {
                    Directory.CreateDirectory(ccPeDir);
                }
                if (!Directory.Exists(goPeDir))
                {
                    Directory.CreateDirectory(goPeDir);
                }
                if (!Directory.Exists(luaPeDir))
                {
                    Directory.CreateDirectory(luaPeDir);
                }

                //Thread.Sleep(1000); // 不等待一下,有可能报 proto 文件锁住
                Console.WriteLine("********** 生成 *.proto 和 *.pe 文件 **********");

                //
                FileInfo tmpFileInfo = null;

                tmpFileInfo = new FileInfo(@".\DesTable\DataTable\GlobalTable.xlsx");
                if (tmpFileInfo.Exists)
                {
                    argsStr = @"-GenType=Enum -DataFile=.\DesTable\DataTable\GlobalTable.xlsx -OutputFile=.\TableOut\Temp\1_Protoext\globalEnum.proto -EnumName=EnumName -EnumValue=ID -EnumDesc=Description";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpFileInfo = new FileInfo(@".\DesTable\DataTable\MailMsgTable.xlsx");
                if (tmpFileInfo.Exists)
                {
                    argsStr = @"-GenType=Enum -DataFile=.\DesTable\DataTable\MailMsgTable.xlsx -OutputFile=.\TableOut\Temp\1_Protoext\mailIDEnum.proto -EnumName=EnumName -EnumValue=ID -EnumDesc=Title";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                //
                DirectoryInfo tmpDirectoryInfo = null;

                tmpDirectoryInfo = new DirectoryInfo(@".\ProTable\AccountServer\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\ProTable\AccountServer\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDirectoryInfo = new DirectoryInfo(@".\ProTable\GlobalServer\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\ProTable\GlobalServer\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDirectoryInfo = new DirectoryInfo(@".\ProTable\DatabaseServer\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\ProTable\DatabaseServer\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDirectoryInfo = new DirectoryInfo(@".\ProTable\LogServer\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\ProTable\LogServer\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDirectoryInfo = new DirectoryInfo(@".\ProTable\LogicTable\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\ProTable\LogicTable\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDirectoryInfo = new DirectoryInfo(@".\ProTable\BattleTable\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\ProTable\BattleTable\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDirectoryInfo = new DirectoryInfo(@".\DesTable\DescTable\");
                if (tmpDirectoryInfo.Exists)
                {
                    argsStr = @"-GenType=Proto -DescPath=.\DesTable\DescTable\ -OutputPath=.\TableOut\Temp\1_Protoext\";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }
            }

            //
            Environment.CurrentDirectory       = desDir1.FullName;
            CGeneration.Instance.RootDirectory = Environment.CurrentDirectory;

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CPP)
            {
                Console.WriteLine("********** 生成 C++ 的 *.pb 文件 **********");
                argsStr = @"-GenType=Pbsrc -ProtoPath=.\ -OutputPath=..\2_Protobuf\ -Language=C++";
                Console.WriteLine(argsStr);
                Execute(argsStr.Split(' '));
            }

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CSP)
            {
                Console.WriteLine("********** 生成 C# 的 *.pb 文件 **********");
                argsStr = @"-GenType=Pbsrc -ProtoPath=.\ -OutputPath=..\2_Protobuf\ -Language=C#";
                Console.WriteLine(argsStr);
                Execute(argsStr.Split(' '), true);
            }

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.LUA)
            {
                Console.WriteLine("********** 生成 Lua 的 *.pb 文件 **********");
                argsStr = @"-GenType=Pbsrc -ProtoPath=.\ -OutputPath=..\2_Protobuf\ -Language=Lua";
                Console.WriteLine(argsStr);
                Execute(argsStr.Split(' '));
            }

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO)
            {
                Console.WriteLine("********** 生成 Python 的 *.pb 文件 **********");
                argsStr = @"-GenType=Pbsrc -ProtoPath=.\ -OutputPath=..\2_Protobuf\ -Language=Python";
                Console.WriteLine(argsStr);
                Execute(argsStr.Split(' '));
            }

            Environment.CurrentDirectory       = dirRoot.FullName;
            CGeneration.Instance.RootDirectory = Environment.CurrentDirectory;

            //
            if (ExportType == EExportType.ALL || ExportType == EExportType.DES)
            {
                Console.WriteLine("********** 生成 *.bin 文件 **********");
                DirectoryInfo exeDir1 = new DirectoryInfo(@".\TableGen\01_LopGeneration\");
                Environment.CurrentDirectory       = exeDir1.FullName; // 因为要找 cspProtobuf.dll 文件
                CGeneration.Instance.RootDirectory = Environment.CurrentDirectory;

                argsStr = @"-GenType=Binary -DataPath=..\..\DesTable\DataTable\ -DescPath=..\..\DesTable\DescTable\ -PBSrcPath=..\..\TableOut\Temp\2_Protobuf\C#\ -OutputPath=..\..\TableOut\Temp\3_Protobin\";
                Console.WriteLine(argsStr);
                Execute(argsStr.Split(' '));

                Environment.CurrentDirectory       = dirRoot.FullName;
                CGeneration.Instance.RootDirectory = Environment.CurrentDirectory;
            }

            //
            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CPP || ExportType == EExportType.CSP || ExportType == EExportType.LUA)
            {
                Console.WriteLine("********** 生成 Msg 文件 **********");
                DirectoryInfo tmpDir = null;

                tmpDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Msg -DataPath=.\TableGen\10_BasicsSystem\ -OutputPath=.\TableOut\Temp\4_Protomsg\ -Language=cpp_cs_lua";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDir = new DirectoryInfo(@".\TableGen\11_ExtendSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Msg -DataPath=.\TableGen\11_ExtendSystem\ -OutputPath=.\TableOut\Temp\4_Protomsg\ -Language=cpp_cs_lua";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                // 兼容老版文件目录
                tmpDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Msg -DataPath=.\TableGen\10_ProtobufDef\ -OutputPath=.\TableOut\Temp\4_Protomsg\ -Language=cpp_cs_lua";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }
            }
            else if (ExportType == EExportType.CPP)
            {
                Console.WriteLine("********** 生成 Msg 文件 **********");
                DirectoryInfo tmpDir = null;

                tmpDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Msg -DataPath=.\TableGen\10_BasicsSystem\ -OutputPath=.\TableOut\Temp\4_Protomsg\ -Language=cpp";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDir = new DirectoryInfo(@".\TableGen\11_ExtendSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Msg -DataPath=.\TableGen\11_ExtendSystem\ -OutputPath=.\TableOut\Temp\4_Protomsg\ -Language=cpp";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                // 兼容老版文件目录
                tmpDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Msg -DataPath=.\TableGen\10_ProtobufDef\ -OutputPath=.\TableOut\Temp\4_Protomsg\ -Language=cpp";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }
            }

            //
            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CPP)
            {
                Console.WriteLine("********** 生成 Task 文件 **********");
                DirectoryInfo tmpDir = null;

                tmpDir = new DirectoryInfo(@".\TableGen\10_BasicsSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Task -DataPath=.\TableGen\10_BasicsSystem\ -OutputPath=.\TableOut\Temp\5_Prototask\ -Language=cpp";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                tmpDir = new DirectoryInfo(@".\TableGen\11_ExtendSystem\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Task -DataPath=.\TableGen\11_ExtendSystem\ -OutputPath=.\TableOut\Temp\5_Prototask\ -Language=cpp";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }

                // 兼容老版文件目录
                tmpDir = new DirectoryInfo(@".\TableGen\10_ProtobufDef\");
                if (tmpDir.Exists)
                {
                    argsStr = @"-GenType=Task -DataPath=.\TableGen\10_ProtobufDef\ -OutputPath=.\TableOut\Temp\5_Prototask\ -Language=cpp";
                    Console.WriteLine(argsStr);
                    Execute(argsStr.Split(' '));
                }
            }

            //
            CFileList.Instance.ClearUnuseFile();

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.LUA)
            {
                Console.WriteLine("********** 生成 LuaCfg(Parser) 文件 **********");
                argsStr = @"-GenType=LuaConfig -DataPath=.\DesTable\DescTable\ -OutputPath=.\TableOut\Lua\Generate\Parser\";
                Console.WriteLine(argsStr);
                Execute(argsStr.Split(' '));
            }

            //
            CFileList.Instance.SaveFileList();

            //拷贝到工程目录下
            CSyncFile.Instance.Copy2TableOut();

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.LUA)
            {
                Console.WriteLine("********** 生成 ConfigFiles.lua 文件 **********");
                string path = ".\\TableOut\\Lua\\Generate\\";
                TSLib.ProtoGeneration.CGenerateLuaConfigFiles luaConfig = new TSLib.ProtoGeneration.CGenerateLuaConfigFiles(path);
                luaConfig.TransConfig();
            }

            if (ExportType == EExportType.ALL || ExportType == EExportType.PRO || ExportType == EExportType.CPP)
            {
                Console.WriteLine("********** 刷新VS工程文件 **********");

                _RefreshVSProject(dirRoot.FullName + "/TableOut/C++/PBLib/RefPBLibPrj.exe");
                _RefreshVSProject(dirRoot.FullName + "/TableOut/C++/PELib/RefPELibPrj.exe");
                _RefreshVSProject(dirRoot.FullName + "/TableOut/C++/LTLib/RefLTLibPrj.exe");
                _RefreshVSProject(dirRoot.FullName + "/TableOut/C++/MSLib/RefMSLibPrj.exe");
                _RefreshVSProject(dirRoot.FullName + "/TableOut/C++/DTLib/RefDTLibPrj.exe");
            }

            Console.WriteLine("按任意键继续...");
            Console.ReadKey();
            return(0);
        }