Example #1
0
        public override bool WarnIfNecessary(Chat chat)
        {
            if (!isIntelRenderer)
            {
                return(false);
            }

            chat.Add("&cIntel graphics cards are known to have issues with the OpenGL build.");
            chat.Add("&cVSync may not work, and you may see disappearing clouds and map edges.");
            chat.Add("&cFor Windows, try downloading the Direct3D 9 build instead.");
            return(true);
        }
        /*NEBEREIKIA
         * public bool CanSend
         * {
         *  get
         *  {
         *      if (Message == null)
         *          return false;
         *
         *      return !string.IsNullOrWhiteSpace(Message);
         *  }
         * }*/

        public void SendMessage()
        {
            Chat.Add(Username + ": " + Message);
            OnPropertyChanged("Chat");
            Message = "";
            OnPropertyChanged("Message");
        }
Example #3
0
        private static void Parse0x3A(ClientSocket cs, Receiver receiver)
        {
            Int32 accountResponse = receiver.GetInt32();

            switch (accountResponse)
            {
            case 0x000:
                cs.FirstJoin = true;
                //sets logged on variables
                ConnectedBar.AddOne();
                //confirm logon packet
                Builder builder = new Builder();
                builder.InsertNTString(cs.AccountName);
                builder.InsertByte(0);
                builder.SendPacket(cs, 0x0A);
                //send join to targeted channel
                Send0x0C(cs);
                break;

            case 0x001:
                //account doesnt exist. create account
                Send0x3D(cs);
                break;

            case 0x002:
                //logon failed. generate random name, create account and so on
                cs.AccountName = RandomName();
                Send0x3D(cs);
                break;

            default:
                Chat.Add(Color.Wheat, "Unhandled 0x3A code." + NewLine);
                break;
            }
        }
Example #4
0
File: CDKeys.cs Project: inrg/KryX2
        private static void ImportGoodCdKeys(List <string> badkeys)
        {
            string path = (KryX2.Settings.GeneratedSettings.AppDirectory + @"\Text\CdKeys.txt");

            if (!File.Exists(path))
            {
                Chat.Add(Color.NavajoWhite, "Missing CdKeys.txt file!" + NewLine);
            }

            string fileText = null; //default

            _cdKeyList.Clear();

            StreamReader fileReader = new StreamReader(path);

            while ((fileText = fileReader.ReadLine()) != null)
            {
                try
                {
                    fileText = TidyText(fileText);
                    if (fileText.Length == 13)
                    { //if length is 13 proceed
                        if (!badkeys.Contains(fileText) && (ReturnCdKeyIndex(fileText) == -1))
                        {
                            _cdKeyList.Add(fileText);
                        }
                    }
                }           //try end
                finally { } //do nothing
            }
            fileReader.Close();

            Chat.Add(Color.Silver, "Loaded " + _cdKeyList.Count + " cdkeys." + Environment.NewLine);
        } //loads scanlist into an array
Example #5
0
 void Scheduled(ScheduledTask task)
 {
     if (lastMessage != "")
     {
         gameChat.Add(lastMessage);
         lastMessage = "";
     }
 }
Example #6
0
        private static void Parse0x51(ClientSocket cs, Receiver receiver)
        {
            Int32  keyResponse       = receiver.GetInt32();
            string additionalMessage = receiver.GetNTString();

            switch (keyResponse)
            {
            case 0x000:
                //removes plug
                Builder builder = new Builder();
                builder.InsertNonNTString("tenb");
                builder.SendPacket(cs, 0x14);
                //determine what type of name is being used and send packet accordingly
                SendLogon(cs);
                return;

            case 0x100:
                Chat.Add(Color.White, "Old game version! (verbyte)" + NewLine);
                return;

            case 0x101:
                Chat.Add(Color.White, "Invalid game version!" + NewLine);
                CDKeys.WriteBadCDKey(cs.CdKey, " game-version");
                cs.CDKeyBlacklisted = true;
                return;

            case 0x102:
                Chat.Add(Color.White, "Must downgrade game version!" + NewLine);
                return;

            case 0x200:
                Chat.Add(Color.White, "Invalid cdkey!" + NewLine);
                CDKeys.WriteBadCDKey(cs.CdKey, " invalid");
                cs.CDKeyBlacklisted = true;
                break;

            case 0x201:
                Chat.Add(Color.White, "Key in use by: " + additionalMessage + NewLine);
                break;

            case 0x202:
                Chat.Add(Color.White, "Banned cdkey!" + NewLine);
                CDKeys.WriteBadCDKey(cs.CdKey, " banned");
                cs.CDKeyBlacklisted = true;
                break;

            case 0x203:
                Chat.Add(Color.White, "Cdkey meant for another product!" + NewLine);
                break;

            default:
                Chat.Add(Color.Yellow, "Unknown 0x51 response. sadface.com" + NewLine);
                break;
            }

            SocketActions.ReconnectClient(cs, true, false);
        }
