예제 #1
0
        // Get group-range
        int[] GroupPos(string group = "")
        {
            if (group == "")
            {
                return(new[] { 0, 0 });// No Group.
            }

            string lowerline;

            int[] ret = new[] { -1, -1 };
            for (int i = 0; i < lines.Length; i++)
            {
                lowerline = lines[i].ToLower();

                if (ret[0] < 0)
                {
                    if (lowerline.Contains("[" + group.ToLower() + "]"))
                    {
                        ret[0] = i; // Group found.
                    }
                }
                else
                {
                    if (lowerline.StartsWith("[") || i == lines.Length - 1) // next group or end of file.
                    {
                        ret[1] = --i;                                       // End of group found.
                        return(ret);
                    }
                }
            }
            WriteConsole.WriteLine($"[INI_FILE_ERROR]: Unable to find Group '" + group + "' in configuration file '" + fn + "'.");
            return(ret); // Group not found.
        }
예제 #2
0
        public ChannelCollection(IniFile Ini)
        {
            //GameInformation gameInfo;
            byte i;

            try
            {
                var LobbyCount = Ini.ReadByte("Channel", "ChannelCount", 0);
                for (i = 1; i <= LobbyCount; i++)
                {
                    string name    = Ini.ReadString("Channel", $"ChannelName_{i}", $"#Lobby {i}");
                    ushort maxuser = Ini.ReadUInt16("Channel", $"ChannelMaxUser_{i}", 100);
                    byte   Id      = Ini.ReadByte("Channel", $"ChannelID_{i}", i);
                    uint   flag    = Ini.ReadUInt32("Channel", $"ChannelFlag_{i}", 2048);
                    var    lobby   = new Channel(name, maxuser, Id, flag);
                    Add(lobby);
                }
            }
            catch
            { }
            finally
            {
                if (Ini != null)
                {
                    Ini.Dispose();
                }
            }

            WriteConsole.WriteLine("[SERVER_SYSTEM_CHANNEL]: Canais foram carregados !", ConsoleColor.Green);
        }
예제 #3
0
        public void AdicionarItemPedido(ItemPedido item)
        {
            WriteConsole write = new WriteConsole();

            ListItensPedidos.Add(write.WriteOrder(item));
            Console.WriteLine($"Item {item.CodItemPedido} adicionado ao pedido!");
        }
예제 #4
0
        public void HandleRequestPacket(PangyaPacketsEnum PacketID, Packet ProcessPacket)
        {
            WriteConsole.WriteLine($"[PLAYER_REQUEST_PACKET] --> [{PacketID}, {this.GetLogin}]");
            switch (PacketID)
            {
            case PangyaPacketsEnum.PLAYER_LOGIN:
                HandlePlayerLogin(ProcessPacket);
                break;

            case PangyaPacketsEnum.PLAYER_SELECT_SERVER:
            {
                var ID = ProcessPacket.ReadInt32();
                WriteConsole.WriteLine($"[PLAYER_SELECT_SERVER] --> [{ID}, {this.GetLogin}]");
                this.SendGameAuthKey();
            }
            break;

            case PangyaPacketsEnum.PLAYER_DUPLCATE_LOGIN:
                this.HandleDuplicateLogin();
                break;

            case PangyaPacketsEnum.PLAYER_SET_NICKNAME:
                this.CreateCharacter(ProcessPacket);
                break;

            case PangyaPacketsEnum.PLAYER_CONFIRM_NICKNAME:
                this.NicknameCheck(ProcessPacket);
                break;

            case PangyaPacketsEnum.PLAYER_SELECT_CHARACTER:
                RequestCharacaterCreate(ProcessPacket);
                break;

            case PangyaPacketsEnum.PLAYER_RECONNECT:
                HandlePlayerReconnect(ProcessPacket);
                break;

            case PangyaPacketsEnum.NOTHING:
            default:
            {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < ProcessPacket.GetRemainingData.Length; i++)
                {
                    if ((i + 1) == ProcessPacket.GetRemainingData.Length)
                    {
                        sb.Append("0x" + ProcessPacket.GetRemainingData[i].ToString("X2") + "");
                    }
                    else
                    {
                        sb.Append("0x" + ProcessPacket.GetRemainingData[i].ToString("X2") + ", ");
                    }
                }

                WriteConsole.WriteLine("{Unknown Packet} -> " + sb.ToString(), ConsoleColor.Red);
                Disconnect();
            }
            break;
            }
        }
