ReadBoolean() public méthode

public ReadBoolean ( ) : bool
Résultat bool
Exemple #1
1
        public Boolean fromFile(String path)
        {
            FileStream fs = new FileStream(path, FileMode.Open);
            BinaryReader reader = new BinaryReader(fs);
            try
            {
                String h = reader.ReadString();
                float v = BitConverter.ToSingle(reader.ReadBytes(sizeof(float)), 0);
                drawFloorModel = reader.ReadBoolean();
                showAlwaysFloorMap = reader.ReadBoolean();
                lockMapSize = reader.ReadBoolean();
                mapXsize = reader.ReadInt32();
                mapYsize = reader.ReadInt32();

                //edgeXのxはmapX-1
                //yはmapYsize

                return true;

            }
            catch (EndOfStreamException eex)
            {
                //握りつぶす
                return false;
            }
            finally
            {
                reader.Close();
            }
        }
        public void Deserialize(BinaryReader reader)
        {
            Width = reader.ReadInt32();
            Height = reader.ReadInt32();
            Stories = reader.ReadInt32();

            var size = Width * Height;

            Walls = new WallTile[Stories][];
            for (int l=0;l<Stories;l++)
            {
                Walls[l] = new WallTile[size];
                for (int i = 0; i < size; i++) Walls[l][i] = WallTileSerializer.Deserialize(reader);
            }

            Floors = new FloorTile[Stories][];
            for (int l = 0; l < Stories; l++)
            {
                Floors[l] = new FloorTile[size];
                for (int i = 0; i < size; i++) Floors[l][i] = new FloorTile { Pattern = reader.ReadUInt16() };
            }

            WallsDirty = reader.ReadBoolean();
            FloorsDirty = reader.ReadBoolean();
        }
Exemple #3
0
 public BeyondDemons(BinaryReader inStream)
 {
     Unknown0 = inStream.ReadInt32();
     Unknown1 = inStream.ReadInt32();
     Flag0 = inStream.ReadBoolean();
     Flag1 = inStream.ReadBoolean();
 }
Exemple #4
0
        public static IList<Station> ParseStations(Stream stream)
        {
            using (var reader = new BinaryReader (stream, System.Text.Encoding.UTF8, true)) {
                var count = reader.ReadInt32 ();
                var stations = new Station[count];
                for (int i = 0; i < count; i++) {
                    stations [i] = new Station {
                        Id = reader.ReadInt32 (),
                        Street = reader.ReadString (),
                        Name = reader.ReadString(),
                        StationType = reader.ReadInt32(),
                        b = reader.ReadBoolean(),
                        su = reader.ReadBoolean(),
                        t = reader.ReadBoolean(),
                        bk = reader.ReadBoolean(),
                        bl = reader.ReadBoolean(),
                        Latitude = reader.ReadDouble(),
                        Longitude = reader.ReadDouble(),
                        EmptySlotCount = reader.ReadInt32(),
                        dx = reader.ReadInt32(),
                        BikeCount = reader.ReadInt32(),
                        bx = reader.ReadInt32()
                    };
                }

                return stations;
            }
        }
		private static AntiForgeryToken DeserializeImpl(BinaryReader reader)
		{
			byte b = reader.ReadByte();
			if (b != 1)
			{
				return null;
			}
			AntiForgeryToken antiForgeryToken = new AntiForgeryToken();
			byte[] data = reader.ReadBytes(16);
			antiForgeryToken.SecurityToken = new BinaryBlob(128, data);
			antiForgeryToken.IsSessionToken = reader.ReadBoolean();
			if (!antiForgeryToken.IsSessionToken)
			{
				bool flag = reader.ReadBoolean();
				if (flag)
				{
					byte[] data2 = reader.ReadBytes(32);
					antiForgeryToken.ClaimUid = new BinaryBlob(256, data2);
				}
				else
				{
					antiForgeryToken.Username = reader.ReadString();
				}
				antiForgeryToken.AdditionalData = reader.ReadString();
			}
			if (reader.BaseStream.ReadByte() != -1)
			{
				return null;
			}
			return antiForgeryToken;
		}
		/// <summary>
		/// バイナリ読み込み
		/// </summary>
		/// <param name="reader">バイナリリーダー</param>
		public void Read(BinaryReader reader)
		{
			int version = reader.ReadInt32();
			if (version == VERSION)
			{
				isFullScreen = reader.ReadBoolean();
				isMouseWheelSendMessage = reader.ReadBoolean();
				isEffect = reader.ReadBoolean();
				isSkipUnread = reader.ReadBoolean();
				isStopSkipInSelection = reader.ReadBoolean();
				messageSpeed = reader.ReadSingle();
				autoBrPageSpeed = reader.ReadSingle();
				messageWindowTransparency = reader.ReadSingle();
				soundMasterVolume = reader.ReadSingle();
				bgmVolume = reader.ReadSingle();
				seVolume = reader.ReadSingle();
				ambienceVolume = reader.ReadSingle();
				voiceVolume = reader.ReadSingle();
				voiceStopType = (VoiceStopType)(reader.ReadInt32());
				int num = reader.ReadInt32();
				isVoiceActiveArray = new bool[num];
				for (int i = 0; i < num; i++)
				{
					isVoiceActiveArray[i] = reader.ReadBoolean();
				}
				isAutoBrPage = reader.ReadBoolean();
			}
			else
			{
				Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
			}
		}
        public void LoadBody(byte[] array)
        {
            BinaryReader br = new BinaryReader(new MemoryStream(array));
            // matname = br.ReadPackString();
            int lodcount = br.ReadInt32();
            LODs = new List<Model>();
            for (int i = 0; i < lodcount; i++)
            {
                SubSet[] LodSubset = new SubSet[br.ReadInt32()];
                for (int j = 0; j < LodSubset.Length; j++)
                {
                    string[] names = new string[br.ReadInt32()];
                    for (int n = 0; n < names.Length; n++)
                        names[n] = br.ReadPackString();
                    LodSubset[j] = new SubSet(names);
                }
                LODs.Add(new Model(LodSubset));
            }

            IsShadowCaster = br.ReadBoolean();
            IsShadowReceiver = br.ReadBoolean();
            NeedRotate = br.ReadBoolean();
            isTransparent = br.ReadBoolean();
            isSelfIllumination = br.ReadBoolean();
        }
Exemple #8
0
        internal PdfFont(System.IO.BinaryReader reader)
        {
            _fontName           = reader.ReadString();
            _fullName           = reader.ReadString();
            _familyName         = reader.ReadString();
            _weight             = reader.ReadString();
            _isCIDFont          = reader.ReadBoolean();
            _italicAngle        = reader.ReadDouble();
            _isFixedPitch       = reader.ReadBoolean();
            _characterSet       = reader.ReadString();
            _fontBBox           = new AfmRectangle(reader);
            _underlinePosition  = reader.ReadInt16();
            _underlineThickness = reader.ReadInt16();
            _capHeight          = reader.ReadInt16();
            _xheight            = reader.ReadInt16();
            _ascender           = reader.ReadInt16();
            _descender          = reader.ReadInt16();
            _stdHW = reader.ReadInt16();
            _stdVW = reader.ReadInt16();

            _charMetric = new AfmCharMetric[65536];

            UInt16 pos;

            while ((pos = reader.ReadUInt16()) != 0)
            {
                _charMetric[pos] = new AfmCharMetric(reader);
            }
        }
Exemple #9
0
        public void Deserialize(BinaryReader reader)
        {
            var stackN = reader.ReadInt32();
            Stack = new VMStackFrameMarshal[stackN];
            for (int i = 0; i < stackN; i++) {
                var type = reader.ReadByte();
                Stack[i] = (type==1)?new VMRoutingFrameMarshal():new VMStackFrameMarshal();
                Stack[i].Deserialize(reader);
            }

            var queueN = reader.ReadInt32();
            Queue = new VMQueuedActionMarshal[queueN];
            for (int i = 0; i < queueN; i++)
            {
                Queue[i] = new VMQueuedActionMarshal();
                Queue[i].Deserialize(reader);
            }

            TempRegisters = new short[20];
            for (int i = 0; i < 20; i++) TempRegisters[i] = reader.ReadInt16();
            TempXL = new int[2];
            for (int i = 0; i < 2; i++) TempXL[i] = reader.ReadInt32();
            LastStackExitCode = (VMPrimitiveExitCode)reader.ReadByte();

            if (reader.ReadBoolean())
            {
                BlockingDialog = new VMDialogResult();
                BlockingDialog.Deserialize(reader);
            }
            else BlockingDialog = null;
            Interrupt = reader.ReadBoolean();

            ActionUID = reader.ReadUInt16();
            DialogCooldown = reader.ReadInt32();
        }
