コード例 #1
0
 public IEnumerable <byte[]> GetChunks(IEnumerable <Xyz> chunkpositions)
 {
     foreach (byte[] b in d_ChunkDb.GetChunks(chunkpositions))
     {
         if (b == null)
         {
             yield return(null);
         }
         else
         {
             yield return(d_Compression.Decompress(b));
         }
     }
 }
コード例 #2
0
        public string Decompress(string stringToDecompress)
        {
            var encodedDataAsBytes = Convert.FromBase64String(stringToDecompress);
            var decompressData     = _compression.Decompress(encodedDataAsBytes);

            return(Encoding.UTF8.GetString(decompressData));
        }
コード例 #3
0
        public static string DecryptBlock(string textToDecrypt, byte [] password)
        {
            if (string.IsNullOrEmpty(textToDecrypt))
            {
                throw new ArgumentNullException("textToDecrypt");
            }

            if (password == null)
            {
                throw new ArgumentNullException("password");
            }

            var aes = new Aes();

            var convertFromBase64String = Convert.FromBase64String(textToDecrypt);

            var salt    = ByteHelpers.CreateSpecialByteArray(32);
            var message = ByteHelpers.CreateSpecialByteArray(convertFromBase64String.Length - 32);

            Buffer.BlockCopy(convertFromBase64String, 0, salt, 0, 32);
            Buffer.BlockCopy(convertFromBase64String, 32, message, 0, convertFromBase64String.Length - 32);

            var deCompressed = Compressor.Decompress(aes.Decrypt(message, Convert.ToBase64String(password), salt, 70000));

            return(ByteHelpers.GetString(deCompressed));
        }
コード例 #4
0
        public T Deserialize <T>(byte[] compressedBytes, IMoBiProject project, SerializationContext serializationContext = null)
        {
            var decompressesBytes = _compression.Decompress(compressedBytes);
            var element           = XmlHelper.ElementFromBytes(decompressesBytes);

            return(deserialize(element, project, VersionFrom(element), parentSerializationContext: serializationContext).DowncastTo <T>());
        }
コード例 #5
0
 public string DecodeMessageFromImage(Bitmap coverImage, string decryptionKey, string stegoSeed,
                                      bool decrypt = true, bool decompress = true)
 {
     try
     {
         byte[] byteMessage = _stegoMethod.Decode(coverImage, stegoSeed);
         if (decompress)
         {
             byteMessage = _compressMethod.Decompress(byteMessage);
         }
         string message = Encoding.UTF8.GetString(byteMessage);
         if (decrypt)
         {
             message = _cryptoMethod.Decrypt(message, decryptionKey);
         }
         return(message);
     }
     catch (NotifyUserException)
     {
         throw;
     }
     catch (AbortActionException)
     {
         throw;
     }
 }
コード例 #6
0
        private byte[] DecryptData(byte[] encrypted, byte[] salt, int workFactor)
        {
            var decrypted = Aes.Decrypt(encrypted, Convert.ToBase64String(Password.CombinedPasswords), salt, workFactor);

            var decompressed = Compression.Decompress(decrypted);

            return(decompressed);
        }
コード例 #7
0
        private byte[] DecryptData(byte[] encrypted)
        {
            var decrypted  = _aes.Decrypt(encrypted, Convert.ToBase64String(_password.Password1), Encoding.ASCII.GetBytes(Salt), 1000);
            var decrypted2 = _aes.Decrypt(decrypted, Convert.ToBase64String(_password.Password2), Encoding.ASCII.GetBytes(Salt), 1000);
            var decrypted3 = _aes.Decrypt(decrypted2, Convert.ToBase64String(_password.Password1), Encoding.ASCII.GetBytes(Salt), 1000);

            var decompressed = _compression.Decompress(decrypted3);

            return(decompressed);
        }
コード例 #8
0
        public void DecompressData(string folderPath)
        {
            DirectoryInfo directorySelected = new DirectoryInfo(folderPath);

            foreach (FileInfo fileToDecompress in directorySelected.GetFiles(Compresor.GetFileExtensionPattern()))
            {
                Compresor.Decompress(fileToDecompress);
            }

            Console.WriteLine("All files has been decompress.");
        }
コード例 #9
0
        public byte[] Decompress(byte[] data)
        {
            Ensure.ArgumentNotNull(data, "data");

            using (var stream = data.ToStream())
            {
                var decompressedData = _compression.Decompress(stream);

                return(decompressedData);
            }
        }