Example #7
0
        //builds headers for proxy types which are sent when connecting to a proxy
        #region Contruct Proxy Destination Headers
        internal static bool ConstructHeaders(string server)
        {
            try
            {
                IPAddress resultIP;
                if (IPAddress.TryParse(server, out resultIP))
                {
                }
                else
                {
                    IPAddress[] ips;
                    ips = Dns.GetHostAddresses(server);
                    Random randomizer  = new Random();
                    int    serverIndex = randomizer.Next(0, ips.Length - 1);
                    resultIP = ips[serverIndex];
                }

                if (resultIP.Equals(IPAddress.None) || resultIP.ToString().Length == 0 || resultIP.Equals(null))
                {
                    return(false);
                }
                else
                {
                    Chat.Add(Color.GreenYellow, Environment.NewLine + "Using server address: " + resultIP.ToString() + Environment.NewLine);
                }

                int bnetPort = 6112;

                byte[] socks4Array = new byte[9];
                socks4Array[0] = 4;
                socks4Array[1] = 1;
                //socks 4 header
                Array.Copy(PortToBytes(bnetPort), 0, socks4Array, 2, 2);
                //copies port to array
                byte[] IPArray;
                //IPArray = IPAddress.Parse(bnetServer).GetAddressBytes();
                IPArray = resultIP.GetAddressBytes();
                Array.Copy(IPArray, 0, socks4Array, 4, 4);
                //copy ip bytes to array
                socks4Array[8] = 0;
                //null trunc for username
                Socks4Header = new byte[socks4Array.Length]; //set to appropriate length
                Array.Copy(socks4Array, 0, Socks4Header, 0, 9);
                //build socks4 header

                string httpHeaderText = "CONNECT " + resultIP.ToString() + ":" + bnetPort + " HTTP/1.1" + Environment.NewLine +
                                        Environment.NewLine;
                HttpHeader = System.Text.Encoding.UTF8.GetBytes(httpHeaderText.ToCharArray());

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #8
0
        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);


            User    us1  = new User("random mail", 1);
            Chat    ch   = new Chat(us1);
            Message msg1 = new Message("first message", 1);
            Message msg2 = new Message("seccond message", 2);

            ch.Add(msg1);
            ch.Add(msg2);

            //Button b = new Button();
            //b.Content = "new Button";
            //mainCanvas.Children.Add(b);

            //ShowChat(chatWindow, ch);
        }
Example #9
0
 private void OnChatClosed(string room, string sender)
 {
     if (this._room == room)
     {
         _guiDispatcher.Invoke(() =>
         {
             Chat.Add($"{sender} has left the chat room.");
         });
     }
 }
Example #10
0
 public void OnNewMessage(string room, string msg)
 {
     _guiDispatcher.Invoke(() =>
     {
         if (this._room == room)
         {
             Chat.Add(msg);
         }
     });
 }
Example #11
0
        public static void HandleRpc(Hashtable hash)
        {
            if (oldHash.Equals(hash))
            {
                return;
            }

            int           count = 0;
            StringBuilder bld   = new StringBuilder();

            foreach (var set in allGameSettings)
            {
                set.ReadFromHashtable(hash);
                if (set.HasChangedReceived)
                {
                    set.ApplyReceived();
                    if (count > 0)
                    {
                        bld.Append("\n");
                    }

                    bld.Append(set.ToStringLocal());
                    count++;
                }
            }

            if (hash.ContainsKey("motd") && oldHash.ContainsKey("motd") &&
                oldHash["motd"] as string != hash["motd"] as string)
            {
                if (count > 0)
                {
                    bld.Append("\n");
                }

                bld.Append("MOTD: " + hash["motd"]);
                oldHash["motd"] = hash["motd"];
            }
            else if (hash.ContainsKey("motd") && oldHash.ContainsKey("motd") == false)
            {
                bld.AppendLine("MOTD: " + hash["motd"]);
                oldHash.Add("motd", hash["motd"]);
            }

            oldHash = new Hashtable();
            Dictionary <object, object> clone = (Dictionary <object, object>)hash.Clone();

            foreach (KeyValuePair <object, object> pair in clone)
            {
                oldHash.Add(pair.Key, pair.Value);
            }

            Chat.Add(bld.ToString());
            PhotonNetwork.SetModProperties();
        }