Exemple #10
0
 public EffectTemplate(string file)
 {
     BinaryReader reader = new BinaryReader(File.OpenRead(file));
     NumParticles = reader.ReadInt32();
     Offset = new Vector2(reader.ReadSingle(),reader.ReadSingle());
     SizeModRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
     SpeedRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
     LifeTimeRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
     int numRanges = reader.ReadInt32();
     AngleRanges = new List<Vector2>();
     _normalizedAngleRangeLength = new float[numRanges];
     for (int x = 0; x < numRanges; x++)
     {
         Vector2 newRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
         _totalAngleRangeSum += (float)(((newRange.Y - newRange.X) + Math.PI * 2) % Math.PI * 2);
         _normalizedAngleRangeLength[x] = (float)(((newRange.Y - newRange.X) + Math.PI * 2) % Math.PI * 2);
         AngleRanges.Add(newRange);
     }
     for (int x = 0; x < numRanges; x++)
     {
         _normalizedAngleRangeLength[x] /= _totalAngleRangeSum;
     }
     _normalizedAngleRangeLength = new float[AngleRanges.Count];
     InitialSpeedFactor = reader.ReadSingle();
     string textureName = reader.ReadString();
     Collides = reader.ReadBoolean();
     Sticky = reader.ReadBoolean();
 }
        /* The serialized format of the anti-XSRF token is as follows:
         * Version: 1 byte integer
         * SecurityToken: 16 byte binary blob
         * IsSessionToken: 1 byte Boolean
         * [if IsSessionToken = true]
         *   +- IsClaimsBased: 1 byte Boolean
         *   |  [if IsClaimsBased = true]
         *   |    `- ClaimUid: 32 byte binary blob
         *   |  [if IsClaimsBased = false]
         *   |    `- Username: UTF-8 string with 7-bit integer length prefix
         *   `- AdditionalData: UTF-8 string with 7-bit integer length prefix
         */
        private static AntiForgeryToken DeserializeImpl(BinaryReader reader)
        {
            // we can only consume tokens of the same serialized version that we generate
            byte embeddedVersion = reader.ReadByte();
            if (embeddedVersion != TokenVersion) {
                return null;
            }

            AntiForgeryToken deserializedToken = new AntiForgeryToken();
            byte[] securityTokenBytes = reader.ReadBytes(AntiForgeryToken.SecurityTokenBitLength / 8);
            deserializedToken.SecurityToken = new BinaryBlob(AntiForgeryToken.SecurityTokenBitLength, securityTokenBytes);
            deserializedToken.IsSessionToken = reader.ReadBoolean();

            if (!deserializedToken.IsSessionToken) {
                bool isClaimsBased = reader.ReadBoolean();
                if (isClaimsBased) {
                    byte[] claimUidBytes = reader.ReadBytes(AntiForgeryToken.ClaimUidBitLength / 8);
                    deserializedToken.ClaimUid = new BinaryBlob(AntiForgeryToken.ClaimUidBitLength, claimUidBytes);
                } else {
                    deserializedToken.Username = reader.ReadString();
                }

                deserializedToken.AdditionalData = reader.ReadString();
            }

            // if there's still unconsumed data in the stream, fail
            if (reader.BaseStream.ReadByte() != -1) {
                return null;
            }

            // success
            return deserializedToken;
        }
Exemple #12
0
		public static List<MethodSigInfo> Read(BinaryReader reader) {
			if (reader.ReadInt32() != 1)
				throw new InvalidDataException();
			int numHandlers = reader.ReadInt32();
			var list = new List<MethodSigInfo>(numHandlers);
			for (int i = 0; i < numHandlers; i++) {
				var typeCode = (HandlerTypeCode)reader.ReadInt32();
				int numBlocks = reader.ReadInt32();
				var blocks = new List<BlockSigInfo>(numBlocks);
				for (int j = 0; j < numBlocks; j++) {
					int numTargets = reader.ReadInt32();
					var targets = new List<int>(numTargets);
					for (int k = 0; k < numTargets; k++)
						targets.Add(reader.ReadInt32());
					var numHashes = reader.ReadInt32();
					var hashes = new List<BlockElementHash>(numHashes);
					for (int k = 0; k < numHashes; k++)
						hashes.Add((BlockElementHash)reader.ReadInt32());
					var block = new BlockSigInfo(hashes, targets);
					block.HasFallThrough = reader.ReadBoolean();
					block.EndsInRet = reader.ReadBoolean();
					blocks.Add(block);
				}
				list.Add(new MethodSigInfo(blocks, typeCode));
			}
			return list;
		}
Exemple #13
0
        /** Deserializes links placed by the user */
        public virtual UserConnection[] DeserializeUserConnections()
        {
            System.IO.BinaryReader stream = readerStream;

            if (MoveToAnchor("UserConnections"))
            {
                int count = stream.ReadInt32();

                UserConnection[] userConnections = new UserConnection[count];

                for (int i = 0; i < count; i++)
                {
                    UserConnection conn = new UserConnection();
                    conn.p1 = new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle());
                    conn.p2 = new Vector3(stream.ReadSingle(), stream.ReadSingle(), stream.ReadSingle());

                    conn.doOverrideCost = stream.ReadBoolean();
                    conn.overrideCost   = stream.ReadInt32();

                    conn.oneWay        = stream.ReadBoolean();
                    conn.width         = stream.ReadSingle();
                    conn.type          = (ConnectionType)stream.ReadInt32();
                    userConnections[i] = conn;
                }
                return(userConnections);
            }
            else
            {
                return(new UserConnection[0]);
            }
        }
Exemple #14
0
 public override void StateLoad(BinaryReader reader)
 {
     indexReg = reader.ReadInt32();
     irqCounter = reader.ReadInt32();
     irqEnabled = reader.ReadBoolean();
     irqCountdown = reader.ReadBoolean();
 }
        public virtual void Deserialize(BinaryReader reader)
        {
            RoutineID = reader.ReadUInt16();
            InstructionPointer = reader.ReadUInt16();
            Caller = reader.ReadInt16();
            Callee = reader.ReadInt16();
            StackObject = reader.ReadInt16();
            CodeOwnerGUID = reader.ReadUInt32();

            var localN = reader.ReadInt32();
            if (localN > -1)
            {
                Locals = new short[localN];
                for (int i = 0; i < localN; i++) Locals[i] = reader.ReadInt16();
            }

            var argsN = reader.ReadInt32();
            if (argsN > -1)
            {
                Args = new short[argsN];
                for (int i = 0; i < argsN; i++) Args[i] = reader.ReadInt16();
            }

            if (Version > 3) DiscardResult = reader.ReadBoolean();
            ActionTree = reader.ReadBoolean();
        }
Exemple #16
0
 public void RaceSfv()
 {
     CleanTestFilesOutput();
     Race race = UploadSfvFile ();
     FileInfo fileInfo = new FileInfo (Misc.PathCombine (race.CurrentRaceData.DirectoryPath, Config.FileNameRace));
     using (FileStream stream = new FileStream (fileInfo.FullName,
                                                FileMode.OpenOrCreate,
                                                FileAccess.ReadWrite,
                                                FileShare.None))
     {
         using (BinaryReader reader = new BinaryReader (stream))
         {
             stream.Seek (0, SeekOrigin.Begin);
             Assert.AreEqual (4, reader.ReadInt32 (), "Expected integer value (4)");
             stream.Seek(256 * 1, SeekOrigin.Begin);
             Assert.AreEqual("infected.part1.rar", reader.ReadString(), "infected.part1.rar");
             Assert.AreEqual("2e04944c", reader.ReadString(), "2e04944c");
             Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
             stream.Seek(256 * 2, SeekOrigin.Begin);
             Assert.AreEqual("infected.part2.rar", reader.ReadString(), "infected.part2.rar");
             Assert.AreEqual("1c7c24a5", reader.ReadString(), "1c7c24a5");
             Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
             stream.Seek(256 * 3, SeekOrigin.Begin);
             Assert.AreEqual("infected.part3.rar", reader.ReadString(), "infected.part3.rar");
             Assert.AreEqual("d5d617e3", reader.ReadString(), "d5d617e3");
             Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
             stream.Seek(256 * 4, SeekOrigin.Begin);
             Assert.AreEqual("infected.part4.rar", reader.ReadString(), "infected.part4.rar");
             Assert.AreEqual("0edb20ea", reader.ReadString(), "0edb20ea");
             Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
         }
     }
 }
Exemple #17
0
 public override void StateLoad(BinaryReader reader)
 {
     ntReg1 = reader.ReadByte();
     ntReg2 = reader.ReadByte();
     ntRom = reader.ReadBoolean();
     mirroring = reader.ReadBoolean();
 }
Exemple #18
0
 public override void StateLoad(BinaryReader reader)
 {
     irqCounter = reader.ReadByte();
     irqLatch = reader.ReadByte();
     irqReload = reader.ReadBoolean();
     irqEnable = reader.ReadBoolean();
 }
Exemple #19
0
        internal HTTPCacheFileInfo(Uri uri, System.IO.BinaryReader reader, int version)
        {
            this.Uri        = uri;
            this.LastAccess = DateTime.FromBinary(reader.ReadInt64());
            this.BodyLength = reader.ReadInt32();

            switch (version)
            {
            case 3:
                this.NoCache = reader.ReadBoolean();
                this.StaleWhileRevalidate = reader.ReadInt64();
                this.StaleIfError         = reader.ReadInt64();
                goto case 2;

            case 2:
                this.MappedNameIDX = reader.ReadUInt64();
                goto case 1;

            case 1:
            {
                this.ETag           = reader.ReadString();
                this.LastModified   = reader.ReadString();
                this.Expires        = DateTime.FromBinary(reader.ReadInt64());
                this.Age            = reader.ReadInt64();
                this.MaxAge         = reader.ReadInt64();
                this.Date           = DateTime.FromBinary(reader.ReadInt64());
                this.MustRevalidate = reader.ReadBoolean();
                this.Received       = DateTime.FromBinary(reader.ReadInt64());
                break;
            }
            }
        }
Exemple #20
0
 public NPCMaster(BinaryReader inStream)
 {
     Index0 = inStream.ReadInt32();
     Unknown1 = inStream.ReadInt32();
     Flag0 = inStream.ReadBoolean();
     Flag1 = inStream.ReadBoolean();
     Unknown2 = inStream.ReadInt32();
     Unknown3 = inStream.ReadInt32();
     Flag2 = inStream.ReadBoolean();
     Unknown4 = inStream.ReadInt32();
     Unknown5 = inStream.ReadInt32();
     Unknown6 = inStream.ReadInt32();
     Unknown7 = inStream.ReadInt32();
     Unknown8 = inStream.ReadInt32();
     Unknown9 = inStream.ReadInt32();
     Unknown10 = inStream.ReadInt32();
     Unknown11 = inStream.ReadInt32();
     Unknown12 = inStream.ReadInt32();
     Unknown13 = inStream.ReadInt32();
     Unknown14 = inStream.ReadInt32();
     Unknown15 = inStream.ReadInt32();
     Unknown16 = inStream.ReadInt32();
     Unknown17 = inStream.ReadInt32();
     Unknown18 = inStream.ReadInt32();
     Unknown19 = inStream.ReadInt32();
 }
