Пример #1
0
        public async static Task <string> FixCorruptXmlAsync(byte[] file, CorruptionType corruptionType, bool ff_KeyTracks)
        {
            byte[] unzip;

            try
            {
                unzip = await ZipTool.DecompressAsync(file);
            }
            catch (UnsupportedCompressionAlgorithmException)
            {
                throw;
            }

            if (unzip is byte[] bytes && bytes.Length > 0)
            {
                var xmlDoc = XDocument.Parse(Encoding.UTF8.GetString(unzip));

                if (corruptionType == CorruptionType.DUPLICATE_NOTE_IDS)
                {
                    //saved here for debugging purposes
                    var dupes = RunDuplicateNoteIdsAlgorithm(xmlDoc, ff_KeyTracks);
                }

                return(await SaveXmlAsync(xmlDoc));
            }

            throw new InvalidDataException("file");
        }
Пример #2
0
        string ProcessFile(string filePath, string dirName, int contentOrder)
        {
            var extention = Path.GetExtension(filePath);
            var fileName  = string.Empty;


            switch (extention)
            {
            case ".zip":
                var outpuDirPahtZip = ZipTool.Exact(filePath);
                CreateContentAndUploadImage(outpuDirPahtZip, dirName, contentOrder);
                Directory.Delete(outpuDirPahtZip, true);
                break;

            case ".rar":
                var outpuDirPahtRar = ZipTool.Exact(filePath);
                CreateContentAndUploadImage(outpuDirPahtRar, dirName, contentOrder);
                Directory.Delete(outpuDirPahtRar, true);
                break;

            case ".pdf":
                var outpuStreamList = PDFTool.PDFToImage(filePath).Result;
                CreateContentAndUploadImage(filePath, dirName, outpuStreamList, contentOrder);
                break;
            }
            return(fileName);
        }
Пример #3
0
        /// <summary>
        /// 组合打包文件
        /// </summary>
        /// <returns></returns>
        private IEnumerator PitchFile()
        {
            this.m_updatPhase = UpdatePhase.PitchFile;

            string fileName  = "Temp/" + KTConfigs.kSrcName;
            string deltaName = "Temp/" + KTConfigs.kDeltaName;

            Debug.Log("组合补丁文件");
            Directory.SetCurrentDirectory(KTPathHelper.DataPath);
            OctodiffUtil.ExecutePitch(fileName, deltaName, KTConfigs.kSrcName);

            //把新的src.zip文件拷贝到persistentDataPath/Temp目录下,覆盖掉原来的src.zip
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            if (File.Exists(KTConfigs.kSrcName))
            {
                File.Move(KTConfigs.kSrcName, fileName);
            }

            //删掉除Temp目录之外的所有旧资源,目录直接删掉,文件不需要删,会直接覆盖
            Directory.Delete(KTPathHelper.DataPath + "BuildRes", true);
            Directory.Delete(KTPathHelper.DataPath + "lua", true);
            Directory.SetCurrentDirectory(Application.dataPath.Replace("/Assets", ""));

            Debug.Log("解压src.zip");
            this.m_updatPhase = UpdatePhase.UnZipFile;
            ZipTool.unZipFile(KTPathHelper.DataPath + fileName, KTPathHelper.DataPath);//需要时间
            yield return(UpdateComplete());
        }
Пример #4
0
        static string ProcessFile(string filePath, string dirName)
        {
            var extention = Path.GetExtension(filePath);
            var fileName  = "cartoon/" + Path.GetRandomFileName();

            switch (extention)
            {
            case ".zip":
                var outpuDirPaht = ZipTool.Exact(filePath);
                AnalyseDic(outpuDirPaht, dirName);
                break;

            case ".pdf":
                var outpuStream = PDFTool.PDFToImage(filePath);
                //QiniuTool.UploadImage(outpuStream, fileName).Wait();
                break;

            case ".jpg":
            case ".jpeg":
                QiniuTool.UploadImage(filePath, fileName).Wait();
                break;
            }

            return(fileName);
        }
