/// <summary> /// The entry point of the program /// </summary> /// <param name="args"></param> public static void Main(string[] args) { UniqueList list = new UniqueList(); try { list.Add(0, 1); list.Add(1, 1); } catch (EqualElementsException e) { Console.WriteLine(e); } try { list.Remove(2); } catch (NonexistentElementException e) { Console.WriteLine(e); } int counter = list.GetSize(); Console.WriteLine("List: "); for (int i = 0; i < counter; ++i) { Console.Write(" " + list.Get(i)); } Console.WriteLine(); }
public void DeleteTest() { UniqueList list = new UniqueList(); list.AddToList(7); list.DeleteFromList(7); Assert.IsTrue(list.ListIsEmpty()); }
public void ElementExistTest() { UniqueList list = new UniqueList(); list.AddToList(4); Assert.IsTrue(list.ElementExist(4)); Assert.IsFalse(list.ElementExist(5)); }
public void AddRangeEnforcesSameRulesAsAdd() { var ins = new System.Collections.Generic.List<string> {"one", "one", null}; _uniqueList = new UniqueList<string>(); _uniqueList.AddRange(ins); Assert.AreEqual(1, _uniqueList.Count); }
public void Initialize() { list = new UniqueList(); list.AddElem(1); list.AddElem(2); list.AddElem(3); }
public void SizeOfListTest() { UniqueList list = new UniqueList(); list.AddToList(1); list.AddToList(2); list.AddToList(3); list.AddToList(3); Assert.AreEqual(3, list.SizeOfList()); }
public Grammar() { _productions = new ReadWriteList<IProduction>(); _ignores = new ReadWriteList<ILexerRule>(); _productionIndex = new Dictionary<INonTerminal, ReadWriteList<IProduction>>(); _ignoreIndex = new Dictionary<int, ReadWriteList<ILexerRule>>(); _nullable = new UniqueList<INonTerminal>(); _reverseLookup = new Dictionary<INonTerminal, UniqueList<IProduction>>(); }
public void UniqueListSerializationTest() { UniqueList<int> dataToSerialize = new UniqueList<int>(); byte[] data = SerializationUtil.SerializeData(dataToSerialize); Assert.IsNotNull(data); Assert.AreNotEqual(0, data.Length); UniqueList<int> deserializedData = SerializationUtil.DeserializeData<UniqueList<int>>(data); Assert.IsNotNull(deserializedData); Assert.AreNotSame(dataToSerialize, deserializedData); }
protected override void OnInit(EventArgs e) { _keys = WebDialogueContext.GetDialogueParameter<UniqueList<CKeyNLR>>("Keys", new UniqueList<CKeyNLR>()); var q = WAFContext.Session.CreateQuery(); q.From<ImageFile>(); q.Select(AqlImageFile.NodeId); q.Where(Aql.In(AqlImageFile.NodeId, _keys.Select(k => k.NodeId))); lstFiles.Query = q; lstFiles.DblClick += lstFiles_DblClick; base.OnInit(e); }
public override NextCall Invoke(WorkflowMethod invoker) { string selectedKeysString = GetUnsecureInput<string>("SelectedValues"); UniqueList<CKeyNLR> selectedContents = new UniqueList<CKeyNLR>(); foreach (string keyString in selectedKeysString.Split('|')) { if (keyString != null && keyString.Length > 0) selectedContents.Add(new CKeyNLR(keyString)); } WMContentTreeView.SetDefaultSelectedContents(selectedContents, RelHierarchical.RelationId, Session.CompleteKeyC(Session.SiteId), false); WMCreateContent diag = new WMCreateContent(0, false); return new NextCall(diag, onComplete); }
public void DataFromPosTest() { UniqueList list = new UniqueList(); list.AddToList(1); list.AddToList(2); list.AddToList(3); list.AddToList(5); list.AddToList(4); Assert.AreEqual(3, list.DataFromPos(3)); Assert.AreEqual(4, list.DataFromPos(5)); }
public override NextCall Invoke(WorkflowMethod invoker) { MemDefContentClass baseClassDef = WAFRuntime.Definitions.ContentClass[DiscountBase.ContentClassId]; UniqueList<int> classesToInclude = new UniqueList<int>(); foreach (int classId in baseClassDef.AllDescendantsIncThis) { if (classId != DiscountBase.ContentClassId) { classesToInclude.Add(classId); } } WMCreateContent d = new WMCreateContent(classesToInclude, false, false); return new NextCall(d, onComplete); }
void addTab(int tabIndex, string key, UniqueList<int> classIds) { List<string> fieldNames = new List<string>(); List<DataValueType> fieldDataValueType = new List<DataValueType>(); List<IDataValue[]> data = new List<IDataValue[]>(); fieldNames.Add("ClassId"); fieldNames.Add("Type"); fieldDataValueType.Add(DataValueType.IntegerType); fieldDataValueType.Add(DataValueType.ShortStringType); List<MemDefContentClass> sorted = new List<MemDefContentClass>(); foreach (int id in classIds) { MemDefContentClass classDef = WS.Definitions.ContentClass[id]; bool include = false; if (classDef.Id != 0 && classDef.ClassType == ContentClassType.ContentClass) { switch (classDef.GetContentClassGroupId()) { case "system": include = tabIndex == 1; break; case "internal": include = tabIndex == 2; break; default: include = tabIndex == 0; break; } } if (include) sorted.Add(classDef); } sorted.Sort(delegate(MemDefContentClass c1, MemDefContentClass c2) { return string.Compare(c1.GetName(WS), c2.GetName(WS)); }); foreach (MemDefContentClass classDef in sorted) { data.Add(new IDataValue[] { new IntegerDataValue(classDef.Id), new ShortStringDataValue(classDef.GetDescription(WS)) }); } ContentList list = null; TabView tab = null; if (tabIndex == 0) { list = ctlLocal; tab = tabs.GetTabView("local"); } else if (tabIndex == 1) { list = ctlSystem; tab = tabs.GetTabView("system"); } else if (tabIndex == 2) { list = ctlInternal; tab = tabs.GetTabView("internal"); } if (sorted.Count == 0) { tabs.RemoveView(tab.TabId); } list.IQuery = new DataQuery(fieldNames, fieldDataValueType, data); list.ViewMode = ListViewOptions.Details; list.DblClick += new EventHandler(list_DblClick); list.Height = new Unit("100%"); list.Width = new Unit("100%"); list.SelectionMode = _selectMode; }
public WDEditImageMeta(UniqueList<CKeyNLR> keys) { this.DialogueName = "EditImageMeta"; this.DialogueModule = "Main"; this.DialogueTitle = "Edit image meta data"; this.DialogueIcon = DialogueIcon.None; this.DialogueButtons = UIButtons.Cancel; if (this.DialogueHeight == 0) this.DialogueHeight = 550; if (this.DialogueWidth == 0) this.DialogueWidth = 710; this.DialogueShowDeviderLine = false; this.DialogueParameters.Add("Keys", keys); return; }
public override void Decode() { MemoryStream stream = new MemoryStream(Data); BinaryReader reader = new BinaryReader(stream); TotalOccurance = reader.ReadInt32(); NumStrings = reader.ReadInt32(); StringList = new UniqueList<string>(NumStrings); RichTextFormatting = new RichTextFormat[NumStrings]; StringDecoder stringDecoder = new StringDecoder(this, reader); for (int i = 0; i < NumStrings; i++) { StringList.Add(stringDecoder.ReadString(16, out RichTextFormatting[i])); } }
public void AddToHeadTest() { UniqueList<int> list = new UniqueList<int>(); bool wasThrown = false; try { list.AddToHead(1); list.AddToHead(1); } catch (DublicateElementException) { wasThrown = true; } Assert.IsTrue(wasThrown); }
public void TestValueTypeAddInsert() { IList<int> uniqueList = new UniqueList<int>(); uniqueList.Add(1); uniqueList.Add(2); uniqueList.Add(3); uniqueList.Add(3); uniqueList.Add(2); uniqueList.Add(1); Assert.AreEqual(3, uniqueList.Count); uniqueList.Insert(0, 1); uniqueList.Insert(0, 2); uniqueList.Insert(0, 3); Assert.AreEqual(3, uniqueList.Count); }
public void TestReferenceTypeAddInsert() { IList<string> uniqueList = new UniqueList<string>(); uniqueList.Add(null); uniqueList.Add("x"); uniqueList.Add("X"); Assert.AreEqual(3, uniqueList.Count); uniqueList.Add(null); uniqueList.Add("x"); uniqueList.Add("X"); Assert.AreEqual(3, uniqueList.Count); uniqueList.Insert(0, null); uniqueList.Insert(0, "x"); uniqueList.Insert(0, "X"); Assert.AreEqual(3, uniqueList.Count); }
public SelectByCopyOrReference(Guid exchangedId, UniqueList<CKeyNLR> selected) { _exchangedId = exchangedId; _selected = selected; }
private static bool GenerateMasterBffFile(Builder builder, ConfigurationsPerBff configurationsPerBff) { configurationsPerBff.Sort(); string masterBffFilePath = Util.GetCapitalizedPath(configurationsPerBff.BffFilePathWithExtension); string masterBffDirectory = Path.GetDirectoryName(masterBffFilePath); string masterBffFileName = Path.GetFileName(masterBffFilePath); // Global configuration file is in the same directory as the master bff but filename suffix added to its filename. string globalConfigFullPath = GetGlobalBffConfigFileName(masterBffFilePath); string globalConfigFileName = Path.GetFileName(globalConfigFullPath); var solutionProjects = configurationsPerBff.ResolvedProjects; if (solutionProjects.Count == 0 && configurationsPerBff.ProjectsWereFiltered) { // We are running in filter mode for submit assistant and all projects were filtered out. // We need to skip generation and delete any existing master bff file. Util.TryDeleteFile(masterBffFilePath); return(false); } // Start writing Bff var fileGenerator = new FileGenerator(); var masterBffInfo = new MasterBffInfo(); var bffPreBuildSection = new Dictionary <string, string>(); var bffCustomPreBuildSection = new Dictionary <string, string>(); var bffMasterSection = new Dictionary <string, string>(); var masterBffCopySections = new List <string>(); var masterBffCustomSections = new UniqueList <string>(); // section that is not ordered bool mustGenerateFastbuild = false; var platformBffCache = new Dictionary <Platform, IPlatformBff>(); var verificationPostBuildCopies = new Dictionary <string, string>(); foreach (Solution.Configuration solutionConfiguration in configurationsPerBff) { foreach (var solutionProject in solutionProjects) { var project = solutionProject.Project; // Export projects do not have any bff if (project.SharpmakeProjectType == Project.ProjectTypeAttribute.Export) { continue; } // When the project has a source file filter, only keep it if the file list is not empty if (project.SourceFilesFilters != null && (project.SourceFilesFiltersCount == 0 || project.SkipProjectWhenFiltersActive)) { continue; } Solution.Configuration.IncludedProjectInfo includedProject = solutionConfiguration.GetProject(solutionProject.Project.GetType()); bool perfectMatch = includedProject != null && solutionProject.Configurations.Contains(includedProject.Configuration); if (!perfectMatch) { continue; } var conf = includedProject.Configuration; if (!conf.IsFastBuildEnabledProjectConfig()) { continue; } mustGenerateFastbuild = true; IPlatformBff platformBff = platformBffCache.GetValueOrAdd(conf.Platform, PlatformRegistry.Query <IPlatformBff>(conf.Platform)); platformBff.AddCompilerSettings(masterBffInfo.CompilerSettings, conf); if (FastBuildSettings.WriteAllConfigsSection && includedProject.ToBuild == Solution.Configuration.IncludedProjectInfo.Build.Yes) { masterBffInfo.AllConfigsSections.Add(Bff.GetShortProjectName(project, conf)); } bool isOutputTypeExe = conf.Output == Project.Configuration.OutputType.Exe; bool isOutputTypeDll = conf.Output == Project.Configuration.OutputType.Dll; bool isOutputTypeLib = conf.Output == Project.Configuration.OutputType.Lib; bool isOutputTypeExeOrDll = isOutputTypeExe || isOutputTypeDll; using (fileGenerator.Declare("conf", conf)) using (fileGenerator.Declare("target", conf.Target)) using (fileGenerator.Declare("project", conf.Project)) { var preBuildEvents = new Dictionary <string, Project.Configuration.BuildStepBase>(); if (isOutputTypeExeOrDll || conf.ExecuteTargetCopy) { var copies = ProjectOptionsGenerator.ConvertPostBuildCopiesToRelative(conf, masterBffDirectory); foreach (var copy in copies) { var sourceFile = copy.Key; var sourceFileName = Path.GetFileName(sourceFile); var destinationFolder = copy.Value; var destinationFile = Path.Combine(destinationFolder, sourceFileName); // use the global root for alias computation, as the project has not idea in which master bff it has been included var destinationRelativeToGlobal = Util.GetConvertedRelativePath(masterBffDirectory, destinationFolder, conf.Project.RootPath, true, conf.Project.RootPath); { string key = sourceFileName + destinationRelativeToGlobal; string currentSourceFullPath = Util.PathGetAbsolute(masterBffDirectory, sourceFile); string previous; if (verificationPostBuildCopies.TryGetValue(key, out previous)) { if (previous != currentSourceFullPath) { builder.LogErrorLine("A post-build copy to the destination '{0}' already exist but from different sources: '{1}' and '{2}'!", Util.PathGetAbsolute(masterBffDirectory, destinationFolder), previous, currentSourceFullPath); } } else { verificationPostBuildCopies.Add(key, currentSourceFullPath); } } string fastBuildCopyAlias = UtilityMethods.GetFastBuildCopyAlias(sourceFileName, destinationRelativeToGlobal); { using (fileGenerator.Declare("fastBuildCopyAlias", fastBuildCopyAlias)) using (fileGenerator.Declare("fastBuildCopySource", Bff.CurrentBffPathKeyCombine(sourceFile))) using (fileGenerator.Declare("fastBuildCopyDest", Bff.CurrentBffPathKeyCombine(destinationFile))) { if (!bffMasterSection.ContainsKey(fastBuildCopyAlias)) { bffMasterSection.Add(fastBuildCopyAlias, fileGenerator.Resolver.Resolve(Bff.Template.ConfigurationFile.CopyFileSection)); } } } } } foreach (var eventPair in conf.EventPreBuildExecute) { preBuildEvents.Add(eventPair.Key, eventPair.Value); } foreach (var buildEvent in conf.ResolvedEventPreBuildExe) { string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PreBuild); preBuildEvents.Add(eventKey, buildEvent); } WriteEvents(fileGenerator.Resolver, preBuildEvents, bffPreBuildSection, conf.Project.RootPath, masterBffDirectory); var customPreBuildEvents = new Dictionary <string, Project.Configuration.BuildStepBase>(); foreach (var eventPair in conf.EventCustomPrebuildExecute) { customPreBuildEvents.Add(eventPair.Key, eventPair.Value); } foreach (var buildEvent in conf.ResolvedEventCustomPreBuildExe) { string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PreBuildCustomAction); customPreBuildEvents.Add(eventKey, buildEvent); } WriteEvents(fileGenerator.Resolver, customPreBuildEvents, bffCustomPreBuildSection, conf.Project.RootPath, masterBffDirectory); if (includedProject.ToBuild == Solution.Configuration.IncludedProjectInfo.Build.Yes) { MergeBffIncludeTreeRecursive(conf, ref masterBffInfo.BffIncludeToDependencyIncludes); } } } } if (!mustGenerateFastbuild) { throw new Error("Sharpmake-FastBuild : Trying to generate a MasterBff with none of its projects having a FastBuild configuration, or having a platform supporting it, or all of them having conf.DoNotGenerateFastBuild = true"); } masterBffCopySections.AddRange(bffMasterSection.Values); masterBffCopySections.AddRange(bffPreBuildSection.Values); masterBffCustomSections.AddRange(bffCustomPreBuildSection.Values); var result = new StringBuilder(); foreach (var projectBffFullPath in GetMasterIncludeList(masterBffInfo.BffIncludeToDependencyIncludes)) { string projectFullPath = Path.GetDirectoryName(projectBffFullPath); var projectPathRelativeFromMasterBff = Util.PathGetRelative(masterBffDirectory, projectFullPath, true); string bffKeyRelative = Path.Combine(projectPathRelativeFromMasterBff, Path.GetFileName(projectBffFullPath)); result.AppendLine($"#include \"{bffKeyRelative}\""); } string fastBuildMasterBffDependencies = result.Length == 0 ? FileGeneratorUtilities.RemoveLineTag : result.ToString(); GenerateMasterBffGlobalSettingsFile(builder, globalConfigFullPath, masterBffInfo); using (fileGenerator.Declare("fastBuildProjectName", masterBffFileName)) using (fileGenerator.Declare("fastBuildGlobalConfigurationInclude", $"#include \"{globalConfigFileName}\"")) { fileGenerator.Write(Bff.Template.ConfigurationFile.HeaderFile); foreach (Platform platform in platformBffCache.Keys) // kind of cheating to use that cache instead of the masterBffInfo.CompilerSettings, but it works :) { using (fileGenerator.Declare("fastBuildDefine", Bff.GetPlatformSpecificDefine(platform))) fileGenerator.Write(Bff.Template.ConfigurationFile.Define); } fileGenerator.Write(Bff.Template.ConfigurationFile.GlobalConfigurationInclude); } WriteMasterCopySection(fileGenerator, masterBffCopySections); WriteMasterCustomSection(fileGenerator, masterBffCustomSections); using (fileGenerator.Declare("fastBuildProjectName", masterBffFileName)) using (fileGenerator.Declare("fastBuildOrderedBffDependencies", fastBuildMasterBffDependencies)) { fileGenerator.Write(Bff.Template.ConfigurationFile.Includes); } if (masterBffInfo.AllConfigsSections.Count != 0) { using (fileGenerator.Declare("fastBuildConfigs", UtilityMethods.FBuildFormatList(masterBffInfo.AllConfigsSections.SortedValues, 4))) { fileGenerator.Write(Bff.Template.ConfigurationFile.AllConfigsSection); } } // remove all line that contain RemoveLineTag fileGenerator.RemoveTaggedLines(); MemoryStream bffCleanMemoryStream = fileGenerator.ToMemoryStream(); // Write master .bff file FileInfo bffFileInfo = new FileInfo(masterBffFilePath); bool updated = builder.Context.WriteGeneratedFile(null, bffFileInfo, bffCleanMemoryStream); foreach (var confsPerSolution in configurationsPerBff) { confsPerSolution.Solution.PostGenerationCallback?.Invoke(masterBffDirectory, Path.GetFileNameWithoutExtension(masterBffFileName), FastBuildSettings.FastBuildConfigFileExtension); } return(updated); }
/// <summary> /// /// </summary> /// <param name="worldObject"></param> /// <returns>A list of all <see cref="GridLocation"/>s containing the <see cref="IWorldObject"/></returns> public List<GridLocation> Intersects(IWorldObject worldObject) { List<GridLocation> found = new List<GridLocation>(gridSize.X * gridSize.Y); List<GridLocation> missed = new List<GridLocation>(gridSize.X * gridSize.Y); UniqueList<GridLocation> toTest = new UniqueList<GridLocation>(gridSize.X * gridSize.Y); UniqueList<GridLocation> newToBeTested = new UniqueList<GridLocation>(gridSize.X * gridSize.Y); // the GridLocation that contains the center of the object GridLocation hasCenter; // STEP 1 - determine the GridLocation of the object's center Point cellCoord; // Use integer division to find cell coordinates. // Since the grid cell coords are in the upperleft corner // 1 must be subtracted from the division if we are in the negative (left or up) // direction - effectively rounding up in absolute value. if (worldObject.Position.X < 0) cellCoord.X = (Int16)(((Int16)worldObject.Position.X / (Int16)cellSize.X) - 1); else cellCoord.X = (Int16)(((Int16)worldObject.Position.X / (Int16)cellSize.X)); if (worldObject.Position.Y < 0) cellCoord.Y = (Int16)(((Int16)worldObject.Position.Y / (Int16)cellSize.Y) - 1); else cellCoord.Y = (Int16)(((Int16)worldObject.Position.Y / (Int16)cellSize.Y)); // check to makes sure these coordinates are in the world if (minGrid.X <= cellCoord.X && cellCoord.X <= maxGrid.X && minGrid.Y <= cellCoord.Y && cellCoord.Y <= maxGrid.Y) { hasCenter = new GridLocation((Int16)cellCoord.X, (Int16)cellCoord.Y, cellSize); } // if they are not in the world, return the empty list else { return found; } // add it to the found list found.Add(hasCenter); // STEP 2 - determine all surrounding GridLocations that contain the object toTest.UnionWith(GetSurrounding(hasCenter)); while (toTest.Count != 0) { foreach (GridLocation gridLocation in toTest) { // if a surrounding GridLocation intersects the object do 4 things if (worldObject.Bounds.Intersects(gridLocation.Bounds)) { // 1. Add it to the found list found.Add(gridLocation); // 2. Get its surrounding GridLocations newToBeTested.UnionWith(GetSurrounding(gridLocation)); // 3. Remove any that are already known to not contain the object foreach (GridLocation g in missed) { newToBeTested.Remove(g); } // 4. Remove any that are already known to contain the object foreach (GridLocation g in found) { newToBeTested.Remove(g); } } // if a surrounding GridLocation DOES NOT intersect the object add it to missed else { missed.Add(gridLocation); } } // since we have checked everything in toTest flush it toTest.Clear(); // add the newly found surrounding candidates to toTest toTest.UnionWith(newToBeTested); // flush the temp list newToBeTested.Clear(); } return found; }
private void GenerateCommands() { var cmds = (from e in definitions.enums where e.name == "MAV_CMD" select e).FirstOrDefault(); if (cmds == null) { return; } foreach (var cmd in cmds.entries) { Console.WriteLine("generating command {0}", cmd.name); if (!string.IsNullOrWhiteSpace(cmd.description)) { WriteComment("", cmd.description); } string name = CamelCase(cmd.name); header.WriteLine("class {0} : public MavLinkCommand {{", name); header.WriteLine("public:"); header.WriteLine(" const static uint16_t kCommandId = {0};", cmd.value); header.WriteLine(" {0}() {{ command = kCommandId; }}", name); UniqueList unique = new UniqueList(); foreach (var p in cmd.parameters) { string fieldName = p.label; if (string.IsNullOrWhiteSpace(fieldName)) { fieldName = NameFromDescription(p.description); } else { fieldName = LegalizeIdentifier(fieldName); } if (fieldName != "Empty" && fieldName != "Reserved") { if (!string.IsNullOrWhiteSpace(p.description)) { WriteComment(" ", p.description); } header.WriteLine(" float {0} = 0;", unique.Add(fieldName)); } } unique = new UniqueList(); header.WriteLine("protected:"); header.WriteLine(" virtual void pack();"); impl.WriteLine("void {0}::pack() {{", name); int i = 0; foreach (var p in cmd.parameters) { i++; string fieldName = p.label; if (string.IsNullOrWhiteSpace(fieldName)) { fieldName = NameFromDescription(p.description); } else { fieldName = LegalizeIdentifier(fieldName); } if (fieldName != "Empty" && fieldName != "Reserved") { impl.WriteLine(" param{0} = {1};", i, unique.Add(fieldName)); } } impl.WriteLine("}"); header.WriteLine(" virtual void unpack();"); impl.WriteLine("void {0}::unpack() {{", name); unique = new UniqueList(); i = 0; foreach (var p in cmd.parameters) { i++; string fieldName = p.label; if (string.IsNullOrWhiteSpace(fieldName)) { fieldName = NameFromDescription(p.description); } else { fieldName = LegalizeIdentifier(fieldName); } if (fieldName != "Empty" && fieldName != "Reserved") { impl.WriteLine(" {1} = param{0};", i, unique.Add(fieldName)); } } impl.WriteLine("}"); header.WriteLine("};"); } }
public void AddTest() { UniqueList list = new UniqueList(); list.AddToList(5); Assert.AreEqual(list.HeadValue(), 5); }
void refreshTabs() { tabbedView.Visible = true; CKeyNLR selected = null; _currentUser = null; if (userList.GetSelectedCount() > 0) { selected = userList.GetSelectedKeys().GetFirst(); if (WAFContext.Session.NodeExists(selected.NodeId, true, true)) { _currentUser = WAFContext.Session.GetContent<SystemUser>(selected); } else { selected = null; cntFrm.Content = null; userList.ClearFlaggedValues(); } } if (selected == null) { tabbedView.Visible = false; return; } // Details if (cntFrm.Content == null || cntFrm.Content.RootContent.Key.lKey != _currentUser.Key.lKey) { cntFrm.Content = _currentUser; } // Effective memberships AqlQuery qm = WAFContext.Session.CreateQuery(); qm.From<UserGroup>(); qm.Select<UserGroup>(); qm.Select(AqlUserGroup.NodeId); UniqueList<int> allGroupMembersShips; try { allGroupMembersShips = _currentUser.GetAllMembershipsById(); } catch (CircularReferenceException error) { WAFContext.Session.Notify(error); allGroupMembersShips = new UniqueList<int>(-1); } qm.Where(Aql.In(AqlUserGroup.NodeId, allGroupMembersShips)); listMemberships.Query = qm; // Effective permissions AqlQuery qp = WAFContext.Session.CreateQuery(); qp.From<ContentBase>(); qp.Select<ContentBase>(); if (!_currentUser.IsAdmin) { AqlExpressionBuilder ex = new AqlExpressionBuilder(); UniqueList<int> ms = new UniqueList<int>(allGroupMembersShips); ms.Add((int)SystemUserGroupType.AllUsers); ms.Add((int)SystemUserGroupType.Anonymous); AqlPropertyInteger prop = null; switch (rblPermissions.SelectedValue) { case "Read": prop = AqlContent.ReadGroupId; break; case "Edit": prop = AqlContent.EditGroupId; break; case "Publish": prop = AqlContent.PublishGroupId; break; default: break; } qp.Where(Aql.In(prop, ms)); } listPermissions.Query = qp; // Relevant content AqlQuery qr = WAFContext.Session.CreateQuery(); qr.From<ContentBase>(); qr.Select<ContentBase>(); qr.Select(AqlContent.NodeId); qr.IncludeUnpublished = true; qr.Where( (AqlContent.AuthorId == _currentUser.NodeId) | (AqlContent.CreatedById == _currentUser.NodeId) | (AqlContent.PublicationApprovedById == _currentUser.NodeId) | (AqlContent.ChangedById == _currentUser.NodeId )); listRelevant.Query = qr; }
private void AddProductionToReverseLookup(IProduction production) { // get nullable nonterminals: http://cstheory.stackexchange.com/a/2493/32787 if (production.IsEmpty) _nullable.Add(production.LeftHandSide); for(var s = 0; s< production.RightHandSide.Count; s++) { var symbol = production.RightHandSide[s]; if (symbol.SymbolType != SymbolType.NonTerminal) continue; var nonTerminal = symbol as INonTerminal; UniqueList<IProduction> hashSet = null; if (!_reverseLookup.TryGetValue(nonTerminal, out hashSet)) { hashSet = new UniqueList<IProduction>(); _reverseLookup.Add(nonTerminal, hashSet); } hashSet.Add(production); } }
public SST() { this.Type = 252; this.StringList = new UniqueList <string>(); }
public IViewComponentResult Invoke(UniqueList <string> modules) { modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName()); return(View(new Model.Email())); }
public void Initialize() { list = new UniqueList(); }
public AssetNetworkResponseMessage(Network network, UniqueList <Asset> assets) { Network = network; Assets = assets; }
public void Setup() { list = new UniqueList(); }
internal DeleteUsers(UniqueList<CKeyNLR> keys) { _keys = keys; }
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); } }
public async Task <IReadOnlyDictionary <Network, AssetPairs> > GetNetworkPairsAsync(UniqueList <Network> networks, bool onlyDirect = true) { var results = new ConcurrentDictionary <Network, AssetPairs>(); var tasks = networks.Select(async n => { var r = await GetPairsAsync(n).ConfigureAwait(false); results.TryAdd(n, r); }); await Task.WhenAll(tasks).ConfigureAwait(false); return(results.ToDictionary(x => x.Key, y => y.Value)); }
public WMEditImageMeta(UniqueList<CKeyNLR> keys) { _keys = keys; }
NextCall onCompleteSelectClass(WorkflowMethod invoker) { WMSelectContentClass selectClass = (WMSelectContentClass)invoker; _classIds = selectClass.SelectedClassIds; AqlQuery q = Session.CreateQuery(); AqlAliasContentBase alias = new AqlAliasContentBase(); AqlResultInteger nodeId = q.Select(alias.NodeId); AqlResultInteger rev = q.Select(alias.Revision); AqlResultInteger lc = q.Select(alias.LCID); q.Where(Aql.In(alias.ContentClassId, _classIds)); alias.IgnoreSessionCulture = _allCultures; alias.IgnoreSessionRevision = _allRevision; if (!_allSites) q.Where(alias.SiteId == Session.SiteId); q.From(alias); _selectedContents = new List<CKeyNLR>(); AqlResultSet rs = q.Execute(); while (rs.Read()) _selectedContents.Add(new CKeyNLR(nodeId, lc, rev)); return searchStart(this); }
/// <summary> /// Requests the <see cref="Grid"/> to return a list of all <see cref="IWorldObject"/>s /// which share a GridLocation with the given object. /// </summary> /// <param name="worldObject"></param> /// <returns></returns> public List<IWorldObject> PotentialIntersects(IWorldObject worldObject) { UniqueList<IWorldObject> collidables = new UniqueList<IWorldObject>(); // find all grid locations that contain the object List<GridLocation> IntersectedGridCells = Intersects(worldObject); foreach (GridLocation gridLocation in IntersectedGridCells) { // compile a list of all objects contained in the found Grid Locations collidables.UnionWith(getLocationObjectsOf(gridLocation)); } return collidables; }
public void DeleteTest() { UniqueList list = new UniqueList(); list.DeleteFromList(5); }
private static void WriteMasterCustomSection(IFileGenerator masterBffGenerator, UniqueList <string> masterBffCustomSections) { if (masterBffCustomSections.Count != 0) { masterBffGenerator.Write(Bff.Template.ConfigurationFile.CustomSectionHeader); } foreach (var customSection in masterBffCustomSections) { masterBffGenerator.Write(new StringReader(customSection).ReadToEnd()); } }
public void PrintTest() { UniqueList list = new UniqueList(); list.PrintList(); }
public IViewComponentResult Invoke(UniqueList <string> modules) { return(View()); }