Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            string datadir = null;

            string[] openFiles = null;
            if (args.Length > 0)
            {
                if (!GameConfig.CheckFLDirectory(args[0]))
                {
                    Console.Error.WriteLine("Error: {0} is not a valid data directory", args[0]);
                    return;
                }
                datadir   = args[0];
                openFiles = args.Skip(1).ToArray();
            }
            MainWindow mw = null;

            AppHandler.Run(() =>
            {
                mw                = new MainWindow();
                mw.PreloadOpen    = openFiles;
                mw.PreloadDataDir = datadir;
                mw.Run();
            }, () => mw.Crashed());
        }
Exemplo n.º 2
0
        public ActionResult UnverifyAgent(string id)
        {
            string decrypted_id = AppHandler.Decrypt(id);

            new DB().ExecuteQuery("Update Landlords set [Status] = 'Active Unverified' where IDforLand = '" + decrypted_id + "'");
            return(RedirectToAction("Index"));
        }
        // Register the application with a mastodon instance,
        // retreive client-credentials and
        // save them to configuration.
        public async Task <bool> RegisterApplication(string instance, string appName, string appSite)
        {
            using (log.BeginScope($"{ nameof(MastodonInstanceService) }->{ nameof(RegisterApplication) }"))
            {
                log.LogDebug("Parameters: {instance}, appName: {appName}, appSite: {appSite}",
                             instance, appName, appSite);

                try
                {
                    log.LogDebug("Create mastodon-AppHandler");

                    using (var appHandler = new AppHandler(instance))
                    {
                        var appData = await appHandler.CreateAppAsync(appName, scopes, appSite);

                        log.LogDebug("appData returned");

                        // Save appData
                        cfg.Application.Instance.Name         = instance;
                        cfg.Application.Instance.ClientId     = appData.client_id;
                        cfg.Application.Instance.ClientSecret = appData.client_secret;

                        cfg.Save();
                    }
                }
                catch (Exception ex)
                {
                    log.LogError(ex, "RegisterApplication - Exception");
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        public void Reassigning_factory_will_call_it_again()
        {
            var handler = new AppHandler(null);
            var calls = 0;
            Func<AppHandler> factory = () =>
            {
                ++calls;
                return handler;
            };

            AppHandlerSingleton.SetFactory(factory);
            Assert.That(calls, Is.EqualTo(0));

            var handler1 = AppHandlerSingleton.Instance;
            Assert.That(calls, Is.EqualTo(1));
            Assert.That(handler1, Is.SameAs(handler));

            var handler2 = AppHandlerSingleton.Instance;
            Assert.That(calls, Is.EqualTo(1));
            Assert.That(handler2, Is.SameAs(handler));

            AppHandlerSingleton.SetFactory(factory);
            Assert.That(calls, Is.EqualTo(1));

            var handler3 = AppHandlerSingleton.Instance;
            Assert.That(calls, Is.EqualTo(2));
            Assert.That(handler3, Is.SameAs(handler));

            var handler4 = AppHandlerSingleton.Instance;
            Assert.That(calls, Is.EqualTo(2));
            Assert.That(handler4, Is.SameAs(handler));
        }
 static void Main(string[] args)
 {
     AppHandler.Run(() =>
     {
         WindowsChecks();
         new MainWindow().Run();
     });
 }
        private object UploadFileSync(string fileName, Stream fileStream)
        {
            AppHandler       currentAppHandler = this.application.WorkWith();
            FileField        fileField         = new FileField("file", fileName, "image/jpg", fileStream);
            CreateResultItem item = currentAppHandler.Files().Upload(fileField).ExecuteSync();

            return(item.Id);
        }
Exemplo n.º 7
0
    //Apphandler's sceneloader has the transition thing but isn't in all scenes by default.
    //We're checking if we have reference first. It should ALWAYS be in the scene so we can rely on it here.
    public void LoadNewScene(string sceneName)
    {
        if (appHandler == null)
        {
            appHandler = FindObjectOfType <AppHandler>();
        }

        appHandler.LoadNewScene(sceneName);
    }
Exemplo n.º 8
0
 public static void OnKeyPressUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     AppHandler.KeyUpEventHandler(sender, e);
     OfferHandler.KeyUpEventHandler(sender, e);
     if (e.Control)
     {
         EnableControlKey = false;
     }
 }
Exemplo n.º 9
0
 public MainWindow()
 {
     InitializeComponent();
     AllocConsole();
     Setup();
     ChromeInit("https://github.com/AmazingDM/TarkovApp");
     InputHelper.Init();
     AppHandler.Init(this);
 }
 public MainWindow()
 {
     InitializeComponent();
     AllocConsole();
     Setup();
     ChromeInit("https://tarkov-market.com/");
     InputHelper.Init();
     AppHandler.Init(this);
     NetStat.Test();
 }
Exemplo n.º 11
0
        public static void Main(string[] args)
        {
            MainWindow mw = null;

            AppHandler.Run(() =>
            {
                mw = new MainWindow();
                mw.Run();
            }, () => mw.Crashed());
        }
Exemplo n.º 12
0
        public void HttpContextBase_is_added_to_environment()
        {
            SetRequestPaths("http://localhost/", "/");

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.Env["aspnet.HttpContextBase"], Is.SameAs(_httpContext));
        }
        internal static IEnumerable <string> ListFiles(string apiKey)
        {
            EverliveAppSettings settings = new EverliveAppSettings();

            settings.ServiceUrl = "api.everlive.com";
            settings.ApiKey     = apiKey;
            var        application       = new EverliveApp(settings);
            AppHandler currentAppHandler = application.WorkWith();
            var        files             = currentAppHandler.Files().GetAll().ExecuteSync();

            return(files.Select(f => f.Filename));
        }
Exemplo n.º 14
0
        public void stopRentingGame()
        {
            //Kill Platform
            string PlatformExe = "steam.exe";

            AppHandler.killPlatformByCMD(PlatformExe);

            //Kill Game Extention
            string KillGameExe = "csgo.exe";

            AppHandler.killPlatformByCMD(KillGameExe);
        }
Exemplo n.º 15
0
        public bool LoadImage()
        {
            var imgSrc = AppHandler.LoadImage();

            if (imgSrc != null)
            {
                Name        = $"IMG_{Path.GetFileName(imgSrc)}".Replace(" ", "_").Replace("-", "_").Replace(".", "_");
                ImageSource = imgSrc;
                return(true);
            }

            return(false);
        }
Exemplo n.º 16
0
        public async Task CreateApp()
        {
            using (var appHandler = new AppHandler(Settings.InstanceName))
            {
                var scopes  = AppScopeEnum.Read | AppScopeEnum.Write | AppScopeEnum.Follow;
                var appData = await appHandler.CreateAppAsync("mastodon.NET", scopes,
                                                              "https://github.com/NicolasConstant/mastodon.NET");

                Assert.IsTrue(!string.IsNullOrWhiteSpace(appData.client_secret));
                Settings.ClientId     = appData.client_id;
                Settings.ClientSecret = appData.client_secret;
            }
        }
Exemplo n.º 17
0
        public void AppHandler_can_be_created_and_invoked()
        {
            SetRequestPaths("http://localhost/", "/");

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.AppDelegateInvoked, Is.True);
            Assert.That(_httpResponse.Status, Is.EqualTo("200 OK"));
            Assert.That(ResponseOutputText, Is.EqualTo("Hello World"));
        }