Пример #5
0
    static void UnCompressFiles()
    {
        string zipPath = Application.dataPath + @"/ZipTest/ZipTest.zip";
        string outPath = Application.dataPath + @"/ZipTest/UncCompress/";

        ZipTool.TestUnZipFile(zipPath, outPath);
        AssetDatabase.Refresh();
    }
Пример #6
0
        public void ZipArchiveSubmit(byte[] zipdata, int principalID, int asstID)
        {
            AuthorizedIdent ident = AuthenticateTicket(Ticket);

            ZipTool zt = new ZipTool();

            zt.CreateSource(new MemoryStream(zipdata));
            new Submissions(ident).Create(asstID, principalID, zt);
        }
Пример #7
0
    static void CompressFiles()
    {
        string[] fileName = new string[] {
            Application.dataPath + @"/ZipTest/zip01.txt",
            Application.dataPath + @"/ZipTest/zip02.txt"
        };
        string outputFilePath = Application.dataPath + @"/ZipTest/ZipTest.zip";

        ZipTool.TestZipFile(fileName, outputFilePath, 9);
        AssetDatabase.Refresh();
    }
Пример #8
0
 public static void StartUnZipFile(byte[] bts, string unZipDir, string password, bool overWrite = true)
 {
     if (!unZipDir.EndsWith("\\"))
     {
         unZipDir += Path.DirectorySeparatorChar;
     }
     if (!Directory.Exists(unZipDir))
     {
         Directory.CreateDirectory(unZipDir);
     }
     ZipTool.UnZipFile(ZipTool.WriteFile(bts), unZipDir, password, overWrite);
 }
Пример #9
0
 public static void StartUnZipFile(string zipedFile, string unZipDir, string password, bool overWrite)
 {
     if (!unZipDir.EndsWith("\\"))
     {
         unZipDir += Path.DirectorySeparatorChar;
     }
     if (!Directory.Exists(unZipDir))
     {
         Directory.CreateDirectory(unZipDir);
     }
     ZipTool.UnZipFile(ZipTool.WriteFile(zipedFile), unZipDir, string.Empty, overWrite);
 }
Пример #10
0
        /// <summary>
        /// 这个方法主要是想暴露给外部知道当前的下载进度。类内部通过Update()调用,捕获www的状态然后相应的保存或者其他的操作
        /// </summary>
        /// <returns></returns>
        public DownloadStatus GetDownloadStatus()
        {
            if (downloadTimeCounter > MAX_DOWNLOAD_COUNT)
            {
                return(DownloadStatus.COMPLETEFAILED);
            }

            if (www.IsDone())
            {
                if (www.IsError == false)
                {
                    if (fileInfo.NeedCompress)
                    {
                        string path     = FileManager.GetPersistentDataPath(fileInfo.SavePath);
                        string fullPath = string.Empty;
                        if (path.EndsWith("/"))
                        {
                            fullPath = path + fileInfo.FileName;
                        }
                        else
                        {
                            fullPath = path + "/" + fileInfo.FileName;
                        }

                        if (ZipTool.Decompress(www.GetWWW().bytes, fullPath, false) == false)                       //如果解压失败
                        {
                            Debug.LogError(fileInfo.URL + " download failed, trying download again. downloadTimeCounter : " + downloadTimeCounter + "\n " + www.GetWWW().error);
                            www = null;
                            StartDownload();
                            return(DownloadStatus.FAILED);
                        }
                    }
                    else
                    {
                        SaveByteToFile();
                    }

                    return(DownloadStatus.DOWNLOADED);
                }
                else
                {
                    Debug.LogError(fileInfo.URL + " download failed, trying download again. downloadTimeCounter : " + downloadTimeCounter + "\n " + www.GetWWW().error);
                    www = null;                         //类内部调用StartDownload方法要确保每次都是新开辟的www
                    StartDownload();

                    return(DownloadStatus.FAILED);
                }
            }
            else
            {
                return(DownloadStatus.DOWNLOADING);
            }
        }
