Esempio n. 1
0
        public InfoCustomer(ConnectData conData, string MaKH)
        {
            InitializeComponent();
            connectData = conData;
            maKH        = MaKH;
            item        = connectData.getInfoCustomer(maKH);

            lblMaKH.Content   = item.MaKH;
            lblTenKH.Content  = item.TenKH;
            lblSDT.Content    = item.SDT;
            lblCMND.Content   = item.CMND;
            lblDiaChi.Content = item.DiaChi;
            lblLK.Content     = item.LoaiKhach;
            lblPhong.Content  = item.PhongDangO;

            txtDiaChi.Visibility    = Visibility.Hidden;
            txtSDT.Visibility       = Visibility.Hidden;
            cbbLK.Visibility        = Visibility.Hidden;
            borderSDT.Visibility    = Visibility.Hidden;
            borderDiaChi.Visibility = Visibility.Hidden;
            borderLK.Visibility     = Visibility.Hidden;

            listTypeOfCustom = connectData.getTypeOfCustommer();

            for (int i = 0; i < listTypeOfCustom.Count; i++)
            {
                listNameTypeOfCustom.Add(listTypeOfCustom[i].LoaiKhach);

                if (listTypeOfCustom[i].LoaiKhach.Trim() == item.LoaiKhach.Trim())
                {
                    typeOfCustom = i;
                }
            }
        }
