public void InvokeAddsNecessaryModules() { //Arrange //Act var result = component.Invoke(modules); //Assert Assert.IsTrue(modules.Contains(nameof(ConfirmationDialogViewComponent).ViewComponentName())); Assert.IsTrue(modules.Contains(nameof(PersonEditorViewComponent).ViewComponentName())); }
public void InvokeAddsNecessaryComponents() { //Arrange //Act var result = component.Invoke(modules); //Assert Assert.IsTrue(modules.Contains(nameof(PhonesListViewComponent).ViewComponentName())); Assert.IsTrue(modules.Contains(nameof(EmailsListViewComponent).ViewComponentName())); Assert.IsTrue(modules.Contains(nameof(DocumentsListViewComponent).ViewComponentName())); Assert.IsTrue(modules.Contains(nameof(GuardiansListViewComponent).ViewComponentName())); }
public void SetPrimaryScene(Scene scene) { if (scene == null) { throw new System.ArgumentNullException("scene"); } if (_scenes.Contains(scene)) { _scenes.Remove(scene); } _scenes.Insert(0, scene); }
public void ContainsTest() { for (int i = 0; i < 10; ++i) { list.Add(i); } for (int i = 9; i >= 0; --i) { Assert.IsTrue(list.Contains(i)); } Assert.IsFalse(list.Contains(12)); }
public void InvokePopulatesModulesSet() { //Arrange UniqueList <string> modules = new UniqueList <string>(); var cRep = new Mock <ICountryRepository>(); cRep.Setup(r => r.Get()).Returns(Task.FromResult(new List <Country>() as IEnumerable <Country>)); var gRep = new Mock <IRepository <Gender> >(); gRep.Setup(r => r.Get()).Returns(Task.FromResult(new List <Gender>() as IEnumerable <Gender>)); var cTRep = new Mock <IRepository <CityType> >(); cTRep.Setup(r => r.Get()).Returns(Task.FromResult(new List <CityType>() as IEnumerable <CityType>)); var sTRep = new Mock <IRepository <StreetType> >(); sTRep.Setup(r => r.Get()).Returns(Task.FromResult(new List <StreetType>() as IEnumerable <StreetType>)); PersonEditorViewComponent component = new PersonEditorViewComponent(cRep.Object, gRep.Object, sTRep.Object, cTRep.Object); //Act var result = component.InvokeAsync(modules); //Assert Assert.IsTrue(modules.Contains(nameof(ConfirmationDialogViewComponent).ViewComponentName())); }
private string GetColumnDisPlayName() { if (fColumnDisPlayName.IsEmpty()) { var _l = DataFormConfig.Columns.FindAll(a => UniqueList.Contains(a.Name)).Select(a => a.DisplayName).ToList(); fColumnDisPlayName = String.Join(", ", _l); } return(fColumnDisPlayName); }
public void GetInfoFromUniqueList() { var list = new UniqueList <int> { 2, 9, 5, 3, 0, 1 }; Assert.AreEqual(false, list.IsReadOnly); Assert.AreEqual(true, list.Contains(9)); Assert.AreEqual(2, list.IndexOf(5)); }
public void IvokeAddsRequiredComponents() { //Arrange UniqueList <string> modules = new UniqueList <string>(); //Act var result = component.InvokeAsync(modules).Result; //Assert Assert.IsTrue(modules.Contains(nameof(ConfirmationDialogViewComponent).ViewComponentName())); }
public static void TestContainsFalse() { UniqueList <string> uniqueList = new UniqueList <string> { "AA", "BBB", "CC", "DDD" }; Assert.IsFalse(uniqueList.Contains("HHH")); }
public void CheckUnique(List <ObjectDataView> insertDataViewList, List <ObjectDataView> updateDataViewList, List <string> deleteStringList) { string _columSelect = String.Join(",", UniqueList); // var _updateObjs = updateDataViewList.FindAll(a => HasAllUniqueColumns(a.objectData)); // var _updateIds = updateDataViewList.Select(a => a.KeyId); // deleteStringList.AddRange(_updateIds); if (CheckUniqueFilterSql.IsEmpty()) { CheckUniqueFilterSql = " 1 = 1"; } string _strSql = "SELECT {0},{1} FROM {2} WHERE ({3}) ".SFormat(PrimaryKey, _columSelect, RegName, CheckUniqueFilterSql); var _sqlCmd = SqlUtil.SqlByNotAnd(_strSql, PrimaryKey, deleteStringList); DataSet ds = _sqlCmd.QueryDataSet(DbContext); UniqueRowArrange list = new UniqueRowArrange(); foreach (DataRow row in ds.Tables[0].Rows) { HasOnlyUniqueColumns(row, updateDataViewList); //----------- var _isCheck = list.CheckInsert(new UniqueRow(GetColumnValues(row).ToArray())); if (!_isCheck) { string str = " {0} : {1} ".SFormat(GetColumnDisPlayName(), String.Join(",", GetColumnTexts(row))); ThrowUniError(str); } } //--------------xxxxxxxx--------------------------- // insertDataViewList. insertDataViewList.ForEach(a => { if (!ForeignKeyValue.IsEmpty() && UniqueList.Contains(ForeignKey)) { if (!a.objectData.Row.Table.Columns.Contains(ForeignKey)) { a.objectData.Row.Table.Columns.Add(ForeignKey); } a.objectData.Row[ForeignKey] = ForeignKeyValue; } var _isCheck = list.CheckInsert(new UniqueRow(GetColumnValues(a.objectData.Row).ToArray())); if (!_isCheck) { string str = " {0} : {1} ".SFormat(GetColumnDisPlayName(), String.Join(",", GetColumnTexts(a.objectData.Row))); ThrowUniError(str); //ThrowUniError(GetColumnDisPlayName() + ":" + String.Join(",", GetColumnTexts(a.objectData.Row))); } }); }
public void DefaultPopulatesModules() { //Arrange UniqueList <string> modules = new UniqueList <string>(); var moq = new Mock <IRepository <Region> >(); moq.Setup(m => m.Get()).Returns(Task.FromResult(default(IEnumerable <Region>))); PatientSearchViewComponent component = new PatientSearchViewComponent(moq.Object); //Act var result = component.InvokeAsync(modules).Result; //Assert Assert.IsTrue(modules.Contains(nameof(PersonEditorViewComponent).ViewComponentName())); }
public override CommandBase Parse(string scmd) { if (Commands.Contains(scmd)) { return(new SimpleContentCommand(scmd)); } if (scmd.Length <= 3) { return(null); } var cmd = Commands.FirstOrDefault(x => x.StartsWith(scmd)); return(!string.IsNullOrWhiteSpace(cmd) ? new SimpleContentCommand(cmd) : null); }
private static void GetOrderedFlattenedProjectDependenciesInternal(Project.Configuration conf, UniqueList <Project.Configuration> dependencies, bool allDependencies, bool fuDependencies) { if (!conf.IsFastBuild) { return; } var confDependencies = allDependencies ? conf.ResolvedDependencies : fuDependencies ? conf.ForceUsingDependencies : conf.ConfigurationDependencies; if (confDependencies.Contains(conf)) { throw new Error("Cyclic dependency detected in project " + conf); } if (!allDependencies) { var tmpDeps = new UniqueList <Project.Configuration>(); foreach (Project.Configuration dep in confDependencies) { GetOrderedFlattenedProjectDependenciesInternal(dep, tmpDeps, true, fuDependencies); tmpDeps.Add(dep); } foreach (Project.Configuration dep in tmpDeps) { if (dep.IsFastBuild && confDependencies.Contains(dep) && (conf != dep)) { dependencies.Add(dep); } } } else { foreach (Project.Configuration dep in confDependencies) { if (dependencies.Contains(dep)) { continue; } GetOrderedFlattenedProjectDependenciesInternal(dep, dependencies, true, fuDependencies); if (dep.IsFastBuild) { dependencies.Add(dep); } } } }
void addFiles(UniqueList<string> files, string folderPath, string[] excludes) { foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath)) { if (!files.Contains(file)) files.Add(file); } foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) { bool exclude = false; foreach (string e in excludes) { if (subFolder.StartsWith(e, StringComparison.OrdinalIgnoreCase)) { exclude = true; break; } } if (!exclude) addFiles(files, subFolder, excludes); } }
void addFiles(UniqueList<string> files, string folderPath, string exclude, string searchPattern) { foreach (string p in searchPattern.Split(';')) { foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath, p.Trim(), SearchOption.TopDirectoryOnly)) { if (!files.Contains(file)) files.Add(file); } } foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) { if (!subFolder.StartsWith(exclude, StringComparison.OrdinalIgnoreCase)) { addFiles(files, subFolder, exclude, searchPattern); } } }
void addFiles(UniqueList<string> files, string folderPath, string exclude) { foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath)) { if (!files.Contains(file)) files.Add(file); } foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) { if (!subFolder.StartsWith(exclude, StringComparison.OrdinalIgnoreCase)) { addFiles(files, subFolder, exclude); } } }
void addFiles(UniqueList<string> files, string folderPath) { foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath)) { if (!files.Contains(file)) files.Add(file); } foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) { addFiles(files, subFolder); } }
UniqueList<MemDefContentClass> getClassList() { DialogueMasterPage master = (DialogueMasterPage)this.Master; UniqueList<int> classIds = null; UniqueList<int> classIds2 = new UniqueList<int>(); UniqueList<MemDefContentClass> contDefList; if (master.Exchange.DialogueParameters.ContainsKey("ClassIds")) { contDefList = new UniqueList<MemDefContentClass>(); classIds = (UniqueList<int>)master.Exchange.DialogueParameters["ClassIds"]; foreach (int id in classIds) { foreach (int id2 in WAFContext.Engine.Definition.ContentClass[id].AllDescendantsIncThis) { if (!classIds2.Contains(id2)) { classIds2.Add(id2); contDefList.Add(WAFContext.Engine.Definition.ContentClass[id2]); } } } classIds = classIds2; } else { contDefList = new UniqueList<MemDefContentClass>(); foreach (MemDefContentClass classDef in WAFContext.Engine.Definition.ContentClass.Values) contDefList.Add(classDef); } return contDefList; }
protected void Page_Load(object sender, EventArgs e) { DialogueMasterPage master = (DialogueMasterPage)this.Master; if (master.Exchange == null) return; contentTree.RelationId = AqlRelFilefolders.Relation.RelationId; List<FileLibrary> libs = WAFContext.Session.GetContents<FileLibrary>(); if (libs.Count == 0) { FileLibrary newlib = WAFContext.Session.NewContent<FileLibrary>(); newlib.UpdateChanges(); newlib.Name = "Library"; contentTree.RootKey = newlib.Key; } else { contentTree.RootKey = new UniqueList<FileLibrary>(libs).GetFirst().Key; } UniqueList<int> classIds = null; UniqueList<int> classIds2 = new UniqueList<int>(); UniqueList<MemDefContentClass> contDefList; if (master.Exchange.DialogueParameters.ContainsKey("ClassIds")) { contDefList = new UniqueList<MemDefContentClass>(); classIds = (UniqueList<int>)master.Exchange.DialogueParameters["ClassIds"]; foreach (int id in classIds) { foreach (int id2 in WAFContext.Engine.Definition.ContentClass[id].AllDescendantsIncThis) { if (!classIds2.Contains(id2)) { classIds2.Add(id2); contDefList.Add(WAFContext.Engine.Definition.ContentClass[id2]); } } } classIds = classIds2; } else { contDefList = new UniqueList<MemDefContentClass>(); foreach (MemDefContentClass classDef in WAFContext.Engine.Definition.ContentClass.Values) contDefList.Add(classDef); } if (!IsPostBack) { updateTypeList(); txtSearch.Text = (string)master.Exchange.DialogueParameters["SearchString"]; if (master.Exchange.DialogueParameters.ContainsKey("ViewMode")) { contentList.ViewMode = (ListViewOptions)master.Exchange.DialogueParameters["ViewMode"]; chkThumbnails.Checked = contentList.ViewMode == ListViewOptions.Thumbnails; } //chkFilter.Checked = txtSearch.Text.Length > 0; chkTreeview_CheckedChanged(null, null); chkFilter_CheckedChanged(null, null); //foreach (MemDefRelation rel in WAFContext.Session.Definitions.Relation.Values) { // ListItem item = new ListItem(rel.GetName(WAFContext.Session), rel.Id.ToString()); // lstTreeviewRelation.Items.Add(item); //} } if (contentList.ViewMode != ListViewOptions.List) { contentList.ViewMode = chkThumbnails.Checked ? ListViewOptions.Thumbnails : ListViewOptions.Details; } int nodeId = 0; if (int.TryParse(txtSearch.Text + "", out nodeId)) { if (WAFContext.Session.NodeExists(nodeId, true, true)) { UniqueList<CKeyNLRC> result = new UniqueList<CKeyNLRC>(); result.Add(WAFContext.Session.GetContent(nodeId).Key); master.SendResult(result); Response.End(); } } AqlQuery query = WAFContext.Session.CreateQuery(); AqlAliasContentBase alias; int selectedFolderId = -1; if (chkTreeview.Checked) { AqlAliasFileFolder parent = new AqlAliasFileFolder(); parent.AssignNoneAliasFields = false; alias = new AqlAliasContentFile(); AqlAliasRelation relation = new AqlAliasRelation(parent, alias, AqlRelFolderFiles.Relation); query.From(relation); if (contentTree.GetSelectedCount() > 0) { selectedFolderId = new CKeyNLR(contentTree.GetSelectedValues().GetFirst()).NodeId; } query.Where(parent.NodeId == selectedFolderId); } else { alias = new AqlAliasContentBase(0); query.From(alias); } query.Select(alias); query.Select(alias.Name, "Name"); query.Select(alias.ChangeDate, "ChangedDate"); query.OrderBy(alias.Name); if (master.Exchange != null) { if (master.Exchange.DialogueParameters.ContainsKey("WhereExpression")) { AqlExpressionBoolean where = (AqlExpressionBoolean)master.Exchange.DialogueParameters["WhereExpression"]; if (((object)where) != null) query.Where(where); } } int classId = 0; if (int.TryParse(ddlFilter.SelectedValue, out classId)) { // if selected //query.Where(AqlContent.ContentClassId == classId); query.Where(Aql.In(alias.ContentClassId, WAFContext.Session.Definitions.ContentClass[classId].AllDescendantsIncThis)); } else { // if not, return all in list or omit if no class is specified to dialogue if (classIds != null) query.Where(Aql.In(alias.ContentClassId, classIds)); } if (chkHideOtherLangs.Checked) { query.Where(alias.IsDerived == false); } if (txtSearch.Text.Length > 0) { if (int.TryParse(txtSearch.Text, out nodeId)) { query.Where(alias.NodeId == nodeId); } else { query.Where(Aql.Like(alias.Name, "*" + txtSearch.Text + "*")); } } contentList.Query = (query); if (!IsPostBack) { query.RetrieveTotalCount = true; query.PageSize = contentList.PageSize; } btnNewFolder.AddInputParameters("ChooseHierarchyPosition", false); btnNewFolder.AddInputParameters("EditAfterCreate", true); btnNewFolder.AddInputParameters("EditInNewWindow", true); btnNewFolder.AddInputParameters("ClassIds", WAFContext.Engine.Definition.ContentClass[FileFolder.ContentClassId].AllDescendantsIncThis.ToList()); btnNewContent.AddInputParameters("ChooseHierarchyPosition", false); btnNewContent.AddInputParameters("EditAfterCreate", true); btnNewContent.AddInputParameters("EditInNewWindow", true); btnNewContent.AddInputParameters("ClassIds", classIds); bool fileUpload = (bool)master.Exchange.DialogueParameters["FileUpload"]; if (fileUpload) { btnUpload.AddInputParameters("ParentFolderNodeId", selectedFolderId); btnUpload.AddInputParameters("FileUploadType", FileUploadType.ContentFileUpload); btnUpload.AddInputParameters("Multiple", true); btnUploadArchive.WorkflowType = typeof(WAF.Engine.Workflow.FileUpload); btnUploadArchive.AddInputParameters("ParentFolderNodeId", selectedFolderId); btnUploadArchive.AddInputParameters("FileUploadType", FileUploadType.ContentFileUploadZipped); btnUploadArchive.AddInputParameters("Multiple", false); } master.AddDialogueButton(btnSelect); // contentTree.PersistenceKey = "Tree"; }
void ensureInegrity(object stateInfo) { try { setThreadDescription("Ensuring data uniqueness"); SqlQuery query = new SqlQuery(WAFRuntime.Engine.Dao); DataAccessObject dao = WAFRuntime.Engine.Dao; // Node table setThreadDescription("Fixing Node table..."); int fixCount = 0; foreach (int nodeId in dao.GetDuplicateNodeRecords()) { if (dao.FixDuplicateNodeRecords(nodeId)) fixCount++; } //if (fixCount > 0) WFContext.Notify("Fixed " + fixCount + " duplicate records in the node table. "); // NodeCsd table setThreadDescription("Fixing Node Csd table..."); fixCount = 0; foreach (int[] ids in dao.GetDuplicateNodeCsdRecords()) { if (dao.FixDuplicateNodeCsdRecords(ids[0], ids[1])) fixCount++; } //if (fixCount > 0) WFContext.Notify("Fixed " + fixCount + " duplicate records in the nodeCsd table. "); // Content table setThreadDescription("Fixing Content table..."); fixCount = 0; foreach (int[] ids in dao.GetDuplicateContentBaseRecords()) { if (dao.FixDuplicateContentBaseRecords(ids[0], ids[1], ids[2])) fixCount++; } //if (fixCount > 0) WAFRuntime.Notify("Fixed " + fixCount + " duplicate records in the content table. "); // Class tables foreach (MemDefContentClass classDef in WAFRuntime.Engine.Definition.ContentClass.Values) { setThreadDescription("Fixing Class table '" + classDef.ClassName + "'..."); fixCount = 0; List<int> contentIds = dao.GetDuplicateContentClassRecords(classDef.Id); foreach (int contentId in contentIds) { if (dao.FixDuplicateContentClassRecords(classDef.Id, contentId)) fixCount++; } } //if (fixCount > 0) WAFRuntime.Notify("Fixed " + fixCount + " duplicate records in class tables. "); foreach (MemDefRelation relDef in WAFRuntime.Engine.Definition.Relation.Values) { } foreach (MemDefProperty propDef in WAFRuntime.Engine.Definition.Property.Values) { if (propDef.BasePropertyClassId == PropertyBaseClass.InnerContents) { } } AqlAlias alias = new AqlAlias(); alias.IgnoreSessionCulture = true; alias.IgnoreSessionRevision = true; alias.IncludeDeletedContents = true; alias.IncludeDeletedNodes = true; setThreadDescription("Refreshing derived flag..."); foreach (int siteId in WAFRuntime.Engine.GetAllSiteIds()) { foreach (int lcid in WAFRuntime.Engine.GetSiteAllLCIDs(siteId)) { UniqueList<int> cultInSite = new UniqueList<int>(WAFRuntime.Engine.GetSiteLCIDs(siteId)); if (!cultInSite.Contains(lcid)) { // if lcid is not in site, set all contents in this lcis to derived... // get all nodes in site SqlAliasNode node = new SqlAliasNode(); SqlAliasContent content = new SqlAliasContent(); SqlJoinExpression joinExp = new SqlJoinExpression(); joinExp.Add(node.Id, content.NodeId); SqlFromInnerJoin join = new SqlFromInnerJoin(node, content, joinExp); SqlQuery select = new SqlQuery(WAFRuntime.Engine.Dao); select.Select(content.ContentId); select.From(join); select.Where(node.SiteId == siteId); select.Where(content.LCID == lcid); select.Where(content.IsDerived == false); List<int> cIds = new List<int>(); using (SqlDataReader dr = select.ExecuteReader()) { while (dr.Read()) cIds.Add(dr.GetInt(0)); } foreach (int contentId in cIds) { SqlQuery update = new SqlQuery(WAFRuntime.Engine.Dao); update.Update(Sql.Table.Content); update.Set(Sql.Field.Content.IsDerived, true); update.Where(Sql.Field.Content.LCID == lcid); update.Where(Sql.Field.Content.ContentId == contentId); update.ExecuteNonQuery(); } if (isThreadCancelled()) return; } } } setThreadDescription("Retrieving node ids..."); SqlQuery sqlQuery = new SqlQuery(WAFRuntime.Engine.Dao); List<int> nodeIds = new List<int>(); List<int> classIds = new List<int>(); sqlQuery.From(Sql.Table.Node); sqlQuery.Distinct = true; sqlQuery.Select(Sql.Field.Node.Id); sqlQuery.Select(Sql.Field.Node.ContentClassId); using (SqlDataReader sqlDr = sqlQuery.ExecuteReader()) { while (sqlDr.Read()) { nodeIds.Add(sqlDr.GetInt(0)); classIds.Add(sqlDr.GetInt(1)); } } int n = 0; foreach (int nodeId in nodeIds) { WAFRuntime.Engine.Dao.RebuildDerivedContents(nodeId, classIds[n]); setThreadDescription("Ensuring derived content records: " + (++n) + " of " + nodeIds.Count + "..."); if (isThreadCancelled()) return; } setThreadDescription("Retrieving content ids..."); AqlQuery q = WAFRuntime.SystemSession.CreateQuery(); alias.IgnoreSessionRevision = true; alias.IgnoreSessionCulture = true; q.From(alias); q.Select(alias.ContentId); q.Select(alias.ContentClassId); List<int> coIds = new List<int>(); classIds = new List<int>(); AqlResultSet rs = q.Distinct().Execute(); while (rs.Read()) { coIds.Add((int)rs[0]); classIds.Add((int)rs[1]); } WAFRuntime.Engine.Dao.AddContentIdsInnerContent(ref coIds, ref classIds); n = 0; foreach (int contentId in coIds) { WAFRuntime.Engine.Dao.EnsureContentRecords(contentId, classIds[n], 0); setThreadDescription("Ensuring class table records: " + (++n) + " of " + coIds.Count + "..."); if (isThreadCancelled()) return; } WAFRuntime.Engine.ClearCache(); completeThread("DONE. Database integrity check is complete."); } catch (Exception error) { completeThread("ERROR: " + error.Message); } }
protected void Page_Load(object sender, EventArgs e) { _key = WebDialogueContext.GetDialogueParameter<CKeyNLR>("ContentKey", null); _classIds = WebDialogueContext.GetDialogueParameter<UniqueList<int>>("ClassIds", null); _selectionMode = WebDialogueContext.GetDialogueParameter<ListSelectionMode>("SelectionMode", ListSelectionMode.Multiple); // add all inherited classes aswell: UniqueList<int> newClassIds = new UniqueList<int>(); foreach (int id in _classIds) { MemDefContentClass clDef = WAFRuntime.Definitions.ContentClass[id]; foreach (int id2 in clDef.AllDescendantsIncThis) { if (!newClassIds.Contains(id2)) newClassIds.Add(id2); } } _classIds = newClassIds; MainButton mb = new MainButton(); mb.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnOk"); mb.Click += new EventHandler(mb_Click); Controls.Add(mb); WebDialogueContext.AddDialogueButton(mb); _paths = new List<PropertyPath>(); WMSelectFileToEditor.RetrieveAllRelevantPaths(WAFContext.Session.GetContent(_key), _paths, _classIds); _values = new List<FilePropertyValue>(); _selectedIndexes = new UniqueList<int>(); int n = 0; foreach (PropertyPath p in _paths) { _values.Add(WAFContext.Session.GetProperty<FilePropertyValue>(p)); if (Request["chk" + n] != null) _selectedIndexes.Add(n); n++; } if (_values.Count == 0) { WebDialogueContext.Session.Notify(Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentNotifyThereAreNoFile"), Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentYouMustUploadAFile")); WebDialogueContext.SendResult(new List<PropertyPath>()); } if (n > 3) { MainButton btnCheckAll = new MainButton(); btnCheckAll.Click += new EventHandler(btnCheckAll_Click); btnCheckAll.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnCheckAll"); Controls.Add(btnCheckAll); WebDialogueContext.AddDialogueButton(btnCheckAll); } }
public bool IsTransativeNullable(INonTerminal nonTerminal) { return(_transativeNullableSymbols.Contains(nonTerminal)); }
public bool IsNullable(INonTerminal nonTerminal) { return(_nullable.Contains(nonTerminal)); }
void refreshTypeList() { string currentSelected = lstFilterType.SelectedValue; lstFilterType.Items.Clear(); UniqueList<int> classIds = (UniqueList<int>)WebDialogueContext.DialogueParameters["ClassIds"]; if (classIds == null) { lstFilterType.Visible = false; return; } lstFilterType.Visible = true; Dictionary<int, MemDefContentClass> newList = new Dictionary<int, MemDefContentClass>(); foreach (int id in classIds) newList.Add(id, WAFContext.Session.Definitions.ContentClass[id]); if (_includeDerivated) { List<MemDefContentClass> secondList = new List<MemDefContentClass>(); foreach (MemDefContentClass c in newList.Values) secondList.Add(c); foreach (MemDefContentClass c in secondList) { foreach (int id in c.AllDescendantsIncThis) { if (!newList.ContainsKey(id)) newList.Add(id, WAFContext.Session.Definitions.ContentClass[id]); } } } IEnumerable<MemDefContentClass> list1 = from defs in newList.Values where (defs.ClassType == ContentClassType.ContentClass || defs.ClassType == ContentClassType.Interface) && defs.Id != 0 select defs; list1 = from def in list1 where hasContents(def.Id) select def; UniqueList<int> filtered = new UniqueList<int>(from d in list1 select d.Id); IEnumerable<MemDefContentClass> orderedList; lstFilterType.Items.Add(""); orderedList = from defs in list1 where defs.GetContentClassGroupId() == "local" orderby defs.GetName(WAFContext.Session) select defs; foreach (MemDefContentClass d in orderedList) lstFilterType.Items.Add(new ListItem(d.GetName(WAFContext.Session), d.Id.ToString())); orderedList = from defs in list1 where defs.GetContentClassGroupId() == "system" orderby defs.GetName(WAFContext.Session) select defs; ListItem l; if (orderedList.Count<MemDefContentClass>() > 0) { l = new ListItem("", ""); lstFilterType.Items.Add(l); l.Attributes.Add("disabled", "true"); l = new ListItem("------- SYSTEM TYPES --------", ""); lstFilterType.Items.Add(l); l.Attributes.Add("disabled", "true"); } foreach (MemDefContentClass d in orderedList) lstFilterType.Items.Add(new ListItem(d.GetName(WAFContext.Session), d.Id.ToString())); orderedList = from defs in list1 where defs.GetContentClassGroupId() == "internal" orderby defs.GetName(WAFContext.Session) select defs; if (orderedList.Count<MemDefContentClass>() > 0) { l = new ListItem("", ""); lstFilterType.Items.Add(l); l.Attributes.Add("disabled", "true"); l = new ListItem("------- INTERNAL TYPES --------", ""); lstFilterType.Items.Add(l); l.Attributes.Add("disabled", "true"); } foreach (MemDefContentClass d in orderedList) lstFilterType.Items.Add(new ListItem(d.GetName(WAFContext.Session), d.Id.ToString())); if (currentSelected != null && currentSelected.Length > 0) { if (filtered.Contains(int.Parse(currentSelected))) lstFilterType.SelectedValue = currentSelected; } }
private void FilterAddCandidate(Video candidate, UniqueList <Video> candidates) { if (candidate.TitleMatchRatio > Constants.MIN_ACCEPTABLE_TITLE_MATCH_PERCENTAGE && !candidates.Contains(candidate)) //TODO 003 replace by extension method: AddUnique(T) { candidates.Add(candidate); } }
public bool NodeExist(GraphPathNode graphPathNode) { return(_nodes.Contains(graphPathNode)); }
public void ResolveUnities(Project project, string projectPath, ref Dictionary <Unity, List <Project.Configuration> > unities) { // we need to compute the missing member values in the Unity objects: // UnityName and UnityOutputPattern var masks = new List <Tuple <Unity, int[]> >(); List <FieldInfo> fragmentsInfos = null; // first we merge the fragment values of all configurations sharing a unity foreach (var unityFile in unities) { var configurations = unityFile.Value; // get the fragment info from the first configuration target, // which works as they all share the same Target type if (fragmentsInfos == null) { fragmentsInfos = new List <FieldInfo>(configurations.First().Target.GetFragmentFieldInfo()); } var fragments = configurations.Select(x => x.Target.GetFragmentsValue()).ToList(); var merged = fragments[0]; for (int i = 1; i < fragments.Count; ++i) { var toMerge = fragments[i]; for (int j = 0; j < toMerge.Length; ++j) { merged[j] |= toMerge[j]; } } masks.Add(Tuple.Create(unityFile.Key, merged)); } // then, figure out which fragments are different *across* unities var differentFragmentIndices = new UniqueList <int>(); var fragmentValuesComparisonBase = masks[0].Item2; for (int i = 1; i < masks.Count; ++i) { var fragmentValues = masks[i].Item2; for (int j = 0; j < fragmentValues.Length; ++j) { if (fragmentValuesComparisonBase[j] != fragmentValues[j]) { differentFragmentIndices.Add(j); } } } // finally, create a unity name that only contains the varying fragments foreach (var unityFile in masks) { var unity = unityFile.Item1; var fragments = unityFile.Item2; string fragmentString = string.Empty; for (int i = 0; i < fragments.Length; ++i) { // if not a differentiating fragment, skip if (!differentFragmentIndices.Contains(i)) { continue; } // Convert from int to the fragment enum type, so we can ToString() them. // Fragments are enums by contract, so Enum.ToObject works var typedFragment = Enum.ToObject(fragmentsInfos[i].FieldType, fragments[i]); if (typedFragment is Platform) { Platform platformFragment = (Platform)typedFragment; string platformString = platformFragment.ToString(); if (platformFragment >= Platform._reserved9) { platformString = Util.GetSimplePlatformString(platformFragment); } fragmentString += "_" + platformString.ToLower(); } else { fragmentString += "_" + typedFragment.ToString().Replace(",", "").Replace(" ", ""); } } unity.UnityName = project.Name + fragmentString + "_unity"; unity.UnityOutputPattern = unity.UnityName.ToLower() + "*.cpp"; } }