예제 #5
0
 public Server(string localIPAddress, int listenPort) : base(localIPAddress, listenPort)
 {
     Options = new ServerOptions(Flags.ServerOptionFlag.MAINTENANCE_FLAG_PAPELSHOP, 1);
     IFFEntry.Load();
     WriteConsole.WriteLine($"[GAMESERVER]: START {localIPAddress}:{listenPort}", ConsoleColor.Green);
     LobbyList = new LobbyCollection(new Lobby(name: "#Lobby Test", maxPlayers: 100, id: 1, flag: 0));
 }
예제 #6
0
        /// <summary>
        /// Construtor
        /// </summary>
        /// <param name="ip">IP do servidor (Local ou Global)</param>
        /// <param name="port">Porta</param>
        /// <param name="maxConnections">
        /// Número máximo de conexões
        /// Quando o Player se conecta ao Game-server, automaticamente ele é desconectado do LoginServer pois não necessita mais desta comunicação
        /// </param>
        public AuthServer()
        {
            try
            {
                var Ini = new IniFile(ConfigurationManager.AppSettings["Config"]);

                Data = new ServerSettings()
                {
                    Name       = Ini.ReadString("Config", "Name", "AuthServer"),
                    Version    = Ini.ReadString("Config", "Version", "SV_AT_Release_2.0"),
                    UID        = Ini.ReadUInt32("Config", "UID", 7997),
                    MaxPlayers = Ini.ReadUInt32("Config", "MaxPlayers", 3000),
                    Port       = Ini.ReadUInt32("Config", "Port", 7997),
                    IP         = Ini.ReadString("Config", "IP", "127.0.0.1"),
                    Type       = AuthClientTypeEnum.AuthServer
                };
                _server = new TcpListener(IPAddress.Parse(Data.IP), (int)Data.Port);

                db = new PangyaEntities();
            }
            catch (Exception erro)
            {
                WriteConsole.WriteLine($"ERRO_START: {erro.Message}");
                Console.ReadKey();
                Environment.Exit(0);
            }
        }
예제 #7
0
 public void Start(IPAddress IP, int Port)
 {
     try
     {
         if (ServerType == ServerTypeEnum.Login)
         {
             TcpLogin.Connect(IP, Port);
             OnClient = TcpLogin;
         }
         else if (ServerType == ServerTypeEnum.Game)
         {
             TcpGame.Connect(IP, Port);
             OnClient = TcpGame;
         }
         else if (ServerType == ServerTypeEnum.Message)
         {
             TcpMessenge.Connect(IP, Port);
             OnClient = TcpMessenge;
         }
         running = true;
         //Inicia Thread para escuta de OnClientes
         var WaitConnectionsThread = new Thread(new ThreadStart(HandleClient));
         WaitConnectionsThread.Start();
     }
     catch
     {
         WriteConsole.WriteLine("[BOT_EXCEPTION]: SERVER OFFLINE", ConsoleColor.Red);
         Console.ReadKey();
         Environment.Exit(0);
     }
 }
예제 #8
0
        public override void DisconnectPlayer(Player Player)
        {
            var Client = (GPlayer)Player;

            if (Client != null && Client.Connected)
            {
                var PLobby = Client.Lobby;

                if (PLobby != null)
                {
                    PLobby.RemovePlayer(Client);
                }
                Client.PlayerLeave();   //{ push player to offline }

                Players.Remove(Client); //{ remove from player lists }
                Player.Connected = false;
                Player.Dispose();
                Player.Tcp.Close();
            }
            WriteConsole.WriteLine(string.Format("[PLAYER_DISCONNECT]: {0} is disconnected", Client?.GetLogin), ConsoleColor.Red);

            UpdateServer();
            Console.Title = $"Pangya Fresh Up! GameServer - {Data.Name} - Players: {Players.Count} ";
            new GameTools.ClearMemory().FlushMemory();
        }
