Example #1
0
    public void PushBack()
    {
        CustomLogger.debug(this, "PushBack", CustomLogger.guardLog);
        float            halfAttackAngle = 90;
        List <Transform> targets         = new List <Transform> ();

        foreach (Transform character in m_CharactersinRange)
        {
            if (character == null)
            {
                continue;
            }

            Vector3 lookDir = m_Body.forward;
            lookDir.y = 0;
            lookDir   = lookDir.normalized;
            Vector3 toTargetDir = (character.transform.position - this.transform.position);
            toTargetDir.y = 0;
            toTargetDir   = toTargetDir.normalized;
            float dotProd = Vector3.Dot(lookDir, toTargetDir);
            if (dotProd >= 0 && halfAttackAngle >= (90 - 90 * dotProd))
            {
                targets.Add(character);
            }
        }
        foreach (Transform target in targets)
        {
            CustomLogger.debug(this, "pushing : " + target.transform.name, CustomLogger.guardLog);
            if (target == null)
            {
                continue;
            }
            target.transform.GetComponent <IDamageable> ().PushBack(this.transform.position);
        }
    }
        public EmailNotificationResponse SendEmail(NotifyEmail notifyEmail)
        {
            if (EmailIsAnonymised(notifyEmail.EmailAddress))
            {
                return(null);
            }

            try
            {
                EmailNotificationResponse response = _client.SendEmail(
                    notifyEmail.EmailAddress,
                    notifyEmail.TemplateId,
                    notifyEmail.Personalisation);

                return(response);
            }
            catch (NotifyClientException e)
            {
                CustomLogger.Error(
                    "EMAIL FAILURE: Error whilst sending email using Gov.UK Notify",
                    new {
                    NotifyEmail            = notifyEmail,
                    Personalisation        = JsonConvert.SerializeObject(notifyEmail.Personalisation),
                    ErrorMessageFromNotify = e.Message
                });
                throw;
            }
        }
        public override void OnException(ExceptionContext context)
        {
            if (context.Exception is HttpException hex)
            {
                CustomLogger.Warning(hex.Message, hex);
                context.Result = new ViewResult {
                    ViewName = "CustomError",
                    ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), context.ModelState)
                    {
                        Model = new ErrorViewModel(hex.StatusCode) // set the model
                    }
                };

                context.ExceptionHandled = true;
            }
            else if (context.Exception is CustomErrorPageException customErrorPageException)
            {
                context.Result = new ViewResult
                {
                    StatusCode = customErrorPageException.StatusCode,
                    ViewName   = customErrorPageException.ViewName,
                    ViewData   = new ViewDataDictionary(new EmptyModelMetadataProvider(), context.ModelState)
                    {
                        // For this type of custom error page, we use the exception itself as the model
                        Model = customErrorPageException
                    }
                };
            }
            else if (context.Exception is CustomRedirectException customRedirectException)
            {
                context.Result = new RedirectResult(customRedirectException.RedirectUrl, permanent: false);
            }
        }
 /// <summary>
 /// constructor for Receipt controller
 /// </summary>
 /// <param name="receiptService"></param>
 /// <param name="logger"></param>
 public ReceiptController(
     IReceiptService receiptService,
     ILogger <ReceiptController> logger)
 {
     _logger  = new CustomLogger <ReceiptController>(logger);
     _service = (ReceiptService)receiptService;
 }
        [Obsolete("Please use method 'Employer' instead.")] //, true)]
        public IActionResult EmployerDetails(string e = null, int y = 0, string id = null)
        {
            if (!string.IsNullOrWhiteSpace(id))
            {
                Organisation organisation;

                try
                {
                    CustomResult <Organisation> organisationLoadingOutcome =
                        OrganisationBusinessLogic.GetOrganisationByEncryptedReturnId(id);

                    if (organisationLoadingOutcome.Failed)
                    {
                        return(organisationLoadingOutcome.ErrorMessage.ToHttpStatusViewResult());
                    }

                    organisation = organisationLoadingOutcome.Result;
                }
                catch (Exception ex)
                {
                    CustomLogger.Error("Cannot decrypt return id from query string", ex);
                    return(View("CustomError", new ErrorViewModel(400)));
                }

                string organisationIdEncrypted = organisation.GetEncryptedId();
                return(RedirectToActionPermanent(nameof(Employer), new { employerIdentifier = organisationIdEncrypted }));
            }

            if (string.IsNullOrWhiteSpace(e))
            {
                return(new HttpBadRequestResult("EmployerDetails: \'e\' query parameter was null or white space"));
            }

            return(RedirectToActionPermanent(nameof(Employer), new { employerIdentifier = e }));
        }
    // instantiate a new UI object with a given prefab id, onto a specified layer
    public UIObject CreateNewUIObject(string uiPrefabId, UILayerId layerId)
    {
        if (_activeUI.ContainsKey(uiPrefabId))
        {
            CustomLogger.Error(nameof(UIManager), $"Already contains active UI with prefab Id {uiPrefabId}!");
            return(null);
        }
        if (!_uiLayers.TryGetValue(layerId, out UILayer layer))
        {
            CustomLogger.Error(nameof(UIManager), $"Layer Id {layerId} not found!");
            return(null);
        }
        GameObject obj = AssetManager.Instance.GetAsset(uiPrefabId);

        if (obj == null)
        {
            CustomLogger.Error(nameof(UIManager), $"Could not retrieve prefab for id {uiPrefabId}!");
            return(null);
        }
        UIObject uiObject = obj.GetComponent <UIObject>();

        if (uiObject == null)
        {
            CustomLogger.Error(nameof(UIManager), $"Prefab {uiPrefabId} did not contain type {nameof(UIObject)}!");
            return(null);
        }
        UILayer       parent            = _uiLayers[layerId];
        UIObject      instancedUIObject = Instantiate(uiObject, _uiLayers[layerId].transform);
        UIObjectEntry newEntry          = new UIObjectEntry(layerId, instancedUIObject);

        _activeUI.Add(uiPrefabId, newEntry);
        CustomLogger.Log(nameof(UIManager), $"Creating ui object with prefab id {uiPrefabId}");
        return(instancedUIObject);
    }