Example #12
0
        public static void SendRPC()
        {
            StringBuilder bld       = new StringBuilder();
            Hashtable     hash      = new Hashtable();
            int           count     = 0;
            int           countSend = 0;

            for (int i = 0; i < allGameSettings.Count; i++)
            {
                GameModeSetting set = allGameSettings[i];
                if (set.Enabled && !set.HasChanged)
                {
                    set.WriteToHashtable(hash);
                    count++;
                    continue;
                }
                if (set.HasChanged)
                {
                    bool oldstate = set.State;
                    set.Apply();
                    if (oldstate != set.State && set.State == false)
                    {
                        set.Save();
                        continue;
                    }
                    set.WriteToHashtable(hash);
                    if (countSend > 0)
                    {
                        bld.Append("\n");
                    }
                    bld.Append(set.ToStringLocal());
                    set.Save();
                    count++;
                    countSend++;
                }
            }
            if (count <= 0)
            {
                return;
            }
            if (InfectionMode.Enabled)
            {
                InfectionUpdate();
            }
            if (TeamMode.Enabled)
            {
                SendTeamInfo();
            }
            FengGameManagerMKII.FGM.BasePV.RPC("settingRPC", PhotonTargets.Others, new object[] { hash });
            if (bld.ToString() != string.Empty)
            {
                Chat.Add(bld.ToString());
            }
        }
Example #13
0
File: Form1.cs Project: inrg/KryX2
        private void button1_Click(object sender, EventArgs e)
        {
            //no keys, dont proceed

            int keyCount   = CDKeys.ReturnListCount();
            int proxyCount = Proxies.ReturnListCount();

            if (keyCount == 0)
            {
                Chat.Add(Color.Yellow, "No cdkeys. Connection stopped." + Environment.NewLine);
                return;
            }
            if (proxyCount == 0)
            {
                Chat.Add(Color.Yellow, "No proxies. Connection stopped." + Environment.NewLine);
                return;
            }

            //determine max number of socks allowed
            int socks      = UserSettings.MaxClients;
            int perProxy   = UserSettings.ClientsPerProxy;
            int maxSockets = (perProxy * proxyCount);

            if (socks > maxSockets)
            {
                socks = maxSockets;
            }

            if (socks > keyCount)
            {
                socks = keyCount;
            }

            if (socks == 0)
            {
                Chat.Add(Color.Yellow, "Bot count cannot be zero. Connection stopped." + Environment.NewLine);
                return;
            }

            if (!GeneratedSettings.ConstructHeaders(UserSettings.ServerName))
            {
                Chat.Add(Color.Yellow, "Could not validate server. Connection stopped." + Environment.NewLine);
                return;
            }

            GeneratedSettings.BotActive = true;

            ConnectedBar.SetTotalSockets(socks);

            Chat.Add(Color.White, "Loading " + socks + " sockets." + Environment.NewLine);

            SocketActions.SpawnAndConnectClients(socks);
        }
Example #14
0
        internal static void ReconnectClient(ClientSocket cs, bool newCdKey = false, bool newProxy = false)
        {
            if (GeneratedSettings.BotActive == false)
            {
                return;
            }

            //always use new proxy, probably safer/more reliable for all clients to load
            newProxy = true;

            DisconnectClient(cs);

            //if key was marked as bad get a new one no matter what
            if (cs.CDKeyBlacklisted)
            {
                newCdKey            = true;
                cs.CDKeyBlacklisted = false;
            }

            if (newCdKey)
            {
                if (!CDKeys.CycleCDKey(cs))
                {
                    cs.Active = false;
                    Debug.Print("CDKeys are out");
                    return;
                }
            }

            if (newProxy)
            {
                if (!Proxies.CycleProxy(cs))
                {
                    cs.Active = false;
                    Debug.Print("Proxies are out");
                    Chat.Add(Color.Red, "Proxies are out" + Environment.NewLine);
                    return;
                }
            }

            RelayConnectClient(cs);
            //cs.ConnectClient(); /r// semaphore
        }