Exemple #21
0
        public override void Unserialize(BinaryReader br, UInt32 mapVersion)
        {
            Location = Vector4.Read(br);
            Quaternion = Vector4.Read(br);

            if (((((mapVersion <= 50) ? 1 : 0) - 1) & 20) + 10 > 0)
            {
                var count = (UInt32)(((((mapVersion <= 50) ? 1 : 0) - 1) & 20) + 10);
                for (var i = 0U; i < count; ++i)
                    ItemsTypes.Add(ItemType.Read(br));
            }

            if (mapVersion >= 39)
            {
                StoreName = br.ReadLengthedString();
                MinLevel = br.ReadUInt32();
                MaxLevel = br.ReadUInt32();
            }

            if (mapVersion > 40)
                IsJunkyard = br.ReadBoolean();

            if (mapVersion >= 50)
                IsVehicleStore = br.ReadBoolean();

            if (mapVersion >= 61)
                IsSouvenirStore = br.ReadBoolean();
        }
Exemple #22
0
 public IEnumerable<Entry> Import()
 {
     using (var reader = new BinaryReader(File.OpenRead(filename)))
     {
         // 4
         Version = reader.ReadInt32();
         // 4
         Positions = reader.ReadInt32();
         foreach (var i in Enumerable.Range(0, Positions))
         {
             // 16
             var board = new Board(reader.ReadUInt64(), reader.ReadUInt64(), Color.Black);
             // 20
             var height = reader.ReadInt32();
             // 24
             var prune = reader.ReadInt32();
             // 25
             var wld = reader.ReadBoolean();
             // 26
             var knownSolve = reader.ReadBoolean();
             // 28
             var fillOut = reader.ReadInt16();
             // 30
             var cutoff = reader.ReadInt16();
             // 32
             var heuristic = reader.ReadInt16();
             // 34
             var black = reader.ReadInt16();
             // 36
             var white = reader.ReadInt16();
             // 37
             var set = reader.ReadBoolean();
             // 38
             var assigned = reader.ReadBoolean();
             // 39
             var wldSolved = reader.ReadBoolean();
             // 40
             var fill2 = reader.ReadByte();
             // 48
             var games = new int[] { reader.ReadInt32(), reader.ReadInt32() };
             // 49
             var root = reader.ReadBoolean();
             // 52
             var fill3 = reader.ReadBytes(3);
             yield return new Entry(board, height, heuristic, 72/*new BookData()
             {
                 Height = height,
                 Prune = prune,
                 WLD = wld,
                 KnownSolve = knownSolve,
                 Cutoff = cutoff,
                 HeuristicValue = heuristic,
                 BlackValue = black,
                 WhiteValue = white,
                 Games = games
             }*/);
         }
     }
 }
Exemple #23
0
 protected override void OnLoaded(BinaryReader r)
 {
     base.OnLoaded(r);
     _isInit = r.ReadBoolean();
     _running = r.ReadBoolean();
     if (_running)
         OnGameLoad(r);
 }
Exemple #24
0
 public override void StateLoad(BinaryReader reader)
 {
     irqReload = reader.ReadInt32();
     irqMode = reader.ReadBoolean();
     irqEnable = reader.ReadBoolean();
     irqAckEnable = reader.ReadBoolean();
     irqCounter = reader.ReadInt32();
 }
Exemple #25
0
        //===========================================================================
        //
        // Public Functions
        //
        //===========================================================================
        //
        // Load(string name, ref NSSKeylogger.ProfileData profile)
        // Attempts to load a profile from a file into a ProfileData structure
        //
        public Boolean Load(string name, ref NSSKeyloggerForm.ProfileData profile)
        {
            Boolean success = false;
            BinaryReader b = null;
            try
            {
                //Open the file
                b = new BinaryReader(File.Open(currentDirectory + "\\" + name + ".nss", FileMode.Open));

                //Check the header
                if (b.ReadString() != "NSS Keylogger Profile")
                {
                    success = false; //header was invalid
                    throw new Exception("File is not a NSS Keylogger profile!");
                }

                //Load the KEYCOMBO structures
                if (!LoadKEYCOMBO(b, ref profile.ActivationKey))
                {
                    success = false;
                    throw new Exception("ActivationKey could not be loaded!");
                }
                if (!LoadKEYCOMBO(b, ref profile.DeactivationKey))
                {
                    success = false;
                    throw new Exception("DeactivationKey could not be loaded!");
                }
                if (!LoadKEYCOMBO(b, ref profile.SubtleModeKey))
                {
                    success = false;
                    throw new Exception("SubtleModeKey could not be loaded!");
                }

                //Load all other profile data
                profile.useDeactivationKey = b.ReadBoolean();
                profile.suppressHotkeys = b.ReadBoolean();
                profile.clearKeylogOnStartup = b.ReadBoolean();
                profile.useSubtleModeKey = b.ReadBoolean();
                profile.startupSubtleMode = b.ReadBoolean();
                profile.subtleMode = b.ReadBoolean();
                profile.keylogSaveLocation = b.ReadString();

                success = true;
            }
            catch
            { //something went wrong
                success = false;
            }
            finally
            {
                if (b != null)
                {
                    b.Close(); //all done with the file
                    b.Dispose();
                }
            }
            return success;
        }
Exemple #26
0
 public override void StateLoad(BinaryReader reader)
 {
     latch0 = reader.ReadBoolean();
     latch1 = reader.ReadBoolean();
     fd0 = reader.ReadInt32();
     fe0 = reader.ReadInt32();
     fd1 = reader.ReadInt32();
     fe1 = reader.ReadInt32();
 }
 private void Read(BinaryReader reader) {
     fromId = reader.ReadInt32();
     toId = reader.ReadInt32();
     date = reader.ReadInt32();
     output = reader.ReadBoolean();
     unread = reader.ReadBoolean();
     message = TL.Parse<DecryptedMessage>(reader);
     file = TL.Parse<EncryptedFile>(reader);
 }
Exemple #28
0
 public Buff(BinaryReader reader)
 {
     Type = (BuffType)reader.ReadByte();
     Caster = null;
     Visible = reader.ReadBoolean();
     ObjectID = reader.ReadUInt32();
     ExpireTime = reader.ReadInt64();
     Value = reader.ReadInt32();
     Infinite = reader.ReadBoolean();
 }
 public void SetDataFrom(BinaryReader reader)
 {
     CorrelationId = new Guid(reader.ReadString());
     ProcessId = reader.ReadInt32();
     Port = reader.ReadInt32();
     NUnitTestRunner = reader.ReadString();
     MsTestRunner = reader.ReadString();
     LoggingEnabled = reader.ReadBoolean();
     StartedPaused = reader.ReadBoolean();
 }
 public void Deserialize(BinaryReader reader)
 {
     Type = reader.ReadInt32();
     Target = reader.ReadInt16();
     Interaction = reader.ReadByte();
     SetParam = reader.ReadBoolean();
     StackObject = reader.ReadInt16();
     Caller = reader.ReadInt16();
     IsTree = reader.ReadBoolean();
 }
 public void Read(BinaryReader reader)
 {
     NumberOfPeels = reader.ReadInt32();
     PerformedFirstPeel = reader.ReadBoolean();
     AvgTimeBetweenPeels = reader.ReadInt32();
     NumberOfDumps = reader.ReadInt32();
     AvgTimeBetweenDumps = reader.ReadInt32();
     IsWinner = reader.ReadBoolean();
     RawGameData = reader.ReadList<GameMoveDataPoint>();
 }
Exemple #32
0
        public Material(System.IO.BinaryReader br)
        {
            m_ambientColor = new Vec4(br);
            m_diffuseColor = new Vec4(br);
            m_name         = br.ReadString();
            bool isOpacityMapNull = br.ReadBoolean();

            if (isOpacityMapNull)
            {
                this.m_opacityMap = null;
            }
            else
            {
                this.m_opacityMap = MaterialMap.Load(br);
            }

            this.m_shininess     = (float)br.ReadDouble();
            this.m_specularColor = new Vec4(br);
            int count = br.ReadInt32();

            if (count > 0)
            {
                for (int i = 0; i < count; ++i)
                {
                    AddMaterialMap(MaterialMap.Load(br));
                }
            }

            this.Transparency = (float)br.ReadDouble();
            this.m_twoSided   = br.ReadBoolean();
            this.m_scale      = (float)br.ReadDouble();
            if (this.m_scale != 1)
            {
                this.hasTexTransform = true;
            }
            if (br.ReadBoolean())
            {
                remapUV    = new Vec2[2];
                remapUV[0] = Vec2.Load(br);
                remapUV[1] = Vec2.Load(br);
            }
            else
            {
                remapUV = null;
            }
            if (br.PeekChar() == '~')
            {
                br.ReadChar();
                count = br.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    AddShader(Shader.Load(br));
                }
            }
        }