Example #7
0
 /// <summary>
 /// constructor for GateEntries controller
 /// </summary>
 /// <param name="gateEntriesService"></param>
 /// <param name="logger"></param>
 public GateEntriesController(
     IGateEntriesService gateEntriesService,
     ILogger <GateEntriesController> logger)
 {
     _logger             = new CustomLogger <GateEntriesController>(logger);
     _gateEntriesService = (GateEntriesService)gateEntriesService;
 }
Example #8
0
        public static string SendEndSignal(string configUUID, string host_addr, CustomLogger clog)
        {
            // Create a request using a URL that can receive a post.
            WebRequest analysisRequest = WebRequest.Create(host_addr);

            analysisRequest.Method = "GET";

            // Set the Config-GUID header
            analysisRequest.Headers["Config-GUID"] = configUUID;

            string analysisResponse = "[ProducerAzure] Default analysis response";

            try
            {
                HttpWebResponse endResponse = (HttpWebResponse)analysisRequest.GetResponse();
                if (endResponse.StatusCode != HttpStatusCode.OK)
                {
                    clog.RawLog(LogLevel.ERROR, "[ProducerAzure] Bad consumer analysis status");
                }
                using (Stream responseStream = endResponse.GetResponseStream())
                {
                    // Open the stream using a StreamReader for easy access and read the content
                    analysisResponse = new StreamReader(responseStream).ReadToEnd();
                }
                //analysisResponse = endResponse.StatusDescription;
                endResponse.Close();
            }
            catch (WebException)
            {
                clog.RawLog(LogLevel.ERROR, "Got Web exception!");
            }
            return(analysisResponse);
        }
