示例#1
0
        internal Login_frm(Configuration configuration, NetClient connection, Authenticator authenticator)
        {
            InitializeComponent();

            _configuration = configuration;
            _connection = connection;
            _authenticator = authenticator;

            UsernameInput.Text = _configuration.DefaultUsername;
            AutoLoginCheckBox.Checked = _configuration.AutoLogin;
            PasswordInput.KeyPress += new KeyPressEventHandler(PasswordInput_KeyPress);

            if (Directory.Exists(LanguageManager.Path))
            {
                string[] languages = Directory.GetDirectories(LanguageManager.Path);
                foreach (string language in languages)
                {
                    LanguageSelect.Items.Add(language.Split('/')[1]);
                }

                LanguageSelect.SelectedItem = Program.Config.Language;
                LanguageSelect.SelectedIndexChanged += new EventHandler(LanguageSelect_SelectedIndexChanged);
            }
            else
            {
                LanguageSelect.Items.Add("Files Not Found");
                LanguageSelect.SelectedIndex = 0;
            }
            ApplyTranslation();
        }
示例#2
0
        internal Login_frm(Configuration configuration, NetClient connection, Authenticator authenticator)
        {
            InitializeComponent();

            _configuration = configuration;
            _connection = connection;
            _authenticator = authenticator;

            UsernameInput.Text = _configuration.DefaultUsername;
            AutoLoginCheckBox.Checked = _configuration.AutoLogin;
            PasswordInput.KeyPress += new KeyPressEventHandler(PasswordInput_KeyPress);
        }
        internal Login_frm(Configuration configuration, NetClient connection, Authenticator authenticator)
        {
            InitializeComponent();

            _configuration = configuration;
            _connection = connection;
            _authenticator = authenticator;

            UsernameInput.Text = _configuration.DefaultUsername;
            AutoLoginCheckBox.Checked = _configuration.AutoLogin;
            PasswordInput.KeyPress += new KeyPressEventHandler(PasswordInput_KeyPress);

            cBLanguage.Text = Program.Config.language;
            _language.Load(Program.Config.language + ".conf");
            newText();
        }