Exemple #33
0
 /// <summary>
 /// Load board state
 /// </summary>
 /// <param name="stream">The stream that should be used to read data</param>
 public virtual void LoadState(System.IO.BinaryReader stream)
 {
     // Read prg ram
     for (int i = 0; i < prg_banks.Length; i++)
     {
         if (prg_isram[i])
         {
             stream.Read(prg_banks[i], 0, prg_banks[i].Length);
         }
     }
     // Write prg indexes, enable ...etc
     for (int i = 0; i < prg_indexes.Length; i++)
     {
         prg_indexes[i] = stream.ReadInt32();
     }
     for (int i = 0; i < prg_enable.Length; i++)
     {
         prg_enable[i] = stream.ReadBoolean();
     }
     for (int i = 0; i < prg_writable.Length; i++)
     {
         prg_writable[i] = stream.ReadBoolean();
     }
     // Write chr ram
     for (int i = 0; i < chr_banks.Length; i++)
     {
         if (chr_isram[i])
         {
             stream.Read(chr_banks[i], 0, chr_banks[i].Length);
         }
     }
     // Write chr indexes, enable ...etc
     for (int i = 0; i < chr_indexes.Length; i++)
     {
         chr_indexes[i] = stream.ReadInt32();
     }
     for (int i = 0; i < chr_enable.Length; i++)
     {
         chr_enable[i] = stream.ReadBoolean();
     }
     for (int i = 0; i < chr_writable.Length; i++)
     {
         chr_writable[i] = stream.ReadBoolean();
     }
     // Write nmt
     for (int i = 0; i < nmt_banks.Length; i++)
     {
         stream.Read(nmt_banks[i], 0, nmt_banks[i].Length);
     }
     // Write chr indexes, enable ...etc
     for (int i = 0; i < nmt_indexes.Length; i++)
     {
         nmt_indexes[i] = stream.ReadInt32();
     }
 }
Exemple #34
0
        public override void Read(BinaryReader br, List<RvDat> parentDirDats)
        {
            base.Read(br, parentDirDats);
            bool foundTree = br.ReadBoolean();
            if (foundTree)
            {
                Tree = new RvTreeRow();
                Tree.Read(br);
            }
            else
                Tree = null;

            bool foundGame = br.ReadBoolean();
            if (foundGame)
            {
                Game = new RvGame();
                Game.Read(br);
            }
            else
                Game = null;

            int count = br.ReadInt32();
            _dirDats.Clear();
            for (int i = 0; i < count; i++)
            {
                RvDat dat = new RvDat { DatIndex = i };
                dat.Read(br);
                _dirDats.Add(dat);

                string datname = TreeFullName + @"\" + dat.GetData(RvDat.DatData.DatName);
                if (datname.Length >= 9 && datname.Substring(0, 9) == @"RomVault\")
                    datname = datname.Substring(9);

                DB.Bgw.ReportProgress(0, new bgwText("Loading: " + datname));
                DB.Bgw.ReportProgress((int)br.BaseStream.Position);

            }
            if (_dirDats.Count > 0)
                parentDirDats = _dirDats;

            count = br.ReadInt32();
            _children.Clear();
            for (int i = 0; i < count; i++)
            {
                RvBase tChild = DBTypeGet.GetRvType((FileType)br.ReadByte());

                tChild.Parent = this;
                tChild.Read(br, parentDirDats);
                _children.Add(tChild);
            }

            if (DBTypeGet.isCompressedDir(FileType))
                ZipStatus = (ZipStatus)br.ReadByte();

        }
 public static AnimationEntry Parse(byte version, BinaryReader br)
 {
     return new AnimationEntry
     {
         Mode = (AnimationMode)br.ReadByte(),
         EaseIn = br.ReadBoolean(),
         EaseOut = br.ReadBoolean(),
         IterationDuration = br.ReadInt32(),
         Frames = new LinkedList<AnimationFrame>(Enumerable.Range(0, br.ReadInt32()).Select(_ => AnimationFrame.Parse(version, br))),
     };
 }
 public void Load(string fileName)
 {
     using (var reader = new System.IO.BinaryReader(
                new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)))
     {
         int fileCount = reader.ReadInt32();
         for (int fileIndex = 0; fileIndex < fileCount; fileIndex++)
         {
             var dataFile = new MyResourceDataFile();
             dataFile.FileName = reader.ReadString();
             dataFile.Name     = reader.ReadString();
             var bsLength = reader.ReadInt32();
             if (bsLength > 0)
             {
                 dataFile.Datas = reader.ReadBytes(bsLength);
             }
             var itemCount = reader.ReadInt32();
             for (int iCount = 0; iCount < itemCount; iCount++)
             {
                 var newItem = new MyResourceDataFile.MyResourceDataItem();
                 newItem.Name       = reader.ReadString();
                 newItem.StartIndex = reader.ReadInt32();
                 newItem.BsLength   = reader.ReadInt32();
                 newItem.Key        = reader.ReadInt32();
                 newItem.IsBmp      = reader.ReadBoolean();
                 dataFile.Items.Add(newItem);
             }
             this.Add(dataFile);
         }
     }
 }
 private void DeserializeCallback(System.IO.BinaryReader reader, StatusInstance <TestObj> instance, TestObj obj)
 {
     Assert.AreEqual("hello", reader.ReadString());
     Assert.AreEqual(true, reader.ReadBoolean());
     if (instance.GetStatus <TestStatus>() == TestStatus.A)
     {
         deserializedInstanceA = instance;
     }
 }
        public void LoadStateBinary(System.IO.BinaryReader reader)
        {
            int length = reader.ReadInt32();

            byte[] data = reader.ReadBytes(length);
            LoadCoreBinary(data);
            // other variables
            IsLagFrame = reader.ReadBoolean();
            LagCount   = reader.ReadInt32();
            Frame      = reader.ReadInt32();
        }
Exemple #39
0
 public void Load(System.IO.BinaryReader _br)
 {
     IsFilter        = _br.ReadBoolean();
     CurrentType     = _br.ReadInt32();
     CurrentSubType  = _br.ReadInt32();
     Order           = _br.ReadInt32();
     CutoffFrequency = _br.ReadDouble();
     WidthFrequency  = _br.ReadDouble();
     CenterFrequency = _br.ReadDouble();
     RippleDb        = _br.ReadDouble();
     Rolloff         = _br.ReadDouble();
 }
Exemple #40
0
        public static JSONNode Deserialize(System.IO.BinaryReader aReader)
        {
            JSONBinaryTag type = (JSONBinaryTag)aReader.ReadByte();
            switch (type)
            {
                case JSONBinaryTag.Array:
                    {
                        int count = aReader.ReadInt32();
                        JSONArray tmp = new JSONArray();
                        for (int i = 0; i < count; i++)
                            tmp.Add(Deserialize(aReader));
                        return tmp;
                    }
                case JSONBinaryTag.Class:
                    {
                        int count = aReader.ReadInt32();
                        JSONClass tmp = new JSONClass();
                        for (int i = 0; i < count; i++)
                        {
                            string key = aReader.ReadString();
                            var val = Deserialize(aReader);
                            tmp.Add(key, val);
                        }
                        return tmp;
                    }
                case JSONBinaryTag.Value:
                    {
                        return new JSONData(aReader.ReadString());
                    }
                case JSONBinaryTag.IntValue:
                    {
                        return new JSONData(aReader.ReadInt32());
                    }
                case JSONBinaryTag.DoubleValue:
                    {
                        return new JSONData(aReader.ReadDouble());
                    }
                case JSONBinaryTag.BoolValue:
                    {
                        return new JSONData(aReader.ReadBoolean());
                    }
                case JSONBinaryTag.FloatValue:
                    {
                        return new JSONData(aReader.ReadSingle());
                    }

                default:
                    {
                        throw new Exception("Error deserializing JSON. Unknown tag: " + type);
                    }
            }
        }
Exemple #41
0
        static public string ReadNullableString(System.IO.BinaryReader r)
        {
            bool isNull = r.ReadBoolean();

            if (isNull)
            {
                return(null);
            }
            else
            {
                return(r.ReadString());
            }
        }
Exemple #42
0
        public static VVIP FromStream(System.IO.BinaryReader br)
        {
            VVIP obj = new VVIP();

            obj.chainx = br.ReadDouble();
            obj.chainy = br.ReadDouble();
            obj.sym    = br.ReadBoolean();
            obj.grade  = br.ReadDouble();
            obj.vcl1   = br.ReadDouble();
            obj.vcl2   = br.ReadDouble();

            return(obj);
        }
Exemple #43
0
        public int Load(byte[] data)
        {
            try
            {
                System.IO.MemoryStream ms = null;
                System.IO.BinaryReader br = null;
                ms = new System.IO.MemoryStream(@data, 0, @data.Length);
                br = new System.IO.BinaryReader(ms);

                Magic        = br.ReadInt16();
                m_Compressed = br.ReadBoolean();
                Version      = br.ReadByte();

                int palcnt = br.ReadInt16();
                int rgbcnt = br.ReadInt16();

                m_PaletteImage = new PaletteImage[palcnt];
                for (int i = 1; i <= palcnt; i++)
                {
                    PaletteImage palImage = new PaletteImage(br, m_Compressed);
                    m_PaletteImage[i - 1] = palImage;
                }

                m_RGBImage = new RGBImage[rgbcnt];
                for (int i = 1; i <= rgbcnt; i++)
                {
                    RGBImage rgbImage = new RGBImage(br);
                    m_RGBImage[i - 1] = rgbImage;
                }

                for (int i = 0; i <= 255; i++)
                {
                    byte red   = br.ReadByte();
                    byte green = br.ReadByte();
                    byte blue  = br.ReadByte();
                    byte res   = br.ReadByte();
                    Palette[i] = System.Drawing.Color.FromArgb(red, green, blue);
                }

                OriginalPalette = Palette;

                br.Close();
                ms.Close();
                ms.Dispose();
                return(0);
            }
            catch (Exception ex)
            {
                return(-2);
            }
        }
        public void LoadStateBinary(System.IO.BinaryReader reader)
        {
            int newlen = reader.ReadInt32();

            if (newlen > savebuff.Length)
            {
                throw new Exception("Unexpected buffer size");
            }
            reader.Read(savebuff, 0, newlen);
            api.CMD_Unserialize(savebuff);
            // other variables
            Frame      = reader.ReadInt32();
            LagCount   = reader.ReadInt32();
            IsLagFrame = reader.ReadBoolean();
        }
        public void LoadStateBinary(System.IO.BinaryReader reader)
        {
            CheckDisposed();
            int len = reader.ReadInt32();

            if (len != SaveStateBuff.Length)
            {
                throw new InvalidOperationException("Unexpected savestate buffer length!");
            }
            reader.Read(SaveStateBuff, 0, SaveStateBuff.Length);
            LibQuickNES.ThrowStringError(QN.qn_state_load(Context, SaveStateBuff, SaveStateBuff.Length));
            // other variables
            IsLagFrame = reader.ReadBoolean();
            LagCount   = reader.ReadInt32();
            Frame      = reader.ReadInt32();
        }