コード例 #10
0
        public async Task <IPayload> GetPayload(IMessage message)
        {
            var data = encryption.Decrypt(message.Data);

            data = compression.Decompress(data);

            var @event   = eventHolder.GetEvent(message.EventId);
            var dataType = @event.GetInterfaces()[0].GetGenericArguments()[0];

            var @object = serializer.Deserialize(data, dataType);

            return(await Task.FromResult((IPayload) new Payload { Event = @event, Data = @object }).ConfigureAwait(false));
        }
コード例 #11
0
 private void Decrypt(BasicRequest request)
 {
     if (_settings.Encrypt)
     {
         var compressedFlatArray = _encryption.DecryptString(request.Source);
         var flatArray           = _compression.Decompress(compressedFlatArray);
         var doubleArray         = flatArray.Split('|').Select(o => Convert.ToInt32(o)).ToArray();
         var unicodeString       = new String(doubleArray.Select(o => (char)o).ToArray());
         var split = unicodeString.Split(new[] { "[ENDSEED]" }, StringSplitOptions.None);
         request.Seed   = split[0].Split('|').Select(o => Convert.ToInt32(o)).ToList();
         request.Source = split[1];
     }
 }
コード例 #12
0
        private static byte[] DecryptBytes(Compact.Iterator parts, object key, JweAlgorithm?jweAlg, JweEncryption?jweEnc, JwtSettings settings = null)
        {
            byte[] header       = parts.Next();
            byte[] encryptedCek = parts.Next();
            byte[] iv           = parts.Next();
            byte[] cipherText   = parts.Next();
            byte[] authTag      = parts.Next();

            JwtSettings jwtSettings = GetSettings(settings);
            IDictionary <string, object> jwtHeader = jwtSettings.JsonMapper.Parse <Dictionary <string, object> >(Encoding.UTF8.GetString(header));

            JweAlgorithm  headerAlg = jwtSettings.JwaAlgorithmFromHeader((string)jwtHeader["alg"]);
            JweEncryption headerEnc = jwtSettings.JweAlgorithmFromHeader((string)jwtHeader["enc"]);

            IKeyManagement keys = jwtSettings.Jwa(headerAlg);
            IJweAlgorithm  enc  = jwtSettings.Jwe(headerEnc);

            if (keys == null)
            {
                throw new JoseException(string.Format("Unsupported JWA algorithm requested: {0}", headerAlg));
            }

            if (enc == null)
            {
                throw new JoseException(string.Format("Unsupported JWE algorithm requested: {0}", headerEnc));
            }

            if (jweAlg != null && (JweAlgorithm)jweAlg != headerAlg)
            {
                throw new InvalidAlgorithmException("The algorithm type passed to the Decrypt method did not match the algorithm type in the header.");
            }

            if (jweEnc != null && (JweEncryption)jweEnc != headerEnc)
            {
                throw new InvalidAlgorithmException("The encryption type passed to the Decrypt method did not match the encryption type in the header.");
            }

            byte[] cek = keys.Unwrap(encryptedCek, key, enc.KeySize, jwtHeader);
            byte[] aad = Encoding.UTF8.GetBytes(Compact.Serialize(header));

            byte[] plainText = enc.Decrypt(aad, cek, iv, cipherText, authTag);

            if (jwtHeader.ContainsKey("zip"))
            {
                ICompression compression = jwtSettings.Compression((string)jwtHeader["zip"]);

                plainText = compression.Decompress(plainText);
            }

            return(plainText);
        }
コード例 #13
0
ファイル: file.cs プロジェクト: sotigr/vdpk
        public byte[] GetDecryptedData()
        {
            byte[] bt;
            if (_encrypted_data && _compressed_data)
            {
                bt = Cryptography.Decrypt(Compression.Decompress(_bytes), Settings.DefaultPassword);
            }
            else if (_encrypted_data)
            {
                bt = Cryptography.Decrypt(_bytes, Settings.DefaultPassword);
            }
            else if (_compressed_data)
            {
                bt = Compression.Decompress(_bytes);
            }
            else
            {
                bt = _bytes;
            }

            // GC.Collect();
            return(bt);
        }