Exemplo n.º 18
0
        /// <summary>
        /// App Entry point
        /// </summary>
        /// <param name="args">The arguments.</param>
        static void Main(string[] args)
        {
            var outputWriter = new StandardInputOutputWriter();

            //Greetings
            outputWriter.SendToOutput("Hello, Welcome to the Drawing Tool", true);
            outputWriter.SendToOutput("Your window size is " + Console.WindowWidth + ' ' + Console.WindowHeight, true);
            outputWriter.SendToOutput("Please limit your canvas size to " + (Console.WindowWidth - 2) + ' ' + (Console.WindowHeight - 2) + " for optimal experience, Select from the following options", true);
            outputWriter.SendToOutput("", true);

            AppHandler appHandler = new AppHandler(new InputCommandReader(), new InputCommandValidator(), outputWriter);

            appHandler.DisplayMenu();
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            MainWindow mw = null;

            AppHandler.Run(() =>
            {
                mw = new MainWindow()
                {
                    InitOpenFile = args
                };
                mw.Run();
                mw.Config.Save();
            }, () => mw.Crashed());
        }
Exemplo n.º 20
0
        public void HttpContextBase_is_added_to_environment()
        {
            SetRequestPaths("http://localhost/", "/");

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request.Environment["aspnet.HttpContextBase"], Is.SameAs(_httpContext));
        }