Exemple #46
0
        public void Load(System.IO.BinaryReader reader)
        {
            version = reader.ReadByte();
            if (version > VERSION)
            {
                throw new CacheException("Unknown CacheItem Version.", null, version);
            }

            modelname        = reader.ReadString();
            family           = reader.ReadString();
            def              = reader.ReadBoolean();
            pfd              = new Packages.PackedFileDescriptor();
            pfd.Type         = reader.ReadUInt32();
            pfd.Group        = reader.ReadUInt32();
            pfd.LongInstance = reader.ReadUInt64();
        }
Exemple #47
0
        public void LoadStateBinary(System.IO.BinaryReader reader)
        {
            int newlen = reader.ReadInt32();

            if (newlen != savebuff.Length)
            {
                throw new Exception("Unexpected state size");
            }
            reader.Read(savebuff, 0, savebuff.Length);
            if (!LibGPGX.gpgx_state_load(savebuff, savebuff.Length))
            {
                throw new Exception("gpgx_state_load() returned false");
            }
            // other variables
            Frame      = reader.ReadInt32();
            LagCount   = reader.ReadInt32();
            IsLagFrame = reader.ReadBoolean();
            update_video();
        }
Exemple #48
0
        public void Load(System.IO.BinaryReader reader)
        {
            states.Clear();
            version = reader.ReadByte();
            if (version > VERSION)
            {
                throw new CacheException("Unknown CacheItem Version.", null, version);
            }

            name    = reader.ReadString();
            type    = (PackageType)reader.ReadUInt32();
            enabled = reader.ReadBoolean();
            int ct = reader.ReadByte();

            guids = new uint[ct];
            for (int i = 0; i < guids.Length; i++)
            {
                guids[i] = reader.ReadUInt32();
            }

            ct = reader.ReadByte();
            for (int i = 0; i < ct; i++)
            {
                PackageState ps = new PackageState();
                ps.Load(reader);
                states.Add(ps);
            }

            int size = reader.ReadInt32();

            if (size == 0)
            {
                thumb = null;
            }
            else
            {
                byte[]       data = reader.ReadBytes(size);
                MemoryStream ms   = new MemoryStream(data);

                thumb = Image.FromStream(ms);
            }
        }
Exemple #49
0
        VariableReference ReadVariableReference(System.IO.BinaryReader br)
        {
            VariableReference res = null;

            if (br.ReadBoolean())
            {
                res         = new Debugger.VariableReference();
                res.Address = br.ReadInt64();
                res.Type    = (VariableTypes)br.ReadByte();
                res.Offset  = br.ReadInt32();
                res.Name    = br.ReadString();
                res.Parent  = ReadVariableReference(br);
                int cnt = br.ReadInt32();
                res.Parameters = new VariableReference[cnt];
                for (int i = 0; i < cnt; i++)
                {
                    res.Parameters[i] = ReadVariableReference(br);
                }
            }
            return(res);
        }
Exemple #50
0
        public void LoadStateBinary(System.IO.BinaryReader reader)
        {
            int length = reader.ReadInt32();

            if (length != savebuff.Length)
            {
                throw new InvalidOperationException("Savestate buffer size mismatch!");
            }

            reader.Read(savebuff, 0, savebuff.Length);

            if (!LibGambatte.gambatte_newstateload(GambatteState, savebuff, savebuff.Length))
            {
                throw new Exception("gambatte_newstateload() returned false");
            }

            // other variables
            IsLagFrame    = reader.ReadBoolean();
            LagCount      = reader.ReadInt32();
            Frame         = reader.ReadInt32();
            frameOverflow = reader.ReadUInt32();
            _cycleCount   = reader.ReadUInt64();
        }
Exemple #51
0
        public void LoadStateBinary(System.IO.BinaryReader reader)
        {
            int newlen = reader.ReadInt32();

            if (newlen > savebuff.Length)
            {
                throw new Exception("Unexpected buffer size");
            }
            reader.Read(savebuff, 0, newlen);
            if (savebuff.Length > 0)
            {
                fixed(byte *ptr = &savebuff[0])
                {
                    if (!retro.retro_unserialize((IntPtr)ptr, (uint)newlen))
                    {
                        throw new Exception("retro_unserialize() failed");
                    }
                }
            }
            // other variables
            Frame      = reader.ReadInt32();
            LagCount   = reader.ReadInt32();
            IsLagFrame = reader.ReadBoolean();
        }
        public static IEnumerable <MemoryBitmap> ReadRaw(System.IO.BinaryReader reader)
        {
            var hdr = reader.ReadBytes(_SpanBitmapHeader.Length);

            if (!hdr.SequenceEqual(_SpanBitmapHeader))
            {
                throw new System.IO.IOException("invalid header");
            }

            var version = reader.ReadInt32();

            if (version != 0)
            {
                throw new System.IO.IOException("invalid version");
            }

            var endianness = reader.ReadBoolean();

            if (endianness != BitConverter.IsLittleEndian)
            {
                throw new System.IO.IOException("invalid endianness");
            }

            int planeCount = reader.ReadInt32();

            for (int i = 0; i < planeCount; i++)
            {
                var info = BitmapInfo.Read(reader);

                var dataLen = reader.ReadInt32();
                var dataCmp = reader.ReadInt32();
                var data    = _ReadFromStream(reader.BaseStream, dataLen, dataCmp);

                yield return(new MemoryBitmap(data, info));
            }
        }
Exemple #53
0
        /// <summary>
        /// Loads a database schema
        /// </summary>
        /// <param name="reader">binary reader</param>
        /// <returns></returns>
        public static DbSchemaConfig Load(io.BinaryReader reader)
        {
            var schema = new DbSchemaConfig()
            {
                Flags       = (DbSchemaConfigType)reader.ReadUInt32(),
                Version     = reader.BinaryRead(),
                Description = reader.BinaryRead(),
                Name        = reader.BinaryRead(),

                PageSize = reader.ReadInt32(),
                _tables  = new Dictionary <string, DbTable>()
                           //Tables = new List<DbTable>()
            };

            //tables
            var pageCount = reader.ReadInt32();

            for (var t = 0; t < pageCount; t++)
            {
                var table = new DbTable()
                {
                    Name          = reader.BinaryRead(),
                    FileName      = reader.BinaryRead(),
                    Generate      = reader.ReadBoolean(),
                    Multikey      = reader.ReadBoolean(),
                    Rows          = reader.ReadInt32(),
                    RowMask       = reader.ReadUInt64(),
                    RowMaskLength = reader.ReadInt32(),
                    Pager         = DbTablePager.Load(reader),
                    Count         = reader.ReadInt32(),
                    _columns      = new Dictionary <string, DbColumn>()
                };
                //read columns
                var columnNameList = new List <string>();

                for (var c = 0; c < table.Count; c++)
                {
                    var col = new DbColumn()
                    {
                        Indexer = reader.BinaryRead(),
                        Unique  = reader.ReadBoolean(),
                        Name    = reader.BinaryRead(),
                        Index   = reader.ReadInt32(),
                        Type    = reader.BinaryRead(),
                        Key     = reader.ReadBoolean(),
                        Indexed = reader.ReadBoolean(),
                        //
                        NodePages = reader.ReadInt32(),
                        ItemPages = reader.ReadInt32()
                    };
                    if (!table.Add(col))
                    {
                        throw new ArgumentException($"duplicated column: {col.Name} on table {table.Name}");
                    }
                    columnNameList.Add(col.Name);
                }

                //check count
                if (table.Count != table.Columns.Count())
                {
                    throw new ArgumentException($"invalid table count on: {table.Name}");
                }
                table._columnNameList = columnNameList.ToArray();

                //get key
                table.Keys = table.Columns.Where(c => c.Key).ToArray();

                var keyCount = table.Keys.Length;
                if (table.Multikey)
                {
                    //must have more than one key
                    table.Key = null;
                    if (keyCount < 2)
                    {
                        throw new ArgumentException($"table: {table} is multi-key and has less than 2 keys");
                    }
                }
                else
                {
                    //must have just one key
                    if (keyCount != 1)
                    {
                        throw new ArgumentException($"table: {table} must have one key");
                    }
                    table.Key = table.Keys[0];
                }
                //schema.Tables.Add(table);
                schema._tables.Add(table.Name, table);
            }
            return(schema);
        }
