Пример #1
0
        public void OnUserRequestDesKey(Client client)
        {
            if (OPT.SettingExists("des.key"))
            {
                if (debug)
                {
                    Output.Write(new Message()
                    {
                        Text = string.Format("Client [{0}] requested des.key...", client.Id)
                    });
                }

                string desKey = OPT.GetString("des.key");

                PacketStream stream = new PacketStream(0x9999);
                stream.WriteString(desKey);

                if (OPT.GetBool("debug"))
                {
                    Output.Write(new Message()
                    {
                        Text = string.Format("[{0}] Sent!", desKey), AddBreak = true
                    });
                }

                ClientManager.Instance.Send(client, stream);
            }
            else
            {
                Output.Write(new Message()
                {
                    Text = "Failed to find des.key in settings!", AddBreak = true
                });
            }
        }
Пример #2
0
 public static void SetIO()
 {
     GUI.Instance.Invoke(new MethodInvoker(delegate
     {
         GUI.Instance.IP.Text          = OPT.GetString("io.ip");
         GUI.Instance.Port.Text        = OPT.GetString("io.port");
         GUI.Instance.Maintenance.Text = (OPT.GetBool("maintenance")) ? "ON" : "OFF";
     }));
 }
Пример #3
0
        internal void OnUserRequestArguments(Client client)
        {
            string arguments = string.Format("/auth_ip:{0} /auth_port:{1} /locale:? country:? /use_nprotect:0 /cash /commercial_shop /allow_double_exec:{2}", OPT.GetString("auth.io.ip"), OPT.GetString("auth.io.port"), OPT.GetString("double.execute"));

            if (OPT.GetBool("imbc.login"))
            {
                arguments += "/imbclogin /account:? /password:?";
            }

            ClientPackets.Instance.SC_SendArguments(client, arguments, OPT.GetInt("sframe.bypass"));
        }
Пример #4
0
        public void OnUserRequestDesKey(Client client)
        {
            if (OPT.SettingExists("des.key"))
            {
                string desKey = OPT.GetString("des.key");

                PacketStream stream = new PacketStream(0x9999);
                stream.WriteString(desKey);

                if (OPT.GetBool("debug")) { Console.WriteLine("[{0}] Sent!", desKey); }

                ClientManager.Instance.Send(client, stream);
            }
            else { Console.WriteLine("Failed to find des.key in settings!"); }
        }
Пример #5
0
        internal void OnUserRequestFile(Client client, string fileName)
        {
            if (OPT.GetBool("debug"))
            {
                Console.WriteLine("Client [{0}] requested file: {1}", client.Id, fileName);
            }

            string updatePath  = string.Format(@"{0}\{1}", updatesDir, fileName);
            string archiveName = compressFile(updatePath);
            string archivePath = string.Format(@"{0}\{1}.zip", Program.tmpPath, archiveName);

            if (File.Exists(archivePath))
            {
                ClientPackets.Instance.SC_SendFile(client, archivePath);
            }
        }