예제 #9
0
        public void PlayMemorialGacha(GPlayer player, Packet packet)
        {
            uint RandInt, TypeID;

            TypeID = packet.ReadUInt32();

            if (!IffEntry.MemorialCoin.IsExist(TypeID))
            {
                player.SendResponse(new byte[] { 0x64, 0x02, 0x85, 0x073, 0x55, 0x00 });
                WriteConsole.WriteLine("PlayerPlayerMemorialGacha: coin was not found", ConsoleColor.Red);
            }

            var RemoveData = player.Inventory.Remove(TypeID, 1);

            if (!RemoveData.Status)
            {
                player.SendResponse(new byte[] { 0x64, 0x02, 0x85, 0x073, 0x55, 0x00 });
                WriteConsole.WriteLine("PlayerPlayerMemorialGacha: Player don''t have that coin TypeID", ConsoleColor.Red);
            }
            RandInt = Rand.NextUInt(150);

            if (RandInt <= 20)
            {
                GetRareItem(player, TypeID);
            }
            else
            {
                GetNormalItem(player, TypeID);
            }
        }
예제 #10
0
        public override void ServerStart()
        {
            try
            {
                Data.InsertServer();
                _isRunning = true;
                _server.Start((int)Data.MaxPlayers);

                if (DateTime.Now == EndTime || (DateTime.Now.Month == EndTime.Month && DateTime.Now.Day == EndTime.Day))
                {
                    _isRunning = false;
                }
                WriteConsole.WriteLine($"[SERVER_START]: PORT {Data.Port}", ConsoleColor.Green);
                //Inicia os Lobby's
                Ini = new IniFile(ConfigurationManager.AppSettings["ChannelConfig"]);

                LobbyList = new ChannelCollection(Ini);
                //Inicia a leitura dos arquivos .iff
                new IffBaseManager();//is 100% work? test for iff
                //Inicia Thread para escuta de clientes
                var WaitConnectionsThread = new Thread(new ThreadStart(HandleWaitConnections));
                WaitConnectionsThread.Start();
            }
            catch (Exception erro)
            {
                new GameTools.ClearMemory().FlushMemory();
                WriteConsole.WriteLine($"[ERROR_START]: {erro.Message}");
                Console.ReadKey();
                Environment.Exit(1);
            }
        }
예제 #11
0
        public static void Menu()
        {
            Console.Clear();
            WriteConsole.AsciiText("ProxyStar", true, true, ConsoleColor.Cyan);
            WriteConsole.ColorText($"Welcome to ProxyStar V1.0.0!\n\nRead {ProxyQueue.Count.ToString()} Proxies from proxies.txt\n", ConsoleColor.Cyan);
            WriteConsole.ColorText("Menu:\n\n1) Check HTTP(s) proxies\n2) Check SOCKS4 proxies\n3) Check SOCKS5 proxies\n\nInput: ", ConsoleColor.Cyan);

            var UserInput = Console.ReadKey();

            if (UserInput.Key == ConsoleKey.D1)
            {
                type = ProxyTypes.Http;
            }
            else if (UserInput.Key == ConsoleKey.D2)
            {
                type = ProxyTypes.Socks4;
            }
            else if (UserInput.Key == ConsoleKey.D3)
            {
                type = ProxyTypes.Socks5;
            }
            else
            {
                Menu();
            }

            Console.Clear();
            WriteConsole.ColorText($"Loaded: {ProxyQueue.Count.ToString()} Proxies from proxies.txt\n", ConsoleColor.Cyan);
            Console.WriteLine("Threads: ");
            threads = Convert.ToInt32(Console.ReadLine());
            CheckProxy();
        }
예제 #12
0
        public void ExecuteTest()
        {
            string expectedMessage = "#Test Message123";

            WriteConsole wc = new WriteConsole();

            wc.Message    = expectedMessage;
            wc.AddNewline = true;

            StringWriter sw = new StringWriter();

            System.Console.SetOut(sw);

            wc.Execute();

            Assert.AreEqual(expectedMessage + Environment.NewLine, sw.ToString());


            // cleanup
            StreamWriter standardOutput = new StreamWriter(System.Console.OpenStandardOutput());

            standardOutput.AutoFlush = true;

            System.Console.SetOut(standardOutput);
        }
