Пример #1
0
        private IMsalRequest CreateRequest(
            AuthenticationParameters authParameters,
            bool isInteractive)
        {
            var authParams = authParameters.Clone();

            authParams.TelemetryCorrelationId = _guidService.NewGuid();
            authParams.Logger = _platformProxy.CreateLogger(
                authParams.TelemetryCorrelationId,
                _msalClientConfiguration);

            var webRequestManager = new WebRequestManager(
                _httpManager,
                _platformProxy.GetSystemUtils(),
                _environmentMetadata,
                authParams);
            var cacheManager = new CacheManager(_storageManager, authParams);

            if (isInteractive)
            {
                return(new MsalInteractiveRequest(webRequestManager, cacheManager, _browserFactory, authParams));
            }
            else
            {
                return(new MsalBackgroundRequest(
                           webRequestManager,
                           cacheManager,
                           _platformProxy.GetSystemUtils(),
                           authParams));
            }
        }
Пример #2
0
        public ActionResult EditUser(EditUserBindingModel model)
        {
            if (ModelState.IsValid)
            {
                EditUserResultModel editedUser = new EditUserResultModel
                {
                    UserId   = model.UserId,
                    Username = model.Username,
                    Password = model.Password
                };

                try
                {
                    // using (HttpClient client = new HttpClient())
                    // {
                    //     var postTask = client.PostAsJsonAsync("http://localhost:52680/user/edituser/", editedUser);
                    //     postTask.Wait();
                    //
                    //     var result = postTask.Result;
                    // }

                    WebRequestManager.HttpPost("http://localhost:52680/user/edituser/", editedUser);
                }
                catch (Exception ex)
                {
                    var error = ex;
                }
            }

            return(View("~/Views/Home/Index.cshtml"));
        }
Пример #3
0
    public static WebRequest <uint> Register(string name, string password, OnRequestComplete <uint> onComplete = null)
    {
        var accountInfo = new AccountInfo {
            name = name, password = password.GetMD5()
        };

        return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_REGISTER), accountInfo, onComplete));
    }
Пример #4
0
        public List <CraftingBase> GetCraftingBases()
        {
            var url          = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.CraftingBases);
            var craftingBase =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.CraftingBase>(url);

            return(craftingBase.Data);
        }
Пример #5
0
        public List <Armour> GetArmours()
        {
            var url           = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Armour);
            var armourWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Armour>(url);

            return(armourWrapper.Data);
        }
Пример #6
0
        public List <Prophecy> GetProphecies()
        {
            var url             = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Prophecies);
            var prophecyWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Prophecy>(url);

            return(prophecyWrapper.Data);
        }
Пример #7
0
        public List <Flask> GetFlasks()
        {
            var url           = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Flask);
            var flasksWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Flask>(url);

            return(flasksWrapper.Data);
        }
Пример #8
0
        public List <DivinationCard> GetDivinationCards()
        {
            var url = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.DivinationCards);
            var divinationCardsWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.DivinationCard>(url);

            return(divinationCardsWrapper.Data);
        }
Пример #9
0
        public List <Accessory> GetAccessories()
        {
            var url = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Accessory);
            var accessoryWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Accessory>(url);

            return(accessoryWrapper.Data);
        }
Пример #10
0
 public static WebRequest <AccountData> Login(string username, string password, bool guest, OnRequestComplete <AccountData> onComplete = null)
 {
     if (guest)
     {
         return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_AUTH_GUEST), new { name = username }, onComplete));
     }
     return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_AUTH), new { name = username, password = password.GetMD5() }, onComplete));
 }
Пример #11
0
        public List <Gem> GetGems()
        {
            var url            = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Gems);
            var weaponsWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Gem>(url);

            return(weaponsWrapper.Data);
        }
Пример #12
0
        public List <UniqueMap> GetUniqueMaps()
        {
            var url        = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.UnqiueMaps);
            var uniqueMaps =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.UniqueMaps>(url);

            return(uniqueMaps.Data);
        }
Пример #13
0
        //
        public static void SendMessageLog(string playerName, string message, string server, string title, string footer, Color color)
        {
            var webhook = new Webhook("https://discordapp.com/api/webhooks/467126640041000970/Jvq96CHExzyDqH1Nu-VmMdUFWtETLAEjBuasHZdCyVCM9fKKaJel0whPzvqS_YFKNv7b")
            {
                Content = $"{server} | {playerName}: {message}"
            };

            WebRequestManager.SendWebhook(webhook);
        }