Example #9
0
        public override Task ExecuteResultAsync(ActionContext actionContext)
        {
            string message;

            if (Enum.IsDefined(typeof(HttpStatusCode), StatusCode.Value))
            {
                message = $"{(HttpStatusCode) StatusCode.Value} ({StatusCode.Value}):  {StatusDescription}";
            }
            else
            {
                message = $"HttpStatusCode ({StatusCode.Value}):  {StatusDescription}";
            }
            if (StatusCode == 404 || StatusCode == 405)
            {
                CustomLogger.Warning(message);
            }
            else if (StatusCode >= 500)
            {
                CustomLogger.Fatal(message);
            }
            else if (StatusCode >= 400)
            {
                CustomLogger.Error(message);
            }

            return(base.ExecuteResultAsync(actionContext));
        }
 /// <summary>
 /// Force stops the research.
 /// </summary>
 public virtual void StopResearch()
 {
     currentManager.Cancel();
     StatusInfo = new ResearchStatusInfo(ResearchStatus.Stopped, StatusInfo.CompletedStepsCount);
     CustomLogger.Write("Research ID - " + ResearchID.ToString() +
                        ". Research - " + ResearchName + ". STOPPED " + GetResearchType() + " RESEARCH.");
 }
        /// <summary>
        /// Saves the results of research analyze.
        /// </summary>
        protected void SaveResearch()
        {
            if (result.EnsembleResults.Count == 0 || result.EnsembleResults[0] == null)
            {
                StatusInfo = new ResearchStatusInfo(ResearchStatus.Failed, StatusInfo.CompletedStepsCount + 1);
                return;
            }
            result.ResearchID       = ResearchID;
            result.ResearchName     = ResearchName;
            result.ResearchType     = GetResearchType();
            result.ModelType        = modelType;
            result.RealizationCount = realizationCount;
            result.Size             = result.EnsembleResults[0].NetworkSize;
            result.Edges            = result.EnsembleResults[0].EdgesCount;
            result.Date             = DateTime.Now;

            result.ResearchParameterValues   = ResearchParameterValues;
            result.GenerationParameterValues = GenerationParameterValues;

            Storage.Save(result);
            StatusInfo = new ResearchStatusInfo(ResearchStatus.Completed, StatusInfo.CompletedStepsCount + 1);

            CustomLogger.Write("Research - " + ResearchName + ". Result is SAVED");

            result.Clear();
            CustomLogger.Write("Research - " + ResearchName + ". Result is CLEARED.");
        }
Example #12
0
        public IActionResult ChangeAddressGet(long id)
        {
            Organisation organisation = dataRepository.Get <Organisation>(id);

            if (!string.IsNullOrWhiteSpace(organisation.CompanyNumber))
            {
                try
                {
                    CompaniesHouseCompany organisationFromCompaniesHouse =
                        companiesHouseApi.GetCompany(organisation.CompanyNumber);

                    OrganisationAddress addressFromCompaniesHouse =
                        UpdateFromCompaniesHouseService.CreateOrganisationAddressFromCompaniesHouseAddress(
                            organisationFromCompaniesHouse.RegisteredOfficeAddress);

                    if (!organisation.GetLatestAddress().AddressMatches(addressFromCompaniesHouse))
                    {
                        return(OfferNewCompaniesHouseAddress(organisation, addressFromCompaniesHouse));
                    }
                }
                catch (Exception ex)
                {
                    // Use Manual Change page instead
                    CustomLogger.Warning("Error from Companies House API", ex);
                }
            }

            // In all other cases...
            // * Organisation doesn't have a Companies House number
            // * CoHo API returns an error
            // * CoHo address matches Organisation address
            // ... send to the Manual Change page
            return(SendToManualChangePage(organisation));
        }
        public IActionResult SendFeedbackPost(FeedbackViewModel viewModel)
        {
            viewModel.ParseAndValidateParameters(Request, m => m.HowEasyIsThisServiceToUse);
            viewModel.ParseAndValidateParameters(Request, m => m.HowDidYouHearAboutGpg);
            viewModel.ParseAndValidateParameters(Request, m => m.OtherSourceText);
            viewModel.ParseAndValidateParameters(Request, m => m.WhyVisitGpgSite);
            viewModel.ParseAndValidateParameters(Request, m => m.OtherReasonText);
            viewModel.ParseAndValidateParameters(Request, m => m.WhoAreYou);
            viewModel.ParseAndValidateParameters(Request, m => m.OtherPersonText);
            viewModel.ParseAndValidateParameters(Request, m => m.Details);

            if (viewModel.HasAnyErrors())
            {
                // If there are any errors, return the user back to the same page to correct the mistakes
                return(View("SendFeedback", viewModel));
            }

            CustomLogger.Information("Feedback has been received", viewModel);

            Feedback feedbackDatabaseModel = ConvertFeedbackViewModelIntoFeedbackDatabaseModel(viewModel);

            dataRepository.Insert(feedbackDatabaseModel);
            dataRepository.SaveChanges();

            return(View("FeedbackSent"));
        }
    private void SetPathToTarget()
    {
        IntVector3 destination = GetClosestAvailableTile();

        if (destination == _unit.MoveController.MapPosition)
        {
            CustomLogger.Warn(nameof(AIState_Chase), $"Could not find closest available tile!");
            _unit.Navigator.OnArrivedFinalDestination -= OnArrivedFinalDestination;
            SetReadyToTransition(_onFailedToPath);
        }
        PathStatus status = _unit.Navigator.SetDestination(
            _unit.MoveController.MapPosition,
            destination);

        if (status == PathStatus.Invalid)
        {
            CustomLogger.Warn(nameof(AIState_Chase), $"Could not path to destination: {destination}!");
            _unit.Navigator.OnArrivedFinalDestination -= OnArrivedFinalDestination;
            SetReadyToTransition(_onFailedToPath);
            return;
        }
        _unit.Navigator.OnArrivedFinalDestination += OnArrivedFinalDestination;
        _unit.Navigator.LookTarget = null;
        float speed = _fullSpeed ? _unit.UnitData.RunSpeed : _unit.UnitData.WalkSpeed;

        _moveController.SetSpeed(speed);
    }