예제 #13
0
        public static void CharacaterCreate(this LPlayer session, Packet ClientPacket)
        {
            if (!ClientPacket.ReadUInt32(out uint CHAR_TYPEID))
            {
                return;
            }
            if (!ClientPacket.ReadUInt16(out ushort HAIR_COLOR))
            {
                return;
            }

            try
            {
                WriteConsole.WriteLine($"[PLAYER_CREATE_CHARACTER]: {IFFEntry.GetIff.GetName(CHAR_TYPEID).ToUpper()}");
                if (string.IsNullOrEmpty(session.UserInfo.GetNickname) == false)
                {
                    session.LoginSucess();
                }
                else
                {
                    session.Disconnect();
                    return;
                }
            }
            catch
            {
                session.Disconnect();
            }
        }
예제 #14
0
        public void Handle(ProjectG client, MessengerResponseEnum packetID, ClientPacket packet)
        {
            WriteConsole.WriteLine($"[BOT_LOGIN_PACKET]: {packetID}", ConsoleColor.Cyan);
            switch (packetID)
            {
            case MessengerResponseEnum.PLAYER_CONNECTION:
            {
                var key = packet.Message[8];

                Console.WriteLine("Key =>" + key);

                client.GetKey = key;

                client.Response.Write(new byte[] { 0x12, 0x00 });
                client.Response.Write(client.GetUID);
                client.Response.Write(client.GetLogin);
            }
            break;

            default:
            {
                WriteConsole.WriteLine($"[BOT_MESSENGER_PACKETLOG]: {packet.GetLog()}", ConsoleColor.Cyan);
                packet.Save();
            }
            break;
            }
        }
예제 #15
0
 public override void OnException(PClient player, Exception ex)
 {
     WriteConsole.WriteLine("[BOT_EXCEPTION]: {0}", ex.ToString(), ConsoleColor.Red);
     OnDisconnectBot(player);
     Console.ReadKey();
     Environment.Exit(0);
 }
예제 #16
0
        public override PClient OnConnectBot(TcpClient tcp)
        {
            ProjectG player = null;

            if (ServerType == FakeProjectG.Defines.ServerTypeEnum.Login)
            {
                player = new ProjectG(tcp)
                {
                    Conn = this
                };
                Clients.Add(player);
            }
            else if (ServerType == FakeProjectG.Defines.ServerTypeEnum.Game)
            {
                player = (ProjectG)Clients.First();

                Clients.RemoveAt(0);

                player.Tcp        = tcp;
                player.Conn       = this;
                player.ServerType = FakeProjectG.Defines.ServerTypeEnum.Game;
                Clients.Add(player);
            }
            else if (ServerType == FakeProjectG.Defines.ServerTypeEnum.Message)
            {
                player = (ProjectG)Clients.First();
                Clients.RemoveAt(0);
                player.Tcp        = tcp;
                player.Conn       = this;
                player.ServerType = FakeProjectG.Defines.ServerTypeEnum.Message;
                Clients.Add(player);
            }
            WriteConsole.WriteLine($"[BOT_{player.ServerType}_CONNECTED]: Sucess", ConsoleColor.Green);
            return(player);
        }
예제 #17
0
 public void ShowChannel()
 {
     foreach (var lobby in this)
     {
         WriteConsole.WriteLine($"[SHOW_LOBBY_INFO]: LobbyPlayers [{lobby.Players.Count}/{lobby.MaxPlayers}] LobbyID [{lobby.Id}] LobbyName [{lobby.Name}]", ConsoleColor.Green);
     }
 }
예제 #18
0
        public async Task <String> NewLogin(String login, String pass)
        {
            try
            {
                if (WebRequestHelper.CheckNet() == false)
                {
                    return(null);
                }

                WriteConsole.WriteInLine("Logando ", 1, 1);

                this.login = login;
                this.pass  = pass;

                if ((IdAccess = await LoginAsync("http://gspn6.samsungcsportal.com/")) != null)
                {
                    return(IdAccess);
                }

                return(null);
            }
            catch
            {
                throw;
            }
        }