Пример #14
0
        static OrientRepo DefaultManagerInit(string databaseName = null, string hostPort_ = null)
        {
            string dbName;
            string login    = ConfigurationManager.AppSettings["orient_login"];
            string password = ConfigurationManager.AppSettings["orient_pswd"];
            string dbHost   = string.Format("{0}:{1}"
                                            , ConfigurationManager.AppSettings["OrientDevHost"]
                                            , ConfigurationManager.AppSettings["OrientPort"]);

            if (databaseName == null)
            {
                dbName = ConfigurationManager.AppSettings["OrientUnitTestDB"];
            }
            else
            {
                dbName = databaseName;
            }
            if (hostPort_ == null)
            {
                dbHost = string.Format("{0}:{1}"
                                       , ConfigurationManager.AppSettings["OrientDevHost"]
                                       , ConfigurationManager.AppSettings["OrientPort"]);
            }
            else
            {
                dbName = hostPort_;
            }

            TypeConverter typeConverter = new TypeConverter();

            JsonManagers.JSONManager jsonMnager   = new JSONManager();
            TokenMiniFactory         tokenFactory = new TokenMiniFactory();
            UrlShemasExplicit        UrlShema     = new UrlShemasExplicit(
                new CommandBuilder(tokenFactory, new FormatFactory())
                , new FormatFromListGenerator(new TokenMiniFactory())
                , tokenFactory, new OrientBodyFactory());

            BodyShemas bodyShema = new BodyShemas(new CommandFactory(), new FormatFactory(), new TokenMiniFactory(),
                                                  new OrientBodyFactory());

            UrlShema.AddHost(dbHost);
            WebResponseReader webResponseReader = new WebResponseReader();
            WebRequestManager webRequestManager = new WebRequestManager();

            webRequestManager.SetCredentials(new NetworkCredential(login, password));
            CommandFactory     commandFactory     = new CommandFactory();
            FormatFactory      formatFactory      = new FormatFactory();
            OrientQueryFactory orientQueryFactory = new OrientQueryFactory();
            OrientCLRconverter orientCLRconverter = new OrientCLRconverter();

            CommandShemasExplicit commandShema_ = new CommandShemasExplicit(commandFactory, formatFactory,
                                                                            new TokenMiniFactory(), new OrientQueryFactory());

            return(new OrientRepo(typeConverter, jsonMnager, tokenFactory, UrlShema, bodyShema, commandShema_
                                  , webRequestManager, webResponseReader, commandFactory, formatFactory, orientQueryFactory, orientCLRconverter));
        }
Пример #15
0
    // Start is called before the first frame update
    void Start()
    {
        webRequestManager = Lufy.GetManager <WebRequestManager>();
        eventManager      = Lufy.GetManager <EventManager>();
        webRequestManager.SetEventManager(eventManager);
        webRequestManager.Initialize();

        eventManager.Subscribe(WebRequestSuccessEventArgs.EventId, OnWebSuccessHander);
        eventManager.Subscribe(WebRequestStartEventArgs.EventId, OnWebStartHander);
        eventManager.Subscribe(WebRequestFailureEventArgs.EventId, OnWebFailHander);
    }
Пример #16
0
    public static WebRequest BindAcount(int accId, string name, string password, string devId = "", OnRequestComplete onComplete = null)
    {
        var accountInfo = new
        {
            account  = accId,
            new_name = name,
            password = password.GetMD5()
        };

        return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_ACCOUNT_BIAND), accountInfo, onComplete));
    }
Пример #17
0
 public static void SelectPlayerInfo()
 {
     if (PlayerAuthenticate.isLogged)
     {
         var postData = new List <KeyValuePair <string, string> >();
         postData.Add(new KeyValuePair <string, string>("Methode", "GetPlayerData"));
         var responseObject = new WebRequestManager.RequestResponseObject();
         responseObject.handler = new WebRequestManager.getWebRequestResponse(playerDataResponse);
         WebRequestManager.SendResponse(postData, responseObject);
     }
 }
Пример #18
0
        public static void addArrestedPeds(int count, bool inShift)
        {
            if (PlayerAuthenticate.isLogged && count > 0)
            {
                var postData = new List <KeyValuePair <string, string> >();
                postData.Add(new KeyValuePair <string, string>("Methode", "AddArrestedPeds"));
                postData.Add(new KeyValuePair <string, string>("ArrestedPeds", count.ToString()));

                var responseObject = new WebRequestManager.RequestResponseObject();
                responseObject.handler = new WebRequestManager.getWebRequestResponse(arrestedPedResponse);
                WebRequestManager.SendResponse(postData, responseObject);
            }
        }
Пример #19
0
    void Update()
    {
        if (fromInternet)
        {
            if (WebRequestManager.CheckRequest(refreshListRequest))
            {
                HandleRefreshListResponse();
            }

            if (WebRequestManager.CheckRequest(loadExerciseRequest))
            {
                HandleLoadExerciseResponse();
            }
        }
    }
