// Token: 0x0600009C RID: 156 RVA: 0x00004654 File Offset: 0x00002854 protected override TreeNode ProcessScopeSubQueryTree(TreeNode scopeSubQueryTree) { if (this.isDLPAuthorized) { return(scopeSubQueryTree); } ScopeNode scopeNode = scopeSubQueryTree as ScopeNode; if (scopeNode == null || scopeNode.Scope == null) { ULS.SendTraceTag(5578898U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree ::tenantId={0}; Argument is null or is not a ScopeNode.", new object[] { this.tenantId }); return(scopeSubQueryTree); } string scope = scopeNode.Scope; if (this.classificationScopes.Contains(scope)) { ULS.SendTraceTag(5256290U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree :: tenantId={0}; property={1}; Attempt by unauthorized user to access data-loss-prevention properties.", new object[] { this.tenantId, scope }); throw new SecurityAccessDeniedException("You do not have access to the property identified in this scope: " + scopeSubQueryTree); } ULS.SendTraceTag(5578899U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree :: tenantId={0}; scopeSubQueryTree={1}; Erroneously entered ProcessScopeSubQueryTree with an argument that is not a classification property. This should not have happened because the scopes of the associated operator should only contain classification properties.", new object[] { this.tenantId, scopeSubQueryTree.ToString() }); return(scopeSubQueryTree); }
/// <summary> /// Loads the server child scope nodes. /// </summary> /// <param name="serverConfigurator">The server configurator.</param> /// <param name="serverScopeNode">The server scope node.</param> private void LoadServerChildScopeNodes(ScopeNode serverScopeNode) { // Companies CompaniesScopeNode companiesScopeNode = new CompaniesScopeNode(this.Configurator); serverScopeNode.Children.Add(companiesScopeNode); // License LicenseScopeNode licenseScopeNode = new LicenseScopeNode(this.Configurator); serverScopeNode.Children.Add(licenseScopeNode); // Updates UpgradesScopeNode upgradesScopeNode = new UpgradesScopeNode(this.Configurator); serverScopeNode.Children.Add(upgradesScopeNode); foreach (int version in GetUpgradeElements(this.Configurator)) { UpgradeScopeNode upgradeScopeNode = new UpgradeScopeNode(this.Configurator, version); upgradesScopeNode.Children.Add(upgradeScopeNode); } // Properties ServerPropertiesScopeNode serverPropertiesScopeNode = new ServerPropertiesScopeNode(this.Configurator); serverScopeNode.Children.Add(serverPropertiesScopeNode); }
private void CreateModuleTree(LibraryNode root, LibraryNode current, ScopeNode scope, string namePrefix, ModuleId moduleId) { if ((null == root) || (null == scope) || (null == scope.NestedScopes)) { return; } foreach (ScopeNode subItem in scope.NestedScopes) { PythonLibraryNode newNode = new PythonLibraryNode(subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID); string newNamePrefix = namePrefix; // The classes are always added to the root node, the functions to the // current node. if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None) { current.AddNode(newNode); } else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None) { // Classes are always added to the root. root.AddNode(newNode); newNamePrefix = newNode.Name + "."; } // Now use recursion to get the other types. CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId); } }
public HelperResult Traverse(ScopeNode node) { return(new HelperResult((writer) => { var messageIndex = 0; var childIndex = 0; while (messageIndex < node.Messages.Count && childIndex < node.Children.Count) { if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime) { LogRow(node.Messages[messageIndex]); messageIndex++; } else { Traverse(node.Children[childIndex]); childIndex++; } } if (messageIndex < node.Messages.Count) { for (var i = messageIndex; i < node.Messages.Count; i++) { LogRow(node.Messages[i]); } } else { for (var i = childIndex; i < node.Children.Count; i++) { Traverse(node.Children[i]); } } })); }
/// <summary> /// Expands scope node in the scope tree /// </summary> private void ExpandScopeNode(ScopeNode node) { if (node != null) { if (!node.Populated) { node.Nodes.Clear(); StartProgress("Loading..."); string text = node.Text; node.Text += " expanding..."; scopeTree.Update(); scopeTree.BeginUpdate(); switch (node.NodeType) { /*case NodeType.Servers: * LoadServers(node); * break; * case NodeType.Server: * LoadServerComponents(node); * break;*/ case NodeType.Components: LoadInstalledComponents(node); break; } node.Text = text; node.Populated = true; node.Expand(); scopeTree.EndUpdate(); FinishProgress(); } } }
public static void RunTaskSequenceExport(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedResultObjects, PropertyDataUpdated dataUpdatedDelegate, Status status) { using (XmlReader readerFromString = SecureXml.CreateXmlReaderFromString(selectedResultObjects["Sequence"].StringValue)) { XElement taskSequencePackage = new XElement("TaskSequencePackage", new XElement("PackageID", selectedResultObjects["PackageID"].StringValue), new XElement("BootImageID", selectedResultObjects["BootImageID"].StringValue), new XElement("Category", selectedResultObjects["Category"].StringValue), new XElement("DependentProgram", selectedResultObjects["DependentProgram"].StringValue), new XElement("Description", selectedResultObjects["Description"].StringValue), new XElement("Duration", selectedResultObjects["Duration"].IntegerValue), new XElement("Name", selectedResultObjects["Name"].StringValue), new XElement("SourceDate", selectedResultObjects["SourceDate"].DateTimeValue), new XElement("SequenceData", XElement.Load(readerFromString) ) ); SaveFileDialog saveFileDialog1 = new SaveFileDialog { Filter = "XML files(.xml)|*.xml", Title = "Export Task Sequnce to XML", FileName = selectedResultObjects["PackageID"].StringValue }; saveFileDialog1.ShowDialog(); if (saveFileDialog1.FileName != "") { taskSequencePackage.Save(saveFileDialog1.FileName); } } }
public static ScopeNode BuildSettingsCategoryNode( string displayName, string formViewDescriptionDisplayName, SettingsCategoryInfo settingsCategoryInfo, Nullable <int> imageIndex, Nullable <int> selectedImageIndex, bool hideExpandIcon) { ScopeNode result = new ScopeNode(hideExpandIcon) { DisplayName = displayName }; ValidateMandatoryNodeFields(result); result.ViewDescriptions.Add(new FormViewDescription() //Tells the snap-in how to construct a form and what control to to add it to. { DisplayName = formViewDescriptionDisplayName, ViewType = typeof(SettingsFormViewWindows), //The Type of the form to instantiate. ControlType = typeof(SettingsControlWindows), //The Type of the control to instantiate and place onto the form. Tag = settingsCategoryInfo, //Informs the SettingsControl which CATEGORY of settings to display i.e. i.e. the properties of the Settings class which have an attribute with the same Category name set. }); result.ViewDescriptions.DefaultIndex = 0; SetImageIndices(result, imageIndex, selectedImageIndex); return(result); }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); var vertexControl = (GraphSharp.Controls.VertexControl)DataContext; m_exitScopeNode = (ExperimentEndNode)vertexControl.Vertex; //listen to property changed of the parent scope node, and update exit node x and y, if scope size is changing. ScopeNodeControl scope = this.GetParent <ScopeNodeControl>(null); //find node label border - needed border height to adjust node move inside the canvas Border labelBorder = (Border)scope.Template.FindName("labelBorder", scope); m_labelHeight = labelBorder.ActualHeight; m_scopeNode = (ScopeNode)scope.VertexControl.Vertex; //listen to scope node size change and exit node position changes m_scopeNode.DataWithSize.PropertyChanged += ScopeNodeData_PropertyChanged; m_scopeNode.ExitDecisionNode.Data.PropertyChanged += ExitDecisionNodeData_PropertyChanged; //intially move node to the border MoveNodeAlongScopeBorder(); }
/// <summary> /// The DisplayName of the extension node will be the computer name /// published by the primary. Note: this defaults to an empty string for localhost. /// </summary> void SetDisplayName(ScopeNode scopeNode, SharedDataItem sharedDataItem) { // get buffer containing the machine name string machineName = Encoding.Unicode.GetString(sharedDataItem.GetData()); // find first null terminated string in buffer. if (machineName.IndexOf('\0') <= 0) { // either not found in buffer or first entry in buffer machineName = String.Empty; } else { machineName = machineName.Substring(0, machineName.IndexOf('\0')); } // if empty then localhost if (machineName == string.Empty) { scopeNode.DisplayName = "Sample Extension to (localhost)"; } else { scopeNode.DisplayName = "Sample Extension to (" + machineName + ")"; } }
public override bool ItemExpandable(NSOutlineView outlineView, NSObject item) { if (item != null) { try { ScopeNode passedNode = item as ScopeNode; // cast to appropriate type of node if (passedNode != null) { return(passedNode.NumberOfChildren() != 0); } else { System.Diagnostics.Debug.WriteLine("passedNode cast failed."); return(false); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); return(false); } } else { // if null, it's asking about the root element return(true); } }
private void SolveScopeDependencyAndAdd(Dictionary <ScopeControl, int> parentScopeIdList, ScopeControl[] alreadyAddedScopes) { var nodes = new Dictionary <int, ScopeNode>(); foreach (ScopeControl scope in alreadyAddedScopes) { nodes.Add(scope.CurrentScope.Id, new ScopeNode { ScopeControl = scope }); } foreach (KeyValuePair <ScopeControl, int> kvp in parentScopeIdList) { var scopeNode = new ScopeNode { ScopeControl = kvp.Key }; if (!nodes.ContainsKey(kvp.Key.CurrentScope.Id)) { nodes.Add(kvp.Key.CurrentScope.Id, scopeNode); } } foreach (KeyValuePair <ScopeControl, int> kvp in parentScopeIdList) { ScopeNode scopeNode = nodes[kvp.Key.CurrentScope.Id]; nodes[kvp.Value].AddNext(scopeNode); } foreach (ScopeControl scope in alreadyAddedScopes) { nodes[scope.CurrentScope.Id].AddToCanvas(this); } }
private void AddViewDescription(ScopeNode node, MmcListViewDescription lvd) { node.ViewDescriptions.Add(lvd); node.ViewDescriptions.DefaultIndex = 0; }
private void ParseInstallNode(XmlNode installNode) { XmlNodeList components = installNode.SelectNodes("component"); if (components.Count == 0) { //remove parent install node installNode.ParentNode.RemoveChild(installNode); ProceedUnattendedSetup(); } else { //remove current node and start installation XmlElement componentNode = (XmlElement)components[0]; string componentCode = componentNode.GetAttribute("code"); string componentVersion = componentNode.GetAttribute("version"); string xml = componentNode.InnerXml; installNode.RemoveChild(componentNode); if (!string.IsNullOrEmpty(componentCode)) { ScopeNode componentsNode = scopeTree.Nodes[0] as ScopeNode; scopeTree.SelectedNode = componentsNode; ComponentsControl ctrl = componentsNode.ResultView as ComponentsControl; ctrl.InstallComponent(componentCode, componentVersion, xml); } } }
/// <summary> /// Adds scope node to the scope tree /// </summary> internal ScopeNode AddScopeNode(ScopeNode parent, string text, Icon largeIcon, Icon smallIcon, ResultViewControl resultView, NodeType nodeType, object tag) { string smallIconName = smallIcon.GetHashCode().ToString(); if (!this.smallImages.Images.ContainsKey(smallIconName)) { this.smallImages.Images.Add(smallIconName, smallIcon); } ScopeNode node = new ScopeNode(); node.Text = text; node.ResultView = resultView; node.SmallIcon = smallIcon; node.LargeIcon = largeIcon; node.ImageKey = smallIconName; node.SelectedImageKey = smallIconName; node.NodeType = nodeType; node.Populated = false; node.Tag = tag; if (parent == null) { scopeTree.Nodes.Add(node); } else { parent.Nodes.Add(node); } //add fake node to show + node.Nodes.Add(" "); return(node); }
public SingleObserver(ScopeNode parent, AsyncStatus status, Func <TModel, ScopeNode[]> builder) { _snapIn = parent.SnapIn; _children = parent.Children; _status = status; _builder = builder; _status.ReportProgress(0, 0, "Fetching..."); }
public static void ExecuteMultiSelectAction(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject resultObject, PropertyDataUpdated dataUpdatedDelegate, Status status) { if (resultObject.Count > 0) { subName = resultObject.DisplayString; } GetExecutableActionByName(action.DisplayName); }
public static void Show(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedObject, PropertyDataUpdated dataUpdatedDelegate, Status Status) { using (CollevalStatisticsDialog dialog = new CollevalStatisticsDialog(action, scopeNode)) { dialog.ShowDialog(); return; } }
public CollectionObserver(ScopeNode parent, AsyncStatus status, Func <TModel, ScopeNode> mapper) { _snapIn = parent.SnapIn; _children = parent.Children; _status = status; _mapper = mapper; _status.ReportProgress(0, 0, "Fetching..."); }
/// <summary> /// Initializes a new instance of the <see cref="PapyrusCodeBlock" /> class. /// </summary> /// <param name="begin">The begin.</param> /// <param name="end">The end.</param> public PapyrusCodeBlock(int begin, int end) { Begin = begin; End = end; Next = END; OnFalse = END; Scope = new ScopeNode(); }
public HelperResult Traverse(ScopeNode node, int level, Dictionary <string, int> counts) { return(new HelperResult((writer) => { PushWriter(writer); // print start of scope Write(LogRow(new LogInfo() { Name = node.Name, Time = node.StartTime, Severity = LogLevel.Debug, Message = "Beginning " + node.State, }, level)); var messageIndex = 0; var childIndex = 0; while (messageIndex < node.Messages.Count && childIndex < node.Children.Count) { if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime) { Write(LogRow(node.Messages[messageIndex], level)); counts[node.Messages[messageIndex].Severity.ToString()]++; messageIndex++; } else { Write(Traverse(node.Children[childIndex], level + 1, counts)); childIndex++; } } if (messageIndex < node.Messages.Count) { for (var i = messageIndex; i < node.Messages.Count; i++) { Write(LogRow(node.Messages[i], level)); counts[node.Messages[i].Severity.ToString()]++; } } else { for (var i = childIndex; i < node.Children.Count; i++) { Write(Traverse(node.Children[i], level + 1, counts)); } } // print end of scope Write(LogRow(new LogInfo() { Name = node.Name, Time = node.EndTime, Severity = LogLevel.Debug, Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime) }, level)); PopWriter(); })); }
/// <summary> /// Intialize the extension to add new nodes attached to the Primary, etc. /// </summary> protected override void OnInitialize() { string sampleData1FromPrimary = Encoding.Unicode.GetString(PrimaryNode.SharedData.GetItem(Data1ClipboardFormatId).GetData()); ScopeNode scopeNode = new ScopeNode(); scopeNode.DisplayName = "Extension - Shared: (" + sampleData1FromPrimary + ")"; PrimaryNode.Children.Add(scopeNode); }
/// <summary> /// Performs operation of adding the new scope to the given decision. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param> protected void ExecuteAddScopeToDecision(object sender, ExecutedRoutedEventArgs e) { GraphSharp.Controls.VertexControl vertexControl = e.Parameter as GraphSharp.Controls.VertexControl; if (vertexControl != null) { ExperimentDecisionNode decisionNode = vertexControl.Vertex as ExperimentDecisionNode; if (decisionNode != null) { ExitDecisionNode exitDecisionNode = null; IEditableExperiment experiment = decisionNode.Owner as IEditableExperiment; double rightmostX = decisionNode.Data.X; HashSet <string> currentLabels = new HashSet <string>(); //iterate through outgoing scopes and find the scope with right border located most to the right among all scopes //also locate among outgoing edges reference to exit IEnumerable <ExperimentNodeConnection> outEdges; if (experiment.TryGetOutEdges(decisionNode, out outEdges)) { foreach (ExperimentNodeConnection connection in outEdges) { ScopeNode scope = connection.Target as ScopeNode; if (scope != null) { double candidateRightMostX = scope.DataWithSize.X + scope.DataWithSize.Width / 2; if (candidateRightMostX > rightmostX) { rightmostX = candidateRightMostX; } //also collect labels currentLabels.Add(scope.Data.Metadata.Label); } else if (exitDecisionNode == null) { //try find exit decision node exitDecisionNode = connection.Target as ExitDecisionNode; } } } double xPosition = rightmostX + 100; double yPosition = decisionNode.Data.Y + 120; string finalLabel = DetermineNewScopeLabel(currentLabels); //check if deicion node is not null. In old decision nodes without scopes, there were no associated exit node, //thus the scope cannot be added for these decisions. if (exitDecisionNode != null) { ComponentFactory.AddScopeToDecision(finalLabel, xPosition, yPosition, decisionNode, exitDecisionNode, experiment); } } } }
/// <summary> /// Actions on select node in the scope tree /// </summary> private void OnScopeTreeAfterSelect(object sender, TreeViewEventArgs e) { ScopeNode node = e.Node as ScopeNode; //node.ContextMenuStrip = scopeItemContextMenu; ExpandScopeNode(node); PopulateResultView(node); activeScopeNode = node; }
/// <summary> /// Use shared data /// </summary> protected override void OnInitialize() { // create extension node extensionRootNode = new ScopeNode(); PrimaryNode.Children.Add(extensionRootNode); // get shared data SetDisplayName(extensionRootNode, PrimaryNode.SharedData.GetItem(machineNameClipboardFormatId)); }
public static void AddMulitDeviceCollection(object sender, ScopeNode scopeNode, ActionDescription action, IResultObject selectedObject, PropertyDataUpdated dataUpdatedDelegate, Status Status) { try { using (BrowseCollectionDialog collectionDialog = new BrowseCollectionDialog(selectedObject.ConnectionManager)) { collectionDialog.MultiSelect = true; collectionDialog.CollectionType = CollectionType.Device; collectionDialog.CollectionFilter = (collectionResultObject => { if (collectionResultObject["IsReferenceCollection"].BooleanValue || collectionResultObject["IsBuiltIn"].BooleanValue) { return(false); } if (selectedObject.Count > 1) { foreach (IResultObject resultObject in selectedObject) { if (resultObject.ObjectClass == "SMS_Collection" && resultObject["CollectionID"].StringValue == collectionResultObject["CollectionID"].StringValue) { return(false); } } return(true); } return(!(selectedObject.ObjectClass == "SMS_Collection") || !(selectedObject["CollectionID"].StringValue == collectionResultObject["CollectionID"].StringValue)); }); if (collectionDialog.ShowDialog() != DialogResult.OK) { return; } foreach (IResultObject collection in collectionDialog.SelectedCollections) { List <IResultObject> list = new List <IResultObject>(); foreach (IResultObject item in selectedObject) { IResultObject instance = selectedObject.ConnectionManager.CreateEmbeddedObjectInstance("SMS_CollectionRuleDirect"); instance["ResourceClassName"].StringValue = "SMS_R_System"; instance["RuleName"].StringValue = item["Name"].StringValue; instance["ResourceID"].IntegerValue = item["ResourceID"].IntegerValue; list.Add(instance); } collection.ExecuteMethod("AddMembershipRules", new Dictionary <string, object>() { { "collectionRules", list } }); } } } catch (SmsQueryException ex) { SccmExceptionDialog.ShowDialog(SnapIn.Console, ex); } }
private void AddChildren(TModel[] models) { var nodes = new ScopeNode[models.Length]; for (int modelIndex = 0; modelIndex < models.Length; modelIndex++) { nodes[modelIndex] = _mapper(models[modelIndex]); } _children.AddRange(nodes); }
private static void ValidateMandatoryNodeFields(ScopeNode node) { if (string.IsNullOrEmpty(node.DisplayName)) { throw new NullReferenceException(string.Format( "{0} may not be null or empty on MMC {1}.", EntityReaderGeneric <ScopeNode> .GetPropertyName(p => p.DisplayName, false), typeof(ScopeNode).FullName)); } }
/// <summary> /// Adds predefined nodes /// </summary> private void AddDefaultNodes() { scopeTree.Nodes.Clear(); ScopeNode componentsNode = AddScopeNode(null, "Components", Properties.Resources.Folder32, Properties.Resources.Folder16, new ComponentsControl(), NodeType.Components, null); AddScopeNode(null, "Application Settings", Properties.Resources.Tool32, Properties.Resources.Tool16, new SettingsControl(), NodeType.Settings, null); componentsNode.Expand(); ExpandScopeNode(componentsNode); scopeTree.SelectedNode = componentsNode; }
private List <LogInfo> NodeLogs(ScopeNode node, List <LogInfo> logs) { if (node != null) { logs.AddRange(node.Messages); foreach (var child in node.Children) { NodeLogs(child, logs); } } return(logs); }
public ServerNode GetServerNode(ScopeNode node) { while (node != null) { if (node is ServerNode) { break; } node = node.Parent; } return((ServerNode)node); }