예제 #19
0
    public void CadastrarProduto(Produto p)
    {
        WriteConsole write = new WriteConsole();

        listProducts.Add(write.WriteProduct(p));

        Console.WriteLine($"O produto {p.NomeProduto} ({p.CodProduto}) foi adicionado com sucesso.");
    }
예제 #20
0
        private void ClientConnected(AuthClient Server)
        {
            //Chama evento OnClientConnected
            OnClientConnected?.Invoke(Server);

            WriteConsole.WriteLine($"[CLIENT_CONNECTED]: {Server.Data.Name} | Type: {Server.Data.Type}", ConsoleColor.Green);
            UpdateServer();
        }
예제 #21
0
        private void Write(DateTime dtLoggedTime, string strText)
        {
            WriteLogLine(String.Format("[{0}] {1}", dtLoggedTime.ToString("HH:mm:ss"), strText.Replace("{", "{{").Replace("}", "}}")));

            if (WriteConsole != null)
            {
                FrostbiteConnection.RaiseEvent(WriteConsole.GetInvocationList(), dtLoggedTime, strText);
            }
        }
예제 #22
0
        //02 : The Room is full
        //03 : The Room is not exist
        //04 : wrong password
        //05 : you cannot get in this room level
        //07 : can not create game
        //08 : game is in progress
        public void PlayerCreateGame(GPlayer player, Packet packet)
        {
            GameInformation GameData;

            GameData = new GameInformation
            {
                Unknown1    = packet.ReadByte(),            //1
                VSTime      = packet.ReadUInt32(),          //5/
                GameTime    = packet.ReadUInt32(),          //9
                MaxPlayer   = packet.ReadByte(),            //10
                GameType    = (GAME_TYPE)packet.ReadByte(), //11
                HoleTotal   = packet.ReadByte(),            //12
                Map         = packet.ReadByte(),            //13
                Mode        = packet.ReadByte(),            //14
                NaturalMode = packet.ReadUInt32(),          //18
            };

            //Course = 63, hole repeted = 68, chip-in = 73
            if (GameData.GameType == GAME_TYPE.HOLE_REPEAT && packet.GetSize == 68)
            {
                packet.Skip(5);
                GameData.HoleNumber  = 1;
                GameData.LockHole    = 7;
                GameData.NaturalMode = 0;
                GameData.Mode        = (byte)TGAME_MODE.GAME_MODE_REPEAT;
            }
            if (GameData.GameType == GAME_TYPE.HOLE_REPEAT && packet.GetSize == 63)
            {
                GameData.HoleNumber = 0;
                GameData.LockHole   = 0;
            }
            packet.ReadPStr(out GameData.Name);
            packet.ReadPStr(out GameData.Password);
            packet.ReadUInt32(out GameData.Artifact);

            GameData.GP        = false;
            GameData.GPTypeID  = 0;
            GameData.GPTypeIDA = 0;
            GameData.GPTime    = 0;
            // { GM Event } && { Chat Room }
            if (player.GetCapability == 4 && GameData.MaxPlayer >= 100 || GameData.GameType == GAME_TYPE.CHAT_ROOM && player.GetCapability == 4)
            {
                GameData.GMEvent = true;
            }

            var GameHandle = CreateGame(player, GameData);

            if (GameHandle != null)
            {
                WriteConsole.WriteLine($"[CREATE ROOM]: GAMERESULT = Sucess, Type: {GameData.GameType}", ConsoleColor.Green);
            }
            else
            {
                WriteConsole.WriteLine($"[CREATE ROOM]: GAMERESULT = Failed, Type: {GameData.GameType} ", ConsoleColor.Red);
            }
        }
예제 #23
0
        private static void Server_OnPacketReceived(Player player, Packet packet)
        {
            var Client = (GPlayer)player;

            if ((TGAMEPACKET)packet.Id != TGAMEPACKET.PLAYER_LOGIN)
            {
                WriteConsole.WriteLine($"[PLAYER_CALL_PACKET]: [{(TGAMEPACKET)packet.Id},{player.GetLogin}]", ConsoleColor.Cyan);
            }
            Client.HandleRequestPacket((TGAMEPACKET)packet.Id, packet);
        }