Example #15
0
        public override void WarnIfNecessary(Chat chat)
        {
            if (!isIntelRenderer)
            {
                return;
            }

            chat.Add("&cIntel graphics cards are known to have issues with the OpenGL build.");
            chat.Add("&cVSync may not work, and you may see disappearing clouds and map edges.");
            chat.Add("    ");
            chat.Add("&cFor Windows, try downloading the Direct3D 9 build as it doesn't have");
            chat.Add("&cthese problems. Alternatively, the disappearing graphics can be");
            chat.Add("&cpartially fixed by typing \"/client render legacy\" into chat.");
        }
Example #16
0
 private void checkIfBeingCapture()
 {
     this.playerOn = false;
     this.titanOn  = false;
     GameObject[] array  = GameObject.FindGameObjectsWithTag("Player");
     GameObject[] array2 = GameObject.FindGameObjectsWithTag("titan");
     for (int i = 0; i < array.Length; i++)
     {
         if (Vector3.Distance(array[i].transform.position, base.transform.position) < this.hitTestR)
         {
             this.playerOn = true;
             if (this.state == CheckPointState.Human && array[i].GetPhotonView().IsMine)
             {
                 if (FengGameManagerMKII.FGM.checkpoint != base.gameObject)
                 {
                     FengGameManagerMKII.FGM.checkpoint = base.gameObject;
                     Chat.Add("<color=#A8FF24>Respawn point changed to point" + this.id + "</color>");
                 }
                 break;
             }
         }
     }
     for (int i = 0; i < array2.Length; i++)
     {
         if (Vector3.Distance(array2[i].transform.position, base.transform.position) < this.hitTestR + 5f)
         {
             if (!array2[i].GetComponent <TITAN>() || !array2[i].GetComponent <TITAN>().hasDie)
             {
                 this.titanOn = true;
                 if (this.state == CheckPointState.Titan && array2[i].GetPhotonView().IsMine&& array2[i].GetComponent <TITAN>() && array2[i].GetComponent <TITAN>().nonAI)
                 {
                     if (FengGameManagerMKII.FGM.checkpoint != base.gameObject)
                     {
                         FengGameManagerMKII.FGM.checkpoint = base.gameObject;
                         Chat.Add("<color=#A8FF24>Respawn point changed to point" + this.id + "</color>");
                     }
                     break;
                 }
             }
         }
     }
 }
Example #17
0
        public static void HandleRPC(Hashtable hash)
        {
            if (oldHash.Equals(hash))
            {
                return;
            }
            int           count = 0;
            StringBuilder bld   = new StringBuilder();

            for (int i = 0; i < allGameSettings.Count; i++)
            {
                GameModeSetting set = allGameSettings[i];
                set.ReadFromHashtable(hash);
                if (set.HasChangedReceived)
                {
                    set.ApplyReceived();
                    if (count > 0)
                    {
                        bld.Append("\n");
                    }
                    bld.Append(set.ToStringLocal());
                    count++;
                }
            }
            if (hash.ContainsKey("motd") && oldHash.ContainsKey("motd") && oldHash["motd"] as string != hash["motd"] as string)
            {
                if (count > 0)
                {
                    bld.Append("\n");
                }
                bld.Append("MOTD: " + hash["motd"].ToString());
            }
            oldHash = new Hashtable();
            Dictionary <object, object> clone = (Dictionary <object, object>)hash.Clone();

            foreach (KeyValuePair <object, object> pair in clone)
            {
                oldHash.Add(pair.Key, pair.Value);
            }
            Chat.Add(bld.ToString());
        }
Example #18
0
        private static bool CreateNewClient()
        {
            ClientSocket cs = new ClientSocket();

            if (!Proxies.CycleProxy(cs))
            {
                Chat.Add(Color.Yellow, "Proxy is null" + Environment.NewLine);
                return(false);
            } //exit method due to no more proxies being available


            //set cdkey
            if (!CDKeys.CycleCDKey(cs))
            {
                Chat.Add(Color.Yellow, "CDKey is null" + Environment.NewLine);
                return(false);
            }

            cs.Active = true;
            _clientSockets.Add(cs);
            return(true);
        }
