public ScopeNodeInsert ReadScopeNodeInsert() { if (this._currentIndex >= this.Count) { throw new EndOfStreamException(); } ScopeNodeInsert insert = new ScopeNodeInsert(); insert.ParentScopeNodeId = this._source.Get_ParentScopeNodeId()[this._currentIndex]; insert.InsertionIndex = this._source.Get_InsertionIndex()[this._currentIndex]; insert.NodeData = this.ReadNextNodeData(); this.ReadNextInitialSharedData(insert.InitialSharedData); insert.Actions = this.ReadNextActions(); insert.HelpActions = this.ReadNextHelpActions(); this._currentIndex++; return insert; }
private void AddTreeToInsertionList(InsertScopeNodesCommandWriter writer, ScopeNode[] nodeList, ref int currentNodesIndex, int index, ScopeNode[] nodes) { foreach (ScopeNode node in nodes) { if (this._nodes.ContainsKey(node.Id)) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerAddTreeToInsertionListNodeExistInOneLocation)); } if (node == null) { throw new Exception(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.NodeSyncManagerInvalidNodeType)); } ScopeNodeInsert insert = new ScopeNodeInsert(); insert.NodeData = (ScopeNodeData) node.Data; ActionsPaneRootData data = new ActionsPaneRootData(); data.Write(node.ActionsPaneItems.Data); insert.Actions = data; data = new ActionsPaneRootData(); data.Write(node.ActionsPaneHelpItems.Data); insert.HelpActions = data; insert.InitialSharedData.SetAddedFormats(this.GenerateSharedDataFormatConfiguration(node)); insert.InitialSharedData.SetUpdatedData(this.GenerateClipboardData(node)); if (node.Parent != null) { insert.ParentScopeNodeId = node.Parent.Id; } insert.InsertionIndex = index; writer.WriteScopeNodeInsert(insert); nodeList[currentNodesIndex++] = node; index++; if (node.Children.Count > 0) { this.AddTreeToInsertionList(writer, nodeList, ref currentNodesIndex, 0, node.Children.ToArray()); } } }
public void WriteScopeNodeInsert(ScopeNodeInsert obj) { if (this._currentIndex >= this._target.Count) { throw new EndOfStreamException(); } this._ParentScopeNodeId[this._currentIndex] = obj.ParentScopeNodeId; this._InsertionIndex[this._currentIndex] = obj.InsertionIndex; this.WriteNextNodeData(obj.NodeData); this.WriteNextInitialSharedData(obj.InitialSharedData); this.WriteNextActions(obj.Actions); this.WriteNextHelpActions(obj.HelpActions); this._currentIndex++; }