public void basicTestMaxiMax() { MiniMax <int> algo = new MiniMax <int>(); ActionsType res = algo.Run(0, maxiMaxOp, maxiMaxOp, basicCuttof, basicEval); Assert.AreEqual("plus3", res.Method.Name); }
public void differentCostMaxiMax() { MaxiMax <int> algo = new MaxiMax <int>(true); ActionsType res = algo.Run(1, OpsDifferentCosts, OpsDifferentCosts, basicCuttof, basicEval); Assert.AreEqual("plus3Cost3", res.Method.Name); }
/// <summary> /// Calculates the state of the this version and stores that in _availableActions. /// </summary> private void CalculateActionsState() { // Yes, I realize the following code could be more efficient, it was written this way so // it would be half-way understandable. // Reset flags _availableActions = ActionsType.None; // No versionid means that we cannot do anything if (VersionId == null) { return; } if (string.IsNullOrEmpty(Revision)) { // VersionId _availableActions |= ActionsType.CreateWithoutPropertiesOrContent | ActionsType.HeadCurrentRevision | ActionsType.GetCurrentRevision; } if (!string.IsNullOrEmpty(Revision)) { // VersionId + Revision _availableActions |= ActionsType.Delete | ActionsType.HeadSpecificRevision | ActionsType.GetSpecificRevision | ActionsType.UpdateWithoutPropertiesOrContent; } if (Metadata != null) { // VersionId + Metadata _availableActions |= ActionsType.CreateWithPropertiesWithoutContent; } if (Content != null) { // VersionId + Content _availableActions |= ActionsType.CreateWithoutPropertiesWithContent; } if (Metadata != null && Content != null) { // VersionId + Metadata + Content _availableActions |= ActionsType.CreateWithPropertiesAndContent; } if (!string.IsNullOrEmpty(Revision) && Metadata != null) { // VersionId + Revision + Metadata _availableActions |= ActionsType.UpdateWithPropertiesWithoutContent; } if (!string.IsNullOrEmpty(Revision) && Content != null) { // VersionId + Revision + Content _availableActions |= ActionsType.UpdateWithoutPropertiesWithContent; } if (!string.IsNullOrEmpty(Revision) && Metadata != null && Content != null) { _availableActions |= ActionsType.UpdateWithPropertiesAndContent; } }
public static String getTypes() { String s = ""; List <Model.Type> types = new ActionsType().ListerTypes(); foreach (var t in types) { s += typeGenerator(t); } return(s); }
//generateur des archives: public static String GenerateArchive(Fichier f) { String text = f.chemain; String url = text.Replace("\\", @"/"); Model.Type t = new ActionsType().getTypeById(f.idType); String s = " <div class=\"archive\">\r\n" + " \r\n" + " <div class=\"photoAr\">\r\n" + " <img class=\"photoArImg\" src=\"./images/pdf.png\" alt=\"Alternate Text\" />\r\n" + " </div>\r\n" + " <div class=\"descripAr\">\r\n" + " <table class=\"tableArchive\">\r\n" + " <tr>\r\n" + " <td>Archive:</td>\r\n" + " <td> " + f.Nom + " </td>\r\n" + " </tr>\r\n" + " <tr>\r\n" + " <td>Type :</td>\r\n" + " <td>" + t.nomType + "</td>\r\n" + " </tr>\r\n" + " <tr>\r\n" + " <td>\r\n" + " <a onclick='openArchiveModal(" + f.idFichier + ",\"" + url + "\")' href=\"#\"><i class=\"far fa-eye\"></i> voir le fichier</a><br />\r\n" + " </td>\r\n"; if (f.chemain != "") { s += " <td><a href=\"DownloadFile.aspx?idFile=" + f.idFichier + "#\"><i class=\"fa fa-file-download\"><span class=\"separator\"> </span></i>telecharger</a> </td>\r\n"; } s += " </tr>\r\n" + " \r\n" + " \r\n" + " \r\n" + " </table>\r\n" + " \r\n" + " </div>\r\n" + " <div class=\"btnsAr\">\r\n" + " \r\n"; if (1 == 1) { s += " <a class=\"aform\" href=\"./ModifierArchiveAdmin.aspx?idFichier=" + f.idFichier + "\"><i class=\"fas fa-edit\"></i></a>\r\n" + " <a class=\"aform\" onclick='deleteArchive(" + f.idFichier + ",\"" + f.dateAjout + "\")' href=\"#\"><i class=\"fas fa-trash-alt\"></i></a>\r\n"; } s += " </div>\r\n" + " \r\n" + " </div>"; return(s); }
protected void BTNADDArch_Click(object sender, EventArgs e) { if (TitreArch.Value != "" || textArea.InnerHtml != "" || EmpPc.Value != "" || index.Value != "" || selectTypeAroo.SelectedValue != "" || ArchiveUpload.HasFile) { String ext = System.IO.Path.GetExtension(ArchiveUpload.FileName); if (ext == ".pdf" || ext == ".docx" || ext == ".png") { idU = Int32.Parse(Session["idUser"].ToString()); Utilisateur u = new ActionsUtilisateur().rechercheUtilisateurParId(idU); String titreAr = TitreArch.Value; String description = textArea.InnerHtml; DateTime day = DateTime.Now; int idType = 0; Int32.TryParse(selectTypeAroo.SelectedValue, out idType); Fichier f = new Fichier(); f.Nom = titreAr; f.Description = description; f.dateAjout = day; f.extention = ext; f.dateModification = day; f.dateDernierAcces = day; f.index = index.Value; f.emplacementPC = EmpPc.Value; f.dateSuppression = day; ActionsType actionsType = new ActionsType(); f.idType = idType; f.type = actionsType.getTypeById(idType); int id = new ActionsFichier().ajouterParUser(u, f); f.idFichier = id; f.chemain = Server.MapPath("~/Archives/" + "archive-" + id + ".pdf"); new ActionsFichier().modifier(f); ArchiveUpload.SaveAs(Server.MapPath("~/Archives/" + "archive-" + id + ".pdf")); String indexmsg = "index du archive ajoute est : " + f.index + ""; Response.Redirect("./Calendrier.aspx?indexmsg=" + indexmsg); } else { erreur.InnerHtml = "Le fichier doit etre format pdf,img,docx seulement"; } } else { erreur.InnerHtml = "veuillez remplir tous les champs"; } }
protected void BTNADDArch_Click(object sender, EventArgs e) { String nomType = typeN.Value; int duree = Convert.ToInt32(DUA.Value); String action = selectAction.SelectedValue; String critereSort = selectCritere.SelectedValue; String description = textArea.InnerHtml; if (nomType != "" || duree != null || action != "" || critereSort != "") { ActionsType actionsType = new ActionsType(); Model.Type t = new Model.Type(); t.nomType = nomType; t.duree = duree; t.action = action; t.DUAselon = critereSort; t.Description = description; int idType = actionsType.ajouterType(t); Response.Redirect("./Types.aspx"); } }
private GEAction ProcessActions(ActionsType actions, string parentId) { List <GEAction.GEActivation> activations = new List <GEAction.GEActivation>(); foreach (ActionsTypeSetActive activation in actions.setActive) { ActivationSetEnum vEnum = activation.value; bool?value = null; if (vEnum != ActivationSetEnum.@switch) { value = vEnum == ActivationSetEnum.@true ? true : false; } activations.Add(new GEAction.GEActivation(activation.refId, value)); } List <GEAction.GEPropertySetter> propSetter = new List <GEAction.GEPropertySetter>(); foreach (ActionsTypeSetPropertyValue prop in actions.setPropertyValue) { GEAction.PropertyChangeType propEnum = GEAction.PropertyChangeType.SET; PropertyChangeEnum change = prop.change; if (!change.Equals(PropertyChangeEnum.set)) { propEnum = change.Equals(PropertyChangeEnum.inc) ? GEAction.PropertyChangeType.SET : GEAction.PropertyChangeType.DEC; } propSetter.Add(new GEAction.GEPropertySetter(prop.refId, propEnum, prop.value)); } GEAction.GESaveAction saveAction = null; if (actions.SaveGame != null) { saveAction = new GEAction.GESaveAction(actions.SaveGame.isAutoSave, parentId); } GEAction processedAction = new GEAction(elementManager, null, activations, propSetter, saveAction, actions.onUseIntervalTo); OnReferenceProcessing += delegate(object o, EventArgs e) { processedAction.ResponseText = elementManager.GetTextElement(actions.responseTextId); }; return(processedAction); }
protected void BTNADDArch_Click(object sender, EventArgs e) { if (TitreArch.Value != "" || textArea.InnerHtml != "" || EmpPc.Value != "" || index.Value != "" || selectTypeAroo.SelectedValue != "") { Fichier f = new Fichier(); String titreAr = TitreArch.Value; String description = textArea.InnerHtml; DateTime day = DateTime.Now; int idType = 0; Int32.TryParse(selectTypeAroo.SelectedValue, out idType); f.Nom = titreAr; f.Description = description; f.dateAjout = day; f.dateModification = day; f.dateDernierAcces = day; f.index = index.Value; f.emplacementPC = EmpPc.Value; f.dateSuppression = day; if (CKRC.Checked) { f.commArch = 0; } else { f.commArch = 1; } ActionsType actionsType = new ActionsType(); f.type = actionsType.getTypeById(idType); int id = new ActionsFichier().ajouterF(f); f.idFichier = id; if (!CKCE.Checked) { String ext = System.IO.Path.GetExtension(ArchiveUpload.FileName); f.extention = ext; if (ext == ".pdf" || ext == ".doc" || ext == ".png") { f.chemain = Server.MapPath("~/Archives/" + "archive-" + id + ".pdf"); ArchiveUpload.SaveAs(Server.MapPath("~/Archives/" + "archive-" + id + ".pdf")); } else { erreur.InnerHtml = "veuillez remplir tous les champs"; Response.Redirect("./AjouterArchiveAdmin.aspx"); } } new ActionsFichier().modifier(f); String indexmsg = "index du archive ajoute est : " + f.index + ""; Response.Redirect("./CalendrierAdmin.aspx?indexmsg=" + indexmsg); } else { erreur.InnerHtml = "veuillez remplir tous les champs"; } }
public ActionsTaskForm(ActionsType _actionsType, WebPanelItemCollection ItemsToProcess, Type _workType, WebPanelOptionData.IOptionData ExtOptions) { InitializeComponent(); this.actionsType = _actionsType; if (this.actionsType == ActionsType.Add) { this.ActionBackGroundWorker = new WebPanelActionsTask.ActionAddTask(); this.TaskTypePict.Image = global::BatchDomainTools.Properties.Resources.AddTaskIcon; this.Text = "Добавления новых объектов"; this.desription = new Dictionary <string, string>() { { "Укажите объекты для добавления", "Каждый добавляемый объект должен начинаться с новой строки" }, { "Вы можете указать параметры для добавляемых объектов", "По умолчанию используются стандартные параметры для панели" },// из настроек программы"}, { "Все готово, можно начинать процесс добавления", "Нажмите кнопку старта для начала процесса добавления" } }; } else { if (this.actionsType == ActionsType.Edit) { this.ActionBackGroundWorker = new WebPanelActionsTask.ActionEditTask(); this.TaskTypePict.Image = global::BatchDomainTools.Properties.Resources.EditTaskIcon; this.Text = "Редактирование выделенных объектов"; this.desription = new Dictionary <string, string>() { { "Укажите объекты для редактирования", "Каждый редактируемый объект должен начинаться с новой строки" }, { "Измените параметры для редактируемых объектов", "По умолчанию используются стандартные параметры для панели" }, { "Все готово, можно начинать процесс редактирования", "Нажмите кнопку старта для начала процесса редактирования" } }; } else if (this.actionsType == ActionsType.Remove) { this.ActionBackGroundWorker = new WebPanelActionsTask.ActionRemoveTask(); this.TaskTypePict.Image = global::BatchDomainTools.Properties.Resources.DeleteTaskIcon; this.Text = "Удаление выделенных объектов"; this.desription = new Dictionary <string, string>() { { "Укажите объекты для удаления", "Каждый удаляемый объект должен начинаться с новой строки" }, { "Измените параметры удаления объектов", "По умолчанию будут использованны параметры из настроек программы" }, { "Можно начинать процесс удаления", "Для начала процесса удаления нажмите на кнопку старта" } }; } } if (ExtOptions == null) { this.tablessControl1.TabPages.Remove(this.PropertyChangeTabPage); this.desription.Remove(this.desription.ElementAt(1).Key); } else { this.PropertyData = ExtOptions; this.OptionsGrid.SelectedObject = this.PropertyData; this.OptionsGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(OprionsGrid_PropertyValueChanged); } this.tablessControl1.SelectedIndexChanged += new EventHandler(tablessControl1_SelectedIndexChanged); this.ActionBackGroundWorker.ProgressChanged += new ProgressChangedEventHandler(bgWorker_ProgressChanged); this.ActionBackGroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ActionBackGroundWorker_RunWorkerCompleted); this.workType = _workType; this.panel3.Paint += new PaintEventHandler((_sender, _e) => { ControlPaint.DrawBorder(_e.Graphics, _e.ClipRectangle, Color.Transparent, 0, ButtonBorderStyle.None, Color.FromArgb(223, 223, 223), 1, ButtonBorderStyle.Solid, Color.Transparent, 0, ButtonBorderStyle.None, Color.Transparent, 0, ButtonBorderStyle.None); }); this.panel2.Paint += new PaintEventHandler((__sender, __e) => { ControlPaint.DrawBorder(__e.Graphics, __e.ClipRectangle, Color.Transparent, 0, ButtonBorderStyle.None, Color.Transparent, 0, ButtonBorderStyle.Solid, Color.Transparent, 0, ButtonBorderStyle.None, Color.FromArgb(223, 223, 223), 1, ButtonBorderStyle.Solid); }); this.TitleLabel.Text = desription.ElementAt(this.tablessControl1.SelectedIndex).Key; this.Desriptionlabel.Text = desription.ElementAt(this.tablessControl1.SelectedIndex).Value; if (ItemsToProcess != null) { this.DomaintBox.Lines = ItemsToProcess.ToStringArray(); } }
/// <summary> /// Calculates the state of the this version and stores that in _availableActions. /// </summary> private void CalculateActionsState() { // Yes, I realize the following code could be more efficient, it was written this way so // it would be half-way understandable. // Reset flags _availableActions = ActionsType.None; // No versionid means that we cannot do anything if (VersionId == null) return; if (string.IsNullOrEmpty(Revision)) { // VersionId _availableActions |= ActionsType.CreateWithoutPropertiesOrContent | ActionsType.HeadCurrentRevision | ActionsType.GetCurrentRevision; } if (!string.IsNullOrEmpty(Revision)) { // VersionId + Revision _availableActions |= ActionsType.Delete | ActionsType.HeadSpecificRevision | ActionsType.GetSpecificRevision | ActionsType.UpdateWithoutPropertiesOrContent; } if (Metadata != null) { // VersionId + Metadata _availableActions |= ActionsType.CreateWithPropertiesWithoutContent; } if (Content != null) { // VersionId + Content _availableActions |= ActionsType.CreateWithoutPropertiesWithContent; } if (Metadata != null && Content != null) { // VersionId + Metadata + Content _availableActions |= ActionsType.CreateWithPropertiesAndContent; } if (!string.IsNullOrEmpty(Revision) && Metadata != null) { // VersionId + Revision + Metadata _availableActions |= ActionsType.UpdateWithPropertiesWithoutContent; } if (!string.IsNullOrEmpty(Revision) && Content != null) { // VersionId + Revision + Content _availableActions |= ActionsType.UpdateWithoutPropertiesWithContent; } if (!string.IsNullOrEmpty(Revision) && Metadata != null && Content != null) { _availableActions |= ActionsType.UpdateWithPropertiesAndContent; } }