private void WriteMessage(MessageDeclaration message, bool isAfter) { WriteLine(); if (isAfter) { WriteLine(Resources.AfterAttr); WriteLine(Resources.After); } else { WriteLine(Resources.BeforeAttr); WriteLine(Resources.Before); } using (new Block(this)) { string[] lines = message.Code.Split('\n'); foreach (string line in lines) { WriteLine(line.Trim()); } } }
private Declaration[] GetMembers(bool isTypeRef, bool isCompact, out InitMemoryDeclaration initMemory, out MessageDeclaration before, out MessageDeclaration after) { List <Declaration> declarations = new List <Declaration>(5); initMemory = null; before = null; after = null; while (MoveNext()) { Token token = Current(); Declaration declaration = null; switch (token.Type) { case TokenType.Semicolon: case TokenType.Document: continue; case TokenType.DotInitMemoryKeyword when initMemory != null: LogError(Resources.Error_A1031_InvalidDotInitMemory, token); break; case TokenType.DotInitMemoryKeyword: initMemory = GetInitMemory(); continue; case TokenType.DotBeforeKeyword when before != null: LogError(Resources.Error_A1032_InvalidDotBefore, token); break; case TokenType.DotBeforeKeyword: before = GetBefore(); continue; case TokenType.DotAfterKeyword when after != null: LogError(Resources.Error_A1033_InvalidDotAfter, token); break; case TokenType.DotAfterKeyword: after = GetAfter(); continue; case TokenType.CheckrefKeyword when isCompact: LogError(Resources.Error_A1024_InvalidCheckRefWhenCompact, token); break; case TokenType.CheckrefKeyword: case TokenType.FixedKeyword: case TokenType.UnicodeKeyword: case TokenType.UTF8Keyword: case TokenType.ASCIIKeyword: case TokenType.SByteKeyword: case TokenType.ByteKeyword: case TokenType.ShortKeyword: case TokenType.UShortKeyword: case TokenType.IntKeyword: case TokenType.UIntKeyword: case TokenType.LongKeyword: case TokenType.ULongKeyword: case TokenType.BoolKeyword: case TokenType.FloatKeyoword: case TokenType.DoubleKeyword: case TokenType.DecimalKeyword: case TokenType.CharKeyword: case TokenType.StringKeyword: case TokenType.Identifier: MoveBack(); declaration = GetField(isTypeRef); break; case TokenType.PublicKeyword: case TokenType.InternalKeyword: case TokenType.FinalKeyword: case TokenType.RuntimeKeyword: case TokenType.CompactKeyword: case TokenType.RefKeyword: case TokenType.TypeKeyword: MoveBack(); declaration = GetTypeDef(); break; default: MoveBack(); goto End; } declarations.Add(declaration); } End: return(declarations.ToArray()); }