예제 #1
0
        /// <summary>
        /// UpdateIndex entry received
        /// </summary>
        /// <param name="stream"></param>
        private void SC_DataUpdateEntry(PacketStream stream)
        {
            string name     = stream.ReadString();
            string fileHash = stream.ReadString();

            UpdateHandler.Instance.OnDataEntryReceived(name, fileHash);
        }
예제 #2
0
        private void SC_ResourceUpdateEntry(PacketStream stream)
        {
            string name     = stream.ReadString();
            string fileHash = stream.ReadString();
            bool   delete   = stream.ReadBool();

            UpdateHandler.Instance.OnResourceEntryReceived(name, fileHash, delete);
        }
예제 #3
0
        /// <summary>
        /// UpdateIndex entry received
        /// </summary>
        /// <param name="stream"></param>
        private void SC_UpdateIndex(PacketStream stream)
        {
            string name     = stream.ReadString();
            string fileHash = stream.ReadString();
            bool   isLegacy = stream.ReadBool();
            bool   isDelete = stream.ReadBool();

            UpdateHandler.Instance.OnUpdateIndexReceived(name, fileHash, isLegacy);
        }
예제 #4
0
        private void SC_UpdateDateTime(PacketStream stream)
        {
            string   dateString = stream.ReadString();
            DateTime time       = DateTime.Parse(dateString, CultureInfo.InvariantCulture);

            UpdateHandler.Instance.OnUpdateDateTimeReceived(time);
        }
예제 #5
0
        private void SC_ReceiveFileInfo(PacketStream stream)
        {
            string tmpName  = stream.ReadString();
            int    fileSize = stream.ReadInt32();

            if (fileSize > 0)
            {
                tempBuffer = new byte[fileSize];
                GUI.Instance.UpdateProgressMaximum(1, fileSize);
                GUI.Instance.UpdateProgressValue(1, 0);
                UpdateHandler.Instance.OnFileInfoReceived(tmpName);
            }
        }
예제 #6
0
        private void SC_ReceiveEOF(PacketStream stream)
        {
            string fileName = stream.ReadString();
            string filePath = String.Format(@"{0}\Downloads\{1}", Directory.GetCurrentDirectory(), fileName);

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            GUI.Instance.UpdateProgressValue(1, tempBuffer.Length);

            using (FileStream fs = new FileStream(filePath, FileMode.Create)) { fs.Write(tempBuffer, 0, tempBuffer.Length); }

            UpdateHandler.Instance.OnFileTransfered(fileName);
        }
예제 #7
0
 private void SC_UpdateSelfUpdate(PacketStream stream)
 {
     UpdateHandler.Instance.ExecuteSelfUpdate(stream.ReadString());
 }
예제 #8
0
 private void SC_DesKey(PacketStream stream)
 {
     GUI.Instance.OnDesKeyReceived(stream.ReadString());
 }