public MatchCollector(ExtractionData probe, ExtractionData candidate) { var tree = new ObjectTree(Matcher); tree.Remove("MinutiaMatcher.EdgeTablePrototype"); tree.Remove("MinutiaMatcher.RootSelector"); tree.Remove("MinutiaMatcher.Pairing"); tree.Remove("MinutiaMatcher.MatchScoring"); Logger.Attach(tree); Collect(probe.Template, candidate.Template); probe.PropertyChanged += (source, args) => { if (args.PropertyName == "Template") { Collect(probe.Template, candidate.Template); } }; candidate.PropertyChanged += (source, args) => { if (args.PropertyName == "Template") { Collect(probe.Template, candidate.Template); } }; }
/// <summary> /// Constructs a constraint with the specified expected value and node filter. /// </summary> /// <param name="expected">the expected value</param> /// <param name="nodeFilter">the filter to use, or null if no filter should be used</param> public ObjectTreeEqualConstraint(object expected, IObjectTreeNodeFilter nodeFilter) { this.expected = expected; this.nodeFilter = nodeFilter; this.expectedTree = ObjectTree.Create(expected, nodeFilter); this.DisplayName = "equal"; }
/// <summary> /// 선택된 go와 설정된 네임스페이스, /// </summary> /// <param name="go"></param> /// <param name="defNamespace"></param> /// <param name="defaultTemplatePath"></param> public void Setup(GameObject go, string defNamespace, string defaultTemplatePath) { //clear savedList.Clear(); className = ""; nameSpace = ""; csFilePath = ""; fileName = go.name; //init //savedList.Add(go); nameSpace = defNamespace; RecursiveSearch(go); savedList.Remove(go); sampleT4FilePath = defaultTemplatePath; if (string.IsNullOrEmpty(sampleT4FilePath) == true) { sampleT4FilePath = Application.dataPath + "/T4Sample/TextTemplate1.tt"; } tree = new ObjectTree(go.name); for (int i = 0; i < go.transform.childCount; i++) { RecursiveSearchTree(ref tree, "", go.transform.GetChild(i).gameObject); } }
public void ConstructorSetsPropertiesToDefaultValuesAndNull() { var tree = new ObjectTree <object>(); Assert.That(tree.Children, Is.Null); Assert.That(tree.Item, Is.Null); }
public void TestXmlDocumentSeiralization() { var objTree = new ObjectTree { Foo = "Foo1", Bar = 1, Nested = new List<object>() }; objTree.Nested.AddRange(new[] { new ObjectTree{ Foo = "Foo2", Bar = 2}, new ObjectTree{ Foo = "Foo3", Bar = 3}, }); XmlDocument xmlDoc = objTree.ToXmlDocument(); string xml = xmlDoc.ToXml(); Assert.IsNotNull(xml); XmlNode parentElem = xmlDoc.DocumentElement; objTree.SerializeInto(parentElem); xml = xmlDoc.ToXml(); Assert.IsNotNull(xml); xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); ObjectTree newObjectTree = xmlDoc.Deserialize<ObjectTree>(); Assert.IsNotNull(newObjectTree); ObjectTree nested = newObjectTree.AnyXml.Deserialize<ObjectTree>(); Assert.AreEqual(1, nested.Bar); Assert.AreEqual(objTree.Nested.Count, nested.Nested.Count); }
private void PacketListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0 || e.AddedItems[0] == null) { return; } object item = (sender as ListBox).SelectedItem; AcknowledgeListItem ack = item as AcknowledgeListItem; AsyncListItem async = item as AsyncListItem; ErrorListItem err = item as ErrorListItem; if (ack != null) { ObjectTree.SetRoot("Invoke", BuildAck(ack.ServiceName, ack.Operation, ack.InvokeArguments, ack.Response)); } else if (async != null) { ObjectTree.SetRoot("AsyncMessage", BuildAsync(async.Body)); } else if (err != null) { ObjectTree.SetRoot("Invoke", BuildError(err.ServiceName, err.Operation, err.InvokeArguments, err.Response)); } }
//-------------------------------------------------------------------------------------------------- // メインウィンドウ中央描画領域. private void drawMainMiddleElem() { EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(MAIN_MIDDLE_ELEM_WIDTH)); EditorGUILayout.LabelField("検索結果表示欄."); if (this.objList != null) { // ここで検索結果のオブジェクトをリスト表示する. this.middleScrPos = EditorGUILayout.BeginScrollView(this.middleScrPos); { for (int i = 0; i < this.objList.Count; ++i) { if (GUILayout.Button(this.objList[i].name)) { this.objTree = null; this.objTree = new ObjectTree(( GameObject )this.objList[i]); Object[] obj = { ( Object )this.objList[i] }; Selection.objects = obj; } } } EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); }
public void RenameOnSubFolder() { var storage = new Mock <IMetaDataStorage>(); var fsFactory = new Mock <IFileSystemInfoFactory>(); var underTest = new LocalEventGenerator(storage.Object, fsFactory.Object); Dictionary <string, Tuple <AbstractFolderEvent, AbstractFolderEvent> > eventMap = new Dictionary <string, Tuple <AbstractFolderEvent, AbstractFolderEvent> >(); Guid rootGuid = Guid.NewGuid(); var rootName = "root"; var rootPath = Path.Combine(Path.GetTempPath(), rootName); var rootObjectId = "rootId"; ObjectTree <IFileSystemInfo> rootTree = this.CreateTreeFromPathAndGuid(rootName, rootPath, rootGuid); Guid subFolderGuid = Guid.NewGuid(); var subName = "A"; var subPath = Path.Combine(rootPath, subName); var subFolderId = "subId"; ObjectTree <IFileSystemInfo> subFolder = this.CreateTreeFromPathAndGuid(subName, subPath, subFolderGuid); rootTree.Children.Add(subFolder); Guid subSubFolderGuid = Guid.NewGuid(); var subSubName = "B"; var subSubPath = Path.Combine(subPath, subSubName); var subSubFolderId = "subId"; ObjectTree <IFileSystemInfo> subSubFolder = this.CreateTreeFromPathAndGuid(subSubName, subSubPath, subSubFolderGuid); subFolder.Children.Add(subSubFolder); List <IMappedObject> storedObjectsForLocal = new List <IMappedObject>(); var rootMappedObject = this.CreateStoredObjectMock(rootGuid, rootObjectId, rootName, null); storedObjectsForLocal.Add(rootMappedObject); var subMappedObject = this.CreateStoredObjectMock(subFolderGuid, subFolderId, subName, rootObjectId); storedObjectsForLocal.Add(subMappedObject); var subSubMappedObject = this.CreateStoredObjectMock(subSubFolderGuid, subSubFolderId, "oldsubsubName", subSubFolderId); storedObjectsForLocal.Add(subSubMappedObject); storage.Setup(s => s.GetLocalPath(rootMappedObject)).Returns(rootPath); storage.Setup(s => s.GetLocalPath(subMappedObject)).Returns(subPath); storage.Setup(s => s.GetLocalPath(subSubMappedObject)).Returns(subSubPath); ISet <IMappedObject> handledLocalStoredObjects = new HashSet <IMappedObject>(); List <AbstractFolderEvent> creationEvents = underTest.CreateEvents(storedObjectsForLocal, rootTree, eventMap, handledLocalStoredObjects); foreach (var handledObjects in handledLocalStoredObjects) { storedObjectsForLocal.Remove(handledObjects); } storedObjectsForLocal.Remove(rootMappedObject); Assert.That(creationEvents, Is.Empty); Assert.That(storedObjectsForLocal, Is.Empty); Assert.That(eventMap.Count, Is.EqualTo(1)); Assert.That(eventMap[subSubFolderId], Is.Not.Null); Assert.That(eventMap[subSubFolderId].Item1.Local, Is.EqualTo(MetaDataChangeType.CHANGED)); }
/// <summary> /// Gets the remote directory tree. /// </summary> /// <returns>The remote directory tree.</returns> /// <param name="parent">Parent folder.</param> /// <param name="descendants">Descendants of remote object.</param> /// <param name="filter">Filter of ignored or invalid files and folder</param> public static IObjectTree <IFileableCmisObject> GetRemoteDirectoryTree(IFolder parent, IList <ITree <IFileableCmisObject> > descendants, IFilterAggregator filter, IIgnoredEntitiesStorage ignoredStorage, IPathMatcher matcher) { IList <IObjectTree <IFileableCmisObject> > children = new List <IObjectTree <IFileableCmisObject> >(); if (descendants != null) { foreach (var child in descendants) { if (child.Item is IFolder) { string reason; var folder = child.Item as IFolder; if (!filter.FolderNamesFilter.CheckFolderName(folder.Name, out reason) && !filter.InvalidFolderNamesFilter.CheckFolderName(folder.Name, out reason)) { if (folder.AreAllChildrenIgnored()) { ignoredStorage.AddOrUpdateEntryAndDeleteAllChildrenFromStorage(new IgnoredEntity(folder, matcher)); Logger.Info(string.Format("Folder {0} with Id {1} is ignored", folder.Name, folder.Id)); children.Add(new ObjectTree <IFileableCmisObject> { Item = child.Item, Children = new List <IObjectTree <IFileableCmisObject> >() }); } else { ignoredStorage.Remove(folder.Id); children.Add(GetRemoteDirectoryTree(folder, child.Children, filter, ignoredStorage, matcher)); } } else { Logger.Info(reason); } } else if (child.Item is IDocument) { string reason; if (!filter.FileNamesFilter.CheckFile(child.Item.Name, out reason)) { children.Add(new ObjectTree <IFileableCmisObject> { Item = child.Item, Children = new List <IObjectTree <IFileableCmisObject> >() }); } else { Logger.Info(reason); } } } } var tree = new ObjectTree <IFileableCmisObject> { Item = parent, Children = children }; return(tree); }
public void ItemProperty() { var tree = new ObjectTree<object>(); var obj = new object(); tree.Item = obj; Assert.That(tree.Item, Is.EqualTo(obj)); }
/// <inheritdoc /> public override bool Matches(object actual) { this.actual = actual; this.actualTree = ObjectTree.Create(actual, nodeFilter); this.differences = new ObjectTreeEqualityComparer().FindDifferences(expectedTree, actualTree).ToList(); return(!this.differences.Any()); }
public ObjectTree _get_object_tree(uint topNodeSId) { if (!m_objectTreeCache.Exists(topNodeSId)) { ObjectTree ot = new ObjectTree(topNodeSId, m_dbSegmentManager); m_objectTreeCache.Insert(topNodeSId, ot); } return((ObjectTree)m_objectTreeCache.Retrive(topNodeSId)); }
public void ItemProperty() { var tree = new ObjectTree <object>(); var obj = new object(); tree.Item = obj; Assert.That(tree.Item, Is.EqualTo(obj)); }
public void ToListReturnsRootItemAsEntryInList() { var obj = new object(); var tree = new ObjectTree<object> { Item = obj }; Assert.That(tree.ToList(), Contains.Item(obj)); }
public void ToListReturnsRootItemAsEntryInList() { var obj = new object(); var tree = new ObjectTree <object> { Item = obj }; Assert.That(tree.ToList(), Contains.Item(obj)); }
public void TestExtractName() { const string test = "org(3)"; Assert.AreEqual("org", ObjectTree.ExtractName(test)); const string test1 = "iso"; Assert.AreEqual("iso", ObjectTree.ExtractName(test1)); }
/// <summary> /// Adds the specified node filter to this constraint. /// </summary> /// <param name="nodeFilter">the filter to use, or null if no filter should be used</param> /// <returns>self</returns> public ObjectTreeEqualConstraint WithFilter(IObjectTreeNodeFilter nodeFilter) { if (nodeFilter == null) { throw new ArgumentNullException(nameof(nodeFilter)); } this.nodeFilter = nodeFilter; this.expectedTree = ObjectTree.Create(expected, nodeFilter); return(this); }
public void Attach(ObjectTree tree) { foreach (object reference in tree.GetAllObjects()) { FieldInfo field = reference.GetType().GetField("Logger"); if (field != null) { field.SetValue(reference, new ActiveHook(this, tree.GetPath(reference))); } } }
public ObjectTree Add(string parentName, string name) { ObjectTree child = new ObjectTree(parentName, parentName + (string.IsNullOrEmpty(parentName) ? "" : seperator) + name); children.Add(child); childrenName.Add(child.name); return(child); }
public void ChildrenProperty() { var tree = new ObjectTree<object>(); var obj = new object(); IList<IObjectTree<object>> children = new List<IObjectTree<object>>(); children.Add(new ObjectTree<object> { Item = obj }); tree.Children = children; Assert.That(tree.Children, Is.Not.Null); Assert.That(tree.Children[0].Item, Is.EqualTo(obj)); }
private ObjectTree <IFileSystemInfo> CreateTreeFromPathAndGuid(string name, string path, Guid guid) { var localTree = new ObjectTree <IFileSystemInfo>(); var fsInfo = new Mock <IDirectoryInfo>(); fsInfo.Setup(f => f.GetExtendedAttribute(It.IsAny <string>())).Returns(guid.ToString()); fsInfo.Setup(f => f.FullName).Returns(path); fsInfo.Setup(f => f.Name).Returns(name); fsInfo.Setup(f => f.LastWriteTimeUtc).Returns(zeroDate); localTree.Item = fsInfo.Object; localTree.Children = new List <IObjectTree <IFileSystemInfo> >(); return(localTree); }
public object Perform(object prm) { ObjectTree tPrm = new ObjectTree(prm); string command = tPrm[0].StringValue; if (command == "background-image-src-list") { return(Directory.GetFiles(Path.Combine(ProcMain.SelfDir, @"..\..\..\..\..\home\coffee\res\background-image")) .Select(v => "res/background-image/" + Path.GetFileName(v)) .ToArray()); } throw new Exception("不明なコマンド"); }
public void Perspective(GameObject go) { string[] strs = new string[6]; //System.Array.IndexOf() ObjectTree tree = new ObjectTree(go.name); for (int i = 0; i < go.transform.childCount; i++) { //tree.Add(go.name, go.transform.GetChild(i).name); RecursiveSearchTree(ref tree, "", go.transform.GetChild(i).gameObject); } Debug.Log(tree.ToString()); }
public void ToListReturnsChildrenAsEntryInList() { var obj = new object(); IList <IObjectTree <object> > list = new List <IObjectTree <object> >(); list.Add(new ObjectTree <object> { Item = obj }); var tree = new ObjectTree <object> { Children = list }; Assert.That(tree.ToList(), Contains.Item(obj)); }
public void ChildrenProperty() { var tree = new ObjectTree <object>(); var obj = new object(); IList <IObjectTree <object> > children = new List <IObjectTree <object> >(); children.Add(new ObjectTree <object> { Item = obj }); tree.Children = children; Assert.That(tree.Children, Is.Not.Null); Assert.That(tree.Children[0].Item, Is.EqualTo(obj)); }
/// <summary> /// Gets the local directory tree. /// </summary> /// <returns>The local directory tree.</returns> /// <param name="parent">Parent directory.</param> /// <param name="filter">Filter for files.</param> public static IObjectTree <IFileSystemInfo> GetLocalDirectoryTree(IDirectoryInfo parent, IFilterAggregator filter) { var children = new List <IObjectTree <IFileSystemInfo> >(); try { foreach (var child in parent.GetDirectories()) { string reason; if (!filter.InvalidFolderNamesFilter.CheckFolderName(child.Name, out reason) && !filter.FolderNamesFilter.CheckFolderName(child.Name, out reason) && !filter.SymlinkFilter.IsSymlink(child, out reason)) { children.Add(GetLocalDirectoryTree(child, filter)); } else { Logger.Info(reason); } } foreach (var file in parent.GetFiles()) { string reason; if (!filter.FileNamesFilter.CheckFile(file.Name, out reason) && !filter.SymlinkFilter.IsSymlink(file, out reason)) { children.Add(new ObjectTree <IFileSystemInfo> { Item = file, Children = new List <IObjectTree <IFileSystemInfo> >() }); } else { Logger.Info(reason); } } } catch (System.IO.PathTooLongException) { Logger.Fatal(string.Format("One or more children paths of \"{0}\" are to long to be synchronized, synchronization is impossible since the problem is fixed", parent.FullName)); throw; } IObjectTree <IFileSystemInfo> tree = new ObjectTree <IFileSystemInfo> { Item = parent, Children = children }; return(tree); }
/// <summary> /// Gets the remote directory tree. /// </summary> /// <returns>The remote directory tree.</returns> /// <param name="parent">Parent folder.</param> /// <param name="descendants">Descendants of remote object.</param> /// <param name="filter">Filter of ignored or invalid files and folder</param> public static IObjectTree <IFileableCmisObject> GetRemoteDirectoryTree(IFolder parent, IList <ITree <IFileableCmisObject> > descendants, IFilterAggregator filter) { IList <IObjectTree <IFileableCmisObject> > children = new List <IObjectTree <IFileableCmisObject> >(); if (descendants != null) { foreach (var child in descendants) { if (child.Item is IFolder) { string reason; if (!filter.FolderNamesFilter.CheckFolderName(child.Item.Name, out reason) && !filter.InvalidFolderNamesFilter.CheckFolderName(child.Item.Name, out reason)) { children.Add(GetRemoteDirectoryTree(child.Item as IFolder, child.Children, filter)); } else { Logger.Info(reason); } } else if (child.Item is IDocument) { string reason; if (!filter.FileNamesFilter.CheckFile(child.Item.Name, out reason)) { children.Add(new ObjectTree <IFileableCmisObject> { Item = child.Item, Children = new List <IObjectTree <IFileableCmisObject> >() }); } else { Logger.Info(reason); } } } } var tree = new ObjectTree <IFileableCmisObject> { Item = parent, Children = children }; return(tree); }
public static void GenerateSourceFiles(this ObjectTree tree, string outputFolder) { if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } File.WriteAllText(Path.Combine(outputFolder, "Objects.csproj"), Properties.Resources.Objects); foreach (var module in tree.LoadedModules) { if (module.Objects.Count == 0) { continue; } module.Generate(outputFolder); } }
private IObjectTree <string> CreateStringTree() { var tree = new ObjectTree <string>() { Item = "root" }; var children = new List <IObjectTree <string> >(); children.Add(new ObjectTree <string>() { Item = "A" }); children.Add(new ObjectTree <string>() { Item = "B" }); tree.Children = children; return(tree); }
private IObjectTree <IFileSystemInfo> CreateFileTree() { var tree = new ObjectTree <IFileSystemInfo>() { Item = Mock.Of <IFileSystemInfo>(m => m.Name == "root" && m.FullName == Path.Combine(Path.GetTempPath(), "root")) }; var children = new List <IObjectTree <IFileSystemInfo> >(); children.Add(new ObjectTree <IFileSystemInfo>() { Item = Mock.Of <IFileSystemInfo>(m => m.Name == "A" && m.FullName == Path.Combine(Path.GetTempPath(), "root", "A")) }); children.Add(new ObjectTree <IFileSystemInfo>() { Item = Mock.Of <IFileSystemInfo>(m => m.Name == "B" && m.FullName == Path.Combine(Path.GetTempPath(), "root", "B")) }); tree.Children = children; return(tree); }
public void TraverseReferences() { var parent = Category.CreateHierarchy(); var actionReferences = new List <string>(); var references = ObjectTree.Traverse( parent, x => { Normalizer.TrimProperties(x); actionReferences.Add(((Category)x).Name); }); var names = new[] { "Root", "Root 1", "Root 1.1", "Root 2" }; actionReferences.Should().BeSameAs(names); references.Cast <Category>().Select(x => x.Name).Should().BeSameAs(names); }
void RecursiveSearchTree(ref ObjectTree tree, string parent, GameObject go) { string retVal = go.name; if (go.transform.childCount == 0) { tree.Add(parent, go.name); return; } else { var node = tree.Add(parent, go.name); for (int i = 0; i < go.transform.childCount; i++) { RecursiveSearchTree(ref tree, node.name, go.transform.GetChild(i).gameObject); } } return; }
private void LoggedIn(bool supervisorMode = false) { string sessionKey = this.TPrm[0].StringValue; this.TPrm = this.TPrm[1]; // 本来のパラメータに置き換え SessionBundle sessionBundle = new SessionBundle(); Session session = sessionBundle.Sessions.First(v => v.SessionKey == sessionKey); if (supervisorMode && session.SupervisorMode == false) { throw new Exception("管理者権限が必要です。"); } session.Accessed(); this.Session = session; this.LiteGroup = new GroupBundle().LiteGroups.FirstOrDefault(v => v.AccessKey == session.AccessKey); }
private IObjectTree <IFileableCmisObject> CreateRemoteTree() { var tree = new ObjectTree <IFileableCmisObject>() { Item = Mock.Of <IFileableCmisObject>(m => m.Name == "root" && m.Id == Guid.NewGuid().ToString()) }; var children = new List <IObjectTree <IFileableCmisObject> >(); children.Add(new ObjectTree <IFileableCmisObject>() { Item = Mock.Of <IFileableCmisObject>(m => m.Name == "A" && m.Id == Guid.NewGuid().ToString()) }); children.Add(new ObjectTree <IFileableCmisObject>() { Item = Mock.Of <IFileableCmisObject>(m => m.Name == "B" && m.Id == Guid.NewGuid().ToString()) }); tree.Children = children; return(tree); }
/// <summary> /// Gets the remote directory tree. /// </summary> /// <returns>The remote directory tree.</returns> /// <param name="parent">Parent folder.</param> /// <param name="descendants">Descendants of remote object.</param> /// <param name="filter">Filter of ignored or invalid files and folder</param> public static IObjectTree<IFileableCmisObject> GetRemoteDirectoryTree(IFolder parent, IList<ITree<IFileableCmisObject>> descendants, IFilterAggregator filter, IIgnoredEntitiesStorage ignoredStorage, IPathMatcher matcher) { IList<IObjectTree<IFileableCmisObject>> children = new List<IObjectTree<IFileableCmisObject>>(); if (descendants != null) { foreach (var child in descendants) { if (child.Item is IFolder) { string reason; var folder = child.Item as IFolder; if (!filter.FolderNamesFilter.CheckFolderName(folder.Name, out reason) && !filter.InvalidFolderNamesFilter.CheckFolderName(folder.Name, out reason)) { if (folder.AreAllChildrenIgnored()) { ignoredStorage.AddOrUpdateEntryAndDeleteAllChildrenFromStorage(new IgnoredEntity(folder, matcher)); Logger.Info(string.Format("Folder {0} with Id {1} is ignored", folder.Name, folder.Id)); children.Add(new ObjectTree<IFileableCmisObject> { Item = child.Item, Children = new List<IObjectTree<IFileableCmisObject>>() }); } else { ignoredStorage.Remove(folder.Id); children.Add(GetRemoteDirectoryTree(folder, child.Children, filter, ignoredStorage, matcher)); } } else { Logger.Info(reason); } } else if (child.Item is IDocument) { string reason; if (!filter.FileNamesFilter.CheckFile(child.Item.Name, out reason)) { children.Add(new ObjectTree<IFileableCmisObject> { Item = child.Item, Children = new List<IObjectTree<IFileableCmisObject>>() }); } else { Logger.Info(reason); } } } } var tree = new ObjectTree<IFileableCmisObject> { Item = parent, Children = children }; return tree; }
private IObjectTree<IMappedObject> CreateStoredTree() { var tree = new ObjectTree<IMappedObject>() { Item = Mock.Of<IMappedObject>(m => m.Name == "root" && m.RemoteObjectId == Guid.NewGuid().ToString()) }; var children = new List<IObjectTree<IMappedObject>>(); children.Add(new ObjectTree<IMappedObject>() { Item = Mock.Of<IMappedObject>(m => m.Name == "A" && m.RemoteObjectId == Guid.NewGuid().ToString()) }); children.Add(new ObjectTree<IMappedObject>() { Item = Mock.Of<IMappedObject>(m => m.Name == "B" && m.RemoteObjectId == Guid.NewGuid().ToString()) }); tree.Children = children; return tree; }
private IObjectTree<IFileableCmisObject> CreateRemoteTree() { var tree = new ObjectTree<IFileableCmisObject>() { Item = Mock.Of<IFileableCmisObject>(m => m.Name == "root" && m.Id == Guid.NewGuid().ToString()) }; var children = new List<IObjectTree<IFileableCmisObject>>(); children.Add(new ObjectTree<IFileableCmisObject>() { Item = Mock.Of<IFileableCmisObject>(m => m.Name == "A" && m.Id == Guid.NewGuid().ToString()) }); children.Add(new ObjectTree<IFileableCmisObject>() { Item = Mock.Of<IFileableCmisObject>(m => m.Name == "B" && m.Id == Guid.NewGuid().ToString()) }); tree.Children = children; return tree; }
private IObjectTree<string> CreateStringTree() { var tree = new ObjectTree<string>() { Item = "root" }; var children = new List<IObjectTree<string>>(); children.Add(new ObjectTree<string>() { Item = "A" }); children.Add(new ObjectTree<string>() { Item = "B" }); tree.Children = children; return tree; }
private IObjectTree<IMappedObject> GetSubTree(List<MappedObject> nodes, MappedObject parent) { var children = nodes.FindAll(o => o.ParentId == parent.RemoteObjectId); nodes.RemoveAll(o => o.ParentId == parent.RemoteObjectId); IList<IObjectTree<IMappedObject>> childNodes = new List<IObjectTree<IMappedObject>>(); foreach (var child in children) { childNodes.Add(this.GetSubTree(nodes, child)); } IObjectTree<IMappedObject> tree = new ObjectTree<IMappedObject> { Item = parent, Children = childNodes }; return tree; }
private IObjectTree<IFileSystemInfo> CreateFileTree() { var tree = new ObjectTree<IFileSystemInfo>() { Item = Mock.Of<IFileSystemInfo>(m => m.Name == "root" && m.FullName == Path.Combine(Path.GetTempPath(), "root")) }; var children = new List<IObjectTree<IFileSystemInfo>>(); children.Add(new ObjectTree<IFileSystemInfo>() { Item = Mock.Of<IFileSystemInfo>(m => m.Name == "A" && m.FullName == Path.Combine(Path.GetTempPath(), "root", "A")) }); children.Add(new ObjectTree<IFileSystemInfo>() { Item = Mock.Of<IFileSystemInfo>(m => m.Name == "B" && m.FullName == Path.Combine(Path.GetTempPath(), "root", "B")) }); tree.Children = children; return tree; }
public void ToListOfEmptyTreeReturnsEmptyList() { var tree = new ObjectTree<object>(); Assert.That(tree.ToList(), Is.Empty); }
private ObjectTree<IFileSystemInfo> CreateTreeFromPathAndGuid(string name, string path, Guid guid) { var localTree = new ObjectTree<IFileSystemInfo>(); var fsInfo = new Mock<IDirectoryInfo>(); fsInfo.SetupGuid(guid); fsInfo.Setup(f => f.FullName).Returns(path); fsInfo.Setup(f => f.Name).Returns(name); fsInfo.Setup(f => f.LastWriteTimeUtc).Returns(zeroDate); localTree.Item = fsInfo.Object; localTree.Children = new List<IObjectTree<IFileSystemInfo>>(); return localTree; }
public SimpleObjectRegistry() { Tree = new ObjectTree(); }
public void ConstructorSetsPropertiesToDefaultValuesAndNull() { var tree = new ObjectTree<object>(); Assert.That(tree.Children, Is.Null); Assert.That(tree.Item, Is.Null); }
/// <summary> /// Gets the local directory tree. /// </summary> /// <returns>The local directory tree.</returns> /// <param name="parent">Parent directory.</param> /// <param name="filter">Filter for files.</param> public static IObjectTree<IFileSystemInfo> GetLocalDirectoryTree(IDirectoryInfo parent, IFilterAggregator filter) { var children = new List<IObjectTree<IFileSystemInfo>>(); try { foreach (var child in parent.GetDirectories()) { string reason; if (!filter.InvalidFolderNamesFilter.CheckFolderName(child.Name, out reason) && !filter.FolderNamesFilter.CheckFolderName(child.Name, out reason) && !filter.SymlinkFilter.IsSymlink(child, out reason)) { children.Add(GetLocalDirectoryTree(child, filter)); } else { Logger.Info(reason); } } foreach (var file in parent.GetFiles()) { string reason; if (!filter.FileNamesFilter.CheckFile(file.Name, out reason) && !filter.SymlinkFilter.IsSymlink(file, out reason)) { children.Add(new ObjectTree<IFileSystemInfo> { Item = file, Children = new List<IObjectTree<IFileSystemInfo>>() }); } else { Logger.Info(reason); } } } catch (System.IO.PathTooLongException) { Logger.Fatal(string.Format("One or more children paths of \"{0}\" are to long to be synchronized, synchronization is impossible since the problem is fixed", parent.FullName)); throw; } IObjectTree<IFileSystemInfo> tree = new ObjectTree<IFileSystemInfo> { Item = parent, Children = children }; return tree; }
public void ToListReturnsChildrenAsEntryInList() { var obj = new object(); IList<IObjectTree<object>> list = new List<IObjectTree<object>>(); list.Add(new ObjectTree<object> { Item = obj }); var tree = new ObjectTree<object> { Children = list }; Assert.That(tree.ToList(), Contains.Item(obj)); }
//-------------------------------------------------------------------------------------------------- // メインウィンドウ中央描画領域. private void drawMainMiddleElem() { EditorGUILayout.BeginVertical( GUI.skin.box, GUILayout.Width( MAIN_MIDDLE_ELEM_WIDTH ) ); EditorGUILayout.LabelField( "検索結果表示欄." ); if ( this.objList != null ){ // ここで検索結果のオブジェクトをリスト表示する. this.middleScrPos = EditorGUILayout.BeginScrollView( this.middleScrPos ); { for ( int i = 0; i < this.objList.Count; ++i ){ if ( GUILayout.Button( this.objList[ i ].name ) ){ this.objTree = null; this.objTree = new ObjectTree( ( GameObject )this.objList[ i ] ); Object[] obj = { ( Object )this.objList[ i ] }; Selection.objects = obj; } } } EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); }