public TdlProperty(string identifier, TdlObject owner, TdlType type, ToffeeModifiers modifiers = ToffeeModifiers.None) : base(identifier, owner, modifiers) { if (owner.GetType() == typeof(TdlService)) { throw new Exception("TdlProperty cannot be owned by TdlService."); } Type = type; }
public void AddParameter(string identifier, TdlType type) { if (ParameterLookup.ContainsKey(identifier)) { return; } TdlParameter parameter = new TdlParameter(identifier, type); _Parameters.Add(parameter); MinimumSize += parameter.Type.MinimumSize; ParameterLookup.Add(identifier, parameter); Owner.File.AddStringToHash(identifier); if (type.Type == ToffeeValueType.Struct) { Owner.AddRequiredNamespace(type.StructType.Namespace.FullName); } }
public void AddProperty(string identifier, TdlType type, ToffeeModifiers modifiers = ToffeeModifiers.None) { if (PropertyIdentifierLookup.ContainsKey(identifier)) { return; } TdlProperty property = new TdlProperty(identifier, this, type, modifiers); _Properties.Add(property); PropertyLookup.Add(property.FieldId, property); PropertyIdentifierLookup.Add(identifier, property); AddField(property); MinimumSize += type.MinimumSize; if (type.Type == ToffeeValueType.Struct) { AddRequiredNamespace(type.StructType.Namespace.FullName); } }