Exemple #54
0
        void OnReceive(DebugMessageType type, byte[] buffer)
        {
            if (clientSocket == null || clientSocket.Disconnected)
            {
                return;
            }
            System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer);
            System.IO.BinaryReader br = new System.IO.BinaryReader(ms);

            switch (type)
            {
            case DebugMessageType.CSAttach:
            {
                SendAttachResult();
            }
            break;

            case DebugMessageType.CSBindBreakpoint:
            {
                CSBindBreakpoint msg = new Protocol.CSBindBreakpoint();
                msg.BreakpointHashCode = br.ReadInt32();
                msg.IsLambda           = br.ReadBoolean();
                msg.NamespaceName      = br.ReadString();
                var typeName = br.ReadString();
                msg.TypeName        = String.IsNullOrWhiteSpace(msg.NamespaceName) ? typeName : msg.NamespaceName + "." + typeName;
                msg.MethodName      = br.ReadString();
                msg.StartLine       = br.ReadInt32();
                msg.EndLine         = br.ReadInt32();
                msg.Enabled         = br.ReadBoolean();
                msg.Condition       = new BreakpointCondition();
                msg.Condition.Style = (BreakpointConditionStyle)br.ReadByte();
                if (msg.Condition.Style != BreakpointConditionStyle.None)
                {
                    msg.Condition.Expression = br.ReadString();
                }
                msg.UsingInfos    = new UsingInfo[br.ReadInt32() + 1];
                msg.UsingInfos[0] = new UsingInfo()
                {
                    Alias = null, Name = msg.NamespaceName
                };                                                                                      //当前命名空间具有最高优先级
                for (int i = 1; i < msg.UsingInfos.Length; i++)
                {
                    msg.UsingInfos[i] = new UsingInfo()
                    {
                        Alias = br.ReadString(), Name = br.ReadString()
                    };
                }
                TryBindBreakpoint(msg);
            }
            break;

            case DebugMessageType.CSSetBreakpointEnabled:
            {
                ds.SetBreakpointEnabled(br.ReadInt32(), br.ReadBoolean());
            }
            break;

            case DebugMessageType.CSSetBreakpointCondition:
            {
                int bpHash = br.ReadInt32();
                BreakpointConditionStyle style = (BreakpointConditionStyle)br.ReadByte();
                string expression = style != BreakpointConditionStyle.None ? br.ReadString() : null;
                ds.SetBreakpointCondition(bpHash, style, expression);
            }
            break;

            case DebugMessageType.CSDeleteBreakpoint:
            {
                CSDeleteBreakpoint msg = new Protocol.CSDeleteBreakpoint();
                msg.BreakpointHashCode = br.ReadInt32();
                ds.DeleteBreakpoint(msg.BreakpointHashCode);
            }
            break;

            case DebugMessageType.CSExecute:
            {
                CSExecute msg = new Protocol.CSExecute();
                msg.ThreadHashCode = br.ReadInt32();
                ds.ExecuteThread(msg.ThreadHashCode);
            }
            break;

            case DebugMessageType.CSStep:
            {
                CSStep msg = new CSStep();
                msg.ThreadHashCode = br.ReadInt32();
                msg.StepType       = (StepTypes)br.ReadByte();
                ds.StepThread(msg.ThreadHashCode, msg.StepType);
            }
            break;

            case DebugMessageType.CSResolveVariable:
            {
                CSResolveVariable msg = new CSResolveVariable();
                msg.ThreadHashCode = br.ReadInt32();
                msg.FrameIndex     = br.ReadInt32();
                msg.Variable       = ReadVariableReference(br);
                VariableInfo info;
                try
                {
                    object res;
                    info = ds.ResolveVariable(msg.ThreadHashCode, msg.FrameIndex, msg.Variable, out res);
                }
                catch (Exception ex)
                {
                    info = VariableInfo.GetException(ex);
                }
                if (info.Type != VariableTypes.Pending)
                {
                    SendSCResolveVariableResult(info);
                }
            }
            break;

            case DebugMessageType.CSResolveIndexAccess:
            {
                CSResolveIndexer msg = new CSResolveIndexer();
                msg.ThreadHashCode = br.ReadInt32();
                msg.FrameIndex     = br.ReadInt32();
                msg.Body           = ReadVariableReference(br);
                msg.Index          = ReadVariableReference(br);

                VariableInfo info;
                try
                {
                    object res;
                    info = ds.ResolveIndexAccess(msg.ThreadHashCode, msg.FrameIndex, new VariableReference {
                            Parent = msg.Body, Parameters = new VariableReference[1] {
                                msg.Index
                            }
                        }, out res);
                }
                catch (Exception ex)
                {
                    info = VariableInfo.GetException(ex);
                }
                if (info.Type != VariableTypes.Pending)
                {
                    SendSCResolveVariableResult(info);
                }
            }
            break;

            case DebugMessageType.CSEnumChildren:
            {
                int thId    = br.ReadInt32();
                int frameId = br.ReadInt32();
                var parent  = ReadVariableReference(br);

                VariableInfo[] info = null;
                try
                {
                    info = ds.EnumChildren(thId, frameId, parent);
                }
                catch (Exception ex)
                {
                    info = new VariableInfo[] { VariableInfo.GetException(ex) };
                }
                if (info != null)
                {
                    SendSCEnumChildrenResult(info);
                }
            }
            break;
            }
        }