Esempio n. 2
0
 private void BrowseServers(System.Windows.Forms.TreeNode node)
 {
     try
     {
         node.Nodes.Clear();
         string host = null;
         if (node != this.m_localServers)
         {
             host = node.Text;
         }
         ConnectData  connectData      = this.FindConnectData(node);
         Opc.Server[] availableServers = this.m_discovery.GetAvailableServers(this.m_specification, host, connectData);
         if (availableServers != null)
         {
             Opc.Server[] array = availableServers;
             for (int i = 0; i < array.Length; i++)
             {
                 Opc.Da.Server server = (Opc.Da.Server)array[i];
                 System.Windows.Forms.TreeNode treeNode = new System.Windows.Forms.TreeNode(server.Name);
                 treeNode.ImageIndex = (treeNode.SelectedImageIndex = Resources.IMAGE_LOCAL_SERVER);
                 treeNode.Tag        = server;
                 node.Nodes.Add(treeNode);
             }
             node.Expand();
         }
     }
     catch (System.Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
     }
 }
        /// <summary>
        /// Looks up the CLSID for the specified prog id on a remote host.
        /// </summary>
        public Guid CLSIDFromProgID(string progID, string host, ConnectData connectData)
        {
            lock (this)
            {
                NetworkCredential credentials = (connectData != null)?connectData.GetCredential(null, null):null;

                // connect to the server.
                m_server = (IOPCServerList2)OpcCom.Interop.CreateInstance(CLSID, host, credentials);
                m_host   = host;

                // lookup prog id.
                Guid clsid;

                try
                {
                    m_server.CLSIDFromProgID(progID, out clsid);
                }
                catch
                {
                    clsid = Guid.Empty;
                }
                finally
                {
                    OpcCom.Interop.ReleaseServer(m_server);
                    m_server = null;
                }

                // return empty guid if prog id not found.
                return(clsid);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Receives the challenge and responds with a Connect request
        /// </summary>
        /// <param name="packet">The packet.</param>
        private void ReceiveChallenge(UdpPacket packet)
        {
            if (state != State.ChallengeReqSent)
            {
                return;
            }

            ChallengeData cr = new ChallengeData();

            cr.Deserialize(packet.Payload);

            ConnectData cd = new ConnectData();

            cd.ChallengeValue = cr.ChallengeValue ^ ConnectData.CHALLENGE_MASK;

            MemoryStream ms = new MemoryStream();

            cd.Serialize(ms);
            ms.Seek(0, SeekOrigin.Begin);

            SendSequenced(new UdpPacket(EUdpPacketType.Connect, ms));

            state        = State.ConnectSent;
            inSeqHandled = packet.Header.SeqThis;
        }
Esempio n. 5
0
 public ListCustomer(ConnectData conData)
 {
     InitializeComponent();
     connectData   = conData;
     listCustomers = conData.getListCustomer();
     this.lvListCustomer.ItemsSource = listCustomers;
 }
Esempio n. 6
0
        public Option GetBykey(string key)
        {
            string sql  = @"SELECT * FROM Option WHERE StrKey = @optionId";
            Option data = ConnectData.Query <Option>(sql, key).Single();

            return(data);
        }
Esempio n. 7
0
        public override async Task <bool> DataExistedAsync(int id)
        {
            string sql    = @"SELECT count(*) FROM Option WHERE Id = @id";
            int    result = await ConnectData.ExecuteScalarAsync <int>(sql, id);

            return(result > 0);
        }
Esempio n. 8
0
        public IActionResult Connect(ConnectData connectData)
        {
            this.applicationState.BreadCrumbTrail.Add("Verbinden", "/Connect", true);

            this.applicationState.ManufacturerParameters = this.GetManufacturerParametersFromRequest();

            connectData.DeviceId = connectData.DeviceId.Trim();
            connectData.Address  = connectData.Address.Trim();

            this.applicationState.ConnectData = connectData;

            if (this.applicationState.ConnectData.AuthMode == AuthMode.ClientCertificate)
            {
                if (this.applicationState.ClientCert == null ||
                    this.applicationState.ClientCert.PasswordState == CertPasswordState.InvalidCertFile ||
                    this.applicationState.ClientCert.PasswordState == CertPasswordState.InvalidPassword ||
                    this.applicationState.ClientCert.PasswordState == CertPasswordState.NoCertSelected)
                {
                    this.applicationState.LastErrorMessages.Clear();
                    this.applicationState.LastErrorMessages.Add("Kein gültiges Zertifikat angegeben.");
                    return(this.RedirectToAction("Index"));
                }
            }

            this.applicationState.ConnectAndLoadContracts();

            return(this.RedirectToAction("Index", "Progress"));
        }
Esempio n. 9
0
 public ServerInformation()
 {
     ServerName  = "";
     ServerMotd  = "";
     connectdata = new ConnectData();
     ServerPing  = new Ping_();
 }
Esempio n. 10
0
        // Token: 0x06000005 RID: 5 RVA: 0x000022C8 File Offset: 0x000012C8
        public Guid CLSIDFromProgID(string progID, string host, ConnectData connectData)
        {
            Guid result;

            lock (this)
            {
                NetworkCredential credential = (connectData != null) ? connectData.GetCredential(null, null) : null;
                this.m_server = (IOPCServerList2)Interop.CreateInstance(ServerEnumerator.CLSID, host, credential);
                this.m_host   = host;
                Guid empty;
                try
                {
                    this.m_server.CLSIDFromProgID(progID, out empty);
                }
                catch
                {
                    empty = Guid.Empty;
                }
                finally
                {
                    Interop.ReleaseServer(this.m_server);
                    this.m_server = null;
                }
                result = empty;
            }
            return(result);
        }
Esempio n. 11
0
        public override Post GetById(int id)
        {
            string sql  = @"SELECT * FROM Post WHERE Id = @postId";
            Post   data = ConnectData.Query <Post>(sql, id).Single();

            return(data);
        }
        public static async void StartConnectionAndTestConnectionDuration()
        {
            //Arrange
            SocketManager socketManager = MockData.GetSocketManager();

            Account     account          = SecretData.GetValidTestAccount();
            ConnectData validCredentials = new ConnectData
            {
                Username          = account.Username,
                Password          = account.Password,
                ServerCountryCode = "en",
                WorldID           = "en48"
            };


            //Act
            ConnectResult result1 = await socketManager.StartConnection(validCredentials);

            Thread.Sleep(6000);

            SocketMessage message = RouteProvider.GetDefaultSendMessage(RouteProvider.SYSTEM_GETTIME);

            var result = await socketManager.Emit(message);

            Thread.Sleep(600000);

            //Assert
            Assert.True(socketManager.IsConnected);
            await socketManager.StopConnection(true);
        }
Esempio n. 13
0
 private void Payment()
 {
     try
     {
         int client = LoginM.IClients.ID, payment = LoginM.IPayment.ID;
         MessageBoxResult _returnReg = MessageBox.Show(Language.Set(Language.Payment, new string[3] {
             LoginM.IPayment.Name, client.ToString(), LoginM.PayCostAll
         }), Language.Notification, MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (_returnReg == MessageBoxResult.No)
         {
             return;
         }
         string _data = ConnectData.Payment(client, payment);
         if (_data == "false")
         {
             MessageBox.Show(Language.ErrorConnect, Language.Notification, MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         dynamic data = JsonConvert.DeserializeObject(_data);
         string  Title = data.title, Text = data.text, Msg = data.msg; if (Msg == "error")
         {
             MessageBox.Show(Text, Title, MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         GetDataInfo();
         MessageBox.Show(Text, Title);
     }
     catch
     {
         MessageBox.Show(Language.ErrorConnect, Language.Notification, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 14
0
        public void OnTryLogin(SvManager svManager, AuthData authData, ConnectData connectData)
        {
            if (ValidateUser(svManager, authData))
            {
                if (!svManager.TryGetUserData(authData.accountID, out User playerData))
                {
                    svManager.RegisterFail(authData.connection, "Account not found - Please Register");
                    return;
                }

                if (playerData.BanInfo.IsBanned)
                {
                    svManager.RegisterFail(authData.connection, $"Account banned: {playerData.BanInfo.Reason}");
                    return;
                }

                if (!svManager.settings.auth.steam && playerData.PasswordHash != connectData.passwordHash)
                {
                    svManager.RegisterFail(authData.connection, $"Invalid credentials");
                    return;
                }

                svManager.LoadSavedPlayer(playerData, authData, connectData);
            }
        }
Esempio n. 15
0
        public void OnTryRegister(SvManager svManager, AuthData authData, ConnectData connectData)
        {
            if (ValidateUser(svManager, authData))
            {
                if (svManager.TryGetUserData(authData.accountID, out User playerData))
                {
                    if (playerData.BanInfo.IsBanned)
                    {
                        svManager.RegisterFail(authData.connection, $"Account banned: {playerData.BanInfo.Reason}");
                        return;
                    }

                    if (!svManager.settings.auth.steam && playerData.PasswordHash != connectData.passwordHash)
                    {
                        svManager.RegisterFail(authData.connection, $"Invalid credentials");
                        return;
                    }
                }

                if (!connectData.username.ValidCredential())
                {
                    svManager.RegisterFail(authData.connection, $"Name cannot be registered (min: {Util.minCredential}, max: {Util.maxCredential})");
                    return;
                }

                svManager.AddNewPlayer(authData, connectData);
            }
        }
Esempio n. 16
0
 public TypeOfCustomer(ConnectData conData)
 {
     InitializeComponent();
     connectData = conData;
     items       = conData.getTypeOfCustommer();
     lvTypeCustommer.ItemsSource = items;
 }
Esempio n. 17
0
 public override void Connect(URL url, ConnectData connectData)
 {
     base.Connect(url, connectData);
     this.GetAttributes();
     this.GetAggregates();
     foreach (Trend trend in this.m_trends)
     {
         ArrayList list = new ArrayList();
         foreach (Item item in trend.Items)
         {
             list.Add(new ItemIdentifier(item));
         }
         IdentifiedResult[] resultArray = this.CreateItems((ItemIdentifier[])list.ToArray(typeof(ItemIdentifier)));
         if (resultArray != null)
         {
             for (int i = 0; i < resultArray.Length; i++)
             {
                 trend.Items[i].ServerHandle = null;
                 if (resultArray[i].ResultID.Succeeded())
                 {
                     trend.Items[i].ServerHandle = resultArray[i].ServerHandle;
                 }
             }
         }
     }
 }
 public EsqueceuSenhaController()
 {
     conexao      = new ConnectData();
     cliente      = new Usuario();
     clienteEmail = new SmtpClient();
     emailEnviar  = new MailMessage();
 }
        public ChinhSuaThongTinPhong(ConnectData conData, string maPhong)
        {
            InitializeComponent();
            connectData    = conData;
            maP            = maPhong;
            infoRoom       = connectData.GetDetailOfRoom(maPhong);
            infoTypeOfRoom = connectData.getTypeOfRoom();

            for (int i = 0; i < infoTypeOfRoom.Count; i++)
            {
                listTypeOfRoom.Add(infoTypeOfRoom[i].LoaiPhong);

                if (infoTypeOfRoom[i].LoaiPhong.Trim() == infoRoom.TenLP.Trim())
                {
                    typeOfRoom = i;
                }
            }

            lblMP.Content           = maPhong;
            lbldonGia.Content       = infoRoom.DonGia;
            lblsoKhachToiDa.Content = infoRoom.SoKhachToiDa;

            if (infoRoom.GhiChu != null)
            {
                txtghiChu.Text = infoRoom.GhiChu.Trim();
            }
        }
Esempio n. 20
0
 public void ConnectAndRegist(ConnectData conn_data, Action <bool, bool> call_back)
 {
     Connect(conn_data, delegate(bool is_connect)
     {
         Logd("Connected. valid={0}", is_connect);
         if (!is_connect)
         {
             if (call_back != null)
             {
                 call_back(is_connect, false);
             }
         }
         else
         {
             Regist(conn_data, delegate(bool is_regist)
             {
                 Logd("Registed. valid={0}", is_regist);
                 if (call_back != null)
                 {
                     call_back(is_connect, is_regist);
                 }
             });
         }
     });
 }
Esempio n. 21
0
 // Token: 0x06000460 RID: 1120 RVA: 0x0000D1C8 File Offset: 0x0000C1C8
 public override void Connect(URL url, ConnectData connectData)
 {
     base.Connect(url, connectData);
     this.GetAttributes();
     this.GetAggregates();
     foreach (object obj in this.m_trends)
     {
         Trend     trend     = (Trend)obj;
         ArrayList arrayList = new ArrayList();
         foreach (object obj2 in trend.Items)
         {
             Item itemID = (Item)obj2;
             arrayList.Add(new ItemIdentifier(itemID));
         }
         IdentifiedResult[] array = this.CreateItems((ItemIdentifier[])arrayList.ToArray(typeof(ItemIdentifier)));
         if (array != null)
         {
             for (int i = 0; i < array.Length; i++)
             {
                 trend.Items[i].ServerHandle = null;
                 if (array[i].ResultID.Succeeded())
                 {
                     trend.Items[i].ServerHandle = array[i].ServerHandle;
                 }
             }
         }
     }
 }
Esempio n. 22
0
    public void Regist(ConnectData conn_data, Action <bool> call_back)
    {
        Party_Model_Register party_Model_Register = new Party_Model_Register();

        party_Model_Register.roomId     = conn_data.roomId;
        party_Model_Register.owner      = conn_data.owner;
        party_Model_Register.ownerToken = conn_data.ownerToken;
        party_Model_Register.uid        = conn_data.uid;
        party_Model_Register.signature  = conn_data.signature;
        Logd("Regist. roomId={0}", conn_data.roomId);
        registerAck = null;
        SendServer(party_Model_Register, true, delegate(Coop_Model_ACK ack)
        {
            bool obj    = true;
            registerAck = (ack as Party_Model_RegisterACK);
            if (ack == null || !ack.positive)
            {
                obj = false;
                MonoBehaviourSingleton <LoungeWebSocket> .I.Close(1000, "Bye!");
            }
            if (call_back != null)
            {
                call_back(obj);
            }
            return(true);
        }, null);
    }
Esempio n. 23
0
 public ListRoom(ConnectData conData)
 {
     InitializeComponent();
     connectData = conData;
     listRoom    = conData.getListRoom();
     this.LV_ListRoom.ItemsSource = listRoom;
 }
        public async Task <ConnectResult> SendAccountAuthentication(ConnectData connectData)
        {
            var response = new SocketMessage();

            if (_socketManager.IsReconnecting)
            {
                response = await SendStandardMessage(
                    RouteProvider.AUTHENTICATION_RECONNECT,
                    RouteProvider.AuthenticationReconnect(connectData, _socketManager.ActiveCharacterId));
            }
            else
            {
                response = await SendStandardMessage(RouteProvider.LOGIN, RouteProvider.Login(connectData));
            }

            var loginData = SocketUtilities.ParseDataFromResponse <LoginDataDTO>(response.Response);

            ConnectResult connectResult = _socketManager.GetConnectResult();

            connectResult.IsConnected  = true;
            connectResult.AccessToken  = loginData?.AccessToken;
            connectResult.TW2AccountId = loginData?.PlayerId;

            _socketManager.ConnectData.AccessToken = loginData?.AccessToken;

            DataEvents.InvokeLoginDataAvailable(loginData);
            DataEvents.InvokeConnectionResult(connectResult);

            return(connectResult);
        }
Esempio n. 25
0
        public override Option GetById(int id)
        {
            string sql  = @"SELECT * FROM Option WHERE Id = @optionId";
            Option data = ConnectData.Query <Option>(sql, id).Single();

            return(data);
        }
Esempio n. 26
0
            /// <summary>
            /// Adds the row.
            /// </summary>
            /// <param name="credential">The credential.</param>
            /// <param name="status">The status.</param>
            /// <param name="preferedSpecyfication">The prefered specyfication.</param>
            /// <param name="url">The URL.</param>
            /// <param name="SupportedLocales">The supported locales.</param>
            /// <returns>ServersTableRow.</returns>
            public ServersTableRow AddRow
                (ConnectData credential, OpcDa.ServerStatus status, Specification preferedSpecyfication, URL url, string[] SupportedLocales)
            {
                ServersTableRow mRow = this.NewServersTableRow();

                mRow.LicenseKey = credential.LicenseKey;
                if (credential.Credentials != null)
                {
                    mRow.Domain   = credential.Credentials.Domain;
                    mRow.Password = credential.Credentials.Password;
                    mRow.UserName = credential.Credentials.UserName;
                }
                mRow.CurrentTime              = status.CurrentTime;
                mRow.ProductVersion           = status.ProductVersion;
                mRow.SpecificationDescription = preferedSpecyfication.Description;
                mRow.SpecificationID          = preferedSpecyfication.ID;
                mRow.URLString  = url.ToString();
                mRow.VendorInfo = status.VendorInfo;
                this.AddServersTableRow(mRow);
                foreach (var loc in SupportedLocales)
                {
                    ((AddressSpaceDataBase)this.DataSet).LocalesTable.AddRow(mRow.ID, loc);
                }
                return(mRow);
            }
Esempio n. 27
0
        public override async Task <int> DeleteDataAsync(Option entity)
        {
            string sql    = @"DELETE FROM Option WHERE Id = @id";
            int    result = await ConnectData.ExecuteAsync(sql, entity.Id);

            return(result);
        }
Esempio n. 28
0
 public TypeOfRoom(ConnectData conData)
 {
     InitializeComponent();
     connectData            = conData;
     items                  = conData.getTypeOfRoom();   //get data in server
     lvTypeRoom.ItemsSource = items;
 }
Esempio n. 29
0
    public static ConnectData FromUri(UriCi uri)
    {
        ConnectData c = new ConnectData();

        c          = new ConnectData();
        c.Ip       = uri.GetIp();
        c.Port     = 25565;
        c.Username = "******";
        if (uri.GetPort() != -1)
        {
            c.Port = uri.GetPort();
        }
        if (uri.GetGet().ContainsKey("user"))
        {
            c.Username = uri.GetGet().Get("user");
        }
        if (uri.GetGet().ContainsKey("auth"))
        {
            c.Auth = uri.GetGet().Get("auth");
        }
        if (uri.GetGet().ContainsKey("serverPassword"))
        {
            c.IsServePasswordProtected = MiscCi.ReadBool(uri.GetGet().Get("serverPassword"));
        }
        return(c);
    }
Esempio n. 30
0
        public override async Task <IEnumerable <Option> > GetAllAsync()
        {
            string sql = @"SELECT * FROM Option";
            IEnumerable <Option> data = await ConnectData.QueryAsync <Option>(sql);

            return(data);
        }
Esempio n. 31
0
        public void onConnected(ConnectData data) {
            this.ClientId = data.ClientId;
            _welcomeDiv.innerHTML = "Connected.";

            StartGameData startGameData = new StartGameData(this.ClientId);
            startGameData.ClientId = this.ClientId;
            Server.Send(startGameData);
        }
Esempio n. 32
0
    public void Start(GamePlatform platform_, bool singleplayer_, string singleplayerSavePath_, ConnectData connectData_)
    {
        platform = platform_;
        singleplayer = singleplayer_;
        singleplayerSavePath = singleplayerSavePath_;
        connectData = connectData_;

        game.platform = platform;
        game.issingleplayer = singleplayer;
        game.assets = menu.assets;
        game.assetsLoadProgress = menu.assetsLoadProgress;

        game.Start();
        Connect(platform);
    }
Esempio n. 33
0
        public string exportToWord()
        {
            // Step 1. Read data from database
            if (isStoreNameEmpty())
                return "Store Name is empty";
 
            if (hasParameterStore)
            {
                try
                {
                    ConnectData cdata = new ConnectData();
                    // get connectString from Sacombank
                    cdata.ConnectString = System.Configuration.ConfigurationManager.ConnectionStrings["gMVVMConnectionString"].ConnectionString;

                    foreach (KeyValuePair<string, string> pair in this.storeParameterValue)
                    {
                        cdata.Paramerters.Add(pair.Key);
                        cdata.ParamertersValue.Add(pair.Value);
                        cdata.ParametersType.Add(SqlDbType.VarChar);
                    }
                    // get data from database to datatable
                    if (!cdata.Read_Store(StoreName, true)) return "Gọi Store thất bại";
                    //bat dau export
                    WordTemplateBase word = new WordTemplateBase()
                    {
                        TemplatePath = this.FilePath
                    };

                    word.Data = cdata.DataSource;
                    this.packageStream = word.ExcuteMailMergeSimple();
                    return null;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Passed invalid TemplatePath to Excel Template")
                        return "Chưa có mẫu báo cáo dạng excel.";
                    return ex.Message;
                }


            }
            return null;
        }
Esempio n. 34
0
 public void Connect(ConnectData data) {
     Client.inst.onConnected(data);
 }
Esempio n. 35
0
 public void StartGame(bool singleplayer, string singleplayerSavePath, ConnectData connectData)
 {
     ScreenGame screenGame = new ScreenGame();
     screenGame.menu = this;
     screenGame.Start(p, singleplayer, singleplayerSavePath, connectData);
     p.MouseCursorSetVisible(false);
     screen = screenGame;
 }
Esempio n. 36
0
        public string exportToExcel()
        {
            // Step 1. Read data from database
            if (isStoreNameEmpty())
                return "Store Name is empty";
            if (isReportNameEmpty())
                return "Excel Name id is empty";
            if (isfilePathTemplateFileEmpty())
                return "Template File Doesn't exists";
            if (hasParameterStore)
            {
                try
                {
                    ConnectData cdata = new ConnectData();
                    // get connectString from Sacombank
                    cdata.ConnectString = System.Configuration.ConfigurationManager.ConnectionStrings["gMVVMConnectionString"].ConnectionString;

                    foreach (KeyValuePair<string, string> pair in this.storeParameterValue)
                    {
                        cdata.Paramerters.Add(pair.Key);
                        cdata.ParamertersValue.Add(pair.Value);
                        cdata.ParametersType.Add(SqlDbType.VarChar);
                    }
                    // get data from database to datatable
                    if (!cdata.Read_Store(StoreName, true)) return "Gọi Store thất bại";
                    //Bat dat export
                    //Khoi tao voi duong dan excel truyen vao          
                    ExcelTemplateExportBase excel = new ExcelTemplateExportBase()
                    {
                        TemplatePath = this.FilePath
                    };

                    //gan du lieu doc tu store do vo excel
                    excel.SmartmarkersObjData = new Dictionary<string, object>();
                    excel.SmartmarkersObjData.Add("obj", cdata.DataSource.DefaultView);
                    //cac doi so truyen vao
                    foreach (KeyValuePair<string, string> pair in this.ParameterReport)
                    {
                        excel.SmartmarkersObjData.Add(pair.Key, pair.Value);
                    }
                    this.packageStream = excel.ExprortSmartmarkers();
                    
                    return null;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Passed invalid TemplatePath to Excel Template")
                        return "Chưa có mẫu báo cáo dạng excel.";
                    return ex.Message;
                }


            }
            return null;
        }
Esempio n. 37
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.sqlData = new ConnectData();
     this.Label1.Text = "";
 }
Esempio n. 38
0
    public override void OnButton(MenuWidget w)
    {
        if (w == login)
        {
            loginResultData = new LoginData();
            if (serverHash != null)
            {
                // Connect to server hash, through main game menu. Do login.
                menu.Login(loginUsername.text, loginPassword.text, serverHash, "", loginResult, loginResultData);
            }
            else
            {
                // Connect to IP. Don't login

                // Save username
                if (loginRememberMe.text == menu.lang.Get("MainMenu_ChoiceYes"))
                {
                    Preferences preferences = menu.p.GetPreferences();
                    preferences.SetString("Username", loginUsername.text);
                    menu.p.SetPreferences(preferences);
                }

                ConnectData connectdata = new ConnectData();
                connectdata.Ip = serverIp;
                connectdata.Port = serverPort;
                connectdata.Username = loginUsername.text;
                menu.StartGame(false, null, connectdata);
            }
        }
        if (w == createAccount)
        {
            menu.CreateAccount(createAccountUsername.text, createAccountPassword.text, loginResult);
        }
        if (w == loginRememberMe || w == createAccountRememberMe)
        {
            if (w.text == menu.lang.Get("MainMenu_ChoiceYes"))
            {
                w.text = menu.lang.Get("MainMenu_ChoiceNo");
            }
            else
            {
                w.text = menu.lang.Get("MainMenu_ChoiceYes");
            }
        }
        if (w == back)
        {
            OnBackPressed();
        }
    }
Esempio n. 39
0
 public void StartGame(bool singleplayer, string singleplayerSavePath, ConnectData connectData)
 {
     ScreenGame screenGame = new ScreenGame();
     screenGame.menu = this;
     screenGame.Start(p, singleplayer, singleplayerSavePath, connectData);
     screen = screenGame;
 }
Esempio n. 40
0
    internal void ConnectToGame(LoginData loginResultData, string username)
    {
        ConnectData connectData = new ConnectData();
        connectData.Ip = loginResultData.ServerAddress;
        connectData.Port = loginResultData.Port;
        connectData.Auth = loginResultData.AuthCode;
        connectData.Username = username;

        StartGame(false, null, connectData);
    }
Esempio n. 41
0
    void ReadArgs(MainMenu mainmenu, string[] args)
    {
        if (args.Length > 0)
        {
            ConnectData connectdata = new ConnectData();
            connectdata = ConnectData.FromUri(new GamePlatformNative().ParseUri(args[0]));

            mainmenu.StartGame(false, null, connectdata);
        }
    }
Esempio n. 42
0
    internal void ProcessServerIdentification(Packet_Server packet)
    {
        this.LocalPlayerId = packet.Identification.AssignedClientId;
        this.ServerInfo.connectdata = this.connectdata;
        this.ServerInfo.ServerName = packet.Identification.ServerName;
        this.ServerInfo.ServerMotd = packet.Identification.ServerMotd;
        this.d_TerrainChunkTesselator.ENABLE_TEXTURE_TILING = packet.Identification.RenderHint_ == RenderHintEnum.Fast;
        Packet_StringList requiredMd5 = packet.Identification.RequiredBlobMd5;
        Packet_StringList requiredName = packet.Identification.RequiredBlobName;
        ChatLog("[GAME] Processed server identification");
        int getCount = 0;
        if (requiredMd5 != null)
        {
            ChatLog(platform.StringFormat("[GAME] Server has {0} assets", platform.IntToString(requiredMd5.ItemsCount)));
            for (int i = 0; i < requiredMd5.ItemsCount; i++)
            {
                string md5 = requiredMd5.Items[i];

                //check if file with that content is already in cache
                if (platform.IsCached(md5))
                {
                    //File has been cached. load cached version.
                    Asset cachedAsset = platform.LoadAssetFromCache(md5);
                    string name;
                    if (requiredName != null)
                    {
                        name = requiredName.Items[i];
                    }
                    else // server older than 2014-07-13.
                    {
                        name = cachedAsset.name;
                    }
                    SetFile(name, cachedAsset.md5, cachedAsset.data, cachedAsset.dataLength);
                }
                else
                {
                    //Asset not present in cache
                    if (requiredName != null)
                    {
                        //If list of names is given (server > 2014-07-13) lookup if asset is already loaded
                        if (!HasAsset(md5, requiredName.Items[i]))
                        {
                            //Request asset from server if not already loaded
                            getAsset[getCount++] = md5;
                        }
                    }
                    else
                    {
                        //Server didn't send list of required asset names
                        getAsset[getCount++] = md5;
                    }
                }
            }
            ChatLog(platform.StringFormat("[GAME] Will download {0} missing assets", platform.IntToString(getCount)));
        }
        SendGameResolution();
        ChatLog("[GAME] Sent window resolution to server");
        sendResize = true;
        SendRequestBlob(getAsset, getCount);
        ChatLog("[GAME] Sent BLOB request");
        if (packet.Identification.MapSizeX != map.MapSizeX
            || packet.Identification.MapSizeY != map.MapSizeY
            || packet.Identification.MapSizeZ != map.MapSizeZ)
        {
            map.Reset(packet.Identification.MapSizeX,
                packet.Identification.MapSizeY,
                packet.Identification.MapSizeZ);
            d_Heightmap.Restart();
        }
        shadowssimple = packet.Identification.DisableShadows == 1 ? true : false;
        //maxdrawdistance = packet.Identification.PlayerAreaSize / 2;
        //if (maxdrawdistance == 0)
        //{
        //    maxdrawdistance = 128;
        //}
        maxdrawdistance = 256;
        ChatLog("[GAME] Map initialized");
    }
Esempio n. 43
0
    void Connect(GamePlatform platform)
    {
        if (singleplayer)
        {
            if (platform.SinglePlayerServerAvailable())
            {
                platform.SinglePlayerServerStart(singleplayerSavePath);
            }
            else
            {
                serverSimple = new ServerSimple();
                DummyNetwork network = platform.SinglePlayerServerGetNetwork();
                network.Start(platform.MonitorCreate(), platform.MonitorCreate());
                DummyNetServer server = new DummyNetServer();
                server.network = network;
                server.platform = platform;
                server.Start();
                serverSimple.Start(server, singleplayerSavePath, platform);

                serverSimpleMod = new ModServerSimple();
                serverSimpleMod.server = serverSimple;
                game.AddMod(serverSimpleMod);
                platform.SinglePlayerServerGetNetwork().ServerReceiveBuffer.Enqueue(new ByteArray());
            }

            connectData = new ConnectData();
            connectData.Username = "******";
            game.connectdata = connectData;

            DummyNetClient netclient = new DummyNetClient();
            netclient.SetPlatform(platform);
            netclient.SetNetwork(platform.SinglePlayerServerGetNetwork());
            game.main = netclient;
        }
        else
        {
            game.connectdata = connectData;
            if (platform.EnetAvailable())
            {
                EnetNetClient client = new EnetNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.TcpAvailable())
            {
                TcpNetClient client = new TcpNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.WebSocketAvailable())
            {
                WebSocketClient client = new WebSocketClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else
            {
                platform.ThrowException("Network not implemented");
            }
        }
    }
Esempio n. 44
0
 public static ConnectData FromUri(UriCi uri)
 {
     ConnectData c = new ConnectData();
     c = new ConnectData();
     c.Ip = uri.GetIp();
     c.Port = 25565;
     c.Username = "******";
     if (uri.GetPort() != -1)
     {
         c.Port = uri.GetPort();
     }
     if (uri.GetGet().ContainsKey("user"))
     {
         c.Username = uri.GetGet().Get("user");
     }
     if (uri.GetGet().ContainsKey("auth"))
     {
         c.Auth = uri.GetGet().Get("auth");
     }
     if (uri.GetGet().ContainsKey("serverPassword"))
     {
         c.IsServePasswordProtected = MiscCi.ReadBool(uri.GetGet().Get("serverPassword"));
     }
     return c;
 }
Esempio n. 45
0
 public ServerInformation()
 {
     ServerName = "";
     ServerMotd = "";
     connectdata = new ConnectData();
     ServerPing = new Ping_();
 }