private static bool indexY(string str) { return(ty.ToString().ToUpper().IndexOf(str) == -1 ? true : false); }
private StateOfEditor DrawNode(Rect rect, TreeNode node, StateOfEditor expanded, bool haveChild, bool isRuning, RunStatus?state) { Color color = isRuning ? Color.yellow : Color.black; Color bg = Color.white; var att = GetNodeAtt(node.GetType()); if (lastClick == node) { color = Color.green; } var name = node.GetType().Name; if (att != null) { name = att.ShorName + ":" + node.name + (state == null?"":state.Value.ToString()); bg = GetColorByShortName(att.ShorName); } if (haveChild) { expanded.Expanded = EditorGLTools.DrawExpandBox(rect, name, expanded.OnEdited?string.Empty:node.ToString(), expanded.Expanded, color, bg, isRuning ? 2 : 1); } else { EditorGLTools.DrawTitleRect(rect, name, expanded.OnEdited?string.Empty:node.ToString(), color, bg, isRuning ? 2 : 1); } if (lastClick == node) { if (GUI.Button(new Rect(rect.xMax - 50, rect.y, 50, 20), expanded.OnEdited?"Close":"Edit")) { expanded.OnEdited = !expanded.OnEdited; } } else { expanded.OnEdited = false; } if (expanded.OnEdited) { GUILayout.BeginArea(new Rect(rect.x, rect.y + 25, rect.width - 2, rect.height - 25)); expanded.scroll = GUILayout.BeginScrollView(expanded.scroll); GUILayout.BeginVertical(GUILayout.Width(rect.width - 25)); PropertyDrawer.DrawObject(node, "AINODE"); GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); } if (currentDrag == node) { return(new StateOfEditor()); } if (Event.current.type == EventType.ContextClick) { if (rect.Contains(Event.current.mousePosition)) { GenericMenu m = new GenericMenu(); m.AddItem(new GUIContent("Delete"), false, DeleteNode, node); //m.AddSeparator (""); ProcessMenu(m, node); m.ShowAsContext(); Event.current.Use(); } } if (lastClick != node) { if (Event.current.type == EventType.MouseDown) { if (rect.Contains(Event.current.mousePosition)) { SetLastClick(node); Event.current.Use(); } } } if (Event.current.type == EventType.MouseDrag) { if (rect.Contains(Event.current.mousePosition)) { if (currentDrag != null) { if (currentDrag != node) { HoverType t = HoverType.Middle; if (node != root) { t = GetHoverType(rect, Event.current.mousePosition.y); } DragHover(rect, t); Event.current.Use(); } else { currentShowDrag = null; Event.current.Use(); } } else { BeginDrag(node); Event.current.Use(); } } } if (Event.current.type == EventType.MouseUp) { if (currentDrag != null && currentDrag != node) { if (rect.Contains(Event.current.mousePosition)) { var t = GetHoverType(rect, Event.current.mousePosition.y); EndDrag(node, t); Event.current.Use(); } } } return(expanded); }
// Token: 0x060000BF RID: 191 RVA: 0x00004FEC File Offset: 0x000031EC protected override TreeNode ProcessScopeSubQueryTree(TreeNode scopeSubQueryTree) { if (scopeSubQueryTree == null) { throw new ArgumentNullException("scopeSubQueryTree"); } ScopeNode scopeNode = scopeSubQueryTree as ScopeNode; if (scopeNode == null || scopeNode.Scope == null) { ULS.SendTraceTag(5884049U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: argument={0}; Erroneously entered ProcessScopeSubQueryTree with an argument that is not a ScopeNode. This should not have happened because the scopes of the associated operator should prevent it.", new object[] { scopeSubQueryTree.ToString() }); return(base.ProcessScopeSubQueryTree(scopeSubQueryTree)); } if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100)) { ULS.SendTraceTag(5884050U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: scope={0}; Processing a tree (or subtree) for data loss prevention translation from a virtual property to the actual index property.", new object[] { scopeNode.Scope }); } string scope = scopeNode.Scope; if (string.Equals("SensitiveType", scope, StringComparison.OrdinalIgnoreCase)) { BoundaryNode boundaryNode = scopeNode.Node as BoundaryNode; StringNode stringNode; TokenNode tokenNode; if (boundaryNode != null) { if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100)) { ULS.SendTraceTag(6038296U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Boundary operator mode:{0}; Processing a boundary node in the query tree." + boundaryNode.BoundaryMode); } if (boundaryNode.BoundaryMode != 2 && boundaryNode.BoundaryMode != null) { ULS.SendTraceTag(5884051U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Unexpected boundary operator mode. For 'SensitiveType' queries, only equality is legal. Boundary operator mode: " + boundaryNode.BoundaryMode); return(base.ProcessScopeSubQueryTree(scopeSubQueryTree)); } stringNode = (boundaryNode.Node as StringNode); tokenNode = (boundaryNode.Node as TokenNode); } else { stringNode = (scopeNode.Node as StringNode); tokenNode = (scopeNode.Node as TokenNode); } string text; if (stringNode != null) { text = stringNode.Text; } else { if (tokenNode == null) { ULS.SendTraceTag(5884052U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Unexpected node type. The query looks like it is a 'SensitiveType' style query, but the value portion is not a StringNode or a TokenNode. Node type: " + boundaryNode.Node.GetType()); return(base.ProcessScopeSubQueryTree(scopeSubQueryTree)); } text = tokenNode.Token; } if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100)) { ULS.SendTraceTag(5884053U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: encoding={0}; About to parse the encoding.", new object[] { text }); } SensitiveTypeWildcardExpander sensitiveTypeWildcardExpander = new SensitiveTypeWildcardExpander(text, DLPQuerySensitiveTypeTranslationOperator.Store); if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100)) { ULS.SendTraceTag(5884054U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: About to create the new subtree."); } return(sensitiveTypeWildcardExpander.CreateSubtree()); } if (string.Equals("SensitiveMatchConfidence", scope, StringComparison.OrdinalIgnoreCase) || string.Equals("SensitiveMatchCount", scope, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException(scope + " is illegal to use in a query. You may use it as a select property. In queries, use SensitiveType"); } ULS.SendTraceTag(5884055U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: scope={0}; This is not a legal scope for this producer. There must be some error in which the operator has the wrong scopes or a code change is incorrect. Ignoring and continuing.", new object[] { scope }); return(base.ProcessScopeSubQueryTree(scopeSubQueryTree)); }
protected void PopulateFiles(TreeNode nodeCurrent) { string[] lvData = new string[4]; InitListView(); if (nodeCurrent.SelectedImageIndex != 0) { if (Directory.Exists((string)getFullPath(nodeCurrent.FullPath)) == false) { MessageBox.Show("Directory or path " + nodeCurrent.ToString() + " does not exist."); } else { try { string[] stringFiles = Directory.GetFiles(getFullPath(nodeCurrent.FullPath)); string stringFileName = ""; DateTime dtCreateDate, dtModifyDate; Int64 lFileSize = 0; //loop throught all files foreach (string stringFile in stringFiles) { stringFileName = stringFile; FileInfo fileInfo = new FileInfo(stringFileName); lFileSize = fileInfo.Length; dtCreateDate = fileInfo.CreationTime; //GetCreationTime(stringFileName); dtModifyDate = fileInfo.LastWriteTime; //GetLastWriteTime(stringFileName); //create listview data lvData[0] = GetPathName(stringFileName); lvData[1] = formatSize(lFileSize); //check if file is in local current day light saving time if (TimeZone.CurrentTimeZone.IsDaylightSavingTime(dtCreateDate) == false) { //not in day light saving time adjust time lvData[2] = formatDate(dtCreateDate.AddHours(1)); } else { //is in day light saving time adjust time lvData[2] = formatDate(dtCreateDate); } //check if file is in local current day light saving time if (TimeZone.CurrentTimeZone.IsDaylightSavingTime(dtModifyDate) == false) { //not in day light saving time adjust time lvData[3] = formatDate(dtModifyDate.AddHours(1)); } else { //not in day light saving time adjust time lvData[3] = formatDate(dtModifyDate); } //Create actual list item ListViewItem lvItem = new ListViewItem(lvData, 0); lvFiles.Items.Add(lvItem); } } catch (IOException e) { MessageBox.Show("Error: Drive not ready or directory does not exist."); } catch (UnauthorizedAccessException e) { MessageBox.Show("Error: Drive or directory access denided."); } catch (Exception e) { MessageBox.Show("Error: " + e); } } } }
public override string ToString() { return(m_tree.ToString()); }
private static void Main() { int sum = 6; string input = Console.ReadLine(); int n = int.Parse(input); TreeNode <int>[] nodes = new TreeNode <int> [n]; for (int i = 0; i < n; i++) { nodes[i] = new TreeNode <int>(i); } for (int i = 1; i < n; i++) { string edge = Console.ReadLine(); string[] edgeNodes = edge.Split(' '); int parentData = int.Parse(edgeNodes[0]); int childData = int.Parse(edgeNodes[1]); nodes[parentData].Nodes.Add(nodes[childData]); } TreeNode <int> root = GetRoot(nodes); Console.WriteLine("Root: {0}", root != null ? root.ToString() : "[no root]"); List <TreeNode <int> > leaves = GetLeaves(nodes); Console.WriteLine("Leaf nodes:"); foreach (var leaf in leaves) { Console.WriteLine(leaf); } List <TreeNode <int> > innerNodes = GetInnerNodes(nodes); Console.WriteLine("Inner nodes:"); foreach (var node in innerNodes) { Console.WriteLine(node); } var tree = new Tree <int>(root); Console.WriteLine("Nodes data (DFS):"); foreach (var data in tree) { Console.Write(data + " "); } Console.WriteLine(); Console.WriteLine("The tree (DFS):{0}{1}", Environment.NewLine, tree); Console.WriteLine("Height: " + tree.GetHeight()); Console.WriteLine("All downward paths that sum to {0}:", sum); PrintAllPathsThatSumTo(nodes, sum); Console.WriteLine("Nodes whose subtrees sum to {0}:", sum); PrintAllSubtreesThatSumTo(nodes, sum); Tree <double> sinTree = tree.Map <double>(i => Math.Sin(i)); Console.WriteLine("A tree created by applying Math.Sin() to the tree nodes:"); Console.WriteLine(sinTree); }