Пример #11
0
        /// <summary>
        /// メイン関数
        /// </summary>
        /// <param name="args">
        /// <para>圧縮ファイルのパス</para>
        /// <para>フォルダや、複数ファイルにも対応</para>
        /// </param>
        private static async Task Main(string[] args)
        {
            //有効なパスが一つもなければ終了
            if (!args.Any(s => Directory.Exists(s) || File.Exists(s)))
            {
                return;
            }
            Console.WriteLine("application path  : " + Common.ApplicationDirPath);

            //Console.WriteLine("Zip files");
            foreach (var x in args)
            {
                Console.WriteLine(x);
            }

            //パスワード生成
            var passWord = ZipTool.GenerateZipPassword(Common.PasswordLength, Common.PasswordChars);

            Console.WriteLine("password : " + passWord);

            // パスワードファイル作成
            using (var templateStream = new StreamReader(Common.TemplateFilePath))
                using (var passwordFile = new StreamWriter(Path.Combine(GetOutputDirName(args), Common.PassWordFileName)))
                {
                    var passwordFileString = (await templateStream.ReadToEndAsync())
                                             .Replace(Common.PasswordKeyWord, passWord);
                    await passwordFile.WriteAsync(passwordFileString);
                }

            //出力先のZipファイルを作成
            var outputFileName = Path.Combine(GetOutputDirName(args), Common.ZipFileName);

            using (FileStream fsOut = File.Create(outputFileName))
                using (var zipStream = new ZipOutputStream(fsOut)
                {
                    Password = passWord,
                })
                {
                    //フォルダ群の圧縮
                    foreach (var folder in args.Where(name => Directory.Exists(name)))
                    {
                        ZipTool.CompressFolder(zipStream, folder, Directory.GetParent(folder).FullName);
                    }

                    //ファイル群の圧縮
                    foreach (var file in args.Where(name => File.Exists(name)))
                    {
                        ZipTool.CompressFile(zipStream, file, new FileInfo(file).DirectoryName);
                    }
                }
        }
Пример #12
0
        public void DbToFile(HttpResponse res)
        {
            this.dboperator_0 = this.connectionConfig_0.getDBOperator();
            this.dboperator_0.Open();
            StringBuilder builder = new StringBuilder();
            string        str     = this.httpRequest_0[("type")];

            try
            {
                string      str2     = "<root>" + this.method_0("option", "") + "</root>";
                XmlDocument document = null;
                document = new XmlDocument();
                document.LoadXml(str2);
                for (int i = 0; i < document.DocumentElement.ChildNodes.Count; i++)
                {
                    string    tableName = document.DocumentElement.ChildNodes.Item(i).InnerText;
                    string    str4      = tableName.ToUpper();
                    ArrayList list      = this.getFieldInfos(tableName);
                    if (!((str4.StartsWith("FC_") || str4.StartsWith("FCQ_")) || str4.StartsWith("WF_")))
                    {
                        builder.Append(this.method_3(tableName, list));
                        if (str == "2")
                        {
                            builder.Append(this.method_4(tableName, list));
                        }
                    }
                    else
                    {
                        builder.Append(this.method_4(tableName, list));
                    }
                }
            }
            finally
            {
                try
                {
                    this.dboperator_0.Close();
                }
                catch (Exception)
                {
                }
            }
            ZipTool.zipString(builder.ToString(), "fc_db.zip", "fc.sql", res);
        }
Пример #13
0
        public static void MakeNewVersionSrc()
        {
            string srcName     = Path.Combine(Application.dataPath, "NewVersion", KTConfigs.kSrcName);
            string fileName    = Path.Combine(Application.dataPath, "NewVersion/files.txt");
            string cpySrcName  = Path.Combine(Application.dataPath, "OldVersion", KTConfigs.kSrcName);
            string cpyFileName = Path.Combine(Application.dataPath, "OldVersion/files.txt");

            if (File.Exists(srcName) && File.Exists(fileName))
            {
                File.Copy(srcName, cpySrcName, true);
                File.Delete(srcName);
                File.Copy(fileName, cpyFileName, true);
                File.Delete(fileName);
            }

            ZipTool.ZipFile(Application.streamingAssetsPath, srcName);//创建资源到NewVersion中
            BuildZipFileIndex();
            AssetDatabase.Refresh();
        }
