public void GenData(IDataReadable reader, string outputPath = null)
        {
            string className        = reader.currentDataTypeName;
            Type   protobufDataType = Type.GetType(ProtobufData.nameSpace + "." + className + ",Assembly-CSharp");

            //Debug.Log(ProtobufData.nameSpace + "." + className + ",Assembly-CSharp" + " 是否存在" + protobufDataType.ToString());

            if (protobufDataType == null)
            {
                GenCS(reader);
                protobufDataType = Type.GetType(ProtobufData.nameSpace + "." + className + ",Assembly-CSharp");
                Debug.unityLogger.Log("Gen the CS File Please");
            }

            List <Dictionary <string, object> > rowObjs = reader.GetRowObjs();

            List <object> result = new List <object>();

            for (int i = 0; i < rowObjs.Count; i++)
            {
                object         item      = Activator.CreateInstance(protobufDataType);
                PropertyInfo[] propertys = protobufDataType.GetProperties();
                foreach (KeyValuePair <string, object> pair in rowObjs[i])
                {
                    PropertyInfo prop = propertys.First((pro) => { return(pro.Name == pair.Key); });
                    prop.SetValue(item, pair.Value, null);
                    Debug.unityLogger.Log(pair.ConverToString());
                }

                result.Add(item);
            }

            string protoPath = PathConfig.GetLocalGameDataPath(PathConfig.DataType.Protobuf);

            PathEx.MakeFileDirectoryExist(protoPath);

            if (ProtoBuf.Serializer.NonGeneric.CanSerialize(protobufDataType))
            {
                string resPath = protoPath + className + ProtobufData.ex;
                if (outputPath != null)
                {
                    resPath = outputPath;
                }
                string root = Path.GetDirectoryName(resPath);
                PathEx.MakeFileDirectoryExist(root);
                using (var file = System.IO.File.Create(resPath))
                {
                    ProtoBuf.Serializer.NonGeneric.Serialize(file, result);
                    Debug.unityLogger.Log(resPath + "导出成功");
                }
            }
            else
            {
                Debug.unityLogger.LogError("序列化", protobufDataType.FullName + "不可序列化!");
            }
        }
        public void GenData(IDataReadable reader, string outputPath = null)
        {
            string className = reader.currentDataTypeName;

            Type          objDataType = Type.GetType(ObjData.nameSpace + "." + className + ",Assembly-CSharp");
            ObjDataBundle data        = ScriptableObject.CreateInstance <ObjDataBundle>();

            List <Dictionary <string, object> > rowObjs = reader.GetRowObjs();

            //ArrayList result = new ArrayList();
            for (int i = 0; i < rowObjs.Count; i++)
            {
                var            item      = Activator.CreateInstance(objDataType);
                PropertyInfo[] propertys = objDataType.GetProperties();
                foreach (KeyValuePair <string, object> pair in rowObjs[i])
                {
                    Debug.logger.Log(pair.ConverToString());
                    PropertyInfo prop = propertys.First((pro) => { return(pro.Name == pair.Key); });
                    prop.SetValue(item, pair.Value, null);
                }

                data.dataArray.Add(item);
            }

            string dataPath = PathConfig.GetLocalGameDataPath(PathConfig.DataType.Obj);

            PathEx.MakeDirectoryExist(dataPath);


            string resPath = dataPath + className + ObjData.ex;

            if (outputPath != null)
            {
                resPath = outputPath;
            }
            string root = Path.GetDirectoryName(resPath);

            PathEx.MakeDirectoryExist(root);

            AssetDatabase.CreateAsset(data, "Assets/" + className + ObjData.ex);

            string tempPath = Path.Combine(Application.dataPath, className + ObjData.ex);

            if (File.Exists(resPath))
            {
                File.Delete(resPath);
            }
            File.Move(tempPath, resPath);
            Debug.Log("保存到了" + resPath);
        }
        public void GenData(IDataReadable reader, string outputPath = null)
        {
            string className = reader.currentDataTypeName;

            Type objDataType = Type.GetType(ObjData.nameSpace + "." + className + ",Assembly-CSharp");
            Type bundleType  = Type.GetType(ObjData.nameSpace + "." + className + "Bundle" + ",Assembly-CSharp");
            //var bundleType = typeof(ObjDataBundle<>).MakeGenericType(objDataType);
            var data = ScriptableObject.CreateInstance(bundleType);

            List <Dictionary <string, object> > rowObjs = reader.GetRowObjs();

            //ArrayList result = new ArrayList();
            for (int i = 0; i < rowObjs.Count; i++)
            {
                var            item      = Activator.CreateInstance(objDataType);
                PropertyInfo[] propertys = objDataType.GetProperties();
                foreach (KeyValuePair <string, object> pair in rowObjs[i])
                {
                    Debug.unityLogger.Log(pair.ConverToString());
                    PropertyInfo prop = propertys.First((pro) => { return(pro.Name == pair.Key); });
                    prop.SetValue(item, pair.Value, null);
                }

                var field        = bundleType.GetField("dataArray");
                var list         = field.GetValue(data);
                var fieldType    = field.FieldType;
                var fieldMethods = fieldType.GetMethods();
                var method       = fieldType.GetMethod("Add");
                method.Invoke(list, new object[] { item });
                field.SetValue(data, list);
                //field.InvokeByReflect("Add", item);
                //data.dataArray.Add(item);
            }

            string dataPath = PathConfig.GetLocalGameDataPath(PathConfig.DataType.Obj);

            PathEx.MakeFileDirectoryExist(dataPath);


            string resPath = dataPath + className + ObjData.ex;

            if (outputPath != null)
            {
                resPath = outputPath;
            }
            string root = Path.GetDirectoryName(resPath);

            PathEx.MakeFileDirectoryExist(root);

            AssetDatabase.CreateAsset(data, "Assets/" + className + ObjData.ex);

            string tempPath = Path.Combine(Application.dataPath, className + ObjData.ex);

            if (File.Exists(resPath))
            {
                File.Delete(resPath);
            }
            File.Move(tempPath, resPath);
            Debug.Log("保存到了" + resPath);
            AssetDatabase.Refresh();
            var ai = AssetImporter.GetAtPath(PathEx.ConvertAbstractToAssetPath(resPath));

            ai.assetBundleName = PathConfig.DataBundleName;
            AssetDatabase.Refresh();
        }