コード例 #14
0
        private void btnDecompress_Click(object sender, EventArgs e)
        {
            time.Stop();
            NewSerializer newSerializer = new NewSerializer();

            CompressionAlgs algorithms = new CompressionAlgs(pluginPath);

            if (algorithms.objects.Count == 0)
            {
                MessageBox.Show("No plugins");
            }

            AddCompressorDecorator(algorithms);

            OpenFileDialog dlg = new OpenFileDialog();

            string filter = string.Empty;

            foreach (ICompression alg in algorithms.objects)
            {
                filter += "*" + alg.Format + ";";
            }
            filter     = filter.TrimEnd(';');
            dlg.Filter = "Archives (" + filter + ")|" + filter;

            bool result = dlg.ShowDialog() == DialogResult.OK;

            if (result == true)
            {
                try
                {
                    string ext  = System.IO.Path.GetExtension(dlg.FileName);
                    string temp = dlg.FileName.Replace(ext, "");

                    ICompression compressor = algorithms.objects.Find(obj => obj.Format == ext);
                    compressor.Decompress(dlg.FileName, temp);

                    star = (Star)newSerializer.GetfileName_Serialization(dlg.FileName).Deserialize(typeof(Star), temp);

                    File.Delete(temp);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error");
                }
            }

            time.Start();
        }
コード例 #15
0
        public TObject Deserialize <TObject>(byte[] serializationByte)
        {
            if (typeof(TObject) != typeof(IDiagramModel))
            {
                return(default(TObject));
            }

            var serializer = _modelingXmlSerializerRepository.SerializerFor <IDiagramModel>();

            using (var serializationContext = SerializationTransaction.Create())
            {
                var outputToDeserialize = XmlHelper.ElementFromBytes(_compress.Decompress(serializationByte));
                return((TObject)serializer.Deserialize(outputToDeserialize, serializationContext));
            }
        }
コード例 #16
0
        internal static async Task <byte[]> DeflateDecompress(byte[] value, ICompression compression)
        {
            //var encoded = Convert.FromBase64String(value);
            using (var compressed = new MemoryStream(value))
            {
                using (var decompressed = new MemoryStream())
                {
                    await compression.Decompress(compressed, decompressed);

                    decompressed.Position = 0;
                    var result = new byte[decompressed.Length];
                    Array.Copy(decompressed.GetBuffer(), result, result.Length);
                    return(result);
                }
            }
        }
コード例 #17
0
        internal static async Task <string> DeflateDecompress(string value, ICompression compression)
        {
            var encoded = Convert.FromBase64String(value);

            using (var compressed = new MemoryStream(encoded))
            {
                using (var decompressed = new MemoryStream())
                {
                    await compression.Decompress(compressed, decompressed);

                    decompressed.Position = 0;
                    using (var streamReader = new StreamReader(decompressed, Encoding.UTF8))
                    {
                        return(await streamReader.ReadToEndAsync());
                    }
                }
            }
        }
コード例 #18
0
        public IPayload <TData> GetPayload <TData>(Message message)
        {
            using (var stream = new ValueStream(message.Data))
            {
                var commandId = stream.ReadInt32();

                var commandType     = commandHolder.GetCommand(commandId);
                var genericArgument = commandHolder.GetGenericArgument(commandType);

                encryption.Decrypt(stream);
                compression.Decompress(stream);

                var data = serializer.Deserialize(stream, genericArgument);
                return(new Payload <TData>
                {
                    CommandType = commandType,
                    Data = (TData)data
                });
            }
        }
コード例 #19
0
 private byte[] decompressedByte(byte[] serializationBytes)
 {
     return(_compression.Decompress(serializationBytes));
 }
コード例 #20
0
 protected override void ProcessCompression(ICompression compression, Stream input, Stream output)
 {
     compression.Decompress(input, output);
 }
コード例 #21
0
        public BasicClient Deserialise(string key, string iv, string client)
        {
            _encryption.SetKeyAndIv(key, iv);
            var serlizedBasicClient = _serialisation.Deserialise <SerlializedBasicClient>(_compression.Decompress(_encryption.DecryptString(client)));

            return(new BasicClient(serlizedBasicClient.GeneratorSettings, serlizedBasicClient.ServiceSettings, serlizedBasicClient.TokenTable));
        }