Exemplo n.º 21
0
        public static void Main(string[] args)
        {
            FreelancerGame flgame = null;

            AppHandler.Run(() =>
            {
                Func <string> filePath = null;
                if (args.Length > 0)
                {
                    filePath = () => args[0];
                }
                var cfg = GameConfig.Create(true, filePath);
                flgame  = new FreelancerGame(cfg);
                flgame.Run();
            }, () => flgame.Crashed());
        }
Exemplo n.º 22
0
        public void AppHandler_can_be_created_and_invoked()
        {
            SetRequestPaths("http://localhost/", "/");

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request, Is.Not.Null);
            Assert.That(_httpResponse.StatusCode, Is.EqualTo(200));
            Assert.That(ResponseOutputText, Is.EqualTo("Hello World"));
        }
Exemplo n.º 23
0
        public ActionResult UpdateProfile()
        {
            var    userName = User.Identity.GetUserName();
            string userType = new DB().ReadData("Select UserType From AspNetUsers where Email = '" + userName + "'");
            string userID   = User.Identity.GetUserId();


            if (userType == "Landlord")
            {
                string iDforLand = new DB().ReadData("Select IDforLand From Landlords where ApplicationUserId = '" + userID + "'");
                return(RedirectToAction("Edit", "Landlords", new { id = AppHandler.Encrypt(iDforLand) }));
            }
            if (userType == "Tenant")
            {
                string tenantID = new DB().ReadData("Select TenantID From Tenants where ApplicationUserId = '" + userID + "'");
                return(RedirectToAction("Edit", "Tenants", new { id = AppHandler.Encrypt(tenantID) }));
            }
            return(View());
        }
Exemplo n.º 24
0
        public void Factory_method_should_be_called_once()
        {
            var handler = new AppHandler(null);
            var calls = 0;
            AppHandlerSingleton.SetFactory(() =>
            {
                ++calls;
                return handler;
            });
            Assert.That(calls, Is.EqualTo(0));

            var handler1 = AppHandlerSingleton.Instance;
            Assert.That(calls, Is.EqualTo(1));
            Assert.That(handler1, Is.SameAs(handler));

            var handler2 = AppHandlerSingleton.Instance;
            Assert.That(calls, Is.EqualTo(1));
            Assert.That(handler2, Is.SameAs(handler));
        }