Пример #6
0
        internal void OnRequestFileInfo(Client client, string fileName)
        {
            if (OPT.GetBool("debug"))
            {
                Console.WriteLine("Client [{0}] requested file info for: {1}", client.Id, fileName);
            }

            string updatePath  = string.Format(@"{0}\{1}", IndexManager.UpdatesDirectory, fileName);
            string archiveName = compressFile(updatePath);
            string archivePath = string.Format(@"{0}\{1}.zip", Program.tmpPath, archiveName);

            if (File.Exists(archivePath))
            {
                ClientPackets.Instance.SC_SendFileInfo(client, archiveName, new FileInfo(archivePath).Length);
            }
            else /*TODO: Send File Does Not Exist Error?*/ } {
Пример #7
0
 public UserHandler()
 {
     debug = OPT.GetBool("debug");
 }
Пример #8
0
        public static void Build(bool rebuild)
        {
            if (rebuild && OPT.GetBool("debug"))
            {
                Console.Write("Rebuilding the Update Index...");
            }
            else
            {
                Console.Write("Building the Update Index...");
            }

            Program.Wait = true;

            if (Index.Count > 0)
            {
                Index.Clear();
            }

            switch (OPT.GetInt("send.type"))
            {
            case 0:     // Google drive
                using (StreamReader sr = new StreamReader(File.Open(string.Format(@"{0}\{1}", System.IO.Directory.GetCurrentDirectory(), "gIndex.opt"), FileMode.Open, FileAccess.Read)))
                {
                    //string line;
                    //while ((line = sr.ReadLine()) != null)
                    //{
                    //    string[] optBlocks = line.Split('|');
                    //    if (optBlocks.Length == 4)
                    //    {
                    //        Index.Add(new IndexEntry { FileName = optBlocks[0], SHA512 = optBlocks[1], Legacy = Convert.ToBoolean(Convert.ToInt32(optBlocks[2])), Delete = Convert.ToBoolean(Convert.ToInt32(optBlocks[3])) });
                    //    }
                    //}
                }
                break;

            case 1:     // HTTP
                break;

            case 2:     // FTP
                break;

            case 3:     // TCP
                foreach (string filePath in System.IO.Directory.GetFiles(UpdatesDirectory))
                {
                    string fileName = Path.GetFileName(filePath);

                    Index.Add(new IndexEntry
                    {
                        FileName = fileName,
                        SHA512   = Hash.GetSHA512Hash(filePath),
                        Legacy   = OPT.IsLegacy(fileName),
                        Delete   = OPT.IsDelete(fileName)
                    });
                }
                break;
            }

            if (rebuild && OPT.GetBool("debug"))
            {
                Console.WriteLine("[OK]\n\t{0} files indexed", Count);
            }
            else
            {
                Console.WriteLine("[OK]\n\t{0} files indexed", Count);
            }

            Program.Wait = false;
        }
Пример #9
0
        public static void Build(bool rebuild)
        {
            Output.WriteAndLock(new Message()
            {
                Text = string.Format("{0} the Update Index...", (rebuild && OPT.GetBool("debug")) ? "Rebuilding" : "Building")
            });

            if (rebuild)
            {
                Program.Wait = true;
            }

            if (Index.Count > 0)
            {
                Index.Clear();
            }

            switch (OPT.GetInt("send.type"))
            {
            case 0:     // Google drive
                using (StreamReader sr = new StreamReader(File.Open(string.Format(@"{0}\{1}", System.IO.Directory.GetCurrentDirectory(), "gIndex.opt"), FileMode.Open, FileAccess.Read)))
                {
                    //string line;
                    //while ((line = sr.ReadLine()) != null)
                    //{
                    //    string[] optBlocks = line.Split('|');
                    //    if (optBlocks.Length == 4)
                    //    {
                    //        Index.Add(new IndexEntry { FileName = optBlocks[0], SHA512 = optBlocks[1], Legacy = Convert.ToBoolean(Convert.ToInt32(optBlocks[2])), Delete = Convert.ToBoolean(Convert.ToInt32(optBlocks[3])) });
                    //    }
                    //}
                }
                break;

            case 1:     // HTTP
                break;

            case 2:     // FTP
                break;

            case 3:     // TCP
                foreach (string filePath in System.IO.Directory.GetFiles(UpdatesDirectory))
                {
                    string fileName = Path.GetFileName(filePath);

                    Index.Add(new IndexEntry
                    {
                        FileName = fileName,
                        SHA512   = Hash.GetSHA512Hash(filePath),
                        Legacy   = OPT.IsLegacy(fileName),
                        Delete   = OPT.IsDelete(fileName)
                    });
                }
                break;
            }

            if (OPT.GetBool("debug"))
            {
                Output.WriteAndUnlock(new Message()
                {
                    Text = string.Format("[OK]\n\t- {0} files indexed", Count), AddBreak = true
                });
            }

            if (rebuild)
            {
                Program.Wait = false;
            }

            GUI.Instance.Invoke(new System.Windows.Forms.MethodInvoker(delegate {
                GUI.Instance.updatesViewBtn.Enabled = true;
                GUI.Instance.updatesView.Enabled    = true;
            }));
        }