Пример #14
0
    /// <summary>
    /// 下载完毕
    /// </summary>
    static void OnUpdateOver(HTTPRequest req, HTTPResponse resp)
    {
        switch (req.State)
        {
        case HTTPRequestStates.Finished:
            if (resp.IsSuccess)
            {
                if (_isUncompress)
                {
                    ZipTool.Zip(ZipTool.ZipType.UncompressBySevenZipByte, ZipOver, resp.Data);
                }
                else
                {
                    CreateFile(resp.Data);
                }
            }
            else
            {
                Debug.LogWarning(string.Format("下载完毕,但是服务器发送了个错误信息: Status Code: {0}-{1} Message: {2}",
                                               resp.StatusCode,
                                               resp.Message,
                                               resp.DataAsText));
            }
            break;

        case HTTPRequestStates.Error:
            Debug.LogError("下载遇到错误: " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "无异常"));
            break;

        case HTTPRequestStates.Aborted:
            Debug.LogWarning("请求失效!");
            break;

        case HTTPRequestStates.ConnectionTimedOut:
            Debug.LogError("连接目标地址超时!");
            break;

        case HTTPRequestStates.TimedOut:
            Debug.LogError("下载处理超时!");
            break;
        }
    }
Пример #15
0
        private void ProcessFileCategory(string filePath)
        {
            var    extention     = Path.GetExtension(filePath);
            string outputDirPath = string.Empty;

            switch (extention)
            {
            case ".zip":
                outputDirPath = ZipTool.Exact(filePath);
                break;

            case ".rar":
                outputDirPath = RarTool.Exact(filePath);
                break;
            }
            if (!string.IsNullOrEmpty(outputDirPath))
            {
                ProcessCategory(outputDirPath);
                Directory.Delete(outputDirPath, true);
            }
        }
Пример #16
0
 /// <summary>
 /// 开始压缩打出的场景包
 /// </summary>
 void DoCumpress()
 {
     //判断是否有文件夹,没有就创建,否则直接写入会报错
     if (!Directory.Exists(OutputPath))
     {
         Directory.CreateDirectory(OutputPath);
     }
     EditorGUILayout.LabelField("开始压缩打包资源:", EditorStyles.boldLabel);
     if (GUILayout.Button("压缩"))
     {
         //将所有打包出来的场景,进行压缩
         for (int i = 0; i < Dirs.Count; i++)
         {
             DirectoryInfo _dir = new DirectoryInfo(Dirs[i]);
             if (_dir.Exists)
             {
                 var _files = _dir.GetFiles("*.unity3d");
                 for (int j = 0; j < _files.Length; j++)
                 {
                     var    _fileName = _files[j].FullName.Replace("\\", "/");
                     string _name     = _fileName.Replace(Application.streamingAssetsPath, "");
                     string _fullPath = OutputPath + _name;
                     Debug.Log("压缩文件存放路径:" + _fullPath);
                     string _tempDir = Path.GetDirectoryName(_fullPath);
                     if (!Directory.Exists(_tempDir))
                     {
                         Directory.CreateDirectory(_tempDir);
                     }
                     //将文件进行压缩
                     ZipTool.Zip(ZipTool.ZipType.CompressBySevenZip, null, _fileName, _fullPath);
                 }
             }
             else
             {
                 EditorUtility.DisplayDialog("提示", "导入文件路径不存在,请导出场景文件", "确定");
                 return;
             }
         }
     }
 }