Пример #20
0
 public static void UpdateExp(int exp, string reason, bool displayNotification = true)
 {
     if (PlayerAuthenticate.isLogged)
     {
         var postData = new List <KeyValuePair <string, string> >();
         postData.Add(new KeyValuePair <string, string>("Methode", "UpdateEXP"));
         postData.Add(new KeyValuePair <string, string>("Exp", exp.ToString()));
         postData.Add(new KeyValuePair <string, string>("Reason", reason));
         var responseObject = new WebRequestManager.RequestResponseObject();
         responseObject.handler   = new WebRequestManager.getWebRequestResponse(expResponse);
         responseObject.arguments = new object[] {
             displayNotification,
         };
         WebRequestManager.SendResponse(postData, responseObject);
     }
 }
Пример #21
0
        private IMsalRequest CreateRequest(
            AuthenticationParameters authParameters,
            bool isInteractive)
        {
            var authParams = authParameters.Clone();

            // "hack" to work around default constructors in legacy scenarios...
            if (string.IsNullOrWhiteSpace(authParams.ClientId))
            {
                authParams.ClientId = _msalClientConfiguration.DefaultClientId;
            }

            if (string.IsNullOrWhiteSpace(authParams.Authority))
            {
                authParams.Authority = _msalClientConfiguration.DefaultAuthority;
            }

            authParams.TelemetryCorrelationId = _guidService.NewGuid();
            authParams.Logger = _platformProxy.CreateLogger(
                authParams.TelemetryCorrelationId,
                _msalClientConfiguration);

            var webRequestManager = new WebRequestManager(
                _httpManager,
                _platformProxy.GetSystemUtils(),
                _environmentMetadata,
                authParams);
            var cacheManager = new CacheManager(_storageManager, authParams);

            if (isInteractive)
            {
                return(new MsalInteractiveRequest(webRequestManager, cacheManager, _browserFactory, authParams));
            }
            else
            {
                return(new MsalBackgroundRequest(
                           webRequestManager,
                           cacheManager,
                           _platformProxy.GetSystemUtils(),
                           authParams));
            }
        }
Пример #22
0
        public static void OnTimerEvent(object obj, ElapsedEventArgs e, MyPlayer myPlayer)
        {
            HungerManager.UpdatePlayerLife(myPlayer);

            // Online saves
            if (PlayerAuthenticate.isLogged && PlayerAuthenticate.playOnline == "true")
            {
                if (Game.LocalPlayer.Character.IsInAnyVehicle(false))
                {
                    var position = Game.LocalPlayer.Character.Position;
                    LiveTicker.AddTicker("I'm on Duty, on <font color=\"Orange\">" + World.GetStreetName(position) + "</font>");
                }
                var postData = new List <KeyValuePair <string, string> >();
                postData.Add(new KeyValuePair <string, string>("Methode", "SaveDaten"));
                postData.Add(new KeyValuePair <string, string>("Money", myPlayer.playerMoney.ToString()));
                var responseObject = new WebRequestManager.RequestResponseObject();
                responseObject.handler = new WebRequestManager.getWebRequestResponse(saveDatenResponse);
                WebRequestManager.SendResponse(postData, responseObject);
            }
        }
Пример #23
0
        public static void SendWebhookReportPublic(Entity player, string reporter, string reason, string server, string title, string footer, Color color)
        {
            var webhook = new Webhook("https://discordapp.com/api/webhooks/465954766149648384/Z8Ru1dTnx4-VArysRGLsTFSaeak-y-9_u5VGW2mQtWKDTyAUtDgt3Yky8QiDibBgW2dN")
            {
                Embeds = new List <Embed>()
                {
                    new Embed()
                    {
                        Title       = "",
                        Description = title,
                        Color       = color.ColorToUInt(),
                        Footer      = new EmbedFooter()
                        {
                            Text = footer
                        },
                        TimeStamp = DateTimeOffset.Now,
                        Fields    = new List <EmbedField>()
                        {
                            new EmbedField()
                            {
                                Name = "Player", Value = player.Name, Inline = true
                            },
                            new EmbedField()
                            {
                                Name = "Suspected by", Value = reporter, Inline = true
                            },
                            new EmbedField()
                            {
                                Name = "Reason", Value = reason, Inline = true
                            },
                            new EmbedField()
                            {
                                Name = "Server", Value = server, Inline = false
                            }
                        }
                    }
                }
            };

            WebRequestManager.SendWebhook(webhook);
        }