Example #19
0
        internal static void SpawnAndConnectClients(int count)
        {
            Task.Factory.StartNew(() =>
            {
                //reset clientsocket list
                _clientSockets.Clear();

                int i = 0;
                do
                {
                    if (!CreateNewClient())
                    {
                        Chat.Add(System.Drawing.Color.Yellow, "Failed to create all clients. " + i + " clients made.");
                        break;
                    }
                    //if couldnt create a new socket leave loop
                    i++;
                } while (i < count);

                //StartReconnectTimer();
                ConnectAllClients();
            });
        }
Example #20
0
        public override bool WarnIfNecessary(Chat chat)
        {
                        #if GL11
            chat.Add("&cYou are using the very outdated OpenGL backend.");
            chat.Add("&cAs such you may experience poor performance.");
            chat.Add("&cIt is likely you need to install video card drivers.");
                        #endif

            if (!isIntelRenderer)
            {
                return(false);
            }

            chat.Add("&cIntel graphics cards are known to have issues with the OpenGL build.");
            chat.Add("&cVSync may not work, and you may see disappearing clouds and map edges.");
            chat.Add("&cFor Windows, try downloading the Direct3D 9 build instead.");
            return(true);
        }
Example #21
0
        private string CreateSkypeGroup(string topic, string skypenames, string ticket, string data)
        {
            Skype4Sharp.Skype4Sharp mainSkype;
            SkypeCredentials        authCreds = new SkypeCredentials("*****@*****.**", "BIG4web1");

            //if (string.IsNullOrEmpty(skypenames))
            //    throw new HttpError(HttpStatusCode.NotFound, "Skype names are empty");
            mainSkype = new Skype4Sharp.Skype4Sharp(authCreds);
            //mainSkype.authTokens.SkypeToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEyIn0.eyJpYXQiOjE1MDIzNjY3NTUsImV4cCI6MTUwMjQ1MzE0Nywic2t5cGVpZCI6ImxpdmU6Ymlnd2ViYXBwc18xIiwic2NwIjo5NTgsImNzaSI6IjEiLCJjaWQiOiJkNTRiODlhNjYzY2JkYmM2IiwiYWF0IjoxNTAyMjAxMTA0fQ.BFXZgoiS7rhMLgOGgj3D71PBnUn3R4kRTK6t5NhoEwweYVHEzunI3KpoDK2ap66pX_8H2SW9GTUtswb-FYoNJ2gh_-2RnBlu2a8xDhQwTAkAxyppzwVWC_Zs1s2FBWCbPkaq5iuw9v7H8XWE_JabKW6rCjFbs7CYISGKiziXjY0WXizguYJeVVZxoEM7PZkamqGgA-eLfKGLf8Vw";
            mainSkype.authTokens.SkypeToken = GetSkypeToken(false);
            mainSkype.Login();
            Chat newChat = new Chat(mainSkype);
            //string chatId = newChat.CreateNew(skypenames);
            var chatId = CreateNew(mainSkype, "");//, skypenames);

            newChat.ID = chatId;
            if (string.IsNullOrEmpty(chatId))
            {
                throw new HttpError(HttpStatusCode.NotFound, "Cannot create group chat");
            }
            if (!chatId.StartsWith("19:"))
            {
                return(chatId);
            }
            //newChat.ID = "19:[email protected]";
            newChat.Type           = ChatType.Group;
            newChat.JoiningEnabled = true;
            newChat.Topic          = topic;
            var joinUrl = newChat.JoinUrl;

            joinUrl += "?" + chatId.Substring(3, chatId.IndexOf("@thread.skype") - 3);
            string          token    = "";
            string          new_data = "[]";
            List <UserData> users    = new List <UserData>();

            if (!string.IsNullOrWhiteSpace(data) && data.StartsWith("{"))
            {
                dynamic userdata = JsonConvert.DeserializeObject(data);
                token = (string)userdata.t;
                for (int i = 0; i < userdata.users.Count; i++)
                {
                    var user = new UserData((string)userdata.users[i].id, (string)userdata.users[i].skype, (string)userdata.users[i].name);
                    users.Add(user);
                    var chat_user = mainSkype.GetUser(user.skype);
                    user.name = chat_user.DisplayName;
                }
            }

            //sent invite(s) to following user(s) by email: Jon ()
            if (users.Count > 0)
            {
                new_data = JsonConvert.SerializeObject(users.ToArray());
            }
            data = $"{{\"t\":\"{token}\",\"users\":{new_data}}}";
            var message = newChat.SendMessage("setuser " + data, "28:8b270cdf-8d2a-41e7-bdb1-9108f3c220bd");

            newChat.DeleteMessage(message.ID);
            message = newChat.SendMessage(joinUrl, "28:8b270cdf-8d2a-41e7-bdb1-9108f3c220bd");
            newChat.DeleteMessage(message.ID);
            if (!string.IsNullOrWhiteSpace(ticket) && !string.IsNullOrWhiteSpace(token))
            {
                message = newChat.SendMessage(ticket, "28:8b270cdf-8d2a-41e7-bdb1-9108f3c220bd");
                newChat.DeleteMessage(message.ID);
            }

            if (!string.IsNullOrWhiteSpace(skypenames))
            {
                string[] usernames = skypenames.Split(',');
                foreach (var name in usernames)
                {
                    newChat.Add(name);
                }
            }
            else if (users.Count > 0)
            {
                foreach (var user in users)
                {
                    newChat.Add(user.skype);
                }
            }
            //newChat.HistoryEnabled = true;
            return(joinUrl);
        }