Пример #17
0
    static public void ZipDirectory(string source, string target, int compressionLevel)
    {
        source.Replace("\\", "/");

        if (source.Length != 0)
        {
            // 打包所有的assetbundle到zip,先获取文件目录层级路径,以及assetbundle路径
            string[]      pathDerctorys = Directory.GetDirectories(source, "*", SearchOption.AllDirectories);
            List <string> pathList      = new List <string>(pathDerctorys);

            for (int i = 0; i < pathList.Count;)
            {
                pathList[i] = pathList[i].Replace("\\", "/");
                if (Directory.GetFiles(pathList[i], "*", SearchOption.AllDirectories).Length != 0)
                {
                    pathList[i] = pathList[i] + "/";
                    i++;
                }
                else
                {
                    pathList.RemoveAt(i);
                }
            }
            pathDerctorys = pathList.ToArray();

            string[] pathFiles = Directory.GetFiles(source, "*", SearchOption.AllDirectories);

            string[] allPaths            = ZipTool.MergerArray(pathDerctorys, pathFiles);
            int      directoryNameLength = source.Length;

            for (int i = 0; i < allPaths.Length; i++)
            {
                allPaths[i] = allPaths[i].Replace("\\", "/");
            }
            m_process = 0;
            ZipTool.ZipDerctory(allPaths, target, directoryNameLength + 1, compressionLevel);
        }
    }
Пример #18
0
        /// <summary>
        /// 第一次运行前,在编辑器模式下,需要把src.zip和files文件从NewVersion目录手动拷贝到streamingAssetsPath目录中
        /// 第一次运行游戏,增量更新模式,把资源从streamingAssetsPath目录拷贝到Application.persistentDataPath目录
        /// 首先要把src.zip拷贝到persistentDataPath/Temp目录下
        /// 再把src.zip解压到Application.persistentDataPath下
        /// </summary>
        /// <returns></returns>
        private IEnumerator DeltaExtractResource()
        {
            this.m_updatPhase = UpdatePhase.DeltaExtractFile;
            //拷贝files.txt到persistentDataPath目录
            string srcPath = KTPathHelper.AppContentPath(); //游戏包资源释放和加载目录
            string dstPath = KTPathHelper.DataPath;         //发布后的游戏数据存储目录

            if (Directory.Exists(dstPath))
            {
                Directory.Delete(dstPath, true);
            }

            Directory.CreateDirectory(dstPath);

            string infile  = srcPath + "files.txt";
            string outfile = dstPath + "files.txt";

            yield return(CopyFile(infile, outfile));

            this.m_updatPhase = UpdatePhase.DeltaExtractSrc;
            if (!Directory.Exists(dstPath + "Temp"))
            {
                Directory.CreateDirectory(dstPath + "Temp");
            }

            //拷贝src.zip到persistentDataPath目录
            infile  = srcPath + KTConfigs.kDeltaName;
            outfile = dstPath + "Temp/" + KTConfigs.kDeltaName;
            yield return(CopyFile(infile, outfile));

            Debug.Log("解压" + KTConfigs.kDeltaName);
            ZipTool.unZipFile(outfile, dstPath);//同步操作 需要时间
            //if (ZipTool.inputStream.Available > 0)
            //    yield return new WaitForEndOfFrame();
            Debug.Log("解包完成!!!");
            yield return(DeltaUpdateResource());
        }
Пример #19
0
        private bool zipAction(string arguments, bool unzip = false)
        {
            bool result = true;

            string[] args = parseArguments(arguments);

            if (args != null && args.Length == 2)
            {
                ZipTool zt = new ZipTool();

                if (unzip)
                {
                    log.Info("$> Extrallendo contenido del archivo ZIP: [" + args[0] + "] al destino: [" + args[1] + "]");
                    result = zt.UnZipFile(args[0], args[1]);
                }
                else
                {
                    log.Info("$> Creando archivo ZIP: [" + args[1] + "] del Directorio: [" + args[0] + "]");
                    result = zt.CreateZipFileFromDirectory(args[0], args[1], true);
                }
            }

            return(result);
        }
