Ejemplo n.º 1
0
        public bool ConnectToServer(List <ServerListEntry> publicServers, string hash)
        {
            if (String.IsNullOrEmpty(hash))
            {
                return(false);
            }

            ClientStartData data = null;

            for (int i = 0; i < publicServers.Count; i++)
            {
                ServerListEntry entry = publicServers[i];
                if (entry.Hash != hash)
                {
                    continue;
                }

                data = new ClientStartData(Session.Username, entry.Mppass,
                                           entry.IPAddress, entry.Port);
                Client.Start(data, true, ref ShouldExit);
                return(true);
            }

            // Fallback to private server handling
            try {
                data = Session.GetConnectInfo(hash);
            } catch (WebException ex) {
                ErrorHandler2.LogError("retrieving server information", ex);
                return(false);
            } catch (ArgumentOutOfRangeException) {
                return(false);
            }
            Client.Start(data, true, ref ShouldExit);
            return(true);
        }
Ejemplo n.º 2
0
        static void RunLauncher()
        {
            string logPath = Path.Combine(AppDirectory, "launcher.log");

            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            ErrorHandler2.InstallHandler(logPath);
            OpenTK.Configuration.SkipPerfCountersHack();
            LauncherWindow window = new LauncherWindow();

            window.Run();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
            string clientPath = Path.Combine(AppDirectory, "ClassicalSharp.exe");

            if (!File.Exists(clientPath))
            {
                MessageBox.Show("ClassicalSharp.exe needs to be in the same folder as the launcher.", "Missing file");
                return;
            }

            string logPath = Path.Combine(AppDirectory, "launcher.log");

            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            ErrorHandler2.InstallHandler(logPath);
            LauncherWindow window = new LauncherWindow();

            window.Run();
        }
Ejemplo n.º 4
0
        public void Init()
        {
            Window.Resize             += Resize;
            Window.FocusedChanged     += FocusedChanged;
            Window.WindowStateChanged += Resize;
            Window.Keyboard.KeyDown   += KeyDown;
            LoadFont();
            logoFont = new Font(FontName, 32, FontStyle.Regular);

            string path = Assembly.GetExecutingAssembly().Location;

            try {
                Window.Icon = Icon.ExtractAssociatedIcon(path);
            } catch (Exception ex) {
                ErrorHandler2.LogError("LauncherWindow.Init() - Icon", ex);
            }
            //Minimised = Window.WindowState == WindowState.Minimized;

            PlatformID platform = Environment.OSVersion.Platform;

            if (platform == PlatformID.Win32Windows)
            {
                platformDrawer = new WinOldPlatformDrawer();
            }
            else if (Configuration.RunningOnWindows)
            {
                platformDrawer = new WinPlatformDrawer();
            }
            else if (Configuration.RunningOnX11)
            {
                platformDrawer = new X11PlatformDrawer();
            }
            else if (Configuration.RunningOnMacOS)
            {
                platformDrawer = new OSXPlatformDrawer();
            }

            Drawer.Colours['g'] = new FastColour(125, 125, 125);
        }