예제 #24
0
        public static void GoToMMPage(string eventid)
        {
            Report.Case("GMM MMPage", "Go to MM Page and search the event we created");
            var gmmMenu   = new GMMMenu(driver);
            var gmmMMPage = new GMMMMPage(driver);

            #region (1) Go to MM Page
            ElementVerify.Exist(driver, gmmMenu.MarketManagement).ClickOnIt("Market Management");
            ElementVerify.Exist(driver, gmmMenu.MarketManagementNormal).ClickOnIt("Market Management (Normal)");
            Thread.Sleep(1000);
            #endregion
            #region (2) Choose Sport / Competition / Event ...
            // Sport
            ElementVerify.Exist(driver, gmmMMPage.SportCriteria).ClickOnIt("Sport");
            ElementVerify.Exist(driver, gmmMMPage.SportPopup);
            ElementVerify.Exist(driver, gmmMMPage.SportList);
            ElementVerify.Exist(driver, By.XPath("//label[contains(text() ,'" + sport + "')]")).ClickOnIt(sport);
            ElementVerify.Exist(driver, gmmMMPage.SportSubmit).ClickOnIt("SubmitSport");

            // Odds Page (In-Play)
            ElementVerify.Exist(driver, gmmMMPage.OddsPageInPlay);
            Thread.Sleep(2000);
            ElementVerify.Exist(driver, gmmMMPage.OddsPageDropdown).SelectByText("All Market (In Play)", "All Market (In Play)");

            // Competition
            wait.Until(ExpectedConditions.ElementToBeClickable(gmmMMPage.SearchButton));
            ElementVerify.Exist(driver, gmmMMPage.CompetitionCriteria).ClickOnIt("Competition Filter");
            ElementVerify.Exist(driver, gmmMMPage.ComptitionSelectAll).ClickOnIt("Deselect All");
            ElementVerify.Exist(driver, By.XPath("//label[contains(text() , '" + competition + "')]")).ClickOnIt(competition);
            ElementVerify.Exist(driver, gmmMMPage.CompetitionSubmit).ClickOnIt("Confirm Competition");

            // Event
            wait.Until(ExpectedConditions.ElementToBeClickable(gmmMMPage.SearchButton));
            ElementVerify.Exist(driver, gmmMMPage.EventCriteria).ClickOnIt("Event Filter");
            ElementVerify.Exist(driver, gmmMMPage.EventTextbox).EnterText("EventID Textbox", eventid);
            ElementVerify.Exist(driver, gmmMMPage.EventSelectAll).ClickOnIt("Deselect All");
            ElementVerify.Exist(driver, By.Id("" + eventid + "")).ClickOnIt("Filter one event we created");
            ElementVerify.Exist(driver, gmmMMPage.EventSubmit).ClickOnIt("Confirm Event");

            // Filter Status (Skip for now)


            // Filter Date Range (Skip for now)
            // (1) Inplay events are no need to define range
            // (2) Pre Start events
            #endregion
            #region (3) Base on filters to search the event
            wait.Until(ExpectedConditions.ElementToBeClickable(gmmMMPage.SearchButton));
            ElementVerify.Exist(driver, gmmMMPage.SearchButton).ClickOnIt("SearchEvent");
            WriteConsole.Green(String.Format("Search Event id : {0} ({1})", eventid, sport));
            #endregion
            ElementVerify.Exist(driver, By.Id("evt" + eventid));
            Report.PrintScreen(driver);
        }
예제 #25
0
 public void AddItems(ItemRandom itemInfo)
 {
     if (itemInfo.Active)
     {
         this.Add(itemInfo);
     }
     else
     {
         WriteConsole.WriteLine("Falied To add {0} IsNoValid {1}", ConsoleColor.Red, new object[] { itemInfo.TypeId, itemInfo.Active });
     }
 }
예제 #26
0
 static void Main(string[] args)
 {
     if (!File.Exists("proxies.txt"))
     {
         WriteConsole.ColorText("Could not find proxies.txt! Make sure that proxies.txt is located in the root folder of this program!\n\n\n\n", ConsoleColor.Red);
     }
     else
     {
         Menu();
     }
 }
