public static int GetTypeSize(PropNode prop) { Symbol sym = prop.Type; // no static size for proto if (prop.Flags != null && prop.Flags == "proto") { return(0); } if (sym is WeakSymbol) { WeakSymbol wsym = sym as WeakSymbol; string key = wsym.Identifier; if (!weakTypeMap.ContainsKey(key)) { key = defaultType; } if (!String.IsNullOrEmpty(prop.FlagsOpt)) { return(Int32.Parse(prop.FlagsOpt)); } return(weakTypeMap[key].Size); } else if (sym is StrongSymbol) { StrongSymbol ssym = sym as StrongSymbol; if (ssym.Class is EnumNode) { EnumNode enode = ssym.Class as EnumNode; if (enode.Type is WeakSymbol) { return(weakTypeMap[((WeakSymbol)enode.Type).Identifier].Size); } else { return(weakTypeMap[defaultType].Size); } } } return(0); }
public virtual string EmitType(Symbol sym) { if (sym is WeakSymbol) { WeakSymbol wsym = sym as WeakSymbol; string identifier = wsym.Identifier; if (weakTypeMap.ContainsKey(identifier)) { return(weakTypeMap[identifier]); } else if (identifier.StartsWith("CMsg")) { return(identifier + " *"); } else if (identifier == "ulong.MaxValue") { return("ULLONG_MAX"); } else { return(identifier); } } else if (sym is StrongSymbol) { StrongSymbol ssym = sym as StrongSymbol; if (ssym.Prop == null) { return(ssym.Class.Name); } else { if (ssym.Class.Name.StartsWith("E")) { return(ssym.Class.Name + ssym.Prop.Name); } else { return("[_SK" + ssym.Class.Name + " " + ssym.Prop.Name + "]"); } } } return("INVALID"); }
public string EmitType(Symbol sym) { if (sym is WeakSymbol) { WeakSymbol wsym = sym as WeakSymbol; return(wsym.Identifier); } else if (sym is StrongSymbol) { StrongSymbol ssym = sym as StrongSymbol; if (ssym.Prop == null) { return(ssym.Class.Name); } else { return(ssym.Class.Name + "." + ssym.Prop.Name); } } return("INVALID"); }
public string EmitType(Symbol sym) { if (sym is WeakSymbol) { WeakSymbol wsym = sym as WeakSymbol; return(wsym.Identifier.Replace("SteamKit2", "Steam").Replace("ulong.MaxValue", "'18446744073709551615'")); } else if (sym is StrongSymbol) { StrongSymbol ssym = sym as StrongSymbol; if (ssym.Prop == null) { return(ssym.Class.Name); } else { return(ssym.Class.Name + "." + ssym.Prop.Name); } } return("INVALID"); }