Example #15
0
        public bool CheckConnected()
        {
            try
            {
                CustomLogger.Write("Research - " + ResearchName +
                                   ". CHECK CONNECTED STARTED for network - " + NetworkID.ToString());

                bool result = false;
                Debug.Assert(networkGenerator.Container != null);
                networkAnalyzer.Container = networkGenerator.Container;
                Object ccd = networkAnalyzer.CalculateOption(AnalyzeOption.ConnectedComponentDistribution);
                Debug.Assert(ccd is SortedDictionary <Double, Double>);
                SortedDictionary <Double, Double> r = ccd as SortedDictionary <Double, Double>;
                result = r.ContainsKey(networkGenerator.Container.Size);
                if (!result)
                {
                    UpdateStatus(NetworkStatus.StepCompleted);  // for analyze
                }

                CustomLogger.Write("Research - " + ResearchName +
                                   ". CHECK COMPLETED FINISHED for network - " + NetworkID.ToString());

                return(result);
            }
            catch (CoreException ex)
            {
                UpdateStatus(NetworkStatus.Failed);

                CustomLogger.Write("Research - " + ResearchName +
                                   "CHECK COMPLETED FAILED for network - " + NetworkID.ToString() +
                                   ". Exception message: " + ex.Message);
                return(false);
            }
        }
        public override Task ExecuteResultAsync(ActionContext actionContext)
        {
            string message;

            if (Enum.IsDefined(typeof(HttpStatusCode), StatusCode.Value))
            {
                message = $"{(HttpStatusCode)StatusCode.Value} ({StatusCode.Value}):  {StatusDescription}";
            }
            else
            {
                message = $"HttpStatusCode ({StatusCode.Value}):  {StatusDescription}";
            }
            if (StatusCode == 404 || StatusCode == 405)
            {
                CustomLogger.Warning(message);
            }
            else if (StatusCode >= 500)
            {
                CustomLogger.Fatal(message);
            }
            else if (StatusCode >= 400)
            {
                CustomLogger.Error(message);
            }

            ViewName = "Error";
            ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), actionContext.ModelState)
            {
                Model = new ErrorViewModel((int)StatusCode)  // set the model
            };

            return(base.ExecuteResultAsync(actionContext));
        }
 public static bool TryParseAssetBundlePath(string assetName, out string filePath)
 {
     filePath = "";
     string[] assetNameComponents = assetName.Split(AssetNameSplitter);
     // this should be split into 2 parts
     if (assetNameComponents.Length != 2)
     {
         CustomLogger.Error(nameof(IAssetManager), $"{assetName} is an invalid asset name!");
         return(false);
     }
     string[] filePathComponents = assetNameComponents[0].Split(AssetBundlePathSplitter);
     // file path components should be greater than 0
     if (filePathComponents.Length == 0)
     {
         return(false);
     }
     filePath = filePathComponents[0];
     for (int i = 1; i < filePathComponents.Length; i++)
     {
         string component = filePathComponents[i].ToLower();
         filePath = $"{filePath}/{component}";
     }
     filePath = $"Assets/BundledResources/{filePath}";
     return(true);
 }