コード例 #22
0
        private int TryReadPacket()
        {
            BinaryReader br = new BinaryReader(new MemoryStream(received.ToArray()));

            if (received.Count == 0)
            {
                return(0);
            }
            var packetId  = (MinecraftServerPacketId)br.ReadByte();
            int totalread = 1;

            if (packetId != MinecraftServerPacketId.PositionandOrientationUpdate &&
                packetId != MinecraftServerPacketId.PositionUpdate &&
                packetId != MinecraftServerPacketId.OrientationUpdate &&
                packetId != MinecraftServerPacketId.PlayerTeleport &&
                packetId != MinecraftServerPacketId.ExtendedPacketTick)
            {
                Console.WriteLine(Enum.GetName(typeof(MinecraftServerPacketId), packetId));
            }
            switch (packetId)
            {
            case MinecraftServerPacketId.ServerIdentification:
            {
                totalread += 1 + NetworkHelper.StringLength + NetworkHelper.StringLength + 1; if (received.Count < totalread)
                {
                    return(0);
                }
                if (ENABLE_FORTRESS)
                {
                    totalread += NetworkHelper.StringLength; if (received.Count < totalread)
                    {
                        return(0);
                    }
                }
                ServerPlayerIdentification p = new ServerPlayerIdentification();
                p.ProtocolVersion = br.ReadByte();
                string invalidversionstr = "Invalid game version. Local: {0}, Server: {1}";
                if (!ENABLE_FORTRESS)
                {
                    if (!(p.ProtocolVersion == 7 || p.ProtocolVersion == 6))
                    {
                        throw new Exception(string.Format(invalidversionstr,
                                                          "Minecraft 7", "Minecraft " + p.ProtocolVersion));
                    }
                }
                else
                {
                    string servergameversion = NetworkHelper.ReadString64(br);
                    if (p.ProtocolVersion != 200)
                    {
                        servergameversion = "Minecraft " + p.ProtocolVersion;
                    }
                    if (servergameversion != GameVersion.Version)
                    {
                        throw new Exception(string.Format(invalidversionstr, GameVersion.Version, servergameversion));
                    }
                }
                p.ServerName = NetworkHelper.ReadString64(br);
                p.ServerMotd = NetworkHelper.ReadString64(br);
                p.UserType   = br.ReadByte();
                //connected = true;
                this.serverName = p.ServerName;
                this.ServerMotd = p.ServerMotd;
                ChatLog("---Connected---");
            }
            break;

            case MinecraftServerPacketId.Ping:
            {
            }
            break;

            case MinecraftServerPacketId.LevelInitialize:
            {
                receivedMapStream = new MemoryStream();
                InvokeMapLoadingProgress(0, 0);
            }
            break;

            case MinecraftServerPacketId.LevelDataChunk:
            {
                totalread += 2 + 1024 + 1; if (received.Count < totalread)
                {
                    return(0);
                }
                int          chunkLength             = NetworkHelper.ReadInt16(br);
                byte[]       chunkData               = br.ReadBytes(1024);
                BinaryWriter bw1                     = new BinaryWriter(receivedMapStream);
                byte[]       chunkDataWithoutPadding = new byte[chunkLength];
                for (int i = 0; i < chunkLength; i++)
                {
                    chunkDataWithoutPadding[i] = chunkData[i];
                }
                bw1.Write(chunkDataWithoutPadding);
                MapLoadingPercentComplete = br.ReadByte();
                InvokeMapLoadingProgress(MapLoadingPercentComplete, (int)receivedMapStream.Length);
            }
            break;

            case MinecraftServerPacketId.LevelFinalize:
            {
                totalread += 2 + 2 + 2; if (received.Count < totalread)
                {
                    return(0);
                }
                if (ENABLE_FORTRESS)
                {
                    totalread += 4; if (received.Count < totalread)
                    {
                        return(0);
                    }                                                                     //simulationstartframe
                }
                mapreceivedsizex = NetworkHelper.ReadInt16(br);
                mapreceivedsizez = NetworkHelper.ReadInt16(br);
                mapreceivedsizey = NetworkHelper.ReadInt16(br);
                receivedMapStream.Seek(0, SeekOrigin.Begin);
                if (!ENABLE_FORTRESS)
                {
                    MemoryStream decompressed = new MemoryStream(compression.Decompress(receivedMapStream.ToArray()));
                    if (decompressed.Length != mapreceivedsizex * mapreceivedsizey * mapreceivedsizez +
                        (decompressed.Length % 1024))
                    {
                        //throw new Exception();
                        Console.WriteLine("warning: invalid map data size");
                    }
                    byte[, ,] receivedmap = new byte[mapreceivedsizex, mapreceivedsizey, mapreceivedsizez];
                    {
                        BinaryReader br2  = new BinaryReader(decompressed);
                        int          size = NetworkHelper.ReadInt32(br2);
                        for (int z = 0; z < mapreceivedsizez; z++)
                        {
                            for (int y = 0; y < mapreceivedsizey; y++)
                            {
                                for (int x = 0; x < mapreceivedsizex; x++)
                                {
                                    receivedmap[x, y, z] = br2.ReadByte();
                                }
                            }
                        }
                    }
                    MapStoragePortion.UseMap(receivedmap);
                    Map.Map.MapSizeX = receivedmap.GetUpperBound(0) + 1;
                    Map.Map.MapSizeY = receivedmap.GetUpperBound(1) + 1;
                    Map.Map.MapSizeZ = receivedmap.GetUpperBound(2) + 1;
                    Console.WriteLine("Game loaded successfully.");
                }
                else
                {
                    int simulationstartframe = NetworkHelper.ReadInt32(br);
                    gameworld.LoadState(receivedMapStream.ToArray(), simulationstartframe);
                }
                if (MapLoaded != null)
                {
                    MapLoaded.Invoke(this, new MapLoadedEventArgs()
                        {
                        });
                }
                loadedtime = DateTime.Now;
            }
            break;

            case MinecraftServerPacketId.SetBlock:
            {
                int x;
                int y;
                int z;
                if (ENABLE_FORTRESS)
                {
                    throw new Exception("SetBlock packet");        //no such packet.
                }
                else
                {
                    totalread += 2 + 2 + 2 + 1; if (received.Count < totalread)
                    {
                        return(0);
                    }
                    x = NetworkHelper.ReadInt16(br);
                    z = NetworkHelper.ReadInt16(br);
                    y = NetworkHelper.ReadInt16(br);
                }
                byte type = br.ReadByte();
                try { Map.SetTileAndUpdate(new Vector3(x, y, z), type); }
                catch { Console.WriteLine("Cannot update tile!"); }
            }
            break;

            case MinecraftServerPacketId.SpawnPlayer:
            {
                if (ENABLE_FORTRESS)
                {
                    totalread += 1 + NetworkHelper.StringLength + 4 + 4 + 4 + 1 + 1; if (received.Count < totalread)
                    {
                        return(0);
                    }
                }
                else
                {
                    totalread += 1 + NetworkHelper.StringLength + 2 + 2 + 2 + 1 + 1; if (received.Count < totalread)
                    {
                        return(0);
                    }
                }
                byte   playerid   = br.ReadByte();
                string playername = NetworkHelper.ReadString64(br);
                if (ENABLE_FORTRESS && playerid == 255)
                {
                    spawned = true;
                    break;
                }
                connectedplayers.Add(new ConnectedPlayer()
                    {
                        name = playername, id = playerid
                    });
                if (Clients.Players.ContainsKey(playerid))
                {
                    //throw new Exception();
                }
                Clients.Players[playerid]      = new Player();
                Clients.Players[playerid].Name = playername;
                if (ENABLE_FORTRESS && ((DateTime.Now - loadedtime).TotalSeconds > 10))
                {
                    ReadAndUpdatePlayerPosition(br, playerid);
                }
                if (!ENABLE_FORTRESS)
                {
                    ReadAndUpdatePlayerPosition(br, playerid);
                }
                if (playerid == 255)
                {
                    spawned = true;
                }
            }
            break;

            case MinecraftServerPacketId.PlayerTeleport:
            {
                if (ENABLE_FORTRESS)
                {
                    totalread += 1 + (4 + 4 + 4) + 1 + 1; if (received.Count < totalread)
                    {
                        return(0);
                    }
                }
                else
                {
                    totalread += 1 + (2 + 2 + 2) + 1 + 1; if (received.Count < totalread)
                    {
                        return(0);
                    }
                }
                byte playerid = br.ReadByte();
                ReadAndUpdatePlayerPosition(br, playerid);
            }
            break;

            case MinecraftServerPacketId.PositionandOrientationUpdate:
            {
                totalread += 1 + (1 + 1 + 1) + 1 + 1; if (received.Count < totalread)
                {
                    return(0);
                }
                byte    playerid = br.ReadByte();
                float   x        = (float)br.ReadSByte() / 32;
                float   y        = (float)br.ReadSByte() / 32;
                float   z        = (float)br.ReadSByte() / 32;
                byte    heading  = br.ReadByte();
                byte    pitch    = br.ReadByte();
                Vector3 v        = new Vector3(x, y, z);
                UpdatePositionDiff(playerid, v);
            }
            break;

            case MinecraftServerPacketId.PositionUpdate:
            {
                totalread += 1 + 1 + 1 + 1; if (received.Count < totalread)
                {
                    return(0);
                }
                byte    playerid = br.ReadByte();
                float   x        = (float)br.ReadSByte() / 32;
                float   y        = (float)br.ReadSByte() / 32;
                float   z        = (float)br.ReadSByte() / 32;
                Vector3 v        = new Vector3(x, y, z);
                UpdatePositionDiff(playerid, v);
            }
            break;

            case MinecraftServerPacketId.OrientationUpdate:
            {
                totalread += 1 + 1 + 1; if (received.Count < totalread)
                {
                    return(0);
                }
                byte playerid = br.ReadByte();
                byte heading  = br.ReadByte();
                byte pitch    = br.ReadByte();
                Clients.Players[playerid].Heading = heading;
                Clients.Players[playerid].Pitch   = pitch;
            }
            break;

            case MinecraftServerPacketId.DespawnPlayer:
            {
                totalread += 1; if (received.Count < totalread)
                {
                    return(0);
                }
                byte playerid = br.ReadByte();
                for (int i = 0; i < connectedplayers.Count; i++)
                {
                    if (connectedplayers[i].id == playerid)
                    {
                        connectedplayers.RemoveAt(i);
                    }
                }
                Clients.Players.Remove(playerid);
            }
            break;

            case MinecraftServerPacketId.Message:
            {
                totalread += 1 + NetworkHelper.StringLength; if (received.Count < totalread)
                {
                    return(0);
                }
                byte   unused  = br.ReadByte();
                string message = NetworkHelper.ReadString64(br);
                Chatlines.AddChatline(message);
                ChatLog(message);
            }
            break;

            case MinecraftServerPacketId.DisconnectPlayer:
            {
                totalread += NetworkHelper.StringLength; if (received.Count < totalread)
                {
                    return(0);
                }
                string disconnectReason = NetworkHelper.ReadString64(br);
                throw new Exception(disconnectReason);
            }

            case MinecraftServerPacketId.ExtendedPacketCommand:
            {
                totalread += 1 + 4 + 4; if (received.Count < totalread)
                {
                    return(0);
                }
                int playerid = br.ReadByte();
                int cmdframe = NetworkHelper.ReadInt32(br);
                int length   = NetworkHelper.ReadInt32(br);
                totalread += length; if (received.Count < totalread)
                {
                    return(0);
                }
                byte[] cmd = br.ReadBytes(length);
                gameworld.EnqueueCommand(playerid, cmdframe, cmd);
            }
            break;

            case MinecraftServerPacketId.ExtendedPacketTick:
            {
                totalread += 4 + 4; if (received.Count < totalread)
                {
                    return(0);
                }
                int allowedframe = NetworkHelper.ReadInt32(br);
                int hash         = NetworkHelper.ReadInt32(br);

                totalread += 1; if (received.Count < totalread)
                {
                    return(0);
                }
                int clientscount = br.ReadByte();
                totalread += clientscount * (1 + (3 * 4) + 1 + 1); if (received.Count < totalread)
                {
                    return(0);
                }
                Dictionary <int, PlayerPosition> playerpositions = new Dictionary <int, PlayerPosition>();
                for (int i = 0; i < clientscount; i++)
                {
                    byte playerid = br.ReadByte();
                    //copied
                    float x       = (float)((double)NetworkHelper.ReadInt32(br) / 32);
                    float y       = (float)((double)NetworkHelper.ReadInt32(br) / 32);
                    float z       = (float)((double)NetworkHelper.ReadInt32(br) / 32);
                    byte  heading = br.ReadByte();
                    byte  pitch   = br.ReadByte();
                    playerpositions[playerid] = new PlayerPosition()
                    {
                        position = new Vector3(x, y, z), heading = heading, pitch = pitch
                    };
                }
                gameworld.KeyFrame(allowedframe, hash, playerpositions);
            }
            break;

            default:
            {
                throw new Exception("Invalid packet id");
            }
            }
            return(totalread);
        }
コード例 #23
0
ファイル: Decorator.cs プロジェクト: Balaclava505/OOP-Space
 public virtual void Decompress(string inputFile, string outputFile)
 {
     compressor.Decompress(inputFile, outputFile);
 }