Пример #20
0
    /// <summary>
    /// 开始导出对应文件
    /// </summary>
    void DoOutputFile(DataTable table, EExprotType type)
    {
        if (type == EExprotType.C && string.IsNullOrEmpty(OutputPath))
        {
            EditorUtility.DisplayDialog("提示", "当前不压缩数据的导出路径不存在", "确定");
            return;
        }
        if (type == EExprotType.C && string.IsNullOrEmpty(OutputPathCompress) && IsNeedCompress)
        {
            EditorUtility.DisplayDialog("提示", "当前压缩数据的导出路径不存在", "确定");
            return;
        }
        if (type == EExprotType.S && string.IsNullOrEmpty(OutputPathServer))
        {
            EditorUtility.DisplayDialog("提示", "当前服务器数据导出路径不存在", "确定");
            return;
        }
        if (type == EExprotType.C && OutputPath == OutputPathCompress)
        {
            EditorUtility.DisplayDialog("提示", "压缩数据路径不能与不压缩数据路径相同", "确定");
            return;
        }
        int _rowCount = table.Rows.Count;
        int _column   = table.Columns.Count;

        //开始循环写数据
        for (int i = _HEADROWNUM; i < _rowCount; i++)
        {
            var _row = table.Rows[i];
            for (int j = 0; j < _column; j++)
            {
                var _s = table.Rows[1][j].ToString().Trim().ToLower();
                switch (type)
                {
                case EExprotType.C:
                    if (_s == NOCS || _s == NOC)
                    {
                        continue;
                    }
                    break;

                case EExprotType.S:
                    if (_s == NOCS || _s == NOS)
                    {
                        continue;
                    }
                    break;

                default:
                    break;
                }
                string _type = table.Rows[3][j].ToString();
                if (_type == "string")
                {
                    WriteData(_type, _row[j].ToString(), uint.Parse(table.Rows[4][j].ToString()));
                }
                else
                {
                    WriteData(_type, _row[j].ToString());
                }
            }
        }
        if (type == EExprotType.C && IsExportClient)
        {
            //数据写入buff完毕,将buff写入不压缩文件
            IOTool.CreateFileBytes(OutputPath + "/" + _TableName + ".bytes", NowBuffer.ToBytes());
        }
        //若是压缩选项,则开始压缩
        if (type == EExprotType.C && IsNeedCompress)
        {
            ZipTool.Zip(ZipTool.ZipType.CompressBySevenZip, null, OutputPath + "/" + _TableName + ".bytes", OutputPathCompress + "/" + _TableName + ".bytes");
        }
        if (type == EExprotType.S && IsExportServer)
        {
            IOTool.CreateFileBytes(OutputPathServer + "/" + _TableName + ".bytes", NowBuffer.ToBytes());
        }
    }
