protected bool ReadData_Impl(GData data, JsonData jsonData, GStructField field) { data.Obj = new Dictionary <string, GData>(); if (!jsonData.IsObject) { GLog.LogError("JsonData of {0}({1}) is not a struct {2}", field.Name, this.Name, data.debugInfo); return(false); } bool inheritParent = false; string fieldName; // check if field name is not defined. foreach (var key in jsonData.Keys) { if (key.Equals("ID") || key.Equals("Type") || key.Equals("Parent") || key.Equals("Singleton") || key.Equals("RuntimeLink") ) { continue; } if (key[0] == '+') { GLog.Log("inheritParent " + key); inheritParent = true; fieldName = key.Substring(1, key.Length - 1); } else { fieldName = key; } GStructField desc = GetField(fieldName); if (desc == null) { GLog.LogError("{0} is not a field of {1} {2}", fieldName, this.Name, data.debugInfo); return(false); } GType tp = GTypeManager.Instance.GetType(desc.Type); GData subData = tp.ReadData(jsonData[key], inheritParent, desc, data.debugInfo); if (subData == null) { return(false); } data.Obj.Add(desc.Name, subData); } return(true); }
public GType GetType(string name) { GType tp; if (mTypeMap.TryGetValue(name, out tp)) { return(tp); } else { GLog.LogError("GTypeManager GetType, error, can't find type: " + name); return(null); } }
public override GData ReadData(string strData, GStructField field, DataDebugInfo ownerDebugInfo) { GData data = new GData(Name); data.debugInfo = ownerDebugInfo; data.Enum = strData; if (!this.Contains(data.Enum)) { GLog.LogError(data.Enum + " is not in " + Name + data.debugInfo); return(null); } return(data); }
public override bool WriteBinary(BinaryWriter writer, GData data, GObject inObj) { writer.Write(data.Count); for (int iSub = 0; iSub < data.Count; ++iSub) { if (data.Map[iSub] == null) { GLog.LogError("Map item is null!"); } data.Map[iSub].key.WriteBinary(writer, inObj); data.Map[iSub].val.WriteBinary(writer, inObj); } return(true); }
public override bool WriteBinary(BinaryWriter writer, GData data, GObject inObj) { writer.Write(data.Count); for (int iSub = 0; iSub < data.Count; ++iSub) { if (data.Array[iSub] == null) { GLog.LogError("Array item is null! in {1}:{0}", data.fieldInfo.Name, inObj.ID); return(false); } data.Array[iSub].WriteBinary(writer, inObj); } return(true); }
public override GData ReadData(JsonData jsonData, bool inherit, GStructField field, DataDebugInfo ownerDebugInfo) { GData data = new GData(Name); data.inheritParent = inherit; data.debugInfo = ownerDebugInfo; data.Enum = (string)jsonData; if (!this.Contains(data.Enum)) { GLog.LogError(data.Enum + " is not in " + Name + data.debugInfo); return(null); } return(data); }
// get base type inherited from TBase // public string GetRootType(string type) { GTypeClass tmp = (GTypeClass)this.GetType(type); while (tmp != null && !string.IsNullOrEmpty(tmp.Parent)) { tmp = (GTypeClass)this.GetType(tmp.Parent); } if (tmp == null) { GLog.LogError("Cant find Root Type of " + type); return(null); } return(tmp.Name); }
public override GData GetFieldWithInheritance(string fieldName) { GData ret = this.GetField(fieldName); if (ret == null && !string.IsNullOrEmpty(this.Parent)) { GObject parent = GDataManager.Instance.GetObj(this.Parent); // TODO: check errors if (parent == null) { GLog.LogError("Can't find template definition: " + this.Parent + debugInfo); return(null); } ret = parent.GetFieldWithInheritance(fieldName); } return(ret); }
public static GType CreateFromJson(JsonData data) { GType ret = null; if (data.Keys.Contains("Class")) { ret = new GTypeClass(); } else if (data.Keys.Contains("Struct")) { ret = new GTypeStruct(); } else if (data.Keys.Contains("Enum")) { ret = new GTypeEnum(); } else if (data.Keys.Contains("BitField")) { ret = new GTypeBitField(); } else { GLog.LogError("Type must be declared as 'Class' or 'Struct' or 'Enum' or 'BitField'. \n" + data.ToJson()); return(null); } if (ret != null) { if (data.Keys.Contains("CompileTo")) { ret.CompileTo = (CompileTarget)Enum.Parse(typeof(CompileTarget), (string)data["CompileTo"]); } else { ret.CompileTo = CompileTarget.CSharp; } if (ret.ParseJson(data)) { return(ret); } } return(null); }
public override bool WriteDefault(BinaryWriter writer, JsonData defaultVal) { if (defaultVal != null) { if (!defaultVal.IsString) { GLog.LogError("Invalid default value:{0} of {1}. Need string.", defaultVal, Name); return(false); } writer.Write(GetVal((string)defaultVal, null)); } else { writer.Write((long)0); } return(true); }
/* public bool LoadYaml(string content) * { * try * { * var deserializer = new YamlDotNet.Serialization.DeserializerBuilder().Build(); * var yamlObject = deserializer.Deserialize(new StringReader(content)); * var serializer = new YamlDotNet.Serialization.SerializerBuilder() * .JsonCompatible() * .Build(); * } * catch (Exception ex) * { * GLog.LogError("YAML parse error: " + ex.Message); * } * * var json = serializer.Serialize(yamlObject); * return LoadJson(json); * } */ /// <summary> /// Load types json. /// 可以多次Load多个json并合并 /// 最终必须调用Build() /// </summary> public bool LoadJson(string content, string fileName, BatchInfo batch = null) { LitJson.JsonData typeList; try { typeList = LitJson.JsonMapper.ToObject(content); } catch (Exception ex) { GLog.LogError("Exception catched while parsing : " + fileName + "\n" + ex.Message); return(false); } for (int i = 0; i < typeList.Count; ++i) { GType tp = GType.CreateFromJson(typeList[i]); if (tp == null) { return(false); } if (mTypeMap.ContainsKey(tp.Name)) { GLog.LogError("GTypeManager.Load: Multi definition of " + tp.Name); return(false); } tp.batch = batch; if (tp.Namespace == null) { if (batch != null) { tp.Namespace = batch.code_namespace; } else { tp.Namespace = "zf.util"; } } mTypeMap.Add(tp.Name, tp); mTypeList.Add(tp); //GLog.Log("Finish " + tp.Name + " isEnum:" + tp.IsEnum() + "\n"); } return(true); }
public GData GetArrayIndex(int index) { if (inst_array == null) { GLog.LogError("GData.GetIndex: " + mType + " is not an array" + debugInfo); return(null); } if (index < inst_array.Count) { return(inst_array[index]); } else { GLog.LogError("GData.GetIndex: " + index + " is out of index " + inst_array.Count + debugInfo); return(null); } }
public override bool WriteDefault(BinaryWriter writer, JsonData defaultVal) { long val = 0; if (defaultVal != null) { if (!defaultVal.IsString) { GLog.LogError("Invalid default value:{0} of {1}. Need string.", defaultVal, Name); return(false); } if (GetVal((string)defaultVal) == -1) { GLog.LogError("Invalid default value:{0} of {1}.", defaultVal, Name); return(false); } val = GetVal((string)defaultVal); } else { val = 0; } switch (bitSize) { case 8: writer.Write((sbyte)val); break; case 16: writer.Write((short)val); break; case 32: writer.Write((int)val); break; case 64: writer.Write((long)val); break; } return(true); }
public int GetID(string str, bool autoGen = false) { int ret = 0; if (!record.idMap.TryGetValue(str, out ret)) { if (autoGen) { // todo: 临时使用CRC32,后面需要支持多人、多分支并行开发时保证ID不重复 ret = (int)Crc32.Calc(str); record.idMap[str] = ret; } else { GLog.LogError("Template of {0} is not defined.", str); } } return(ret); }
public void PrepareTIDForJsonTmpls(string jsonPath) { if (!File.Exists(jsonPath)) { return; } string jsonStr = File.ReadAllText(jsonPath); LitJson.JsonData jsonData; try { jsonData = LitJson.JsonMapper.ToObject(jsonStr); } catch (LitJson.JsonException ex) { GLog.LogError("Exception catched while parsing : " + jsonPath + "\n" + ex.Message); return; } if (!jsonData.IsArray) { return; } for (int i = 0; i < jsonData.Count; ++i) { if (!jsonData[i].Keys.Contains("Type") || !jsonData[i].Keys.Contains("ID")) { return; } string type = (string)jsonData[i]["Type"]; // check is class GTypeClass tp = GTypeManager.Instance.GetType(type) as GTypeClass; if (tp == null) { GLog.LogError("LoadJson. '" + type + "' is not defined or is not class\n"); return; } string finalTID = string.IsNullOrEmpty(tp.Category) ? (string)jsonData[i]["ID"] : (tp.Category + "." + (string)jsonData[i]["ID"]); GetID(finalTID, true); } }
public override GData ReadData(JsonData jsonData, bool inherit, GStructField field, DataDebugInfo ownerDebugInfo) { GData data = new GData(GType.Map); data.inheritParent = inherit; data.debugInfo = ownerDebugInfo; data.fieldInfo = field; data.Map = new List <MapKV>(); GType keyType = GTypeManager.Instance.GetType(field.SubTypes[0]); GType valType = GTypeManager.Instance.GetType(field.SubTypes[1]); if (jsonData.IsObject) { var keys = jsonData.Keys; var e = keys.GetEnumerator(); while (e.MoveNext()) { GData key = keyType.ReadData(e.Current, field, data.debugInfo); if (key == null) { return(null); } GData val = valType.ReadData(jsonData[e.Current], false, field, data.debugInfo); if (val == null) { return(null); } data.Map.Add(new MapKV() { key = key, val = val }); } return(data); } else { GLog.LogError("Field '{0}' expect array data.{1}", field.Name, data.debugInfo); return(null); } }
public virtual bool WriteBinary(BinaryWriter writer, GData data, GObject inObj) { if (Name.Equals(GType.Bool)) { writer.Write(data.Bool); } else if (Name.Equals(GType.Byte)) { writer.Write(data.Byte); } else if (Name.Equals(GType.Short)) { writer.Write(data.Short); } else if (Name.Equals(GType.Int)) { writer.Write(data.Int); } else if (Name.Equals(GType.Float)) { writer.Write(data.Float); } else if (Name.Equals(GType.String)) { SerializeUtil.WriteString(writer, inObj.ReplaceMacro(data.String, data.debugInfo)); } else if (Name.Equals(GType.TID)) { string realTID = inObj.ReplaceMacro(data.TID, data.debugInfo); //GObject obj = GDataManager.Instance.GetObj(realTID); int id = GTIDGenerator.Instance.GetID(realTID); if (id == 0) { GLog.LogError("Can't find the definition of '" + realTID + "'" + data.debugInfo); writer.Write(0); } else { writer.Write(id); } } return(true); }
public void LoadRecord(string path) { if (File.Exists(path)) { try { record = LitJson.JsonMapper.ToObject <TIDMap>(File.ReadAllText(path)); this.path = path; } catch (Exception ex) { GLog.LogError("Exception while reading {0} :\n{1}", path, ex); } } else { this.path = path; record = new TIDMap(); record.idMap = new Dictionary <string, int>(); } }
public static GType CreateFromDesc(TypeDesc desc) { GType ret = null; if (desc.Tt == TypeDesc.TT.Class) { ret = new GTypeClass(); } else if (desc.Tt == TypeDesc.TT.Struct) { ret = new GTypeStruct(); } else if (desc.Tt == TypeDesc.TT.Enum) { ret = new GTypeEnum(); } else if (desc.Tt == TypeDesc.TT.BitField) { ret = new GTypeBitField(); } else { GLog.LogError("Type must be declared as 'Class' or 'Struct' or 'Enum' or 'BitField'. \n" + desc.Tt); return(null); } ret.Name = desc.Name; ret.Namespace = desc.Namespace; ret.CompileTo = desc.CompileTo; ret.Gen_Head = desc.Gen_Head; ret.Gen_Serialize = desc.Gen_Serialize; ret.Gen_Deserialize = desc.Gen_Deserialize; if (ret.Parse(desc)) { return(ret); } return(null); }
/// <summary> /// Load Types from C# Assembly /// </summary> public bool LoadFromAssembly(string fileName, BatchInfo batch = null, string[] namespaceFilter = null) { Assembly asm = Assembly.Load(File.ReadAllBytes(fileName)); foreach (var desc in GCSAssembly_Convertor.Convert(asm, namespaceFilter)) { GType tp = GType.CreateFromDesc(desc); if (tp == null) { return(false); } if (mTypeMap.ContainsKey(tp.Name)) { GLog.LogError("GTypeManager.Load: Multi definition of " + tp.Name); return(false); } tp.batch = batch; mTypeMap.Add(tp.Name, tp); mTypeList.Add(tp); } return(true); }
public bool PreBuild() { if (prebuilded) { return(true); } prebuilded = true; if (!string.IsNullOrEmpty(Parent)) { GLog.Log("Build: " + this.ID); GObject parentObj = GDataManager.Instance.GetObj(Parent); if (parentObj == null) { GLog.LogError("Parent '{0}' can't be found.{1}", Parent, debugInfo); return(false); } // 0. parent prebuild parentObj.PreBuild(); // 1. Inherite Array、Map ... var e = inst_object.GetEnumerator(); while (e.MoveNext()) { if (e.Current.Value.inheritParent) { GLog.Log("inheriteParent true"); GData parentData = parentObj.GetField(e.Current.Key); e.Current.Value.InheriteParent(parentData); } } } return(true); }
public bool InheritParentFields() { if (inherited) { return(true); } if (this.Parent == null) { return(true); } // check GTypeClass parentType = (GTypeClass)GTypeManager.Instance.GetType(this.Parent); if (parentType == null || !parentType.IsClass()) { GLog.LogError("'" + this.Parent + "' is not defined or is not a 'Class'"); return(false); } parentType.InheritParentFields(); // inherit category this.Category = parentType.Category; // inherit fiedls this.mInheritedFields = new GStructField[parentType.FieldCount]; for (int i = 0; i < this.mInheritedFields.Length; ++i) { // TODO: copy or ref ? // this.mInheritedFields[i] = parentType.GetField(i); } inherited = true; return(true); }
public virtual bool GenCode_CS_Impl(CodeGenerator gen) { GLog.LogError("Basic GType!"); return(false); }
public virtual GData ReadData(string strData, GStructField field, DataDebugInfo ownerDebugInfo) { GData data = new GData(Name); data.debugInfo = ownerDebugInfo; if (Name.Equals(GType.Bool)) { bool ret; if (bool.TryParse(strData, out ret)) { data.Bool = bool.Parse(strData); } else { GLog.LogError("Parse Bool failed: {0}", strData); return(null); } } else if (Name.Equals(GType.Byte) || Name.Equals(GType.Short) || Name.Equals(GType.Int)) { int intVal = 0; int ret; if (int.TryParse(strData, out ret)) { intVal = ret; } else { string[] splits = strData.Split('.'); if (splits.Length >= 2) { GType tp = GTypeManager.Instance.GetType(splits[0]); if (tp.IsEnum()) { GTypeEnum enumTp = tp as GTypeEnum; int val = (int)enumTp.GetVal(splits[1]); if (val != -1) { intVal = val; } else { GLog.LogError("Can't parse {0} while assigning to int field {1}{2}", strData, field.Name, data.debugInfo); } } else { GLog.LogError("Can't parse {0} while assigning to int field {1}{2}", strData, field.Name, data.debugInfo); } } else { GLog.LogError("Can't parse {0} while assigning to int field {1}{2}", strData, field.Name, data.debugInfo); } } if (Name.Equals(GType.Int)) { data.Int = intVal; } else if (Name.Equals(GType.Short)) { data.Short = (short)intVal; if (data.Short != intVal) { GLog.LogError("{0} is cast to short {1}", intVal, data.Short); } } else if (Name.Equals(GType.Byte)) { data.Byte = (byte)intVal; if (data.Byte != intVal) { GLog.LogError("{0} is cast to byte {1}", intVal, data.Byte); } } } else if (Name.Equals(GType.Float)) { float ret; if (float.TryParse(strData, out ret)) { data.Float = ret; } else { GLog.LogError("(" + strData + ") is not a number" + data.debugInfo); return(null); } } else if (Name.Equals(GType.String)) { data.String = strData; } else if (Name.Equals(GType.TID)) { if (string.IsNullOrEmpty(field.Category)) { data.TID = strData; } else { data.TID = field.Category + "." + strData; } } return(data); }
public override bool WriteJson(ref JsonData jsonData, GData data) { GLog.LogError("GTypeMap WriteJson is not implemented."); return(false); }
public virtual bool WriteDefault(BinaryWriter writer, JsonData defaultVal = null) { if (Name.Equals(GType.Bool)) { if (defaultVal == null) { writer.Write(false); } else if (defaultVal.IsBoolean) { writer.Write((bool)defaultVal); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } else if (Name.Equals(GType.Byte)) { if (defaultVal == null) { writer.Write((byte)0); } else if (defaultVal.IsInt) { writer.Write((byte)defaultVal); } else if (defaultVal.IsDouble) { writer.Write((byte)(float)defaultVal); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } else if (Name.Equals(GType.Short)) { if (defaultVal == null) { writer.Write((short)0); } else if (defaultVal.IsInt) { writer.Write((short)defaultVal); } else if (defaultVal.IsDouble) { writer.Write((short)(float)defaultVal); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } else if (Name.Equals(GType.Int)) { if (defaultVal == null) { writer.Write(0); } else if (defaultVal.IsInt) { writer.Write((int)defaultVal); } else if (defaultVal.IsDouble) { writer.Write((int)(float)defaultVal); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } else if (Name.Equals(GType.Float)) { if (defaultVal == null) { writer.Write(0.0f); } else if (defaultVal.IsInt) { writer.Write((float)defaultVal); } else if (defaultVal.IsDouble) { writer.Write((float)defaultVal); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } else if (Name.Equals(GType.String)) { if (defaultVal == null) { writer.Write(0); } else if (defaultVal.IsString) { SerializeUtil.WriteString(writer, (string)defaultVal); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } else if (Name.Equals(GType.TID)) { if (defaultVal == null) { writer.Write(0); } else if (defaultVal.IsString) { writer.Write(GTIDGenerator.Instance.GetID((string)defaultVal)); } else { GLog.LogError("Default value is invalid. Skipped. Type: " + this.Name + " default: " + defaultVal); } return(true); } return(false); }
/// <summary> /// Replaces the macro. /// </summary> /// <returns>new string</returns> public string ReplaceMacro(string str, DataDebugInfo debugInfo) { if (string.IsNullOrEmpty(str)) { return(str); } int index = 0; int numOfMacro = 0; string newStr = ""; while (index < str.Length) { int leftIndex = str.IndexOf("##", index, StringComparison.Ordinal); if (leftIndex < 0) { if (index > 0) { newStr += str.Substring(index); } break; } int rightIndex = str.IndexOf("##", leftIndex + 2, StringComparison.Ordinal); if (rightIndex < 0) { GLog.LogError("Can't parse macro in string : " + str + debugInfo); return(str); } numOfMacro += 1; newStr += str.Substring(index, leftIndex - index); string macroName = str.Substring(leftIndex + 2, rightIndex - leftIndex - 2); // todo: 目前仅支持ID宏 其他的后续看情况添加 // if (macroName.Equals("ID")) { if (this.ID.IndexOf('.') < 0) { newStr += this.ID; } else { string[] splits = this.ID.Split('.'); newStr += splits[1]; } } else { GLog.LogError("Unknown macro '{0}' in string '{1}'{2}", macroName, str, debugInfo); return(str); } index = rightIndex + 2; } if (numOfMacro > 0) { GLog.Log("ReplaceMacro '{0}' to '{1}' {2}", str, newStr, debugInfo); } else { newStr = str; } return(newStr); }
// string cache // List<string> mStrings = new List<string>(); public bool LoadJson(string jsonStr, string dir, string fileName, string patchName) { GLog.Log("Load json: " + Path.Combine(dir, fileName)); LitJson.JsonData jsonData; try { jsonData = LitJson.JsonMapper.ToObject(jsonStr); } catch (LitJson.JsonException ex) { GLog.LogError("Exception catched while parsing : " + Path.Combine(dir, fileName) + "\n" + ex.Message); return(false); } for (int i = 0; i < jsonData.Count; ++i) { if (!jsonData[i].Keys.Contains("Type")) { GLog.LogError("GDataManager.LoadJson: " + jsonData.ToJson() + " does not contain 'Type' definition"); return(false); } string type = (string)jsonData[i]["Type"]; // check is class GTypeClass tp = GTypeManager.Instance.GetType(type) as GTypeClass; if (tp == null) { GLog.LogError("LoadJson. '" + type + "' is not defined or is not class\n"); return(false); } DataDebugInfo info = new DataDebugInfo(); info.fileName = Path.Combine(dir, fileName); GObject obj = tp.ReadData(jsonData[i], false, null, info) as GObject; if (obj == null) { continue; } obj.DirPath = dir; obj.FileName = Path.GetFileNameWithoutExtension(fileName); obj.patch = patchName; GObject oldObj; if (mIDMap.TryGetValue(obj.ID, out oldObj)) { if (oldObj.patch.Equals((obj.patch))) { GLog.LogError("GDataManager.LoadJson: Multi definition of " + oldObj.ID); return(false); } else { mIDMap[obj.ID] = obj; List <GObject> typeObjs; if (!mTypeMap.TryGetValue(type, out typeObjs)) { typeObjs = new List <GObject>(); mTypeMap.Add(type, typeObjs); } typeObjs.Remove(oldObj); typeObjs.Add(obj); } } else { mIDMap[obj.ID] = obj; List <GObject> typeObjs; if (!mTypeMap.TryGetValue(type, out typeObjs)) { typeObjs = new List <GObject>(); mTypeMap.Add(type, typeObjs); } typeObjs.Add(obj); } } return(true); }
public bool Parse(JsonData jsonData) { foreach (var key in jsonData.Keys) { // 兼容旧版本 // if (key.Equals("Field")) { this.Name = (string)jsonData["Field"]; } else if (key.Equals("Array")) { this.Name = (string)jsonData["Array"]; this.Type = GType.Array; } // 兼容旧版本 // else if (key.Equals("Type")) { if (jsonData["Type"].IsString) { if (this.Type == null) { this.Type = (string)jsonData["Type"]; } else { this.SubTypes = new string[1]; this.SubTypes[0] = (string)jsonData["Type"]; } } else { GLog.LogError("'Type' must be string. " + jsonData["Type"]); return(false); } } else if (key.Equals("Category")) { this.Category = (string)jsonData["Category"]; } else if (key.Equals("Default")) { this.Default = jsonData["Default"]; } else if (key.Equals("Tags")) { this.Tags = ((string)jsonData["Tags"]).Split(';'); } else if (key.Equals("Limit")) { this.Limit = (string)jsonData["Limit"]; } else if (key.Equals("Desc")) { // todo: desc } else { // new way to define type-name if (key.StartsWith("Array<") && key.EndsWith(">")) { this.Type = GType.Array; int preLength = 6; // "Array<".Length string innerStr = key.Substring(preLength, key.Length - preLength - 1); this.SubTypes = new string[1]; this.SubTypes[0] = innerStr.Trim(); } else if (key.Contains("Map<") && key.Contains(">")) { this.Type = GType.Map; int preLength = 4; // "Map<".Length string innerStr = key.Substring(preLength, key.Length - preLength - 1); string[] splits = innerStr.Split(','); if (splits.Length != 2) { GLog.LogError("Parse Type {0} failed!", key); return(false); } this.SubTypes = new string[2]; this.SubTypes[0] = splits[0].Trim(); this.SubTypes[1] = splits[1].Trim(); } else { this.Type = key; } this.Name = (string)jsonData[key]; } } // TODO: check type is correct // check errors if (string.IsNullOrEmpty(this.Name)) { GLog.LogError("GType.Field.Parse: 'Name' is required"); return(false); } if (string.IsNullOrEmpty(this.Type)) { GLog.LogError("GType.Field.Parse: 'Type' is required"); return(false); } return(true); }
public virtual bool GenCode_FlatBuffer(CodeGenerator gen) { GLog.LogError("Basic GType!"); return(false); }