Example #22
0
 private void OnSendData(string name, string message)
 {
     Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { Chat.Add(name + " : " + message); }));
     Message = "";
     //Chat.Add(message);
 }
Example #23
0
        private static void Parse0x50(ClientSocket cs, Receiver receiver)
        {
            receiver.SkipLength(4); // Int32 logonType = receiver.GetInt32();
            cs.ServerToken = receiver.GetInt32();
            cs.ClientToken = receiver.GetInt32();
            receiver.SkipLength(8); // long mpqFiletime = receiver.GetInt64();
            string mpqFilename = receiver.GetNTString();

            byte[] checksumFormula = receiver.GetNTBytes();

            int crResult = -1, exeVer = -1, checkRevisionPass = 0;

            mpqFilename = mpqFilename.Substring(0,
                                                (mpqFilename.Length - 4)) + ".dll";

            byte[] exeInfo = CheckRevision.DoLockdownCheckRevision(checksumFormula,
                                                                   KryX2.Settings.GeneratedSettings.HashFiles,
                                                                   KryX2.Settings.GeneratedSettings.LockdownPath, mpqFilename, KryX2.Settings.GeneratedSettings.StarBin,
                                                                   ref exeVer, ref crResult);

            if (crResult == -1 || exeVer == -1)
            //if (checkRevisionPass != 1 || exeVer == 0)
            {
                //bad hashes perhaps
                Chat.Add(Color.Yellow, "CheckrevisionPass " + checkRevisionPass.ToString() + NewLine);
                Chat.Add(Color.White, "Exeversoin " + exeVer.ToString() + Environment.NewLine);
                //Chat.Add(Color.White, "No hashes or cr result is bad " + crResult + " / " + exeVer + NewLine);
                return;
            }


            CdKey cdkey;

            byte[] key1Hash;
            try
            {
                cdkey    = new CdKey(cs.CdKey);
                key1Hash = cdkey.GetHash(cs.ClientToken, cs.ServerToken);
            }
            catch
            {
                Chat.Add(Color.Yellow, "Couldn't decode key." + NewLine);
                return;
            }

            Builder builder = new Builder();

            builder.InsertInt32(cs.ClientToken);
            builder.InsertInt32(exeVer);
            builder.InsertInt32(crResult);
            builder.InsertInt32(1);  //keys used
            builder.InsertInt32(0);  //spawn?
            builder.InsertInt32(13); //key length
            builder.InsertInt32(cdkey.Product);
            builder.InsertInt32(cdkey.Value1);
            builder.InsertInt32(0);
            builder.InsertByteArray(key1Hash);
            builder.InsertByteArray(exeInfo);
            builder.InsertByte(0);
            builder.InsertNTString(RandomName()); //in use by
            builder.SendPacket(cs, 0x51);
        }