예제 #27
0
        public override void PlayerLoading(GPlayer player, Packet packet)
        {
            byte Process;

            Process = packet.ReadByte();

            Send(ShowGameLoading(player.ConnectionID, Process));
            player.GameInfo.Versus.LoadComplete = (Process * 10 >= 80);

            WriteConsole.WriteLine($"[PLAYER_LOADING]: {player.GetNickname}:{Process * 10}%");
        }
예제 #28
0
    public void RemoverProduto()
    {
        WriteConsole write = new WriteConsole();

        Produto RemoverProduto = listProducts.FirstOrDefault(delegate(Produto produto){
            return(produto.CodProduto == write.ConsoleBuscarID());
        });

        listProducts.Remove(RemoverProduto);

        Console.WriteLine($"O produto {RemoverProduto.NomeProduto} ({RemoverProduto.CodProduto}) foi removido com sucesso");
    }
예제 #29
0
        public void Write(string strFormat, params object[] arguments)
        {
            DateTime dtLoggedTime = DateTime.UtcNow.ToUniversalTime().AddHours(Client.Game.UtcOffset).ToLocalTime();
            string   strText      = String.Format(strFormat, arguments);

            WriteLogLine(String.Format("[{0}] {1}", dtLoggedTime.ToString("HH:mm:ss"), strText.Replace("{", "{{").Replace("}", "}}")));

            if (WriteConsole != null)
            {
                FrostbiteConnection.RaiseEvent(WriteConsole.GetInvocationList(), dtLoggedTime, strText);
            }
        }
예제 #30
0
        static void CheckProxy()
        {
            int ProxyCount = ProxyQueue.Count;
            var uri        = new Uri("https://api.ipify.org");

            Parallel.ForEach(ProxyQueue, new ParallelOptions {
                MaxDegreeOfParallelism = threads
            }, FProxy =>
            {
                try
                {
                    string[] proxy        = FProxy.Split(':'); string ip = proxy[0]; int port = Convert.ToInt32(proxy[1]);
                    var HttpClientHandler = new HttpClientHandler(); HttpClientHandler.UseProxy = true;
                    switch (type)
                    {
                    case ProxyTypes.Http:
                        HttpClientHandler.Proxy = new WebProxy($"http://{proxy[0]}:{proxy[1]}");
                        break;

                    case ProxyTypes.Socks4:
                        var Socks4Proxy         = new ProxyClient(ip, port, ProxyType.Socks4);
                        HttpClientHandler.Proxy = Socks4Proxy;
                        break;

                    case ProxyTypes.Socks5:
                        var Socks5Proxy         = new ProxyClient(ip, port, ProxyType.Socks5);
                        HttpClientHandler.Proxy = Socks5Proxy;
                        break;
                    }
                    var client = new HttpClient(HttpClientHandler);
                    HttpResponseMessage httpResponse = client.GetAsync(uri).Result;
                    string response = httpResponse.Content.ReadAsStringAsync().Result;
                    if (response.Contains(ip))
                    {
                        Working++;
                        WriteConsole.ColorText($"WORKING: {ip}:{port}", ConsoleColor.Green);
                        SaveData.WriteLinesToTxt($"Working-Proxies-{DateTime.Now.ToString("MM-dd-yyyy")}.txt", $"{ip}:{port}");
                    }
                    else
                    {
                        Dead++;
                        WriteConsole.ColorText($"BAD: {ip}:{port}", ConsoleColor.Red);
                    }
                }
                catch (HttpRequestException) { Dead++; WriteConsole.ColorText($"BAD: {FProxy}", ConsoleColor.Red); }
                catch (AggregateException) { Dead++; WriteConsole.ColorText($"BAD: {FProxy}", ConsoleColor.Red); }
                catch (NullReferenceException) { Dead++; WriteConsole.ColorText($"BAD: {FProxy}", ConsoleColor.Red); }
                catch (TaskCanceledException) {}

                Checked++;
                Console.Title = $"ProxyStar V1.0.0 | Progress: {Checked}/{ProxyCount} | Working: {Working} | Dead Proxies: {Dead}";
            });
        }