コード例 #1
0
        private void Connect_OnClick(object sender, RoutedEventArgs e)
        {
            var networkConnectEventArgs = new NetworkConnectEventArgs(AddressTextbox.Text);

            ConnectToServer?.Invoke(this, networkConnectEventArgs);
            Close();
        }
コード例 #2
0
ファイル: Message_Get.cs プロジェクト: zoqiushui/Six
    void ConnectCallBack(byte[] data)
    {
        MyData          reader  = new MyData(data, 4);
        ConnectToServer handler = new ConnectToServer();

        handler.result = reader.Read_Byte();
    }
コード例 #3
0
        void ReleaseDesignerOutlets()
        {
            if (ConnectToServer != null)
            {
                ConnectToServer.Dispose();
                ConnectToServer = null;
            }

            if (DescriptionField1 != null)
            {
                DescriptionField1.Dispose();
                DescriptionField1 = null;
            }

            if (DescriptionField2 != null)
            {
                DescriptionField2.Dispose();
                DescriptionField2 = null;
            }

            if (DescriptionField3 != null)
            {
                DescriptionField3.Dispose();
                DescriptionField3 = null;
            }

            if (TitleDescriptionField != null)
            {
                TitleDescriptionField.Dispose();
                TitleDescriptionField = null;
            }
        }
コード例 #4
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            //set window background color
            this.Window.BackgroundColor = NSColor.FromSrgb(1, 1, (float)1, (float)1);
            string[] servers = VMDirSnapInEnvironment.Instance.LocalData.GetServerArray();
            ConnectToServer.AddItem("New Server");
            ConnectToServer.AddItems(servers);

            ConnectToServer.Activated += LoginAction;
        }
コード例 #5
0
    public void ConnectToServerRequest(string name)
    {
        ProtocolNetRequest req = new ProtocolNetRequest();

        req.cmd = (int)NetRequestType.CONNECTTOSERVER;
        ConnectToServer connectToServer = new ConnectToServer();

        connectToServer.name = name;
        req.connectToServer  = connectToServer;
        socket.sendMSG(PBCSerialize.Serialize(req));
    }
コード例 #6
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            //set window background color
            this.Window.BackgroundColor = NSColor.FromSrgb(1, 1, (float)1, (float)1);

            this.TitleDescriptionField.StringValue = TitleDescription;
            this.DescriptionField1.StringValue     = Description1;
            this.DescriptionField2.StringValue     = Description2;
            this.DescriptionField3.StringValue     = Description3;

            //string[] servers = VMDirSnapInEnvironment.Instance.LocalData.GetServerArray ();
            ConnectToServer.AddItem("Connect to Server");
            //ConnectToServer.AddItems (Servers);

            ConnectToServer.Activated += LoginAction;
        }
コード例 #7
0
        /*
         * private async Task ConnectToServerAsync1(SendingArgs args)
         * {
         *  var data = (ConnectToServerArgs) args;
         *
         *  await args.SendPacketAsync(new HandshakePacket
         *  {
         *      ProtocolVersion = 47,
         *      ServerAddress = Minecraft.ServerHost,
         *      ServerPort = Minecraft.ServerPort,
         *      NextState = (int)NextState.Login,
         *  });
         *
         *  await args.SendPacketAsync(new LoginStartPacket { Name = Minecraft.ClientUsername });
         * }
         */

        private void ConnectToServer(ConnectToServer args) // Forge
        {
            args.SendPacket(new HandshakePacket
            {
                ServerAddress   = args.ServerHost + "\0FML\0",
                ServerPort      = args.Port,
                ProtocolVersion = new VarInt(NetworkVersion),
                NextState       = NextState.Login
            });

            args.SendPacket(new LoginStartPacket {
                Name = args.Username
            });


            //await SendPacketAsync(GetFMLFakeLoginPacket());
            //await SendPacketAsync(new ClientStatusPacket { Status = ClientStatus.Respawn});
        }