示例#4
0
        internal Login_frm(Configuration configuration, NetClient connection, Authenticator authenticator)
        {
            InitializeComponent();
            this.Text = "DevPro" + " v" + Program.Version[0] + "." + Program.Version[1] + "." + Program.Version[2]+ " r" + Program.Version[3];
            _configuration = configuration;
            _connection = connection;
            _authenticator = authenticator;

            UsernameInput.Text = _configuration.DefaultUsername;
            AutoLoginCheckBox.Checked = _configuration.AutoLogin;
            PasswordInput.KeyPress += new KeyPressEventHandler(PasswordInput_KeyPress);
            _authenticator.ResetTimeout += new Authenticator.Reset(ResetTimeOut);

            if (Directory.Exists(LanguageManager.Path))
            {
                string[] languages = Directory.GetDirectories(LanguageManager.Path);
                foreach (string language in languages)
                {
                    string[] split = language.Split('/');
                    if(split.Length > 1)
                        LanguageSelect.Items.Add(split[1]);
                }

                LanguageSelect.SelectedItem = Program.Config.Language;
                LanguageSelect.SelectedIndexChanged += new EventHandler(LanguageSelect_SelectedIndexChanged);
            }
            else
            {
                LanguageSelect.Items.Add("English");
                LanguageSelect.SelectedIndex = 0;
            }

            foreach (Server server in Program.ServerList)
            {
                ServerSelect.Items.Add(server.ServerName);
            }
            ServerSelect.SelectedItem = Program.Config.DefaultServer;
            LoginTimeOut.Tick += new EventHandler(LoginTimeOut_Tick);
            UsernameInput.KeyDown += new KeyEventHandler(UsernameInput_KeyDown);
            ServerSelect.SelectedIndexChanged += new EventHandler(ServerSelect_SelectedIndexChanged);

            ApplyTranslation();
            //FormStyler.ApplyStlye(this, new StyleInfo());
        }
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            if (LauncherHelper.checkInstance() != null)
                if (MessageBox.Show(lang.pmsbProgRun) == DialogResult.OK)
                    return;

            Config = new Configuration();
            Config.Load(Program.ConfigurationFilename);

            lang = new Language();
            lang.Load(Config.language + ".conf");

            UserInfo = new UserData();
            ServerConnection = new NetClient();

            if (!Config.DebugMode)
            {
                if (CheckUpdates())
                    return;

                CheckServerInfo();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginService = new Authenticator(Config.DefaultUsername, Config.Password, ServerConnection, UserInfo);

            if(!ServerConnection.Connect(Config.ServerAddress, Config.ServerPort))
            {
                MessageBox.Show(lang.pMsbErrorToServer);
            }

            if (Config.AutoLogin)
            {
                LoginService.Authenticate();
                Thread.Sleep(2000);
            }

            if (UserInfo.Username == "" && UserInfo.LoginKey == "")
            {
                LoginWindow = new Login_frm(Config, ServerConnection, LoginService);

                if (LoginWindow.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                Thread.Sleep(2000);
            }

            if (!ServerConnection.IsConnected)
            {
                return;
            }

            if (UserInfo.Username != "" && UserInfo.LoginKey != "")
                Application.Run(new Main_frm());
            else
                MessageBox.Show(lang.pMsbBadLog);
        }
示例#6
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            if (LauncherHelper.checkInstance() != null)
                if (MessageBox.Show("Program already running") == DialogResult.OK)
                    return;

            Config = new Configuration();
            UserInfo = new UserData();
            Config.Load();
            if (CheckUpdates())
                return;

            CheckServerInfo();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ServerConnection = new NetClient();

            if(!ServerConnection.Connect(Config.ServerAddress, Config.ServerPort))
            {
                MessageBox.Show("Error Connecting to server");
            }

            LoginWindow = new Login_frm();
            if (LoginWindow.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (UserInfo.Username != "" && UserInfo.LoginKey != "")
                Application.Run(new Main_frm());
            else
                MessageBox.Show("Bad Login");
        }
示例#7
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            foreach(string arg in args)
            {
                if (arg == "-r")
                {
                    int timeout = 0;
                    while (LauncherHelper.checkInstance())
                    {
                        if (timeout == 3)
                        {
                            if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                            {
                                return;
                            }
                        }
                        Thread.Sleep(500);
                        timeout++;
                    }
                }
            }

            Config = new Configuration();
            Config.Load(Program.ConfigurationFilename);

            if (File.Exists("ygopro_vs.exe") && !File.Exists("devpro.dll"))
            {
                File.Copy("ygopro_vs.exe", "devpro.dll");
                File.Delete("ygopro_vs.exe");
                Config.GameExe = "devpro.dll";
                Config.Save(ConfigurationFilename);
            }

            LanguageManager = new LanguageManager();
            //LanguageManager.Save("English");
            LanguageManager.Load(Config.Language);

            if (LauncherHelper.checkInstance())
                if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                    return;

            UserInfo = new UserData();
            ServerConnection = new NetClient();

            if (!Config.DebugMode)
            {
                if (CheckUpdates())
                    return;

                CheckServerInfo();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginService = new Authenticator(Config.DefaultUsername, Config.Password, ServerConnection, UserInfo);

            if(!ServerConnection.Connect(Config.ServerAddress, Config.ServerPort))
            {
                MessageBox.Show(LanguageManager.Translation.pMsbErrorToServer);
            }

            if (Config.AutoLogin && Config.DefaultUsername.Length < 15)
            {

                LoginService.Authenticate();
                Thread.Sleep(2000);
            }

            if (UserInfo.Username == "" && UserInfo.LoginKey == "")
            {
                LoginWindow = new Login_frm(Config, ServerConnection, LoginService);

                if (LoginWindow.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            if (!ServerConnection.IsConnected)
            {
                return;
            }

            if (UserInfo.Username != "" && UserInfo.LoginKey != "")
                Application.Run(new Main_frm());
            else
            {
                Config.AutoLogin = false;
                Config.Save(ConfigurationFilename);
                MessageBox.Show(LanguageManager.Translation.pMsbBadLog);
            }
        }
示例#8
0
        static void Main(string[] args)
        {
            bool forcelogin = false;
            foreach(string arg in args)
            {
                if (arg == "-r")
                {
                    int timeout = 0;
                    while (LauncherHelper.checkInstance())
                    {
                        if (timeout == 3)
                        {
                            if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                            {
                                return;
                            }
                        }
                        Thread.Sleep(500);
                        timeout++;
                    }
                }
                if (arg == "-l")
                {
                    forcelogin = true;
                }
            }

            Config = new Configuration();
            LoadConfig(Program.ConfigurationFilename);
            #if DEBUG
            Config.DebugMode = true;
            #endif

            //if (Config.ConfigReset181000)
            //{
            //    if (MessageBox.Show("Major changes were made this update and requires user settings to be reset.") == DialogResult.OK)
            //    {
            //        Config = new Configuration();
            //        Config.ConfigReset181000 = false;
            //        SaveConfig(ConfigurationFilename, Config);
            //        Process process = new Process();
            //        ProcessStartInfo startInfos = new ProcessStartInfo(Application.ExecutablePath, "-r");
            //        process.StartInfo = startInfos;
            //        process.Start();
            //        Application.Exit();
            //    }
            //}
            //new update server - Forced change to prevent resting a users config
            Config.UpdaterAddress = "http://ygopro.de/launcher/checkversion.php";
            Config.ServerInfoAddress = "http://ygopro.de/launcher/serverinfo.php";

            if (!Config.DebugMode)
               AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            if (forcelogin)
            {
                Config.AutoLogin = false;
            }

            LanguageManager = new LanguageManager();
            //LanguageManager.Save("English");
            LanguageManager.Load(Config.Language);

            if (LauncherHelper.checkInstance())
                if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                    return;

            UserInfo = new UserData();
            ServerConnection = new NetClient();

            if (!Config.DebugMode)
            {
                if (CheckUpdates())
                    return;

                CheckServerInfo();
            }

            #if DEBUG
            ServerList.Add(new Server() { ServerName = "Debug", ServerAddress = "86.0.24.143", ServerPort = 7922, GamePort = 7911, ChatAddress = "86.0.24.143", ChatPort = 6666 });
            #endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (Program.Config.NewUpdate)
            {
                LauncherHelper.CardManager = new CardDatabase.CardsManager();
                LauncherHelper.CardManager.Init();
                if (LauncherHelper.CardManager.Loaded)
                {
                    FileCleaner cleaner = new FileCleaner();
                    cleaner.ShowDialog();
                }
            }

            Server serverinfo = null;

            foreach (Server server in ServerList)
            {
                if (server.ServerName == Config.DefaultServer)
                {
                    serverinfo = server;
                     Config.ServerAddress = serverinfo.ServerAddress; Config.GamePort = serverinfo.GamePort; Config.ServerPort = serverinfo.ServerPort;
                     Config.ChatServerAddress = serverinfo.ChatAddress; Config.ChatPort = serverinfo.ChatPort; Config.ServerName = serverinfo.ServerName;
                }
            }

            LoginService = new Authenticator(Config.DefaultUsername, Config.Password, ServerConnection, UserInfo);

            if (serverinfo != null)
            {
                if (!ServerConnection.Connect(Config.ServerName,Config.ServerAddress, Config.ServerPort))
                {
                    MessageBox.Show(LanguageManager.Translation.pMsbErrorToServer);
                }

                if (Config.AutoLogin && Config.DefaultUsername.Length < 15)
                {

                    LoginService.Authenticate();
                    Thread.Sleep(2000);
                }
            }

            if (UserInfo.Username == "" && UserInfo.LoginKey == "")
            {
                LoginWindow = new Login_frm(Config, ServerConnection, LoginService);

                if (LoginWindow.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            if (!ServerConnection.IsConnected)
            {
                return;
            }

            if (UserInfo.Username != "" && UserInfo.LoginKey != "")
            {
                if(forcelogin)
                    LoadConfig(ConfigurationFilename);
                MainForm = new Main_frm();
                Application.Run(MainForm);
            }
            else
            {
                Config.AutoLogin = false;
                SaveConfig(ConfigurationFilename, Config);
                MessageBox.Show(LanguageManager.Translation.pMsbBadLog);
            }
        }
示例#9
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            foreach (string arg in args)
            {
                if (arg == "-r")
                {
                    int timeout = 0;
                    while (LauncherHelper.checkInstance())
                    {
                        if (timeout == 3)
                        {
                            if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                            {
                                return;
                            }
                        }
                        Thread.Sleep(500);
                        timeout++;
                    }
                }
            }

            Config = new Configuration();
            Config.Load(Program.ConfigurationFilename);

            if (File.Exists("ygopro_vs.exe") && !File.Exists("devpro.dll"))
            {
                File.Copy("ygopro_vs.exe", "devpro.dll");
                File.Delete("ygopro_vs.exe");
                Config.GameExe = "devpro.dll";
                Config.Save(ConfigurationFilename);
            }

            LanguageManager = new LanguageManager();
            //LanguageManager.Save("English");
            LanguageManager.Load(Config.Language);

            if (LauncherHelper.checkInstance())
            {
                if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                {
                    return;
                }
            }

            UserInfo         = new UserData();
            ServerConnection = new NetClient();

            if (!Config.DebugMode)
            {
                if (CheckUpdates())
                {
                    return;
                }

                CheckServerInfo();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginService = new Authenticator(Config.DefaultUsername, Config.Password, ServerConnection, UserInfo);

            if (!ServerConnection.Connect(Config.ServerAddress, Config.ServerPort))
            {
                MessageBox.Show(LanguageManager.Translation.pMsbErrorToServer);
            }

            if (Config.AutoLogin && Config.DefaultUsername.Length < 15)
            {
                LoginService.Authenticate();
                Thread.Sleep(2000);
            }

            if (UserInfo.Username == "" && UserInfo.LoginKey == "")
            {
                LoginWindow = new Login_frm(Config, ServerConnection, LoginService);

                if (LoginWindow.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            if (!ServerConnection.IsConnected)
            {
                return;
            }

            if (UserInfo.Username != "" && UserInfo.LoginKey != "")
            {
                Application.Run(new Main_frm());
            }
            else
            {
                Config.AutoLogin = false;
                Config.Save(ConfigurationFilename);
                MessageBox.Show(LanguageManager.Translation.pMsbBadLog);
            }
        }