Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / CompMod / System / ComponentModel / Design / Serialization / CodeMethodMap.cs / 1 / CodeMethodMap.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel.Design.Serialization { using System; using System.CodeDom; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Design; using System.Diagnostics; ////// This structure is used by IntegrateStatements to put statements in the right place. /// internal class CodeMethodMap { private CodeStatementCollection _container; private CodeStatementCollection _begin; private CodeStatementCollection _end; private CodeStatementCollection _statements; private CodeStatementCollection _locals; private CodeStatementCollection _fields; private CodeStatementCollection _variables; private CodeStatementCollection _targetStatements; private CodeMemberMethod _method; internal CodeMethodMap(CodeMemberMethod method) : this(null, method){ } internal CodeMethodMap(CodeStatementCollection targetStatements, CodeMemberMethod method) { _method = method; if (targetStatements != null) { _targetStatements = targetStatements; } else { _targetStatements = _method.Statements; } } internal CodeStatementCollection BeginStatements { get { if (_begin == null) _begin = new CodeStatementCollection(); return _begin; } } internal CodeStatementCollection EndStatements { get { if (_end == null) _end = new CodeStatementCollection(); return _end; } } internal CodeStatementCollection ContainerStatements { get { if (_container == null) _container = new CodeStatementCollection(); return _container; } } internal CodeMemberMethod Method { get { return _method; } } internal CodeStatementCollection Statements { get { if (_statements == null) _statements = new CodeStatementCollection(); return _statements; } } internal CodeStatementCollection LocalVariables { get { if (_locals == null) _locals = new CodeStatementCollection(); return _locals; } } internal CodeStatementCollection FieldAssignments { get { if (_fields == null) _fields = new CodeStatementCollection(); return _fields; } } // internal CodeStatementCollection VariableAssignments { get { if (_variables == null) _variables = new CodeStatementCollection(); return _variables; } } internal void Add(CodeStatementCollection statements) { foreach (CodeStatement statement in statements) { string isContainer = statement.UserData["IContainer"] as string; if (isContainer != null && isContainer == "IContainer") { ContainerStatements.Add(statement); } else if (statement is CodeAssignStatement && ((CodeAssignStatement)statement).Left is CodeFieldReferenceExpression) { FieldAssignments.Add(statement); } else if (statement is CodeAssignStatement && ((CodeAssignStatement)statement).Left is CodeVariableReferenceExpression) { VariableAssignments.Add(statement); } else if (statement is CodeVariableDeclarationStatement) { LocalVariables.Add(statement); } else { string order = statement.UserData["statement-ordering"] as string; if (order != null) { switch (order) { case "begin": BeginStatements.Add(statement); break; case "end": EndStatements.Add(statement); break; case "default": default: Statements.Add(statement); break; } } else { Statements.Add(statement); } } } } internal void Combine() { if (_container != null) _targetStatements.AddRange(_container); if (_locals != null) _targetStatements.AddRange(_locals); if (_fields != null) _targetStatements.AddRange(_fields); if (_variables != null) _targetStatements.AddRange(_variables); if (_begin != null) _targetStatements.AddRange(_begin); if (_statements != null) _targetStatements.AddRange(_statements); if (_end != null) _targetStatements.AddRange(_end); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ColorAnimation.cs
- TextRangeProviderWrapper.cs
- ValidationContext.cs
- SamlSecurityTokenAuthenticator.cs
- MetadataPropertyvalue.cs
- QueueProcessor.cs
- DeadCharTextComposition.cs
- ClientSession.cs
- Odbc32.cs
- Rules.cs
- FontNameConverter.cs
- _DisconnectOverlappedAsyncResult.cs
- HtmlObjectListAdapter.cs
- SqlClientWrapperSmiStream.cs
- ViewStateModeByIdAttribute.cs
- DocumentEventArgs.cs
- WindowsTooltip.cs
- elementinformation.cs
- StructuredTypeInfo.cs
- BinaryWriter.cs
- CodeIdentifier.cs
- ForeignKeyConstraint.cs
- Volatile.cs
- IPipelineRuntime.cs
- SafeNativeMethods.cs
- WebServiceHandler.cs
- XmlSchemaAttribute.cs
- TemplatePagerField.cs
- CodeLinePragma.cs
- DateTimeFormatInfo.cs
- SqlBuffer.cs
- Publisher.cs
- Missing.cs
- SqlBulkCopyColumnMappingCollection.cs
- ObjectDataSourceDesigner.cs
- MachineKeySection.cs
- XamlParser.cs
- DateTimeFormatInfoScanner.cs
- HtmlElement.cs
- XpsResourceDictionary.cs
- MetafileHeaderWmf.cs
- PointUtil.cs
- StringUtil.cs
- SpecialNameAttribute.cs
- ElementHost.cs
- FontDriver.cs
- OfTypeExpression.cs
- CompilerCollection.cs
- ProcessModelInfo.cs
- IdnMapping.cs
- CodeCatchClause.cs
- SoapMessage.cs
- ForceCopyBuildProvider.cs
- FigureParaClient.cs
- Properties.cs
- AddInBase.cs
- DataGridViewRowEventArgs.cs
- PermissionAttributes.cs
- ToolStripCollectionEditor.cs
- StreamWriter.cs
- SQLMoney.cs
- UpdatePanelTrigger.cs
- UserPreferenceChangingEventArgs.cs
- DiscoveryInnerClientAdhocCD1.cs
- BitHelper.cs
- Geometry3D.cs
- GuidelineCollection.cs
- NotifyParentPropertyAttribute.cs
- Size3DConverter.cs
- X509SubjectKeyIdentifierClause.cs
- FontDialog.cs
- MenuItemStyleCollection.cs
- Brush.cs
- TrustManager.cs
- VariantWrapper.cs
- DataControlFieldCell.cs
- HelpInfo.cs
- TableCellAutomationPeer.cs
- UICuesEvent.cs
- FileVersionInfo.cs
- CounterSample.cs
- HiddenFieldPageStatePersister.cs
- DependencyPropertyValueSerializer.cs
- PropertyCollection.cs
- RoleManagerSection.cs
- RotateTransform.cs
- SystemIPInterfaceProperties.cs
- SR.Designer.cs
- BamlReader.cs
- DocumentPaginator.cs
- StoreAnnotationsMap.cs
- BatchWriter.cs
- SvcMapFileLoader.cs
- DesignerDataTable.cs
- RegexCapture.cs
- Registry.cs
- QilStrConcat.cs
- EntityDataSourceContainerNameConverter.cs
- BinaryNode.cs
- HttpConfigurationContext.cs