ProtocolBuffers.ProtoParser.ParseOption C# (CSharp) Method

ParseOption() static private method

File or Message options
static private ParseOption ( TokenReader tr, Message m ) : void
tr TokenReader
m Message
return void
        static void ParseOption(TokenReader tr, Message m)
        {
            //Read name
            string key = tr.ReadNext ();
            if (tr.ReadNext () != "=")
                throw new ProtoFormatException ("Expected: = got " + tr.Next);
            //Read value
            string value = tr.ReadNext ();
            if (tr.ReadNext () != ";")
                throw new ProtoFormatException ("Expected: ; got " + tr.Next);

            //null = ignore option
            if (m == null)
                return;

            switch (key) {
            case "namespace":
                m.OptionNamespace = value;
                break;
            case "triggers":
                m.OptionTriggers = Boolean.Parse (value);
                break;
            case "access":
                m.OptionAccess = value;
                break;
            default:
                Console.WriteLine ("Warning: Unknown option: " + key);
                break;
            }
        }