Пример #21
0
    private void doUpdate()
    {
        string currentVer = ProductVersion;
            string onLineVer = "";
            try
            {
                onLineVer = GetOnlinever();
            }
            catch (Exception ex)
            {
                screenBox.Buffer.Text += "\r\n Non è possibile reperire la versione online";
                return;
            }

            if (currentVer != onLineVer)
                {
                    DialogResult DigR = MessageBox.Show("Rilevata Nuova Versione !!\r\n Update ?","WARN !!",MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
                    if (DigR.ToString() == "Yes")
                    {
                    Directory.CreateDirectory(@".\updates\");
                    download("http://www.enturion.com/Launcher_Installer/Launcher" + onLineVer + ".zip", @".\updates\Launcher" + onLineVer + ".zip");
                    ZipTool zip = new ZipTool();
                    bool result = zip.UnZipFile(@".\updates\Launcher" + onLineVer + ".zip");
                    if (result)
                    {
                        MessageBox.Show("File Estratti !");
                        ProcessStartInfo PI = new ProcessStartInfo();

                        string CopyArgs = @".\updates\update.bat";
                        PI.FileName = "cmd.exe";
                        PI.Arguments = " /c " + CopyArgs;
                        //PI.CreateNoWindow = true;
                        //PI.RedirectStandardOutput = true;
                        //PI.UseShellExecute = false;
                        MessageBox.Show("Processo di Update in avvvio !");
                        Process newProc = Process.Start(PI);

                        Application.Exit();
                    }
                    }
                }
    }
Пример #22
0
    public static void ExportLuaApi()
    {
        List <Type> classList = XLua.Utils.GetAllTypes();

        // add class here
        BindingFlags bindType = BindingFlags.DeclaredOnly |
                                BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public;

        MethodInfo[]           methods;
        MemberInfo[]           fields;
        PropertyInfo[]         properties;
        List <ConstructorInfo> constructors;

        ParameterInfo[] paramInfos;
        int             delta;
        string          path = m_apiDir;

        if (path == "")
        {
            return;
        }

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        foreach (Type t in classList)
        {
            string fileName = path + "/" + t.Name + ".lua";
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            Debug.LogError("fileName=" + fileName);
            FileStream   fs             = new FileStream(fileName, FileMode.Create);
            var          utf8WithoutBom = new System.Text.UTF8Encoding(false);
            StreamWriter sw             = new StreamWriter(fs, utf8WithoutBom);

            if (t.BaseType != null)
            {
                sw.WriteLine(string.Format("---@class {0} : {1}", t.FullName, t.BaseType.FullName));
            }
            else
            {
                sw.WriteLine(string.Format("---@class {0}", t.FullName));
            }

            string className = t.Name;

            #region field
            fields = t.GetFields(bindType);
            foreach (var field in fields)
            {
                if (IsObsolete(field))
                {
                    continue;
                }
                WriteField(sw, field.DeclaringType, field.Name);
            }

            properties = t.GetProperties(bindType);
            foreach (var property in properties)
            {
                if (IsObsolete(property))
                {
                    continue;
                }
                WriteField(sw, property.DeclaringType, property.Name);
            }

            sw.Write("\n");
            #endregion

            #region constructor
            constructors = new List <ConstructorInfo>(t.GetConstructors(bindType));
            constructors.Sort((left, right) => { return(left.GetParameters().Length - right.GetParameters().Length); });
            bool isDefineTable = false;

            if (constructors.Count > 0)
            {
                sw.WriteLine(className + " = { }");
                WriteCtorComment(sw, constructors);
                paramInfos = constructors[constructors.Count - 1].GetParameters();
                delta      = paramInfos.Length - constructors[0].GetParameters().Length;
                WriteFun(sw, paramInfos, delta, t, "New", className);
                isDefineTable = true;
            }

            #endregion

            #region method
            methods = t.GetMethods(bindType);
            MethodInfo method;

            Dictionary <string, List <MethodInfo> > methodDict = new Dictionary <string, List <MethodInfo> >();
            if (methods.Length != 0 && !isDefineTable)
            {
                sw.WriteLine(className + " = { }");
            }

            for (int i = 0; i < methods.Length; i++)
            {
                method = methods[i];
                string methodName = method.Name;
                if (IsObsolete(method))
                {
                    continue;
                }
                if (method.IsGenericMethod)
                {
                    continue;
                }
                if (!method.IsPublic)
                {
                    continue;
                }
                if (methodName.StartsWith("get_") || methodName.StartsWith("set_"))
                {
                    continue;
                }

                List <MethodInfo> list;
                if (!methodDict.TryGetValue(methodName, out list))
                {
                    list = new List <MethodInfo>();
                    methodDict.Add(methodName, list);
                }
                list.Add(method);
            }

            var itr = methodDict.GetEnumerator();
            while (itr.MoveNext())
            {
                List <MethodInfo> list = itr.Current.Value;
                RemoveRewriteFunHasTypeAndString(list);
                list.Sort((left, right) => { return(left.GetParameters().Length - right.GetParameters().Length); });
                WriteFunComment(sw, list);
                paramInfos = list[list.Count - 1].GetParameters();
                delta      = paramInfos.Length - list[0].GetParameters().Length;
                WriteFun(sw, paramInfos, delta, list[0].ReturnType, list[0].Name, className);
            }
            itr.Dispose();

            if (methods.Length != 0 || isDefineTable)
            {
                sw.WriteLine("return " + className);
            }
            #endregion

            //清空缓冲区
            sw.Flush();
            //关闭流
            sw.Close();
            fs.Close();
        }
        string zipName = path + ".zip";
        if (File.Exists(zipName))
        {
            File.Delete(zipName);
        }
        ZipTool.ZipDirectory(path, zipName, 7);
        Directory.Delete(path, true);

        Debug.Log("转换完成");
    }