Example #24
0
        //loads all proxy list
        internal static void ImportProxylist()
        {
            //clear proxy list, reset take from index
            _proxyList.Clear();
            _proxyIndex = 0;

            string[] paths;
            paths = new string[]
            {
                GeneratedSettings.AppDirectory + @"\Text\Proxies.txt",
                GeneratedSettings.AppDirectory + @"\Text\ProxiesHttp.txt",
                GeneratedSettings.AppDirectory + @"\Text\ProxiesS4.txt",
                GeneratedSettings.AppDirectory + @"\Text\ProxiesS5.txt"
            };

            ProxyType[] types;
            types = new ProxyType[]
            {
                ProxyType.Default,
                ProxyType.Http,
                ProxyType.Socks4,
                ProxyType.Socks5
            };


            for (int i = 0; i < paths.Length; i++)
            {
                string    path     = paths[i];
                string    fileText = null; //default
                ProxyType type     = types[i];

                if (File.Exists(path))
                {
                    StreamReader FileReader = new StreamReader(path);
                    while ((fileText = FileReader.ReadLine()) != null)
                    {
                        try
                        {
                            fileText = TidyText(fileText);

                            if (!string.IsNullOrEmpty(fileText))
                            { //filetext still contains data, lets proceed
                                //set proxy type from the beginning if reading from a specified type file
                                switch (type)
                                {
                                case ProxyType.Default:
                                    break;

                                case ProxyType.Http:
                                    fileText = fileText + "@http";
                                    break;

                                case ProxyType.Socks4:
                                    fileText = fileText + "@s4";
                                    break;

                                case ProxyType.Socks5:
                                    fileText = fileText + "@s5";
                                    break;
                                }

                                //pass string to proxy parser
                                ProxyDetails proxyInfo = new ProxyDetails(); //initialize
                                ProxyParser  parser    = new ProxyParser();
                                parser.Engage(fileText);                     //presets some valus on our sorter

                                proxyInfo.Address = parser.ReturnAddress();

                                //if valid ip proceed
                                if (proxyInfo.Address != null)
                                {
                                    //if already in list continue past
                                    if (ReturnProxyIndex(proxyInfo.Address) != -1)
                                    {
                                        continue;
                                    }
                                    proxyInfo.Port      = parser.ReturnPort();
                                    proxyInfo.Type      = parser.ReturnType();
                                    proxyInfo.UsedCount = 0;
                                    //bool proxyFound = _proxyList.Exists(IPAddress => IPAddress.Address == proxyInfo.Address);
                                    //if (!proxyFound)
                                    //{
                                    _proxyList.Add(proxyInfo);
                                }
                            }
                        } //try end
                        finally
                        {
                            //do nothing
                        } //try set scanlist entry
                    }
                    FileReader.Close();
                }
            }

            Chat.Add(Color.Silver, "Loaded " + _proxyList.Count + " proxies." + Environment.NewLine);
        }
Example #25
0
        public static void SendRpc()
        {
            StringBuilder bld       = new StringBuilder();
            Hashtable     hash      = new Hashtable();
            int           count     = 0;
            int           countSend = 0;

            foreach (var set in allGameSettings)
            {
                if (set.Enabled && !set.HasChanged)
                {
                    set.WriteToHashtable(hash);
                    count++;
                    continue;
                }

                if (set.HasChanged)
                {
                    bool oldstate = set.State;
                    set.Apply();
                    if (oldstate != set.State && set.State == false)
                    {
                        set.Save();
                        continue;
                    }

                    set.WriteToHashtable(hash);
                    if (countSend > 0)
                    {
                        bld.Append("\n");
                    }

                    bld.Append(set.ToStringLocal());
                    set.Save();
                    count++;
                    countSend++;
                }
            }

            if (count <= 0)
            {
                if (Motd.Value.Trim().Length > 0 && oldHash["motd"] as string != Motd.Value.Trim())
                {
                    oldHash["motd"] = Motd.Value;
                    FengGameManagerMKII.FGM.BasePV.RPC("Chat", PhotonTargets.All, "MOTD: " + Motd.Value, string.Empty);
                }
                return;
            }

            if (InfectionMode.Enabled)
            {
                InfectionUpdate();
            }

            //if (TeamMode.Enabled)
            //{
            //    SendTeamInfo();
            //}
            FengGameManagerMKII.FGM.BasePV.RPC("settingRPC", PhotonTargets.Others, hash);

            if (Motd.Value.Trim().Length > 0 && oldHash["motd"] as string != Motd.Value.Trim())
            {
                oldHash["motd"] = Motd.Value;
                FengGameManagerMKII.FGM.BasePV.RPC("Chat", PhotonTargets.Others, "MOTD: " + Motd.Value, string.Empty);
            }
            if (bld.ToString() != string.Empty)
            {
                Chat.Add(bld.ToString());
            }
        }
Example #26
0
 public static void Add(this Chat targetChat, User targetUser)
 {
     targetChat.Add(targetUser.Username);
 }
Example #27
0
 public static async Task Add(this Chat targetChat, User targetUser)
 {
     await targetChat.Add(targetUser.Username);
 }