Exemplo n.º 1
0
 private void TryReconnectTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         Server.GetCurrentUsers();
     }
     catch (Exception)
     {
         ServerConnectionState = VConnectionState.Faulted;
     }
     finally
     {
         if (ServerConnectionState != VConnectionState.Connected)
         {
             try//Attempt to reconnect
             {
                 ConnectToServer();
             }
             catch (CommunicationException)
             {
                 ServerConnectionState = VConnectionState.Disconnected;
             }
         }
     }
 }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            ServerConnectionState = VConnectionState.Disconnected;

            #region AutoLogin
            if (File.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp"))
            {
                string[] data = new string[2];
                FileInfo file = new FileInfo(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp");
                if (file.Length > 0)
                {
                    RememberUserCB.Checked = true;
                    data              = File.ReadAllLines(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp");
                    LoginRtb.Text     = data[0];
                    passMTextBox.Text = data[1];
                }
            }

            if (File.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupia.temp"))
            {
                var result = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupia.temp");
                if (result == "1")
                {
                    if (!string.IsNullOrEmpty(LoginRtb.Text))
                    {
                        LoginBtn_Click(null, null);
                    }
                }
            }
            #endregion
        }
Exemplo n.º 3
0
 public static void CreateChannel()
 {
     _channelFactory = new DuplexChannelFactory <IVolupiaService>(new VolupiaClientCallBack(), "VolupiaServiceEndPoint");
     Server          = _channelFactory.CreateChannel();
     if (_channelFactory.State == CommunicationState.Opened || _channelFactory.State == CommunicationState.Created)
     {
         ServerConnectionState = VConnectionState.Connected;
     }
 }
Exemplo n.º 4
0
        private static void ConnectToServer()
        {
            string userName          = Environment.UserName;
            string hostName          = null;
            string winVer            = null;
            string campaing          = null;
            string audioVar          = null;
            string loginSince        = null;
            string windowsLockScreen = null;

            using (RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\WOW6432Node\\Microsoft\\MOS\\BURAN"))
            {
                if (key != null)
                {
                    Object o = key.GetValue("USER_BURAN");//
                    if (o != null)
                    {
                        hostName = o.ToString();
                    }
                    o = key.GetValue("VERSAOWINDOWS_INSTALACAO");
                    if (o != null)
                    {
                        winVer = o.ToString();
                    }
                    o = key.GetValue("CAMPANHA");
                    if (o != null)
                    {
                        campaing = o.ToString();
                    }
                    o = key.GetValue("VARIACAO");
                    if (o != null)
                    {
                        audioVar = o.ToString();
                    }
                    o = key.GetValue("WINDOWS_LOGADO_HORARIO");
                    if (o != null)
                    {
                        loginSince = o.ToString();
                    }
                    o = key.GetValue("WINDOWS_LOGADO");
                    if (o != null)
                    {
                        windowsLockScreen = o.ToString();
                    }
                }
            }

            _channelFactory = new DuplexChannelFactory <IListener>(new ClientCallBack(), "ListenerServiceEndPoint");
            Server          = _channelFactory.CreateChannel();
            if (_channelFactory.State == CommunicationState.Created || _channelFactory.State == CommunicationState.Opened)
            {
                ServerConnectionState = VConnectionState.Connected;

                while (true)
                {
                    int login = Server.Login(userName, hostName, campaing, winVer, loginSince, GetLocalIPAddress(), false);
                    if (login == 0)
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 5
0
        public Player()
        {
            InitializeComponent();

            ServerConnectionState = VConnectionState.Disconnected;
        }
Exemplo n.º 6
0
        public LoginForm()
        {
            Theme.SetTheme();

            InitializeComponent();
            ApplyTheme();

            ServerConnectionState = VConnectionState.Disconnected;

            //#region AutoLogin
            if (File.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp"))
            {
                FileInfo file = new FileInfo(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp");
                if (file.Length > 0)
                {
                    RememberUserCB.Checked = true;
                    var data = File.ReadAllLines(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp");
                    LoginRtb.Text     = data[0];
                    passMTextBox.Text = data[1];
                }
            }

            //if (File.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupia.temp"))
            //{
            //    var result = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupia.temp");
            //    if (result == "1")
            //    {
            //        if (!string.IsNullOrEmpty(LoginRtb.Text))
            //        {
            //            ButtonLogin.Enabled = false;
            //            button1.Enabled = false;
            //            Thread.Sleep(2000);
            //            try
            //            {
            //                CreateChannel();
            //                GetAccount(Server.ValidateUser(LoginRtb.Text, passMTextBox.Text));
            //            }
            //            catch (EndpointNotFoundException)
            //            {
            //                System.Windows.Forms.MessageBox.Show("O servidor não está disponível no momento, tente novamente mais tarde.", "Volupia Messenger");
            //                return;
            //            }

            //            if (RememberUserCB.Checked)
            //            {
            //                string[] data = new string[] { LoginRtb.Text, passMTextBox.Text };
            //                File.WriteAllLines(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp", data);
            //            }
            //            else
            //            {
            //                File.Delete(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupialog.temp");
            //            }

            //            if (AutoLoginCB.Checked)
            //                File.WriteAllText(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupia.temp", "1");
            //            else
            //                File.WriteAllText(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Temp\volupia.temp", "0");

            //            ButtonLogin.Enabled = true;
            //            button1.Enabled = true;
            //        }

            //    }
            //}
            //#endregion
        }