コード例 #8
0
        private void HandleConnectToServer(ConnectToServer payload, PayloadWriter writer)
        {
            uint serverId = payload.ServerId;

            Server server = Program.Servers.Get(serverId);

            if (server == null)
            {
                StatusMsg resultPayload = Payloads.CreatePayload <StatusMsg>();
                resultPayload.Errorcode = 1;
                resultPayload.Errormsg  = "Unknown server";
                resultPayload.TicketId  = payload.TicketId;
                SendReply(writer, resultPayload);
                return;
            }

            byte[] nonce = Crypto.CreateNonce();

            PlayerConnecting resultPayload2 = Payloads.CreatePayload <PlayerConnecting>();

            resultPayload2.Nonce     = nonce;
            resultPayload2.CharId    = Account.Id;
            resultPayload2.Name      = Account.PlayerName;
            resultPayload2.OwnerId   = Account.Id;
            resultPayload2.OwnerName = Account.UserName;
            resultPayload2.GuildId   = 0;
            resultPayload2.GuildName = null;
            resultPayload2.GuildRole = 0;
            resultPayload2.Data      = _nicknameData;
            SendToLobbyConnection(server.ConnectionId, resultPayload2);

            ConnectToServerReply resultPayload3 = Payloads.CreatePayload <ConnectToServerReply>();

            resultPayload3.PermId    = Account.Id;
            resultPayload3.ServerId  = serverId;
            resultPayload3.Ip        = server.Ip;
            resultPayload3.Port      = server.Port;
            resultPayload3.Nonce     = nonce;
            resultPayload3.Errorcode = 0;
            resultPayload3.Errormsg  = null;
            resultPayload3.TicketId  = payload.TicketId;
            SendReply(writer, resultPayload3);
        }
コード例 #9
0
        private void TryConnectToServer()  // Обработчик настройки подключения к серверу
        {
            try
            {
                string Address = Helper.GetLocalIPv4(NetworkInterfaceType.Ethernet);
                IPAddress = IPAddress.TryParse(Address, out IPAddress IP) ? IP : default;
                Port      = 11000;

                if (IPAddress == default) // Пустой Ip-адрес?
                {
                    // Настройка подключения к серверу
                }
                else
                {
                    ConnectToServer.StartClient(IPAddress, Port);
                }
            }
            catch
            {
            }
        }
コード例 #10
0
 public static void DowloadCommand(string selectedVer, string selectedCore, string fileLoc, string filename)
 {
     if (settings.IsServer == false)
     {
         if (selectedCore != null && selectedVer != null)
         {
             if (fileLoc != "" & fileLoc != null & filename != "" & filename != null)
             {
                 VersionsContoller.VersionsManager(selectedVer + "-" + selectedCore, $"{fileLoc}" + "\\" + filename + ".jar");
             }
             else
             {
                 UCLogsViewModel.TextLogs.Value += "\nРасположения или имя файла недопустимы!";
             }
         }
         else
         {
             UCLogsViewModel.TextLogs.Value += "\nВыберите версию и ядро";
         }
     }
     else
     {
         if (selectedCore != null && selectedVer != null)
         {
             if (filename != "" & filename != null)
             {
                 ConnectToServer.SendMessage(selectedVer + "-" + selectedCore, filename + ".jar");
             }
             else
             {
                 UCLogsViewModel.TextLogs.Value += "\nРасположения или имя файла недопустимы!";
             }
         }
         else
         {
             UCLogsViewModel.TextLogs.Value += "\nВыберите версию и ядро";
         }
     }
 }
コード例 #11
0
        public static Tuple <List <dynamic>, string> CommonLayer(List <dynamic> SetItems, List <dynamic> ReturnItems, string MethodName, out ConnectionBackInformation ConnectionBackInformation)
        {
            string                    messageFromServer1 = "";
            List <dynamic>            messageFromServer  = new List <dynamic>();
            ConnectionBackInformation ConnectionBackInformation_Local = default;

            {
                if (string.IsNullOrEmpty(MethodName))
                {
                    throw new NullReferenceException(nameof(MethodName) + " is null or empty");
                }
                else
                {
                    if (ImportDesignForm.IPAddress is null)
                    {
                        throw new NullReferenceException(nameof(ImportDesignForm.IPAddress) + " is null");
                    }

                    if (ImportDesignForm.Port == default)
                    {
                        throw new NullReferenceException(nameof(ImportDesignForm.Port) + " == default");
                    }

                    List <dynamic> returnParametersAndMessageFromSocket = ConnectToServer.CommonLayerConnection(ImportDesignForm.IPAddress, ImportDesignForm.Port, SetItems, ReturnItems, MethodName, out ConnectionBackInformation_Local);

                    messageFromServer = returnParametersAndMessageFromSocket;

                    if (messageFromServer.Count > 1)
                    {
                        messageFromServer1 = messageFromServer[messageFromServer.Count - 1];
                    }
                }
            }

            ConnectionBackInformation = ConnectionBackInformation_Local;

            return(new Tuple <List <dynamic>, string>(messageFromServer, messageFromServer1));
        }
コード例 #12
0
 public static void Disconnect()
 {
     ConnectToServer.Disconnect();
 }
コード例 #13
0
 public static void ConnectCommand()
 {
     ConnectToServer.Connect();
 }
コード例 #14
0
    //Debugging Stuff
    //private string outputText = "";
    //public Text OutputTextField;
    //public GameObject loginLabel;

    #endregion

    void Awake()
    {
        ServerInstance = this;
    }
コード例 #15
0
 void Start()
 {
     Instance = this;
 }