public virtual async Task <int> LogErrorAsync(IErrorModel model) { try { _tracker.TrackError(model.Exception, model.Location, model.FullName); _logger.Log(LogLevel.Error, model.Exception.ToString()); var path = Path.Combine(Environment.SpecialFolder.ApplicationData.ToString(), model.ApplicationName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var logFile = path + "\\ErrorLog.txt"; using (var stream = new StreamWriter(logFile)) { var logText = $"Date & Time: {DateTime.Now}\nUser: {model.FullName}\nLocation: {model.Location}\nError: {model.Exception.Message.Trim()}\n----------------------------------------"; await stream.WriteAsync(logText); stream.Flush(); } return(0); } // lol I'm not going to try to log an error about logging an error... catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message.Trim()); return(-1); } }
public ScalogramModel(ILogger <ScalogramModel> logger, SoundDataModel soundDataModel, IErrorModel errorModel) { _logger = logger; _soundDataModel = soundDataModel; _errorModel = errorModel; CreateScalogram.SubscribeAsync(CreateScalogramImpl); }
public SubmissionController(ILogger <SubmissionController> _logger, ISubmissionService submissionService, IErrorModel errorModel) : base(errorModel) { logger = _logger; this.submissionService = submissionService; }
public Corrector(IErrorModel errorModel, ILanguageModel languageModel, IAccentModel accentModel = null, bool skipCandidatesMissingInNgrams = false) { this.errorModel = errorModel; this.languageModel = languageModel; this.accentModel = accentModel; this.skipCandidatesMissingInNgrams = skipCandidatesMissingInNgrams; }
public SubmissionService(ISubmissionRepository submissionRepository, IActivityService activityService, IErrorModel errorModel, ILogger <SubmissionService> logger) : base(errorModel) { this.submissionRepository = submissionRepository; this.activityService = activityService; this.logger = logger; }
private void FaxHataUret_Click(object sender, EventArgs e) { errorModel = new FaxAdapter { ErrorNumber = 8002, ErrorDescription = " Fax Adresi Bulunamadı." }; listBox1.Items.Add(errorModel.SendMail()); errorRepository[i] = errorModel.SendMail(); i++; }
protected virtual void HandleInvalidModelState(IErrorModel display) { //lastly, if it is not valid, add the model state to the outgoing object and throw a 403 if (!ModelState.IsValid) { display.Errors = ModelState.ToErrorDictionary(); throw new HttpResponseException(Request.CreateValidationErrorResponse(display)); } }
private void ServiceHataUret_Click(object sender, EventArgs e) { errorModel = new ServiceError { ErrorNumber = 4004, ErrorDescription = " Sunucuya bağlanılamadı." }; listBox1.Items.Add(errorModel.SendMail()); errorRepository[i] = errorModel.SendMail(); i++; }
private void DbHataUret_Click(object sender, EventArgs e) { errorModel = new FaxAdapter { ErrorNumber = 4000, ErrorDescription = " Veri tabanına bağlanılamadı." };; errorRepository[i] = errorModel.SendMail(); listBox1.Items.Add(errorModel.SendMail()); i++; }
public ErrorModelTest() { dictionary = new SimpleDictionary(); dictionary.Add("actress"); dictionary.Add("cress"); dictionary.Add("caress"); dictionary.Add("access"); dictionary.Add("across"); dictionary.Add("acres"); errorModel = new ErrorModel(dictionary); }
public void OnError(IErrorModel em) { var key = em.Key; var errors = em.Errors; var es = errors ?? Enumerable.Empty<ValidationError>(); #if false foreach (var item in es) { Console.WriteLine(item.ErrorContent); } #endif this.Errors[key] = es; this.SubmitCommand.RaiseCanExecuteChanged(); }
public SoundDataModel(ILogger <SoundDataModel> logger, IErrorModel errorModel, UserPreferencesModel userPreferencesModel) { _logger = logger; _errorModel = errorModel; _userPreferencesModel = userPreferencesModel; LoadFile.SubscribeAsync(LoadFileImpl); LoadContainer.SubscribeAsync(LoadContainerImpl); CalculateSampleSignalSpectrum.SubscribeAsync(_ => CalculateCommonSignalSpectrumImpl()); GenerateSample.SubscribeAsync(GenerateSampleImp); SetCurrentWorkDirectory.SubscribeAsync(SetCurrentWorkDirectoryImpl); var currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); SetCurrentWorkDirectoryImpl(_userPreferencesModel.WorkDirectory ?? currentPath); LoadDefaultData(); }
public DictionaryGenerator(Dictionary dictionary, string directory, string outputDirectory) { this.dictionary = dictionary; this.outputDirectory = outputDirectory; this.directory = directory; this.errorModel = new MPSpell.Correction.ErrorModel(dictionary); this.languageModel = new LanguageModel(dictionary); int initValue = 1; char[] alphabetWithSpace = dictionary.GetAlphabetForErrorModel(true).ToCharArray(); char[] alphabet = dictionary.GetAlphabetForErrorModel().ToCharArray(); insGen = new InsertionsMatrixGenerator(alphabetWithSpace, initValue); delGen = new DeletionsMatrixGenerator(alphabetWithSpace, initValue); subGen = new SubstitutionsMatrixGenerator(alphabet, initValue); trnGen = new TranspositionsMatrixGenerator(alphabet, initValue); charCounter = new CharFrequencyCounter(alphabetWithSpace.ToStringArray()); twoCharCounter = new TwoCharFrequencyCounter(alphabetWithSpace.ToStringArray()); }
/// <summary> /// Returns a validation problem result for the <see cref="IErrorModel"/> and the <see cref="ModelStateDictionary"/> /// </summary> /// <param name="model"></param> /// <param name="modelStateDictionary"></param> /// <param name="statusCode"></param> /// <returns></returns> protected virtual ActionResult ValidationProblem(IErrorModel model, ModelStateDictionary modelStateDictionary, int statusCode = StatusCodes.Status400BadRequest) { model.Errors = modelStateDictionary.ToErrorDictionary(); return(ValidationProblem(model, statusCode)); }
public GameService(IGameRepository gameRepository, IErrorModel errorModel) : base(errorModel) { this.gameRepository = gameRepository; }
public ResponseDTO(IErrorModel errorModel) { Errors = errorModel.Errors; }
internal ModelOutput(string name, IErrorModel errorModel) { Name = name; ErrorModel = errorModel; }
public _BaseController(IErrorModel errorModel) : base() { this.ErrorModel = errorModel; }
public _BaseService(IErrorModel errorModel) { ErrorModel = errorModel; }
public AudioPlayerModel(IErrorModel errorModel) { _errorModel = errorModel; Play.SubscribeAsync(PlayImpl); }
private void PrepareProject(Dictionary dictionary, string resultDirectory, string reportDirectory, bool preserveSubfolders) { this.ExportContext = false; this.ResultDirectory = resultDirectory; this.ReportDirectory = reportDirectory; this.dictionary = dictionary; // setup models this.languageModel = new LanguageModel(dictionary); this.errorModel = new ErrorModel(dictionary); this.accentModel = dictionary.IsAccentModelAvailable() ? new AccentModel(dictionary) : null; // setup corrector this.corrector = new Corrector(errorModel, languageModel, accentModel); this.ThreadsAvailable = this.ScaleThreads(); this.filesGroups = this.DivadeIntoGroups(this.ThreadsAvailable); this.ThreadsUsed = this.FilesToProcess.Count > 1 ? filesGroups.Length : 1; // other settings PreserveSubfolders = preserveSubfolders; }
public GamesController(IGameService gameService, IErrorModel errorModel) : base() { this.gameService = gameService; ErrorModel = errorModel; }