Exemplo n.º 25
0
        private void Command_FileSave(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                SliderCanvasZoom.Value = 1;

                var codes = GetCanvasComponents <BarcodeControl>();

                foreach (var code in codes)
                {
                    //BarcodeHandler.BitmapToFile(code.Source, code.CodeType.ToString());
                }

                AppHandler.SaveCanvas(MainCanvas);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Zapis etykiety", ex.Message, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 26
0
        private void Command_FileOpen(object sender, ExecutedRoutedEventArgs e)
        {
            var output = AppHandler.OpenFile();

            if (output != null)
            {
                ClearCanvas();

                MainVM.CurrentComponentName = null;

                MainVM.CanvasHeightMM = MainVM.pxToMm(output.CanvasHeight);
                MainVM.CanvasWidthMM  = MainVM.pxToMm(output.CanvasWidht);

                MainVM.IdGrupa = output.Id_Grupa;

                foreach (var component in output.Components)
                {
                    var cmp = component.Key;
                    var pos = component.Value;

                    if (cmp is Label lbl)
                    {
                        if (lbl.Name.Contains("Margin"))
                        {
                            var margin = MainCanvas.FindName(lbl.Name) as Label;
                            Canvas.SetLeft(margin, pos.CanvasLeft);
                            Canvas.SetTop(margin, pos.CanvasTop);
                        }
                        else
                        {
                            AddComponentToCanvas(lbl, pos.CanvasLeft, pos.CanvasTop);
                        }
                    }

                    if (cmp is Image img)
                    {
                        AddComponentToCanvas(img, pos.CanvasLeft, pos.CanvasTop);
                    }
                }
            }
        }
Exemplo n.º 27
0
        // GET: Tenants/Edit/5
        public ActionResult Edit(string id)
        {
            int idDecrypted = int.Parse(AppHandler.Decrypt(id));
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}
            Tenant tenant = db.Tenants.Find(idDecrypted);

            if (tenant == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.ApplicationUserId = new SelectList(db.Users, "Id", "Email", landlord.ApplicationUserId);
            TenantViewModel model = new TenantViewModel
            {
                TenantID          = tenant.TenantID,
                AccountNo         = tenant.AccountNo,
                LandlordID        = tenant.LandlordID,
                Title             = tenant.Title,
                Surname           = tenant.Surname,
                OtherNames        = tenant.OtherNames,
                Address           = tenant.Address,
                Phone             = tenant.Phone,
                RegDate           = tenant.RegDate,
                PropertyID        = tenant.PropertyID,
                StartDate         = tenant.StartDate,
                EndDate           = tenant.EndDate,
                Status            = tenant.Status,
                NoOfProperty      = tenant.NoOfProperty,
                Rent              = tenant.Rent,
                PropertyNo        = tenant.PropertyNo,
                RentPaymentStatus = tenant.RentPaymentStatus,
                CycleCount        = tenant.CycleCount,
                EndOfGrace        = tenant.EndOfGrace,
                NoOfPropertyUnits = tenant.NoOfPropertyUnits,
                ApplicationUserId = tenant.ApplicationUserId
            };

            return(View(model));
        }
Exemplo n.º 28
0
        public NewTextWindow(Label lbl = null)
        {
            InitializeComponent();

            if (lbl != null)
            {
                NewTextVM.EditMode = true;

                var dc = lbl.DataContext as NewTextViewModel;

                NewTextVM.Refresh(dc);

                fontDialog = dc.FontDialog;
            }

            NewText         = new OwnTextModel();
            NewTextBlock    = new TextBlock();
            NewText.Content = NewTextBlock;

            AppHandler.BindData(NewText, NewTextBlock);

            NewText.DataContext = NewTextVM;
        }
Exemplo n.º 29
0
        public async Task <AppInfoWrapper> GetAppInfoAsync(string mastodonInstanceUrl)
        {
            var instances = _instancesRepository.GetAllInstances().ToList();

            if (instances.Any(x => x.InstanceUrl == mastodonInstanceUrl))
            {
                return(instances.Find(x => x.InstanceUrl == mastodonInstanceUrl));
            }

            //Create new instance app
            var appHandler = new AppHandler(mastodonInstanceUrl);
            var scopes     = AppScopeEnum.Read | AppScopeEnum.Write | AppScopeEnum.Follow;
            var appData    = await appHandler.CreateAppAsync("Twittoot", scopes, "https://github.com/NicolasConstant/Twittoot");

            //Create new wrapper
            var appDataWrapper = new AppInfoWrapper(mastodonInstanceUrl, appData);

            //Save it
            instances.Add(appDataWrapper);
            _instancesRepository.SaveInstances(instances.ToArray());

            //Returns
            return(appDataWrapper);
        }
Exemplo n.º 30
0
 private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     e.Handled = !AppHandler.IsTextAllowed(e.Text);
 }
Exemplo n.º 31
0
        public void PathBase_receives_leading_portion_when_apprelative_portion_is_shorter()
        {
            SetRequestPaths("http://localhost/foo/bar", "/foo");

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request, Is.Not.Null);
            Assert.That(request.Path, Is.EqualTo("/bar"));
            Assert.That(request.PathBase, Is.EqualTo("/foo"));
        }
Exemplo n.º 32
0
        public void Path_and_pathbase_are_rooted()
        {
            SetRequestPaths("http://localhost/", "/");

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.AppDelegateInvoked);
            Assert.That(app.Owin.Path, Is.EqualTo("/"));
            Assert.That(app.Owin.PathBase, Is.EqualTo(""));
        }
Exemplo n.º 33
0
 private void Start()
 {
     appHandler    = FindObjectOfType <AppHandler>();
     locationDatas = appHandler.GetJSON();
 }
Exemplo n.º 34
0
        public void Path_receives_path_portion_of_request()
        {
            SetRequestPaths("http://localhost/foo/bar", "/");

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request, Is.Not.Null);
            Assert.That(request.Path, Is.EqualTo("/foo/bar"));
            Assert.That(request.PathBase, Is.EqualTo(""));
        }
