Read() public method

public Read ( OsiReader reader ) : void
reader OsiReader
return void
示例#1
0
文件: Rule.cs 项目: Norbyte/lslib
        public override void Read(OsiReader reader)
        {
            base.Read(reader);
            Calls = reader.ReadList<Call>();

            Variables = new List<Variable>();
            var variables = reader.ReadByte();
            while (variables-- > 0)
            {
                var type = reader.ReadByte();
                if (type != 1) throw new InvalidDataException("Illegal value type in rule variable list");
                var variable = new Variable();
                variable.Read(reader);
                if (variable.Adapted)
                {
                    variable.VariableName = String.Format("_Var{0}", Variables.Count + 1);
                }

                Variables.Add(variable);
            }

            Line = reader.ReadUInt32();

            if (reader.MajorVersion > 1 || (reader.MajorVersion == 1 && reader.MinorVersion >= 6))
                IsQuery = reader.ReadBoolean();
            else
                IsQuery = false;
        }
示例#2
0
        public override void Read(OsiReader reader)
        {
            base.Read(reader);
            Calls = reader.ReadList <Call>();

            Variables = new List <Variable>();
            var variables = reader.ReadByte();

            while (variables-- > 0)
            {
                var type = reader.ReadByte();
                if (type != 1)
                {
                    throw new InvalidDataException("Illegal value type in rule variable list");
                }
                var variable = new Variable();
                variable.Read(reader);
                if (variable.Adapted)
                {
                    variable.VariableName = String.Format("_Var{0}", Variables.Count + 1);
                }

                Variables.Add(variable);
            }

            Line = reader.ReadUInt32();

            if (reader.Ver >= OsiVersion.VerAddQuery)
            {
                IsQuery = reader.ReadBoolean();
            }
            else
            {
                IsQuery = false;
            }
        }