Exemple #55
0
        internal override void Read(System.IO.BinaryReader reader, BinaryReadInfo readInfo)
        {
            uint length = reader.ReadUInt32();

            ID = reader.ReadUInt32();
            uint numSections = reader.ReadUInt32();

            string componentName = null;
            bool   canResize     = false;
            bool   canFlip       = false;
            double minSize       = ComponentHelper.GridSize;
            List <ComponentProperty>          properties          = new List <ComponentProperty>();
            List <ConnectionGroup>            connections         = new List <ConnectionGroup>();
            List <RenderDescription>          renderDescriptions  = new List <RenderDescription>();
            List <Conditional <FlagOptions> > flagOptions         = new List <Conditional <FlagOptions> >();
            ComponentDescriptionMetadata      descriptionMetadata = new ComponentDescriptionMetadata();
            uint?iconResourceId = null;

            for (uint sectionCounter = 0; sectionCounter < numSections; sectionCounter++)
            {
                ushort sectionType   = reader.ReadUInt16();
                uint   sectionLength = reader.ReadUInt32();

                #region Metadata
                if (sectionType == (uint)BinaryConstants.ComponentSectionType.Metadata)
                {
                    componentName              = reader.ReadString();
                    canResize                  = reader.ReadBoolean();
                    canFlip                    = reader.ReadBoolean();
                    minSize                    = reader.ReadDouble();
                    descriptionMetadata.Type   = String.Format("Binary r{0} (*.cdcom)", readInfo.FormatVersion);
                    descriptionMetadata.GUID   = new Guid(reader.ReadBytes(16));
                    descriptionMetadata.Author = reader.ReadString();
                    if (readInfo.IsSignatureValid && readInfo.Certificate != null && readInfo.IsCertificateTrusted)
                    {
                        descriptionMetadata.Author = readInfo.Certificate.GetNameInfo(X509NameType.EmailName, false);
                    }
                    descriptionMetadata.Version = new Version(reader.ReadUInt16(), reader.ReadUInt16());
                    descriptionMetadata.AdditionalInformation          = reader.ReadString();
                    descriptionMetadata.ImplementSet                   = reader.ReadString();
                    descriptionMetadata.ImplementItem                  = reader.ReadString();
                    descriptionMetadata.Signature.IsHashValid          = readInfo.IsSignatureValid;
                    descriptionMetadata.Signature.Certificate          = readInfo.Certificate;
                    descriptionMetadata.Signature.IsCertificateTrusted = readInfo.IsCertificateTrusted;
                    int iconResource = reader.ReadInt32();
                    if (iconResource != -1)
                    {
                        iconResourceId = (uint)iconResource;
                    }
                    long created = reader.ReadInt64();
                }
                #endregion
                #region Flags
                else if (sectionType == (uint)BinaryConstants.ComponentSectionType.Flags)
                {
                    uint numFlagGroups = reader.ReadUInt32();
                    for (uint j = 0; j < numFlagGroups; j++)
                    {
                        IConditionTreeItem conditions;
                        if (readInfo.FormatVersion > 1)
                        {
                            conditions = reader.ReadConditionTree();
                        }
                        else
                        {
                            conditions = reader.ReadConditionCollection();
                        }

                        FlagOptions value = (FlagOptions)reader.ReadUInt32();
                        flagOptions.Add(new Conditional <FlagOptions>(value, conditions));
                    }
                }
                #endregion
                #region Properties
                else if (sectionType == (uint)BinaryConstants.ComponentSectionType.Properties)
                {
                    uint numProperties = reader.ReadUInt32();
                    for (uint j = 0; j < numProperties; j++)
                    {
                        string        propertyName   = reader.ReadString();
                        string        serializedName = reader.ReadString();
                        string        displayName    = reader.ReadString();
                        BinaryType    propType;
                        object        rawDefaultValue = reader.ReadType(out propType);
                        PropertyUnion defaultValue    = propType.ToPropertyUnion(rawDefaultValue);
                        string[]      enumOptions     = null;
                        if (propType == BinaryType.Enum)
                        {
                            enumOptions = new string[reader.ReadInt32()];
                            for (int k = 0; k < enumOptions.Length; k++)
                            {
                                enumOptions[k] = reader.ReadString();
                            }
                        }

                        // Format rules
                        List <ComponentPropertyFormat> formatRules = new List <ComponentPropertyFormat>();
                        uint numFormatRules = reader.ReadUInt32();
                        for (uint k = 0; k < numFormatRules; k++)
                        {
                            IConditionTreeItem conditions;
                            if (readInfo.FormatVersion > 1)
                            {
                                conditions = reader.ReadConditionTree();
                            }
                            else
                            {
                                conditions = reader.ReadConditionCollection();
                            }
                            string formatRule = reader.ReadString();
                            formatRules.Add(new ComponentPropertyFormat(formatRule, conditions));
                        }

                        // Other conditions
                        uint numOtherConditions = reader.ReadUInt32();
                        Dictionary <PropertyOtherConditionType, IConditionTreeItem> otherConditions = new Dictionary <PropertyOtherConditionType, IConditionTreeItem>((int)numOtherConditions);
                        for (uint k = 0; k < numOtherConditions; k++)
                        {
                            uint uintConditionType = reader.ReadUInt32();
                            IConditionTreeItem conditions;
                            if (readInfo.FormatVersion > 1)
                            {
                                conditions = reader.ReadConditionTree();
                            }
                            else
                            {
                                conditions = reader.ReadConditionCollection();
                            }
                            PropertyOtherConditionType conditionType = (PropertyOtherConditionType)uintConditionType;
                            otherConditions.Add(conditionType, conditions);
                        }

                        properties.Add(new ComponentProperty(propertyName, serializedName, displayName, BinaryIOExtentions.BinaryTypeToPropertyType(propType), defaultValue, formatRules.ToArray(), otherConditions, enumOptions));
                    }
                }
                #endregion
                #region Configurations
                else if (sectionType == (uint)BinaryConstants.ComponentSectionType.Configurations)
                {
                    uint numConfigurations = reader.ReadUInt32();
                    for (int j = 0; j < numConfigurations; j++)
                    {
                        string configurationName  = reader.ReadString();
                        string implementationName = reader.ReadString();

                        int numSetters = reader.ReadInt32();
                        var setters    = new Dictionary <string, PropertyUnion>(numSetters);
                        for (int k = 0; k < numSetters; k++)
                        {
                            BinaryType tempType;
                            string     name        = reader.ReadString();
                            var        setterValue = reader.ReadType(out tempType);
                            setters.Add(name, tempType.ToPropertyUnion(setterValue));
                        }

                        int iconID = reader.ReadInt32();

                        var configuration = new ComponentConfiguration(implementationName, configurationName, setters);
                        descriptionMetadata.Configurations.Add(configuration);

                        if (iconID != -1)
                        {
                            iconResources.Add(configuration, (uint)iconID);
                        }
                    }
                }
                #endregion
                #region Connections
                else if (sectionType == (uint)BinaryConstants.ComponentSectionType.Connections)
                {
                    uint numConnectionGroups = reader.ReadUInt32();
                    List <ConnectionGroup> connectionGroups = new List <ConnectionGroup>();
                    for (int j = 0; j < numConnectionGroups; j++)
                    {
                        IConditionTreeItem conditions;
                        if (readInfo.FormatVersion > 1)
                        {
                            conditions = reader.ReadConditionTree();
                        }
                        else
                        {
                            conditions = reader.ReadConditionCollection();
                        }

                        List <ConnectionDescription> tConnections = new List <ConnectionDescription>();
                        uint numConnections = reader.ReadUInt32();
                        for (uint k = 0; k < numConnections; k++)
                        {
                            tConnections.Add(new ConnectionDescription(reader.ReadComponentPoint(), reader.ReadComponentPoint(), (ConnectionEdge)reader.ReadInt32(), reader.ReadString()));
                        }

                        connections.Add(new ConnectionGroup(conditions, tConnections.ToArray()));
                    }
                }
                #endregion
                #region Render
                else if (sectionType == (uint)BinaryConstants.ComponentSectionType.Render)
                {
                    uint numRenderGroups = reader.ReadUInt32();
                    for (uint j = 0; j < numRenderGroups; j++)
                    {
                        IConditionTreeItem conditions;
                        if (readInfo.FormatVersion > 1)
                        {
                            conditions = reader.ReadConditionTree();
                        }
                        else
                        {
                            conditions = reader.ReadConditionCollection();
                        }

                        int numRenderCommands = (int)reader.ReadUInt32();
                        List <IRenderCommand> renderCommands = new List <IRenderCommand>(numRenderCommands);
                        for (int k = 0; k < numRenderCommands; k++)
                        {
                            RenderCommandType commandType = (RenderCommandType)reader.ReadUInt32();
                            switch (commandType)
                            {
                            case RenderCommandType.Line:
                            {
                                ComponentPoint start     = reader.ReadComponentPoint();
                                ComponentPoint end       = reader.ReadComponentPoint();
                                double         thickness = reader.ReadDouble();
                                renderCommands.Add(new Line(start, end, thickness));
                            }
                                continue;

                            case RenderCommandType.Rect:
                            {
                                ComponentPoint location  = reader.ReadComponentPoint();
                                double         width     = reader.ReadDouble();
                                double         height    = reader.ReadDouble();
                                double         thickness = reader.ReadDouble();
                                bool           fill      = (reader.ReadUInt32() == 0 ? false : true);
                                renderCommands.Add(new Rectangle(location, width, height, thickness, fill));
                            }
                                continue;

                            case RenderCommandType.Ellipse:
                            {
                                ComponentPoint centre    = reader.ReadComponentPoint();
                                double         radiusX   = reader.ReadDouble();
                                double         radiusY   = reader.ReadDouble();
                                double         thickness = reader.ReadDouble();
                                bool           fill      = (reader.ReadUInt32() == 0 ? false : true);
                                renderCommands.Add(new Ellipse(centre, radiusX, radiusY, thickness, fill));
                            }
                                continue;

                            case RenderCommandType.Path:
                            {
                                ComponentPoint start     = reader.ReadComponentPoint();
                                double         thickness = reader.ReadDouble();
                                bool           fill      = (reader.ReadUInt32() == 0 ? false : true);

                                int numCommands = reader.ReadInt32();
                                List <IPathCommand> pathCommands = new List <IPathCommand>(numCommands);
                                for (int l = 0; l < numCommands; l++)
                                {
                                    CommandType  pType      = (CommandType)reader.ReadInt32();
                                    IPathCommand theCommand = null;
                                    switch (pType)
                                    {
                                    case CommandType.MoveTo:
                                        theCommand = new MoveTo();
                                        break;

                                    case CommandType.LineTo:
                                        theCommand = new LineTo();
                                        break;

                                    case CommandType.CurveTo:
                                        theCommand = new CurveTo();
                                        break;

                                    case CommandType.EllipticalArcTo:
                                        theCommand = new EllipticalArcTo();
                                        break;

                                    case CommandType.QuadraticBeizerCurveTo:
                                        theCommand = new QuadraticBeizerCurveTo();
                                        break;

                                    case CommandType.SmoothCurveTo:
                                        theCommand = new SmoothCurveTo();
                                        break;

                                    case CommandType.SmoothQuadraticBeizerCurveTo:
                                        theCommand = new SmoothQuadraticBeizerCurveTo();
                                        break;

                                    default:
                                        theCommand = new ClosePath();
                                        break;
                                    }
                                    theCommand.Read(reader);
                                    pathCommands.Add(theCommand);
                                }

                                renderCommands.Add(new RenderPath(start, thickness, fill, pathCommands));
                            }
                                continue;

                            case RenderCommandType.Text:
                            {
                                byte           formattedTextVersion = reader.ReadByte();
                                ComponentPoint location             = reader.ReadComponentPoint();
                                TextAlignment  alignment            = (TextAlignment)reader.ReadUInt32();

                                uint           numTextRuns = reader.ReadUInt32();
                                List <TextRun> textRuns    = new List <TextRun>((int)numTextRuns);
                                for (uint l = 0; l < numTextRuns; l++)
                                {
                                    TextRunFormattingType formattingType = (TextRunFormattingType)reader.ReadUInt32();
                                    double runSize = reader.ReadDouble();
                                    string runText = reader.ReadString();
                                    textRuns.Add(new TextRun(runText, new TextRunFormatting(formattingType, runSize)));
                                }

                                renderCommands.Add(new Text(location, alignment, textRuns));
                            }
                                continue;
                            }
                        }

                        renderDescriptions.Add(new RenderDescription(conditions, renderCommands.ToArray()));
                    }
                }
                #endregion
                #region Skip
                else
                {
                    // Unknown type - skip
                    reader.BaseStream.Seek(sectionLength, SeekOrigin.Current);
                }
                #endregion
            }

            ComponentDescription = new ComponentDescription(ID.ToString(), componentName, canResize, canFlip, minSize, properties.ToArray(), connections.ToArray(), renderDescriptions.ToArray(), flagOptions.ToArray(), descriptionMetadata);

            if (iconResourceId.HasValue)
            {
                mainIconResource = iconResourceId.Value;
            }
        }