Exemplo n.º 35
0
 private void Awake()
 {
     _instance = this;
     InitializeFirebase();
 }
Exemplo n.º 36
0
 void ProcessRequest(AppHandler appHandler)
 {
     var asyncResult = appHandler.BeginProcessRequest(_httpContext, null, null);
     appHandler.EndProcessRequest(asyncResult);
 }
Exemplo n.º 37
0
        public App()
        {
            IApp app = new global::MechaApp();

            handler = new AppHandler(app, this);
        }
Exemplo n.º 38
0
        public void ServerVariables_that_are_not_headers_are_added_to_environment()
        {
            SetRequestPaths("http://localhost/", "/");
            _httpRequest.ServerVariables["HTTP_HELLO"] = "http.hello.server.variable";
            _httpRequest.ServerVariables["FOO"] = "foo.server.variable";

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.Env["server.FOO"], Is.EqualTo("foo.server.variable"));
            Assert.That(app.Env.ContainsKey("server.HTTP_HELLO"), Is.False);
        }
Exemplo n.º 39
0
        public void Uri_scheme_http_passes_through_to_environment()
        {
            SetRequestPaths("http://localhost/", "/");

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.AppDelegateInvoked);
            Assert.That(app.Owin.Scheme, Is.EqualTo("http"));
        }
Exemplo n.º 40
0
        public void Request_headers_dictionary_is_case_insensitive()
        {
            SetRequestPaths("http://localhost/", "/");
            _httpRequest.Headers["Content-Type"] = "text/plain";

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.Env["aspnet.HttpContextBase"], Is.SameAs(_httpContext));

            var headers = new Environment(app.Env).Headers;

            Assert.That(headers["Content-Type"], Is.EqualTo("text/plain"));
            Assert.That(headers["CONTENT-TYPE"], Is.EqualTo("text/plain"));
            Assert.That(headers.Keys.ToArray().Contains("Content-Type"), Is.True);
            Assert.That(headers.Keys.ToArray().Contains("CONTENT-TYPE"), Is.False);
        }
Exemplo n.º 41
0
        public void Remote_host_closed_connection_during_write()
        {
            A.CallTo(() => _httpResponse.OutputStream).Returns(new RemoteHostClosedStream());

            SetRequestPaths("http://localhost/", "/");
            _httpRequest.Headers["Content-Type"] = "text/plain";

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            var ex = Assert.Throws<AggregateException>(()=>ProcessRequest(appHandler));
            Assert.That(ex.Flatten().InnerExceptions.Count, Is.EqualTo(1));
            Assert.That(ex.Flatten().InnerExceptions[0], Is.TypeOf<HttpException>());
        }
Exemplo n.º 42
0
        public void Path_receives_path_portion_of_request()
        {
            SetRequestPaths("http://localhost/foo/bar", "/");

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.AppDelegateInvoked);
            Assert.That(app.Owin.Path, Is.EqualTo("/foo/bar"));
            Assert.That(app.Owin.PathBase, Is.EqualTo(""));
        }
Exemplo n.º 43
0
        public void Remote_host_closed_connection_during_write()
        {
            A.CallTo(() => _httpResponse.OutputStream).Returns(new RemoteHostClosedStream());

            SetRequestPaths("http://localhost/", "/");
            _httpRequest.Headers["Content-Type"] = "text/plain";

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);
            Assert.That(_httpResponse.StatusCode, Is.EqualTo(200));
            Assert.That(ResponseOutputText, Is.EqualTo(string.Empty));
        }
Exemplo n.º 44
0
        public void ServerVariables_that_are_not_headers_are_added_to_environment()
        {
            SetRequestPaths("http://localhost/", "/");
            _httpRequest.ServerVariables["HTTP_HELLO"] = "http.hello.server.variable";
            _httpRequest.ServerVariables["FOO"] = "foo.server.variable";

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request.Environment["server.FOO"], Is.EqualTo("foo.server.variable"));
            Assert.That(request.Environment.ContainsKey("server.HTTP_HELLO"), Is.False);
        }
Exemplo n.º 45
0
 /// <summary>
 /// Main method
 /// </summary>
 /// <param name="args"></param>
 static void Main(string[] args)
 {
     // calling app handler run method to start the console app
     AppHandler.Run();
 }
