public void DeepClone_MultiLayerInterface(TypeModel model) { var cleaner = new Cleaner { OdorCode = 10, NbBubbles = 12, IsDirty = true }; var cloneFarter = (Cleaner)model.DeepClone(cleaner); Assert.AreEqual(cleaner.OdorCode, cloneFarter.OdorCode); Assert.AreEqual(cleaner.NbBubbles, cloneFarter.NbBubbles); Assert.AreEqual(cleaner.IsDirty, cloneFarter.IsDirty); }
public static string CloseTags(string html) { return(Cleaner.Render(Cleaner.ParseDepth(html, 0))); }
public Task DeleteAsync(string?id) => ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(id); await id.Validate(nameof(id)).Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false); await _dataService.DeleteAsync(id).ConfigureAwait(false); }, BusinessInvokerArgs.Delete);
// For memory-mapped buffers -- invoked by FileChannelImpl via reflection // protected internal DirectByteBuffer(int cap, long addr, FileDescriptor fd, Runnable unmapper) : base(-1, 0, cap, cap, fd) { Address = addr; Cleaner_Renamed = Cleaner.create(this, unmapper); Att = null; }
// Invoked to construct a direct ByteBuffer referring to the block of // memory. A given arbitrary object may also be attached to the buffer. // internal DirectByteBuffer(long addr, int cap, Object ob) : base(-1, 0, cap, cap) { Address = addr; Cleaner_Renamed = null; Att = ob; }
public void addCleaner(Cleaner c) { cleaners.Add(c); c.Map = this; c.Run(); }
/// <summary> /// Парсит Full Text Search параметры /// </summary> /// <param name="searchQueryParams">параметры запроса</param> /// <param name="hasError">есть ли ошибка при парсинге поисковой строки</param> /// <param name="fieldIdList">список id полей(атрибутов)</param> /// <param name="queryString">параметры Full Text поиска для Sql Server</param> /// <param name="rawQueryString">Строка запроса</param> /// <returns>True - искать, False - не искать</returns> public bool Parse(IEnumerable <ArticleSearchQueryParam> searchQueryParams, out bool?hasError, out string fieldIdList, out string queryString, out string rawQueryString) { hasError = null; fieldIdList = null; queryString = null; rawQueryString = null; var processedParam = searchQueryParams?.FirstOrDefault(p => p.SearchType == ArticleFieldSearchType.FullText); if (processedParam == null) { return(false); } var allIds = false; int[] ids = null; if (string.IsNullOrWhiteSpace(processedParam.FieldId)) { allIds = true; } else { // получить ID, все что не число будет преобразовано в -1000 ids = Converter.ToInt32Collection(processedParam.FieldId, ',', true, -1000); if (ids.Length == 0) { throw new ArgumentException("FieldID"); } // если есть -1000 значить есть не числа if (ids.Any(i => i == -1000)) { throw new FormatException("FieldID"); } } // параметры должны быть не пустые и их не меньше 1х (используем 1й и второй - остальные отбрасываем) if (processedParam.QueryParams == null || processedParam.QueryParams.Length < 1) { throw new ArgumentException(); } // первый параметр должен быть null или строкой if (processedParam.QueryParams[0] != null && !(processedParam.QueryParams[0] is string)) { throw new InvalidCastException(); } var qString = (string)processedParam.QueryParams[0]; if (string.IsNullOrWhiteSpace(qString)) { return(false); } if (!_iSearchGrammarParser.TryParse(qString, out var sqlQString)) { hasError = true; return(true); } hasError = false; fieldIdList = allIds ? string.Empty : string.Join(",", ids); queryString = Cleaner.ToSafeSqlString(sqlQString); rawQueryString = qString; return(true); }
public void Ctor_correctly_schedules() { _target = new Cleaner(_tradeRepo, _analyticsService, _executionService, _lastValueCache, _schedulerService); }
public async Task <ActionResult> Register(RegistrModel model) { //Проверяет правильность заполнения формы if (ModelState.IsValid) { //Создает модель пользователя AppUser user = new AppUser { Email = model.Email, UserName = model.Login, Name = model.Name, Surname = model.Surname, DateOfRegistration = DateTime.Today.Date, Gender = model.Gender, Online = false }; user.Photo = model.File == null ? AppUser.DefaultPhoto :user.Id.GetHashCode() + ".jpg"; //Добавляет пользователя в бд IdentityResult result = await UserManager.CreateAsync(user, model.Password); //Проверяет был ли пользователь добавлен в бд if (result.Succeeded) { //Создает токен подтверждения Email var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // Создаем ссылку для подтверждения var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); try { // Отправка письма await UserManager.SendEmailAsync(user.Id, "Подтверждение электронной почты", "Для завершения регистрации перейдите по ссылке: <a href=\"" + callbackUrl + "\">завершить регистрацию</a>"); } //Возникает,если указанного Email не существует catch (SmtpException e) { ModelState.AddModelError("", e.Message); await UserManager.DeleteAsync(user); return(View(model)); } //Проверяет загрузил ли пользователь фото if (model.File != null) { //Добаляет фото пользователя в проект LoadPhoto(model.File, user.Id); } //Удаляет пользователя,если он не подтвердил свою учетную записть в течении 10 минут ThreadPool.QueueUserWorkItem(delegate { Cleaner.DeleteNoConfirmedUser(user.Id); }); ViewBag.Message = "На указанный электронный адрес отправлены дальнейшие инструкции по завершению регистрации"; return(View("Confirm")); } else { foreach (string error in result.Errors) { ModelState.AddModelError("", error); } } } return(View(model)); }
private void URLRedirect() { if (Request["recurl"] == null) { //If this is null means that the redirect haven't started string op1 = ""; if (Request["findopt1"] != null) { op1 = Request["findopt1"].ToString(); } else { op1 = ""; } string op2 = ""; if (Request["findopt2"] != null) { op2 = Request["findopt2"].ToString(); } else { op2 = ""; } string op3 = ""; if (Request["findopt3"] != null) { op3 = Request["findopt3"].ToString(); } else { op3 = ""; } string op4 = ""; if (Request["findopt4"] != null) { op4 = Request["findopt4"].ToString(); } else { op4 = ""; } string op5 = ""; if (Request["findopt5"] != null) { op5 = Request["findopt5"].ToString(); } else { op5 = ""; } string txt = ""; if (Request["txtadv"] != null) { txt = Request["txtadv"].ToString(); } else { txt = ""; } Cleaner c = new Cleaner(); Response.Redirect("search.pagegroup-" + _pgg + "_page-" + _pg + "_textsearch-" + c.cleanURL(txt) + "_fopt-" + op1 + "_fopt-" + op2 + "_fopt-" + op3 + "_fopt-" + op4 + "_fopt-" + op5 + ".shtml"); } }
public void Start() { log.Info("---\tInitializing CacheCleanUpService\t---"); ConfigureScheduledServiceCheck(); void ConfigureScheduledServiceCheck() { log.Info("---\tStarting CacheCleanUpService\t---"); this.StartBase(); // TODO: Read polling timeout from config var cleanUps = GetCleanUps(); foreach (var cleanUp in cleanUps) { Timers.Start("Poller for " + cleanUp.FilePath, (int)TimeSpan.FromSeconds(cleanUp.TimeSpanFromSeconds).TotalMilliseconds, async() => { try { var guid = Guid.NewGuid(); log.Info($"{Environment.NewLine}----------------------- Cache cleanup @ {guid} started -----------------------"); CleanUpOptions cleanUpOptions = new CleanUpOptions(cleanUp.FilePath); cleanUpOptions.RemoveEmptyFolders = cleanUp.CleanUpOptions.RemoveEmptyFolders; ConfigureThreshold(); cleanUpOptions.DisplayOnly = cleanUp.CleanUpOptions.DisplayOnly; cleanUpOptions.RemoveEmptyFolders = cleanUp.CleanUpOptions.RemoveEmptyFolders; cleanUpOptions.UseRecycleBin = cleanUp.CleanUpOptions.UseRecycleBin; cleanUpOptions.Recursive = cleanUp.CleanUpOptions.Recursive; Cleaner filesProcessor = new Cleaner(log, cleanUpOptions); filesProcessor.CleanUp(); //Activity log.Info($"{Environment.NewLine}----------------------- Cache cleanup @ {guid} finished -----------------------{Environment.NewLine}{Environment.NewLine}{Environment.NewLine}"); #region Local Functions void ConfigureThreshold() { if (cleanUp.CleanUpOptions.ThresholdInSeconds != default(int) && cleanUp.CleanUpOptions.ThresholdInDays == default(int)) { cleanUpOptions.Seconds = cleanUp.CleanUpOptions.ThresholdInSeconds; } else if (cleanUp.CleanUpOptions.ThresholdInSeconds == default(int) && cleanUp.CleanUpOptions.ThresholdInDays != default(int)) { cleanUpOptions.Days = cleanUp.CleanUpOptions.ThresholdInDays; } else if (cleanUp.CleanUpOptions.ThresholdInSeconds != default(int) && cleanUp.CleanUpOptions.ThresholdInDays != default(int)) { cleanUpOptions.Days = cleanUp.CleanUpOptions.ThresholdInDays; } else { cleanUpOptions.Seconds = 300; } } #endregion } catch (Exception ex) { log.Error(ex, $"Exception inside polling action: {ex.ToString()}\n"); } }, (e) => { log.Error(e, "Exception while polling"); }); } #region Local Functions CleanUps[] GetCleanUps() => (CleanUps[]) ServicesContainer.WardeinConfigurationManager(Const.WARDEIN_CONFIG_PATH)?.GetConfiguration()?.CleanUps; #endregion } }
// 为所有输入文件生成vs脚本,并添加任务至TaskManager。 private void WizardFinish(object sender, RoutedEventArgs e) { string[] inputTemplate = Constants.inputRegex.Split(vsScript); // 处理MEMORY标签 if (Constants.memoryRegex.IsMatch(vsScript)) { string[] memoryTag = Constants.memoryRegex.Split(inputTemplate[0]); inputTemplate[0] = memoryTag[0] + memoryTag[1] + eachFreeMemory.ToString() + memoryTag[3]; } // 处理DEBUG标签 if (Constants.debugRegex.IsMatch(vsScript)) { string[] debugTag = Constants.debugRegex.Split(inputTemplate[3]); if (debugTag.Length < 4) { // error System.Windows.MessageBox.Show("Debug标签语法错误!", "新建任务向导", MessageBoxButton.OK, MessageBoxImage.Error); return; } inputTemplate[3] = debugTag[0] + debugTag[1] + "None" + debugTag[3]; } // 新建任务 // 1、清理残留文件 // 2、新建脚本文件 // 3、新建任务参数 Cleaner cleaner = new Cleaner(); foreach (string inputFile in wizardInfo.InputFile) { List <TaskDetail> existing = workerManager.tm.GetTasksByInputFile(inputFile); bool skip = existing.Any(i => i.Progress == TaskStatus.TaskProgress.RUNNING || i.Progress == TaskStatus.TaskProgress.WAITING); if (skip) { System.Windows.MessageBox.Show($"{inputFile}已经在任务列表里,将跳过处理。", $"{inputFile}已经在任务列表里", MessageBoxButton.OK, MessageBoxImage.Error); continue; } // 清理文件 cleaner.Clean(inputFile, new List <string> { json.InputScript, inputFile + ".lwi" }); EpisodeConfig config = null; string cfgPath = inputFile + ".json"; FileInfo cfgFile = new FileInfo(cfgPath); if (cfgFile.Exists) { try { string configStr = File.ReadAllText(cfgPath); config = JsonConvert.DeserializeObject <EpisodeConfig>(configStr); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.ToString(), cfgFile.Name + "文件写错了诶", MessageBoxButton.OK, MessageBoxImage.Error); continue; } } // 新建vpy文件(inputname.m2ts-mmddHHMM.vpy) string vpy = inputTemplate[0] + inputTemplate[1] + "r\"" + inputFile + "\"" + inputTemplate[3]; DateTime time = DateTime.Now; string fileName = inputFile + "-" + time.ToString("MMddHHmm") + ".vpy"; File.WriteAllText(fileName, vpy); FileInfo finfo = new FileInfo(inputFile); TaskDetail td = new TaskDetail { TaskName = string.IsNullOrEmpty(json.ProjectName) ? finfo.Name : json.ProjectName + "-" + finfo.Name, Taskfile = json.Clone() as TaskProfile, InputFile = inputFile, }; // 更新输入脚本和输出文件拓展名 td.Taskfile.InputScript = fileName; if (config != null) { td.Taskfile.Config = config.Clone() as EpisodeConfig; } td.UpdateOutputFileName(); // 寻找章节 td.ChapterStatus = ChapterService.UpdateChapterStatus(td); workerManager.AddTask(td); } }
public async Task <ContactCollectionResult> GetAllAsync() => await ManagerInvoker.Current.InvokeAsync(this, async() => { return(Cleaner.Clean(await _dataService.GetAllAsync().ConfigureAwait(false))); }, BusinessInvokerArgs.Read).ConfigureAwait(false);
public async Task RaiseEventAsync(bool throwError) => await ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(throwError); await _dataService.RaiseEventAsync(throwError).ConfigureAwait(false); }, BusinessInvokerArgs.Unspecified).ConfigureAwait(false);
/// <summary> /// Initializes a new instance of the <see cref="PerformanceReviewValidator"/> class. /// </summary> public PerformanceReviewValidator() { Property(x => x.EmployeeId).Mandatory(); Property(x => x.Date).Mandatory().CompareValue(CompareOperator.LessThanEqual, _ => Cleaner.Clean(DateTime.Now), _ => "today"); Property(x => x.Notes).String(4000); Property(x => x.Reviewer).Mandatory().String(256); Property(x => x.Outcome).Mandatory().IsValid(); }
public ActionResult gotoServer(FormCollection form) { bool added = false; //Ichild child = (Ichild) Cleaner.getMutu(); Table_Coco_People child = new Table_Coco_People(); string prenom = form["field1"].ToString(); string nom = form["field2"].ToString(); string postnom = form["field3"].ToString(); string address = form["field4"].ToString(); string city = form["field5"].ToString(); string zip = form["field6"].ToString(); string telephone = form["field7"].ToString(); if ("bad" == Cleaner.removeSqlCommands(prenom)) { // return Redirect(); } else if ("bad" == Cleaner.removeSqlCommands(nom)) { // return Redirect(); } else if ("bad" == Cleaner.removeSqlCommands(postnom)) { // return Redirect(); } else if ("bad" == Cleaner.removeSqlCommands(address)) { // return Redirect(); } else if ("bad" == Cleaner.removeSqlCommands(city)) { // return Redirect(); } else if ("bad" == Cleaner.removeSqlCommands(zip)) { // return Redirect(); } else if ("bad" == Cleaner.removeSqlCommands(telephone)) { // return Redirect(); } else { if (!zip.Contains("03") || !zip.Contains("04")) { // return Redirect(); } child.first_name = prenom; child.last_name = nom; child.middle_name = postnom; child.addresse = address; child.city = city; child.code_postal = Convert.ToInt32(zip); child.telephone = Convert.ToInt32(telephone); } IProvider provider = new CongoSanduku(); added = provider.bankisaMutu(child); return(View()); }
public override void RunCommand(CalledCommand calledCommand) { string pathDataDir; if (!GetPathOrDefault(calledCommand, out pathDataDir)) { FailCommand("Invalid parameter value: path."); } switch (calledCommand.Name) { case "load": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Loader.LoadGraphFromInternet(pathDataDir); break; case "sales": Loader.LoadSalesFromInternet(pathDataDir); break; } break; } case "clean": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Cleaner.CleanGraphData(pathDataDir); Cleaner.CleanKey(pathDataDir); break; case "sales": Cleaner.CleanSalesData(pathDataDir); break; } break; } case "filter": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph_links": Linker.FilterLinks(pathDataDir); break; } break; } case "link": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Linker.LinkGraphData(pathDataDir); break; case "sales": Linker.LinkGraphWithSales(pathDataDir); break; } break; } case "asm": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Assembler.AssembleGraphData(pathDataDir); break; case "sales": Assembler.AssembleSalesData(pathDataDir); break; } break; } case "sample": { SetType trainingSetType = SamplingHelper.GetSetTypeOrDefault(calledCommand.MandatoryParametersValues[0]); int trainingSetSize; if (!IsValidSetSize(calledCommand.MandatoryParametersValues[1], out trainingSetSize)) { FailCommand("Invalid parameter value: training set size."); } SetType testingSetType = SamplingHelper.GetSetTypeOrDefault(calledCommand.MandatoryParametersValues[2]); int testingSetSize; if (!IsValidSetSize(calledCommand.MandatoryParametersValues[3], out testingSetSize)) { FailCommand("Invalid parameter value: testing set size."); } int testingDataAmount = 100; if (calledCommand.OptionalParametersValues.Count > 0) { if (!IsValidPercentage(calledCommand.OptionalParametersValues[0], out testingDataAmount)) { FailCommand("Invalid parameter value: testing set size."); } } DataSampler.CreateTrainingAndTestSets(pathDataDir, trainingSetType, testingSetType, trainingSetSize, testingSetSize, testingDataAmount); break; } case "test": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph_linkage": TestManager.TestLinkageGraph(pathDataDir); break; case "graph_mapping": TestManager.TestMapping(pathDataDir); break; case "graph_id": TestManager.TestID(pathDataDir); break; } break; } case "stat": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": TestManager.GetStatisticsGraph(pathDataDir); break; case "connectivity": StatisticsCollector.GetConnectivityStatistics(pathDataDir); break; } break; } default: { FailCommand("Cannot recognize the input commands."); break; } } }
/// <summary> /// Parses the wildcard text to ensure validitity returning a <see cref="WildcardResult"/>. /// </summary> /// <param name="text">The wildcard text.</param> /// <returns>The corresponding <see cref="WildcardResult"/>.</returns> public WildcardResult Parse(string text) { text = Cleaner.Clean(text, StringTrim.Both, Transform); if (string.IsNullOrEmpty(text)) { return new WildcardResult { Wildcard = this, Selection = WildcardSelection.None, Text = text } } ; var sb = new StringBuilder(); var wr = new WildcardResult { Wildcard = this, Selection = WildcardSelection.Undetermined }; if (CharactersNotAllowed != null && CharactersNotAllowed.Count > 0 && text.IndexOfAny(CharactersNotAllowed.ToArray()) >= 0) { wr.Selection |= WildcardSelection.InvalidCharacter; } var hasMulti = SpaceTreatment == WildcardSpaceTreatment.MultiWildcardWhenOthers && Supported.HasFlag(WildcardSelection.MultiWildcard) && text.IndexOf(MultiWildcardCharacter) >= 0; var hasTxt = false; for (int i = 0; i < text.Length; i++) { var c = text[i]; var isMulti = c == MultiWildcard; var isSingle = c == SingleWildcard; if (isMulti) { wr.Selection |= WildcardSelection.MultiWildcard; // Skip adjacent multi's as they are redundant. for (int j = i + 1; j < text.Length; j++) { if (text[j] == MultiWildcard) { i = j; continue; } break; } } if (isSingle) { wr.Selection |= WildcardSelection.SingleWildcard; } if (isMulti || isSingle) { if (text.Length == 1) { wr.Selection |= WildcardSelection.Single; } else if (i == 0) { wr.Selection |= WildcardSelection.EndsWith; } else if (i == text.Length - 1) { wr.Selection |= WildcardSelection.StartsWith; } else { if (hasTxt || isSingle) { wr.Selection |= WildcardSelection.Embedded; } else { wr.Selection |= WildcardSelection.EndsWith; } } if (i < text.Length - 1 && (text[i + 1] == MultiWildcard || text[i + 1] == SingleWildcard)) { wr.Selection |= WildcardSelection.AdjacentWildcards; } } else { hasTxt = true; if (c == SpaceCharacter && (SpaceTreatment == WildcardSpaceTreatment.Compress || SpaceTreatment == WildcardSpaceTreatment.MultiWildcardAlways || SpaceTreatment == WildcardSpaceTreatment.MultiWildcardWhenOthers)) { // Compress adjacent spaces. bool skipChar = SpaceTreatment != WildcardSpaceTreatment.Compress && text[i - 1] == MultiWildcardCharacter; for (int j = i + 1; j < text.Length; j++) { if (text[j] == SpaceCharacter) { i = j; continue; } break; } if (skipChar || (SpaceTreatment != WildcardSpaceTreatment.Compress && text[i + 1] == MultiWildcardCharacter)) { continue; } if (SpaceTreatment == WildcardSpaceTreatment.MultiWildcardAlways || (SpaceTreatment == WildcardSpaceTreatment.MultiWildcardWhenOthers && hasMulti)) { c = MultiWildcardCharacter; wr.Selection |= WildcardSelection.MultiWildcard; wr.Selection |= WildcardSelection.Embedded; } } } sb.Append(c); } if (!hasTxt && wr.Selection == (WildcardSelection.StartsWith | WildcardSelection.MultiWildcard)) { wr.Selection |= WildcardSelection.Single; wr.Selection ^= WildcardSelection.StartsWith; } if (hasTxt && wr.Selection.HasFlag(WildcardSelection.StartsWith) && wr.Selection.HasFlag(WildcardSelection.EndsWith) && !wr.Selection.HasFlag(WildcardSelection.Embedded)) { wr.Selection |= WildcardSelection.Contains; wr.Selection ^= WildcardSelection.StartsWith; wr.Selection ^= WildcardSelection.EndsWith; } if (wr.Selection == WildcardSelection.Undetermined) { wr.Selection |= WildcardSelection.Equal; } wr.Text = sb.Length == 0 ? null : sb.ToString(); return(wr); } }
private void URLRedirect() { if (Request["recurl"] == null) { //If this is null means that the redirect haven't started if (Request["LandingId"] != null) { Cleaner c = new Cleaner(); pageName = c.cleanURL(pageName); Response.Redirect(pageName + "--" + Request["LandingId"].ToString()+".gxhtml"); } else { //If this is null better to redirect to the homepage. Response.Redirect("home.aspx"); } } }
protected override void ExecuteImpl() { _cleaner = new Cleaner(_inputTmxFile, _outputTmxFile, Context.Settings, null); AttachProcessorEvents(_cleaner); _cleaner.Execute(); }
private void URLRedirect() { if (Request["recurl"] == null) { //If this is null means that the redirect haven't started Cleaner c = new Cleaner(); Response.Redirect(c.cleanURL(_title) + "--" + _TitleId + ".phtml"); } }
public override CleanUpIfStaleCallback GetCleanUpIfStaleCallback() { Cleaner cleaner = new Cleaner(this); return cleaner.CleanUpIfStale; }
public override void Draw(Graphics g) { if (backgroundImage != null) { g.DrawImage(backgroundImage, -(int)(MyAPI.GamePanelX * 1.0), 0, 1400, 600); } for (int i = 0; i < plants.Count; i++) { Plant p = (Plant)plants[i]; p.Draw(g); } for (int i = 0; i < zombies.Count; i++) { Zombie zombie = (Zombie)zombies[i]; zombie.Draw(g); } for (int i = 0; i < cleaners.Count; i++) { Cleaner c = (Cleaner)cleaners[i]; c.Draw(g); } for (int i = 0; i < plantscards.Count; i++) { PlantCard pc = (PlantCard)plantscards[i]; pc.Draw(g); } for (int i = 0; i < bullets.Count; i++) { //Bullet b = (Bullet)bullets[i]; ((Bullet)bullets[i]).Draw(g); } for (int i = 0; i < suns.Count; i++) { Sun sun = (Sun)suns[i]; sun.Draw(g); } if (pb.IsAcitive != false) { pb.Draw(g); } if (shovel != null) { shovel.Draw(g); } if (sunBoard != null) { sunBoard.Draw(g); } if (noticeImage != null) { g.DrawImage(noticeImage, 900 / 2 - noticeImage.Width / 2 + 120, 600 / 2 - noticeImage.Height / 2, noticeImage.Width, noticeImage.Height); } //绘制介绍区域 //if (isIntroduce) //{ // showIntroduce(g); //} }
public Task <EmployeeBaseCollectionResult> GetByArgsAsync(EmployeeArgs?args, PagingArgs?paging) => ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(args); await args.Validate(nameof(args)).Entity().With <IValidator <EmployeeArgs> >().RunAsync(throwOnError: true).ConfigureAwait(false); return(Cleaner.Clean(await _dataService.GetByArgsAsync(args, paging).ConfigureAwait(false))); }, BusinessInvokerArgs.Read);
// Invoked only by JNI: NewDirectByteBuffer(void*, long) // private DirectByteBuffer(long addr, int cap) : base(-1, 0, cap, cap) { Address = addr; Cleaner_Renamed = null; Att = null; }
// the one parameter is the BCeID guid for an individual. static void Main(string[] args) { bool isObfuscate = false; bool isClean = false; bool isApplicationClean = false; bool isImport = true; bool isMove = false; // start by getting secrets. var builder = new ConfigurationBuilder() .AddEnvironmentVariables() .AddUserSecrets <Program>(); var Configuration = builder.Build(); string basepath = Directory.GetParent(Directory.GetCurrentDirectory()).ToString(); basepath = Directory.GetParent(basepath).ToString(); basepath = Directory.GetParent(basepath).ToString(); basepath = Directory.GetParent(basepath).ToString(); basepath = Directory.GetParent(basepath).ToString(); basepath = Directory.GetParent(basepath).ToString(); basepath = Directory.GetParent(basepath).ToString(); basepath += "\\data"; string rawbase = basepath + "\\raw"; string exportbase = basepath + "\\export"; if (args.Length > 0) { string arg = args[0]; if (!string.IsNullOrEmpty(arg)) { if (arg.ToLower().Equals("obfuscate")) { isObfuscate = true; Console.Out.WriteLine("Data obfuscation enabled"); } else if (arg.ToLower().Equals("import")) { isObfuscate = true; Console.Out.WriteLine("Data import enabled"); } else { Console.Out.WriteLine("USAGE - enter the obfuscate parameter to obfuscate data"); } } } if (isObfuscate) { var obfuscator = new Obfuscator( ContactMap, AccountMap, WorkerMap, AliasMap, InvoiceMap, LicenceMap, ApplicationMap, EstablishmentMap, LegalEntityMap, LocalgovindigenousnationMap ); string filename = $"{rawbase}\\accounts.json"; List <MicrosoftDynamicsCRMaccount> accounts = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMaccount> >(File.ReadAllText(filename)); filename = $"{rawbase}\\contacts.json"; List <MicrosoftDynamicsCRMcontact> contacts = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMcontact> >(File.ReadAllText(filename)); filename = $"{rawbase}\\adoxio_aliases.json"; List <MicrosoftDynamicsCRMadoxioAlias> adoxio_aliases = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioAlias> >(File.ReadAllText(filename)); filename = $"{rawbase}\\adoxio_applications.json"; List <MicrosoftDynamicsCRMadoxioApplication> adoxio_applications = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioApplication> >(File.ReadAllText(filename)); filename = $"{rawbase}\\adoxio_establishments.json"; List <MicrosoftDynamicsCRMadoxioEstablishment> adoxio_establishments = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioEstablishment> >(File.ReadAllText(filename)); filename = $"{rawbase}\\adoxio_legalentities.json"; List <MicrosoftDynamicsCRMadoxioLegalentity> adoxio_legalEntities = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioLegalentity> >(File.ReadAllText(filename)); filename = $"{rawbase}\\adoxio_licences.json"; List <MicrosoftDynamicsCRMadoxioLicences> adoxio_licences = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioLicences> >(File.ReadAllText(filename)); filename = $"{rawbase}\\adoxio_workers.json"; List <MicrosoftDynamicsCRMadoxioWorker> adoxio_workers = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioWorker> >(File.ReadAllText(filename)); filename = $"{rawbase}\\invoices.json"; List <MicrosoftDynamicsCRMinvoice> invoices = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMinvoice> >(File.ReadAllText(filename)); // obfuscate the data. var o_accounts = obfuscator.ObfuscateAccounts(accounts); var o_contacts = obfuscator.ObfuscateContacts(contacts); var o_aliases = obfuscator.ObfuscateAliases(adoxio_aliases); var o_invoices = obfuscator.ObfuscateInvoices(invoices); var o_establishments = obfuscator.ObfuscateEstablishments(adoxio_establishments); var o_applications = obfuscator.ObfuscateApplications(adoxio_applications); var o_workers = obfuscator.ObfuscateWorkers(adoxio_workers); var o_licences = obfuscator.ObfuscateLicences(adoxio_licences); var o_legalentities = obfuscator.ObfuscateLegalEntities(adoxio_legalEntities); // now save the data filename = $"{exportbase}\\accounts.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_accounts)); filename = $"{exportbase}\\contacts.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_contacts)); filename = $"{exportbase}\\adoxio_aliases.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_aliases)); filename = $"{exportbase}\\adoxio_applications.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_applications)); filename = $"{exportbase}\\adoxio_establishments.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_establishments)); filename = $"{exportbase}\\adoxio_legalentities.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_legalentities)); filename = $"{exportbase}\\adoxio_licences.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_licences)); filename = $"{exportbase}\\adoxio_workers.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_workers)); filename = $"{exportbase}\\invoices.json"; File.WriteAllText(filename, JsonConvert.SerializeObject(o_invoices)); /* * // remove all BusinessContacts. * var businessContacts = _dynamicsClient.Businesscontacts.Get().Value; * * foreach (var businessContact in businessContacts) * { * try * { * _dynamicsClient.Businesscontacts.Delete(businessContact.BcgovBusinesscontactid); * Console.Out.WriteLine("Deleted BusinessContact " + businessContact.BcgovBusinesscontactid); * } * catch (OdataerrorException odee) * { * Console.Out.WriteLine("Error deleting business contact"); * Console.Out.WriteLine("Request:"); * Console.Out.WriteLine(odee.Request.Content); * Console.Out.WriteLine("Response:"); * Console.Out.WriteLine(odee.Response.Content); * } * } */ } if (isClean) { var conn = GetDynamicsConnection(Configuration); Cleaner cleaner = new Cleaner(); cleaner.Clean(conn); } if (isApplicationClean) { var conn = GetDynamicsConnection(Configuration); ApplicationCleaner cleaner = new ApplicationCleaner(); cleaner.Clean(conn); } if (isImport) { var importer = new Importer( ContactMap, AccountMap, WorkerMap, AliasMap, InvoiceMap, LicenceMap, ApplicationMap, EstablishmentMap, LegalEntityMap, LocalgovindigenousnationMap ); var conn = GetDynamicsConnection(Configuration); // read the exported data. string filename = $"{exportbase}\\accounts.json"; List <MicrosoftDynamicsCRMaccount> accounts = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMaccount> >(File.ReadAllText(filename)); filename = $"{exportbase}\\contacts.json"; List <MicrosoftDynamicsCRMcontact> contacts = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMcontact> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_aliases.json"; List <MicrosoftDynamicsCRMadoxioAlias> aliases = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioAlias> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_applications.json"; List <MicrosoftDynamicsCRMadoxioApplication> applications = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioApplication> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_establishments.json"; List <MicrosoftDynamicsCRMadoxioEstablishment> establishments = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioEstablishment> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_legalentities.json"; List <MicrosoftDynamicsCRMadoxioLegalentity> legalEntities = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioLegalentity> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_licences.json"; List <MicrosoftDynamicsCRMadoxioLicences> licences = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioLicences> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_workers.json"; List <MicrosoftDynamicsCRMadoxioWorker> workers = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioWorker> >(File.ReadAllText(filename)); filename = $"{exportbase}\\invoices.json"; List <MicrosoftDynamicsCRMinvoice> invoices = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMinvoice> >(File.ReadAllText(filename)); filename = $"{exportbase}\\adoxio_localgovindigenousnations.json"; List <MicrosoftDynamicsCRMadoxioLocalgovindigenousnation> lgin = JsonConvert.DeserializeObject <List <MicrosoftDynamicsCRMadoxioLocalgovindigenousnation> >(File.ReadAllText(filename)); // the order of import is important. Console.Out.WriteLine("Importing Accounts"); importer.ImportAccounts(conn, accounts); Console.Out.WriteLine("Importing Contacts"); importer.ImportContacts(conn, contacts); Console.Out.WriteLine("Importing Workers"); importer.ImportWorkers(conn, workers); Console.Out.WriteLine("Importing Aliases"); importer.ImportAliases(conn, aliases); Console.Out.WriteLine("Importing LG IN data"); importer.ImportLocalGovIndigenousNations(conn, lgin); Console.Out.WriteLine("Importing Legal Entities"); importer.ImportLegalEntities(conn, legalEntities); Console.Out.WriteLine("Importing Establishments"); importer.ImportEstablishments(conn, establishments); Console.Out.WriteLine("Importing Invoices"); importer.ImportInvoices(conn, invoices); Console.Out.WriteLine("Importing Licences"); importer.ImportLicences(conn, licences); Console.Out.WriteLine("Importing Applications"); importer.ImportApplications(conn, applications); } if (isMove) { var conn = GetDynamicsConnection(Configuration); Mover mover = new Mover(); mover.Move(conn); } }
public Task <TripPerson?> GetAsync(string?id) => ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(id); await id.Validate(nameof(id)).Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false); return(Cleaner.Clean(await _dataService.GetAsync(id).ConfigureAwait(false))); }, BusinessInvokerArgs.Read);
protected override IList <Person> Read(DbDataReader reader) { SqlDataReader sqlReader = (SqlDataReader)reader; bool goNext = false; const int START_COLUMN_POSSITION_OF_CAGE_INFORMATION = 15; const int LOGIN_COLUMN_POSSITION = 2; IList <Person> persons = new List <Person>(); while (goNext || sqlReader.Read()) { int i = -1; Person person = new Person(); Breeder breeder = null; Cleaner cleaner = null; person.Id = sqlReader.GetInt32(++i); person.Password = sqlReader.GetString(++i); person.Login = sqlReader.GetString(++i); person.FirstName = sqlReader.GetString(++i); person.LastName = sqlReader.GetString(++i); person.Phone = sqlReader.GetString(++i); person.BirthDate = sqlReader.GetDateTime(++i); person.Active = sqlReader.GetBoolean(++i); if (!sqlReader.IsDBNull(++i)) { person.LastActiveDate = sqlReader.GetDateTime(i); } if (!sqlReader.IsDBNull(++i)) { breeder = new Breeder(person); breeder.AnimalGroup = new AnimalGroup(); breeder.AnimalGroup.Id = sqlReader.GetInt32(i); breeder.AnimalGroup.Description = sqlReader.GetString(++i); person = breeder; } else { i += 1; } Role role = new Role(); role.Id = sqlReader.GetInt32(++i); role.Type = RoleEnumUtils.getRoleType(sqlReader.GetString(++i)); role.Description = sqlReader.GetString(++i); person.Role = role; if (!sqlReader.IsDBNull(++i)) { cleaner = new Cleaner(person); cleaner.ChemicalQualification = sqlReader.GetBoolean(i); person = cleaner; } if (breeder != null) { breeder.Role = role; } else if (cleaner != null) { cleaner.Role = role; } else { person.Role = role; } string lastLogin = person.Login; if (!sqlReader.IsDBNull(START_COLUMN_POSSITION_OF_CAGE_INFORMATION)) { cleaner.Cages = new List <Cage>(); do { int j = START_COLUMN_POSSITION_OF_CAGE_INFORMATION - 1; Cage cage = new Cage(); cage.Id = sqlReader.GetInt32(++j); cage.LengthM = sqlReader.GetInt32(++j); cage.WidthM = sqlReader.GetInt32(++j); cleaner.Cages.Add(cage); goNext = sqlReader.Read(); } while (goNext && lastLogin == sqlReader.GetString(LOGIN_COLUMN_POSSITION)); } else { goNext = false; } persons.Add(person); } return(persons); }
public static IList <char> Clean(IList <char> input) { using var cleaner = new Cleaner(input); return(cleaner.Clean()); }
public async Task <PerformanceReview?> GetAsync(Guid id) => await ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(id); await id.Validate(nameof(id)).Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false); return(Cleaner.Clean(await _dataService.GetAsync(id).ConfigureAwait(false))); }, BusinessInvokerArgs.Read).ConfigureAwait(false);
public static IEnumerable <string> GetLinkUrls(string html) { var nodes = Cleaner.Parse(html); return(nodes.SelectMany(n => GetLinkUrls(n))); }
public async Task <PerformanceReviewCollectionResult> GetByEmployeeIdAsync(Guid employeeId, PagingArgs?paging) => await ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(employeeId); return(Cleaner.Clean(await _dataService.GetByEmployeeIdAsync(employeeId, paging).ConfigureAwait(false))); }, BusinessInvokerArgs.Read).ConfigureAwait(false);
/// <summary> /// Performs a create for the value (reselects and/or automatically saves changes where specified). /// </summary> /// <typeparam name="T">The resultant <see cref="Type"/>.</typeparam> /// <typeparam name="TModel">The entity framework model <see cref="Type"/>.</typeparam> /// <param name="saveArgs">The <see cref="EfDbArgs{T, TModel}"/>.</param> /// <param name="value">The value to insert.</param> /// <returns>The value (refreshed where specified).</returns> public async Task <T> CreateAsync <T, TModel>(EfDbArgs <T, TModel> saveArgs, T value) where T : class, new() where TModel : class, new() { CheckSaveArgs(saveArgs); if (value == null) { throw new ArgumentNullException(nameof(value)); } if (value is IChangeLog cl) { if (cl.ChangeLog == null) { cl.ChangeLog = new ChangeLog(); } cl.ChangeLog.CreatedBy = ExecutionContext.HasCurrent ? ExecutionContext.Current.Username : ExecutionContext.EnvironmentUsername; cl.ChangeLog.CreatedDate = ExecutionContext.HasCurrent ? ExecutionContext.Current.Timestamp : Cleaner.Clean(DateTime.Now); } return(await Invoker.InvokeAsync(this, async() => { var model = saveArgs.Mapper.MapToDest(value, Mapper.OperationTypes.Create) ?? throw new InvalidOperationException("Mapping to the EF entity must not result in a null value."); DbContext.Add(model); if (saveArgs.SaveChanges) { await DbContext.SaveChangesAsync(true).ConfigureAwait(false); } return (saveArgs.Refresh) ? saveArgs.Mapper.MapToSrce(model, Mapper.OperationTypes.Get) ! : value; }, this).ConfigureAwait(false));
// Start is called before the first frame update void Start() { rb2d = GetComponent <Rigidbody2D>(); m_Cleaner = GetComponent <Cleaner>(); }
public override CleanUpIfStaleCallback GetCleanUpIfStaleCallback() { Cleaner cleaner = new Cleaner(this); return(cleaner.CleanUpIfStale); }
private void Form1_Load(object sender, EventArgs e) { Cleaner.CleanDB(); }
private void URLRedirect() { pageType = "e"; if (Request["recurl"] == null) { //If this is null means that the redirect haven't started if (Request["id"] != null) { pageId = Request["id"].ToString(); Cleaner c = new Cleaner(); pageName = c.cleanURL(pageName); pageName = pageName.Replace(":", ""); if (Request["TypeGen"] != null) { if (Request["am"] != null && Request["asm"] != null) { Response.Redirect(pageName + "-r-" + pageType + "-" + pageId + ".g" + Request["am"].ToString() + "_" + Request["asm"].ToString() + "html"); } else { Response.Redirect(pageName + "-r-" + pageType + "-" + pageId + ".ghtml"); } } else { if (Request["am"] != null && Request["asm"] != null) { Response.Redirect(pageName + "--" + pageType + "-" + pageId + ".g" + Request["am"].ToString() + "_" + Request["asm"].ToString() + "html"); } else { Response.Redirect(pageName + "--" + pageType + "-" + pageId + ".ghtml"); } } Response.Redirect(pageName + "--" + pageType + "-" + pageId + ".ghtml"); } else { //If this is null better to redirect to the homepage. Response.Redirect("home.aspx"); } } }
private void URLRedirect() { if (Request["recurl"] == null) { //If this is null means that the redirect haven't started Cleaner c = new Cleaner(); Response.Redirect("publisher.grouppage"+_pgg+"_page-"+_pg+"_p-"+pubId+".plhtml"); } }