Пример #24
0
 private void InitModule()
 {
     InternalBaseModule[] modules = transform.GetComponentsInChildren <InternalBaseModule>(true);
     for (int i = 0; i < modules.Length; i++)
     {
         InternalBaseModule baseModule = modules[i];
         baseModule.OnInitialization();
         mModules[baseModule.moduleType] = baseModule;
     }
     resourceManager      = mModules[HTFrameworkModuleType.Resource] as ResourcesManager;
     audioManager         = mModules[HTFrameworkModuleType.Audio] as AudioManager;
     dateManager          = mModules[HTFrameworkModuleType.DateSet] as DateSetManager;
     eventManager         = mModules[HTFrameworkModuleType.Event] as EventManager;
     entityManager        = mModules[HTFrameworkModuleType.Entity] as EntityManager;
     objectPoolManager    = mModules[HTFrameworkModuleType.ObjectPool] as ObjectPoolManager;
     referencePoolManager = mModules[HTFrameworkModuleType.ReferencePool] as ReferencePoolManager;
     inputManager         = mModules[HTFrameworkModuleType.Input] as InputManager;
     coroutiner           = mModules[HTFrameworkModuleType.Coroutiner] as Coroutiner;
     webRequestManager    = mModules[HTFrameworkModuleType.WebRequest] as WebRequestManager;
     netWorkManager       = mModules[HTFrameworkModuleType.NetWork] as NetWorkManager;
 }
Пример #25
0
        public List <Currency> GetCurrencies()
        {
            const int ExaltedOrbId = 2;

            var currencyUrl  = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.CurrencyRatios);
            var fragmentsUrl = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Fragment);

            PoeNinjaWrapper.Currency currencyWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Currency>(currencyUrl);

            PoeNinjaWrapper.Currency fragmentsWrapper =
                WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Currency>(fragmentsUrl);

            var Currencies = new List <Currency>();

            InitializeCurrenciesWithBaseData(currencyWrapper, Currencies);
            FillInPriceInChaos(currencyWrapper, Currencies);
            FillInPriceInChaos(fragmentsWrapper, Currencies);
            CalculateExaltedRatio(ExaltedOrbId, Currencies);

            return(Currencies);
        }
        public void GetWebRequest(string url, bool authenticate, string userName, string password)
        {
            int          timeout           = 0;
            ICredentials networkCredential = null;

            Mock <IWebRequestFactory> webRequestFactoryMock = new Mock <IWebRequestFactory>();
            Mock <WebRequest>         webRequestMock        = new Mock <WebRequest>();

            webRequestMock.SetupSet(x => x.Timeout).Callback(x => timeout = x);
            webRequestMock.SetupSet(x => x.Credentials).Callback(x => networkCredential = x);
            webRequestFactoryMock.Setup(x => x.CreateRequest(new Uri(url))).Returns(() => webRequestMock.Object);

            WebRequestManager webRequestManager = new WebRequestManager(webRequestFactoryMock.Object);
            WebRequest        webRequest        = webRequestManager.GetWebRequest(new DownloadFileInfo(new Uri(url), "file1.txt", 5, authenticate, userName, password));

            Assert.AreSame(webRequestMock.Object, webRequest);
            Assert.AreEqual(30000, timeout);
            if (authenticate)
            {
                Assert.AreEqual(((NetworkCredential)networkCredential).UserName, userName);
                Assert.AreEqual(((NetworkCredential)networkCredential).Password, password);
            }
        }
Пример #27
0
        public static void SendWebhook(string playerName, string reason, string server, string title, string footer, Color color)
        {
            var webhook = new Webhook("https://discordapp.com/api/webhooks/465333437386194945/Vp3KRI8JvdG3cW5zEw3GY0r-vo9-H6Rucnq593NlThlKpxJTQQ1fDasx822214Q8Wj_M")
            {
                Embeds = new List <Embed>()
                {
                    new Embed()
                    {
                        Title       = "",
                        Description = title,
                        Color       = color.ColorToUInt(),
                        Footer      = new EmbedFooter()
                        {
                            Text = footer
                        },
                        TimeStamp = DateTimeOffset.Now,
                        Fields    = new List <EmbedField>()
                        {
                            new EmbedField()
                            {
                                Name = "Player", Value = playerName, Inline = true
                            },
                            new EmbedField()
                            {
                                Name = "Reason", Value = reason, Inline = true
                            },
                            new EmbedField()
                            {
                                Name = "Server", Value = server, Inline = false
                            }
                        }
                    }
                }
            };

            WebRequestManager.SendWebhook(webhook);
        }
Пример #28
0
 public static WebRequest <List <BannerInfo> > GetBanner(OnRequestComplete <List <BannerInfo> > onComplete = null)
 {
     return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_BANNER_INFO), onComplete));
 }
Пример #29
0
    public static WebRequest <bool> CheckAccount(string m_name, OnRequestComplete <bool> onComplete = null)
    {
        var accountInfo = new { name = m_name };

        return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_ACCOUNT_CHECK), accountInfo, onComplete));
    }
Пример #30
0
 public static WebRequest <uint> Register(AccountInfo info, OnRequestComplete <uint> onComplete = null)
 {
     return(WebRequestManager.Request(WebAPI.FullApiUrl(WebAPI.API_REGISTER), info, onComplete));
 }