Exemplo n.º 46
0
        public void Uri_scheme_http_passes_through_to_environment()
        {
            SetRequestPaths("http://localhost/", "/");

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request, Is.Not.Null);
            Assert.That(request.Scheme, Is.EqualTo("http"));
        }
Exemplo n.º 47
0
        public bool rentGame()
        {
            #region Bước 1: Kiểm tra
            //Kiểm tra xem đăng nhập chưa
            //Kiểm tra xem có đang thuê game không
            //Kiểm tra đủ lvl thuê game không
            //Kiểm tra ví tiền còn không
            //Gửi thông tin cho server - server response thông tin để đăng nhập
            #endregion

            #region Bước 2: Kill Platform

            //Kill Game Platform
            AppHandler.killPlatform(platform);

            #endregion

            #region Bước 2: Đăng nhập Game

            switch (platform)
            {
                #region Login Steam
            case "Steam":
                string LoginSteam;
                LoginSteam = @"/c cd " + folderSteam + " && start steam.exe -login " + steamUsername + " " + steamPassword;
                Process p = new Process();
                p.StartInfo.FileName              = "CMD.exe";
                p.StartInfo.Arguments             = LoginSteam;
                p.StartInfo.UseShellExecute       = false;
                p.StartInfo.CreateNoWindow        = true;
                p.StartInfo.RedirectStandardError = true;
                p.StartInfo.WindowStyle           = ProcessWindowStyle.Hidden;
                p.Start();
                string error  = p.StandardError.ReadToEnd();
                string errors = error + "Xem tại mục hướng dẫn để khắc phục lỗi này.";
                p.WaitForExit();

                // Handle result

                if (error == "")
                {
                    //Hiện Dock Đang thuê game
                    //ShowDockThueGame();

                    //Code Tính giờ
                    //Code Active Application_Exit
                    //Code Kill Game if lose connect to server
                    //Code kill Game if log out
                    return(true);
                }
                else
                {
                    MessageBox.Show(errors, "Lỗi");
                    return(false);
                }
                #endregion

            //Login Epic
            case "Epic":
                return(true);

            //Login Uplay
            case "Uplay":
                // C:\Users\Sky\AppData\Local\Ubisoft Game Launcher
                return(true);

            //Login Battle
            case "Battle":
                return(true);

            //Login Origin
            case "Origin":
                return(true);

            default:
                return(true);
            }

            #endregion
        }
Exemplo n.º 48
0
        public void PathBase_receives_leading_portion_when_apprelative_portion_is_shorter()
        {
            SetRequestPaths("http://localhost/foo/bar", "/foo");

            var app = new FakeApp("200 OK", "Hello World");
            var appHandler = new AppHandler(app.AppDelegate);

            ProcessRequest(appHandler);

            Assert.That(app.AppDelegateInvoked);
            Assert.That(app.Owin.Path, Is.EqualTo("/bar"));
            Assert.That(app.Owin.PathBase, Is.EqualTo("/foo"));
        }
Exemplo n.º 49
0
        public void Request_headers_dictionary_is_case_insensitive()
        {
            SetRequestPaths("http://localhost/", "/");
            _httpRequest.Headers["Content-Type"] = "text/plain";

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request.Environment["aspnet.HttpContextBase"], Is.SameAs(_httpContext));

            var headers = request.Headers;

            Assert.That(headers.GetHeader("Content-Type"), Is.EqualTo("text/plain"));
            Assert.That(headers.GetHeader("CONTENT-TYPE"), Is.EqualTo("text/plain"));
            Assert.That(headers.Keys.ToArray().Contains("Content-Type"), Is.True);
            Assert.That(headers.Keys.ToArray().Contains("CONTENT-TYPE"), Is.False);
        }
Exemplo n.º 50
0
        public void Path_and_pathbase_are_rooted()
        {
            SetRequestPaths("http://localhost/", "/");

            Request request = null;
            var appHandler = new AppHandler(call =>
            {
                request = new Request(call);
                return DefaultResponse().EndAsync();
            });

            ProcessRequest(appHandler);

            Assert.That(request, Is.Not.Null);
            Assert.That(request.Path, Is.EqualTo("/"));
            Assert.That(request.PathBase, Is.EqualTo(""));
        }