Example #18
0
        public async SystemTasks.Task TestCustomLogger()
        {
            CustomLogger  logger = new CustomLogger();
            Configuration config = Configuration.Create().WithVerbosityEnabled();

            ICoyoteRuntime runtime = RuntimeFactory.Create(config);

            runtime.SetLogger(logger);

            Generator generator = Generator.Create();

            Task task = Task.Run(() =>
            {
                int result = generator.NextInteger(10);
                logger.WriteLine($"Task '{Task.CurrentId}' completed with result '{result}'.");
            });

            await task;

            string expected = @"<RandomLog> Task '' nondeterministically chose ''. Task '' completed with result ''.";
            string actual   = RemoveNonDeterministicValuesFromReport(logger.ToString());

            Assert.Equal(expected, actual);

            logger.Dispose();
        }
        protected override void ValidateResearchParameters()
        {
            if (!ResearchParameterValues.ContainsKey(ResearchParameter.InputPath) ||
                ResearchParameterValues[ResearchParameter.InputPath] == null ||
                ((MatrixPath)ResearchParameterValues[ResearchParameter.InputPath]).Path == "")
            {
                CustomLogger.Write("Research - " + ResearchName + ". Invalid research parameters.");
                throw new InvalidResearchParameters();
            }

            MatrixPath mp = ((MatrixPath)ResearchParameterValues[ResearchParameter.InputPath]);

            if ((File.GetAttributes(mp.Path) & FileAttributes.Directory) != FileAttributes.Directory)
            {
                CustomLogger.Write("Research - " + ResearchName + ". Invalid research parameters." +
                                   " Directory should be specified.");
                throw new InvalidResearchParameters();
            }

            if (Directory.GetFiles(mp.Path, "*.txt").Count() != 1)
            {
                CustomLogger.Write("Research - " + ResearchName + ". Invalid research parameters." +
                                   " Directory should contain only 1 .txt file.");
                throw new InvalidResearchParameters();
            }

            base.ValidateResearchParameters();
        }
        public bool Execute(IDictionary <string, object> parameters)
        {
            CustomLogger.Information("Get Fruits Step start");

            CustomLogger.Information("Get Fruits Step Complete");
            return(true);
        }
Example #21
0
        static void Main(string[] args)
        {
            try
            {
                string configFileName = args[0];
                CustomLogger.Information("Execution start");
                CustomLogger.Information($"Loading Unity from File:{configFileName}");
                IDictionary <string, object> parameters = new Dictionary <string, object> {
                    { "CallCarrier", "false" },
                    { "PackageFruits", "false" }
                };

                var container = _Bootstrapper(configFileName);

                IWorkflowManager mgr         = container.Resolve <IWorkflowManager>("SimpleWorkflowManager");
                bool             returnValue = mgr.Initiate(parameters);
            }
            catch (Exception ex)
            {
                CustomLogger.Exception(ex, "MAIN");
            }
            finally
            {
                Console.ReadKey();
                CustomLogger.Information("Execution complete");
            }
        }
Example #22
0
        /// <summary>
        /// Program entry point
        /// </summary>
        /// <param name="args">Passed arguments to program</param>
        public static void Main(string[] args)
        {
            // Configuration application
            var services = new ServiceCollection();

            Startup.ConfigureServices(services);

            var serviceProvider = services.BuildServiceProvider();
            var logger          = serviceProvider.GetService <ICustomLoggerFactory>().CreateLogger(typeof(Program).FullName);

            // It just show how you can to use log event
            logger.LogAdded += (o, e) => Console.WriteLine($"Getting log event with message: {e.Message}\n");

            try
            {
                logger.Debug($"{Resource.ProgramStarted}: {DateTime.Now.ToLocalTime()}");

                // Running application
                serviceProvider.GetService <MainPage>().Display();
            }
            catch (Exception ex)
            {
                logger.Critical(ex.Message, ex);
            }
            finally
            {
                logger.Debug($"{Resource.ProgramFinished}: {DateTime.Now.ToLocalTime()}");
                NLog.LogManager.Shutdown();
                CustomLogger.ShutDown();
            }
        }
 public bool TransitionToScene(string sceneName, bool requiresLoadingScreen)
 {
     Debug.Log($"Loading scene {sceneName}...");
     if (_isLoadingScene)
     {
         CustomLogger.Warn(nameof(SceneController), $"Already loading scene {_nextSceneName}!");
         return(false);
     }
     if (CurrentSceneName == sceneName)
     {
         CustomLogger.Log(nameof(SceneController), $"Already in scene {CurrentSceneName}!");
         return(true);
     }
     _isLoadingScene = true;
     _nextSceneName  = sceneName;
     if (requiresLoadingScreen)
     {
         LoadingScreenController.Instance.OnLoadingScreenShowComplete += OnEndSceneTransition;
         LoadingScreenController.Instance.ShowLoadingScreen();
     }
     else
     {
         StartCoroutine(LoadSceneOneFrame());
     }
     return(true);
 }