Exemple #56
0
        public int Load(string Filename)
        {
            try
            {
                System.IO.FileInfo fi = new System.IO.FileInfo(Filename);
                if (fi.Exists)
                {
                    System.IO.MemoryStream ms = null;
                    System.IO.BinaryReader br = null;
                    System.IO.FileStream   fs = new System.IO.FileStream(fi.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    byte[] @by = new byte[Convert.ToInt32(fs.Length) + 1];
                    fs.Read(@by, 0, Convert.ToInt32(fs.Length));
                    ms = new System.IO.MemoryStream(@by, 0, @by.Length);
                    br = new System.IO.BinaryReader(ms);
                    fs.Close();
                    fs.Dispose();

                    Magic        = br.ReadInt16();
                    m_Compressed = br.ReadBoolean();
                    Version      = br.ReadByte();

                    int palcnt = br.ReadInt16();
                    int rgbcnt = br.ReadInt16();

                    m_PaletteImage = new PaletteImage[palcnt];
                    for (int i = 1; i <= palcnt; i++)
                    {
                        PaletteImage palImage = new PaletteImage(br, m_Compressed);
                        m_PaletteImage[i - 1] = palImage;
                    }

                    m_RGBImage = new RGBImage[rgbcnt];
                    for (int i = 1; i <= rgbcnt; i++)
                    {
                        RGBImage rgbImage = new RGBImage(br);
                        m_RGBImage[i - 1] = rgbImage;
                    }

                    for (int i = 0; i <= 255; i++)
                    {
                        byte red   = br.ReadByte();
                        byte green = br.ReadByte();
                        byte blue  = br.ReadByte();
                        byte res   = br.ReadByte();
                        Palette[i] = System.Drawing.Color.FromArgb(red, green, blue);
                    }

                    OriginalPalette = Palette;

                    br.Close();
                    ms.Close();
                    ms.Dispose();
                }
                else
                {
                    return(-1);
                }
                return(0);
            }
            catch (Exception ex)
            {
                return(-2);
            }
        }
 public override void loadState(System.IO.BinaryReader reader)
 {
     base.loadState(reader);
     dmgDone = reader.ReadBoolean();
 }
Exemple #58
0
    private void BytesDecodeTest(CS2CPrtcData p)
    {
        if (p == null || p.Type != 10531)
        {
            return;
        }

        const int count     = 10000;
        Single    totalTime = 0;

        IntPtr L = LuaScriptMgr.Instance.GetL();

        if (L != IntPtr.Zero)
        {
            var startTime = DateTime.Now;
            for (int i = 0; i < count; i++)
            {
                int oldTop = LuaDLL.lua_gettop(L);
                LuaDLL.lua_getglobal(L, "ProcessMoveProtocol2");
                if (!LuaDLL.lua_isnil(L, -1))
                {
                    LuaDLL.lua_pushinteger(L, p.Type);
                    LuaDLL.lua_pushlstring(L, p.Buffer, p.Buffer.Length);
                    LuaDLL.lua_pushboolean(L, false);
                    LuaDLL.lua_pushboolean(L, false);

                    if (LuaDLL.lua_pcall(L, 4, 0, 0) != 0)
                    {
                        HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1));
                    }
                }
                LuaDLL.lua_settop(L, oldTop);
            }
            totalTime = (DateTime.Now - startTime).Ticks;
        }

        UnityEngine.Debug.LogErrorFormat("ProcessMovePBProtocol * {0} = {1} ticks", count, totalTime);

        byte[] inputBytes         = new byte[100];
        System.IO.MemoryStream ms = new System.IO.MemoryStream(inputBytes);
        System.IO.BinaryWriter bw = new System.IO.BinaryWriter(ms);

        {
            //entityid
            bw.Write(2);
            //CurrentPosition
            bw.Write(1.0f);
            bw.Write(2.0f);
            bw.Write(3.0f);
            //CurrentOrientation
            bw.Write(4.0f);
            bw.Write(5.0f);
            bw.Write(6.0f);
            //MoveType
            bw.Write(3);
            //MoveDirection
            bw.Write(7.0f);
            bw.Write(8.0f);
            bw.Write(9.0f);
            //MoveSpeed
            bw.Write(10.0f);
            //TimeInterval
            bw.Write(4);
            //DstPosition
            bw.Write(11.0f);
            bw.Write(12.0f);
            bw.Write(33.0f);
            //IsDestPosition
            bw.Write(false);


            ms.Seek(0, System.IO.SeekOrigin.Begin);
        }


        System.IO.BinaryReader br = new System.IO.BinaryReader(ms);

        {
            var startTime = DateTime.Now;
            for (int i = 0; i < count; i++)
            {
                br.BaseStream.Position = 0;
                var EntityId        = br.ReadInt32();
                var vecX            = br.ReadSingle();
                var vecY            = br.ReadSingle();
                var vecZ            = br.ReadSingle();
                var CurrentPosition = new UnityEngine.Vector3(vecX, vecY, vecZ);
                vecX = br.ReadSingle();
                vecY = br.ReadSingle();
                vecZ = br.ReadSingle();
                var CurrentOrientation = new UnityEngine.Vector3(vecX, vecY, vecZ);
                var MoveType           = br.ReadInt32();
                vecX = br.ReadSingle();
                vecY = br.ReadSingle();
                vecZ = br.ReadSingle();
                var MoveDirection = new UnityEngine.Vector3(vecX, vecY, vecZ);
                var MoveSpeed     = br.ReadSingle();
                var TimeInterval  = br.ReadInt32();
                vecX = br.ReadSingle();
                vecY = br.ReadSingle();
                vecZ = br.ReadSingle();
                var DstPosition    = new UnityEngine.Vector3(vecX, vecY, vecZ);
                var IsDestPosition = br.ReadBoolean();

                if (L != IntPtr.Zero)
                {
                    int oldTop = LuaDLL.lua_gettop(L);
                    LuaDLL.lua_getglobal(L, "ProcessMoveProtocol1");
                    if (!LuaDLL.lua_isnil(L, -1))
                    {
                        LuaScriptMgr.Push(L, EntityId);
                        LuaScriptMgr.Push(L, CurrentPosition);
                        LuaScriptMgr.Push(L, CurrentOrientation);
                        LuaScriptMgr.Push(L, MoveType);
                        LuaScriptMgr.Push(L, MoveDirection);
                        LuaScriptMgr.Push(L, MoveSpeed);
                        LuaScriptMgr.Push(L, TimeInterval);
                        LuaScriptMgr.Push(L, DstPosition);
                        LuaScriptMgr.Push(L, IsDestPosition);

                        if (LuaDLL.lua_pcall(L, 9, 0, 0) != 0)
                        {
                            HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1));
                        }
                    }
                    LuaDLL.lua_settop(L, oldTop);
                }
            }

            totalTime = (DateTime.Now - startTime).Ticks;
        }
        bw.Close();
        br.Close();
        ms.Close();
        ms.Dispose();

        UnityEngine.Debug.LogErrorFormat("ProcessMoveProtocol * {0} = {1} ticks", count, totalTime);
    }
Exemple #59
0
        public void readFromFile(string path, bool withOutChunks)
        {
            this.relatedFileName = path;
            try
            {
                System.IO.FileStream   fileStream   = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fileStream);
                this.ThisLPRVersion = binaryReader.ReadInt32();
                if (this.ThisLPRVersion >= 0)
                {
                    int count = binaryReader.ReadInt32();
                    this.spectatorClientVersion = binaryReader.ReadChars(count);
                    if (this.ThisLPRVersion < 2)
                    {
                        this.gameId = (ulong)((long)binaryReader.ReadInt32());
                    }
                    else
                    {
                        this.gameId = binaryReader.ReadUInt64();
                    }
                    this.gameEndStartupChunkId    = binaryReader.ReadInt32();
                    this.gameStartChunkId         = binaryReader.ReadInt32();
                    this.gameEndChunkId           = binaryReader.ReadInt32();
                    this.gameEndKeyFrameId        = binaryReader.ReadInt32();
                    this.gameLength               = binaryReader.ReadInt32();
                    this.gameDelayTime            = binaryReader.ReadInt32();
                    this.gameClientAddLag         = binaryReader.ReadInt32();
                    this.gameChunkTimeInterval    = binaryReader.ReadInt32();
                    this.gameKeyFrameTimeInterval = binaryReader.ReadInt32();
                    //this.gameELOLevel = binaryReader.ReadInt32();
                    this.gameLastChunkTime     = binaryReader.ReadInt32();
                    this.gameLastChunkDuration = binaryReader.ReadInt32();
                    count                      = binaryReader.ReadInt32();
                    this.gamePlatform          = binaryReader.ReadChars(count);
                    count                      = binaryReader.ReadInt32();
                    this.observerEncryptionKey = binaryReader.ReadChars(count);
                    //count = binaryReader.ReadInt32();
                    //this.gameCreateTime = binaryReader.ReadChars(count);
                    //count = binaryReader.ReadInt32();
                    //this.gameStartTime = binaryReader.ReadChars(count);
                    //count = binaryReader.ReadInt32();
                    //this.gameEndTime = binaryReader.ReadChars(count);
                    if (this.ThisLPRVersion >= 3)
                    {
                        count           = binaryReader.ReadInt32();
                        this.lolVersion = binaryReader.ReadChars(count);
                    }
                    else
                    {
                        this.lolVersion = string.Empty.ToCharArray();
                    }
                    if (this.ThisLPRVersion >= 2)
                    {
                        this.hasResult = binaryReader.ReadBoolean();
                        if (this.ThisLPRVersion >= 4)
                        {
                            if (this.hasResult)
                            {
                                count = binaryReader.ReadInt32();
                                this.endOfGameStatsBytes = binaryReader.ReadBytes(count);
                                this.gameStats           = new EndOfGameStats(this.endOfGameStatsBytes);
                            }
                            if (binaryReader.ReadBoolean())
                            {
                                this.readPlayerOldFormat(binaryReader);
                            }
                        }
                        else
                        {
                            if (this.hasResult)
                            {
                                count = binaryReader.ReadInt32();
                                this.endOfGameStatsBytes = binaryReader.ReadBytes(count);
                                this.gameStats           = new EndOfGameStats(this.endOfGameStatsBytes);
                            }
                            else
                            {
                                this.readPlayerOldFormat(binaryReader);
                            }
                        }
                    }
                    else
                    {
                        this.readPlayerOldFormat(binaryReader);
                    }
                    if (!withOutChunks)
                    {
                        this.readChunks(binaryReader);
                    }

                    binaryReader.Close();
                    fileStream.Close();
                }
            }
            catch
            {
                this.IsBroken = true;
            }
        }
Exemple #60
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public static bool readBool(System.IO.BinaryReader in_Renamed)
 {
     return(in_Renamed.ReadBoolean());
 }