Example #24
0
        internal async Task <bool> DeleteDeckAsync(Deck deck)
        {
            try
            {
                HttpResponseMessage result = await _httpClient.DeleteAsync(new Uri(_deckUri, "decks/" + deck.DeckId));

                return(result.IsSuccessStatusCode);
            }
            catch (HttpRequestException ex)
            {
                await CustomLogger.Log("DeleteDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(false);
            }
            catch (InvalidOperationException ex)
            {
                await CustomLogger.Log("DeleteDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(false);
            }
            catch (ArgumentNullException ex)
            {
                await CustomLogger.Log("DeleteDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(false);
            }
        }
Example #25
0
        public async Task TestGraphLoggerCollapsed()
        {
            CustomLogger  logger = new CustomLogger();
            Configuration config = Configuration.Create().WithVerbosityEnabled();

            var graphBuilder = new ActorRuntimeLogGraphBuilder(false);

            graphBuilder.CollapseMachineInstances = true;

            var           tcs     = TaskCompletionSource.Create <bool>();
            IActorRuntime runtime = CreateTestRuntime(config, tcs, logger);

            runtime.RegisterLog(graphBuilder);

            ActorId serverId = runtime.CreateActor(typeof(Server));

            runtime.CreateActor(typeof(Client), new ClientSetupEvent(serverId));
            runtime.CreateActor(typeof(Client), new ClientSetupEvent(serverId));
            runtime.CreateActor(typeof(Client), new ClientSetupEvent(serverId));

            await WaitAsync(tcs.Task, 5000000);

            await Task.Delay(1000);

            string actual = graphBuilder.Graph.ToString();

            Assert.Contains("<Node Id='Microsoft.Coyote.Production.Tests.Actors.CustomActorRuntimeLogTests+Client.Client' Label='Client'/>", actual);
            Assert.Contains("<Node Id='Microsoft.Coyote.Production.Tests.Actors.CustomActorRuntimeLogTests+Server.Complete' Label='Complete'/>", actual);

            logger.Dispose();
        }
Example #26
0
        internal async Task <bool> EditDeckAsync(Deck deck)
        {
            try
            {
                var json = JsonConvert.SerializeObject(deck);
                HttpResponseMessage result = await _httpClient.PutAsync(new Uri(_deckUri, "decks/" + deck.DeckId),
                                                                        new StringContent(json, Encoding.UTF8, "application/json")).ConfigureAwait(true);

                return(result.IsSuccessStatusCode);
            }
            catch (HttpRequestException ex)
            {
                await CustomLogger.Log("EditDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(false);
            }
            catch (JsonReaderException ex)
            {
                await CustomLogger.Log("EditDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(false);
            }
            catch (ArgumentNullException ex)
            {
                await CustomLogger.Log("EditDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(false);
            }
        }
 public CollectionController(IUserValidationService userValidationService, ICollectionService service, ILogger <ICategoryService> logger, IConfiguredProductService configuredProductService)
 {
     _collectionService        = service;
     _configuredProductService = configuredProductService;
     _logger = new CustomLogger(logger);
     _userValidationService = userValidationService;
 }
Example #28
0
        public async Task <Deck[]> GetUserDecksAsync(int userId)
        {
            try
            {
                var clientResult = await _httpClient.GetAsync(_deckUri).ConfigureAwait(true);

                var jsonData = await clientResult.Content.ReadAsStringAsync().ConfigureAwait(true);

                Deck[] decks = JsonConvert.DeserializeObject <Deck[]>(jsonData);

                return(decks.Where(x => x.UserId == userId).ToArray());
            }
            catch (HttpRequestException ex)
            {
                await CustomLogger.Log("GetUserDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(null);
            }
            catch (ArgumentNullException ex)
            {
                await CustomLogger.Log("GetUserDeckAsync: " + DateTime.Now.ToShortTimeString() + " " + ex.StackTrace).ConfigureAwait(true);

                return(null);
            }
        }
Example #29
0
        public bool Execute(IDictionary <string, object> parameters)
        {
            CustomLogger.Information("Update Stock start");

            CustomLogger.Information("Update Stock Complete");
            return(true);
        }
Example #30
0
 public override void StopActions()
 {
     CustomLogger.debug(this, "stop actions", CustomLogger.guardLog);
     base.StopActions();
     m_Attack = null;
     m_Dash   = null;
 }