From c07b53bb0b2268543675785f2bc43bdaa45091c6 Mon Sep 17 00:00:00 2001 From: Joshua Askharoun Date: Fri, 2 Apr 2021 19:10:51 -0500 Subject: [PATCH] Simplified usages in UIX project --- .../Iris/Accessibility/Accessible.cs | 222 +-- .../Iris/Accessibility/AccessibleChildren.cs | 40 +- .../Iris/Accessibility/AccessibleProxy.cs | 244 +-- .../Iris/Accessibility/RootAccessibleProxy.cs | 8 +- UIX/Microsoft/Iris/AggregateList.cs | 62 +- .../Iris/Animations/ActiveSequence.cs | 114 +- .../Iris/Animations/AlphaKeyframe.cs | 6 +- UIX/Microsoft/Iris/Animations/Animation.cs | 80 +- .../Iris/Animations/AnimationArgs.cs | 76 +- .../Iris/Animations/AnimationCompleteArgs.cs | 4 +- .../Iris/Animations/AnimationHandle.cs | 26 +- .../Iris/Animations/AnimationManager.cs | 64 +- .../Iris/Animations/AnimationProxy.cs | 142 +- .../Iris/Animations/AnimationTemplate.cs | 64 +- .../Iris/Animations/BaseFloatKeyframe.cs | 12 +- UIX/Microsoft/Iris/Animations/BaseKeyframe.cs | 44 +- .../Animations/BaseMultiplyFloatKeyframe.cs | 2 +- .../Animations/BaseMultiplyVector3Keyframe.cs | 6 +- .../Iris/Animations/BaseRotationKeyframe.cs | 12 +- .../Iris/Animations/BaseVector2Keyframe.cs | 12 +- .../Iris/Animations/BaseVector3Keyframe.cs | 12 +- .../Iris/Animations/BaseVector4Keyframe.cs | 12 +- .../Iris/Animations/CameraZnKeyframe.cs | 2 +- .../Iris/Animations/EffectColorKeyframe.cs | 4 +- .../Iris/Animations/Interpolation.cs | 28 +- .../Iris/Animations/MergeAnimation.cs | 30 +- .../Animations/OrphanedVisualCollection.cs | 54 +- .../Iris/Animations/PositionKeyframe.cs | 2 +- .../Iris/Animations/PositionXKeyframe.cs | 2 +- .../Iris/Animations/PositionYKeyframe.cs | 2 +- .../Iris/Animations/ReferenceAnimation.cs | 18 +- UIX/Microsoft/Iris/Animations/RelativeTo.cs | 52 +- .../Iris/Animations/RendererProperty.cs | 18 +- .../Iris/Animations/RotateKeyframe.cs | 4 +- .../Iris/Animations/ScaleKeyframe.cs | 8 +- .../Iris/Animations/ScaleXKeyframe.cs | 2 +- .../Iris/Animations/ScaleYKeyframe.cs | 2 +- UIX/Microsoft/Iris/Animations/SizeKeyframe.cs | 2 +- .../Iris/Animations/SizeXKeyframe.cs | 2 +- .../Iris/Animations/SizeYKeyframe.cs | 2 +- .../Iris/Animations/SnapshotRelativeTo.cs | 4 +- .../Iris/Animations/SwitchAnimation.cs | 26 +- .../Iris/Animations/TransformAnimation.cs | 72 +- .../TransformByAttributeAnimation.cs | 74 +- .../Iris/Animations/ValueTransformer.cs | 42 +- .../Iris/AssemblyDataProviderWrapper.cs | 8 +- UIX/Microsoft/Iris/Audio/Sound.cs | 20 +- UIX/Microsoft/Iris/BooleanChoice.cs | 14 +- UIX/Microsoft/Iris/Choice.cs | 164 +- .../CodeModel/Cpp/DllConstructorSchema.cs | 28 +- .../Iris/CodeModel/Cpp/DllEnumProxy.cs | 14 +- .../Iris/CodeModel/Cpp/DllEnumSchema.cs | 36 +- .../Iris/CodeModel/Cpp/DllEventSchema.cs | 12 +- .../Iris/CodeModel/Cpp/DllInterfaceProxy.cs | 6 +- .../CodeModel/Cpp/DllIntrinsicTypeSchema.cs | 6 +- .../Iris/CodeModel/Cpp/DllLoadResult.cs | 84 +- .../CodeModel/Cpp/DllLoadResultFactory.cs | 30 +- .../Iris/CodeModel/Cpp/DllMethodSchema.cs | 56 +- .../Iris/CodeModel/Cpp/DllPropertySchema.cs | 68 +- .../Iris/CodeModel/Cpp/DllProxyHandleTable.cs | 18 +- .../Iris/CodeModel/Cpp/DllProxyList.cs | 126 +- .../Iris/CodeModel/Cpp/DllProxyObject.cs | 64 +- .../Cpp/DllProxyObjectHandleTable.cs | 2 +- .../CodeModel/Cpp/DllProxyObjectReference.cs | 14 +- .../Iris/CodeModel/Cpp/DllProxyServices.cs | 2 +- .../Iris/CodeModel/Cpp/DllTypeSchema.cs | 124 +- .../Iris/CodeModel/Cpp/DllTypeSchemaBase.cs | 72 +- .../Cpp/MarkupDataQueryHandleTable.cs | 2 +- .../Cpp/MarkupDataTypeHandleTable.cs | 2 +- .../Cpp/NativeDataProviderWrapper.cs | 8 +- .../Iris/CodeModel/Cpp/ProxyHandleTable.cs | 4 +- .../Iris/CodeModel/Cpp/ProxyHandleTable`1.cs | 100 +- .../CodeModel/Cpp/StringProxyHandleTable.cs | 10 +- .../CodeModel/Cpp/TypeSchemaHandleTable.cs | 2 +- .../Iris/CodeModel/Cpp/UIXIDVerifier.cs | 10 +- .../Iris/CodeModel/Cpp/UIXVariant.cs | 44 +- UIX/Microsoft/Iris/Command.cs | 50 +- UIX/Microsoft/Iris/Data/Resource.cs | 82 +- UIX/Microsoft/Iris/Data/ResourceManager.cs | 26 +- .../Iris/Data/SingleArrayListCache.cs | 6 +- .../Iris/Data/UIListContentsChangedArgs.cs | 16 +- UIX/Microsoft/Iris/Data/UpdateHelper.cs | 118 +- UIX/Microsoft/Iris/DataProviderMapping.cs | 30 +- UIX/Microsoft/Iris/DataProviderObject.cs | 30 +- .../DataProviderPropertyChangedEventArgs.cs | 4 +- UIX/Microsoft/Iris/DataProviderQuery.cs | 112 +- UIX/Microsoft/Iris/DeferredInvokeProxy.cs | 2 +- UIX/Microsoft/Iris/Drawing/Camera.cs | 172 +- UIX/Microsoft/Iris/Drawing/Color.cs | 26 +- UIX/Microsoft/Iris/Drawing/Font.cs | 32 +- UIX/Microsoft/Iris/Drawing/RawImage.cs | 36 +- UIX/Microsoft/Iris/Drawing/RawImageItem.cs | 16 +- UIX/Microsoft/Iris/Drawing/RawImageItemKey.cs | 6 +- .../Iris/Drawing/ResourceImageItem.cs | 78 +- UIX/Microsoft/Iris/Drawing/RichText.cs | 196 +-- UIX/Microsoft/Iris/Drawing/RichTextInfoKey.cs | 38 +- UIX/Microsoft/Iris/Drawing/Rotation.cs | 18 +- .../Iris/Drawing/ScavengeImageCache.cs | 18 +- UIX/Microsoft/Iris/Drawing/SimpleText.cs | 10 +- UIX/Microsoft/Iris/Drawing/TextFlow.cs | 92 +- UIX/Microsoft/Iris/Drawing/TextImageCache.cs | 18 +- UIX/Microsoft/Iris/Drawing/TextImageItem.cs | 36 +- .../Iris/Drawing/TextMeasureParams.cs | 58 +- UIX/Microsoft/Iris/Drawing/TextRun.cs | 146 +- UIX/Microsoft/Iris/Drawing/TextStyle.cs | 130 +- UIX/Microsoft/Iris/Drawing/UIImage.cs | 96 +- UIX/Microsoft/Iris/Drawing/UriImage.cs | 40 +- UIX/Microsoft/Iris/Error.cs | 8 +- UIX/Microsoft/Iris/Group.cs | 30 +- UIX/Microsoft/Iris/GroupedList.cs | 192 +-- UIX/Microsoft/Iris/Image.cs | 34 +- UIX/Microsoft/Iris/ImageInset.cs | 18 +- UIX/Microsoft/Iris/IndexedTree.cs | 232 +-- UIX/Microsoft/Iris/Input/DragDropInfo.cs | 10 +- UIX/Microsoft/Iris/Input/HIDCommandMapping.cs | 6 +- UIX/Microsoft/Iris/Input/InputDevice.cs | 4 +- UIX/Microsoft/Iris/Input/InputInfo.cs | 64 +- UIX/Microsoft/Iris/Input/InputItem.cs | 36 +- UIX/Microsoft/Iris/Input/InputManager.cs | 282 ++-- UIX/Microsoft/Iris/Input/InputQueue.cs | 456 +++--- UIX/Microsoft/Iris/Input/KeyActionInfo.cs | 38 +- UIX/Microsoft/Iris/Input/KeyCharacterInfo.cs | 8 +- UIX/Microsoft/Iris/Input/KeyCommandInfo.cs | 8 +- UIX/Microsoft/Iris/Input/KeyFocusInfo.cs | 16 +- UIX/Microsoft/Iris/Input/KeyStateInfo.cs | 12 +- UIX/Microsoft/Iris/Input/KeyboardDevice.cs | 98 +- UIX/Microsoft/Iris/Input/MouseActionInfo.cs | 40 +- UIX/Microsoft/Iris/Input/MouseButtonInfo.cs | 14 +- UIX/Microsoft/Iris/Input/MouseDevice.cs | 20 +- UIX/Microsoft/Iris/Input/MouseFocusInfo.cs | 12 +- UIX/Microsoft/Iris/Input/MouseInfo.cs | 16 +- UIX/Microsoft/Iris/Input/MouseWheelInfo.cs | 2 +- .../Iris/InputHandlers/ClickHandler.cs | 274 ++-- .../Iris/InputHandlers/DragHandler.cs | 300 ++-- .../Iris/InputHandlers/DragSourceHandler.cs | 144 +- .../Iris/InputHandlers/DropTargetHandler.cs | 46 +- .../Iris/InputHandlers/EventContext.cs | 10 +- .../Iris/InputHandlers/FocusHandler.cs | 32 +- .../Iris/InputHandlers/KeyHandler.cs | 132 +- .../InputHandlers/ModifierInputHandler.cs | 32 +- .../Iris/InputHandlers/MouseWheelHandler.cs | 22 +- .../Iris/InputHandlers/ScrollingHandler.cs | 184 +-- .../Iris/InputHandlers/ShortcutHandler.cs | 46 +- .../Iris/InputHandlers/TextEditingHandler.cs | 630 ++++---- .../Iris/InputHandlers/TypingHandler.cs | 104 +- UIX/Microsoft/Iris/Layout/AreaOfInterest.cs | 20 +- .../Iris/Layout/AreaOfInterestLayoutInput.cs | 12 +- .../Iris/Layout/ExtendedLayoutOutput.cs | 2 +- UIX/Microsoft/Iris/Layout/ItemAlignment.cs | 16 +- .../Iris/Layout/LayoutNodeEnumerator.cs | 24 +- UIX/Microsoft/Iris/Layout/LayoutSlot.cs | 50 +- UIX/Microsoft/Iris/Layout/SharedSize.cs | 110 +- UIX/Microsoft/Iris/Layouts/AnchorEdge.cs | 64 +- UIX/Microsoft/Iris/Layouts/AnchorLayout.cs | 78 +- .../Iris/Layouts/AnchorLayoutInput.cs | 26 +- UIX/Microsoft/Iris/Layouts/DockLayout.cs | 18 +- UIX/Microsoft/Iris/Layouts/DockLayoutInput.cs | 2 +- UIX/Microsoft/Iris/Layouts/FlowLayout.cs | 226 +-- .../Iris/Layouts/FlowSizeMemoryLayoutInput.cs | 10 +- UIX/Microsoft/Iris/Layouts/GridLayout.cs | 192 +-- .../Iris/Layouts/KeepAliveLayoutInput.cs | 6 +- UIX/Microsoft/Iris/Layouts/MajorMinor.cs | 28 +- UIX/Microsoft/Iris/Layouts/PlacementMode.cs | 20 +- UIX/Microsoft/Iris/Layouts/PopupLayout.cs | 42 +- .../Iris/Layouts/PopupLayoutInput.cs | 54 +- UIX/Microsoft/Iris/Layouts/PopupPosition.cs | 18 +- UIX/Microsoft/Iris/Layouts/RotateLayout.cs | 14 +- UIX/Microsoft/Iris/Layouts/ScaleLayout.cs | 30 +- .../Iris/Layouts/ScrollIntoViewDisposition.cs | 88 +- UIX/Microsoft/Iris/Layouts/ScrollingLayout.cs | 62 +- .../Iris/Layouts/ScrollingLayoutInput.cs | 70 +- .../Iris/Layouts/ScrollingLayoutOutput.cs | 38 +- UIX/Microsoft/Iris/Layouts/StackLayout.cs | 4 +- .../Iris/Layouts/StackLayoutInput.cs | 10 +- .../Iris/Library/AncestorEnumerator.cs | 18 +- UIX/Microsoft/Iris/Library/DataCookie.cs | 4 +- .../Library/DisposableNotifyObjectBase.cs | 6 +- .../Iris/Library/DisposableObject.cs | 10 +- UIX/Microsoft/Iris/Library/DynamicData.cs | 18 +- UIX/Microsoft/Iris/Library/EventCookie.cs | 4 +- UIX/Microsoft/Iris/Library/ExpandableArray.cs | 68 +- .../Iris/Library/NotifyObjectBase.cs | 6 +- UIX/Microsoft/Iris/Library/Result.cs | 8 +- .../Iris/Library/SharedDisposableObject.cs | 10 +- UIX/Microsoft/Iris/Library/SmartMap.cs | 66 +- .../Iris/Library/StackIListEnumerator.cs | 10 +- .../Library/StackIListReverseEnumerator.cs | 10 +- UIX/Microsoft/Iris/Library/TreeNode.cs | 82 +- .../Iris/Library/TreeNodeCollection.cs | 32 +- .../Iris/Library/TreeNodeEnumerator.cs | 18 +- UIX/Microsoft/Iris/ListContentsChangedArgs.cs | 16 +- .../Iris/ListContentsChangedProxy.cs | 2 +- UIX/Microsoft/Iris/ListDataSet.cs | 174 +- UIX/Microsoft/Iris/Markup/AliasMapping.cs | 6 +- .../Iris/Markup/AssemblyConstructorSchema.cs | 14 +- .../Iris/Markup/AssemblyEventSchema.cs | 4 +- .../Iris/Markup/AssemblyLoadResult.cs | 24 +- .../Iris/Markup/AssemblyMarkupDataQuery.cs | 32 +- .../Iris/Markup/AssemblyMarkupDataType.cs | 6 +- .../Iris/Markup/AssemblyMethodSchema.cs | 20 +- .../Iris/Markup/AssemblyObjectProxyHelper.cs | 274 ++-- .../Iris/Markup/AssemblyPropertySchema.cs | 38 +- .../Iris/Markup/AssemblyTypeSchema.cs | 120 +- UIX/Microsoft/Iris/Markup/ByteCodeWriter.cs | 162 +- .../Iris/Markup/ClassMethodSchema.cs | 2 +- .../Iris/Markup/ClassPropertySchema.cs | 10 +- UIX/Microsoft/Iris/Markup/ClassTypeSchema.cs | 30 +- .../Iris/Markup/CompiledMarkupLoadResult.cs | 36 +- .../Iris/Markup/CompiledMarkupLoader.cs | 484 +++--- .../Iris/Markup/ConstructorSchema.cs | 6 +- UIX/Microsoft/Iris/Markup/DelegateListener.cs | 8 +- .../Iris/Markup/DestructiveListener.cs | 6 +- .../Iris/Markup/EffectClassTypeSchema.cs | 54 +- UIX/Microsoft/Iris/Markup/EnumSchema.cs | 60 +- UIX/Microsoft/Iris/Markup/EventSchema.cs | 6 +- ...rkCompatibleAssemblyPrimitiveTypeSchema.cs | 18 +- .../FrameworkCompatibleAssemblyTypeSchema.cs | 10 +- .../Iris/Markup/InterpreterContext.cs | 32 +- UIX/Microsoft/Iris/Markup/Listener.cs | 4 +- .../Iris/Markup/ListenerEncodeMode.cs | 12 +- UIX/Microsoft/Iris/Markup/ListenerNodeBase.cs | 38 +- UIX/Microsoft/Iris/Markup/Listeners.cs | 18 +- UIX/Microsoft/Iris/Markup/LoadResult.cs | 52 +- .../Iris/Markup/MarkupBinaryDataTable.cs | 44 +- UIX/Microsoft/Iris/Markup/MarkupCompiler.cs | 396 ++--- .../Iris/Markup/MarkupConstantsTable.cs | 40 +- .../Iris/Markup/MarkupDataMapping.cs | 18 +- .../Iris/Markup/MarkupDataMappingEntry.cs | 16 +- .../Iris/Markup/MarkupDataProvider.cs | 8 +- UIX/Microsoft/Iris/Markup/MarkupDataQuery.cs | 4 +- ...MarkupDataQueryPreDefinedPropertySchema.cs | 14 +- .../Markup/MarkupDataQueryPropertySchema.cs | 12 +- .../Iris/Markup/MarkupDataQuerySchema.cs | 30 +- .../Iris/Markup/MarkupDataTypeBaseObject.cs | 10 +- .../Markup/MarkupDataTypePropertySchema.cs | 4 +- UIX/Microsoft/Iris/Markup/MarkupEncoder.cs | 586 +++---- UIX/Microsoft/Iris/Markup/MarkupError.cs | 22 +- .../Iris/Markup/MarkupLineNumberTable.cs | 28 +- UIX/Microsoft/Iris/Markup/MarkupListener.cs | 20 +- UIX/Microsoft/Iris/Markup/MarkupListeners.cs | 4 +- UIX/Microsoft/Iris/Markup/MarkupLoadResult.cs | 80 +- .../Iris/Markup/MarkupMethodSchema.cs | 40 +- .../Iris/Markup/MarkupPropertySchema.cs | 16 +- UIX/Microsoft/Iris/Markup/MarkupServices.cs | 18 +- UIX/Microsoft/Iris/Markup/MarkupTypeSchema.cs | 162 +- UIX/Microsoft/Iris/Markup/MethodSchema.cs | 6 +- .../Iris/Markup/MethodSignatureKey.cs | 16 +- .../Iris/Markup/NamedContentRecord.cs | 4 +- .../Iris/Markup/NativeMarkupDataQuery.cs | 44 +- .../Iris/Markup/NativeMarkupDataType.cs | 32 +- UIX/Microsoft/Iris/Markup/NotifyService.cs | 28 +- UIX/Microsoft/Iris/Markup/ParameterContext.cs | 16 +- UIX/Microsoft/Iris/Markup/Parser.cs | 6 +- .../PropertyOverrideCriteriaTypeConstraint.cs | 12 +- UIX/Microsoft/Iris/Markup/PropertySchema.cs | 6 +- .../Iris/Markup/ProviderlessMarkupDataType.cs | 12 +- .../Iris/Markup/SSLexUnicodeBufferConsumer.cs | 18 +- .../Iris/Markup/ScriptRunScheduler.cs | 28 +- .../Iris/Markup/SourceMarkupImportTables.cs | 40 +- .../Iris/Markup/SourceMarkupLoadResult.cs | 36 +- .../Iris/Markup/SourceMarkupLoader.cs | 222 +-- UIX/Microsoft/Iris/Markup/SymbolReference.cs | 8 +- UIX/Microsoft/Iris/Markup/TypeConstraint.cs | 8 +- UIX/Microsoft/Iris/Markup/TypeSchema.cs | 38 +- .../Iris/Markup/UIClassPropertySchema.cs | 4 +- .../Iris/Markup/UIClassTypeSchema.cs | 14 +- .../Iris/Markup/UIX/ViewItemSchema.cs | 12 +- .../Iris/Markup/UIXConstructorSchema.cs | 8 +- UIX/Microsoft/Iris/Markup/UIXEnumSchema.cs | 8 +- UIX/Microsoft/Iris/Markup/UIXEventSchema.cs | 4 +- UIX/Microsoft/Iris/Markup/UIXLoadResult.cs | 8 +- UIX/Microsoft/Iris/Markup/UIXMethodSchema.cs | 20 +- .../Iris/Markup/UIXPropertySchema.cs | 44 +- UIX/Microsoft/Iris/Markup/UIXTypeSchema.cs | 114 +- .../Markup/Validation/PropertyAttribute.cs | 4 +- .../Iris/Markup/Validation/TypeRestriction.cs | 18 +- .../Iris/Markup/Validation/Validate.cs | 42 +- .../Iris/Markup/Validation/ValidateAlias.cs | 44 +- .../Iris/Markup/Validation/ValidateClass.cs | 236 +-- .../Iris/Markup/Validation/ValidateCode.cs | 88 +- .../Iris/Markup/Validation/ValidateContext.cs | 238 +-- .../Markup/Validation/ValidateDataMapping.cs | 36 +- .../Markup/Validation/ValidateDataQuery.cs | 8 +- .../Markup/Validation/ValidateDataType.cs | 30 +- .../Iris/Markup/Validation/ValidateEffect.cs | 64 +- .../Validation/ValidateEffectElement.cs | 6 +- .../Markup/Validation/ValidateExpression.cs | 28 +- .../Markup/Validation/ValidateExpressionAs.cs | 32 +- .../ValidateExpressionAssignment.cs | 40 +- .../Validation/ValidateExpressionBaseClass.cs | 8 +- .../Validation/ValidateExpressionCall.cs | 172 +- .../Validation/ValidateExpressionCast.cs | 70 +- .../Validation/ValidateExpressionConstant.cs | 54 +- .../ValidateExpressionDeclareTrigger.cs | 28 +- .../Validation/ValidateExpressionIndex.cs | 32 +- .../Validation/ValidateExpressionIsCheck.cs | 26 +- .../Validation/ValidateExpressionList.cs | 30 +- .../Validation/ValidateExpressionNew.cs | 56 +- .../ValidateExpressionNullCoalescing.cs | 42 +- .../Validation/ValidateExpressionOperation.cs | 62 +- .../Validation/ValidateExpressionSymbol.cs | 38 +- .../Validation/ValidateExpressionTernary.cs | 46 +- .../Validation/ValidateExpressionThis.cs | 6 +- .../Validation/ValidateExpressionTypeOf.cs | 16 +- .../Markup/Validation/ValidateFromString.cs | 34 +- .../Iris/Markup/Validation/ValidateMethod.cs | 104 +- .../Markup/Validation/ValidateMethodList.cs | 22 +- .../Markup/Validation/ValidateNamespace.cs | 20 +- .../Iris/Markup/Validation/ValidateObject.cs | 8 +- .../Markup/Validation/ValidateObjectTag.cs | 180 +-- .../Markup/Validation/ValidateParameter.cs | 20 +- .../Validation/ValidateParameterDefinition.cs | 18 +- .../ValidateParameterDefinitionList.cs | 10 +- .../Markup/Validation/ValidateProperty.cs | 234 +-- .../Iris/Markup/Validation/ValidateScripts.cs | 14 +- .../Markup/Validation/ValidateStatement.cs | 8 +- .../Validation/ValidateStatementAssignment.cs | 40 +- .../Validation/ValidateStatementAttribute.cs | 44 +- .../Validation/ValidateStatementBreak.cs | 22 +- .../Validation/ValidateStatementCompound.cs | 12 +- .../Validation/ValidateStatementExpression.cs | 10 +- .../Validation/ValidateStatementForEach.cs | 52 +- .../Markup/Validation/ValidateStatementIf.cs | 20 +- .../Validation/ValidateStatementIfElse.cs | 26 +- .../Validation/ValidateStatementLoop.cs | 4 +- .../Validation/ValidateStatementReturn.cs | 24 +- .../ValidateStatementScopedLocal.cs | 36 +- .../Validation/ValidateStatementWhile.cs | 24 +- .../Validation/ValidateTypeConstraint.cs | 24 +- .../Validation/ValidateTypeIdentifier.cs | 42 +- .../Iris/Markup/Validation/ValidateUI.cs | 78 +- UIX/Microsoft/Iris/ModelItem.cs | 148 +- .../Iris/ModelItems/BooleanChoice.cs | 4 +- UIX/Microsoft/Iris/ModelItems/CaretInfo.cs | 52 +- UIX/Microsoft/Iris/ModelItems/Choice.cs | 170 +- .../Iris/ModelItems/EditableTextData.cs | 42 +- UIX/Microsoft/Iris/ModelItems/LayoutOutput.cs | 12 +- UIX/Microsoft/Iris/ModelItems/NotifyList.cs | 60 +- UIX/Microsoft/Iris/ModelItems/Range.cs | 34 +- UIX/Microsoft/Iris/ModelItems/RangedValue.cs | 68 +- UIX/Microsoft/Iris/ModelItems/ScrollModel.cs | 578 +++---- .../Iris/ModelItems/SelectionManager.cs | 292 ++-- .../Iris/ModelItems/TextScrollModel.cs | 148 +- UIX/Microsoft/Iris/ModelItems/UICommand.cs | 26 +- UIX/Microsoft/Iris/ModelItems/UITimer.cs | 28 +- .../Iris/Navigation/FindFromPointWorker.cs | 42 +- .../Iris/Navigation/NavigationFlow.cs | 48 +- .../Iris/Navigation/NavigationItem.cs | 86 +- .../Iris/Navigation/NavigationOrder.cs | 8 +- .../Iris/Navigation/NavigationSpace.cs | 18 +- .../Iris/Navigation/NavigationStrip.cs | 22 +- .../Navigation/TransientNavigationSite.cs | 26 +- .../Iris/OS/CLR/StandardOleMarshalObject.cs | 4 +- UIX/Microsoft/Iris/OS/DataObject.cs | 20 +- UIX/Microsoft/Iris/OS/DllResource.cs | 12 +- UIX/Microsoft/Iris/OS/DllResources.cs | 8 +- UIX/Microsoft/Iris/OS/FileResource.cs | 34 +- UIX/Microsoft/Iris/OS/HttpResource.cs | 24 +- UIX/Microsoft/Iris/OS/NativeApi.cs | 4 +- UIX/Microsoft/Iris/OS/NativeXmlException.cs | 12 +- UIX/Microsoft/Iris/OS/NativeXmlReader.cs | 100 +- UIX/Microsoft/Iris/OS/Win32Api.cs | 6 +- UIX/Microsoft/Iris/ObjectPropertyPair.cs | 8 +- UIX/Microsoft/Iris/PropertySet.cs | 66 +- UIX/Microsoft/Iris/PropertyValue.cs | 8 +- .../Iris/ProviderlessDataProviderObject.cs | 6 +- UIX/Microsoft/Iris/Queues/Dispatcher.cs | 44 +- UIX/Microsoft/Iris/Queues/Feeder.cs | 36 +- UIX/Microsoft/Iris/Queues/Interconnect.cs | 14 +- UIX/Microsoft/Iris/Queues/PriorityQueue.cs | 92 +- UIX/Microsoft/Iris/Queues/Queue.cs | 4 +- UIX/Microsoft/Iris/Queues/QueueItem.cs | 90 +- UIX/Microsoft/Iris/Queues/SimpleQueue.cs | 18 +- UIX/Microsoft/Iris/RangedValue.cs | 82 +- .../Iris/RenderAPI/Audio/SoundData.cs | 76 +- .../Iris/RenderAPI/Audio/SoundManager.cs | 44 +- .../RenderAPI/Audio/SystemSoundEventTable.cs | 68 +- UIX/Microsoft/Iris/RenderAPI/Drawing/Dib.cs | 24 +- .../Iris/RenderAPI/Drawing/EdgeFade.cs | 136 +- .../Iris/RenderAPI/Drawing/PointF.cs | 18 +- .../Iris/RenderAPI/Drawing/RectangleF.cs | 106 +- UIX/Microsoft/Iris/RenderAPI/Drawing/SizeF.cs | 32 +- UIX/Microsoft/Iris/RenderAPI/HRESULT.cs | 16 +- .../Iris/RenderAPI/RenderException.cs | 6 +- .../VideoPlayback/BasicVideoPresentation.cs | 16 +- .../VideoPlayback/VideoPresentationBuilder.cs | 86 +- UIX/Microsoft/Iris/Session/DeferredCall.cs | 26 +- UIX/Microsoft/Iris/Session/DispatcherTimer.cs | 118 +- UIX/Microsoft/Iris/Session/EffectManager.cs | 48 +- UIX/Microsoft/Iris/Session/ErrorManager.cs | 40 +- UIX/Microsoft/Iris/Session/ErrorWatermark.cs | 4 +- UIX/Microsoft/Iris/Session/Form.cs | 296 ++-- .../Session/InputNotificationEventArgs.cs | 12 +- UIX/Microsoft/Iris/Session/TimeoutManager.cs | 84 +- UIX/Microsoft/Iris/Session/UIApplication.cs | 12 +- UIX/Microsoft/Iris/Session/UIDispatcher.cs | 136 +- UIX/Microsoft/Iris/Session/UISession.cs | 204 +-- .../Iris/SimpleAnimationPropertyMap.cs | 4 +- UIX/Microsoft/Iris/ThreadSafetyBlock.cs | 20 +- UIX/Microsoft/Iris/Timer.cs | 34 +- UIX/Microsoft/Iris/UI/Class.cs | 72 +- UIX/Microsoft/Iris/UI/EffectClass.cs | 60 +- UIX/Microsoft/Iris/UI/EffectElementWrapper.cs | 24 +- UIX/Microsoft/Iris/UI/EffectValue.cs | 6 +- UIX/Microsoft/Iris/UI/Environment.cs | 32 +- UIX/Microsoft/Iris/UI/InputHandler.cs | 104 +- UIX/Microsoft/Iris/UI/RootLoadResult.cs | 6 +- UIX/Microsoft/Iris/UI/RootUI.cs | 6 +- UIX/Microsoft/Iris/UI/SavedKeyFocus.cs | 4 +- UIX/Microsoft/Iris/UI/UIClass.cs | 604 +++---- UIX/Microsoft/Iris/UI/UIForm.cs | 228 +-- UIX/Microsoft/Iris/UI/UIZone.cs | 204 +-- UIX/Microsoft/Iris/UI/ViewItem.cs | 1422 ++++++++--------- UIX/Microsoft/Iris/UI/ViewItemID.cs | 26 +- UIX/Microsoft/Iris/VideoStream.cs | 158 +- UIX/Microsoft/Iris/ViewItems/Clip.cs | 126 +- .../Iris/ViewItems/ContentViewItem.cs | 32 +- .../Iris/ViewItems/CountLayoutInput.cs | 8 +- UIX/Microsoft/Iris/ViewItems/Graphic.cs | 236 +-- UIX/Microsoft/Iris/ViewItems/Host.cs | 250 +-- .../Iris/ViewItems/HostRequestPacket.cs | 8 +- UIX/Microsoft/Iris/ViewItems/HwndHost.cs | 60 +- UIX/Microsoft/Iris/ViewItems/ImageLayout.cs | 28 +- UIX/Microsoft/Iris/ViewItems/Index.cs | 22 +- .../Iris/ViewItems/IndexLayoutInput.cs | 10 +- UIX/Microsoft/Iris/ViewItems/Repeater.cs | 542 +++---- .../Iris/ViewItems/RepeaterContentSelector.cs | 10 +- .../RepeaterListContentsChangedArgs.cs | 12 +- UIX/Microsoft/Iris/ViewItems/RootViewItem.cs | 20 +- UIX/Microsoft/Iris/ViewItems/Scroller.cs | 44 +- UIX/Microsoft/Iris/ViewItems/Text.cs | 836 +++++----- .../Iris/ViewItems/TextFlowRenderingHelper.cs | 24 +- UIX/Microsoft/Iris/ViewItems/TextFragment.cs | 32 +- UIX/Microsoft/Iris/ViewItems/TextRunData.cs | 32 +- .../Iris/ViewItems/TextRunRenderer.cs | 70 +- UIX/Microsoft/Iris/ViewItems/TypeSelector.cs | 10 +- UIX/Microsoft/Iris/ViewItems/Video.cs | 98 +- .../VisibleIndexRangeLayoutOutput.cs | 22 +- UIX/Microsoft/Iris/VirtualList.cs | 472 +++--- UIX/Microsoft/Iris/Window.cs | 118 +- .../Iris/WindowCloseRequestedEventArgs.cs | 4 +- UIX/Microsoft/Iris/WindowColor.cs | 12 +- UIX/Microsoft/Iris/WindowPosition.cs | 10 +- UIX/Microsoft/Iris/WindowSize.cs | 10 +- UIX/ParserLexTable.cs | 10 +- UIX/ParserYaccClass.cs | 290 ++-- UIX/ParserYaccTable.cs | 10 +- UIX/SSVParseLib/SSLex.cs | 78 +- UIX/SSVParseLib/SSLexConsumer.cs | 70 +- UIX/SSVParseLib/SSLexFinalState.cs | 28 +- UIX/SSVParseLib/SSLexLexeme.cs | 42 +- UIX/SSVParseLib/SSLexMark.cs | 8 +- UIX/SSVParseLib/SSLexSubtable.cs | 16 +- UIX/SSVParseLib/SSLexTable.cs | 20 +- UIX/SSVParseLib/SSLexTableRow.cs | 14 +- UIX/SSVParseLib/SSLexTableRowEntry.cs | 12 +- UIX/SSVParseLib/SSYacc.cs | 228 +-- UIX/SSVParseLib/SSYaccCache.cs | 6 +- UIX/SSVParseLib/SSYaccStack.cs | 12 +- UIX/SSVParseLib/SSYaccStackElement.cs | 12 +- UIX/SSVParseLib/SSYaccTable.cs | 8 +- UIX/SSVParseLib/SSYaccTableProd.cs | 8 +- UIX/SSVParseLib/SSYaccTableRow.cs | 32 +- UIX/SSVParseLib/SSYaccTableRowEntry.cs | 14 +- 464 files changed, 14054 insertions(+), 14064 deletions(-) diff --git a/UIX/Microsoft/Iris/Accessibility/Accessible.cs b/UIX/Microsoft/Iris/Accessibility/Accessible.cs index 481fbd4..070c518 100644 --- a/UIX/Microsoft/Iris/Accessibility/Accessible.cs +++ b/UIX/Microsoft/Iris/Accessibility/Accessible.cs @@ -41,71 +41,71 @@ namespace Microsoft.Iris.Accessibility private static readonly DataCookie s_popupStateSlot = DataCookie.ReserveSlot(); private static readonly DataCookie s_multiSelectableStateSlot = DataCookie.ReserveSlot(); - public Accessible() => this.SetData(s_roleSlot, AccRole.Client); + public Accessible() => SetData(s_roleSlot, AccRole.Client); public void Attach(AccessibleProxy proxy) { - this._proxy = proxy; - this.FireNotification(NotificationID.Enabled); + _proxy = proxy; + FireNotification(NotificationID.Enabled); } public void Detach() { - this.SetData(s_defaultActionCommandSlot, null); - this._proxy = null; + SetData(s_defaultActionCommandSlot, null); + _proxy = null; } - public bool Enabled => this._proxy != null; + public bool Enabled => _proxy != null; public string Description { - get => (string)this.GetData(s_descriptionSlot); + get => (string)GetData(s_descriptionSlot); set { - string description = this.Description; + string description = Description; if (!(value != description)) return; - this.SetData(s_descriptionSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.Description, AccessibleProperty.Description); + SetData(s_descriptionSlot, value); + FireAccessiblePropertyChanged(NotificationID.Description, AccessibleProperty.Description); } } public string DefaultAction { - get => (string)this.GetData(s_defaultActionSlot); + get => (string)GetData(s_defaultActionSlot); set { - string defaultAction = this.DefaultAction; + string defaultAction = DefaultAction; if (!(value != defaultAction)) return; - this.SetData(s_defaultActionSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.DefaultAction, AccessibleProperty.DefaultAction); + SetData(s_defaultActionSlot, value); + FireAccessiblePropertyChanged(NotificationID.DefaultAction, AccessibleProperty.DefaultAction); } } public IUICommand DefaultActionCommand { - get => (IUICommand)this.GetData(s_defaultActionCommandSlot); + get => (IUICommand)GetData(s_defaultActionCommandSlot); set { - IUICommand defaultActionCommand = this.DefaultActionCommand; + IUICommand defaultActionCommand = DefaultActionCommand; if (value == defaultActionCommand) return; - this.SetData(s_defaultActionCommandSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.DefaultActionCommand, AccessibleProperty.DefaultActionCommand); + SetData(s_defaultActionCommandSlot, value); + FireAccessiblePropertyChanged(NotificationID.DefaultActionCommand, AccessibleProperty.DefaultActionCommand); } } public string Help { - get => (string)this.GetData(s_helpSlot); + get => (string)GetData(s_helpSlot); set { - string help = this.Help; + string help = Help; if (!(value != help)) return; - this.SetData(s_helpSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.Help, AccessibleProperty.Help); + SetData(s_helpSlot, value); + FireAccessiblePropertyChanged(NotificationID.Help, AccessibleProperty.Help); } } @@ -113,42 +113,42 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_helpTopicSlot); + object data = GetData(s_helpTopicSlot); return data != null ? (int)data : -1; } set { - int helpTopic = this.HelpTopic; + int helpTopic = HelpTopic; if (value == helpTopic) return; - this.SetData(s_helpTopicSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.HelpTopic, AccessibleProperty.HelpTopic); + SetData(s_helpTopicSlot, value); + FireAccessiblePropertyChanged(NotificationID.HelpTopic, AccessibleProperty.HelpTopic); } } public string KeyboardShortcut { - get => (string)this.GetData(s_keyboardShortcutSlot); + get => (string)GetData(s_keyboardShortcutSlot); set { - string keyboardShortcut = this.KeyboardShortcut; + string keyboardShortcut = KeyboardShortcut; if (!(value != keyboardShortcut)) return; - this.SetData(s_keyboardShortcutSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.KeyboardShortcut, AccessibleProperty.KeyboardShortcut); + SetData(s_keyboardShortcutSlot, value); + FireAccessiblePropertyChanged(NotificationID.KeyboardShortcut, AccessibleProperty.KeyboardShortcut); } } public string Name { - get => (string)this.GetData(s_nameSlot); + get => (string)GetData(s_nameSlot); set { - string name = this.Name; + string name = Name; if (!(value != name)) return; - this.SetData(s_nameSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.Name, AccessibleProperty.Name); + SetData(s_nameSlot, value); + FireAccessiblePropertyChanged(NotificationID.Name, AccessibleProperty.Name); } } @@ -156,29 +156,29 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_roleSlot); + object data = GetData(s_roleSlot); return data != null ? (AccRole)data : AccRole.None; } set { - AccRole role = this.Role; + AccRole role = Role; if (value == role) return; - this.SetData(s_roleSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.Role, AccessibleProperty.Role); + SetData(s_roleSlot, value); + FireAccessiblePropertyChanged(NotificationID.Role, AccessibleProperty.Role); } } public string Value { - get => (string)this.GetData(s_valueSlot); + get => (string)GetData(s_valueSlot); set { - string str = this.Value; + string str = Value; if (!(value != str)) return; - this.SetData(s_valueSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.Value, AccessibleProperty.Value); + SetData(s_valueSlot, value); + FireAccessiblePropertyChanged(NotificationID.Value, AccessibleProperty.Value); } } @@ -186,16 +186,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_animatedStateSlot); + object data = GetData(s_animatedStateSlot); return data != null && (bool)data; } set { - bool isAnimated = this.IsAnimated; + bool isAnimated = IsAnimated; if (value == isAnimated) return; - this.SetData(s_animatedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsAnimated, AccessibleProperty.IsAnimated); + SetData(s_animatedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsAnimated, AccessibleProperty.IsAnimated); } } @@ -203,16 +203,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_unavailableStateSlot); + object data = GetData(s_unavailableStateSlot); return data != null && (bool)data; } set { - bool isUnavailable = this.IsUnavailable; + bool isUnavailable = IsUnavailable; if (value == isUnavailable) return; - this.SetData(s_unavailableStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsUnavailable, AccessibleProperty.IsUnavailable); + SetData(s_unavailableStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsUnavailable, AccessibleProperty.IsUnavailable); } } @@ -220,16 +220,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_selectedStateSlot); + object data = GetData(s_selectedStateSlot); return data != null && (bool)data; } set { - bool isSelected = this.IsSelected; + bool isSelected = IsSelected; if (value == isSelected) return; - this.SetData(s_selectedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsSelected, AccessibleProperty.IsSelected); + SetData(s_selectedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsSelected, AccessibleProperty.IsSelected); } } @@ -237,16 +237,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_busyStateSlot); + object data = GetData(s_busyStateSlot); return data != null && (bool)data; } set { - bool isBusy = this.IsBusy; + bool isBusy = IsBusy; if (value == isBusy) return; - this.SetData(s_busyStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsBusy, AccessibleProperty.IsBusy); + SetData(s_busyStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsBusy, AccessibleProperty.IsBusy); } } @@ -254,16 +254,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_pressedStateSlot); + object data = GetData(s_pressedStateSlot); return data != null && (bool)data; } set { - bool isPressed = this.IsPressed; + bool isPressed = IsPressed; if (value == isPressed) return; - this.SetData(s_pressedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsPressed, AccessibleProperty.IsPressed); + SetData(s_pressedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsPressed, AccessibleProperty.IsPressed); } } @@ -271,16 +271,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_checkedStateSlot); + object data = GetData(s_checkedStateSlot); return data != null && (bool)data; } set { - bool isChecked = this.IsChecked; + bool isChecked = IsChecked; if (value == isChecked) return; - this.SetData(s_checkedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsChecked, AccessibleProperty.IsChecked); + SetData(s_checkedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsChecked, AccessibleProperty.IsChecked); } } @@ -288,16 +288,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_collapsedStateSlot); + object data = GetData(s_collapsedStateSlot); return data != null && (bool)data; } set { - bool isCollapsed = this.IsCollapsed; + bool isCollapsed = IsCollapsed; if (value == isCollapsed) return; - this.SetData(s_collapsedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsCollapsed, AccessibleProperty.IsCollapsed); + SetData(s_collapsedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsCollapsed, AccessibleProperty.IsCollapsed); } } @@ -305,16 +305,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_defaultStateSlot); + object data = GetData(s_defaultStateSlot); return data != null && (bool)data; } set { - bool isDefault = this.IsDefault; + bool isDefault = IsDefault; if (value == isDefault) return; - this.SetData(s_defaultStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsDefault, AccessibleProperty.IsDefault); + SetData(s_defaultStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsDefault, AccessibleProperty.IsDefault); } } @@ -322,16 +322,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_marqueeStateSlot); + object data = GetData(s_marqueeStateSlot); return data != null && (bool)data; } set { - bool isMarquee = this.IsMarquee; + bool isMarquee = IsMarquee; if (value == isMarquee) return; - this.SetData(s_marqueeStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsMarquee, AccessibleProperty.IsMarquee); + SetData(s_marqueeStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsMarquee, AccessibleProperty.IsMarquee); } } @@ -339,16 +339,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_mixedStateSlot); + object data = GetData(s_mixedStateSlot); return data != null && (bool)data; } set { - bool isMixed = this.IsMixed; + bool isMixed = IsMixed; if (value == isMixed) return; - this.SetData(s_mixedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsMixed, AccessibleProperty.IsMixed); + SetData(s_mixedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsMixed, AccessibleProperty.IsMixed); } } @@ -356,16 +356,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_expandedStateSlot); + object data = GetData(s_expandedStateSlot); return data != null && (bool)data; } set { - bool isExpanded = this.IsExpanded; + bool isExpanded = IsExpanded; if (value == isExpanded) return; - this.SetData(s_expandedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsExpanded, AccessibleProperty.IsExpanded); + SetData(s_expandedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsExpanded, AccessibleProperty.IsExpanded); } } @@ -373,16 +373,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_traversedStateSlot); + object data = GetData(s_traversedStateSlot); return data != null && (bool)data; } set { - bool isTraversed = this.IsTraversed; + bool isTraversed = IsTraversed; if (value == isTraversed) return; - this.SetData(s_traversedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsTraversed, AccessibleProperty.IsTraversed); + SetData(s_traversedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsTraversed, AccessibleProperty.IsTraversed); } } @@ -390,16 +390,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_selectableStateSlot); + object data = GetData(s_selectableStateSlot); return data != null && (bool)data; } set { - bool isSelectable = this.IsSelectable; + bool isSelectable = IsSelectable; if (value == isSelectable) return; - this.SetData(s_selectableStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsSelectable, AccessibleProperty.IsSelectable); + SetData(s_selectableStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsSelectable, AccessibleProperty.IsSelectable); } } @@ -407,16 +407,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_multiSelectableStateSlot); + object data = GetData(s_multiSelectableStateSlot); return data != null && (bool)data; } set { - bool isMultiSelectable = this.IsMultiSelectable; + bool isMultiSelectable = IsMultiSelectable; if (value == isMultiSelectable) return; - this.SetData(s_multiSelectableStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsMultiSelectable, AccessibleProperty.IsMultiSelectable); + SetData(s_multiSelectableStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsMultiSelectable, AccessibleProperty.IsMultiSelectable); } } @@ -424,16 +424,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_protectedStateSlot); + object data = GetData(s_protectedStateSlot); return data != null && (bool)data; } set { - bool isProtected = this.IsProtected; + bool isProtected = IsProtected; if (value == isProtected) return; - this.SetData(s_protectedStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.IsProtected, AccessibleProperty.IsProtected); + SetData(s_protectedStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.IsProtected, AccessibleProperty.IsProtected); } } @@ -441,16 +441,16 @@ namespace Microsoft.Iris.Accessibility { get { - object data = this.GetData(s_popupStateSlot); + object data = GetData(s_popupStateSlot); return data != null && (bool)data; } set { - bool hasPopup = this.HasPopup; + bool hasPopup = HasPopup; if (value == hasPopup) return; - this.SetData(s_popupStateSlot, value); - this.FireAccessiblePropertyChanged(NotificationID.HasPopup, AccessibleProperty.HasPopup); + SetData(s_popupStateSlot, value); + FireAccessiblePropertyChanged(NotificationID.HasPopup, AccessibleProperty.HasPopup); } } @@ -458,10 +458,10 @@ namespace Microsoft.Iris.Accessibility string propertyName, AccessibleProperty accessibleProperty) { - this.FireNotification(propertyName); - if (this._proxy != null) + FireNotification(propertyName); + if (_proxy != null) { - this._proxy.NotifyAccessiblePropertyChanged(accessibleProperty); + _proxy.NotifyAccessiblePropertyChanged(accessibleProperty); } else { @@ -471,8 +471,8 @@ namespace Microsoft.Iris.Accessibility } } - protected object GetData(DataCookie cookie) => this._dataMap.GetData(cookie); + protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie); - protected void SetData(DataCookie cookie, object value) => this._dataMap.SetData(cookie, value); + protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value); } } diff --git a/UIX/Microsoft/Iris/Accessibility/AccessibleChildren.cs b/UIX/Microsoft/Iris/Accessibility/AccessibleChildren.cs index 7c30e56..d8b0773 100644 --- a/UIX/Microsoft/Iris/Accessibility/AccessibleChildren.cs +++ b/UIX/Microsoft/Iris/Accessibility/AccessibleChildren.cs @@ -25,24 +25,24 @@ namespace Microsoft.Iris.Accessibility internal AccessibleChildren(AccessibleProxy proxy, int position) { - this._proxy = proxy; - this._current = position; + _proxy = proxy; + _current = position; } - internal IEnumVARIANT Clone() => new AccessibleChildren(this._proxy, this._current); + internal IEnumVARIANT Clone() => new AccessibleChildren(_proxy, _current); internal int Next(int count, object[] children) { int index = 0; do { - ++this._current; - if (this._current >= this._proxy.UI.Children.Count) + ++_current; + if (_current >= _proxy.UI.Children.Count) { - this._current = this._proxy.UI.Children.Count; + _current = _proxy.UI.Children.Count; break; } - UIClass child = (UIClass)this._proxy.UI.Children[this._current]; + UIClass child = (UIClass)_proxy.UI.Children[_current]; children[index] = child.AccessibleProxy; ++index; } @@ -50,47 +50,47 @@ namespace Microsoft.Iris.Accessibility return index; } - internal void Reset() => this._current = -1; + internal void Reset() => _current = -1; internal bool Skip(int count) { - this._current += count; - if (this._current < this._proxy.UI.Children.Count) + _current += count; + if (_current < _proxy.UI.Children.Count) return true; - this._current = this._proxy.UI.Children.Count; + _current = _proxy.UI.Children.Count; return false; } IEnumVARIANT IEnumVARIANT.Clone() { - this.VerifyEnumeratorAccess(); - return this.Clone(); + VerifyEnumeratorAccess(); + return Clone(); } unsafe int IEnumVARIANT.Next(int celt, object[] rgVar, IntPtr pceltFetched) { - this.VerifyEnumeratorAccess(); - int num = this.Next(celt, rgVar); + VerifyEnumeratorAccess(); + int num = Next(celt, rgVar); *(int*)(void*)pceltFetched = num; return num != celt ? 1 : 0; } int IEnumVARIANT.Reset() { - this.VerifyEnumeratorAccess(); - this.Reset(); + VerifyEnumeratorAccess(); + Reset(); return 0; } int IEnumVARIANT.Skip(int celt) { - this.VerifyEnumeratorAccess(); - return !this.Skip(celt) ? 1 : 0; + VerifyEnumeratorAccess(); + return !Skip(celt) ? 1 : 0; } private void VerifyEnumeratorAccess() { - if (this._proxy.UI != null && UIDispatcher.IsUIThread) + if (_proxy.UI != null && UIDispatcher.IsUIThread) return; Marshal.ThrowExceptionForHR(-2147467259); } diff --git a/UIX/Microsoft/Iris/Accessibility/AccessibleProxy.cs b/UIX/Microsoft/Iris/Accessibility/AccessibleProxy.cs index a5d0acf..a5bee40 100644 --- a/UIX/Microsoft/Iris/Accessibility/AccessibleProxy.cs +++ b/UIX/Microsoft/Iris/Accessibility/AccessibleProxy.cs @@ -33,21 +33,21 @@ namespace Microsoft.Iris.Accessibility internal AccessibleProxy(UIClass ui, Accessible data) { - this._ui = ui; - this._data = data; - this._data.Attach(this); - this._children = new AccessibleChildren(this); + _ui = ui; + _data = data; + _data.Attach(this); + _children = new AccessibleChildren(this); } - internal UIClass UI => this._ui; + internal UIClass UI => _ui; internal void Detach() { - this._data.Detach(); - this._ui = null; - if (this._proxyID == -1) + _data.Detach(); + _ui = null; + if (_proxyID == -1) return; - s_proxyFromID.Remove(this._proxyID); + s_proxyFromID.Remove(_proxyID); } internal static bool AccessibilityActive @@ -56,86 +56,86 @@ namespace Microsoft.Iris.Accessibility set => s_accessibilityActive = true; } - internal virtual IAccessible Parent => this._ui.Parent != null ? _ui.Parent.AccessibleProxy : null; + internal virtual IAccessible Parent => _ui.Parent != null ? _ui.Parent.AccessibleProxy : null; - internal int ChildCount => this._ui.Children.Count; + internal int ChildCount => _ui.Children.Count; internal virtual string Name { - get => this._data.Name; - set => this._data.Name = value; + get => _data.Name; + set => _data.Name = value; } internal string Value { - get => this._data.Value; - set => this._data.Value = value; + get => _data.Value; + set => _data.Value = value; } - internal string Description => this._data.Description; + internal string Description => _data.Description; - internal AccRole Role => this._data.Role; + internal AccRole Role => _data.Role; internal AccStates State { get { AccStates accStates = AccStates.None; - if (this._ui.DirectKeyFocus) + if (_ui.DirectKeyFocus) accStates |= AccStates.Focused; - if (this._ui.IsKeyFocusable()) + if (_ui.IsKeyFocusable()) accStates |= AccStates.Focusable; - if (this._ui.DirectMouseFocus) + if (_ui.DirectMouseFocus) accStates |= AccStates.HotTracked; - if (!this._ui.Visible) + if (!_ui.Visible) accStates |= AccStates.Invisible; - if (this._ui.Host != null && this._ui.Host.IsOffscreen) + if (_ui.Host != null && _ui.Host.IsOffscreen) accStates |= AccStates.OffScreen; - if (this._data.HasPopup) + if (_data.HasPopup) accStates |= AccStates.HasPopup; - if (this._data.IsAnimated) + if (_data.IsAnimated) accStates |= AccStates.Animated; - if (this._data.IsBusy) + if (_data.IsBusy) accStates |= AccStates.Busy; - if (this._data.IsChecked) + if (_data.IsChecked) accStates |= AccStates.Checked; - if (this._data.IsCollapsed) + if (_data.IsCollapsed) accStates |= AccStates.Collapsed; - if (this._data.IsDefault) + if (_data.IsDefault) accStates |= AccStates.Default; - if (this._data.IsExpanded) + if (_data.IsExpanded) accStates |= AccStates.Expanded; - if (this._data.IsMarquee) + if (_data.IsMarquee) accStates |= AccStates.Marquee; - if (this._data.IsMixed) + if (_data.IsMixed) accStates |= AccStates.Mixed; - if (this._data.IsMultiSelectable) + if (_data.IsMultiSelectable) accStates |= AccStates.MultiSelectable; - if (this._data.IsPressed) + if (_data.IsPressed) accStates |= AccStates.Pressed; - if (this._data.IsProtected) + if (_data.IsProtected) accStates |= AccStates.Protected; - if (this._data.IsSelectable) + if (_data.IsSelectable) accStates |= AccStates.Selectable; - if (this._data.IsSelected) + if (_data.IsSelected) accStates |= AccStates.Selected; - if (this._data.IsTraversed) + if (_data.IsTraversed) accStates |= AccStates.Traversed; - if (this._data.IsUnavailable) + if (_data.IsUnavailable) accStates |= AccStates.Unavailable; return accStates; } } - internal string Help => this._data.Help; + internal string Help => _data.Help; - internal int HelpTopic => this._data.HelpTopic; + internal int HelpTopic => _data.HelpTopic; - internal string KeyboardShortcut => this._data.KeyboardShortcut; + internal string KeyboardShortcut => _data.KeyboardShortcut; - internal bool HasFocus => this._ui.DirectKeyFocus; + internal bool HasFocus => _ui.DirectKeyFocus; - internal string DefaultAction => this._data.DefaultAction; + internal string DefaultAction => _data.DefaultAction; internal Rectangle Location { @@ -144,7 +144,7 @@ namespace Microsoft.Iris.Accessibility Rectangle rectangle = Rectangle.Zero; Vector3 positionPxlVector; Vector3 sizePxlVector; - if (this._ui.RootItem != null && ((INavigationSite)this._ui.RootItem).ComputeBounds(out positionPxlVector, out sizePxlVector)) + if (_ui.RootItem != null && ((INavigationSite)_ui.RootItem).ComputeBounds(out positionPxlVector, out sizePxlVector)) { rectangle = new Rectangle((int)positionPxlVector.X, (int)positionPxlVector.Y, (int)sizePxlVector.X, (int)sizePxlVector.Y); Point location = rectangle.Location; @@ -161,28 +161,28 @@ namespace Microsoft.Iris.Accessibility switch (navDir) { case AccNavDirs.Up: - this._ui.FindNextFocusablePeer(Direction.North, RectangleF.Zero, out resultUI); + _ui.FindNextFocusablePeer(Direction.North, RectangleF.Zero, out resultUI); break; case AccNavDirs.Down: - this._ui.FindNextFocusablePeer(Direction.South, RectangleF.Zero, out resultUI); + _ui.FindNextFocusablePeer(Direction.South, RectangleF.Zero, out resultUI); break; case AccNavDirs.Left: - this._ui.FindNextFocusablePeer(Direction.West, RectangleF.Zero, out resultUI); + _ui.FindNextFocusablePeer(Direction.West, RectangleF.Zero, out resultUI); break; case AccNavDirs.Right: - this._ui.FindNextFocusablePeer(Direction.East, RectangleF.Zero, out resultUI); + _ui.FindNextFocusablePeer(Direction.East, RectangleF.Zero, out resultUI); break; case AccNavDirs.Next: - resultUI = (UIClass)this._ui.NextSibling; + resultUI = (UIClass)_ui.NextSibling; break; case AccNavDirs.Previous: - resultUI = (UIClass)this._ui.PreviousSibling; + resultUI = (UIClass)_ui.PreviousSibling; break; case AccNavDirs.FirstChild: - resultUI = (UIClass)this._ui.FirstChild; + resultUI = (UIClass)_ui.FirstChild; break; case AccNavDirs.LastChild: - resultUI = (UIClass)this._ui.LastChild; + resultUI = (UIClass)_ui.LastChild; break; } return resultUI != null ? resultUI.AccessibleProxy : null; @@ -190,9 +190,9 @@ namespace Microsoft.Iris.Accessibility internal void DoDefaultAction() { - if (this._data.DefaultActionCommand == null) + if (_data.DefaultActionCommand == null) return; - this._data.DefaultActionCommand.Invoke(); + _data.DefaultActionCommand.Invoke(); } internal static void NotifyCreated(UIClass ui) @@ -232,7 +232,7 @@ namespace Microsoft.Iris.Accessibility internal void NotifyAccessiblePropertyChanged(AccessibleProperty property) { - if (!this._ui.Initialized) + if (!_ui.Initialized) return; AccEvents eventType = AccEvents.None; switch (property) @@ -267,7 +267,7 @@ namespace Microsoft.Iris.Accessibility eventType = AccEvents.ObjectHelpChange; break; case AccessibleProperty.IsSelected: - if (this._data.IsSelected) + if (_data.IsSelected) { eventType = AccEvents.ObjectSelection; break; @@ -285,7 +285,7 @@ namespace Microsoft.Iris.Accessibility } if (eventType == AccEvents.None) return; - this.QueueNotifyEvent(eventType); + QueueNotifyEvent(eventType); } private void QueueNotifyEvent(AccEvents eventType) @@ -314,15 +314,15 @@ namespace Microsoft.Iris.Accessibility { get { - this.VerifyProxyAccess(); + VerifyProxyAccess(); return Parent; } } object IAccessible.get_accChild(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); + VerifyProxyAccess(); + VerifySelfChildID(varChild); return this; } @@ -330,74 +330,74 @@ namespace Microsoft.Iris.Accessibility { get { - this.VerifyProxyAccess(); - return this.ChildCount; + VerifyProxyAccess(); + return ChildCount; } } string IAccessible.get_accName(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return this.Name; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return Name; } string IAccessible.get_accValue(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return this.Value; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return Value; } string IAccessible.get_accDescription(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return this.Description; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return Description; } object IAccessible.get_accRole(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return (int)this.Role; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return (int)Role; } object IAccessible.get_accState(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return (int)this.State; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return (int)State; } string IAccessible.get_accHelp(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return this.Help; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return Help; } int IAccessible.get_accHelpTopic(out string pszHelpFile, object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); + VerifyProxyAccess(); + VerifySelfChildID(varChild); pszHelpFile = null; - return this.HelpTopic; + return HelpTopic; } string IAccessible.get_accKeyboardShortcut(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return this.KeyboardShortcut; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return KeyboardShortcut; } object IAccessible.accFocus { get { - this.VerifyProxyAccess(); - return this.HasFocus ? 0 : (object)null; + VerifyProxyAccess(); + return HasFocus ? 0 : (object)null; } } @@ -405,7 +405,7 @@ namespace Microsoft.Iris.Accessibility { get { - this.VerifyProxyAccess(); + VerifyProxyAccess(); Marshal.ThrowExceptionForHR(-2147467263); return null; } @@ -413,15 +413,15 @@ namespace Microsoft.Iris.Accessibility string IAccessible.get_accDefaultAction(object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - return this.DefaultAction; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + return DefaultAction; } void IAccessible.accSelect(int flagsSelect, object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); + VerifyProxyAccess(); + VerifySelfChildID(varChild); Marshal.ThrowExceptionForHR(-2147467263); } @@ -432,9 +432,9 @@ namespace Microsoft.Iris.Accessibility out int pcyHeight, object varChild) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - Rectangle location = this.Location; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + Rectangle location = Location; pxLeft = location.X; pyTop = location.Y; pcxWidth = location.Width; @@ -443,65 +443,65 @@ namespace Microsoft.Iris.Accessibility object IAccessible.accNavigate(int navDir, object varStart) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varStart); - return this.Navigate((AccNavDirs)navDir); + VerifyProxyAccess(); + VerifySelfChildID(varStart); + return Navigate((AccNavDirs)navDir); } object IAccessible.accHitTest(int xLeft, int yTop) { - this.VerifyProxyAccess(); + VerifyProxyAccess(); Marshal.ThrowExceptionForHR(-2147467263); return null; } void IAccessible.accDoDefaultAction(object varChild) { - this.VerifyProxyAccess(); - this.DoDefaultAction(); + VerifyProxyAccess(); + DoDefaultAction(); } void IAccessible.set_accName(object varChild, string pszName) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - this.Name = pszName; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + Name = pszName; } void IAccessible.set_accValue(object varChild, string pszValue) { - this.VerifyProxyAccess(); - this.VerifySelfChildID(varChild); - this.Value = pszValue; + VerifyProxyAccess(); + VerifySelfChildID(varChild); + Value = pszValue; } IEnumVARIANT IEnumVARIANT.Clone() { - this.VerifyProxyAccess(); - return this._children.Clone(); + VerifyProxyAccess(); + return _children.Clone(); } int IEnumVARIANT.Next(int celt, object[] rgVar, IntPtr pceltFetched) { - this.VerifyProxyAccess(); - return this._children.Next(celt, rgVar, pceltFetched); + VerifyProxyAccess(); + return _children.Next(celt, rgVar, pceltFetched); } int IEnumVARIANT.Reset() { - this.VerifyProxyAccess(); - return this._children.Reset(); + VerifyProxyAccess(); + return _children.Reset(); } int IEnumVARIANT.Skip(int celt) { - this.VerifyProxyAccess(); - return this._children.Skip(celt); + VerifyProxyAccess(); + return _children.Skip(celt); } private void VerifyProxyAccess() { - if (this._ui != null && UIDispatcher.IsUIThread) + if (_ui != null && UIDispatcher.IsUIThread) return; Marshal.ThrowExceptionForHR(-2147467259); } @@ -517,12 +517,12 @@ namespace Microsoft.Iris.Accessibility { get { - if (this._proxyID == -1) + if (_proxyID == -1) { - this._proxyID = ++s_proxyIDAllocator; - s_proxyFromID[this._proxyID] = this; + _proxyID = ++s_proxyIDAllocator; + s_proxyFromID[_proxyID] = this; } - return this._proxyID; + return _proxyID; } } diff --git a/UIX/Microsoft/Iris/Accessibility/RootAccessibleProxy.cs b/UIX/Microsoft/Iris/Accessibility/RootAccessibleProxy.cs index 94ead1d..8600d55 100644 --- a/UIX/Microsoft/Iris/Accessibility/RootAccessibleProxy.cs +++ b/UIX/Microsoft/Iris/Accessibility/RootAccessibleProxy.cs @@ -21,7 +21,7 @@ namespace Microsoft.Iris.Accessibility { } - internal override IAccessible Parent => (IAccessible)this._clientBridge.accParent; + internal override IAccessible Parent => (IAccessible)_clientBridge.accParent; internal override IAccessible Navigate(AccNavDirs navDir) { @@ -34,7 +34,7 @@ namespace Microsoft.Iris.Accessibility case AccNavDirs.Right: case AccNavDirs.Next: case AccNavDirs.Previous: - accessible = (IAccessible)this._clientBridge.accNavigate((int)navDir, 0); + accessible = (IAccessible)_clientBridge.accNavigate((int)navDir, 0); break; case AccNavDirs.FirstChild: case AccNavDirs.LastChild: @@ -46,8 +46,8 @@ namespace Microsoft.Iris.Accessibility internal override string Name => UIApplication.ApplicationName; - internal IAccessible ClientBridge => this._clientBridge; + internal IAccessible ClientBridge => _clientBridge; - internal void AttachClientBridge(IAccessible clientBridge) => this._clientBridge = clientBridge; + internal void AttachClientBridge(IAccessible clientBridge) => _clientBridge = clientBridge; } } diff --git a/UIX/Microsoft/Iris/AggregateList.cs b/UIX/Microsoft/Iris/AggregateList.cs index 50b183c..265b2fa 100644 --- a/UIX/Microsoft/Iris/AggregateList.cs +++ b/UIX/Microsoft/Iris/AggregateList.cs @@ -45,28 +45,28 @@ namespace Microsoft.Iris { if (lists == null) lists = new IList[0]; - this._lists = lists; - UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(this.ChildListModified); - SlowDataAcquireCompleteHandler acquireCompleteHandler = new SlowDataAcquireCompleteHandler(this.ChildListSlowDataAcquired); - for (int index = 0; index < this._lists.Length; ++index) + _lists = lists; + UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(ChildListModified); + SlowDataAcquireCompleteHandler acquireCompleteHandler = new SlowDataAcquireCompleteHandler(ChildListSlowDataAcquired); + for (int index = 0; index < _lists.Length; ++index) { - if (this._lists[index] == null) - this._lists[index] = new ArrayList(); - IList list = this._lists[index]; + if (_lists[index] == null) + _lists[index] = new ArrayList(); + IList list = _lists[index]; if (list is INotifyList notifyList) notifyList.ContentsChanged += contentsChangedHandler; if (list is IVirtualList virtualList && virtualList.SlowDataRequestsEnabled) virtualList.SlowDataAcquireCompleteHandler = acquireCompleteHandler; } - this.Count = this.ItemCount; + Count = ItemCount; } protected override void OnDispose(bool disposing) { if (disposing) { - UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(this.ChildListModified); - foreach (IList list in this._lists) + UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(ChildListModified); + foreach (IList list in _lists) { if (list is INotifyList notifyList) notifyList.ContentsChanged -= contentsChangedHandler; @@ -79,7 +79,7 @@ namespace Microsoft.Iris protected override object OnRequestItem(int index) { - foreach (IList list in this._lists) + foreach (IList list in _lists) { if (index < list.Count) return list[index]; @@ -90,7 +90,7 @@ namespace Microsoft.Iris protected override void OnRequestSlowData(int index) { - foreach (IList list in this._lists) + foreach (IList list in _lists) { if (index < list.Count) { @@ -103,43 +103,43 @@ namespace Microsoft.Iris } index -= list.Count; } - this.NotifySlowDataAcquireComplete(index); + NotifySlowDataAcquireComplete(index); } private bool ChildListSlowDataAcquired(IVirtualList childList, int index) { - this.NotifySlowDataAcquireComplete(this.ListIndexToMasterIndex(childList, index)); + NotifySlowDataAcquireComplete(ListIndexToMasterIndex(childList, index)); return true; } private void ChildListModified(IList listSender, UIListContentsChangedArgs args) { - int masterIndex1 = this.ListIndexToMasterIndex(listSender, args.OldIndex); - int masterIndex2 = this.ListIndexToMasterIndex(listSender, args.NewIndex); + int masterIndex1 = ListIndexToMasterIndex(listSender, args.OldIndex); + int masterIndex2 = ListIndexToMasterIndex(listSender, args.NewIndex); switch (args.Type) { case UIListContentsChangeType.Add: case UIListContentsChangeType.Insert: - this.Insert(masterIndex2); + Insert(masterIndex2); break; case UIListContentsChangeType.AddRange: case UIListContentsChangeType.InsertRange: - this.InsertRange(masterIndex2, args.Count); + InsertRange(masterIndex2, args.Count); break; case UIListContentsChangeType.Remove: - this.RemoveAt(masterIndex1); + RemoveAt(masterIndex1); break; case UIListContentsChangeType.Move: if (masterIndex1 == masterIndex2) break; - this.Move(masterIndex1, masterIndex2); + Move(masterIndex1, masterIndex2); break; case UIListContentsChangeType.Modified: - this.Modified(masterIndex2); + Modified(masterIndex2); break; default: - this.Clear(); - this.Count = this.ItemCount; + Clear(); + Count = ItemCount; break; } } @@ -148,11 +148,11 @@ namespace Microsoft.Iris private void DEBUG_ValidateConsistency() { int index1 = 0; - for (int index2 = 0; index2 < this._lists.Length; ++index2) + for (int index2 = 0; index2 < _lists.Length; ++index2) { - for (int index3 = 0; index3 < this._lists[index2].Count; ++index3) + for (int index3 = 0; index3 < _lists[index2].Count; ++index3) { - object obj1 = this._lists[index2][index3]; + object obj1 = _lists[index2][index3]; object obj2 = this[index1]; ++index1; } @@ -162,8 +162,8 @@ namespace Microsoft.Iris private int ListIndexToMasterIndex(IList list, int index) { int num = 0; - for (int index1 = 0; index1 < this._lists.Length && this._lists[index1] != list; ++index1) - num += this._lists[index1].Count; + for (int index1 = 0; index1 < _lists.Length && _lists[index1] != list; ++index1) + num += _lists[index1].Count; return num + index; } @@ -172,9 +172,9 @@ namespace Microsoft.Iris int num = 0; int index1 = 0; list = null; - for (; index1 < this._lists.Length; ++index1) + for (; index1 < _lists.Length; ++index1) { - list = this._lists[index1]; + list = _lists[index1]; if (num + list.Count <= masterIndex) num += list.Count; else @@ -188,7 +188,7 @@ namespace Microsoft.Iris get { int num = 0; - foreach (IList list in this._lists) + foreach (IList list in _lists) num += list.Count; return num; } diff --git a/UIX/Microsoft/Iris/Animations/ActiveSequence.cs b/UIX/Microsoft/Iris/Animations/ActiveSequence.cs index 01eb6d4..45e5394 100644 --- a/UIX/Microsoft/Iris/Animations/ActiveSequence.cs +++ b/UIX/Microsoft/Iris/Animations/ActiveSequence.cs @@ -27,71 +27,71 @@ namespace Microsoft.Iris.Animations IAnimatable animatableTarget, UISession session) { - this._animatableTarget = animatableTarget; - this._session = session; - this._template = template_; - this._ready = new Vector(); + _animatableTarget = animatableTarget; + _session = session; + _template = template_; + _ready = new Vector(); } protected override void OnDispose() { base.OnDispose(); - Vector animationCollection = this.GetAnimationCollection(); + Vector animationCollection = GetAnimationCollection(); if (animationCollection != null) { foreach (DisposableObject disposableObject in animationCollection) disposableObject.Dispose(this); - this.FireComplete(false); + FireComplete(false); } - this._session = null; - this._animatableTarget = null; - this._template = null; - this._ready = null; + _session = null; + _animatableTarget = null; + _template = null; + _ready = null; } - public UISession Session => this._session; + public UISession Session => _session; - internal IAnimatable Target => this._animatableTarget; + internal IAnimatable Target => _animatableTarget; - public AnimationTemplate Template => this._template; + public AnimationTemplate Template => _template; - public bool Playing => this._playing != null; + public bool Playing => _playing != null; - internal Vector PendingProxies => this._ready; + internal Vector PendingProxies => _ready; public void Play() { - Vector ready = this._ready; - this._ready = null; + Vector ready = _ready; + _ready = null; if (ready.Count > 0) { foreach (AnimationProxy animationProxy in ready) animationProxy.Play(); - this._playing = ready; - this.FireStart(); + _playing = ready; + FireStart(); } else { - this.FireStart(); - this.FireComplete(true); + FireStart(); + FireComplete(true); } } - public void Stop() => this.Stop(null); + public void Stop() => Stop(null); public void Stop(StopCommandSet stopSetCommand) { if (UIDispatcher.IsUIThread) { - this.StopWorker(stopSetCommand); + StopWorker(stopSetCommand); } else { try { - if (!this.Session.IsValid) + if (!Session.IsValid) return; - DeferredCall.Post(DispatchPriority.High, new DeferredHandler(this.DeferredStop), stopSetCommand); + DeferredCall.Post(DispatchPriority.High, new DeferredHandler(DeferredStop), stopSetCommand); } catch (InvalidOperationException ex) { @@ -101,9 +101,9 @@ namespace Microsoft.Iris.Animations private void StopWorker(StopCommandSet stopSetCommand) { - if (this._playing == null) + if (_playing == null) return; - foreach (AnimationProxy animationProxy in this._playing) + foreach (AnimationProxy animationProxy in _playing) { if (stopSetCommand != null) animationProxy.Stop(stopSetCommand[animationProxy.Type]); @@ -112,11 +112,11 @@ namespace Microsoft.Iris.Animations } } - private void DeferredStop(object args) => this.StopWorker((StopCommandSet)args); + private void DeferredStop(object args) => StopWorker((StopCommandSet)args); public bool ValidatePlayable() { - foreach (AnimationProxy animationProxy in this._ready) + foreach (AnimationProxy animationProxy in _ready) { if (!animationProxy.ValidatePlayable()) return false; @@ -127,38 +127,38 @@ namespace Microsoft.Iris.Animations internal void OnAttachChildAnimation(AnimationProxy child) { child.DeclareOwner(this); - this._ready.Add(child); + _ready.Add(child); } - private Vector GetAnimationCollection() => this._ready ?? this._playing; + private Vector GetAnimationCollection() => _ready ?? _playing; internal void OnDetachChildAnimation(AnimationProxy child, float progress) { - Vector animationCollection = this.GetAnimationCollection(); + Vector animationCollection = GetAnimationCollection(); if (animationCollection == null) return; animationCollection.Remove(child); child.Dispose(this); if (_lastProgress < (double)progress) - this._lastProgress = progress; - if (animationCollection != this._playing || animationCollection.Count != 0) + _lastProgress = progress; + if (animationCollection != _playing || animationCollection.Count != 0) return; - this.FireComplete(true); + FireComplete(true); } - private void FireStart() => this.OnStart(); + private void FireStart() => OnStart(); private void FireComplete(bool notify) { - if (this._playing != null) - this._playing = null; - this.OnStop(this._lastProgress, notify); + if (_playing != null) + _playing = null; + OnStop(_lastProgress, notify); } public StopCommandSet GetStopCommandSet() { StopCommandSet stopCommandSet = null; - foreach (AnimationProxy animation in this.GetAnimationCollection()) + foreach (AnimationProxy animation in GetAnimationCollection()) { if (animation.HasDynamicKeyframes) { @@ -172,7 +172,7 @@ namespace Microsoft.Iris.Animations public ActiveTransitions GetActiveTransitions() { - Vector animationCollection = this.GetAnimationCollection(); + Vector animationCollection = GetAnimationCollection(); ActiveTransitions activeTransitions = ActiveTransitions.None; foreach (AnimationProxy animationProxy in animationCollection) { @@ -251,24 +251,24 @@ namespace Microsoft.Iris.Animations { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{ActiveSequence Template=\""); - if (this._template.DebugID != null) + if (_template.DebugID != null) { - stringBuilder.Append(this._template.DebugID); + stringBuilder.Append(_template.DebugID); } else { - Animation template = this._template as Animation; + Animation template = _template as Animation; if (template != null) stringBuilder.Append(template.Type); else stringBuilder.Append(""); } stringBuilder.Append("\", Target="); - stringBuilder.Append(this._animatableTarget.GetType().Name); - if (this._animatableTarget is IVisual) + stringBuilder.Append(_animatableTarget.GetType().Name); + if (_animatableTarget is IVisual) { stringBuilder.Append(", IVisual="); - stringBuilder.Append(((IVisual)this._animatableTarget).DebugID); + stringBuilder.Append(((IVisual)_animatableTarget).DebugID); } stringBuilder.Append("}"); return stringBuilder.ToString(); @@ -282,27 +282,27 @@ namespace Microsoft.Iris.Animations internal void OnStart() { - ++this._playingCount; - if (this._playingCount != 1 || this.AnimationStarted == null) + ++_playingCount; + if (_playingCount != 1 || AnimationStarted == null) return; - this.AnimationStarted(this, EventArgs.Empty); + AnimationStarted(this, EventArgs.Empty); } internal void OnStop(float progress, bool notify) { - --this._playingCount; - if (notify && this._playingCount == 0) + --_playingCount; + if (notify && _playingCount == 0) { EventArgs e = new AnimationCompleteArgs(progress); - if (this.AnimationCompleted != null) - this.AnimationCompleted(this, e); - if (this.AfterAnimationCompleted == null) + if (AnimationCompleted != null) + AnimationCompleted(this, e); + if (AfterAnimationCompleted == null) return; - this.AfterAnimationCompleted(this, e); + AfterAnimationCompleted(this, e); } else { - int playingCount = this._playingCount; + int playingCount = _playingCount; } } } diff --git a/UIX/Microsoft/Iris/Animations/AlphaKeyframe.cs b/UIX/Microsoft/Iris/Animations/AlphaKeyframe.cs index e447af7..cfd4146 100644 --- a/UIX/Microsoft/Iris/Animations/AlphaKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/AlphaKeyframe.cs @@ -18,17 +18,17 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return this.RelativeTo == RelativeTo.Final ? baseValue * args.NewAlpha : baseValue; + return RelativeTo == RelativeTo.Final ? baseValue * args.NewAlpha : baseValue; } public override void Apply(IAnimatableOwner animationTarget, float value) => ((ViewItem)animationTarget).VisualAlpha = value; public override void MagnifyValue(float magnifyValue) { - float num = this.Value * magnifyValue; + float num = Value * magnifyValue; if (num > 1.0) num = 1f; - this.Value = num; + Value = num; } } } diff --git a/UIX/Microsoft/Iris/Animations/Animation.cs b/UIX/Microsoft/Iris/Animations/Animation.cs index 22ab76c..89ea6cc 100644 --- a/UIX/Microsoft/Iris/Animations/Animation.cs +++ b/UIX/Microsoft/Iris/Animations/Animation.cs @@ -24,15 +24,15 @@ namespace Microsoft.Iris.Animations public Animation() { - this._type = AnimationEventType.Idle; - this._bitsBitVector = new BitVector32(); - this._dataMap = new DynamicData(); + _type = AnimationEventType.Idle; + _bitsBitVector = new BitVector32(); + _dataMap = new DynamicData(); } public override object Clone() { Animation animation = new Animation(); - this.CloneWorker(animation); + CloneWorker(animation); return animation; } @@ -40,64 +40,64 @@ namespace Microsoft.Iris.Animations { base.CloneWorker(rawAnimation); Animation animation = (Animation)rawAnimation; - animation.Type = this.Type; - if (this.GetBit(Bits.CenterPointScale)) - animation.CenterPointPercent = this.CenterPointPercent; - if (this.GetBit(Bits.RotationAxis)) - animation.RotationAxis = this.RotationAxis; - animation.DisableMouseInput = this.DisableMouseInput; + animation.Type = Type; + if (GetBit(Bits.CenterPointScale)) + animation.CenterPointPercent = CenterPointPercent; + if (GetBit(Bits.RotationAxis)) + animation.RotationAxis = RotationAxis; + animation.DisableMouseInput = DisableMouseInput; } private void PrepareToPlay(ref AnimationArgs args) { - if (this.GetBit(Bits.CenterPointScale)) - args.ViewItem.VisualCenterPoint = this.CenterPointPercent; - if (!this.GetBit(Bits.RotationAxis)) + if (GetBit(Bits.CenterPointScale)) + args.ViewItem.VisualCenterPoint = CenterPointPercent; + if (!GetBit(Bits.RotationAxis)) return; Rotation visualRotation = args.ViewItem.VisualRotation; - args.ViewItem.VisualRotation = new Rotation(visualRotation.AngleRadians, this.RotationAxis); + args.ViewItem.VisualRotation = new Rotation(visualRotation.AngleRadians, RotationAxis); } public AnimationEventType Type { - get => this._type; - set => this._type = value; + get => _type; + set => _type = value; } public Vector3 CenterPointPercent { - get => !this.GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)this.GetData(s_centerPointScaleProperty); + get => !GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)GetData(s_centerPointScaleProperty); set { - if (!(this.CenterPointPercent != value)) + if (!(CenterPointPercent != value)) return; - this.SetData(s_centerPointScaleProperty, value); - this.SetBit(Bits.CenterPointScale, true); + SetData(s_centerPointScaleProperty, value); + SetBit(Bits.CenterPointScale, true); } } public Vector3 RotationAxis { - get => !this.GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)this.GetData(s_rotationAxisProperty); + get => !GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)GetData(s_rotationAxisProperty); set { - if (!(this.RotationAxis != value)) + if (!(RotationAxis != value)) return; - this.SetData(s_rotationAxisProperty, value); - this.SetBit(Bits.RotationAxis, true); + SetData(s_rotationAxisProperty, value); + SetBit(Bits.RotationAxis, true); } } public bool DisableMouseInput { - get => this.GetBit(Bits.DisableMouseInput); - set => this.SetBit(Bits.DisableMouseInput, value); + get => GetBit(Bits.DisableMouseInput); + set => SetBit(Bits.DisableMouseInput, value); } AnimationTemplate IAnimationProvider.Build( ref AnimationArgs args) { - this.PrepareToPlay(ref args); + PrepareToPlay(ref args); return this; } @@ -107,38 +107,38 @@ namespace Microsoft.Iris.Animations { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{AnimationTemplate ID="); - stringBuilder.Append(this.DebugID); + stringBuilder.Append(DebugID); stringBuilder.Append(", Loop="); - stringBuilder.Append(this.Loop); + stringBuilder.Append(Loop); stringBuilder.Append(", KeyframeCount="); - stringBuilder.Append(this.Keyframes.Count); + stringBuilder.Append(Keyframes.Count); stringBuilder.Append("}"); return stringBuilder.ToString(); } - private bool GetBit(Animation.Bits bit) => this._bitsBitVector[(int)bit]; + private bool GetBit(Animation.Bits bit) => _bitsBitVector[(int)bit]; - private void SetBit(Animation.Bits bit, bool value) => this._bitsBitVector[(int)bit] = value; + private void SetBit(Animation.Bits bit, bool value) => _bitsBitVector[(int)bit] = value; private bool ChangeBit(Animation.Bits bit, bool value) { - if (this._bitsBitVector[(int)bit] == value) + if (_bitsBitVector[(int)bit] == value) return false; - this._bitsBitVector[(int)bit] = value; + _bitsBitVector[(int)bit] = value; return true; } - protected object GetData(DataCookie cookie) => this._dataMap.GetData(cookie); + protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie); - protected void SetData(DataCookie cookie, object value) => this._dataMap.SetData(cookie, value); + protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value); - protected Delegate GetEventHandler(EventCookie cookie) => this._dataMap.GetEventHandler(cookie); + protected Delegate GetEventHandler(EventCookie cookie) => _dataMap.GetEventHandler(cookie); - protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => this._dataMap.AddEventHandler(cookie, handlerToAdd); + protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => _dataMap.AddEventHandler(cookie, handlerToAdd); - protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => this._dataMap.RemoveEventHandler(cookie, handlerToRemove); + protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => _dataMap.RemoveEventHandler(cookie, handlerToRemove); - protected void RemoveEventHandlers(EventCookie cookie) => this._dataMap.RemoveEventHandlers(cookie); + protected void RemoveEventHandlers(EventCookie cookie) => _dataMap.RemoveEventHandlers(cookie); private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie); diff --git a/UIX/Microsoft/Iris/Animations/AnimationArgs.cs b/UIX/Microsoft/Iris/Animations/AnimationArgs.cs index e5fd41d..a10cdff 100644 --- a/UIX/Microsoft/Iris/Animations/AnimationArgs.cs +++ b/UIX/Microsoft/Iris/Animations/AnimationArgs.cs @@ -34,25 +34,25 @@ namespace Microsoft.Iris.Animations public AnimationArgs(Camera cam) { - this.ViewItem = null; - this.OldPosition = Vector3.Zero; - this.OldSize = Vector2.Zero; - this.OldScale = Vector3.Zero; - this.OldRotation = Rotation.Default; - this.OldAlpha = 0.0f; - this.NewPosition = Vector3.Zero; - this.NewSize = Vector2.Zero; - this.NewScale = Vector3.Zero; - this.NewRotation = Rotation.Default; - this.NewAlpha = 0.0f; - this.OldEye = cam.Eye; - this.NewEye = cam.Eye; - this.OldAt = cam.At; - this.NewAt = cam.At; - this.OldUp = cam.Up; - this.NewUp = cam.Up; - this.OldZn = cam.Zn; - this.NewZn = cam.Zn; + ViewItem = null; + OldPosition = Vector3.Zero; + OldSize = Vector2.Zero; + OldScale = Vector3.Zero; + OldRotation = Rotation.Default; + OldAlpha = 0.0f; + NewPosition = Vector3.Zero; + NewSize = Vector2.Zero; + NewScale = Vector3.Zero; + NewRotation = Rotation.Default; + NewAlpha = 0.0f; + OldEye = cam.Eye; + NewEye = cam.Eye; + OldAt = cam.At; + NewAt = cam.At; + OldUp = cam.Up; + NewUp = cam.Up; + OldZn = cam.Zn; + NewZn = cam.Zn; } public AnimationArgs( @@ -68,25 +68,25 @@ namespace Microsoft.Iris.Animations Rotation newRotation, float newAlpha) { - this.ViewItem = vi; - this.OldPosition = oldPosition; - this.OldSize = oldSize; - this.OldScale = oldScale; - this.OldRotation = oldRotation; - this.OldAlpha = oldAlpha; - this.NewPosition = newPosition; - this.NewSize = newSize; - this.NewScale = newScale; - this.NewRotation = newRotation; - this.NewAlpha = newAlpha; - this.OldEye = Vector3.Zero; - this.NewEye = Vector3.Zero; - this.OldAt = Vector3.Zero; - this.NewAt = Vector3.Zero; - this.OldUp = Vector3.Zero; - this.NewUp = Vector3.Zero; - this.OldZn = 0.0f; - this.NewZn = 0.0f; + ViewItem = vi; + OldPosition = oldPosition; + OldSize = oldSize; + OldScale = oldScale; + OldRotation = oldRotation; + OldAlpha = oldAlpha; + NewPosition = newPosition; + NewSize = newSize; + NewScale = newScale; + NewRotation = newRotation; + NewAlpha = newAlpha; + OldEye = Vector3.Zero; + NewEye = Vector3.Zero; + OldAt = Vector3.Zero; + NewAt = Vector3.Zero; + OldUp = Vector3.Zero; + NewUp = Vector3.Zero; + OldZn = 0.0f; + NewZn = 0.0f; } public AnimationArgs( diff --git a/UIX/Microsoft/Iris/Animations/AnimationCompleteArgs.cs b/UIX/Microsoft/Iris/Animations/AnimationCompleteArgs.cs index 36ca8f0..c3d256d 100644 --- a/UIX/Microsoft/Iris/Animations/AnimationCompleteArgs.cs +++ b/UIX/Microsoft/Iris/Animations/AnimationCompleteArgs.cs @@ -12,8 +12,8 @@ namespace Microsoft.Iris.Animations { private float _progress; - public AnimationCompleteArgs(float progress) => this._progress = progress; + public AnimationCompleteArgs(float progress) => _progress = progress; - public float Progress => this._progress; + public float Progress => _progress; } } diff --git a/UIX/Microsoft/Iris/Animations/AnimationHandle.cs b/UIX/Microsoft/Iris/Animations/AnimationHandle.cs index 6be6c50..c244c46 100644 --- a/UIX/Microsoft/Iris/Animations/AnimationHandle.cs +++ b/UIX/Microsoft/Iris/Animations/AnimationHandle.cs @@ -16,32 +16,32 @@ namespace Microsoft.Iris.Animations public event EventHandler Completed; - public bool Playing => this._playing > 0; + public bool Playing => _playing > 0; internal void AssociateWithAnimationInstance(ActiveSequence anim) { - anim.AnimationCompleted += new EventHandler(this.OnAnimationCompleted); - ++this._playing; - if (this._playing != 1) + anim.AnimationCompleted += new EventHandler(OnAnimationCompleted); + ++_playing; + if (_playing != 1) return; - this.FireNotification(NotificationID.Playing); + FireNotification(NotificationID.Playing); } internal void FireCompleted() { - if (this.Completed != null) - this.Completed(this, EventArgs.Empty); - this.FireNotification(NotificationID.Completed); + if (Completed != null) + Completed(this, EventArgs.Empty); + FireNotification(NotificationID.Completed); } private void OnAnimationCompleted(object sender, EventArgs args) { - ((ActiveSequence)sender).AnimationCompleted -= new EventHandler(this.OnAnimationCompleted); - --this._playing; - if (this._playing != 0) + ((ActiveSequence)sender).AnimationCompleted -= new EventHandler(OnAnimationCompleted); + --_playing; + if (_playing != 0) return; - this.FireNotification(NotificationID.Playing); - this.FireCompleted(); + FireNotification(NotificationID.Playing); + FireCompleted(); } } } diff --git a/UIX/Microsoft/Iris/Animations/AnimationManager.cs b/UIX/Microsoft/Iris/Animations/AnimationManager.cs index 8e86702..bccbeee 100644 --- a/UIX/Microsoft/Iris/Animations/AnimationManager.cs +++ b/UIX/Microsoft/Iris/Animations/AnimationManager.cs @@ -32,49 +32,49 @@ namespace Microsoft.Iris.Animations public AnimationManager(IRenderSession session) { - this._session = session; - this._orphans = new Vector(); - this._session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3; - this._session.AnimationSystem.BackCompat = true; + _session = session; + _orphans = new Vector(); + _session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3; + _session.AnimationSystem.BackCompat = true; } - ~AnimationManager() => this.Dispose(false); + ~AnimationManager() => Dispose(false); public void Dispose() { GC.SuppressFinalize(this); - this.Dispose(true); + Dispose(true); } protected virtual void Dispose(bool inDisposeFlag) { - this._shuttingDown = true; + _shuttingDown = true; if (!inDisposeFlag) return; - foreach (DisposableObject orphan in this._orphans) + foreach (DisposableObject orphan in _orphans) orphan.Dispose(this); - this._orphans.Clear(); + _orphans.Clear(); } - internal bool ShuttingDown => this._shuttingDown; + internal bool ShuttingDown => _shuttingDown; public void SetGlobalSpeedAdjustment(float value) { - this.ValidateConnected(); - this._session.AnimationSystem.SpeedAdjustment = value; + ValidateConnected(); + _session.AnimationSystem.SpeedAdjustment = value; } public void PulseTimeAdvance(int pulseSize) { - this.ValidateConnected(); - this._session.AnimationSystem.PulseTimeAdvance(pulseSize); + ValidateConnected(); + _session.AnimationSystem.PulseTimeAdvance(pulseSize); } - public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => this._orphans.Add(orphan); + public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Add(orphan); - public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => this._orphans.Remove(orphan); + public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Remove(orphan); - public bool CanPlayAnimationType(AnimationType type) => this._session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi || type == AnimationType.Position || (type == AnimationType.Size || type == AnimationType.Scale) || type == AnimationType.Alpha; + public bool CanPlayAnimationType(AnimationType type) => _session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi || type == AnimationType.Position || (type == AnimationType.Size || type == AnimationType.Scale) || type == AnimationType.Alpha; private void ValidateConnected() { @@ -82,27 +82,27 @@ namespace Microsoft.Iris.Animations internal IKeyframeAnimation BuildAnimation(AnimationProxy owner) { - this.ValidateConnected(); + ValidateConnected(); IKeyframeAnimation keyframeAnimation = null; switch (owner.Type) { case AnimationType.Position: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput); break; case AnimationType.Size: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput); break; case AnimationType.Alpha: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput); break; case AnimationType.Scale: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput); break; case AnimationType.Rotate: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput); break; case AnimationType.Orientation: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput); break; case AnimationType.PositionX: case AnimationType.PositionY: @@ -111,28 +111,28 @@ namespace Microsoft.Iris.Animations case AnimationType.ScaleX: case AnimationType.ScaleY: case AnimationType.Float: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput); break; case AnimationType.Vector2: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input); break; case AnimationType.Vector3: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input); break; case AnimationType.Vector4: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input); break; case AnimationType.CameraEye: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput); break; case AnimationType.CameraAt: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput); break; case AnimationType.CameraUp: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput); break; case AnimationType.CameraZn: - keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput); + keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput); break; } return keyframeAnimation; diff --git a/UIX/Microsoft/Iris/Animations/AnimationProxy.cs b/UIX/Microsoft/Iris/Animations/AnimationProxy.cs index f763706..694919f 100644 --- a/UIX/Microsoft/Iris/Animations/AnimationProxy.cs +++ b/UIX/Microsoft/Iris/Animations/AnimationProxy.cs @@ -34,50 +34,50 @@ namespace Microsoft.Iris.Animations { UISession.Validate(activeSequence.Session); AnimationSystem.ValidateAnimationType(createType); - this._activeSequence = activeSequence; - this._type = createType; - this._animatableTarget = animatableTarget; - this._rendererProperty = rendererProperty; - this._animation = this._activeSequence.Session.AnimationManager.BuildAnimation(this); - this.CommonCreate(loopCount, stopCmd); + _activeSequence = activeSequence; + _type = createType; + _animatableTarget = animatableTarget; + _rendererProperty = rendererProperty; + _animation = _activeSequence.Session.AnimationManager.BuildAnimation(this); + CommonCreate(loopCount, stopCmd); } private void CommonCreate(int loopCount, StopCommand stopCmd) { - this._animation.RepeatCount = loopCount; - this._animation.AsyncNotifyEvent += new AsyncNotifyHandler(this.OnAsyncNotification); - this._animation.AddStageEvent(AnimationStage.Complete, new AnimationEvent(_animation, "AsyncNotify", 1U)); - this._animation.AddStageEvent(AnimationStage.Reset, new AnimationEvent(_animation, "AsyncNotify", 2U)); - this.SetStopCommand(stopCmd); - this._activeSequence.OnAttachChildAnimation(this); + _animation.RepeatCount = loopCount; + _animation.AsyncNotifyEvent += new AsyncNotifyHandler(OnAsyncNotification); + _animation.AddStageEvent(AnimationStage.Complete, new AnimationEvent(_animation, "AsyncNotify", 1U)); + _animation.AddStageEvent(AnimationStage.Reset, new AnimationEvent(_animation, "AsyncNotify", 2U)); + SetStopCommand(stopCmd); + _activeSequence.OnAttachChildAnimation(this); } protected override void OnDispose() { - this.CleanupWorker(0.0f, false); + CleanupWorker(0.0f, false); base.OnDispose(); } - public UISession Session => this._activeSequence.Session; + public UISession Session => _activeSequence.Session; - public AnimationType Type => this._type; + public AnimationType Type => _type; - public bool HasDynamicKeyframes => this._dynamicFlag; + public bool HasDynamicKeyframes => _dynamicFlag; internal bool DoNotAutoRelease { - get => this._doNotAutoReleaseFlag; - set => this._doNotAutoReleaseFlag = value; + get => _doNotAutoReleaseFlag; + set => _doNotAutoReleaseFlag = value; } public void AddFloatKeyframe(BaseKeyframe keyframe, float value) { - ++this._keyframesValue; + ++_keyframesValue; AnimationInput animationInput1; if (keyframe.IsRelativeToObject) { - this._dynamicFlag = true; - animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); + _dynamicFlag = true; + animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask); if (keyframe.Multiply && value != 1.0) { AnimationInput animationInput2 = new ConstantAnimationInput(value); @@ -91,17 +91,17 @@ namespace Microsoft.Iris.Animations } else animationInput1 = new ConstantAnimationInput(value); - this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); + _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); } public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value) { - ++this._keyframesValue; + ++_keyframesValue; AnimationInput animationInput1; if (keyframe.IsRelativeToObject) { - this._dynamicFlag = true; - animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); + _dynamicFlag = true; + animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask); if (keyframe.Multiply && value != Vector2.UnitVector) { AnimationInput animationInput2 = new ConstantAnimationInput(value); @@ -115,17 +115,17 @@ namespace Microsoft.Iris.Animations } else animationInput1 = new ConstantAnimationInput(value); - this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); + _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); } public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value) { - ++this._keyframesValue; + ++_keyframesValue; AnimationInput animationInput1; if (keyframe.IsRelativeToObject) { - this._dynamicFlag = true; - animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); + _dynamicFlag = true; + animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask); if (keyframe.Multiply && value != Vector3.UnitVector) { AnimationInput animationInput2 = new ConstantAnimationInput(value); @@ -139,17 +139,17 @@ namespace Microsoft.Iris.Animations } else animationInput1 = new ConstantAnimationInput(value); - this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); + _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); } public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value) { - ++this._keyframesValue; + ++_keyframesValue; AnimationInput animationInput1; if (keyframe.IsRelativeToObject) { - this._dynamicFlag = true; - animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); + _dynamicFlag = true; + animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask); if (keyframe.Multiply && value != Vector4.UnitVector) { AnimationInput animationInput2 = new ConstantAnimationInput(value); @@ -163,23 +163,23 @@ namespace Microsoft.Iris.Animations } else animationInput1 = new ConstantAnimationInput(value); - this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); + _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); } public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value) { if (keyframe.Type != AnimationType.Orientation) { - this.AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians)); + AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians)); } else { - ++this._keyframesValue; + ++_keyframesValue; AnimationInput animationInput1; if (keyframe.IsRelativeToObject) { - this._dynamicFlag = true; - animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); + _dynamicFlag = true; + animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask); if (value != Rotation.Default) { AnimationInput animationInput2 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians)); @@ -190,7 +190,7 @@ namespace Microsoft.Iris.Animations animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians)); AnimationInterpolation interpolation = GenerateInterpolation(keyframe.Interpolation); interpolation.UseSphericalCombination = true; - this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation)); + _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation)); } } @@ -199,21 +199,21 @@ namespace Microsoft.Iris.Animations switch (stopCmd) { case StopCommand.LeaveCurrent: - this._animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent; + _animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent; break; case StopCommand.MoveToBegin: - this._animation.ResetBehavior = AnimationResetBehavior.SetInitialValue; + _animation.ResetBehavior = AnimationResetBehavior.SetInitialValue; break; case StopCommand.MoveToEnd: - this._animation.ResetBehavior = AnimationResetBehavior.SetFinalValue; + _animation.ResetBehavior = AnimationResetBehavior.SetFinalValue; break; } - this._animation.AutoReset = true; + _animation.AutoReset = true; } public bool ValidatePlayable() { - if (this._keyframesValue >= 2) + if (_keyframesValue >= 2) return true; ErrorManager.ReportError("Animations must have at least 2 keyframes to play"); return false; @@ -221,50 +221,50 @@ namespace Microsoft.Iris.Animations public void Play() { - if (!this.ValidatePlayable()) + if (!ValidatePlayable()) return; - if (!this._activeSequence.Session.AnimationManager.CanPlayAnimationType(this._type)) + if (!_activeSequence.Session.AnimationManager.CanPlayAnimationType(_type)) { - this.Cleanup(0.0f, true); + Cleanup(0.0f, true); } else { - if (this._playingFlag || this._animation == null || !this.Session.IsValid) + if (_playingFlag || _animation == null || !Session.IsValid) return; - this._animation.AddTarget(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.TargetMask); - this._animation.Play(); - this._playingFlag = true; + _animation.AddTarget(_animatableTarget, _rendererProperty.Property, _rendererProperty.TargetMask); + _animation.Play(); + _playingFlag = true; } } - public void Stop() => this.StopWorker(false, StopCommand.MoveToEnd); + public void Stop() => StopWorker(false, StopCommand.MoveToEnd); - public void Stop(StopCommand stopCommand) => this.StopWorker(true, stopCommand); + public void Stop(StopCommand stopCommand) => StopWorker(true, stopCommand); private void StopWorker(bool stopCommandFlag, StopCommand stopCommand) { - if (!this._playingFlag) + if (!_playingFlag) return; - this._playingFlag = false; - if (this._animation == null || !this.Session.IsValid) + _playingFlag = false; + if (_animation == null || !Session.IsValid) return; if (stopCommandFlag) - this.SetStopCommand(stopCommand); - this._animation.Reset(); - this._animation.RemoveAllTargets(); + SetStopCommand(stopCommand); + _animation.Reset(); + _animation.RemoveAllTargets(); } private void Cleanup(float progress, bool forceDeferFlag) { - if (this._animation == null) + if (_animation == null) return; if (UIDispatcher.IsUIThread && !forceDeferFlag) { - this.CleanupWorker(progress, true); + CleanupWorker(progress, true); } else { - if (!this.Session.IsValid) + if (!Session.IsValid) return; DeferredCall.Post(DispatchPriority.Housekeeping, s_deferredCleanupWorker, this); } @@ -272,17 +272,17 @@ namespace Microsoft.Iris.Animations private void CleanupWorker(float progress, bool withNotifications) { - this._playingFlag = false; - if (this._animation != null) + _playingFlag = false; + if (_animation != null) { - this._animation.AsyncNotifyEvent -= new AsyncNotifyHandler(this.OnAsyncNotification); - this._animation.UnregisterUsage(this); - this._animation = null; + _animation.AsyncNotifyEvent -= new AsyncNotifyHandler(OnAsyncNotification); + _animation.UnregisterUsage(this); + _animation = null; } - this._animatableTarget = null; + _animatableTarget = null; if (!withNotifications) return; - this._activeSequence.OnDetachChildAnimation(this, progress); + _activeSequence.OnDetachChildAnimation(this, progress); } private static void DeferredCleanupWorker(object args) => (args as AnimationProxy).CleanupWorker(0.0f, true); @@ -322,10 +322,10 @@ namespace Microsoft.Iris.Animations switch (nCookie) { case 1: - this.Cleanup(0.0f, false); + Cleanup(0.0f, false); break; case 2: - this.Cleanup(0.0f, false); + Cleanup(0.0f, false); break; } } diff --git a/UIX/Microsoft/Iris/Animations/AnimationTemplate.cs b/UIX/Microsoft/Iris/Animations/AnimationTemplate.cs index 1b38dd6..7661675 100644 --- a/UIX/Microsoft/Iris/Animations/AnimationTemplate.cs +++ b/UIX/Microsoft/Iris/Animations/AnimationTemplate.cs @@ -29,28 +29,28 @@ namespace Microsoft.Iris.Animations public AnimationTemplate(string debugIDName) { - this._keyframesList = new List(); - this.DebugID = debugIDName; + _keyframesList = new List(); + DebugID = debugIDName; } public string DebugID { - get => this._debugIDName; - set => this._debugIDName = value; + get => _debugIDName; + set => _debugIDName = value; } public int Loop { - get => this._loopCount; - set => this._loopCount = value; + get => _loopCount; + set => _loopCount = value; } - public List Keyframes => this._keyframesList; + public List Keyframes => _keyframesList; public ActiveSequence Play(ViewItem vi) { AnimationArgs args = new AnimationArgs(vi); - return this.Play(vi.RendererVisual, ref args, null); + return Play(vi.RendererVisual, ref args, null); } public ActiveSequence Play( @@ -58,7 +58,7 @@ namespace Microsoft.Iris.Animations ref AnimationArgs args, EventHandler onCompleteHandler) { - ActiveSequence instance = this.CreateInstance(visualTarget, ref args); + ActiveSequence instance = CreateInstance(visualTarget, ref args); if (onCompleteHandler != null) instance.AnimationCompleted += onCompleteHandler; instance.Play(); @@ -70,7 +70,7 @@ namespace Microsoft.Iris.Animations string property, ref AnimationArgs args) { - if (this._keyframesList.Count == 0) + if (_keyframesList.Count == 0) { ErrorManager.ReportError("Animations must have at least 2 keyframes to play"); return null; @@ -79,7 +79,7 @@ namespace Microsoft.Iris.Animations AnimationProxy[] animationProxyArray = new AnimationProxy[20]; int[] numArray = new int[20]; bool[] flagArray = new bool[20]; - foreach (BaseKeyframe keyframes in this._keyframesList) + foreach (BaseKeyframe keyframes in _keyframesList) { int type = (int)keyframes.Type; keyframes.AddtoAnimation(this, aseq, property, ref args, ref animationProxyArray[type]); @@ -110,17 +110,17 @@ namespace Microsoft.Iris.Animations IAnimatable animatableTarget, ref AnimationArgs args) { - return this.CreateInstance(animatableTarget, null, ref args); + return CreateInstance(animatableTarget, null, ref args); } - public void AddKeyframe(BaseKeyframe key) => this.InsertSorted(key); + public void AddKeyframe(BaseKeyframe key) => InsertSorted(key); public BaseKeyframe GetKeyframe(float time) { - int count = this._keyframesList.Count; + int count = _keyframesList.Count; for (int index = 0; index < count; ++index) { - BaseKeyframe keyframes = this._keyframesList[index]; + BaseKeyframe keyframes = _keyframesList[index]; if (IsSameTime(time, keyframes.Time)) return keyframes; } @@ -129,58 +129,58 @@ namespace Microsoft.Iris.Animations public void RemoveKeyframe(float time) { - BaseKeyframe keyframe = this.GetKeyframe(time); + BaseKeyframe keyframe = GetKeyframe(time); if (keyframe == null) return; - this._keyframesList.Remove(keyframe); + _keyframesList.Remove(keyframe); } public StopCommand GetStopCommand(AnimationType paramType) { AnimationSystem.ValidateAnimationType(paramType); StopCommand stopCommand = StopCommand.MoveToEnd; - if (this._StopCommandSet != null) - stopCommand = this._StopCommandSet[paramType]; + if (_StopCommandSet != null) + stopCommand = _StopCommandSet[paramType]; return stopCommand; } public void SetStopCommand(AnimationType paramType, StopCommand command) { AnimationSystem.ValidateAnimationType(paramType); - if (this._StopCommandSet == null) - this._StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd); - this._StopCommandSet[paramType] = command; + if (_StopCommandSet == null) + _StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd); + _StopCommandSet[paramType] = command; } - object ICloneable.Clone() => this.Clone(); + object ICloneable.Clone() => Clone(); public virtual object Clone() { - AnimationTemplate anim = new AnimationTemplate(this._debugIDName); - this.CloneWorker(anim); + AnimationTemplate anim = new AnimationTemplate(_debugIDName); + CloneWorker(anim); return anim; } protected virtual void CloneWorker(AnimationTemplate anim) { - anim._loopCount = this._loopCount; - int count = this._keyframesList.Count; + anim._loopCount = _loopCount; + int count = _keyframesList.Count; for (int index = 0; index < count; ++index) - anim._keyframesList.Add(this._keyframesList[index].Clone()); - anim._debugIDName = this._debugIDName; + anim._keyframesList.Add(_keyframesList[index].Clone()); + anim._debugIDName = _debugIDName; } private void InsertSorted(BaseKeyframe key) { - for (int index = this._keyframesList.Count - 1; index >= 0; --index) + for (int index = _keyframesList.Count - 1; index >= 0; --index) { if (_keyframesList[index].Time < (double)key.Time) { - this._keyframesList.Insert(index + 1, key); + _keyframesList.Insert(index + 1, key); return; } } - this._keyframesList.Insert(0, key); + _keyframesList.Insert(0, key); } private static bool IsSameTime(float t1, float t2) diff --git a/UIX/Microsoft/Iris/Animations/BaseFloatKeyframe.cs b/UIX/Microsoft/Iris/Animations/BaseFloatKeyframe.cs index 50bc180..54b665b 100644 --- a/UIX/Microsoft/Iris/Animations/BaseFloatKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseFloatKeyframe.cs @@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations AnimationProxy animation, ref AnimationArgs args) { - float effectiveValue = this.GetEffectiveValue(targetObject, this._value, ref args); + float effectiveValue = GetEffectiveValue(targetObject, _value, ref args); animation.AddFloatKeyframe(this, effectiveValue); } public float Value { - get => this._value; - set => this._value = value; + get => _value; + set => _value = value; } public override object ObjectValue => Value; @@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) { - float effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._value, ref args); - this.Apply(animationTarget, effectiveValue); + float effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _value, ref args); + Apply(animationTarget, effectiveValue); } public abstract void Apply(IAnimatableOwner animationTarget, float value); - public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue; + public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue; } } diff --git a/UIX/Microsoft/Iris/Animations/BaseKeyframe.cs b/UIX/Microsoft/Iris/Animations/BaseKeyframe.cs index 2b10075..1838abe 100644 --- a/UIX/Microsoft/Iris/Animations/BaseKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseKeyframe.cs @@ -44,8 +44,8 @@ namespace Microsoft.Iris.Animations public BaseKeyframe(float timeValue) { - this._timeValue = timeValue; - this._relative = RelativeTo.Final; + _timeValue = timeValue; + _relative = RelativeTo.Final; } public void AddtoAnimation( @@ -56,8 +56,8 @@ namespace Microsoft.Iris.Animations ref AnimationProxy animation) { if (animation == null) - animation = this.CreateProxy(anim, aseq, property); - this.PopulateAnimationWorker(aseq.Target, animation, ref args); + animation = CreateProxy(anim, aseq, property); + PopulateAnimationWorker(aseq.Target, animation, ref args); } protected virtual AnimationProxy CreateProxy( @@ -65,14 +65,14 @@ namespace Microsoft.Iris.Animations ActiveSequence aseq, string property) { - StopCommand stopCommand = anim.GetStopCommand(this.Type); - RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)this.Type]; - return new AnimationProxy(aseq, aseq.Target, this.Type, rendererProperty, anim.Loop, stopCommand); + StopCommand stopCommand = anim.GetStopCommand(Type); + RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)Type]; + return new AnimationProxy(aseq, aseq.Target, Type, rendererProperty, anim.Loop, stopCommand); } - public BaseKeyframe Clone() => (BaseKeyframe)this.MemberwiseClone(); + public BaseKeyframe Clone() => (BaseKeyframe)MemberwiseClone(); - object ICloneable.Clone() => this.Clone(); + object ICloneable.Clone() => Clone(); protected abstract void PopulateAnimationWorker( IAnimatable targetObject, @@ -81,22 +81,22 @@ namespace Microsoft.Iris.Animations public float Time { - get => this._timeValue; - set => this._timeValue = value; + get => _timeValue; + set => _timeValue = value; } public RelativeTo RelativeTo { - get => this._relative == null ? RelativeTo.Absolute : this._relative; - set => this._relative = value; + get => _relative == null ? RelativeTo.Absolute : _relative; + set => _relative = value; } - public bool IsRelativeToObject => this.RelativeTo.IsRelativeToObject; + public bool IsRelativeToObject => RelativeTo.IsRelativeToObject; public Interpolation Interpolation { - get => this._interpolation; - set => this._interpolation = value; + get => _interpolation; + set => _interpolation = value; } public abstract AnimationType Type { get; } @@ -113,24 +113,24 @@ namespace Microsoft.Iris.Animations { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<"); - stringBuilder.Append(this.GetType().Name); + stringBuilder.Append(GetType().Name); stringBuilder.Append(" Time=\""); - stringBuilder.Append(this._timeValue); + stringBuilder.Append(_timeValue); stringBuilder.Append("\""); - if (this._interpolation != null) + if (_interpolation != null) { stringBuilder.Append(" Interpolation=\""); - stringBuilder.Append(this._interpolation.ToString()); + stringBuilder.Append(_interpolation.ToString()); stringBuilder.Append("\""); } - if (this._relative != RelativeTo.Absolute) + if (_relative != RelativeTo.Absolute) { stringBuilder.Append(" RelativeTo=\""); stringBuilder.Append(_relative); stringBuilder.Append("\""); } stringBuilder.Append(" Value=\""); - stringBuilder.Append(this.ObjectValue); + stringBuilder.Append(ObjectValue); stringBuilder.Append("\""); stringBuilder.Append("/>"); return stringBuilder.ToString(); diff --git a/UIX/Microsoft/Iris/Animations/BaseMultiplyFloatKeyframe.cs b/UIX/Microsoft/Iris/Animations/BaseMultiplyFloatKeyframe.cs index 5b896eb..b73d8a7 100644 --- a/UIX/Microsoft/Iris/Animations/BaseMultiplyFloatKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseMultiplyFloatKeyframe.cs @@ -8,7 +8,7 @@ namespace Microsoft.Iris.Animations { internal abstract class BaseMultiplyFloatKeyframe : BaseFloatKeyframe { - public BaseMultiplyFloatKeyframe() => this.Value = 1f; + public BaseMultiplyFloatKeyframe() => Value = 1f; public override bool Multiply => true; } diff --git a/UIX/Microsoft/Iris/Animations/BaseMultiplyVector3Keyframe.cs b/UIX/Microsoft/Iris/Animations/BaseMultiplyVector3Keyframe.cs index 0c8c362..6b60ab3 100644 --- a/UIX/Microsoft/Iris/Animations/BaseMultiplyVector3Keyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseMultiplyVector3Keyframe.cs @@ -10,7 +10,7 @@ namespace Microsoft.Iris.Animations { internal abstract class BaseMultiplyVector3Keyframe : BaseVector3Keyframe { - public BaseMultiplyVector3Keyframe() => this.Value = Vector3.UnitVector; + public BaseMultiplyVector3Keyframe() => Value = Vector3.UnitVector; public override bool Multiply => true; @@ -19,8 +19,8 @@ namespace Microsoft.Iris.Animations Vector3 baseValueVector, ref AnimationArgs args) { - if (this.RelativeTo == RelativeTo.Final) - baseValueVector *= this.GetRelativeToFinalValue(targetObject, ref args); + if (RelativeTo == RelativeTo.Final) + baseValueVector *= GetRelativeToFinalValue(targetObject, ref args); return baseValueVector; } diff --git a/UIX/Microsoft/Iris/Animations/BaseRotationKeyframe.cs b/UIX/Microsoft/Iris/Animations/BaseRotationKeyframe.cs index 49d7b74..c64d273 100644 --- a/UIX/Microsoft/Iris/Animations/BaseRotationKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseRotationKeyframe.cs @@ -13,21 +13,21 @@ namespace Microsoft.Iris.Animations { private Rotation _valueRotation; - public BaseRotationKeyframe() => this._valueRotation = Rotation.Default; + public BaseRotationKeyframe() => _valueRotation = Rotation.Default; protected override void PopulateAnimationWorker( IAnimatable targetObject, AnimationProxy animation, ref AnimationArgs args) { - Rotation effectiveValue = this.GetEffectiveValue(targetObject, this._valueRotation, ref args); + Rotation effectiveValue = GetEffectiveValue(targetObject, _valueRotation, ref args); animation.AddRotationKeyframe(this, effectiveValue); } public Rotation Value { - get => this._valueRotation; - set => this._valueRotation = value; + get => _valueRotation; + set => _valueRotation = value; } public override object ObjectValue => Value; @@ -42,8 +42,8 @@ namespace Microsoft.Iris.Animations public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) { - Rotation effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueRotation, ref args); - this.Apply(animationTarget, effectiveValue); + Rotation effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueRotation, ref args); + Apply(animationTarget, effectiveValue); } public abstract void Apply(IAnimatableOwner animationTarget, Rotation valueRotation); diff --git a/UIX/Microsoft/Iris/Animations/BaseVector2Keyframe.cs b/UIX/Microsoft/Iris/Animations/BaseVector2Keyframe.cs index e38ae17..21ec65d 100644 --- a/UIX/Microsoft/Iris/Animations/BaseVector2Keyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseVector2Keyframe.cs @@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations AnimationProxy animation, ref AnimationArgs args) { - Vector2 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args); + Vector2 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args); animation.AddVector2Keyframe(this, effectiveValue); } public Vector2 Value { - get => this._valueVector; - set => this._valueVector = value; + get => _valueVector; + set => _valueVector = value; } public override object ObjectValue => Value; @@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) { - Vector2 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args); - this.Apply(animationTarget, effectiveValue); + Vector2 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args); + Apply(animationTarget, effectiveValue); } public abstract void Apply(IAnimatableOwner animationTarget, Vector2 valueVector); - public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue; + public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue; } } diff --git a/UIX/Microsoft/Iris/Animations/BaseVector3Keyframe.cs b/UIX/Microsoft/Iris/Animations/BaseVector3Keyframe.cs index 9752efa..54f3fa9 100644 --- a/UIX/Microsoft/Iris/Animations/BaseVector3Keyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseVector3Keyframe.cs @@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations AnimationProxy animation, ref AnimationArgs args) { - Vector3 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args); + Vector3 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args); animation.AddVector3Keyframe(this, effectiveValue); } public Vector3 Value { - get => this._valueVector; - set => this._valueVector = value; + get => _valueVector; + set => _valueVector = value; } public override object ObjectValue => Value; @@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) { - Vector3 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args); - this.Apply(animationTarget, effectiveValue); + Vector3 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args); + Apply(animationTarget, effectiveValue); } public abstract void Apply(IAnimatableOwner animationTarget, Vector3 valueVector); - public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue; + public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue; } } diff --git a/UIX/Microsoft/Iris/Animations/BaseVector4Keyframe.cs b/UIX/Microsoft/Iris/Animations/BaseVector4Keyframe.cs index fc30334..71595a9 100644 --- a/UIX/Microsoft/Iris/Animations/BaseVector4Keyframe.cs +++ b/UIX/Microsoft/Iris/Animations/BaseVector4Keyframe.cs @@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations AnimationProxy animation, ref AnimationArgs args) { - Vector4 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args); + Vector4 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args); animation.AddVector4Keyframe(this, effectiveValue); } public Vector4 Value { - get => this._valueVector; - set => this._valueVector = value; + get => _valueVector; + set => _valueVector = value; } public override object ObjectValue => Value; @@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) { - Vector4 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args); - this.Apply(animationTarget, effectiveValue); + Vector4 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args); + Apply(animationTarget, effectiveValue); } public abstract void Apply(IAnimatableOwner animationTarget, Vector4 valueVector); - public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue; + public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue; } } diff --git a/UIX/Microsoft/Iris/Animations/CameraZnKeyframe.cs b/UIX/Microsoft/Iris/Animations/CameraZnKeyframe.cs index ecaec44..128551a 100644 --- a/UIX/Microsoft/Iris/Animations/CameraZnKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/CameraZnKeyframe.cs @@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - if (this.RelativeTo == RelativeTo.Final) + if (RelativeTo == RelativeTo.Final) baseValue *= args.NewZn; return baseValue; } diff --git a/UIX/Microsoft/Iris/Animations/EffectColorKeyframe.cs b/UIX/Microsoft/Iris/Animations/EffectColorKeyframe.cs index 98946f5..d13e0cd 100644 --- a/UIX/Microsoft/Iris/Animations/EffectColorKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/EffectColorKeyframe.cs @@ -19,8 +19,8 @@ namespace Microsoft.Iris.Animations public Color Color { - get => new Color(this.Value.W, this.Value.X, this.Value.Y, this.Value.Z); - set => this.Value = value.RenderConvert().ToVector4(); + get => new Color(Value.W, Value.X, Value.Y, Value.Z); + set => Value = value.RenderConvert().ToVector4(); } } } diff --git a/UIX/Microsoft/Iris/Animations/Interpolation.cs b/UIX/Microsoft/Iris/Animations/Interpolation.cs index 031a4f8..1071dc1 100644 --- a/UIX/Microsoft/Iris/Animations/Interpolation.cs +++ b/UIX/Microsoft/Iris/Animations/Interpolation.cs @@ -20,42 +20,42 @@ namespace Microsoft.Iris.Animations { } - public Interpolation(InterpolationType type) => this._type = type; + public Interpolation(InterpolationType type) => _type = type; public InterpolationType Type { - get => this._type; - set => this._type = value; + get => _type; + set => _type = value; } public float Weight { - get => this._weight; - set => this._weight = value; + get => _weight; + set => _weight = value; } public float BezierHandle1 { - get => this._bezierHandle1; - set => this._bezierHandle1 = value; + get => _bezierHandle1; + set => _bezierHandle1 = value; } public float BezierHandle2 { - get => this._bezierHandle2; - set => this._bezierHandle2 = value; + get => _bezierHandle2; + set => _bezierHandle2 = value; } public float EasePercent { - get => this._easePercent; - set => this._easePercent = value; + get => _easePercent; + set => _easePercent = value; } public override string ToString() { string str; - switch (this.Type) + switch (Type) { case InterpolationType.SCurve: str = "SCurve"; @@ -96,11 +96,11 @@ namespace Microsoft.Iris.Animations if (obj is Interpolation) { Interpolation interpolation = (Interpolation)obj; - flag = this._type == interpolation._type && _weight == (double)interpolation._weight && (_bezierHandle1 == (double)interpolation._bezierHandle1 && _bezierHandle2 == (double)interpolation._bezierHandle2) && _easePercent == (double)interpolation._easePercent; + flag = _type == interpolation._type && _weight == (double)interpolation._weight && (_bezierHandle1 == (double)interpolation._bezierHandle1 && _bezierHandle2 == (double)interpolation._bezierHandle2) && _easePercent == (double)interpolation._easePercent; } return flag; } - public override int GetHashCode() => this._type.GetHashCode() ^ this._weight.GetHashCode() ^ this._bezierHandle1.GetHashCode() ^ this._bezierHandle2.GetHashCode() ^ this._easePercent.GetHashCode(); + public override int GetHashCode() => _type.GetHashCode() ^ _weight.GetHashCode() ^ _bezierHandle1.GetHashCode() ^ _bezierHandle2.GetHashCode() ^ _easePercent.GetHashCode(); } } diff --git a/UIX/Microsoft/Iris/Animations/MergeAnimation.cs b/UIX/Microsoft/Iris/Animations/MergeAnimation.cs index 1777600..9dee766 100644 --- a/UIX/Microsoft/Iris/Animations/MergeAnimation.cs +++ b/UIX/Microsoft/Iris/Animations/MergeAnimation.cs @@ -18,36 +18,36 @@ namespace Microsoft.Iris.Animations { get { - if (this._sourcesList == null) - this._sourcesList = new List(); - return this._sourcesList; + if (_sourcesList == null) + _sourcesList = new List(); + return _sourcesList; } set { - this._sourcesList = value; - this.ClearCache(); + _sourcesList = value; + ClearCache(); } } public AnimationEventType Type { - get => this._type; + get => _type; set { - this._type = value; - this.ClearCache(); + _type = value; + ClearCache(); } } public AnimationTemplate Build(ref AnimationArgs args) { - if (this._cacheAnimation != null) + if (_cacheAnimation != null) return _cacheAnimation; Animation animation = new Animation(); - animation.Type = this._type; + animation.Type = _type; animation.DebugID = "Merge("; bool flag1 = true; - foreach (IAnimationProvider sources in this._sourcesList) + foreach (IAnimationProvider sources in _sourcesList) { AnimationTemplate anim = sources.Build(ref args); if (anim != null) @@ -74,18 +74,18 @@ namespace Microsoft.Iris.Animations } animation.DebugID += ")"; TransformAnimation.DumpAnimation(animation, "Result"); - if (this.CanCache) - this._cacheAnimation = animation; + if (CanCache) + _cacheAnimation = animation; return animation; } - protected void ClearCache() => this._cacheAnimation = null; + protected void ClearCache() => _cacheAnimation = null; public bool CanCache { get { - foreach (IAnimationProvider sources in this._sourcesList) + foreach (IAnimationProvider sources in _sourcesList) { if (!sources.CanCache) return false; diff --git a/UIX/Microsoft/Iris/Animations/OrphanedVisualCollection.cs b/UIX/Microsoft/Iris/Animations/OrphanedVisualCollection.cs index 6bbfef7..7a4211a 100644 --- a/UIX/Microsoft/Iris/Animations/OrphanedVisualCollection.cs +++ b/UIX/Microsoft/Iris/Animations/OrphanedVisualCollection.cs @@ -19,43 +19,43 @@ namespace Microsoft.Iris.Animations public OrphanedVisualCollection(AnimationManager aniManager) { - this.DeclareOwner(aniManager); - this._orphansList = new Vector(); - this._sequenceList = new Vector(); - this._animationManager = aniManager; - this._countEventsRemaining = 1; - this._animationManager.RegisterAnimatedOrphans(this); + DeclareOwner(aniManager); + _orphansList = new Vector(); + _sequenceList = new Vector(); + _animationManager = aniManager; + _countEventsRemaining = 1; + _animationManager.RegisterAnimatedOrphans(this); } protected override void OnDispose() { - foreach (ActiveSequence sequence in this._sequenceList) + foreach (ActiveSequence sequence in _sequenceList) { sequence.Stop(); sequence.Dispose(this); } - this._sequenceList.Clear(); - foreach (IVisual orphans in this._orphansList) + _sequenceList.Clear(); + foreach (IVisual orphans in _orphansList) { orphans.Remove(); orphans.UnregisterUsage(this); } - this._orphansList.Clear(); - this._animationManager = null; + _orphansList.Clear(); + _animationManager = null; base.OnDispose(); } public void AddOrphan(IVisual visual) { visual.RegisterUsage(this); - this._orphansList.Add(visual); + _orphansList.Add(visual); } public void RegisterWaitForAnimation(ActiveSequence aseq, bool transfer) { - aseq.AnimationCompleted += new EventHandler(this.OnDestroyAnimationComplete); - ++this._countEventsRemaining; - this.RegisterAnimation(aseq, transfer); + aseq.AnimationCompleted += new EventHandler(OnDestroyAnimationComplete); + ++_countEventsRemaining; + RegisterAnimation(aseq, transfer); } public void RegisterAnimation(ActiveSequence aseq, bool transfer) @@ -64,32 +64,32 @@ namespace Microsoft.Iris.Animations aseq.TransferOwnership(this); else aseq.DeclareOwner(this); - this._sequenceList.Add(aseq); + _sequenceList.Add(aseq); } - public void OnLayoutApplyComplete() => this.OnEventComplete(null, EventArgs.Empty); + public void OnLayoutApplyComplete() => OnEventComplete(null, EventArgs.Empty); private void OnDestroyAnimationComplete(object sender, EventArgs args) { ActiveSequence activeSequence = sender as ActiveSequence; - activeSequence.AnimationCompleted -= new EventHandler(this.OnDestroyAnimationComplete); - this._sequenceList.Remove(activeSequence); + activeSequence.AnimationCompleted -= new EventHandler(OnDestroyAnimationComplete); + _sequenceList.Remove(activeSequence); activeSequence.Dispose(this); - this.OnEventComplete(sender, args); + OnEventComplete(sender, args); } private void OnEventComplete(object sender, EventArgs args) { - --this._countEventsRemaining; - if (this.Waiting) + --_countEventsRemaining; + if (Waiting) return; - if (this._animationManager != null) - this._animationManager.UnregisterAnimatedOrphans(this); - this.Dispose(_animationManager); + if (_animationManager != null) + _animationManager.UnregisterAnimatedOrphans(this); + Dispose(_animationManager); } - public bool Waiting => this._countEventsRemaining > 0; + public bool Waiting => _countEventsRemaining > 0; - public override string ToString() => InvariantString.Format("Orphans(WaitCount={0}, OrphanCount={1})", this._sequenceList != null ? this._sequenceList.Count.ToString() : "None", _orphansList.Count); + public override string ToString() => InvariantString.Format("Orphans(WaitCount={0}, OrphanCount={1})", _sequenceList != null ? _sequenceList.Count.ToString() : "None", _orphansList.Count); } } diff --git a/UIX/Microsoft/Iris/Animations/PositionKeyframe.cs b/UIX/Microsoft/Iris/Animations/PositionKeyframe.cs index 1ed565a..de207a4 100644 --- a/UIX/Microsoft/Iris/Animations/PositionKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/PositionKeyframe.cs @@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations Vector3 baseValueVector, ref AnimationArgs args) { - return GetEffectivePositionValue(this.RelativeTo, targetObject, baseValueVector, ref args); + return GetEffectivePositionValue(RelativeTo, targetObject, baseValueVector, ref args); } public static Vector3 GetEffectivePositionValue( diff --git a/UIX/Microsoft/Iris/Animations/PositionXKeyframe.cs b/UIX/Microsoft/Iris/Animations/PositionXKeyframe.cs index 4353012..a0caff2 100644 --- a/UIX/Microsoft/Iris/Animations/PositionXKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/PositionXKeyframe.cs @@ -25,7 +25,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return PositionKeyframe.GetEffectivePositionValue(this.RelativeTo, targetObject, new Vector3(baseValue, 0.0f, 0.0f), ref args).X; + return PositionKeyframe.GetEffectivePositionValue(RelativeTo, targetObject, new Vector3(baseValue, 0.0f, 0.0f), ref args).X; } } } diff --git a/UIX/Microsoft/Iris/Animations/PositionYKeyframe.cs b/UIX/Microsoft/Iris/Animations/PositionYKeyframe.cs index 6405298..3a4d06a 100644 --- a/UIX/Microsoft/Iris/Animations/PositionYKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/PositionYKeyframe.cs @@ -25,7 +25,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return PositionKeyframe.GetEffectivePositionValue(this.RelativeTo, targetObject, new Vector3(0.0f, baseValue, 0.0f), ref args).Y; + return PositionKeyframe.GetEffectivePositionValue(RelativeTo, targetObject, new Vector3(0.0f, baseValue, 0.0f), ref args).Y; } } } diff --git a/UIX/Microsoft/Iris/Animations/ReferenceAnimation.cs b/UIX/Microsoft/Iris/Animations/ReferenceAnimation.cs index 17cfa8c..34e8f38 100644 --- a/UIX/Microsoft/Iris/Animations/ReferenceAnimation.cs +++ b/UIX/Microsoft/Iris/Animations/ReferenceAnimation.cs @@ -14,13 +14,13 @@ namespace Microsoft.Iris.Animations public IAnimationProvider Source { - get => this._sourceAnimation; + get => _sourceAnimation; set { - if (this._sourceAnimation == value) + if (_sourceAnimation == value) return; - this._sourceAnimation = value; - this.OnSourceChanged(); + _sourceAnimation = value; + OnSourceChanged(); } } @@ -28,14 +28,14 @@ namespace Microsoft.Iris.Animations { } - public AnimationEventType Type => this._sourceAnimation != null ? this._sourceAnimation.Type : AnimationEventType.Idle; + public AnimationEventType Type => _sourceAnimation != null ? _sourceAnimation.Type : AnimationEventType.Idle; - public AnimationTemplate Build(ref AnimationArgs args) => this.BuildWorker(ref args); + public AnimationTemplate Build(ref AnimationArgs args) => BuildWorker(ref args); - protected virtual AnimationTemplate BuildWorker(ref AnimationArgs args) => this._sourceAnimation.Build(ref args); + protected virtual AnimationTemplate BuildWorker(ref AnimationArgs args) => _sourceAnimation.Build(ref args); - public override string ToString() => InvariantString.Format("{0}({1})", this.GetType().Name, Source); + public override string ToString() => InvariantString.Format("{0}({1})", GetType().Name, Source); - public virtual bool CanCache => this._sourceAnimation == null || this._sourceAnimation.CanCache; + public virtual bool CanCache => _sourceAnimation == null || _sourceAnimation.CanCache; } } diff --git a/UIX/Microsoft/Iris/Animations/RelativeTo.cs b/UIX/Microsoft/Iris/Animations/RelativeTo.cs index 1605934..7a58cd8 100644 --- a/UIX/Microsoft/Iris/Animations/RelativeTo.cs +++ b/UIX/Microsoft/Iris/Animations/RelativeTo.cs @@ -22,52 +22,52 @@ namespace Microsoft.Iris.Animations private static RelativeTo s_currentSnapshotOnLoop = new RelativeTo(SnapshotPolicy.OnLoop); private static RelativeTo s_final = new RelativeTo(); - public RelativeTo() => this._snapshot = SnapshotPolicy.Continuous; + public RelativeTo() => _snapshot = SnapshotPolicy.Continuous; - public RelativeTo(SnapshotPolicy snapshot) => this._snapshot = snapshot; + public RelativeTo(SnapshotPolicy snapshot) => _snapshot = snapshot; - public bool IsRelativeToObject => this._sourceObject != null || this._sourceId != 0 || this == s_current || this == s_currentSnapshotOnLoop; + public bool IsRelativeToObject => _sourceObject != null || _sourceId != 0 || this == s_current || this == s_currentSnapshotOnLoop; public IAnimatable Source { - get => this._sourceObject; - set => this._sourceObject = value; + get => _sourceObject; + set => _sourceObject = value; } public int SourceId { - get => this._sourceId; - set => this._sourceId = value; + get => _sourceId; + set => _sourceId = value; } public string Property { - get => this._sourceProperty; - set => this._sourceProperty = value; + get => _sourceProperty; + set => _sourceProperty = value; } public SnapshotPolicy Snapshot { - get => this._snapshot; - set => this._snapshot = value; + get => _snapshot; + set => _snapshot = value; } public int Power { - get => this._power; - set => this._power = value; + get => _power; + set => _power = value; } public float Multiply { - get => this._multiply; - set => this._multiply = value; + get => _multiply; + set => _multiply = value; } public float Add { - get => this._add; - set => this._add = value; + get => _add; + set => _add = value; } public static RelativeTo Absolute => s_absolute; @@ -87,12 +87,12 @@ namespace Microsoft.Iris.Animations string sourcePropertyName = null; string sourceMaskSpec = null; bool flag = true; - if (this._sourceProperty != null) + if (_sourceProperty != null) { - sourceObject = this._sourceId == 0 ? this._sourceObject : Application.MapExternalAnimationInput(this._sourceId); + sourceObject = _sourceId == 0 ? _sourceObject : Application.MapExternalAnimationInput(_sourceId); if (sourceObject != null) { - sourcePropertyName = this._sourceProperty; + sourcePropertyName = _sourceProperty; flag = false; } } @@ -103,24 +103,24 @@ namespace Microsoft.Iris.Animations sourceMaskSpec = defaultSourcePropertyMask; } AnimationInput animationInput1; - if (this.Snapshot == SnapshotPolicy.Continuous) + if (Snapshot == SnapshotPolicy.Continuous) { animationInput1 = new ContinuousAnimationInput(sourceObject, sourcePropertyName, sourceMaskSpec); } else { CapturedAnimationInput capturedAnimationInput = new CapturedAnimationInput(sourceObject, sourcePropertyName, sourceMaskSpec); - if (this.Snapshot == SnapshotPolicy.OnLoop) + if (Snapshot == SnapshotPolicy.OnLoop) capturedAnimationInput.RefreshOnRepeat = true; animationInput1 = capturedAnimationInput; } AnimationInput animationInput2 = animationInput1; - for (int index = 1; index < this._power; ++index) + for (int index = 1; index < _power; ++index) animationInput2 *= animationInput1; if (_multiply != 1.0) - animationInput2 *= new ConstantAnimationInput(this._multiply); + animationInput2 *= new ConstantAnimationInput(_multiply); if (_add != 0.0) - animationInput2 += new ConstantAnimationInput(this._add); + animationInput2 += new ConstantAnimationInput(_add); return animationInput2; } @@ -132,7 +132,7 @@ namespace Microsoft.Iris.Animations return "Current"; if (this == s_currentSnapshotOnLoop) return "CurrentSnapshotOnLoop"; - return this == s_final ? "Final" : string.Format("[Object = {0}, Property = {1}]", this._sourceObject != null ? _sourceObject : (object)this._sourceId, _sourceProperty); + return this == s_final ? "Final" : string.Format("[Object = {0}, Property = {1}]", _sourceObject != null ? _sourceObject : (object)_sourceId, _sourceProperty); } } } diff --git a/UIX/Microsoft/Iris/Animations/RendererProperty.cs b/UIX/Microsoft/Iris/Animations/RendererProperty.cs index 88a946b..869ae8b 100644 --- a/UIX/Microsoft/Iris/Animations/RendererProperty.cs +++ b/UIX/Microsoft/Iris/Animations/RendererProperty.cs @@ -14,22 +14,22 @@ namespace Microsoft.Iris.Animations public RendererProperty(string property) { - this._property = property; - this._sourceMask = null; - this._targetMask = null; + _property = property; + _sourceMask = null; + _targetMask = null; } public RendererProperty(string property, string sourceMask, string targetMask) { - this._property = property; - this._sourceMask = sourceMask; - this._targetMask = targetMask; + _property = property; + _sourceMask = sourceMask; + _targetMask = targetMask; } - public string Property => this._property; + public string Property => _property; - public string SourceMask => this._sourceMask; + public string SourceMask => _sourceMask; - public string TargetMask => this._targetMask; + public string TargetMask => _targetMask; } } diff --git a/UIX/Microsoft/Iris/Animations/RotateKeyframe.cs b/UIX/Microsoft/Iris/Animations/RotateKeyframe.cs index c8fd2db..dab6858 100644 --- a/UIX/Microsoft/Iris/Animations/RotateKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/RotateKeyframe.cs @@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations Rotation baseValueRotation, ref AnimationArgs args) { - if (this.RelativeTo == RelativeTo.Final) + if (RelativeTo == RelativeTo.Final) baseValueRotation.AngleRadians += args.NewRotation.AngleRadians; if (UISession.Default.IsRtl && baseValueRotation.Axis.Y <= 0.0 && baseValueRotation.Axis.X <= 0.0) baseValueRotation.AngleRadians = -baseValueRotation.AngleRadians; @@ -29,6 +29,6 @@ namespace Microsoft.Iris.Animations public override void Apply(IAnimatableOwner animationTarget, Rotation valueRotation) => ((ViewItem)animationTarget).VisualRotation = valueRotation; - public override void MagnifyValue(float magnifyValue) => this.Value = new Rotation(this.Value.AngleRadians * magnifyValue, this.Value.Axis); + public override void MagnifyValue(float magnifyValue) => Value = new Rotation(Value.AngleRadians * magnifyValue, Value.Axis); } } diff --git a/UIX/Microsoft/Iris/Animations/ScaleKeyframe.cs b/UIX/Microsoft/Iris/Animations/ScaleKeyframe.cs index d698fbb..789ffb1 100644 --- a/UIX/Microsoft/Iris/Animations/ScaleKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/ScaleKeyframe.cs @@ -12,7 +12,7 @@ namespace Microsoft.Iris.Animations { internal class ScaleKeyframe : BaseVector3Keyframe { - public ScaleKeyframe() => this.Value = Vector3.UnitVector; + public ScaleKeyframe() => Value = Vector3.UnitVector; public override bool Multiply => true; @@ -23,7 +23,7 @@ namespace Microsoft.Iris.Animations Vector3 baseValueVector, ref AnimationArgs args) { - return GetEffectiveScaleValue(this.RelativeTo, targetObject, baseValueVector, ref args); + return GetEffectiveScaleValue(RelativeTo, targetObject, baseValueVector, ref args); } public static Vector3 GetEffectiveScaleValue( @@ -46,8 +46,8 @@ namespace Microsoft.Iris.Animations public override void MagnifyValue(float magnifyValue) { - Vector3 vector3 = this.Value; - this.Value = new Vector3(this.MagnifyDimension(vector3.X, magnifyValue), this.MagnifyDimension(vector3.Y, magnifyValue), this.MagnifyDimension(vector3.Z, magnifyValue)); + Vector3 vector3 = Value; + Value = new Vector3(MagnifyDimension(vector3.X, magnifyValue), MagnifyDimension(vector3.Y, magnifyValue), MagnifyDimension(vector3.Z, magnifyValue)); } private float MagnifyDimension(float dimensionValue, float magnifyValue) diff --git a/UIX/Microsoft/Iris/Animations/ScaleXKeyframe.cs b/UIX/Microsoft/Iris/Animations/ScaleXKeyframe.cs index b392521..41fffa0 100644 --- a/UIX/Microsoft/Iris/Animations/ScaleXKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/ScaleXKeyframe.cs @@ -25,7 +25,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return ScaleKeyframe.GetEffectiveScaleValue(this.RelativeTo, targetObject, new Vector3(baseValue, 0.0f, 0.0f), ref args).X; + return ScaleKeyframe.GetEffectiveScaleValue(RelativeTo, targetObject, new Vector3(baseValue, 0.0f, 0.0f), ref args).X; } } } diff --git a/UIX/Microsoft/Iris/Animations/ScaleYKeyframe.cs b/UIX/Microsoft/Iris/Animations/ScaleYKeyframe.cs index 806a6a9..8e3e599 100644 --- a/UIX/Microsoft/Iris/Animations/ScaleYKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/ScaleYKeyframe.cs @@ -25,7 +25,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return ScaleKeyframe.GetEffectiveScaleValue(this.RelativeTo, targetObject, new Vector3(0.0f, baseValue, 0.0f), ref args).Y; + return ScaleKeyframe.GetEffectiveScaleValue(RelativeTo, targetObject, new Vector3(0.0f, baseValue, 0.0f), ref args).Y; } } } diff --git a/UIX/Microsoft/Iris/Animations/SizeKeyframe.cs b/UIX/Microsoft/Iris/Animations/SizeKeyframe.cs index ab6f7b0..1c4876d 100644 --- a/UIX/Microsoft/Iris/Animations/SizeKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/SizeKeyframe.cs @@ -18,7 +18,7 @@ namespace Microsoft.Iris.Animations Vector2 baseValueVector, ref AnimationArgs args) { - if (this.RelativeTo == RelativeTo.Final) + if (RelativeTo == RelativeTo.Final) baseValueVector += args.NewSize; return baseValueVector; } diff --git a/UIX/Microsoft/Iris/Animations/SizeXKeyframe.cs b/UIX/Microsoft/Iris/Animations/SizeXKeyframe.cs index 4f0c7c4..c9a3643 100644 --- a/UIX/Microsoft/Iris/Animations/SizeXKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/SizeXKeyframe.cs @@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return this.RelativeTo == RelativeTo.Final ? baseValue + args.NewSize.X : baseValue; + return RelativeTo == RelativeTo.Final ? baseValue + args.NewSize.X : baseValue; } } } diff --git a/UIX/Microsoft/Iris/Animations/SizeYKeyframe.cs b/UIX/Microsoft/Iris/Animations/SizeYKeyframe.cs index 54c4fb6..8e31111 100644 --- a/UIX/Microsoft/Iris/Animations/SizeYKeyframe.cs +++ b/UIX/Microsoft/Iris/Animations/SizeYKeyframe.cs @@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations float baseValue, ref AnimationArgs args) { - return this.RelativeTo == RelativeTo.Final ? baseValue + args.NewSize.Y : baseValue; + return RelativeTo == RelativeTo.Final ? baseValue + args.NewSize.Y : baseValue; } } } diff --git a/UIX/Microsoft/Iris/Animations/SnapshotRelativeTo.cs b/UIX/Microsoft/Iris/Animations/SnapshotRelativeTo.cs index 3ed01db..597262b 100644 --- a/UIX/Microsoft/Iris/Animations/SnapshotRelativeTo.cs +++ b/UIX/Microsoft/Iris/Animations/SnapshotRelativeTo.cs @@ -14,8 +14,8 @@ namespace Microsoft.Iris.Animations public SnapshotRelativeTo(RectangleF bounds) : base(SnapshotPolicy.Once) - => this._bounds = bounds; + => _bounds = bounds; - public RectangleF Bounds => this._bounds; + public RectangleF Bounds => _bounds; } } diff --git a/UIX/Microsoft/Iris/Animations/SwitchAnimation.cs b/UIX/Microsoft/Iris/Animations/SwitchAnimation.cs index 684524f..fa671dd 100644 --- a/UIX/Microsoft/Iris/Animations/SwitchAnimation.cs +++ b/UIX/Microsoft/Iris/Animations/SwitchAnimation.cs @@ -17,41 +17,41 @@ namespace Microsoft.Iris.Animations public IUIValueRange Expression { - get => this._expressionObject; - set => this._expressionObject = value; + get => _expressionObject; + set => _expressionObject = value; } public Dictionary Options { get { - if (this._optionsList == null) - this._optionsList = new Dictionary(); - return this._optionsList; + if (_optionsList == null) + _optionsList = new Dictionary(); + return _optionsList; } - set => this._optionsList = value; + set => _optionsList = value; } public AnimationEventType Type { - get => this._type; - set => this._type = value; + get => _type; + set => _type = value; } public AnimationTemplate Build(ref AnimationArgs args) { AnimationTemplate animationTemplate = null; - if (this._optionsList != null) + if (_optionsList != null) { object obj = null; - if (this._expressionObject != null) - obj = this._expressionObject.ObjectValue; + if (_expressionObject != null) + obj = _expressionObject.ObjectValue; string key = null; if (obj != null) key = obj.ToString(); IAnimationProvider animationProvider = null; - if (key != null && this._optionsList.ContainsKey(key)) - animationProvider = this._optionsList[key]; + if (key != null && _optionsList.ContainsKey(key)) + animationProvider = _optionsList[key]; if (animationProvider != null) animationTemplate = animationProvider.Build(ref args); } diff --git a/UIX/Microsoft/Iris/Animations/TransformAnimation.cs b/UIX/Microsoft/Iris/Animations/TransformAnimation.cs index e28bcac..2b30d74 100644 --- a/UIX/Microsoft/Iris/Animations/TransformAnimation.cs +++ b/UIX/Microsoft/Iris/Animations/TransformAnimation.cs @@ -18,70 +18,70 @@ namespace Microsoft.Iris.Animations public TransformAnimation() { - this._timeScaleValue = 1f; - this._magnitudeValue = 1f; - this._filter = KeyframeFilter.All; + _timeScaleValue = 1f; + _magnitudeValue = 1f; + _filter = KeyframeFilter.All; } public float TimeScale { - get => this._timeScaleValue; + get => _timeScaleValue; set { if (_timeScaleValue == (double)value) return; - this._timeScaleValue = value; - this.ClearCache(); + _timeScaleValue = value; + ClearCache(); } } public float Delay { - get => this._timeOffsetValue; + get => _timeOffsetValue; set { if (_timeOffsetValue == (double)value) return; - this._timeOffsetValue = value; - this.ClearCache(); + _timeOffsetValue = value; + ClearCache(); } } public float Magnitude { - get => this._magnitudeValue; + get => _magnitudeValue; set { if (_magnitudeValue == (double)value) return; - this._magnitudeValue = value; - this.ClearCache(); + _magnitudeValue = value; + ClearCache(); } } public KeyframeFilter Filter { - get => this._filter; + get => _filter; set { - if (this._filter == value) + if (_filter == value) return; - this._filter = value; - this.ClearCache(); + _filter = value; + ClearCache(); } } protected override AnimationTemplate BuildWorker(ref AnimationArgs args) { - if (this._cacheAnimation != null) - return this._cacheAnimation; - float timeScale = this.GetTimeScale(ref args); - float delayTime = this.GetDelayTime(ref args); - float magnitude = this.GetMagnitude(ref args); + if (_cacheAnimation != null) + return _cacheAnimation; + float timeScale = GetTimeScale(ref args); + float delayTime = GetDelayTime(ref args); + float magnitude = GetMagnitude(ref args); bool flag1 = timeScale != 1.0; bool flag2 = delayTime != 0.0; bool flag3 = magnitude != 1.0; - int filter = (int)this._filter; + int filter = (int)_filter; AnimationTemplate anim1 = base.BuildWorker(ref args); DumpAnimation(anim1, "Source"); if (!flag1 && !flag2 && !flag3) @@ -89,13 +89,13 @@ namespace Microsoft.Iris.Animations AnimationTemplate anim2 = (AnimationTemplate)anim1.Clone(); anim2.DebugID += "'"; if (flag1) - this.ApplyTimeScale(anim2, timeScale); + ApplyTimeScale(anim2, timeScale); if (flag2) - this.ApplyTimeOffset(anim2, delayTime); + ApplyTimeOffset(anim2, delayTime); if (flag3) - this.ApplyMagnitude(anim2, magnitude); - if (this.CanCache) - this._cacheAnimation = anim2; + ApplyMagnitude(anim2, magnitude); + if (CanCache) + _cacheAnimation = anim2; return anim2; } @@ -105,17 +105,17 @@ namespace Microsoft.Iris.Animations ; } - protected virtual float GetTimeScale(ref AnimationArgs args) => this._timeScaleValue; + protected virtual float GetTimeScale(ref AnimationArgs args) => _timeScaleValue; - protected virtual float GetDelayTime(ref AnimationArgs args) => this._timeOffsetValue; + protected virtual float GetDelayTime(ref AnimationArgs args) => _timeOffsetValue; - protected virtual float GetMagnitude(ref AnimationArgs args) => this._magnitudeValue; + protected virtual float GetMagnitude(ref AnimationArgs args) => _magnitudeValue; private void ApplyTimeScale(AnimationTemplate anim, float timeScaleValue) { foreach (BaseKeyframe keyframe in anim.Keyframes) { - if (this.ShouldApplyTransform(keyframe)) + if (ShouldApplyTransform(keyframe)) keyframe.Time *= timeScaleValue; } DumpAnimation(anim, "Result"); @@ -126,7 +126,7 @@ namespace Microsoft.Iris.Animations ArrayList arrayList = new ArrayList(); foreach (BaseKeyframe keyframe in anim.Keyframes) { - if (this.ShouldApplyTransform(keyframe)) + if (ShouldApplyTransform(keyframe)) { if (keyframe.Time == 0.0) arrayList.Add(keyframe.Clone()); @@ -142,7 +142,7 @@ namespace Microsoft.Iris.Animations { foreach (BaseKeyframe keyframe in anim.Keyframes) { - if (this.ShouldApplyTransform(keyframe)) + if (ShouldApplyTransform(keyframe)) keyframe.MagnifyValue(magnitudeValue); } DumpAnimation(anim, "Result"); @@ -167,10 +167,10 @@ namespace Microsoft.Iris.Animations } } - private bool ShouldApplyTransform(BaseKeyframe key) => this._filter == KeyframeFilter.All || this.GetKeyframeFilter(key) == this._filter; + private bool ShouldApplyTransform(BaseKeyframe key) => _filter == KeyframeFilter.All || GetKeyframeFilter(key) == _filter; - protected override void OnSourceChanged() => this.ClearCache(); + protected override void OnSourceChanged() => ClearCache(); - protected void ClearCache() => this._cacheAnimation = null; + protected void ClearCache() => _cacheAnimation = null; } } diff --git a/UIX/Microsoft/Iris/Animations/TransformByAttributeAnimation.cs b/UIX/Microsoft/Iris/Animations/TransformByAttributeAnimation.cs index 85676cf..a1c3583 100644 --- a/UIX/Microsoft/Iris/Animations/TransformByAttributeAnimation.cs +++ b/UIX/Microsoft/Iris/Animations/TransformByAttributeAnimation.cs @@ -21,76 +21,76 @@ namespace Microsoft.Iris.Animations public TransformByAttributeAnimation() { - this.Delay = 0.0f; - this.Magnitude = 0.0f; - this.TimeScale = 0.0f; - this.Attribute = TransformAttribute.Index; + Delay = 0.0f; + Magnitude = 0.0f; + TimeScale = 0.0f; + Attribute = TransformAttribute.Index; } public TransformAttribute Attribute { - get => this._attrib; - set => this._attrib = value; + get => _attrib; + set => _attrib = value; } public float MaxTimeScale { - get => this._maxTimeScaleValue; + get => _maxTimeScaleValue; set { if (_maxTimeScaleValue == (double)value) return; - this._maxTimeScaleValue = value; - this.ClearCache(); + _maxTimeScaleValue = value; + ClearCache(); } } public float MaxDelay { - get => this._maxTimeOffsetValue; + get => _maxTimeOffsetValue; set { if (_maxTimeOffsetValue == (double)value) return; - this._maxTimeOffsetValue = value; - this.ClearCache(); + _maxTimeOffsetValue = value; + ClearCache(); } } public float MaxMagnitude { - get => this._maxMagnitudeValue; + get => _maxMagnitudeValue; set { if (_maxMagnitudeValue == (double)value) return; - this._maxMagnitudeValue = value; - this.ClearCache(); + _maxMagnitudeValue = value; + ClearCache(); } } public float Override { - get => this._overrideValue; + get => _overrideValue; set { - if (this._haveOverrideFlag && _overrideValue == (double)value) + if (_haveOverrideFlag && _overrideValue == (double)value) return; - this._overrideValue = value; - this._haveOverrideFlag = true; - this.ClearCache(); + _overrideValue = value; + _haveOverrideFlag = true; + ClearCache(); } } public ValueTransformer ValueTransformer { - get => this._valueTransformer; + get => _valueTransformer; set { - if (this._valueTransformer == value) + if (_valueTransformer == value) return; - this._valueTransformer = value; - this.ClearCache(); + _valueTransformer = value; + ClearCache(); } } @@ -99,9 +99,9 @@ namespace Microsoft.Iris.Animations float timeScale = base.GetTimeScale(ref args); if (timeScale == 0.0) return 1f; - float val1 = 1f + this.GetValue(ref args) * timeScale; + float val1 = 1f + GetValue(ref args) * timeScale; if (_maxTimeScaleValue != 0.0) - val1 = Math.Min(val1, this._maxTimeScaleValue); + val1 = Math.Min(val1, _maxTimeScaleValue); if (val1 < 0.0) val1 = 0.0f; return val1; @@ -112,9 +112,9 @@ namespace Microsoft.Iris.Animations float delayTime = base.GetDelayTime(ref args); if (delayTime == 0.0) return 0.0f; - float val1 = this.GetValue(ref args) * delayTime; + float val1 = GetValue(ref args) * delayTime; if (_maxTimeOffsetValue != 0.0) - val1 = Math.Min(val1, this._maxTimeOffsetValue); + val1 = Math.Min(val1, _maxTimeOffsetValue); if (val1 < 0.0) val1 = 0.0f; return val1; @@ -125,28 +125,28 @@ namespace Microsoft.Iris.Animations float magnitude = base.GetMagnitude(ref args); if (magnitude == 0.0) return 1f; - float val1 = 1f + this.GetValue(ref args) * magnitude; + float val1 = 1f + GetValue(ref args) * magnitude; if (_maxMagnitudeValue != 0.0) - val1 = Math.Min(val1, this._maxMagnitudeValue); + val1 = Math.Min(val1, _maxMagnitudeValue); return val1; } private float GetValue(ref AnimationArgs args) { - float num = this.GetValueWorker(ref args); - if (this._valueTransformer != null) - num = this._valueTransformer.Transform(num); + float num = GetValueWorker(ref args); + if (_valueTransformer != null) + num = _valueTransformer.Transform(num); return num; } protected virtual float GetValueWorker(ref AnimationArgs args) { - if (this._haveOverrideFlag) - return this._overrideValue; - switch (this._attrib) + if (_haveOverrideFlag) + return _overrideValue; + switch (_attrib) { case TransformAttribute.Index: - return this.GetIndex(ref args); + return GetIndex(ref args); case TransformAttribute.Width: return args.NewSize.X; case TransformAttribute.Height: diff --git a/UIX/Microsoft/Iris/Animations/ValueTransformer.cs b/UIX/Microsoft/Iris/Animations/ValueTransformer.cs index 7a814f7..ca84d42 100644 --- a/UIX/Microsoft/Iris/Animations/ValueTransformer.cs +++ b/UIX/Microsoft/Iris/Animations/ValueTransformer.cs @@ -19,58 +19,58 @@ namespace Microsoft.Iris.Animations public ValueTransformer() { - this._multiply = 1f; - this._divide = 1f; - this._mod = float.MaxValue; + _multiply = 1f; + _divide = 1f; + _mod = float.MaxValue; } public float Transform(float value) { - value *= this._multiply; - value /= this._divide; - value += this._add; - value -= this._subtract; + value *= _multiply; + value /= _divide; + value += _add; + value -= _subtract; if (_mod != 3.40282346638529E+38) - value %= this._mod; - if (this._absolute) + value %= _mod; + if (_absolute) value = Math.Abs(value); return value; } public float Add { - get => this._add; - set => this._add = value; + get => _add; + set => _add = value; } public float Subtract { - get => this._subtract; - set => this._subtract = value; + get => _subtract; + set => _subtract = value; } public float Multiply { - get => this._multiply; - set => this._multiply = value; + get => _multiply; + set => _multiply = value; } public float Divide { - get => this._divide; - set => this._divide = value; + get => _divide; + set => _divide = value; } public float Mod { - get => this._mod; - set => this._mod = value; + get => _mod; + set => _mod = value; } public bool Absolute { - get => this._absolute; - set => this._absolute = value; + get => _absolute; + set => _absolute = value; } } } diff --git a/UIX/Microsoft/Iris/AssemblyDataProviderWrapper.cs b/UIX/Microsoft/Iris/AssemblyDataProviderWrapper.cs index b1dcd5b..2a66aa8 100644 --- a/UIX/Microsoft/Iris/AssemblyDataProviderWrapper.cs +++ b/UIX/Microsoft/Iris/AssemblyDataProviderWrapper.cs @@ -15,15 +15,15 @@ namespace Microsoft.Iris public AssemblyDataProviderWrapper(string name, DataProviderQueryFactory factory) { - this._name = name; - this._factory = factory; + _name = name; + _factory = factory; } - public string Name => this._name; + public string Name => _name; public MarkupDataQuery Build(MarkupDataQuerySchema querySchema) => new AssemblyMarkupDataQuery(querySchema, this); - public IDataProviderQuery ConstructQuery(object queryTypeCookie) => this._factory(queryTypeCookie); + public IDataProviderQuery ConstructQuery(object queryTypeCookie) => _factory(queryTypeCookie); public override string ToString() => string.Format("{0} ({1})", _name, _factory); } diff --git a/UIX/Microsoft/Iris/Audio/Sound.cs b/UIX/Microsoft/Iris/Audio/Sound.cs index 3fa2531..55399ed 100644 --- a/UIX/Microsoft/Iris/Audio/Sound.cs +++ b/UIX/Microsoft/Iris/Audio/Sound.cs @@ -22,21 +22,21 @@ namespace Microsoft.Iris.Audio internal string Source { - get => this._source; + get => _source; set { - this._source = value; - this._systemSoundEvent = SystemSoundEvent.None; + _source = value; + _systemSoundEvent = SystemSoundEvent.None; } } internal SystemSoundEvent SystemSoundEvent { - get => this._systemSoundEvent; + get => _systemSoundEvent; set { - this._systemSoundEvent = value; - this._source = null; + _systemSoundEvent = value; + _source = null; } } @@ -47,10 +47,10 @@ namespace Microsoft.Iris.Audio SoundManager soundManager = UISession.Default.SoundManager; ISoundBuffer soundBuffer = null; string source = null; - if (this._source != null) - source = this._source; - else if (this._systemSoundEvent != SystemSoundEvent.None) - source = soundManager.GetSystemSoundEventSource(this._systemSoundEvent); + if (_source != null) + source = _source; + else if (_systemSoundEvent != SystemSoundEvent.None) + source = soundManager.GetSystemSoundEventSource(_systemSoundEvent); if (source != null) soundBuffer = soundManager.GetSoundBuffer(source); if (soundBuffer == null) diff --git a/UIX/Microsoft/Iris/BooleanChoice.cs b/UIX/Microsoft/Iris/BooleanChoice.cs index 6ffad19..038102c 100644 --- a/UIX/Microsoft/Iris/BooleanChoice.cs +++ b/UIX/Microsoft/Iris/BooleanChoice.cs @@ -24,7 +24,7 @@ namespace Microsoft.Iris { if (options == null) return; - this.Options = options; + Options = options; } public BooleanChoice(IModelItemOwner owner, string description) @@ -48,19 +48,19 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this.ChosenIndex == 1; + using (ThreadValidator) + return ChosenIndex == 1; } set { - using (this.ThreadValidator) + using (ThreadValidator) { - if (value == this.Value) + if (value == Value) return; if (value) - this.ChosenIndex = 1; + ChosenIndex = 1; else - this.ChosenIndex = 0; + ChosenIndex = 0; } } } diff --git a/UIX/Microsoft/Iris/Choice.cs b/UIX/Microsoft/Iris/Choice.cs index 0b0488a..08f032c 100644 --- a/UIX/Microsoft/Iris/Choice.cs +++ b/UIX/Microsoft/Iris/Choice.cs @@ -35,13 +35,13 @@ namespace Microsoft.Iris public Choice(IModelItemOwner owner, string description, IList options) : base(owner, description) { - this.Initialize(); - this.Options = options; + Initialize(); + Options = options; } public Choice(IModelItemOwner owner, string description) : base(owner, description) - => this.Initialize(); + => Initialize(); public Choice(IModelItemOwner owner) : this(owner, null) @@ -58,11 +58,11 @@ namespace Microsoft.Iris base.OnDispose(disposing); if (disposing) { - this._notifier.ClearListeners(); - this._choice.Dispose(this); - this._listeners.Dispose(this); + _notifier.ClearListeners(); + _choice.Dispose(this); + _listeners.Dispose(this); } - this._choice = null; + _choice = null; } object AssemblyObjectProxyHelper.IFrameworkProxyObject.FrameworkObject => this; @@ -73,16 +73,16 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) + using (ThreadValidator) return (IList)AssemblyLoadResult.UnwrapObject(_choice.Options); } set { - using (this.ThreadValidator) + using (ThreadValidator) { IList potentialOptionsWrapped = (IList)AssemblyLoadResult.WrapObject(value); - this.ValidateOptionsList(potentialOptionsWrapped, value); - this._choice.Options = potentialOptionsWrapped; + ValidateOptionsList(potentialOptionsWrapped, value); + _choice.Options = potentialOptionsWrapped; } } } @@ -91,18 +91,18 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return AssemblyLoadResult.UnwrapObject(this._choice.ChosenValue); + using (ThreadValidator) + return AssemblyLoadResult.UnwrapObject(_choice.ChosenValue); } set { - using (this.ThreadValidator) + using (ThreadValidator) { int index; string error; - if (!this._choice.ValidateOption(AssemblyLoadResult.WrapObject(value), out index, out error)) + if (!_choice.ValidateOption(AssemblyLoadResult.WrapObject(value), out index, out error)) throw new ArgumentException(error); - this._choice.ChosenIndex = index; + _choice.ChosenIndex = index; } } } @@ -111,15 +111,15 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._choice.ChosenIndex; + using (ThreadValidator) + return _choice.ChosenIndex; } set { - using (this.ThreadValidator) + using (ThreadValidator) { string error; - this._choice.ChosenIndex = this._choice.ValidateIndex(value, out error) ? value : throw new ArgumentException(error); + _choice.ChosenIndex = _choice.ValidateIndex(value, out error) ? value : throw new ArgumentException(error); } } } @@ -128,13 +128,13 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._choice.DefaultIndex; + using (ThreadValidator) + return _choice.DefaultIndex; } set { - using (this.ThreadValidator) - this._choice.DefaultIndex = value; + using (ThreadValidator) + _choice.DefaultIndex = value; } } @@ -142,33 +142,33 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return AssemblyLoadResult.UnwrapObject(((IUIValueRange)this._choice).ObjectValue); + using (ThreadValidator) + return AssemblyLoadResult.UnwrapObject(((IUIValueRange)_choice).ObjectValue); } } - object IUIValueRange.ObjectValue => ((IUIValueRange)this._choice).ObjectValue; + object IUIValueRange.ObjectValue => ((IUIValueRange)_choice).ObjectValue; IList IUIChoice.Options { - get => this._choice.Options; - set => this._choice.Options = value; + get => _choice.Options; + set => _choice.Options = value; } - object IUIChoice.ChosenValue => this._choice.ChosenValue; + object IUIChoice.ChosenValue => _choice.ChosenValue; - bool IUIChoice.ValidateIndex(int index, out string error) => this._choice.ValidateIndex(index, out error); + bool IUIChoice.ValidateIndex(int index, out string error) => _choice.ValidateIndex(index, out error); - bool IUIChoice.ValidateOption(object value, out int index, out string error) => this._choice.ValidateOption(value, out index, out error); + bool IUIChoice.ValidateOption(object value, out int index, out string error) => _choice.ValidateOption(value, out index, out error); - bool IUIChoice.ValidateOptionsList(IList value, out string error) => this._choice.ValidateOptionsList(value, out error); + bool IUIChoice.ValidateOptionsList(IList value, out string error) => _choice.ValidateOptionsList(value, out error); public bool HasNextValue { get { - using (this.ThreadValidator) - return this._choice.HasNextValue; + using (ThreadValidator) + return _choice.HasNextValue; } } @@ -176,8 +176,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._choice.HasSelection; + using (ThreadValidator) + return _choice.HasSelection; } } @@ -185,8 +185,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._choice.HasPreviousValue; + using (ThreadValidator) + return _choice.HasPreviousValue; } } @@ -194,50 +194,50 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._choice.Wrap; + using (ThreadValidator) + return _choice.Wrap; } set { - using (this.ThreadValidator) - this._choice.Wrap = value; + using (ThreadValidator) + _choice.Wrap = value; } } public void PreviousValue() { - using (this.ThreadValidator) - this._choice.PreviousValue(); + using (ThreadValidator) + _choice.PreviousValue(); } public void PreviousValue(bool wrap) { - using (this.ThreadValidator) - this._choice.PreviousValue(wrap); + using (ThreadValidator) + _choice.PreviousValue(wrap); } public void NextValue() { - using (this.ThreadValidator) - this._choice.NextValue(); + using (ThreadValidator) + _choice.NextValue(); } public void NextValue(bool wrap) { - using (this.ThreadValidator) - this._choice.NextValue(wrap); + using (ThreadValidator) + _choice.NextValue(wrap); } public void Clear() { - using (this.ThreadValidator) - this._choice.Clear(); + using (ThreadValidator) + _choice.Clear(); } public void DefaultValue() { - using (this.ThreadValidator) - this._choice.DefaultValue(); + using (ThreadValidator) + _choice.DefaultValue(); } protected virtual void OnChosenChanged() @@ -248,64 +248,64 @@ namespace Microsoft.Iris { add { - using (this.ThreadValidator) - this.AddEventHandler(s_chosenChangedEvent, value); + using (ThreadValidator) + AddEventHandler(s_chosenChangedEvent, value); } remove { - using (this.ThreadValidator) - this.RemoveEventHandler(s_chosenChangedEvent, value); + using (ThreadValidator) + RemoveEventHandler(s_chosenChangedEvent, value); } } private void Initialize() { - this._choice = this.CreateInternalChoice(); - this._choice.DeclareOwner(this); + _choice = CreateInternalChoice(); + _choice.DeclareOwner(this); Vector listeners = new Vector(9); - DelegateListener.OnNotifyCallback callback = new DelegateListener.OnNotifyCallback(this.OnInternalChoicePropertyChanged); + DelegateListener.OnNotifyCallback callback = new DelegateListener.OnNotifyCallback(OnInternalChoicePropertyChanged); listeners.Add(new DelegateListener(_choice, NotificationID.Options, callback)); listeners.Add(new DelegateListener(_choice, NotificationID.DefaultIndex, callback)); listeners.Add(new DelegateListener(_choice, NotificationID.ChosenIndex, callback)); - listeners.Add(new DelegateListener(_choice, NotificationID.ChosenValue, new DelegateListener.OnNotifyCallback(this.OnChosenValueChanged))); + listeners.Add(new DelegateListener(_choice, NotificationID.ChosenValue, new DelegateListener.OnNotifyCallback(OnChosenValueChanged))); listeners.Add(new DelegateListener(_choice, NotificationID.Value, callback)); listeners.Add(new DelegateListener(_choice, NotificationID.HasSelection, callback)); listeners.Add(new DelegateListener(_choice, NotificationID.Wrap, callback)); listeners.Add(new DelegateListener(_choice, NotificationID.HasPreviousValue, callback)); listeners.Add(new DelegateListener(_choice, NotificationID.HasNextValue, callback)); - this._listeners = new CodeListeners(listeners); - this._listeners.DeclareOwner(this); + _listeners = new CodeListeners(listeners); + _listeners.DeclareOwner(this); } protected override void OnPropertyChanged(string property) { base.OnPropertyChanged(property); - this._notifier.FireThreadSafe(property); + _notifier.FireThreadSafe(property); } - private void OnInternalChoicePropertyChanged(DelegateListener listener) => this.FirePropertyChanged(listener.Watch); + private void OnInternalChoicePropertyChanged(DelegateListener listener) => FirePropertyChanged(listener.Watch); private void OnChosenValueChanged(DelegateListener listener) { - if (this._lastChosen != null) - this._lastChosen.Selected = false; - this._lastChosen = this.ChosenValue as ModelItem; - if (this._lastChosen != null) - this._lastChosen.Selected = true; - this.FireChangedChosenEvent(); - this.OnInternalChoicePropertyChanged(listener); + if (_lastChosen != null) + _lastChosen.Selected = false; + _lastChosen = ChosenValue as ModelItem; + if (_lastChosen != null) + _lastChosen.Selected = true; + FireChangedChosenEvent(); + OnInternalChoicePropertyChanged(listener); } internal virtual Microsoft.Iris.ModelItems.Choice CreateInternalChoice() => new Microsoft.Iris.ModelItems.Choice(); private void ValidateOptionsList(IList potentialOptionsWrapped, IList potentialOptions) { - using (this.ThreadValidator) + using (ThreadValidator) { string error; - if (!this._choice.ValidateOptionsList(potentialOptionsWrapped, out error)) + if (!_choice.ValidateOptionsList(potentialOptionsWrapped, out error)) throw new ArgumentException(error); - this.ValidateOptionsListWorker(potentialOptions); + ValidateOptionsListWorker(potentialOptions); } } @@ -315,14 +315,14 @@ namespace Microsoft.Iris private void FireChangedChosenEvent() { - if (this.GetEventHandler(s_chosenChangedEvent) is EventHandler eventHandler) + if (GetEventHandler(s_chosenChangedEvent) is EventHandler eventHandler) eventHandler(this, EventArgs.Empty); - this.OnChosenChanged(); + OnChosenChanged(); } private void SetChosenSelected(bool selectedFlag) { - if (!(this.ChosenValue is ModelItem chosenValue)) + if (!(ChosenValue is ModelItem chosenValue)) return; chosenValue.Selected = selectedFlag; } @@ -335,8 +335,8 @@ namespace Microsoft.Iris { } - void IDisposableObject.Dispose(object owner) => this.Dispose(); + void IDisposableObject.Dispose(object owner) => Dispose(); - void INotifyObject.AddListener(Listener listener) => this._notifier.AddListener(listener); + void INotifyObject.AddListener(Listener listener) => _notifier.AddListener(listener); } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllConstructorSchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllConstructorSchema.cs index f5cb06f..1e30d97 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllConstructorSchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllConstructorSchema.cs @@ -18,49 +18,49 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllConstructorSchema(DllTypeSchema owner, uint ID) : base(owner) - => this._id = ID; + => _id = ID; - public bool Load(IntPtr constructor) => this.QueryForParameterTypes(constructor); + public bool Load(IntPtr constructor) => QueryForParameterTypes(constructor); [Conditional("DEBUG")] public void DEBUG_Dump() { string str1 = string.Empty; - if (this._parameterTypes != null) + if (_parameterTypes != null) { - for (int index = 0; index < this._parameterTypes.Length; ++index) + for (int index = 0; index < _parameterTypes.Length; ++index) { string str2 = ""; - if (this._parameterTypes[index] != null) - str2 = this._parameterTypes[index].Name; + if (_parameterTypes[index] != null) + str2 = _parameterTypes[index].Name; str1 = string.Format("{0}{1}{2}", str1, index > 0 ? ", " : string.Empty, str2); } } string.Format("0x{0:x8} {1}({2})", _id, Owner.Name, str1); } - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; - private DllLoadResult OwnerLoadResult => (DllLoadResult)this.Owner.Owner; + private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner.Owner; private bool QueryForParameterTypes(IntPtr constructor) { bool flag1 = false; uint count; - if (this.CheckNativeReturn(NativeApi.SpQueryConstructorParameterCount(constructor, out count))) + if (CheckNativeReturn(NativeApi.SpQueryConstructorParameterCount(constructor, out count))) { uint[] IDs = new uint[count]; - if (this.CheckNativeReturn(NativeApi.SpGetConstructorParameterTypes(constructor, IDs, count))) + if (CheckNativeReturn(NativeApi.SpGetConstructorParameterTypes(constructor, IDs, count))) { if (count > 0U) { - this._parameterTypes = new TypeSchema[count]; + _parameterTypes = new TypeSchema[count]; bool flag2 = false; for (int index = 0; index < count; ++index) { TypeSchema typeSchema = DllLoadResult.MapType(IDs[index]); if (typeSchema != null) - this._parameterTypes[index] = typeSchema; + _parameterTypes[index] = typeSchema; else flag2 = true; } @@ -68,7 +68,7 @@ namespace Microsoft.Iris.CodeModel.Cpp } else { - this._parameterTypes = TypeSchema.EmptyList; + _parameterTypes = TypeSchema.EmptyList; flag1 = true; } } @@ -76,7 +76,7 @@ namespace Microsoft.Iris.CodeModel.Cpp return flag1; } - public override object Construct(object[] parameters) => ((DllTypeSchema)this.Owner).Construct(this._id, parameters); + public override object Construct(object[] parameters) => ((DllTypeSchema)Owner).Construct(_id, parameters); private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXConstructor"); } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumProxy.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumProxy.cs index 7764104..ed5cf4d 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumProxy.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumProxy.cs @@ -13,23 +13,23 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllEnumProxy(DllEnumSchema schema, int value) { - this._value = value; - this._schema = schema; + _value = value; + _schema = schema; } - public int Value => this._value; + public int Value => _value; - public DllEnumSchema Type => this._schema; + public DllEnumSchema Type => _schema; - public override string ToString() => this._schema.InvokeToString(this); + public override string ToString() => _schema.InvokeToString(this); - public override int GetHashCode() => this._value.GetHashCode(); + public override int GetHashCode() => _value.GetHashCode(); public override bool Equals(object other) { bool flag = false; if (other is DllEnumProxy dllEnumProxy) - flag = this._schema == dllEnumProxy._schema && this._value == dllEnumProxy._value; + flag = _schema == dllEnumProxy._schema && _value == dllEnumProxy._value; return flag; } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumSchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumSchema.cs index 6a44432..86178e9 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumSchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllEnumSchema.cs @@ -20,42 +20,42 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllEnumSchema(LoadResult owner, uint id, IntPtr nativeSchema) : base(owner) { - this._id = id; - this._nativeSchema = nativeSchema; + _id = id; + _nativeSchema = nativeSchema; } [Conditional("DEBUG")] public void DEBUG_DumpEnum() { int val1 = 0; - foreach (KeyValueEntry nameToValue in this.NameToValueMap) + foreach (KeyValueEntry nameToValue in NameToValueMap) { if (nameToValue.Key != null) val1 = Math.Max(val1, nameToValue.Key.Length); } string.Format("{{0,{0}}} = 0x{{1:x8}}", val1); - foreach (KeyValueEntry nameToValue in this.NameToValueMap) + foreach (KeyValueEntry nameToValue in NameToValueMap) ; } - public uint ID => this._id; + public uint ID => _id; public bool Load() { string name; - bool flag = this.QueryName(out name); + bool flag = QueryName(out name); if (flag) { bool isFlags; - flag = this.QueryIsFlags(out isFlags); + flag = QueryIsFlags(out isFlags); if (flag) { string[] names; int[] values; - flag = this.QueryNamesAndValues(out names, out values); + flag = QueryNamesAndValues(out names, out values); if (flag) { - this.Initialize(name, typeof(DllEnumProxy), isFlags, names, values); + Initialize(name, typeof(DllEnumProxy), isFlags, names, values); flag = true; } } @@ -66,12 +66,12 @@ namespace Microsoft.Iris.CodeModel.Cpp private unsafe bool QueryName(out string name) { char* name1; - bool flag = this.CheckNativeReturn(NativeApi.SpQueryEnumName(this._nativeSchema, out name1)); + bool flag = CheckNativeReturn(NativeApi.SpQueryEnumName(_nativeSchema, out name1)); name = !flag ? null : new string(name1); return flag; } - private bool QueryIsFlags(out bool isFlags) => this.CheckNativeReturn(NativeApi.SpQueryEnumIsFlags(this._nativeSchema, out isFlags)); + private bool QueryIsFlags(out bool isFlags) => CheckNativeReturn(NativeApi.SpQueryEnumIsFlags(_nativeSchema, out isFlags)); private unsafe bool QueryNamesAndValues(out string[] names, out int[] values) { @@ -79,7 +79,7 @@ namespace Microsoft.Iris.CodeModel.Cpp names = null; values = null; uint valueCount; - if (this.CheckNativeReturn(NativeApi.SpQueryEnumValueCount(this._nativeSchema, out valueCount))) + if (CheckNativeReturn(NativeApi.SpQueryEnumValueCount(_nativeSchema, out valueCount))) { bool flag2 = false; if (valueCount > 0U) @@ -90,7 +90,7 @@ namespace Microsoft.Iris.CodeModel.Cpp { char* name; int num; - if (this.CheckNativeReturn(NativeApi.SpGetEnumNameValue(this._nativeSchema, index, out name, out num))) + if (CheckNativeReturn(NativeApi.SpGetEnumNameValue(_nativeSchema, index, out name, out num))) { if ((IntPtr)name != IntPtr.Zero) { @@ -115,11 +115,11 @@ namespace Microsoft.Iris.CodeModel.Cpp protected override void OnDispose() { base.OnDispose(); - NativeApi.SpReleaseExternalObject(this._nativeSchema); - this._nativeSchema = IntPtr.Zero; + NativeApi.SpReleaseExternalObject(_nativeSchema); + _nativeSchema = IntPtr.Zero; } - public object GetBoxedValue(int value) => this.EnumValueToObject(value); + public object GetBoxedValue(int value) => EnumValueToObject(value); protected override object EnumValueToObject(int value) => new DllEnumProxy(this, value); @@ -129,12 +129,12 @@ namespace Microsoft.Iris.CodeModel.Cpp { string str = null; IntPtr result; - if (this.CheckNativeReturn(NativeApi.SpInvokeEnumToString(this._nativeSchema, proxy.Value, out result))) + if (CheckNativeReturn(NativeApi.SpInvokeEnumToString(_nativeSchema, proxy.Value, out result))) str = DllProxyServices.GetString(result); return str; } - private DllLoadResult OwnerLoadResult => (DllLoadResult)this.Owner; + private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner; private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXEnum"); } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllEventSchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllEventSchema.cs index e57c426..a81e0c4 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllEventSchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllEventSchema.cs @@ -21,30 +21,30 @@ namespace Microsoft.Iris.CodeModel.Cpp { } - public bool Load(IntPtr eventSchema) => this.QueryEventName(eventSchema) && this.QueryIsStatic(eventSchema); + public bool Load(IntPtr eventSchema) => QueryEventName(eventSchema) && QueryIsStatic(eventSchema); [Conditional("DEBUG")] public void DEBUG_Dump() { } - public override string Name => this._name; + public override string Name => _name; - public bool IsStatic => this._isStatic; + public bool IsStatic => _isStatic; private unsafe bool QueryEventName(IntPtr eventSchema) { bool flag = false; char* name; - if (this.CheckNativeReturn(NativeApi.SpQueryEventName(eventSchema, out name))) + if (CheckNativeReturn(NativeApi.SpQueryEventName(eventSchema, out name))) { - this._name = NotifyService.CanonicalizeString(new string(name)); + _name = NotifyService.CanonicalizeString(new string(name)); flag = true; } return flag; } - private bool QueryIsStatic(IntPtr eventSchema) => this.CheckNativeReturn(NativeApi.SpQueryEventIsStatic(eventSchema, out this._isStatic)); + private bool QueryIsStatic(IntPtr eventSchema) => CheckNativeReturn(NativeApi.SpQueryEventIsStatic(eventSchema, out _isStatic)); private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXEvent"); } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllInterfaceProxy.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllInterfaceProxy.cs index 1593a72..54ef746 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllInterfaceProxy.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllInterfaceProxy.cs @@ -12,13 +12,13 @@ namespace Microsoft.Iris.CodeModel.Cpp { protected IntPtr _interface; - ~DllInterfaceProxy() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(this._interface)); + ~DllInterfaceProxy() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(_interface)); - protected override void OnDispose() => new DllProxyObject.AppThreadReleaseEntry(this._interface).Release(); + protected override void OnDispose() => new DllProxyObject.AppThreadReleaseEntry(_interface).Release(); protected override void LoadWorker(IntPtr nativeObject, IntPtr nativeMarshalAs) { - this._interface = nativeMarshalAs; + _interface = nativeMarshalAs; base.LoadWorker(nativeObject, nativeMarshalAs); } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllIntrinsicTypeSchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllIntrinsicTypeSchema.cs index 7e86936..dd9c6d0 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllIntrinsicTypeSchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllIntrinsicTypeSchema.cs @@ -15,9 +15,9 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllIntrinsicTypeSchema(DllLoadResult owner, uint ID, TypeSchema equivalentType) : base(owner, ID) { - this._baseType = ObjectSchema.Type; - this._name = InvariantString.Format(" {0}", equivalentType.Name); - this._marshalAs = ID; + _baseType = ObjectSchema.Type; + _name = InvariantString.Format(" {0}", equivalentType.Name); + _marshalAs = ID; RegisterOneWayEquivalence(this, equivalentType); } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResult.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResult.cs index 7908bd0..d2c2f57 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResult.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResult.cs @@ -87,14 +87,14 @@ namespace Microsoft.Iris.CodeModel.Cpp private TypeSchema MapIntrinsicType(uint typeID) { - if (this._intrinsicTypes == null) - this._intrinsicTypes = new Map(); + if (_intrinsicTypes == null) + _intrinsicTypes = new Map(); TypeSchema typeSchema; DllLoadResult.IntrinsicTypeData intrinsicTypeData; - if (!this._intrinsicTypes.TryGetValue(typeID, out typeSchema) && s_intrinsicData.TryGetValue(typeID, out intrinsicTypeData)) + if (!_intrinsicTypes.TryGetValue(typeID, out typeSchema) && s_intrinsicData.TryGetValue(typeID, out intrinsicTypeData)) { typeSchema = !intrinsicTypeData.DemandCreateTypeSchema ? intrinsicTypeData.FrameworkEquivalent : new DllIntrinsicTypeSchema(this, typeID, intrinsicTypeData.FrameworkEquivalent); - this._intrinsicTypes[typeID] = typeSchema; + _intrinsicTypes[typeID] = typeSchema; } return typeSchema; } @@ -102,31 +102,31 @@ namespace Microsoft.Iris.CodeModel.Cpp private TypeSchema MapLocalType(uint typeID) { TypeSchema typeSchema = null; - this._userDefinedTypes.TryGetValue(typeID, out typeSchema); + _userDefinedTypes.TryGetValue(typeID, out typeSchema); return typeSchema; } public DllLoadResult(DllLoadResultFactory sourceFactory, IntPtr nativeSchema, string uri) : base(uri) { - this._source = sourceFactory; - this._status = LoadResultStatus.Loading; - this._schema = nativeSchema; - this._loadPass = LoadPass.Invalid; - this._component = s_nextID++; + _source = sourceFactory; + _status = LoadResultStatus.Loading; + _schema = nativeSchema; + _loadPass = LoadPass.Invalid; + _component = s_nextID++; } public override void Load(LoadPass pass) { - if (pass <= this._loadPass || pass != LoadPass.DeclareTypes) + if (pass <= _loadPass || pass != LoadPass.DeclareTypes) return; - this._status = !this.SetSchemaID() || !this.LoadTypes() ? LoadResultStatus.Error : LoadResultStatus.Success; - this._loadPass = LoadPass.Done; + _status = !SetSchemaID() || !LoadTypes() ? LoadResultStatus.Error : LoadResultStatus.Success; + _loadPass = LoadPass.Done; } - public ushort SchemaComponent => this._component; + public ushort SchemaComponent => _component; - private bool SetSchemaID() => this.CheckNativeReturn(NativeApi.SpSetSchemaID(this._schema, this.SchemaComponent)); + private bool SetSchemaID() => CheckNativeReturn(NativeApi.SpSetSchemaID(_schema, SchemaComponent)); private bool LoadTypes() { @@ -134,13 +134,13 @@ namespace Microsoft.Iris.CodeModel.Cpp UIXIDVerifier idVerifier = new UIXIDVerifier(this); uint typeCount; uint enumCount; - if (this.CheckNativeReturn(NativeApi.SpQueryTypeCount(this._schema, out typeCount)) && this.CheckNativeReturn(NativeApi.SpQueryEnumCount(this._schema, out enumCount))) + if (CheckNativeReturn(NativeApi.SpQueryTypeCount(_schema, out typeCount)) && CheckNativeReturn(NativeApi.SpQueryEnumCount(_schema, out enumCount))) { int capacity = (int)typeCount + (int)enumCount; if (capacity > 0) { - this._userDefinedTypes = new Map(capacity); - if (!this.LoadClasses(typeCount, idVerifier) || !this.LoadEnums(enumCount, idVerifier) || !this.ResolveTypes(idVerifier)) + _userDefinedTypes = new Map(capacity); + if (!LoadClasses(typeCount, idVerifier) || !LoadEnums(enumCount, idVerifier) || !ResolveTypes(idVerifier)) goto label_4; } flag = true; @@ -156,7 +156,7 @@ namespace Microsoft.Iris.CodeModel.Cpp { for (uint index = 0; index < numClasses; ++index) { - if (!this.GetTypeSchema(index, idVerifier)) + if (!GetTypeSchema(index, idVerifier)) flag = true; } } @@ -168,11 +168,11 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = false; IntPtr type; uint ID; - if (this.CheckNativeReturn(NativeApi.SpGetTypeSchema(this._schema, index, out type, out ID))) + if (CheckNativeReturn(NativeApi.SpGetTypeSchema(_schema, index, out type, out ID))) { if (type != IntPtr.Zero) { - this.StoreType(new DllTypeSchema(this, ID, type), ID, true, idVerifier); + StoreType(new DllTypeSchema(this, ID, type), ID, true, idVerifier); flag = idVerifier.RegisterID(ID); } else @@ -181,7 +181,7 @@ namespace Microsoft.Iris.CodeModel.Cpp return flag; } - private void StoreType(TypeSchema schema, uint ID, bool isClass, UIXIDVerifier idVerifier) => this._userDefinedTypes[ID] = schema; + private void StoreType(TypeSchema schema, uint ID, bool isClass, UIXIDVerifier idVerifier) => _userDefinedTypes[ID] = schema; private static void DEBUG_DumpType(object param) { @@ -194,7 +194,7 @@ namespace Microsoft.Iris.CodeModel.Cpp { for (uint index = 0; index < numEnums; ++index) { - if (!this.GetEnumSchema(index, idVerifier)) + if (!GetEnumSchema(index, idVerifier)) flag = true; } } @@ -206,11 +206,11 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = false; IntPtr enumType; uint ID; - if (this.CheckNativeReturn(NativeApi.SpGetEnumSchema(this._schema, index, out enumType, out ID))) + if (CheckNativeReturn(NativeApi.SpGetEnumSchema(_schema, index, out enumType, out ID))) { if (enumType != IntPtr.Zero) { - this.StoreType(new DllEnumSchema(this, ID, enumType), ID, false, idVerifier); + StoreType(new DllEnumSchema(this, ID, enumType), ID, false, idVerifier); flag = idVerifier.RegisterID(ID); } else @@ -222,9 +222,9 @@ namespace Microsoft.Iris.CodeModel.Cpp private bool ResolveTypes(UIXIDVerifier idVerifier) { bool flag = false; - if (this._userDefinedTypes != null && this._userDefinedTypes.Count > 0) + if (_userDefinedTypes != null && _userDefinedTypes.Count > 0) { - foreach (TypeSchema typeSchema in this._userDefinedTypes.Values) + foreach (TypeSchema typeSchema in _userDefinedTypes.Values) { switch (typeSchema) { @@ -258,29 +258,29 @@ namespace Microsoft.Iris.CodeModel.Cpp protected override void OnDispose() { base.OnDispose(); - if (this._userDefinedTypes != null && this._userDefinedTypes.Count > 0) + if (_userDefinedTypes != null && _userDefinedTypes.Count > 0) { - foreach (DisposableObject disposableObject in this._userDefinedTypes.Values) + foreach (DisposableObject disposableObject in _userDefinedTypes.Values) disposableObject.Dispose(this); } - if (this._intrinsicTypes != null && this._intrinsicTypes.Count > 0) + if (_intrinsicTypes != null && _intrinsicTypes.Count > 0) { - foreach (TypeSchema typeSchema in this._intrinsicTypes.Values) + foreach (TypeSchema typeSchema in _intrinsicTypes.Values) { if (typeSchema is DllIntrinsicTypeSchema intrinsicTypeSchema) intrinsicTypeSchema.Dispose(this); } } - NativeApi.SpReleaseExternalObject(this._schema); - this._schema = IntPtr.Zero; - this._source.NotifyLoadResultDisposed(this); + NativeApi.SpReleaseExternalObject(_schema); + _schema = IntPtr.Zero; + _source.NotifyLoadResultDisposed(this); } public override TypeSchema FindType(string name) { - if (this._userDefinedTypes != null && this._userDefinedTypes.Count > 0) + if (_userDefinedTypes != null && _userDefinedTypes.Count > 0) { - foreach (TypeSchema typeSchema in this._userDefinedTypes.Values) + foreach (TypeSchema typeSchema in _userDefinedTypes.Values) { if (typeSchema.Name == name) return typeSchema; @@ -289,7 +289,7 @@ namespace Microsoft.Iris.CodeModel.Cpp return null; } - public override LoadResultStatus Status => this._status; + public override LoadResultStatus Status => _status; public override LoadResult[] Dependencies => EmptyList; @@ -323,15 +323,15 @@ namespace Microsoft.Iris.CodeModel.Cpp public IntrinsicTypeData(TypeSchema frameworkEquivalent, Type runtimeMarshalAsType) { - this._frameworkType = frameworkEquivalent; - this._runtimeType = runtimeMarshalAsType; + _frameworkType = frameworkEquivalent; + _runtimeType = runtimeMarshalAsType; } - public TypeSchema FrameworkEquivalent => this._frameworkType; + public TypeSchema FrameworkEquivalent => _frameworkType; - public Type MarshalAsRuntimeType => this._runtimeType; + public Type MarshalAsRuntimeType => _runtimeType; - public bool DemandCreateTypeSchema => this.MarshalAsRuntimeType != null; + public bool DemandCreateTypeSchema => MarshalAsRuntimeType != null; } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResultFactory.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResultFactory.cs index fed5c2f..2821060 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResultFactory.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllLoadResultFactory.cs @@ -66,9 +66,9 @@ namespace Microsoft.Iris.CodeModel.Cpp private DllLoadResultFactory(string dllName) { - this._dllName = dllName; - int num = (int)NativeApi.SpLoadDll(this._dllName, out this._module); - if ((int)NativeApi.SpCreateDllLoadResultFactory(this._module, out this._schemaFactory) >= 0) + _dllName = dllName; + int num = (int)NativeApi.SpLoadDll(_dllName, out _module); + if ((int)NativeApi.SpCreateDllLoadResultFactory(_module, out _schemaFactory) >= 0) return; ErrorManager.ReportError("Unable to create IUIXSchemaFactory from '{0}'", dllName); } @@ -76,31 +76,31 @@ namespace Microsoft.Iris.CodeModel.Cpp protected override void OnDispose() { base.OnDispose(); - s_dllFactoriesCache.Remove(this._dllName); - if (this._schemaFactory != IntPtr.Zero) + s_dllFactoriesCache.Remove(_dllName); + if (_schemaFactory != IntPtr.Zero) { - NativeApi.SpReleaseExternalObject(this._schemaFactory); - this._schemaFactory = IntPtr.Zero; + NativeApi.SpReleaseExternalObject(_schemaFactory); + _schemaFactory = IntPtr.Zero; } - if (!(this._module != IntPtr.Zero)) + if (!(_module != IntPtr.Zero)) return; - NativeApi.SpSendDllSchemaUnloadNotification(this._module); - NativeApi.SpFreeDll(this._module); - this._module = IntPtr.Zero; + NativeApi.SpSendDllSchemaUnloadNotification(_module); + NativeApi.SpFreeDll(_module); + _module = IntPtr.Zero; } private DllLoadResult GetLoadResult(string fullUri, string qualifier) { DllLoadResult dllLoadResult = null; IntPtr loadResult = IntPtr.Zero; - if (this._schemaFactory != IntPtr.Zero) + if (_schemaFactory != IntPtr.Zero) { - if ((int)NativeApi.SpCreateDllLoadResult(this._schemaFactory, qualifier, out loadResult) < 0) + if ((int)NativeApi.SpCreateDllLoadResult(_schemaFactory, qualifier, out loadResult) < 0) ErrorManager.ReportError("Unable to create IUIXSchema from '{0}'", fullUri); else if (loadResult != IntPtr.Zero) { dllLoadResult = new DllLoadResult(this, loadResult, fullUri); - this.RegisterUsage(dllLoadResult); + RegisterUsage(dllLoadResult); } else ErrorManager.ReportError("NULL object returned from {0}", "IUIXSchemaFactory::GetSchema"); @@ -112,7 +112,7 @@ namespace Microsoft.Iris.CodeModel.Cpp { s_loadResultCache.Remove(loadResult.Uri); s_loadResultIDCache.Remove(loadResult.SchemaComponent); - this.UnregisterUsage(loadResult); + UnregisterUsage(loadResult); } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllMethodSchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllMethodSchema.cs index e1932a3..7f9d88e 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllMethodSchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllMethodSchema.cs @@ -21,56 +21,56 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllMethodSchema(DllTypeSchema owner, uint ID) : base(owner) - => this._id = ID; + => _id = ID; - public bool Load(IntPtr method) => this.QueryMethodName(method) && this.QueryForParameterTypes(method) && this.QueryReturnType(method) && this.QueryIsStatic(method); + public bool Load(IntPtr method) => QueryMethodName(method) && QueryForParameterTypes(method) && QueryReturnType(method) && QueryIsStatic(method); - public uint ID => this._id; + public uint ID => _id; [Conditional("DEBUG")] public void DEBUG_Dump() { string str1 = string.Empty; - if (this.IsStatic) + if (IsStatic) str1 = "static "; string str2 = "void"; - if (this.ReturnType != null) - str2 = this.ReturnType.Name; + if (ReturnType != null) + str2 = ReturnType.Name; string str3 = string.Empty; - if (this._parameterTypes != null) + if (_parameterTypes != null) { - for (int index = 0; index < this._parameterTypes.Length; ++index) + for (int index = 0; index < _parameterTypes.Length; ++index) { string str4 = ""; - if (this._parameterTypes[index] != null) - str4 = this._parameterTypes[index].Name; + if (_parameterTypes[index] != null) + str4 = _parameterTypes[index].Name; str3 = string.Format("{0}{1}{2}", str3, index > 0 ? ", " : string.Empty, str4); } } string.Format("0x{0:x8} {1}{2} {3}({4})", _id, str1, str2, Name, str3); } - public override string Name => this._name; + public override string Name => _name; - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; - public override TypeSchema ReturnType => this._returnType; + public override TypeSchema ReturnType => _returnType; - public override bool IsStatic => this._isStatic; + public override bool IsStatic => _isStatic; - private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)this.Owner; + private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)Owner; - public override object Invoke(object instance, object[] parameters) => this.OwnerTypeSchema.InvokeMethod(instance, this, parameters); + public override object Invoke(object instance, object[] parameters) => OwnerTypeSchema.InvokeMethod(instance, this, parameters); - private DllLoadResult OwnerLoadResult => (DllLoadResult)this.Owner.Owner; + private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner.Owner; private unsafe bool QueryMethodName(IntPtr method) { bool flag = false; char* name; - if (this.CheckNativeReturn(NativeApi.SpQueryMethodName(method, out name))) + if (CheckNativeReturn(NativeApi.SpQueryMethodName(method, out name))) { - this._name = new string(name); + _name = new string(name); flag = true; } return flag; @@ -80,20 +80,20 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag1 = false; uint count; - if (this.CheckNativeReturn(NativeApi.SpQueryMethodParameterCount(method, out count))) + if (CheckNativeReturn(NativeApi.SpQueryMethodParameterCount(method, out count))) { if (count > 0U) { uint[] IDs = new uint[(int)count]; - if (this.CheckNativeReturn(NativeApi.SpGetMethodParameterTypes(method, IDs, count))) + if (CheckNativeReturn(NativeApi.SpGetMethodParameterTypes(method, IDs, count))) { - this._parameterTypes = new TypeSchema[(int)count]; + _parameterTypes = new TypeSchema[(int)count]; bool flag2 = false; for (uint index = 0; index < count; ++index) { TypeSchema typeSchema = DllLoadResult.MapType(IDs[index]); if (typeSchema != null) - this._parameterTypes[index] = typeSchema; + _parameterTypes[index] = typeSchema; else flag2 = true; } @@ -102,7 +102,7 @@ namespace Microsoft.Iris.CodeModel.Cpp } else { - this._parameterTypes = TypeSchema.EmptyList; + _parameterTypes = TypeSchema.EmptyList; flag1 = true; } } @@ -113,15 +113,15 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; uint type; - if (this.CheckNativeReturn(NativeApi.SpQueryMethodReturnType(method, out type))) + if (CheckNativeReturn(NativeApi.SpQueryMethodReturnType(method, out type))) { - this._returnType = DllLoadResult.MapType(type); - flag = this._returnType != null; + _returnType = DllLoadResult.MapType(type); + flag = _returnType != null; } return flag; } - private bool QueryIsStatic(IntPtr method) => this.CheckNativeReturn(NativeApi.SpQueryMethodIsStatic(method, out this._isStatic)); + private bool QueryIsStatic(IntPtr method) => CheckNativeReturn(NativeApi.SpQueryMethodIsStatic(method, out _isStatic)); private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXMethod"); } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllPropertySchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllPropertySchema.cs index 4f5c58f..2b84047 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllPropertySchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllPropertySchema.cs @@ -21,44 +21,44 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllPropertySchema(DllTypeSchema owner, uint ID) : base(owner) - => this._id = ID; + => _id = ID; - public bool Load(IntPtr property) => this.QueryPropertyName(property) && this.QueryPropertyType(property) && (this.QueryCanRead(property) && this.QueryCanWrite(property)) && this.QueryIsStatic(property) && this.QueryNotifiesOnChange(property); + public bool Load(IntPtr property) => QueryPropertyName(property) && QueryPropertyType(property) && (QueryCanRead(property) && QueryCanWrite(property)) && QueryIsStatic(property) && QueryNotifiesOnChange(property); - public uint ID => this._id; + public uint ID => _id; [Conditional("DEBUG")] public void DEBUG_Dump() { string str1 = string.Empty; - if (this.IsStatic) + if (IsStatic) str1 = "static "; string str2 = ""; - if (this.PropertyType != null) - str2 = this.PropertyType.Name; + if (PropertyType != null) + str2 = PropertyType.Name; string str3 = string.Empty; - if (this.CanRead) + if (CanRead) str3 = "get;"; string str4 = string.Empty; - if (this.CanWrite) - str4 = string.Format("{0}set;", this.CanRead ? " " : string.Empty); + if (CanWrite) + str4 = string.Format("{0}set;", CanRead ? " " : string.Empty); string str5 = ""; - if (!this.NotifiesOnChange) + if (!NotifiesOnChange) str5 = ""; string.Format("0x{0:x8} {1}{2} {3} {{{4}{5}}} {6}", _id, str1, str2, Name, str3, str4, str5); } - public override string Name => this._name; + public override string Name => _name; - public override TypeSchema PropertyType => this._type; + public override TypeSchema PropertyType => _type; public override TypeSchema AlternateType => (TypeSchema)null; - public override bool CanRead => this.GetBit(Bits.CanRead); + public override bool CanRead => GetBit(Bits.CanRead); - public override bool CanWrite => this.GetBit(Bits.CanWrite); + public override bool CanWrite => GetBit(Bits.CanWrite); - public override bool IsStatic => this.GetBit(Bits.IsStatic); + public override bool IsStatic => GetBit(Bits.IsStatic); public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None; @@ -66,23 +66,23 @@ namespace Microsoft.Iris.CodeModel.Cpp public override RangeValidator RangeValidator => (RangeValidator)null; - public override bool NotifiesOnChange => this.GetBit(Bits.NotifiesOnChange); + public override bool NotifiesOnChange => GetBit(Bits.NotifiesOnChange); - private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)this.Owner; + private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)Owner; - public override object GetValue(object instance) => this.OwnerTypeSchema.GetPropertyValue(instance, this); + public override object GetValue(object instance) => OwnerTypeSchema.GetPropertyValue(instance, this); - public override void SetValue(ref object instance, object value) => this.OwnerTypeSchema.SetPropertyValue(instance, this, value); + public override void SetValue(ref object instance, object value) => OwnerTypeSchema.SetPropertyValue(instance, this, value); - private DllLoadResult OwnerLoadResult => (DllLoadResult)this.Owner.Owner; + private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner.Owner; private unsafe bool QueryPropertyName(IntPtr property) { bool flag = false; char* name; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyName(property, out name))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyName(property, out name))) { - this._name = NotifyService.CanonicalizeString(new string(name)); + _name = NotifyService.CanonicalizeString(new string(name)); flag = true; } return flag; @@ -92,9 +92,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; uint type; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyType(property, out type))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyType(property, out type))) { - this._type = DllLoadResult.MapType(type); + _type = DllLoadResult.MapType(type); flag = true; } return flag; @@ -104,9 +104,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; bool canRead; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCanRead(property, out canRead))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyCanRead(property, out canRead))) { - this.SetBit(Bits.CanRead, canRead); + SetBit(Bits.CanRead, canRead); flag = true; } return flag; @@ -116,9 +116,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; bool canWrite; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCanWrite(property, out canWrite))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyCanWrite(property, out canWrite))) { - this.SetBit(Bits.CanWrite, canWrite); + SetBit(Bits.CanWrite, canWrite); flag = true; } return flag; @@ -128,9 +128,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; bool isStatic; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyIsStatic(property, out isStatic))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyIsStatic(property, out isStatic))) { - this.SetBit(Bits.IsStatic, isStatic); + SetBit(Bits.IsStatic, isStatic); flag = true; } return flag; @@ -142,17 +142,17 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; bool notifiesOnChange; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyNotifiesOnChange(property, out notifiesOnChange))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyNotifiesOnChange(property, out notifiesOnChange))) { - this.SetBit(Bits.NotifiesOnChange, notifiesOnChange); + SetBit(Bits.NotifiesOnChange, notifiesOnChange); flag = true; } return flag; } - private bool GetBit(DllPropertySchema.Bits lookupBit) => this._bits[(int)lookupBit]; + private bool GetBit(DllPropertySchema.Bits lookupBit) => _bits[(int)lookupBit]; - private void SetBit(DllPropertySchema.Bits changeBit, bool value) => this._bits[(int)changeBit] = value; + private void SetBit(DllPropertySchema.Bits changeBit, bool value) => _bits[(int)changeBit] = value; private enum Bits : uint { diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyHandleTable.cs index 46bb4c3..cb27d8d 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyHandleTable.cs @@ -10,9 +10,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { internal class DllProxyHandleTable : ProxyHandleTable { - public DllProxyHandleTable.DllProxyHandleTableEnumerator GetEnumerator() => new DllProxyHandleTable.DllProxyHandleTableEnumerator(this.GetTableEnumerator()); + public DllProxyHandleTable.DllProxyHandleTableEnumerator GetEnumerator() => new DllProxyHandleTable.DllProxyHandleTableEnumerator(GetTableEnumerator()); - public ulong RegisterProxy(object d) => this.AllocateHandle(new DllProxyObjectReference() + public ulong RegisterProxy(object d) => AllocateHandle(new DllProxyObjectReference() { Value = d }); @@ -20,14 +20,14 @@ namespace Microsoft.Iris.CodeModel.Cpp public void ReleaseProxy(ulong handle) { DllProxyObjectReference oldValue; - this.ReleaseHandle(handle, out oldValue); + ReleaseHandle(handle, out oldValue); oldValue.Value = null; } protected bool LookupByHandleWorker(ulong handle, out object obj) { DllProxyObjectReference proxyObjectReference; - bool flag = this.InternalLookupByHandle(handle, out proxyObjectReference); + bool flag = InternalLookupByHandle(handle, out proxyObjectReference); obj = !flag ? null : proxyObjectReference.Value; return flag; } @@ -39,7 +39,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllProxyHandleTableEnumerator( ProxyHandleTable.ProxyHandleTableEnumerator enumerator) { - this._enumerator = enumerator; + _enumerator = enumerator; } public bool MoveNext() @@ -47,15 +47,15 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag; do { - flag = this._enumerator.MoveNext(); + flag = _enumerator.MoveNext(); } - while ((!flag || this._enumerator.Current.Value == null) && flag); + while ((!flag || _enumerator.Current.Value == null) && flag); return flag; } - public object Current => this._enumerator.Current.Value; + public object Current => _enumerator.Current.Value; - public void Reset() => this._enumerator.Reset(); + public void Reset() => _enumerator.Reset(); } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyList.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyList.cs index 4d9407b..0107a5b 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyList.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyList.cs @@ -33,15 +33,15 @@ namespace Microsoft.Iris.CodeModel.Cpp protected override void LoadWorker(IntPtr nativeObject, IntPtr nativeMarshalAs) { base.LoadWorker(nativeObject, nativeMarshalAs); - NativeApi.SUCCEEDED(NativeApi.SpUIXListWantSlowDataRequests(this._interface, out this._wantSlowDataRequests)); - if (!this._wantSlowDataRequests) + NativeApi.SUCCEEDED(NativeApi.SpUIXListWantSlowDataRequests(_interface, out _wantSlowDataRequests)); + if (!_wantSlowDataRequests) return; - this._updater = new UpdateHelper(this); + _updater = new UpdateHelper(this); } protected override void OnDispose() { - this.UpdateCallbackRegistration(true); + UpdateCallbackRegistration(true); base.OnDispose(); } @@ -50,30 +50,30 @@ namespace Microsoft.Iris.CodeModel.Cpp int count = 0; UIXVariant uixVariant; UIXVariant.MarshalObject(value, &uixVariant); - NativeApi.SUCCEEDED(NativeApi.SpUIXListAdd(this._interface, &uixVariant, out count)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListAdd(_interface, &uixVariant, out count)); UIXVariant.CleanupMarshalledObject(&uixVariant); return count; } - public bool Contains(object value) => this.IndexOf(value) >= 0; + public bool Contains(object value) => IndexOf(value) >= 0; public unsafe int IndexOf(object value) { int index = -1; UIXVariant uixVariant; UIXVariant.MarshalObject(value, &uixVariant); - NativeApi.SUCCEEDED(NativeApi.SpUIXListIndexOf(this._interface, &uixVariant, out index)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListIndexOf(_interface, &uixVariant, out index)); UIXVariant.CleanupMarshalledObject(&uixVariant); return index; } - public void Clear() => NativeApi.SUCCEEDED(NativeApi.SpUIXListClear(this._interface)); + public void Clear() => NativeApi.SUCCEEDED(NativeApi.SpUIXListClear(_interface)); public unsafe void Insert(int index, object value) { UIXVariant uixVariant; UIXVariant.MarshalObject(value, &uixVariant); - NativeApi.SUCCEEDED(NativeApi.SpUIXListInsert(this._interface, index, &uixVariant)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListInsert(_interface, index, &uixVariant)); UIXVariant.CleanupMarshalledObject(&uixVariant); } @@ -81,11 +81,11 @@ namespace Microsoft.Iris.CodeModel.Cpp { UIXVariant uixVariant; UIXVariant.MarshalObject(value, &uixVariant); - NativeApi.SUCCEEDED(NativeApi.SpUIXListRemove(this._interface, &uixVariant)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListRemove(_interface, &uixVariant)); UIXVariant.CleanupMarshalledObject(&uixVariant); } - public void RemoveAt(int index) => NativeApi.SUCCEEDED(NativeApi.SpUIXListRemoveAt(this._interface, index)); + public void RemoveAt(int index) => NativeApi.SUCCEEDED(NativeApi.SpUIXListRemoveAt(_interface, index)); public void CopyTo(Array array, int index) => throw new NotImplementedException(); @@ -94,7 +94,7 @@ namespace Microsoft.Iris.CodeModel.Cpp get { int count = 0; - NativeApi.SUCCEEDED(NativeApi.SpUIXListGetCount(this._interface, out count)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListGetCount(_interface, out count)); return count; } } @@ -108,7 +108,7 @@ namespace Microsoft.Iris.CodeModel.Cpp bool IVirtualList.IsItemAvailable(int index) { bool isAvailable; - NativeApi.SUCCEEDED(NativeApi.SpUIXListIsItemAvailable(this._interface, index, out isAvailable)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListIsItemAvailable(_interface, index, out isAvailable)); return isAvailable; } @@ -124,7 +124,7 @@ namespace Microsoft.Iris.CodeModel.Cpp { object obj = null; UIXVariant inboundObject; - if (NativeApi.SUCCEEDED(NativeApi.SpUIXListGetItem(this._interface, index, out inboundObject))) + if (NativeApi.SUCCEEDED(NativeApi.SpUIXListGetItem(_interface, index, out inboundObject))) obj = UIXVariant.GetValue(inboundObject, OwningLoadResult); return obj; } @@ -132,14 +132,14 @@ namespace Microsoft.Iris.CodeModel.Cpp { UIXVariant uixVariant; UIXVariant.MarshalObject(value, &uixVariant); - NativeApi.SUCCEEDED(NativeApi.SpUIXListSetItem(this._interface, index, &uixVariant)); + NativeApi.SUCCEEDED(NativeApi.SpUIXListSetItem(_interface, index, &uixVariant)); UIXVariant.CleanupMarshalledObject(&uixVariant); } } public object SyncRoot => (object)null; - IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); public StackIListEnumerator GetEnumerator() => new StackIListEnumerator(this); @@ -147,22 +147,22 @@ namespace Microsoft.Iris.CodeModel.Cpp { add { - if (this._contentsChanged == null) - this.UpdateCallbackRegistration(); - this._contentsChanged += value; + if (_contentsChanged == null) + UpdateCallbackRegistration(); + _contentsChanged += value; } remove { - this._contentsChanged -= value; - if (this._contentsChanged != null) + _contentsChanged -= value; + if (_contentsChanged != null) return; - this.UpdateCallbackRegistration(); + UpdateCallbackRegistration(); } } public void Move(int oldIndex, int newIndex) { - int num = (int)NativeApi.SpUIXListMove(this._interface, oldIndex, newIndex); + int num = (int)NativeApi.SpUIXListMove(_interface, oldIndex, newIndex); } public void ListChanged(int nativeType, int oldIndex, int newIndex, int count) @@ -181,13 +181,13 @@ namespace Microsoft.Iris.CodeModel.Cpp case UIListContentsChangeType.Reset: if (!flag1) break; - if (this._contentsChanged != null) - this._contentsChanged(this, new UIListContentsChangedArgs(type, oldIndex, newIndex, count)); + if (_contentsChanged != null) + _contentsChanged(this, new UIListContentsChangedArgs(type, oldIndex, newIndex, count)); if (flag2) - this.FireNotification(NotificationID.Count); - if (this._updater == null) + FireNotification(NotificationID.Count); + if (_updater == null) break; - this.ForwardListChangeToUpdater(type, oldIndex, newIndex, count); + ForwardListChangeToUpdater(type, oldIndex, newIndex, count); break; case UIListContentsChangeType.Move: case UIListContentsChangeType.Modified: @@ -208,8 +208,8 @@ namespace Microsoft.Iris.CodeModel.Cpp switch (type) { case UIListContentsChangeType.Remove: - this._updater.RemoveIndex(oldIndex); - this._updater.AdjustIndices(oldIndex, -1); + _updater.RemoveIndex(oldIndex); + _updater.AdjustIndices(oldIndex, -1); break; case UIListContentsChangeType.Move: int lowThreshold; @@ -227,93 +227,93 @@ namespace Microsoft.Iris.CodeModel.Cpp highThreshold = oldIndex; amt = 1; } - this._updater.RemoveIndex(oldIndex); - this._updater.AdjustIndices(lowThreshold, highThreshold, amt); - this._updater.AddIndex(newIndex); + _updater.RemoveIndex(oldIndex); + _updater.AdjustIndices(lowThreshold, highThreshold, amt); + _updater.AddIndex(newIndex); break; case UIListContentsChangeType.Insert: - this._updater.AdjustIndices(newIndex, 1); + _updater.AdjustIndices(newIndex, 1); break; case UIListContentsChangeType.InsertRange: - this._updater.AdjustIndices(newIndex, count); + _updater.AdjustIndices(newIndex, count); break; case UIListContentsChangeType.Clear: case UIListContentsChangeType.Reset: - this._updater.Clear(); + _updater.Clear(); break; } } - public bool SlowDataRequestsEnabled => this._wantSlowDataRequests; + public bool SlowDataRequestsEnabled => _wantSlowDataRequests; - public void NotifyRequestSlowData(int index) => NativeApi.SUCCEEDED(NativeApi.SpUIXListFetchSlowData(this._interface, index)); + public void NotifyRequestSlowData(int index) => NativeApi.SUCCEEDED(NativeApi.SpUIXListFetchSlowData(_interface, index)); public void SlowDataAcquireComplete(int index) { bool flag = false; - if (this._slowDataAcquireCompleteHandler != null) - flag = this._slowDataAcquireCompleteHandler(this, index); + if (_slowDataAcquireCompleteHandler != null) + flag = _slowDataAcquireCompleteHandler(this, index); if (flag) return; - this._updater.NotifySlowDataAcquireComplete(index); + _updater.NotifySlowDataAcquireComplete(index); } public SlowDataAcquireCompleteHandler SlowDataAcquireCompleteHandler { - get => this._slowDataAcquireCompleteHandler; + get => _slowDataAcquireCompleteHandler; set { - if (!(value != this._slowDataAcquireCompleteHandler)) + if (!(value != _slowDataAcquireCompleteHandler)) return; - this._slowDataAcquireCompleteHandler = value; - this.UpdateCallbackRegistration(); + _slowDataAcquireCompleteHandler = value; + UpdateCallbackRegistration(); } } public void NotifyVisualsCreated(int index) { - if (this._updater != null) - this._updater.AddIndex(index); - NativeApi.SUCCEEDED(NativeApi.SpUIXListNotifyVisualsCreated(this._interface, index)); + if (_updater != null) + _updater.AddIndex(index); + NativeApi.SUCCEEDED(NativeApi.SpUIXListNotifyVisualsCreated(_interface, index)); } public void NotifyVisualsReleased(int index) { - if (this._updater != null) - this._updater.RemoveIndex(index); - NativeApi.SUCCEEDED(NativeApi.SpUIXListNotifyVisualsReleased(this._interface, index)); + if (_updater != null) + _updater.RemoveIndex(index); + NativeApi.SUCCEEDED(NativeApi.SpUIXListNotifyVisualsReleased(_interface, index)); } public Repeater RepeaterHost { - get => this._repeater; + get => _repeater; set { - if (value == this._repeater) + if (value == _repeater) return; - this._repeater = value; - this.UpdateCallbackRegistration(); + _repeater = value; + UpdateCallbackRegistration(); } } - private void UpdateCallbackRegistration() => this.UpdateCallbackRegistration(false); + private void UpdateCallbackRegistration() => UpdateCallbackRegistration(false); private void UpdateCallbackRegistration(bool inDispose) { - bool flag = (this._slowDataAcquireCompleteHandler != null || this._contentsChanged != null || this._repeater != null) & !inDispose; - if (flag == this._callbacksRegistered) + bool flag = (_slowDataAcquireCompleteHandler != null || _contentsChanged != null || _repeater != null) & !inDispose; + if (flag == _callbacksRegistered) return; if (flag) { - int num1 = (int)NativeApi.SpUIXListRegisterCallbacks(this._interface, this); + int num1 = (int)NativeApi.SpUIXListRegisterCallbacks(_interface, this); } else { - int num2 = (int)NativeApi.SpUIXListUnregisterCallbacks(this._interface, this); - if (this._updater != null) - this._updater.Clear(); + int num2 = (int)NativeApi.SpUIXListUnregisterCallbacks(_interface, this); + if (_updater != null) + _updater.Clear(); } - this._callbacksRegistered = flag; + _callbacksRegistered = flag; } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObject.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObject.cs index 8f112ea..9fb63ba 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObject.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObject.cs @@ -115,9 +115,9 @@ namespace Microsoft.Iris.CodeModel.Cpp return flag; } - protected DllProxyObject() => this._handle = 0UL; + protected DllProxyObject() => _handle = 0UL; - ~DllProxyObject() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(this._nativeObject, this._handle, this.OwningLoadResult)); + ~DllProxyObject() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(_nativeObject, _handle, OwningLoadResult)); protected static void RegisterAppThreadRelease(DllProxyObject.AppThreadReleaseEntry entry) { @@ -135,13 +135,13 @@ namespace Microsoft.Iris.CodeModel.Cpp private void Load(IntPtr nativeObject, IntPtr marshalAs, DllTypeSchemaBase type) { - this._type = type; - this._nativeObject = nativeObject; - this.OwningLoadResult.RegisterProxyUsage(); - this._handle = s_handleTable.RegisterProxy(this); - NativeApi.SpSetStateCache(this._nativeObject, this._handle); - NativeApi.SpAddRefExternalObject(this._nativeObject); - this.LoadWorker(nativeObject, marshalAs); + _type = type; + _nativeObject = nativeObject; + OwningLoadResult.RegisterProxyUsage(); + _handle = s_handleTable.RegisterProxy(this); + NativeApi.SpSetStateCache(_nativeObject, _handle); + NativeApi.SpAddRefExternalObject(_nativeObject); + LoadWorker(nativeObject, marshalAs); } protected virtual void LoadWorker(IntPtr nativeObject, IntPtr nativeMarshalAs) @@ -170,17 +170,17 @@ namespace Microsoft.Iris.CodeModel.Cpp return hresult; } - public ulong Handle => this._handle; + public ulong Handle => _handle; - public IntPtr NativeObject => this._nativeObject; + public IntPtr NativeObject => _nativeObject; public TypeSchema TypeSchema => _type; - protected DllLoadResult OwningLoadResult => this._type.Owner as DllLoadResult; + protected DllLoadResult OwningLoadResult => _type.Owner as DllLoadResult; private static bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXObject"); - bool IDisposableObject.IsDisposed => this._nativeObject == IntPtr.Zero; + bool IDisposableObject.IsDisposed => _nativeObject == IntPtr.Zero; void IDisposableObject.DeclareOwner(object owner) { @@ -192,8 +192,8 @@ namespace Microsoft.Iris.CodeModel.Cpp void IDisposableObject.Dispose(object owner) { - this.OnDispose(); - new DllProxyObject.AppThreadReleaseEntry(this._nativeObject, this._handle, this.OwningLoadResult).Release(); + OnDispose(); + new DllProxyObject.AppThreadReleaseEntry(_nativeObject, _handle, OwningLoadResult).Release(); GC.SuppressFinalize(this); } @@ -227,7 +227,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public string DEBUG_Description() => string.Empty; - public override string ToString() => this._type is DllTypeSchema type ? type.InvokeToString(this) : this.GetType().Name; + public override string ToString() => _type is DllTypeSchema type ? type.InvokeToString(this) : GetType().Name; internal struct AppThreadReleaseEntry { @@ -238,34 +238,34 @@ namespace Microsoft.Iris.CodeModel.Cpp public AppThreadReleaseEntry(IntPtr nativeObject, ulong handle, DllLoadResult loadResult) { - this._nativeObject = nativeObject; - this._handle = handle; - this._loadResult = loadResult; - this._releaseHandle = true; + _nativeObject = nativeObject; + _handle = handle; + _loadResult = loadResult; + _releaseHandle = true; } public AppThreadReleaseEntry(IntPtr nativeObject) { - this._nativeObject = nativeObject; - this._releaseHandle = false; - this._handle = 0UL; - this._loadResult = null; + _nativeObject = nativeObject; + _releaseHandle = false; + _handle = 0UL; + _loadResult = null; } public void Release() { - if (this._releaseHandle) + if (_releaseHandle) { - s_handleTable.ReleaseProxy(this._handle); + s_handleTable.ReleaseProxy(_handle); ulong state; - NativeApi.SpGetStateCache(this._nativeObject, out state); - if ((long)this._handle == (long)state) - NativeApi.SpSetStateCache(this._nativeObject, 0UL); + NativeApi.SpGetStateCache(_nativeObject, out state); + if ((long)_handle == (long)state) + NativeApi.SpSetStateCache(_nativeObject, 0UL); } - NativeApi.SpReleaseExternalObject(this._nativeObject); - if (!this._releaseHandle) + NativeApi.SpReleaseExternalObject(_nativeObject); + if (!_releaseHandle) return; - this._loadResult.UnregisterProxyUsage(); + _loadResult.UnregisterProxyUsage(); } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectHandleTable.cs index 16d90f0..7f6a493 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectHandleTable.cs @@ -11,7 +11,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public bool LookupByHandle(ulong handle, out DllProxyObject obj) { object obj1; - bool flag = this.LookupByHandleWorker(handle, out obj1); + bool flag = LookupByHandleWorker(handle, out obj1); obj = (DllProxyObject)obj1; return flag; } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectReference.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectReference.cs index 1801697..82b8150 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectReference.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyObjectReference.cs @@ -17,24 +17,24 @@ namespace Microsoft.Iris.CodeModel.Cpp get { object obj = null; - if (this._reference.IsAllocated) - obj = this._reference.Target; + if (_reference.IsAllocated) + obj = _reference.Target; return obj; } set { if (value != null) { - if (this._reference.IsAllocated) - this._reference.Target = value; + if (_reference.IsAllocated) + _reference.Target = value; else - this._reference = GCHandle.Alloc(value, GCHandleType.Weak); + _reference = GCHandle.Alloc(value, GCHandleType.Weak); } else { - if (!this._reference.IsAllocated) + if (!_reference.IsAllocated) return; - this._reference.Free(); + _reference.Free(); } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyServices.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyServices.cs index 43d0afe..adc837c 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyServices.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllProxyServices.cs @@ -305,7 +305,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public IntPtr _callback; public IntPtr _data; - public void Thunk() => NativeApi.SpCallDeferredInvokeProc(this._callback, this._data); + public void Thunk() => NativeApi.SpCallDeferredInvokeProc(_callback, _data); } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchema.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchema.cs index 9e89f7f..a4b09e7 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchema.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchema.cs @@ -21,12 +21,12 @@ namespace Microsoft.Iris.CodeModel.Cpp public DllTypeSchema(DllLoadResult owner, uint ID, IntPtr typeSchema) : base(owner, ID) - => this._type = typeSchema; + => _type = typeSchema; public bool Load(UIXIDVerifier idVerifier) { DllLoadResult.PushContext(OwnerLoadResult); - bool flag = this.QueryTypeName() && this.QueryIsRuntimeImmutable() && (this.QueryBaseType() && this.QueryConstructors(idVerifier)) && (this.QueryProperties(idVerifier) && this.QueryMethods(idVerifier) && this.QueryEvents(idVerifier)) && this.QueryMarshalAs(); + bool flag = QueryTypeName() && QueryIsRuntimeImmutable() && (QueryBaseType() && QueryConstructors(idVerifier)) && (QueryProperties(idVerifier) && QueryMethods(idVerifier) && QueryEvents(idVerifier)) && QueryMarshalAs(); DllLoadResult.PopContext(); return flag; } @@ -40,11 +40,11 @@ namespace Microsoft.Iris.CodeModel.Cpp private void DEBUG_DumpConstructors() { bool flag = false; - if (this.HasDefaultConstructor) + if (HasDefaultConstructor) flag = true; - if (this._constructors != null) + if (_constructors != null) { - foreach (DllConstructorSchema constructorSchema in this._constructors.Values) + foreach (DllConstructorSchema constructorSchema in _constructors.Values) ; flag = true; } @@ -54,27 +54,27 @@ namespace Microsoft.Iris.CodeModel.Cpp [Conditional("DEBUG")] private void DEBUG_DumpProperties() { - if (this._properties == null) + if (_properties == null) return; - foreach (DllPropertySchema dllPropertySchema in this._properties.Values) + foreach (DllPropertySchema dllPropertySchema in _properties.Values) ; } [Conditional("DEBUG")] private void DEBUG_DumpMethods() { - if (this._methods == null) + if (_methods == null) return; - foreach (DllMethodSchema dllMethodSchema in this._methods.Values) + foreach (DllMethodSchema dllMethodSchema in _methods.Values) ; } [Conditional("DEBUG")] private void DEBUG_DumpEvents() { - if (this._events == null) + if (_events == null) return; - foreach (DllEventSchema dllEventSchema in this._events.Values) + foreach (DllEventSchema dllEventSchema in _events.Values) ; } @@ -82,9 +82,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; char* name; - if (this.CheckNativeReturn(NativeApi.SpQueryTypeName(this._type, out name))) + if (CheckNativeReturn(NativeApi.SpQueryTypeName(_type, out name))) { - this._name = new string(name); + _name = new string(name); flag = true; } return flag; @@ -94,9 +94,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; bool isRuntimeImmutable; - if (this.CheckNativeReturn(NativeApi.SpIsRuntimeImmutable(this._type, out isRuntimeImmutable))) + if (CheckNativeReturn(NativeApi.SpIsRuntimeImmutable(_type, out isRuntimeImmutable))) { - this.SetBit(Bits.IsRuntimeImmutable, isRuntimeImmutable); + SetBit(Bits.IsRuntimeImmutable, isRuntimeImmutable); flag = true; } return flag; @@ -106,9 +106,9 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; uint baseTypeID; - if (this.CheckNativeReturn(NativeApi.SpQueryBaseType(this._type, out baseTypeID))) + if (CheckNativeReturn(NativeApi.SpQueryBaseType(_type, out baseTypeID))) { - this._baseType = DllLoadResult.MapType(baseTypeID); + _baseType = DllLoadResult.MapType(baseTypeID); flag = true; } return flag; @@ -118,13 +118,13 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag1 = false; uint count; - if (this.CheckNativeReturn(NativeApi.SpQueryConstructorCount(this._type, out count))) + if (CheckNativeReturn(NativeApi.SpQueryConstructorCount(_type, out count))) { bool flag2 = false; - this._constructors = new Map((int)count); + _constructors = new Map((int)count); for (uint index = 0; index < count; ++index) { - if (!this.LoadConstructor(index, idVerifier)) + if (!LoadConstructor(index, idVerifier)) flag2 = true; } flag1 = !flag2; @@ -137,7 +137,7 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = false; IntPtr constructor; uint ID; - if (this.CheckNativeReturn(NativeApi.SpGetConstructorSchema(this._type, index, out constructor, out ID))) + if (CheckNativeReturn(NativeApi.SpGetConstructorSchema(_type, index, out constructor, out ID))) { if (constructor != IntPtr.Zero) { @@ -145,11 +145,11 @@ namespace Microsoft.Iris.CodeModel.Cpp flag = constructorSchema.Load(constructor); if (flag) { - this._constructors[new MethodSignatureKey(constructorSchema.ParameterTypes)] = constructorSchema; + _constructors[new MethodSignatureKey(constructorSchema.ParameterTypes)] = constructorSchema; if (constructorSchema.ParameterTypes.Length == 0) { - this.SetBit(Bits.HasDefaultConstructor, true); - this._defaultConstructorID = ID; + SetBit(Bits.HasDefaultConstructor, true); + _defaultConstructorID = ID; } flag = idVerifier.RegisterID(ID); } @@ -167,13 +167,13 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag1 = false; uint count; - if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCount(this._type, out count))) + if (CheckNativeReturn(NativeApi.SpQueryPropertyCount(_type, out count))) { bool flag2 = false; - this._properties = new Map((int)count); + _properties = new Map((int)count); for (uint index = 0; index < count; ++index) { - if (!this.LoadProperty(index, idVerifier)) + if (!LoadProperty(index, idVerifier)) flag2 = true; } flag1 = !flag2; @@ -186,7 +186,7 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = false; IntPtr property; uint ID; - if (this.CheckNativeReturn(NativeApi.SpGetPropertySchema(this._type, index, out property, out ID))) + if (CheckNativeReturn(NativeApi.SpGetPropertySchema(_type, index, out property, out ID))) { if (property != IntPtr.Zero) { @@ -194,7 +194,7 @@ namespace Microsoft.Iris.CodeModel.Cpp flag = dllPropertySchema.Load(property); if (flag) { - this._properties[ID] = dllPropertySchema; + _properties[ID] = dllPropertySchema; flag = idVerifier.RegisterID(ID); } NativeApi.SpReleaseExternalObject(property); @@ -209,13 +209,13 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag1 = false; uint count; - if (this.CheckNativeReturn(NativeApi.SpQueryMethodCount(this._type, out count))) + if (CheckNativeReturn(NativeApi.SpQueryMethodCount(_type, out count))) { bool flag2 = false; - this._methods = new Map((int)count); + _methods = new Map((int)count); for (uint index = 0; index < count; ++index) { - if (!this.LoadMethod(index, idVerifier)) + if (!LoadMethod(index, idVerifier)) flag2 = true; } flag1 = !flag2; @@ -228,7 +228,7 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = false; IntPtr method; uint ID; - if (this.CheckNativeReturn(NativeApi.SpGetMethodSchema(this._type, index, out method, out ID))) + if (CheckNativeReturn(NativeApi.SpGetMethodSchema(_type, index, out method, out ID))) { if (method != IntPtr.Zero) { @@ -236,7 +236,7 @@ namespace Microsoft.Iris.CodeModel.Cpp flag = dllMethodSchema.Load(method); if (flag) { - this._methods[new MethodSignatureKey(dllMethodSchema.Name, dllMethodSchema.ParameterTypes)] = dllMethodSchema; + _methods[new MethodSignatureKey(dllMethodSchema.Name, dllMethodSchema.ParameterTypes)] = dllMethodSchema; flag = idVerifier.RegisterID(ID); } else @@ -253,13 +253,13 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag1 = false; uint count; - if (this.CheckNativeReturn(NativeApi.SpQueryEventCount(this._type, out count))) + if (CheckNativeReturn(NativeApi.SpQueryEventCount(_type, out count))) { bool flag2 = false; - this._events = new Map((int)count); + _events = new Map((int)count); for (uint index = 0; index < count; ++index) { - if (!this.LoadEvent(index, idVerifier)) + if (!LoadEvent(index, idVerifier)) flag2 = true; } flag1 = !flag2; @@ -270,11 +270,11 @@ namespace Microsoft.Iris.CodeModel.Cpp private bool QueryMarshalAs() { uint interopEquivalent; - bool flag = this.CheckNativeReturn(NativeApi.SpGetMarshalAs(this._type, out interopEquivalent)); + bool flag = CheckNativeReturn(NativeApi.SpGetMarshalAs(_type, out interopEquivalent)); if (flag) - flag = this.ValidateMarshalAs(interopEquivalent); + flag = ValidateMarshalAs(interopEquivalent); if (flag) - flag = this.RegisterMarshalAsEquivalents(interopEquivalent); + flag = RegisterMarshalAsEquivalents(interopEquivalent); return flag; } @@ -306,7 +306,7 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = true; uint num = uint.MaxValue; - TypeSchema typeSchema = this.Base; + TypeSchema typeSchema = Base; DllTypeSchemaBase dllTypeSchemaBase; for (dllTypeSchemaBase = typeSchema as DllTypeSchemaBase; typeSchema != null && dllTypeSchemaBase == null; dllTypeSchemaBase = typeSchema as DllTypeSchemaBase) typeSchema = typeSchema.Base; @@ -322,7 +322,7 @@ namespace Microsoft.Iris.CodeModel.Cpp else declaredMarshalAs = num; } - this._marshalAs = declaredMarshalAs; + _marshalAs = declaredMarshalAs; return flag; } @@ -331,7 +331,7 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = false; IntPtr eventObj; uint ID; - if (this.CheckNativeReturn(NativeApi.SpGetEventSchema(this._type, index, out eventObj, out ID))) + if (CheckNativeReturn(NativeApi.SpGetEventSchema(_type, index, out eventObj, out ID))) { if (eventObj != IntPtr.Zero) { @@ -339,7 +339,7 @@ namespace Microsoft.Iris.CodeModel.Cpp flag = dllEventSchema.Load(eventObj); if (flag) { - this._events[ID] = dllEventSchema; + _events[ID] = dllEventSchema; flag = idVerifier.RegisterID(ID); } else @@ -355,8 +355,8 @@ namespace Microsoft.Iris.CodeModel.Cpp protected override void OnDispose() { base.OnDispose(); - NativeApi.SpReleaseExternalObject(this._type); - this._type = IntPtr.Zero; + NativeApi.SpReleaseExternalObject(_type); + _type = IntPtr.Zero; } public string MapChangeID(uint id) @@ -377,7 +377,7 @@ namespace Microsoft.Iris.CodeModel.Cpp if ((int)UIXID.GetSchemaComponent(id) == OwnerLoadResult.SchemaComponent) { DllPropertySchema dllPropertySchema; - if (this._properties != null && this._properties.TryGetValue(id, out dllPropertySchema)) + if (_properties != null && _properties.TryGetValue(id, out dllPropertySchema)) { name = dllPropertySchema.Name; flag = true; @@ -385,7 +385,7 @@ namespace Microsoft.Iris.CodeModel.Cpp else { DllEventSchema dllEventSchema; - if (this._events != null && this._events.TryGetValue(id, out dllEventSchema)) + if (_events != null && _events.TryGetValue(id, out dllEventSchema)) { name = dllEventSchema.Name; flag = true; @@ -395,7 +395,7 @@ namespace Microsoft.Iris.CodeModel.Cpp return flag; } - public override object ConstructDefault() => this.Construct(this._defaultConstructorID, null); + public override object ConstructDefault() => Construct(_defaultConstructorID, null); public unsafe object Construct(uint constructorID, object[] parameters) { @@ -412,11 +412,11 @@ namespace Microsoft.Iris.CodeModel.Cpp } ErrorWatermark watermark = ErrorManager.Watermark; IntPtr nativeObject; - uint hr = NativeApi.SpInvokeConstructor(this._type, constructorID, uixVariantPtr, (uint)count, out nativeObject); + uint hr = NativeApi.SpInvokeConstructor(_type, constructorID, uixVariantPtr, (uint)count, out nativeObject); if (NativeApi.SUCCEEDED(hr)) dllProxyObject = DllProxyObject.Wrap(nativeObject); else - this.ReportError(hr, ErrorContext.Construct, this, watermark); + ReportError(hr, ErrorContext.Construct, this, watermark); if ((IntPtr)uixVariantPtr != IntPtr.Zero) UIXVariant.CleanupMarshalledObjects(uixVariantPtr, count); return dllProxyObject; @@ -430,11 +430,11 @@ namespace Microsoft.Iris.CodeModel.Cpp ErrorWatermark watermark = ErrorManager.Watermark; object obj = null; UIXVariant propertyValue1; - uint propertyValue2 = NativeApi.SpGetPropertyValue(this._type, nativeObject, property.ID, out propertyValue1); + uint propertyValue2 = NativeApi.SpGetPropertyValue(_type, nativeObject, property.ID, out propertyValue1); if (NativeApi.SUCCEEDED(propertyValue2)) - obj = UIXVariant.GetValue(propertyValue1, this.Owner); + obj = UIXVariant.GetValue(propertyValue1, Owner); else - this.ReportError(propertyValue2, ErrorContext.PropertyGet, property, watermark); + ReportError(propertyValue2, ErrorContext.PropertyGet, property, watermark); return obj; } @@ -447,9 +447,9 @@ namespace Microsoft.Iris.CodeModel.Cpp if (!property.IsStatic) nativeObject = ((DllProxyObject)instance).NativeObject; ErrorWatermark watermark = ErrorManager.Watermark; - uint hr = NativeApi.SpSetPropertyValue(this._type, nativeObject, property.ID, uixVariantPtr); + uint hr = NativeApi.SpSetPropertyValue(_type, nativeObject, property.ID, uixVariantPtr); if (NativeApi.FAILED(hr)) - this.ReportError(hr, ErrorContext.PropertySet, property, watermark); + ReportError(hr, ErrorContext.PropertySet, property, watermark); UIXVariant.CleanupMarshalledObject(uixVariantPtr); } @@ -471,11 +471,11 @@ namespace Microsoft.Iris.CodeModel.Cpp nativeObject = ((DllProxyObject)instance).NativeObject; ErrorWatermark watermark = ErrorManager.Watermark; UIXVariant returnValue; - uint hr = NativeApi.SpInvokeMethod(this._type, nativeObject, method.ID, uixVariantPtr, (uint)count, out returnValue); + uint hr = NativeApi.SpInvokeMethod(_type, nativeObject, method.ID, uixVariantPtr, (uint)count, out returnValue); if (NativeApi.SUCCEEDED(hr)) - obj = UIXVariant.GetValue(returnValue, this.Owner); + obj = UIXVariant.GetValue(returnValue, Owner); else - this.ReportError(hr, ErrorContext.MethodInvoke, method, watermark); + ReportError(hr, ErrorContext.MethodInvoke, method, watermark); if ((IntPtr)uixVariantPtr != IntPtr.Zero) UIXVariant.CleanupMarshalledObjects(uixVariantPtr, count); return obj; @@ -486,15 +486,15 @@ namespace Microsoft.Iris.CodeModel.Cpp string str = null; ErrorWatermark watermark = ErrorManager.Watermark; IntPtr nativeStringObject; - uint hr = NativeApi.SpInvokeToString(this._type, proxy.NativeObject, out nativeStringObject); + uint hr = NativeApi.SpInvokeToString(_type, proxy.NativeObject, out nativeStringObject); if (NativeApi.SUCCEEDED(hr)) str = DllProxyServices.GetString(nativeStringObject); else - this.ReportError(hr, ErrorContext.ToString, this, watermark); + ReportError(hr, ErrorContext.ToString, this, watermark); return str; } - private DllLoadResult OwnerLoadResult => (DllLoadResult)this.Owner; + private DllLoadResult OwnerLoadResult => (DllLoadResult)Owner; private void ReportError( uint hr, diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchemaBase.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchemaBase.cs index 49b5cb1..46cdb12 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchemaBase.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/DllTypeSchemaBase.cs @@ -25,70 +25,70 @@ namespace Microsoft.Iris.CodeModel.Cpp protected DllTypeSchemaBase(DllLoadResult owner, uint ID) : base(owner) - => this._typeID = ID; + => _typeID = ID; protected override void OnDispose() { base.OnDispose(); - if (this._constructors != null) + if (_constructors != null) { - foreach (KeyValueEntry constructor in this._constructors) + foreach (KeyValueEntry constructor in _constructors) { if (constructor.Value != null) constructor.Value.Dispose(this); } - this._constructors = null; + _constructors = null; } - if (this._properties != null) + if (_properties != null) { - foreach (DllPropertySchema dllPropertySchema in this._properties.Values) + foreach (DllPropertySchema dllPropertySchema in _properties.Values) dllPropertySchema?.Dispose(this); - this._properties = null; + _properties = null; } - if (this._methods != null) + if (_methods != null) { - foreach (KeyValueEntry method in this._methods) + foreach (KeyValueEntry method in _methods) { if (method.Value != null) method.Value.Dispose(this); } - this._methods = null; + _methods = null; } - if (this._events == null) + if (_events == null) return; - foreach (DllEventSchema dllEventSchema in this._events.Values) + foreach (DllEventSchema dllEventSchema in _events.Values) dllEventSchema?.Dispose(this); } public override object ConstructDefault() => (object)null; - public override int FindTypeHint => (int)this._typeID; + public override int FindTypeHint => (int)_typeID; - public override bool HasDefaultConstructor => this.GetBit(Bits.HasDefaultConstructor); + public override bool HasDefaultConstructor => GetBit(Bits.HasDefaultConstructor); - public override bool IsRuntimeImmutable => this.GetBit(Bits.IsRuntimeImmutable); + public override bool IsRuntimeImmutable => GetBit(Bits.IsRuntimeImmutable); public override ConstructorSchema FindConstructor(TypeSchema[] parameters) { DllConstructorSchema constructorSchema = null; - if (this._constructors != null) - this._constructors.TryGetValue(new MethodSignatureKey(parameters), out constructorSchema); + if (_constructors != null) + _constructors.TryGetValue(new MethodSignatureKey(parameters), out constructorSchema); return constructorSchema; } public override PropertySchema FindProperty(string name) { - if (this._properties != null) + if (_properties != null) { - foreach (DllPropertySchema dllPropertySchema in this._properties.Values) + foreach (DllPropertySchema dllPropertySchema in _properties.Values) { if (dllPropertySchema != null && dllPropertySchema.Name == name) return dllPropertySchema; } } - if (this.Equivalents != null) + if (Equivalents != null) { - foreach (TypeSchema equivalent in this.Equivalents) + foreach (TypeSchema equivalent in Equivalents) { PropertySchema property = equivalent.FindProperty(name); if (property != null) @@ -100,15 +100,15 @@ namespace Microsoft.Iris.CodeModel.Cpp public override MethodSchema FindMethod(string name, TypeSchema[] parameters) { - if (this._methods != null) + if (_methods != null) { DllMethodSchema dllMethodSchema = null; - if (this._methods.TryGetValue(new MethodSignatureKey(name, parameters), out dllMethodSchema)) + if (_methods.TryGetValue(new MethodSignatureKey(name, parameters), out dllMethodSchema)) return dllMethodSchema; } - if (this.Equivalents != null) + if (Equivalents != null) { - foreach (TypeSchema equivalent in this.Equivalents) + foreach (TypeSchema equivalent in Equivalents) { MethodSchema method = equivalent.FindMethod(name, parameters); if (method != null) @@ -121,9 +121,9 @@ namespace Microsoft.Iris.CodeModel.Cpp public override EventSchema FindEvent(string name) { DllEventSchema dllEventSchema1 = null; - if (this._events != null) + if (_events != null) { - foreach (DllEventSchema dllEventSchema2 in this._events.Values) + foreach (DllEventSchema dllEventSchema2 in _events.Values) { if (dllEventSchema2 != null && dllEventSchema2.Name == name) { @@ -140,26 +140,26 @@ namespace Microsoft.Iris.CodeModel.Cpp get { PropertySchema[] propertySchemaArray = PropertySchema.EmptyList; - if (this._properties != null && this._properties.Count > 0) + if (_properties != null && _properties.Count > 0) { - propertySchemaArray = new PropertySchema[this._properties.Count]; + propertySchemaArray = new PropertySchema[_properties.Count]; int num = 0; - foreach (PropertySchema propertySchema in this._properties.Values) + foreach (PropertySchema propertySchema in _properties.Values) propertySchemaArray[num++] = propertySchema; } return propertySchemaArray; } } - public uint MarshalAs => this._marshalAs; + public uint MarshalAs => _marshalAs; - public override string Name => this._name; + public override string Name => _name; public override string AlternateName => (string)null; - public override TypeSchema Base => this._baseType; + public override TypeSchema Base => _baseType; - public override Type RuntimeType => DllLoadResult.RuntimeTypeForMarshalAs(this._marshalAs); + public override Type RuntimeType => DllLoadResult.RuntimeTypeForMarshalAs(_marshalAs); public override Result TypeConverter( object from, @@ -202,9 +202,9 @@ namespace Microsoft.Iris.CodeModel.Cpp public override bool Disposable => true; - protected bool GetBit(DllTypeSchemaBase.Bits lookupBit) => this._bits[(int)lookupBit]; + protected bool GetBit(DllTypeSchemaBase.Bits lookupBit) => _bits[(int)lookupBit]; - protected void SetBit(DllTypeSchemaBase.Bits changeBit, bool value) => this._bits[(int)changeBit] = value; + protected void SetBit(DllTypeSchemaBase.Bits changeBit, bool value) => _bits[(int)changeBit] = value; protected enum Bits : uint { diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataQueryHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataQueryHandleTable.cs index 9c4aaf1..c3d5824 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataQueryHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataQueryHandleTable.cs @@ -13,7 +13,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public bool LookupByHandle(ulong handle, out MarkupDataQuery obj) { object obj1; - bool flag = this.LookupByHandleWorker(handle, out obj1); + bool flag = LookupByHandleWorker(handle, out obj1); obj = (MarkupDataQuery)obj1; return flag; } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataTypeHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataTypeHandleTable.cs index 48e5b9e..323b828 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataTypeHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/MarkupDataTypeHandleTable.cs @@ -13,7 +13,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public bool LookupByHandle(ulong handle, out MarkupDataType obj) { object obj1; - bool flag = this.LookupByHandleWorker(handle, out obj1); + bool flag = LookupByHandleWorker(handle, out obj1); obj = (MarkupDataType)obj1; return flag; } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/NativeDataProviderWrapper.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/NativeDataProviderWrapper.cs index 41e821f..83323ea 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/NativeDataProviderWrapper.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/NativeDataProviderWrapper.cs @@ -17,11 +17,11 @@ namespace Microsoft.Iris.CodeModel.Cpp public NativeDataProviderWrapper(string name, IntPtr factory) { - this._name = name; - this._factory = factory; + _name = name; + _factory = factory; } - public string Name => this._name; + public string Name => _name; public MarkupDataQuery Build(MarkupDataQuerySchema querySchema) => new NativeMarkupDataQuery(querySchema, this); @@ -32,7 +32,7 @@ namespace Microsoft.Iris.CodeModel.Cpp ulong queryHandle) { IntPtr query; - int num = (int)NativeApi.SpDataProviderConstructQuery(this._factory, providerName, queryTypeHandle, resultTypeHandle, queryHandle, out query); + int num = (int)NativeApi.SpDataProviderConstructQuery(_factory, providerName, queryTypeHandle, resultTypeHandle, queryHandle, out query); return query; } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable.cs index 9a7bb1e..ee70004 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable.cs @@ -14,9 +14,9 @@ namespace Microsoft.Iris.CodeModel.Cpp private uint _tableIndex; private static uint s_tableCount; - protected ProxyHandleTable() => this._tableIndex = s_tableCount++; + protected ProxyHandleTable() => _tableIndex = s_tableCount++; - protected uint TableIndex => this._tableIndex; + protected uint TableIndex => _tableIndex; [Conditional("DEBUG")] public static void DEBUG_AssertValidHandle(ulong handle) diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable`1.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable`1.cs index 960118f..c42b6c2 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable`1.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/ProxyHandleTable`1.cs @@ -27,9 +27,9 @@ namespace Microsoft.Iris.CodeModel.Cpp public ProxyHandleTable() { - this._oldestFreeIndex = -1; - this._newestFreeIndex = -1; - this._filledBoundary = 0; + _oldestFreeIndex = -1; + _newestFreeIndex = -1; + _filledBoundary = 0; } protected bool InternalLookupByHandle(ulong handle, out T obj) @@ -38,8 +38,8 @@ namespace Microsoft.Iris.CodeModel.Cpp obj = default(T); int index; uint uniquenessBits; - this.DecodeHandle(handle, out index, out uniquenessBits); - ProxyHandleTable.ListEntry entry = this._entries[index]; + DecodeHandle(handle, out index, out uniquenessBits); + ProxyHandleTable.ListEntry entry = _entries[index]; if ((int)uniquenessBits == (int)entry.Uniquifier) { flag = true; @@ -50,30 +50,30 @@ namespace Microsoft.Iris.CodeModel.Cpp protected ulong AllocateHandle(T obj) { - this.EnsureSpaceForNewEntry(); - int index = this.ReserveIndexForNewEntry(); - return this.StoreNewEntry(obj, index); + EnsureSpaceForNewEntry(); + int index = ReserveIndexForNewEntry(); + return StoreNewEntry(obj, index); } private void EnsureSpaceForNewEntry() { - if (this._entries != null && (this._oldestFreeIndex != -1 || this._filledBoundary != this._entries.Length)) + if (_entries != null && (_oldestFreeIndex != -1 || _filledBoundary != _entries.Length)) return; - this.EnlargeList(); + EnlargeList(); } private int ReserveIndexForNewEntry() { int index; - if (this._oldestFreeIndex != -1) + if (_oldestFreeIndex != -1) { - index = this.FreeListIndexToRealIndex(this._oldestFreeIndex); - this._oldestFreeIndex = this._entries[index].FreeIndex; - if (this._oldestFreeIndex == -1) - this._newestFreeIndex = -1; + index = FreeListIndexToRealIndex(_oldestFreeIndex); + _oldestFreeIndex = _entries[index].FreeIndex; + if (_oldestFreeIndex == -1) + _newestFreeIndex = -1; } else - index = this._filledBoundary++; + index = _filledBoundary++; return index; } @@ -81,12 +81,12 @@ namespace Microsoft.Iris.CodeModel.Cpp { ulong handle; uint uniquifier; - this.GenerateHandle(index, out handle, out uniquifier); + GenerateHandle(index, out handle, out uniquifier); int index1 = -2; - this.AddRef(ref index1); - this._entries[index].Uniquifier = uniquifier; - this._entries[index].Value = obj; - this._entries[index].FreeIndex = index1; + AddRef(ref index1); + _entries[index].Uniquifier = uniquifier; + _entries[index].Value = obj; + _entries[index].FreeIndex = index1; return handle; } @@ -96,9 +96,9 @@ namespace Microsoft.Iris.CodeModel.Cpp private void GenerateHandle(int insertIndex, out ulong handle, out uint uniquifier) { - ++this._lifetimeCount; - uniquifier = this.TableIndex << 30; - uniquifier |= this._lifetimeCount & 1073741823U; + ++_lifetimeCount; + uniquifier = TableIndex << 30; + uniquifier |= _lifetimeCount & 1073741823U; handle = (ulong)uniquifier << 32; uint num = (uint)insertIndex; handle |= num; @@ -113,23 +113,23 @@ namespace Microsoft.Iris.CodeModel.Cpp private void EnlargeList() { - if (this._entries == null) + if (_entries == null) { - this._entries = new ProxyHandleTable.ListEntry[4]; + _entries = new ProxyHandleTable.ListEntry[4]; } else { - ProxyHandleTable.ListEntry[] listEntryArray = new ProxyHandleTable.ListEntry[this._entries.Length * 2]; - Array.Copy(_entries, listEntryArray, this._entries.Length); - this._entries = listEntryArray; + ProxyHandleTable.ListEntry[] listEntryArray = new ProxyHandleTable.ListEntry[_entries.Length * 2]; + Array.Copy(_entries, listEntryArray, _entries.Length); + _entries = listEntryArray; } } protected void AddRefHandle(ulong handle) { int index; - this.DecodeHandle(handle, out index, out uint _); - this.AddRef(ref this._entries[index].FreeIndex); + DecodeHandle(handle, out index, out uint _); + AddRef(ref _entries[index].FreeIndex); } private void AddRef(ref int index) => --index; @@ -140,27 +140,27 @@ namespace Microsoft.Iris.CodeModel.Cpp { bool flag = false; int index; - this.DecodeHandle(handle, out index, out uint _); - this.Release(ref this._entries[index].FreeIndex); - oldValue = this._entries[index].Value; - if (this._entries[index].FreeIndex == -2) + DecodeHandle(handle, out index, out uint _); + Release(ref _entries[index].FreeIndex); + oldValue = _entries[index].Value; + if (_entries[index].FreeIndex == -2) { flag = true; - this.RemoveEntry(index); + RemoveEntry(index); } return flag; } private void RemoveEntry(int index) { - this._entries[index].Value = default(T); - int freeListIndex = this.RealIndexToFreeListIndex(index); - if (this._newestFreeIndex != -1) - this._entries[this.FreeListIndexToRealIndex(this._newestFreeIndex)].FreeIndex = freeListIndex; + _entries[index].Value = default(T); + int freeListIndex = RealIndexToFreeListIndex(index); + if (_newestFreeIndex != -1) + _entries[FreeListIndexToRealIndex(_newestFreeIndex)].FreeIndex = freeListIndex; else - this._oldestFreeIndex = freeListIndex; - this._newestFreeIndex = freeListIndex; - this._entries[index].FreeIndex = -1; + _oldestFreeIndex = freeListIndex; + _newestFreeIndex = freeListIndex; + _entries[index].FreeIndex = -1; } protected ProxyHandleTable.ProxyHandleTableEnumerator GetTableEnumerator() => new ProxyHandleTable.ProxyHandleTableEnumerator(this); @@ -185,23 +185,23 @@ namespace Microsoft.Iris.CodeModel.Cpp public ProxyHandleTableEnumerator(ProxyHandleTable table) { - this._table = table; - this._index = -1; + _table = table; + _index = -1; } public bool MoveNext() { do { - ++this._index; + ++_index; } - while (this._index < this._table._filledBoundary && this._table._entries[this._index].FreeIndex > -2); - return this._index < this._table._filledBoundary; + while (_index < _table._filledBoundary && _table._entries[_index].FreeIndex > -2); + return _index < _table._filledBoundary; } - public T Current => this._table._entries[this._index].Value; + public T Current => _table._entries[_index].Value; - public void Reset() => this._index = -1; + public void Reset() => _index = -1; } } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/StringProxyHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/StringProxyHandleTable.cs index 09e3680..ba78b52 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/StringProxyHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/StringProxyHandleTable.cs @@ -20,11 +20,11 @@ namespace Microsoft.Iris.CodeModel.Cpp bool flag = s_stringToHandleLookup.TryGetValue(value, out handle); if (flag) { - this.AddRefHandle(handle); + AddRefHandle(handle); } else { - handle = this.AllocateHandle(value); + handle = AllocateHandle(value); s_stringToHandleLookup[value] = handle; } return !flag; @@ -32,13 +32,13 @@ namespace Microsoft.Iris.CodeModel.Cpp public bool ReleaseStringHandle(ulong handle, out string value) { - bool flag = this.ReleaseHandle(handle, out value); + bool flag = ReleaseHandle(handle, out value); if (flag) s_stringToHandleLookup.Remove(value); return flag; } - public bool LookupByHandle(ulong handle, out string obj) => this.InternalLookupByHandle(handle, out obj); + public bool LookupByHandle(ulong handle, out string obj) => InternalLookupByHandle(handle, out obj); public unsafe int PinString(ulong handle, out char* value) { @@ -52,7 +52,7 @@ namespace Microsoft.Iris.CodeModel.Cpp else { string str; - this.LookupByHandle(handle, out str); + LookupByHandle(handle, out str); stringPinState._gcHandle = GCHandle.Alloc(str, GCHandleType.Pinned); stringPinState._pinCount = 1; } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/TypeSchemaHandleTable.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/TypeSchemaHandleTable.cs index 0d00d3d..71b7dc0 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/TypeSchemaHandleTable.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/TypeSchemaHandleTable.cs @@ -13,7 +13,7 @@ namespace Microsoft.Iris.CodeModel.Cpp public bool LookupByHandle(ulong handle, out TypeSchema obj) { object obj1; - bool flag = this.LookupByHandleWorker(handle, out obj1); + bool flag = LookupByHandleWorker(handle, out obj1); obj = (TypeSchema)obj1; return flag; } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/UIXIDVerifier.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/UIXIDVerifier.cs index 26c95aa..2c7eae6 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/UIXIDVerifier.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/UIXIDVerifier.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.CodeModel.Cpp public UIXIDVerifier(DllLoadResult loadResult) { - this._loadResult = loadResult; - this._uniqueIDs = new Map(); + _loadResult = loadResult; + _uniqueIDs = new Map(); } - public bool RegisterID(uint ID) => this.CheckForSchemaMatch(ID) && this.CheckForDuplicate(ID); + public bool RegisterID(uint ID) => CheckForSchemaMatch(ID) && CheckForDuplicate(ID); private bool CheckForSchemaMatch(uint ID) { @@ -32,13 +32,13 @@ namespace Microsoft.Iris.CodeModel.Cpp private bool CheckForDuplicate(uint ID) { uint num = 0; - bool flag = this._uniqueIDs.TryGetValue(ID, out num); + bool flag = _uniqueIDs.TryGetValue(ID, out num); if (flag && num == 0U) { ErrorManager.ReportError("Duplicate ID '0x{0:X8}' found in schema from '{1}'", ID, _loadResult.Uri); ++num; } - this._uniqueIDs[ID] = num; + _uniqueIDs[ID] = num; return !flag; } } diff --git a/UIX/Microsoft/Iris/CodeModel/Cpp/UIXVariant.cs b/UIX/Microsoft/Iris/CodeModel/Cpp/UIXVariant.cs index d2a5e51..8dfa32a 100644 --- a/UIX/Microsoft/Iris/CodeModel/Cpp/UIXVariant.cs +++ b/UIX/Microsoft/Iris/CodeModel/Cpp/UIXVariant.cs @@ -141,52 +141,52 @@ namespace Microsoft.Iris.CodeModel.Cpp private void SetToNull() { - this._pointer = IntPtr.Zero; - this._type = VariantType.UIXObject; + _pointer = IntPtr.Zero; + _type = VariantType.UIXObject; } private void SetPointerValue(IntPtr value, UIXVariant.VariantType type) { - this._pointer = value; - this._type = type; + _pointer = value; + _type = type; } private void SetIntegerValue(long value, UIXVariant.VariantType type) { - this._integer = value; - this._type = type; + _integer = value; + _type = type; } private void SetFloatValue(float value, UIXVariant.VariantType type) { - this._float = value; - this._type = type; + _float = value; + _type = type; } private void SetDoubleValue(double value, UIXVariant.VariantType type) { - this._double = value; - this._type = type; + _double = value; + _type = type; } private void SetEnumValue(UIXVariant.EnumValue value) { - this._enum = value; - this._type = VariantType.Enum; + _enum = value; + _type = VariantType.Enum; } private unsafe IntPtr _pointer { get { - var value = this._union; + var value = _union; return *(IntPtr*)&value; } set { long num; *(IntPtr*)&num = value; - this._union = num; + _union = num; } } @@ -194,35 +194,35 @@ namespace Microsoft.Iris.CodeModel.Cpp { get { - var value = this._union; + var value = _union; return *(UIXVariant.EnumValue*)&value; } set { long num; *(UIXVariant.EnumValue*)&num = value; - this._union = num; + _union = num; } } private long _integer { - get => this._union; - set => this._union = value; + get => _union; + set => _union = value; } private unsafe float _float { get { - var value = this._union; + var value = _union; return *(float*)&value; } set { long num; *(float*)&num = value; - this._union = num; + _union = num; } } @@ -230,14 +230,14 @@ namespace Microsoft.Iris.CodeModel.Cpp { get { - var value = this._union; + var value = _union; return *(double*)&value; } set { long num; *(double*)&num = value; - this._union = num; + _union = num; } } diff --git a/UIX/Microsoft/Iris/Command.cs b/UIX/Microsoft/Iris/Command.cs index 014c46a..4eddab7 100644 --- a/UIX/Microsoft/Iris/Command.cs +++ b/UIX/Microsoft/Iris/Command.cs @@ -22,7 +22,7 @@ namespace Microsoft.Iris { if (invokedHandler == null) return; - this.Invoked += invokedHandler; + Invoked += invokedHandler; } public Command(IModelItemOwner owner, EventHandler invokedHandler) @@ -44,17 +44,17 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._availableFlag; + using (ThreadValidator) + return _availableFlag; } set { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._availableFlag == value) + if (_availableFlag == value) return; - this._availableFlag = value; - this.FirePropertyChanged(nameof(Available)); + _availableFlag = value; + FirePropertyChanged(nameof(Available)); } } } @@ -63,60 +63,60 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._priority; + using (ThreadValidator) + return _priority; } set { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._priority == value) + if (_priority == value) return; - this._priority = value; - this.FirePropertyChanged(nameof(Priority)); + _priority = value; + FirePropertyChanged(nameof(Priority)); } } } - public void Invoke() => this.Invoke(this.Priority); + public void Invoke() => Invoke(Priority); public void Invoke(InvokePolicy invokePolicy) { - using (this.ThreadValidator) + using (ThreadValidator) { if (invokePolicy != InvokePolicy.Synchronous) { DispatchPriority priority = DispatchPriority.AppEvent; if (invokePolicy == InvokePolicy.AsynchronousLowPri) priority = DispatchPriority.Idle; - DeferredCall.Post(priority, new SimpleCallback(this.InvokeWorker)); + DeferredCall.Post(priority, new SimpleCallback(InvokeWorker)); } else - this.InvokeWorker(); + InvokeWorker(); } } private void InvokeWorker() { - if (this.IsDisposed) + if (IsDisposed) return; - this.FirePropertyChanged("Invoked"); - if (this.GetEventHandler(s_invokedEvent) is EventHandler eventHandler) + FirePropertyChanged("Invoked"); + if (GetEventHandler(s_invokedEvent) is EventHandler eventHandler) eventHandler(this, EventArgs.Empty); - this.OnInvoked(); + OnInvoked(); } public event EventHandler Invoked { add { - using (this.ThreadValidator) - this.AddEventHandler(s_invokedEvent, value); + using (ThreadValidator) + AddEventHandler(s_invokedEvent, value); } remove { - using (this.ThreadValidator) - this.RemoveEventHandler(s_invokedEvent, value); + using (ThreadValidator) + RemoveEventHandler(s_invokedEvent, value); } } diff --git a/UIX/Microsoft/Iris/Data/Resource.cs b/UIX/Microsoft/Iris/Data/Resource.cs index 06bc6c7..930b59a 100644 --- a/UIX/Microsoft/Iris/Data/Resource.cs +++ b/UIX/Microsoft/Iris/Data/Resource.cs @@ -23,29 +23,29 @@ namespace Microsoft.Iris.Data public Resource(string uri, bool forceSynchronous) { - this._uri = uri; - this._forceSynchronous = forceSynchronous; - this._status = ResourceStatus.NeedsAcquire; + _uri = uri; + _forceSynchronous = forceSynchronous; + _status = ResourceStatus.NeedsAcquire; } - public string Uri => this._uri; + public string Uri => _uri; public abstract string Identifier { get; } - public void Acquire() => this.Acquire(null); + public void Acquire() => Acquire(null); public void Acquire(ResourceAcquisitionCompleteHandler completeHandler) { - ++this._acquisitions; + ++_acquisitions; if (completeHandler != null) - this._completeHandlers += completeHandler; - if (this._status == ResourceStatus.Acquiring) + _completeHandlers += completeHandler; + if (_status == ResourceStatus.Acquiring) return; - if (this._status != ResourceStatus.Available) + if (_status != ResourceStatus.Available) { - this._status = ResourceStatus.Acquiring; - this._errorDetails = null; - this.StartAcquisition(this._forceSynchronous); + _status = ResourceStatus.Acquiring; + _errorDetails = null; + StartAcquisition(_forceSynchronous); } else { @@ -55,39 +55,39 @@ namespace Microsoft.Iris.Data } } - public void Free() => this.Free(null); + public void Free() => Free(null); public void Free(ResourceAcquisitionCompleteHandler completeHandler) { - --this._acquisitions; + --_acquisitions; if (completeHandler != null) - this._completeHandlers -= completeHandler; - if (this._acquisitions != 0) + _completeHandlers -= completeHandler; + if (_acquisitions != 0) return; - if (this._status == ResourceStatus.Acquiring) - this.CancelAcquisition(); - else if (this._buffer != IntPtr.Zero) + if (_status == ResourceStatus.Acquiring) + CancelAcquisition(); + else if (_buffer != IntPtr.Zero) { - if (this._requiresMemoryFree) - FreeNativeBuffer(this._buffer); - this._buffer = IntPtr.Zero; + if (_requiresMemoryFree) + FreeNativeBuffer(_buffer); + _buffer = IntPtr.Zero; } - this._status = ResourceStatus.NeedsAcquire; + _status = ResourceStatus.NeedsAcquire; } public ResourceStatus Status { - get => this._status; - set => this._status = value; + get => _status; + set => _status = value; } - public string ErrorDetails => this._errorDetails; + public string ErrorDetails => _errorDetails; - public IntPtr Buffer => this._buffer; + public IntPtr Buffer => _buffer; - public uint Length => this._length; + public uint Length => _length; - public bool ForceSynchronous => this._forceSynchronous; + public bool ForceSynchronous => _forceSynchronous; protected abstract void StartAcquisition(bool forceSynchronous); @@ -99,23 +99,23 @@ namespace Microsoft.Iris.Data bool requiresMemoryFree, string errorDetails) { - this._buffer = buffer; - this._length = length; - this._requiresMemoryFree = requiresMemoryFree; + _buffer = buffer; + _length = length; + _requiresMemoryFree = requiresMemoryFree; if (buffer != IntPtr.Zero) { - this._status = ResourceStatus.Available; + _status = ResourceStatus.Available; } else { - this._status = ResourceStatus.Error; + _status = ResourceStatus.Error; if (errorDetails == null) errorDetails = string.Format("Failed to acquire resource '{0}'", Identifier); - this._errorDetails = errorDetails; + _errorDetails = errorDetails; } - if (this._completeHandlers == null) + if (_completeHandlers == null) return; - this._completeHandlers(this); + _completeHandlers(this); } protected static IntPtr AllocNativeBuffer(uint length) => NativeApi.MemAlloc(length, false); @@ -124,12 +124,12 @@ namespace Microsoft.Iris.Data private void FireAcquisitionCompleteHandlers() { - if (this._completeHandlers == null) + if (_completeHandlers == null) return; - this._completeHandlers(this); - this._completeHandlers = null; + _completeHandlers(this); + _completeHandlers = null; } - public override string ToString() => this._uri; + public override string ToString() => _uri; } } diff --git a/UIX/Microsoft/Iris/Data/ResourceManager.cs b/UIX/Microsoft/Iris/Data/ResourceManager.cs index 24be71f..9606b59 100644 --- a/UIX/Microsoft/Iris/Data/ResourceManager.cs +++ b/UIX/Microsoft/Iris/Data/ResourceManager.cs @@ -16,24 +16,24 @@ namespace Microsoft.Iris.Data private Map _sourcesTable; private static ResourceManager s_instance = new ResourceManager(); - private ResourceManager() => this._sourcesTable = new Map(); + private ResourceManager() => _sourcesTable = new Map(); public static ResourceManager Instance => s_instance; - public void RegisterSource(string scheme, IResourceProvider source) => this._sourcesTable[scheme] = source; + public void RegisterSource(string scheme, IResourceProvider source) => _sourcesTable[scheme] = source; - public void UnregisterSource(string scheme) => this._sourcesTable.Remove(scheme); + public void UnregisterSource(string scheme) => _sourcesTable.Remove(scheme); - public bool IsRegisteredSource(string scheme) => this._sourcesTable.ContainsKey(scheme); + public bool IsRegisteredSource(string scheme) => _sourcesTable.ContainsKey(scheme); - public Resource GetResource(string uri) => this.GetResource(uri, false); + public Resource GetResource(string uri) => GetResource(uri, false); public Resource GetResource(string uri, bool forceSynchronous) { Resource resource = null; - if (this._redirects != null) + if (_redirects != null) { - foreach (ResourceManager.UriRedirect redirect in this._redirects) + foreach (ResourceManager.UriRedirect redirect in _redirects) { if (uri.StartsWith(redirect.fromPrefix, StringComparison.OrdinalIgnoreCase)) { @@ -42,7 +42,7 @@ namespace Microsoft.Iris.Data ErrorManager.ReportError("Resource {0} not found, but should have been located by a markup redirect", uri); return null; } - resource = this.GetResourceWorker(redirect.toPrefix + uri.Substring(redirect.fromPrefix.Length), true); + resource = GetResourceWorker(redirect.toPrefix + uri.Substring(redirect.fromPrefix.Length), true); if (resource != null) { resource.Acquire(); @@ -57,7 +57,7 @@ namespace Microsoft.Iris.Data } } if (resource == null) - resource = this.GetResourceWorker(uri, forceSynchronous); + resource = GetResourceWorker(uri, forceSynchronous); return resource; } @@ -73,7 +73,7 @@ namespace Microsoft.Iris.Data return null; } IResourceProvider resourceProvider; - if (this._sourcesTable.TryGetValue(scheme, out resourceProvider)) + if (_sourcesTable.TryGetValue(scheme, out resourceProvider)) resource = resourceProvider.GetResource(hierarchicalPart, uri, forceSynchronous); else ErrorManager.ReportWarning("Invalid resource protocol: '{0}'", scheme); @@ -100,9 +100,9 @@ namespace Microsoft.Iris.Data ResourceManager.UriRedirect uriRedirect = new ResourceManager.UriRedirect(); uriRedirect.fromPrefix = fromPrefix; uriRedirect.toPrefix = toPrefix; - if (this._redirects == null) - this._redirects = new Vector(); - this._redirects.Add(uriRedirect); + if (_redirects == null) + _redirects = new Vector(); + _redirects.Add(uriRedirect); } public static Resource AcquireResource(string uri) diff --git a/UIX/Microsoft/Iris/Data/SingleArrayListCache.cs b/UIX/Microsoft/Iris/Data/SingleArrayListCache.cs index 7d8cb28..3eb6bf0 100644 --- a/UIX/Microsoft/Iris/Data/SingleArrayListCache.cs +++ b/UIX/Microsoft/Iris/Data/SingleArrayListCache.cs @@ -14,8 +14,8 @@ namespace Microsoft.Iris.Data public ArrayList Acquire() { - ArrayList arrayList = this._list; - this._list = null; + ArrayList arrayList = _list; + _list = null; if (arrayList == null) arrayList = new ArrayList(); return arrayList; @@ -24,7 +24,7 @@ namespace Microsoft.Iris.Data public void Release(ArrayList list) { list.Clear(); - this._list = list; + _list = list; } } } diff --git a/UIX/Microsoft/Iris/Data/UIListContentsChangedArgs.cs b/UIX/Microsoft/Iris/Data/UIListContentsChangedArgs.cs index 77a6fb6..36db2c7 100644 --- a/UIX/Microsoft/Iris/Data/UIListContentsChangedArgs.cs +++ b/UIX/Microsoft/Iris/Data/UIListContentsChangedArgs.cs @@ -21,10 +21,10 @@ namespace Microsoft.Iris.Data int newIndex, int count) { - this._count = count; - this._type = type; - this._oldIndex = oldIndex; - this._newIndex = newIndex; + _count = count; + _type = type; + _oldIndex = oldIndex; + _newIndex = newIndex; } public UIListContentsChangedArgs(UIListContentsChangeType type, int oldIndex, int newIndex) @@ -32,13 +32,13 @@ namespace Microsoft.Iris.Data { } - public UIListContentsChangeType Type => this._type; + public UIListContentsChangeType Type => _type; - public int OldIndex => this._oldIndex; + public int OldIndex => _oldIndex; - public int NewIndex => this._newIndex; + public int NewIndex => _newIndex; - public int Count => this._count; + public int Count => _count; public override string ToString() => string.Format("{0} type: {1}, old: {2}, new: {3}, count: {4}", base.ToString(), Type, OldIndex, NewIndex, Count); } diff --git a/UIX/Microsoft/Iris/Data/UpdateHelper.cs b/UIX/Microsoft/Iris/Data/UpdateHelper.cs index 2b38db2..ed5480f 100644 --- a/UIX/Microsoft/Iris/Data/UpdateHelper.cs +++ b/UIX/Microsoft/Iris/Data/UpdateHelper.cs @@ -27,81 +27,81 @@ namespace Microsoft.Iris.Data public UpdateHelper(IVirtualList virtualList) { - this._virtualList = virtualList; - this._itemsToUpdate = new List(); - this._throttle = Environment.ProcessorCount * 2; - this._outstandingUpdates = new List(); + _virtualList = virtualList; + _itemsToUpdate = new List(); + _throttle = Environment.ProcessorCount * 2; + _outstandingUpdates = new List(); } public void AddIndex(int index) { - this._itemsToUpdate.Add(index); - this._listIsDirty = true; - this.TriggerNextUpdate(); + _itemsToUpdate.Add(index); + _listIsDirty = true; + TriggerNextUpdate(); } - public void AdjustIndices(int lowThreshold, int amount) => this.AdjustIndices(lowThreshold, int.MaxValue, amount); + public void AdjustIndices(int lowThreshold, int amount) => AdjustIndices(lowThreshold, int.MaxValue, amount); public void AdjustIndices(int lowThreshold, int highThreshold, int amt) { - for (int index = 0; index < this._itemsToUpdate.Count; ++index) + for (int index = 0; index < _itemsToUpdate.Count; ++index) { - int num = this._itemsToUpdate[index]; + int num = _itemsToUpdate[index]; if (num >= lowThreshold && num <= highThreshold) - this._itemsToUpdate[index] = num + amt; + _itemsToUpdate[index] = num + amt; } - if (this._lastInterestIndex < lowThreshold || this._lastInterestIndex > highThreshold) + if (_lastInterestIndex < lowThreshold || _lastInterestIndex > highThreshold) return; - this._lastInterestIndex += amt; + _lastInterestIndex += amt; } - public void Clear() => this._itemsToUpdate.Clear(); + public void Clear() => _itemsToUpdate.Clear(); public void RemoveIndex(int index) { - int count = this._itemsToUpdate.Count; + int count = _itemsToUpdate.Count; int index1 = 0; - while (index1 < count && this._itemsToUpdate[index1] != index) + while (index1 < count && _itemsToUpdate[index1] != index) ++index1; if (index1 >= count) return; int index2 = index1; for (int index3 = index1 + 1; index3 < count; ++index3) { - int num = this._itemsToUpdate[index3]; + int num = _itemsToUpdate[index3]; if (num != index) { - this._itemsToUpdate[index2] = num; + _itemsToUpdate[index2] = num; ++index2; } } - this._itemsToUpdate.RemoveRange(index2, count - index2); + _itemsToUpdate.RemoveRange(index2, count - index2); } public void Dispose() { - if (this._timer == null) + if (_timer == null) return; - this._timer.Enabled = false; + _timer.Enabled = false; } private void TriggerNextUpdate() { - this.EnsureTimer(); - this._timer.Enabled = true; + EnsureTimer(); + _timer.Enabled = true; } private void DeliverNextUpdate(object senderObject, EventArgs unusedArgs) { - if (this._itemsToUpdate.Count == 0) + if (_itemsToUpdate.Count == 0) return; - if (this._outstandingUpdates.Count == this._throttle) + if (_outstandingUpdates.Count == _throttle) { - this.TriggerNextUpdate(); + TriggerNextUpdate(); } else { - Repeater repeaterHost = this._virtualList.RepeaterHost; + Repeater repeaterHost = _virtualList.RepeaterHost; if (repeaterHost == null) return; int index1 = -1; @@ -116,18 +116,18 @@ namespace Microsoft.Iris.Data if (index1 != -1) { int dataIndex; - ListUtility.GetWrappedIndex(index1, this._virtualList.Count, out dataIndex, out int _); - if (this._lastInterestIndex != dataIndex) - this._listIsDirty = true; - this._lastInterestIndex = dataIndex; + ListUtility.GetWrappedIndex(index1, _virtualList.Count, out dataIndex, out int _); + if (_lastInterestIndex != dataIndex) + _listIsDirty = true; + _lastInterestIndex = dataIndex; } - if (this._listIsDirty) + if (_listIsDirty) { - if (this._itemDistanceComparer == null) - this._itemDistanceComparer = new UpdateHelper.ItemDistanceComparer(); - this._itemDistanceComparer.Initialize(this._lastInterestIndex, this._virtualList.Count); - this._itemsToUpdate.Sort(_itemDistanceComparer); - this._listIsDirty = false; + if (_itemDistanceComparer == null) + _itemDistanceComparer = new UpdateHelper.ItemDistanceComparer(); + _itemDistanceComparer.Initialize(_lastInterestIndex, _virtualList.Count); + _itemsToUpdate.Sort(_itemDistanceComparer); + _listIsDirty = false; } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); @@ -135,34 +135,34 @@ namespace Microsoft.Iris.Data do { ++count; - int index2 = this._itemsToUpdate[this._itemsToUpdate.Count - count]; - this._outstandingUpdates.Add(index2); - this._virtualList.NotifyRequestSlowData(index2); + int index2 = _itemsToUpdate[_itemsToUpdate.Count - count]; + _outstandingUpdates.Add(index2); + _virtualList.NotifyRequestSlowData(index2); } - while (stopwatch.ElapsedMilliseconds < 10L && this._itemsToUpdate.Count != count && this._outstandingUpdates.Count < this._throttle); - this._itemsToUpdate.RemoveRange(this._itemsToUpdate.Count - count, count); - if (this._itemsToUpdate.Count == 0) + while (stopwatch.ElapsedMilliseconds < 10L && _itemsToUpdate.Count != count && _outstandingUpdates.Count < _throttle); + _itemsToUpdate.RemoveRange(_itemsToUpdate.Count - count, count); + if (_itemsToUpdate.Count == 0) return; - this.TriggerNextUpdate(); + TriggerNextUpdate(); } } public int Throttle { - get => this._throttle; - set => this._throttle = value; + get => _throttle; + set => _throttle = value; } - public bool NotifySlowDataAcquireComplete(int index) => this._outstandingUpdates.Remove(index); + public bool NotifySlowDataAcquireComplete(int index) => _outstandingUpdates.Remove(index); private void EnsureTimer() { - if (this._timer != null) + if (_timer != null) return; - this._timer = new DispatcherTimer(); - this._timer.AutoRepeat = false; - this._timer.Interval = 100; - this._timer.Tick += new EventHandler(this.DeliverNextUpdate); + _timer = new DispatcherTimer(); + _timer.AutoRepeat = false; + _timer.Interval = 100; + _timer.Tick += new EventHandler(DeliverNextUpdate); } private class ItemDistanceComparer : IComparer @@ -173,18 +173,18 @@ namespace Microsoft.Iris.Data public void Initialize(int focusedIndex, int totalCount) { - this._focusedIndex = focusedIndex; - this._totalCount = totalCount; - this._midPoint = totalCount / 2; + _focusedIndex = focusedIndex; + _totalCount = totalCount; + _midPoint = totalCount / 2; } - public int Compare(int left, int right) => this.GetDistance(right) - this.GetDistance(left); + public int Compare(int left, int right) => GetDistance(right) - GetDistance(left); private int GetDistance(int potential) { - int num = Math.Abs(potential - this._focusedIndex); - if (num > this._midPoint) - num = this._totalCount - num + 1; + int num = Math.Abs(potential - _focusedIndex); + if (num > _midPoint) + num = _totalCount - num + 1; return num; } } diff --git a/UIX/Microsoft/Iris/DataProviderMapping.cs b/UIX/Microsoft/Iris/DataProviderMapping.cs index 353e7b5..9402f8b 100644 --- a/UIX/Microsoft/Iris/DataProviderMapping.cs +++ b/UIX/Microsoft/Iris/DataProviderMapping.cs @@ -23,21 +23,21 @@ namespace Microsoft.Iris public object UnderlyingCollectionTypeCookie => _propertySchema.AlternateType; - public string PropertyName => this._propertySchema.Name; + public string PropertyName => _propertySchema.Name; - public string PropertyTypeName => GetCanonicalTypeName(this._propertySchema.PropertyType); + public string PropertyTypeName => GetCanonicalTypeName(_propertySchema.PropertyType); - public Type PropertyType => this._assemblyPropertyType; + public Type PropertyType => _assemblyPropertyType; - public string UnderlyingCollectionTypeName => GetCanonicalTypeName(this._propertySchema.AlternateType); + public string UnderlyingCollectionTypeName => GetCanonicalTypeName(_propertySchema.AlternateType); - public Type UnderlyingCollectionType => this._assemblyAlternateType; + public Type UnderlyingCollectionType => _assemblyAlternateType; - public string Source => this._source; + public string Source => _source; - public string Target => this._target; + public string Target => _target; - public object DefaultValue => this._defaultValue; + public object DefaultValue => _defaultValue; internal DataProviderMapping(PropertySchema propertySchema, object defaultValue) : this(propertySchema, null, null, defaultValue) @@ -50,14 +50,14 @@ namespace Microsoft.Iris string target, object defaultValue) { - this._propertySchema = propertySchema; - this._source = source; - this._target = target; - this._defaultValue = defaultValue; - this._assemblyPropertyType = AssemblyLoadResult.MapType(this._propertySchema.PropertyType); - if (this._propertySchema.AlternateType == null) + _propertySchema = propertySchema; + _source = source; + _target = target; + _defaultValue = defaultValue; + _assemblyPropertyType = AssemblyLoadResult.MapType(_propertySchema.PropertyType); + if (_propertySchema.AlternateType == null) return; - this._assemblyAlternateType = AssemblyLoadResult.MapType(this._propertySchema.AlternateType); + _assemblyAlternateType = AssemblyLoadResult.MapType(_propertySchema.AlternateType); } internal static string GetCanonicalTypeName(TypeSchema typeSchema) diff --git a/UIX/Microsoft/Iris/DataProviderObject.cs b/UIX/Microsoft/Iris/DataProviderObject.cs index 1d538f3..bf847ea 100644 --- a/UIX/Microsoft/Iris/DataProviderObject.cs +++ b/UIX/Microsoft/Iris/DataProviderObject.cs @@ -27,9 +27,9 @@ namespace Microsoft.Iris protected DataProviderObject(DataProviderQuery owner, object typeCookie) { - this._owner = owner != null ? owner : throw new ArgumentNullException(nameof(owner)); - this._typeSchema = typeCookie as MarkupDataTypeSchema; - if (this._typeSchema != null) + _owner = owner != null ? owner : throw new ArgumentNullException(nameof(owner)); + _typeSchema = typeCookie as MarkupDataTypeSchema; + if (_typeSchema != null) return; if (typeCookie is TypeSchema) throw new ArgumentException(((TypeSchema)typeCookie).Name + " is not a valid type for a DataProviderObject", nameof(typeCookie)); @@ -38,21 +38,21 @@ namespace Microsoft.Iris throw new ArgumentException("typeCookie must be a TypeCookie from a DataProviderMapping", nameof(typeCookie)); } - internal DataProviderObject(MarkupDataTypeSchema typeSchema) => this._typeSchema = typeSchema; + internal DataProviderObject(MarkupDataTypeSchema typeSchema) => _typeSchema = typeSchema; - public DataProviderQuery Owner => this._owner; + public DataProviderQuery Owner => _owner; - public string TypeName => this._typeSchema.Name; + public string TypeName => _typeSchema.Name; protected IDictionary Mappings { get { - if (this._mappings == null) + if (_mappings == null) { lock (SynchronizedFindDataMappings) { - MarkupDataMapping dataMapping = MarkupDataProvider.FindDataMapping(this._owner != null ? this._owner.ProviderName : string.Empty, this._typeSchema); + MarkupDataMapping dataMapping = MarkupDataProvider.FindDataMapping(_owner != null ? _owner.ProviderName : string.Empty, _typeSchema); if (dataMapping.AssemblyDataProviderCookie == null) { Dictionary dictionary = new Dictionary(dataMapping.Mappings.Length); @@ -60,7 +60,7 @@ namespace Microsoft.Iris dictionary[mapping.Property.Name] = new DataProviderMapping(mapping.Property, mapping.Source, mapping.Target, AssemblyLoadResult.UnwrapObject(mapping.DefaultValue)); dataMapping.AssemblyDataProviderCookie = dictionary; } - this._mappings = (Dictionary)dataMapping.AssemblyDataProviderCookie; + _mappings = (Dictionary)dataMapping.AssemblyDataProviderCookie; } } return _mappings; @@ -69,10 +69,10 @@ namespace Microsoft.Iris protected void FirePropertyChanged(string propertyName) { - this.OnPropertyChanged(propertyName); - if (this._internalObject == null) + OnPropertyChanged(propertyName); + if (_internalObject == null) return; - this._internalObject.FireNotificationThreadSafe(propertyName); + _internalObject.FireNotificationThreadSafe(propertyName); } protected virtual void OnPropertyChanged(string propertyName) @@ -83,12 +83,12 @@ namespace Microsoft.Iris { get { - if (this._internalObject == null) - this._internalObject = new AssemblyMarkupDataType(this._typeSchema, this); + if (_internalObject == null) + _internalObject = new AssemblyMarkupDataType(_typeSchema, this); return _internalObject; } } - public override string ToString() => this._typeSchema == null ? base.ToString() : this._typeSchema.Name; + public override string ToString() => _typeSchema == null ? base.ToString() : _typeSchema.Name; } } diff --git a/UIX/Microsoft/Iris/DataProviderPropertyChangedEventArgs.cs b/UIX/Microsoft/Iris/DataProviderPropertyChangedEventArgs.cs index 9909912..1a31de0 100644 --- a/UIX/Microsoft/Iris/DataProviderPropertyChangedEventArgs.cs +++ b/UIX/Microsoft/Iris/DataProviderPropertyChangedEventArgs.cs @@ -14,8 +14,8 @@ namespace Microsoft.Iris public DataProviderPropertyChangedEventArgs(string name, bool invalidatesQuery) : base(name) - => this._invalidatesQuery = invalidatesQuery; + => _invalidatesQuery = invalidatesQuery; - public bool InvalidatesQuery => this._invalidatesQuery; + public bool InvalidatesQuery => _invalidatesQuery; } } diff --git a/UIX/Microsoft/Iris/DataProviderQuery.cs b/UIX/Microsoft/Iris/DataProviderQuery.cs index b86492e..4196c70 100644 --- a/UIX/Microsoft/Iris/DataProviderQuery.cs +++ b/UIX/Microsoft/Iris/DataProviderQuery.cs @@ -35,55 +35,55 @@ namespace Microsoft.Iris public object Result { - get => this._result; + get => _result; set { - if (Equals(this._result, value)) + if (Equals(_result, value)) return; - this._result = value; - this.FirePropertyChanged(nameof(Result)); + _result = value; + FirePropertyChanged(nameof(Result)); } } public DataProviderQueryStatus Status { - get => this._status; + get => _status; set { - if (this._status == value) + if (_status == value) return; - this._status = value; - this.FirePropertyChanged(nameof(Status)); + _status = value; + FirePropertyChanged(nameof(Status)); } } public bool Enabled { - get => this._enabled; + get => _enabled; set { - if (this._enabled == value) + if (_enabled == value) return; - this._enabled = value; - this.FirePropertyChanged(nameof(Enabled)); - if (!this._enabled || !this._isInvalid) + _enabled = value; + FirePropertyChanged(nameof(Enabled)); + if (!_enabled || !_isInvalid) return; - this.DeferredBeginExecute(null); + DeferredBeginExecute(null); } } - protected bool Initialized => this._initialized; + protected bool Initialized => _initialized; - public void Refresh() => this.BeginExecute(); + public void Refresh() => BeginExecute(); public virtual object GetProperty(string propertyName) { - lock (this.SynchronizedPropertyStorage) + lock (SynchronizedPropertyStorage) { - if (this._propertyValues != null) + if (_propertyValues != null) { object obj; - if (this._propertyValues.TryGetValue(propertyName, out obj)) + if (_propertyValues.TryGetValue(propertyName, out obj)) return obj; } } @@ -93,52 +93,52 @@ namespace Microsoft.Iris public virtual void SetProperty(string propertyName, object value) { bool flag1 = false; - lock (this.SynchronizedPropertyStorage) + lock (SynchronizedPropertyStorage) { bool flag2 = false; - if (this._propertyValues == null) + if (_propertyValues == null) { - this._propertyValues = new Dictionary(); + _propertyValues = new Dictionary(); flag2 = true; } - if (!flag2 && this._propertyValues.ContainsKey(propertyName)) + if (!flag2 && _propertyValues.ContainsKey(propertyName)) { - if (Equals(this._propertyValues[propertyName], value)) + if (Equals(_propertyValues[propertyName], value)) goto label_8; } - this._propertyValues[propertyName] = value; + _propertyValues[propertyName] = value; flag1 = true; } label_8: if (!flag1) return; - this.FirePropertyChanged(propertyName); + FirePropertyChanged(propertyName); } protected void FirePropertyChanged(string propertyName) { - this.OnPropertyChanged(propertyName); - if (this._internalQuery != null) - this._internalQuery.FireNotificationThreadSafe(propertyName); - bool invalidatesQuery = this._typeSchema.InvalidatesQuery(propertyName); - if (this.PropertyChanged != null) - this.PropertyChanged(this, new DataProviderPropertyChangedEventArgs(propertyName, invalidatesQuery)); - if (this._isInvalid || !invalidatesQuery) + OnPropertyChanged(propertyName); + if (_internalQuery != null) + _internalQuery.FireNotificationThreadSafe(propertyName); + bool invalidatesQuery = _typeSchema.InvalidatesQuery(propertyName); + if (PropertyChanged != null) + PropertyChanged(this, new DataProviderPropertyChangedEventArgs(propertyName, invalidatesQuery)); + if (_isInvalid || !invalidatesQuery) return; - this._isInvalid = true; - if (!this._enabled) + _isInvalid = true; + if (!_enabled) return; - Application.DeferredInvoke(new DeferredInvokeHandler(this.DeferredBeginExecute), DeferredInvokePriority.Low); + Application.DeferredInvoke(new DeferredInvokeHandler(DeferredBeginExecute), DeferredInvokePriority.Low); } public event PropertyChangedEventHandler PropertyChanged; private void DeferredBeginExecute(object args) { - if (!this._isInvalid) + if (!_isInvalid) return; - this._isInvalid = false; - this.BeginExecute(); + _isInvalid = false; + BeginExecute(); } protected virtual void OnPropertyChanged(string propertyName) @@ -149,11 +149,11 @@ namespace Microsoft.Iris { } - public bool IsDisposed => this._isDisposed; + public bool IsDisposed => _isDisposed; - void IDisposableObject.DeclareOwner(object owner) => this.DeclareOwnerWorker(owner); + void IDisposableObject.DeclareOwner(object owner) => DeclareOwnerWorker(owner); - void IDataProviderQuery.DeclareOwner(object owner) => this.DeclareOwnerWorker(owner); + void IDataProviderQuery.DeclareOwner(object owner) => DeclareOwnerWorker(owner); private void DeclareOwnerWorker(object owner) { @@ -163,41 +163,41 @@ namespace Microsoft.Iris { } - void IDisposableObject.Dispose(object owner) => this.DisposeWorker(owner); + void IDisposableObject.Dispose(object owner) => DisposeWorker(owner); - void IDataProviderQuery.Dispose(object owner) => this.DisposeWorker(owner); + void IDataProviderQuery.Dispose(object owner) => DisposeWorker(owner); private void DisposeWorker(object owner) { - if (this._isDisposed) + if (_isDisposed) return; - this.OnDispose(); - this._isDisposed = true; + OnDispose(); + _isDisposed = true; } protected DataProviderQuery(object typeCookie) { - this._typeSchema = typeCookie as MarkupDataQuerySchema; - if (this._typeSchema == null) + _typeSchema = typeCookie as MarkupDataQuerySchema; + if (_typeSchema == null) throw new ArgumentException(nameof(typeCookie), "typeCookie must be the queryTypeCookie passed to ConstructQuery"); - this._isInvalid = true; + _isInvalid = true; } object AssemblyObjectProxyHelper.IFrameworkProxyObject.FrameworkObject => _internalQuery; - internal string ProviderName => this._typeSchema.ProviderName; + internal string ProviderName => _typeSchema.ProviderName; - void IDataProviderQuery.SetInternalObject(MarkupDataQuery internalQuery) => this._internalQuery = internalQuery; + void IDataProviderQuery.SetInternalObject(MarkupDataQuery internalQuery) => _internalQuery = internalQuery; void IDataProviderQuery.OnInitialize() { - this._initialized = true; - if (!this._enabled) + _initialized = true; + if (!_enabled) return; - this.DeferredBeginExecute(null); + DeferredBeginExecute(null); } - public override string ToString() => this._typeSchema.Name; + public override string ToString() => _typeSchema.Name; private object SynchronizedPropertyStorage => _internalQuery; } diff --git a/UIX/Microsoft/Iris/DeferredInvokeProxy.cs b/UIX/Microsoft/Iris/DeferredInvokeProxy.cs index 134fad5..244f576 100644 --- a/UIX/Microsoft/Iris/DeferredInvokeProxy.cs +++ b/UIX/Microsoft/Iris/DeferredInvokeProxy.cs @@ -17,6 +17,6 @@ namespace Microsoft.Iris _method = method }.Thunk); - private void Thunk(object args) => this._method(args); + private void Thunk(object args) => _method(args); } } diff --git a/UIX/Microsoft/Iris/Drawing/Camera.cs b/UIX/Microsoft/Iris/Drawing/Camera.cs index 20b551a..89ec143 100644 --- a/UIX/Microsoft/Iris/Drawing/Camera.cs +++ b/UIX/Microsoft/Iris/Drawing/Camera.cs @@ -35,26 +35,26 @@ namespace Microsoft.Iris.Drawing private NotifyService _notifier = new NotifyService(); private IList _listeners = new ArrayList(); - public Camera() => this._camera = UISession.Default.RenderSession.CreateCamera(this); + public Camera() => _camera = UISession.Default.RenderSession.CreateCamera(this); protected override void OnDispose() { base.OnDispose(); - Vector activeAnimations = this.GetActiveAnimations(false); + Vector activeAnimations = GetActiveAnimations(false); if (activeAnimations != null) { foreach (DisposableObject disposableObject in activeAnimations) disposableObject.Dispose(this); } - this._camera.UnregisterUsage(this); - this._camera = null; + _camera.UnregisterUsage(this); + _camera = null; } - public void AddListener(Listener listener) => this._notifier.AddListener(listener); + public void AddListener(Listener listener) => _notifier.AddListener(listener); protected void FireNotification(string id) { - this._notifier.Fire(id); + _notifier.Fire(id); foreach (object listener in _listeners) { if (listener is ViewItem viewItem) @@ -65,38 +65,38 @@ namespace Microsoft.Iris.Drawing public override void RegisterUsage(object consumer) { base.RegisterUsage(consumer); - this._listeners.Add(consumer); + _listeners.Add(consumer); } public override void UnregisterUsage(object consumer) { - this._listeners.Remove(consumer); + _listeners.Remove(consumer); base.UnregisterUsage(consumer); } public bool Perspective { - get => this._camera.Perspective; + get => _camera.Perspective; set { - if (this._camera.Perspective == value) + if (_camera.Perspective == value) return; - this._camera.Perspective = value; - this.FireNotification(NotificationID.Perspective); + _camera.Perspective = value; + FireNotification(NotificationID.Perspective); } } public Vector3 Eye { - get => this._hasEyeNoSend ? this._vEyeNoSend : this._camera.Eye; + get => _hasEyeNoSend ? _vEyeNoSend : _camera.Eye; set { - if (!(this._camera.Eye != value)) + if (!(_camera.Eye != value)) return; - this.CameraEyeNoSend = value; - if (this._eyeAnimation == null || !this.PlayAnimation(this._eyeAnimation, null)) - this.CameraEye = value; - this.FireNotification(NotificationID.Eye); + CameraEyeNoSend = value; + if (_eyeAnimation == null || !PlayAnimation(_eyeAnimation, null)) + CameraEye = value; + FireNotification(NotificationID.Eye); } } @@ -104,8 +104,8 @@ namespace Microsoft.Iris.Drawing { set { - this._hasEyeNoSend = true; - this._vEyeNoSend = value; + _hasEyeNoSend = true; + _vEyeNoSend = value; } } @@ -113,22 +113,22 @@ namespace Microsoft.Iris.Drawing { set { - this._camera.Eye = value; - this._hasEyeNoSend = false; + _camera.Eye = value; + _hasEyeNoSend = false; } } public Vector3 At { - get => this._hasAtNoSend ? this._vAtNoSend : this._camera.At; + get => _hasAtNoSend ? _vAtNoSend : _camera.At; set { - if (!(this._camera.At != value)) + if (!(_camera.At != value)) return; - this.CameraAtNoSend = value; - if (this._atAnimation == null || !this.PlayAnimation(this._atAnimation, null)) - this.CameraAt = value; - this.FireNotification(NotificationID.At); + CameraAtNoSend = value; + if (_atAnimation == null || !PlayAnimation(_atAnimation, null)) + CameraAt = value; + FireNotification(NotificationID.At); } } @@ -136,8 +136,8 @@ namespace Microsoft.Iris.Drawing { set { - this._hasAtNoSend = true; - this._vAtNoSend = value; + _hasAtNoSend = true; + _vAtNoSend = value; } } @@ -145,22 +145,22 @@ namespace Microsoft.Iris.Drawing { set { - this._camera.At = value; - this._hasAtNoSend = false; + _camera.At = value; + _hasAtNoSend = false; } } public Vector3 Up { - get => this._hasUpNoSend ? this._vUpNoSend : this._camera.Up; + get => _hasUpNoSend ? _vUpNoSend : _camera.Up; set { - if (!(this._camera.Up != value)) + if (!(_camera.Up != value)) return; - this.CameraUpNoSend = value; - if (this._upAnimation == null || !this.PlayAnimation(this._upAnimation, null)) - this.CameraUp = value; - this.FireNotification(NotificationID.Up); + CameraUpNoSend = value; + if (_upAnimation == null || !PlayAnimation(_upAnimation, null)) + CameraUp = value; + FireNotification(NotificationID.Up); } } @@ -168,8 +168,8 @@ namespace Microsoft.Iris.Drawing { set { - this._hasUpNoSend = true; - this._vUpNoSend = value; + _hasUpNoSend = true; + _vUpNoSend = value; } } @@ -177,22 +177,22 @@ namespace Microsoft.Iris.Drawing { set { - this._camera.Up = value; - this._hasUpNoSend = false; + _camera.Up = value; + _hasUpNoSend = false; } } public float Zn { - get => this._hasZnNoSend ? this._flZnNoSend : this._camera.Zn; + get => _hasZnNoSend ? _flZnNoSend : _camera.Zn; set { if (_camera.Zn == (double)value) return; - this.CameraZnNoSend = value; - if (this._znAnimation == null || !this.PlayAnimation(this._znAnimation, null)) - this.CameraZn = value; - this.FireNotification(NotificationID.Zn); + CameraZnNoSend = value; + if (_znAnimation == null || !PlayAnimation(_znAnimation, null)) + CameraZn = value; + FireNotification(NotificationID.Zn); } } @@ -200,8 +200,8 @@ namespace Microsoft.Iris.Drawing { set { - this._hasZnNoSend = true; - this._flZnNoSend = value; + _hasZnNoSend = true; + _flZnNoSend = value; } } @@ -209,67 +209,67 @@ namespace Microsoft.Iris.Drawing { set { - this._camera.Zn = value; - this._hasZnNoSend = false; + _camera.Zn = value; + _hasZnNoSend = false; } } - internal ICamera APICamera => this._camera; + internal ICamera APICamera => _camera; IAnimatable IAnimatableOwner.AnimationTarget => _camera; public IAnimationProvider EyeAnimation { - get => this._eyeAnimation; + get => _eyeAnimation; set { - if (this._eyeAnimation == value) + if (_eyeAnimation == value) return; - this._eyeAnimation = value; - this.FireNotification(NotificationID.EyeAnimation); + _eyeAnimation = value; + FireNotification(NotificationID.EyeAnimation); } } public IAnimationProvider AtAnimation { - get => this._atAnimation; + get => _atAnimation; set { - if (this._atAnimation == value) + if (_atAnimation == value) return; - this._atAnimation = value; - this.FireNotification(NotificationID.AtAnimation); + _atAnimation = value; + FireNotification(NotificationID.AtAnimation); } } public IAnimationProvider UpAnimation { - get => this._upAnimation; + get => _upAnimation; set { - if (this._upAnimation == value) + if (_upAnimation == value) return; - this._upAnimation = value; - this.FireNotification(NotificationID.UpAnimation); + _upAnimation = value; + FireNotification(NotificationID.UpAnimation); } } public IAnimationProvider ZnAnimation { - get => this._znAnimation; + get => _znAnimation; set { - if (this._znAnimation == value) + if (_znAnimation == value) return; - this._znAnimation = value; - this.FireNotification(NotificationID.ZnAnimation); + _znAnimation = value; + FireNotification(NotificationID.ZnAnimation); } } public bool PlayAnimation(IAnimationProvider ab, AnimationHandle animationHandle) { AnimationArgs args = new AnimationArgs(this); - return this.PlayAnimation(ab, ref args, UIClass.ShouldPlayAnimation(ab), animationHandle); + return PlayAnimation(ab, ref args, UIClass.ShouldPlayAnimation(ab), animationHandle); } private bool PlayAnimation( @@ -278,16 +278,16 @@ namespace Microsoft.Iris.Drawing bool shouldPlayAnimation, AnimationHandle animationHandle) { - AnimationTemplate anim = this.BuildAnimation(ab, ref args); + AnimationTemplate anim = BuildAnimation(ab, ref args); if (anim == null) return false; if (shouldPlayAnimation) { - this.PlayAnimation(anim, ref args, null, animationHandle); + PlayAnimation(anim, ref args, null, animationHandle); } else { - this.ApplyFinalAnimationState(anim, ref args); + ApplyFinalAnimationState(anim, ref args); animationHandle?.FireCompleted(); } return true; @@ -306,10 +306,10 @@ namespace Microsoft.Iris.Drawing if (onCompleteHandler != null) instance.AnimationCompleted += onCompleteHandler; animationHandle?.AssociateWithAnimationInstance(instance); - instance.AnimationCompleted += new EventHandler(this.OnAnimationComplete); - this.GetActiveAnimations(true).Add(instance); - this.OnAnimationListChanged(); - this.PlayAnimationWorker(instance); + instance.AnimationCompleted += new EventHandler(OnAnimationComplete); + GetActiveAnimations(true).Add(instance); + OnAnimationListChanged(); + PlayAnimationWorker(instance); if (!(anim is Animation animation)) return; int num = animation.DisableMouseInput ? 1 : 0; @@ -317,7 +317,7 @@ namespace Microsoft.Iris.Drawing private void PlayAnimationWorker(ActiveSequence newSequence) { - this.StopOverlappingAnimations(newSequence); + StopOverlappingAnimations(newSequence); newSequence.Play(); } @@ -330,13 +330,13 @@ namespace Microsoft.Iris.Drawing private void StopOverlappingAnimations(ActiveSequence newSequence) { - Vector activeAnimations = this.GetActiveAnimations(false); + Vector activeAnimations = GetActiveAnimations(false); if (activeAnimations == null) return; ActiveTransitions activeTransitions = newSequence.GetActiveTransitions(); StopCommandSet stopCommand = null; foreach (ActiveSequence playingSequence in activeAnimations) - this.StopAnimationIfOverlapping(playingSequence, newSequence, activeTransitions, ref stopCommand); + StopAnimationIfOverlapping(playingSequence, newSequence, activeTransitions, ref stopCommand); } private bool StopAnimationIfOverlapping( @@ -365,12 +365,12 @@ namespace Microsoft.Iris.Drawing private void OnAnimationComplete(object sender, EventArgs args) { ActiveSequence activeSequence = sender as ActiveSequence; - activeSequence.AnimationCompleted -= new EventHandler(this.OnAnimationComplete); - Vector activeAnimations = this.GetActiveAnimations(false); + activeSequence.AnimationCompleted -= new EventHandler(OnAnimationComplete); + Vector activeAnimations = GetActiveAnimations(false); activeAnimations.Remove(activeSequence); - this.OnAnimationListChanged(); + OnAnimationListChanged(); if (activeAnimations.Count == 0) - this._activeAnimations = null; + _activeAnimations = null; if (activeSequence.Template is Animation template) { int num = template.DisableMouseInput ? 1 : 0; @@ -380,9 +380,9 @@ namespace Microsoft.Iris.Drawing private void StopActiveAnimations() { - if (this._activeAnimations == null) + if (_activeAnimations == null) return; - foreach (ActiveSequence activeAnimation in this.GetActiveAnimations(true)) + foreach (ActiveSequence activeAnimation in GetActiveAnimations(true)) activeAnimation.Stop(); } @@ -399,7 +399,7 @@ namespace Microsoft.Iris.Drawing baseKeyframe?.Apply(this, ref args); } - private Vector GetActiveAnimations(bool createIfNone) => this.GetAnimationSequence(ref this._activeAnimations, createIfNone); + private Vector GetActiveAnimations(bool createIfNone) => GetAnimationSequence(ref _activeAnimations, createIfNone); private Vector GetAnimationSequence( ref Vector currentAnimationsList, diff --git a/UIX/Microsoft/Iris/Drawing/Color.cs b/UIX/Microsoft/Iris/Drawing/Color.cs index 9c4aa32..365c372 100644 --- a/UIX/Microsoft/Iris/Drawing/Color.cs +++ b/UIX/Microsoft/Iris/Drawing/Color.cs @@ -30,25 +30,25 @@ namespace Microsoft.Iris.Drawing public byte R { - get => (byte)(this.Value >> 16 & byte.MaxValue); + get => (byte)(Value >> 16 & byte.MaxValue); set => this = FromArgb(A, value, G, B); } public byte G { - get => (byte)(this.Value >> 8 & byte.MaxValue); + get => (byte)(Value >> 8 & byte.MaxValue); set => this = FromArgb(A, R, value, B); } public byte B { - get => (byte)(this.Value & byte.MaxValue); + get => (byte)(Value & byte.MaxValue); set => this = FromArgb(A, R, G, value); } public byte A { - get => (byte)(this.Value >> 24 & byte.MaxValue); + get => (byte)(Value >> 24 & byte.MaxValue); set => this = FromArgb(value, R, G, B); } @@ -60,7 +60,7 @@ namespace Microsoft.Iris.Drawing b = B / (float)byte.MaxValue; } - internal uint Value => this.value; + internal uint Value => value; private static void CheckByte(int value, string name) { @@ -190,7 +190,7 @@ namespace Microsoft.Iris.Drawing } } - internal int ToArgb() => (int)this.Value; + internal int ToArgb() => (int)Value; internal ColorF RenderConvert() => new ColorF(A, R, G, B); @@ -198,13 +198,13 @@ namespace Microsoft.Iris.Drawing { StringBuilder stringBuilder = new StringBuilder(32); stringBuilder.Append("A="); - stringBuilder.Append(this.A); + stringBuilder.Append(A); stringBuilder.Append(", R="); - stringBuilder.Append(this.R); + stringBuilder.Append(R); stringBuilder.Append(", G="); - stringBuilder.Append(this.G); + stringBuilder.Append(G); stringBuilder.Append(", B="); - stringBuilder.Append(this.B); + stringBuilder.Append(B); return stringBuilder.ToString(); } @@ -212,11 +212,11 @@ namespace Microsoft.Iris.Drawing public static bool operator !=(Color left, Color right) => !(left == right); - public override bool Equals(object obj) => obj is Color color && (int)this.value == (int)color.value; + public override bool Equals(object obj) => obj is Color color && (int)value == (int)color.value; - public bool Equals(Color right) => (int)this.value == (int)right.value; + public bool Equals(Color right) => (int)value == (int)right.value; - public override int GetHashCode() => this.value.GetHashCode(); + public override int GetHashCode() => value.GetHashCode(); internal static Color Transparent => new Color(0U); diff --git a/UIX/Microsoft/Iris/Drawing/Font.cs b/UIX/Microsoft/Iris/Drawing/Font.cs index d003569..85da0b0 100644 --- a/UIX/Microsoft/Iris/Drawing/Font.cs +++ b/UIX/Microsoft/Iris/Drawing/Font.cs @@ -42,47 +42,47 @@ namespace Microsoft.Iris.Drawing public Font(string fontName, float fontHeight, float altFontHeight, FontStyles fontStyles) { - this._fontName = fontName; - this._fontHeight = fontHeight; - this._altFontHeight = altFontHeight; - this._fontStyle = fontStyles; + _fontName = fontName; + _fontHeight = fontHeight; + _altFontHeight = altFontHeight; + _fontStyle = fontStyles; } public float FontSize { - get => this._fontHeight; - set => this._fontHeight = value; + get => _fontHeight; + set => _fontHeight = value; } public float AltFontSize { - get => _altFontHeight == 0.0 ? this._fontHeight : this._altFontHeight; - set => this._altFontHeight = value; + get => _altFontHeight == 0.0 ? _fontHeight : _altFontHeight; + set => _altFontHeight = value; } public FontStyles FontStyle { - get => this._fontStyle; - set => this._fontStyle = value; + get => _fontStyle; + set => _fontStyle = value; } public string FontName { - get => this._fontName; - set => this._fontName = value; + get => _fontName; + set => _fontName = value; } - public override bool Equals(object obj) => obj is Font font && this._fontName == font._fontName && (_fontHeight == (double)font._fontHeight && _altFontHeight == (double)font._altFontHeight) && this._fontStyle == font._fontStyle; + public override bool Equals(object obj) => obj is Font font && _fontName == font._fontName && (_fontHeight == (double)font._fontHeight && _altFontHeight == (double)font._altFontHeight) && _fontStyle == font._fontStyle; - public override int GetHashCode() => this._fontName.GetHashCode() ^ this._fontHeight.GetHashCode() ^ this._altFontHeight.GetHashCode() ^ this._fontStyle.GetHashCode(); + public override int GetHashCode() => _fontName.GetHashCode() ^ _fontHeight.GetHashCode() ^ _altFontHeight.GetHashCode() ^ _fontStyle.GetHashCode(); public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{Font \""); - stringBuilder.Append(this._fontName); + stringBuilder.Append(_fontName); stringBuilder.Append("\" "); - stringBuilder.Append(this._fontHeight); + stringBuilder.Append(_fontHeight); stringBuilder.Append("pt "); stringBuilder.Append(_fontStyle); stringBuilder.Append("}"); diff --git a/UIX/Microsoft/Iris/Drawing/RawImage.cs b/UIX/Microsoft/Iris/Drawing/RawImage.cs index 41208ce..4476a99 100644 --- a/UIX/Microsoft/Iris/Drawing/RawImage.cs +++ b/UIX/Microsoft/Iris/Drawing/RawImage.cs @@ -36,27 +36,27 @@ namespace Microsoft.Iris.Drawing bool antialiasEdges) : base(nineGrid, maximumSize, flippable, antialiasEdges) { - this.Source = uniqueID; - this._uniqueID = uniqueID; - this._imageSize = imageSize; - this._stride = stride; - this._format = format; - this._contentSize = imageSize; - int cbCopy = this._imageSize.Height * Math.Abs(stride); - this._length = (uint)cbCopy; + Source = uniqueID; + _uniqueID = uniqueID; + _imageSize = imageSize; + _stride = stride; + _format = format; + _contentSize = imageSize; + int cbCopy = _imageSize.Height * Math.Abs(stride); + _length = (uint)cbCopy; if (!takeOwnership) { - this._data = NativeApi.MemAlloc(this._length, false); - Memory.Copy(this._data, data, cbCopy); + _data = NativeApi.MemAlloc(_length, false); + Memory.Copy(_data, data, cbCopy); } else - this._data = data; + _data = data; } ~RawImage() { - FreeBuffer(this._data); - this._data = IntPtr.Zero; + FreeBuffer(_data); + _data = IntPtr.Zero; } internal static void FreeBuffer(IntPtr data) @@ -70,15 +70,15 @@ namespace Microsoft.Iris.Drawing { ImageCache instance = ScavengeImageCache.Instance; ImageCacheItem imageCacheItem = null; - string str = this.GetHashCode().ToString(); - if (this._cacheItemKey == null) - this._cacheItemKey = new RawImageItemKey(str); + string str = GetHashCode().ToString(); + if (_cacheItemKey == null) + _cacheItemKey = new RawImageItemKey(str); else imageCacheItem = instance.Lookup(_cacheItemKey); if (imageCacheItem == null) { - Size maxSize = ClampSize(this._maximumSize); - imageCacheItem = new RawImageItem(UISession.Default.RenderSession, this, str, this._data, this._length, this._imageSize, this._stride, this._format, maxSize, this.IsFlipped, this._antialiasEdges); + Size maxSize = ClampSize(_maximumSize); + imageCacheItem = new RawImageItem(UISession.Default.RenderSession, this, str, _data, _length, _imageSize, _stride, _format, maxSize, IsFlipped, _antialiasEdges); instance.Add(_cacheItemKey, imageCacheItem); } needAsyncLoad = false; diff --git a/UIX/Microsoft/Iris/Drawing/RawImageItem.cs b/UIX/Microsoft/Iris/Drawing/RawImageItem.cs index c29d236..c599166 100644 --- a/UIX/Microsoft/Iris/Drawing/RawImageItem.cs +++ b/UIX/Microsoft/Iris/Drawing/RawImageItem.cs @@ -30,20 +30,20 @@ namespace Microsoft.Iris.Drawing bool antialiasEdges) : base(renderSession, source, maxSize, flippable, antialiasEdges) { - this._oKeepAlive = rawImage; - this.SetSize(imageSize); - this.SetBuffer(data, length); - this._stride = stride; - this._format = format; + _oKeepAlive = rawImage; + SetSize(imageSize); + SetBuffer(data, length); + _stride = stride; + _format = format; } protected override void OnDispose() { - this._oKeepAlive = null; - this.m_buffer = IntPtr.Zero; + _oKeepAlive = null; + m_buffer = IntPtr.Zero; base.OnDispose(); } - protected override bool DoImageLoad() => ImageLoader.FromRaw(this.RenderImage, this.m_buffer, (int)this.m_length, this.m_size, this._stride, this._format, this.m_req.MaximumSize, this.m_req.Flippable, this.m_req.AntialiasEdges, this.m_req.BorderWidth, this.m_req.BorderColor, out this.m_info); + protected override bool DoImageLoad() => ImageLoader.FromRaw(RenderImage, m_buffer, (int)m_length, m_size, _stride, _format, m_req.MaximumSize, m_req.Flippable, m_req.AntialiasEdges, m_req.BorderWidth, m_req.BorderColor, out m_info); } } diff --git a/UIX/Microsoft/Iris/Drawing/RawImageItemKey.cs b/UIX/Microsoft/Iris/Drawing/RawImageItemKey.cs index e3b1c59..22ce494 100644 --- a/UIX/Microsoft/Iris/Drawing/RawImageItemKey.cs +++ b/UIX/Microsoft/Iris/Drawing/RawImageItemKey.cs @@ -15,15 +15,15 @@ namespace Microsoft.Iris.Drawing public RawImageItemKey(string id) : base(id) - => this._uniqueId = ++s_uniqueId; + => _uniqueId = ++s_uniqueId; public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) return true; - return obj is RawImageItemKey rawImageItemKey && this._uniqueId == rawImageItemKey._uniqueId; + return obj is RawImageItemKey rawImageItemKey && _uniqueId == rawImageItemKey._uniqueId; } - public override int GetHashCode() => this._uniqueId; + public override int GetHashCode() => _uniqueId; } } diff --git a/UIX/Microsoft/Iris/Drawing/ResourceImageItem.cs b/UIX/Microsoft/Iris/Drawing/ResourceImageItem.cs index 47f27f7..da5a069 100644 --- a/UIX/Microsoft/Iris/Drawing/ResourceImageItem.cs +++ b/UIX/Microsoft/Iris/Drawing/ResourceImageItem.cs @@ -25,16 +25,16 @@ namespace Microsoft.Iris.Drawing bool antialiasEdges) : base(renderSession, source, maxSize, flippable, antialiasEdges) { - this._source = source; - this._resource = ResourceManager.Instance.GetResource(this._source); + _source = source; + _resource = ResourceManager.Instance.GetResource(_source); } protected override void OnDispose() { - if (this._resource != null) + if (_resource != null) { - this.FreeResource(); - this._resource = null; + FreeResource(); + _resource = null; } base.OnDispose(); } @@ -43,8 +43,8 @@ namespace Microsoft.Iris.Drawing { get { - this.EnsureResource(); - return this._resource; + EnsureResource(); + return _resource; } } @@ -52,7 +52,7 @@ namespace Microsoft.Iris.Drawing { get { - switch (this._resource.Status) + switch (_resource.Status) { case ResourceStatus.NeedsAcquire: return ImageStatus.PendingLoad; @@ -70,15 +70,15 @@ namespace Microsoft.Iris.Drawing protected override bool EnsureBuffer() { - if (this.EnsureResource()) + if (EnsureResource()) { - if (this.IsResourceAvailable()) - this.OnResourceLoadComplete(this._resource); - else if (!this._acquireCalled) + if (IsResourceAvailable()) + OnResourceLoadComplete(_resource); + else if (!_acquireCalled) { - this._resourceAcquisitionHandler = new ResourceAcquisitionCompleteHandler(this.OnResourceLoadComplete); - this._resource.Acquire(this._resourceAcquisitionHandler); - this._acquireCalled = true; + _resourceAcquisitionHandler = new ResourceAcquisitionCompleteHandler(OnResourceLoadComplete); + _resource.Acquire(_resourceAcquisitionHandler); + _acquireCalled = true; } } return false; @@ -86,38 +86,38 @@ namespace Microsoft.Iris.Drawing protected override void OnImageLoadComplete() { - ImageStatus status = this.Status; - if (this.LoadCompleteHandler == null) + ImageStatus status = Status; + if (LoadCompleteHandler == null) return; - this.LoadCompleteHandler(this, status); + LoadCompleteHandler(this, status); } - private bool IsResourceAvailable() => this._resource.Status == ResourceStatus.Available; + private bool IsResourceAvailable() => _resource.Status == ResourceStatus.Available; public bool EnsureResource() { - if (this._resource == null) - this._resource = ResourceManager.Instance.GetResource(this._source); - return this._resource != null; + if (_resource == null) + _resource = ResourceManager.Instance.GetResource(_source); + return _resource != null; } private void OnResourceLoadComplete(Resource resource) { - if (resource != this._resource) + if (resource != _resource) return; - if (!IsSuccessfulResourceLoad(this._resource) || Application.IsShuttingDown) + if (!IsSuccessfulResourceLoad(_resource) || Application.IsShuttingDown) { - this.OnImageLoadComplete(); - this.FreeResource(); + OnImageLoadComplete(); + FreeResource(); } else { - this.SetBuffer(this._resource.Buffer, this._resource.Length); - if (this._resource.Length <= 0U) + SetBuffer(_resource.Buffer, _resource.Length); + if (_resource.Length <= 0U) return; - if (!this.ProcessBuffer()) - this._resource.Status = ResourceStatus.Error; - this.OnImageLoadComplete(); + if (!ProcessBuffer()) + _resource.Status = ResourceStatus.Error; + OnImageLoadComplete(); } } @@ -125,27 +125,27 @@ namespace Microsoft.Iris.Drawing private void FreeResource() { - if (this._acquireCalled) + if (_acquireCalled) { - this._resource.Free(this._resourceAcquisitionHandler); - this._resourceAcquisitionHandler = null; + _resource.Free(_resourceAcquisitionHandler); + _resourceAcquisitionHandler = null; } - this._acquireCalled = false; + _acquireCalled = false; } - public override void StartLoad() => this.EnsureBuffer(); + public override void StartLoad() => EnsureBuffer(); - public override string ToString() => this._source; + public override string ToString() => _source; public override void ReleaseImage() { - this.LoadCompleteHandler = null; + LoadCompleteHandler = null; base.ReleaseImage(); } public override void RemoveData() { - this.FreeResource(); + FreeResource(); base.RemoveData(); } diff --git a/UIX/Microsoft/Iris/Drawing/RichText.cs b/UIX/Microsoft/Iris/Drawing/RichText.cs index 392f1ca..82df2d3 100644 --- a/UIX/Microsoft/Iris/Drawing/RichText.cs +++ b/UIX/Microsoft/Iris/Drawing/RichText.cs @@ -43,43 +43,43 @@ namespace Microsoft.Iris.Drawing sizeMaximumSurface = UIImage.MaximumSurfaceSize(UISession.Default); if (callbacks != null) { - this._hosted = true; - this._timers = new ArrayList(6); - this._timerTickHandler = new EventHandler(this.OnTimerTick); + _hosted = true; + _timers = new ArrayList(6); + _timerTickHandler = new EventHandler(OnTimerTick); } - RendererApi.IFC(NativeApi.SpRichTextBuildObject(richTextMode, sizeMaximumSurface, callbacks, out this._rtoHandle)); - this._oversampled = false; - this._lock = new object(); - this._rrcb = new NativeApi.ReportRunCallback(this.OnReportRun); + RendererApi.IFC(NativeApi.SpRichTextBuildObject(richTextMode, sizeMaximumSurface, callbacks, out _rtoHandle)); + _oversampled = false; + _lock = new object(); + _rrcb = new NativeApi.ReportRunCallback(OnReportRun); } - public void Dispose() => this.Dispose(true); + public void Dispose() => Dispose(true); private void Dispose(bool inDispose) { if (!inDispose) return; GC.SuppressFinalize(this); - lock (this._lock) + lock (_lock) { - NativeApi.SpRichTextDestroyObject(this._rtoHandle); - this._rtoHandle.h = IntPtr.Zero; + NativeApi.SpRichTextDestroyObject(_rtoHandle); + _rtoHandle.h = IntPtr.Zero; } - if (this._timers == null) + if (_timers == null) return; - for (int index = 0; index < this._timers.Count; ++index) - this.DisposeTimer((DispatcherTimer)this._timers[index]); - this._timers.Clear(); + for (int index = 0; index < _timers.Count; ++index) + DisposeTimer((DispatcherTimer)_timers[index]); + _timers.Clear(); } - ~RichText() => this.Dispose(false); + ~RichText() => Dispose(false); public string Content { set { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetContent(this._rtoHandle, value)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetContent(_rtoHandle, value)); } } @@ -89,13 +89,13 @@ namespace Microsoft.Iris.Drawing { string str = null; int textLength = 0; - lock (this._lock) + lock (_lock) { - RendererApi.IFC(NativeApi.SpRichTextGetSimpleContentLength(this._rtoHandle, out textLength)); + RendererApi.IFC(NativeApi.SpRichTextGetSimpleContentLength(_rtoHandle, out textLength)); if (textLength != 0) { StringBuilder textBuffer = new StringBuilder(textLength); - RendererApi.IFC(NativeApi.SpRichTextGetSimpleContent(this._rtoHandle, textBuffer, textBuffer.Capacity)); + RendererApi.IFC(NativeApi.SpRichTextGetSimpleContent(_rtoHandle, textBuffer, textBuffer.Capacity)); str = textBuffer.ToString(); } } @@ -107,21 +107,21 @@ namespace Microsoft.Iris.Drawing { set { - if (this._oversampled == value) + if (_oversampled == value) return; - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetOversampleMode(this._rtoHandle, value)); - this._oversampled = value; + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetOversampleMode(_rtoHandle, value)); + _oversampled = value; } - get => this._oversampled; + get => _oversampled; } public int MaxLength { set { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetMaximumLength(this._rtoHandle, value)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetMaximumLength(_rtoHandle, value)); } } @@ -129,49 +129,49 @@ namespace Microsoft.Iris.Drawing { set { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetDetectUrls(this._rtoHandle, value)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetDetectUrls(_rtoHandle, value)); } } - public bool HasCallbacks => this._hosted; + public bool HasCallbacks => _hosted; public bool ReadOnly { set { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetReadOnly(this._rtoHandle, value)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetReadOnly(_rtoHandle, value)); } } public void SetWordWrap(bool wordWrap) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetWordWrap(this._rtoHandle, wordWrap)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetWordWrap(_rtoHandle, wordWrap)); } public Size GetNaturalBounds() { int cWidth; int cHeight; - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextGetNaturalBounds(this._rtoHandle, out cWidth, out cHeight)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextGetNaturalBounds(_rtoHandle, out cWidth, out cHeight)); return new Size(cWidth, cHeight); } public void SetSelectionRange(int selectionStart, int selectionEnd) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetSelectionRange(this._rtoHandle, selectionStart, selectionEnd)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetSelectionRange(_rtoHandle, selectionStart, selectionEnd)); } public unsafe TextFlow Measure(string content, ref TextMeasureParams measureParams) { TextFlow textFlow = new TextFlow(); GCHandle gcHandle = GCHandle.Alloc(textFlow); - this._currentlyMeasuringText = content != null ? content : string.Empty; - fixed (char* content1 = this._currentlyMeasuringText) + _currentlyMeasuringText = content != null ? content : string.Empty; + fixed (char* content1 = _currentlyMeasuringText) fixed (char* chPtr = measureParams._textStyle.FontFace) { var style = new TextStyle.MarshalledData(measureParams._textStyle) @@ -186,61 +186,61 @@ namespace Microsoft.Iris.Drawing fixed (TextStyle.MarshalledData* marshalledDataPtr = measureParams._formattedRangeStyles) { measureParams._data._pFormattedRangeStyles = marshalledDataPtr; - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextMeasure(this._rtoHandle, ref measureParams._data, this._rrcb, GCHandle.ToIntPtr(gcHandle))); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextMeasure(_rtoHandle, ref measureParams._data, _rrcb, GCHandle.ToIntPtr(gcHandle))); } } } gcHandle.Free(); - this._currentlyMeasuringText = null; + _currentlyMeasuringText = null; return textFlow; } public void NotifyOfFocusChange(bool gainingFocus) { - lock (this._lock) + lock (_lock) { - RendererApi.IFC(NativeApi.SpRichTextSetFocus(this._rtoHandle, gainingFocus)); + RendererApi.IFC(NativeApi.SpRichTextSetFocus(_rtoHandle, gainingFocus)); if (gainingFocus) return; - this._inImeCompositionMode = false; + _inImeCompositionMode = false; } } public void ScrollUp(ScrollbarType whichBar) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextScroll(this._rtoHandle, (int)whichBar, 0)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextScroll(_rtoHandle, (int)whichBar, 0)); } public void ScrollDown(ScrollbarType whichBar) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextScroll(this._rtoHandle, (int)whichBar, 1)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextScroll(_rtoHandle, (int)whichBar, 1)); } public void PageUp(ScrollbarType whichBar) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextScroll(this._rtoHandle, (int)whichBar, 2)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextScroll(_rtoHandle, (int)whichBar, 2)); } public void PageDown(ScrollbarType whichBar) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextScroll(this._rtoHandle, (int)whichBar, 3)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextScroll(_rtoHandle, (int)whichBar, 3)); } public void ScrollToPosition(ScrollbarType whichBar, int whereTo) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextScrollToPosition(this._rtoHandle, (int)whichBar, whereTo)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextScrollToPosition(_rtoHandle, (int)whichBar, whereTo)); } public void SetScrollbars(bool horizontalScrollbar, bool verticalScrollbar) { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextSetScrollbars(this._rtoHandle, horizontalScrollbar, verticalScrollbar)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextSetScrollbars(_rtoHandle, horizontalScrollbar, verticalScrollbar)); } public bool ForwardKeyStateNotification( @@ -252,10 +252,10 @@ namespace Microsoft.Iris.Drawing ushort flags) { bool handled = true; - lock (this._lock) + lock (_lock) { - if (!this._inImeCompositionMode) - RendererApi.IFC(NativeApi.SpRichTextForwardKeyState(this._rtoHandle, message, virtualKey, scanCode, repeatCount, modifierState, flags, out handled)); + if (!_inImeCompositionMode) + RendererApi.IFC(NativeApi.SpRichTextForwardKeyState(_rtoHandle, message, virtualKey, scanCode, repeatCount, modifierState, flags, out handled)); } return handled; } @@ -269,10 +269,10 @@ namespace Microsoft.Iris.Drawing ushort flags) { bool handled = true; - lock (this._lock) + lock (_lock) { - if (!this._inImeCompositionMode) - RendererApi.IFC(NativeApi.SpRichTextForwardKeyCharacter(this._rtoHandle, message, character, scanCode, repeatCount, modifierState, flags, out handled)); + if (!_inImeCompositionMode) + RendererApi.IFC(NativeApi.SpRichTextForwardKeyCharacter(_rtoHandle, message, character, scanCode, repeatCount, modifierState, flags, out handled)); } return handled; } @@ -286,28 +286,28 @@ namespace Microsoft.Iris.Drawing int mouseWheelDelta) { bool handled = true; - lock (this._lock) + lock (_lock) { - if (!this._inImeCompositionMode) - RendererApi.IFC(NativeApi.SpRichTextForwardMouseInput(this._rtoHandle, message, modifierState, mouseButton, x, y, mouseWheelDelta, out handled)); + if (!_inImeCompositionMode) + RendererApi.IFC(NativeApi.SpRichTextForwardMouseInput(_rtoHandle, message, modifierState, mouseButton, x, y, mouseWheelDelta, out handled)); } return handled; } public HRESULT ForwardImeMessage(uint message, UIntPtr wParam, UIntPtr lParam) { - lock (this._lock) + lock (_lock) { switch (message) { case 269: - this._inImeCompositionMode = true; + _inImeCompositionMode = true; break; case 270: - this._inImeCompositionMode = false; + _inImeCompositionMode = false; break; } - RendererApi.IFC(NativeApi.SpRichTextForwardImeMessage(this._rtoHandle, message, wParam, lParam)); + RendererApi.IFC(NativeApi.SpRichTextForwardImeMessage(_rtoHandle, message, wParam, lParam)); } return new HRESULT(0); } @@ -317,40 +317,40 @@ namespace Microsoft.Iris.Drawing get { bool canUndo; - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextCanUndo(this._rtoHandle, out canUndo)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextCanUndo(_rtoHandle, out canUndo)); return canUndo; } } public void Undo() { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextUndo(this._rtoHandle)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextUndo(_rtoHandle)); } public void Cut() { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextCut(this._rtoHandle)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextCut(_rtoHandle)); } public void Copy() { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextCopy(this._rtoHandle)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextCopy(_rtoHandle)); } public void Paste() { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextPaste(this._rtoHandle)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextPaste(_rtoHandle)); } public void Delete() { - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextDelete(this._rtoHandle)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextDelete(_rtoHandle)); } public static LineAlignment ReverseAlignment( @@ -387,32 +387,32 @@ namespace Microsoft.Iris.Drawing public void SetTimer(uint id, uint timeout) { - DispatcherTimer dispatcherTimer = this.FindTimer(id); + DispatcherTimer dispatcherTimer = FindTimer(id); if (dispatcherTimer == null) { dispatcherTimer = new DispatcherTimer(); - this._timers.Add(dispatcherTimer); + _timers.Add(dispatcherTimer); } dispatcherTimer.UserData = id; dispatcherTimer.Interval = (int)timeout; - dispatcherTimer.Tick += this._timerTickHandler; + dispatcherTimer.Tick += _timerTickHandler; dispatcherTimer.Start(); } public void KillTimer(uint id) { - DispatcherTimer timer = this.FindTimer(id); + DispatcherTimer timer = FindTimer(id); if (timer == null) return; - this.DisposeTimer(timer); - this._timers.Remove(timer); + DisposeTimer(timer); + _timers.Remove(timer); } private DispatcherTimer FindTimer(uint id) { - for (int index = 0; index < this._timers.Count; ++index) + for (int index = 0; index < _timers.Count; ++index) { - DispatcherTimer timer = (DispatcherTimer)this._timers[index]; + DispatcherTimer timer = (DispatcherTimer)_timers[index]; if ((int)(uint)timer.UserData == (int)id) return timer; } @@ -421,15 +421,15 @@ namespace Microsoft.Iris.Drawing private void DisposeTimer(DispatcherTimer timer) { - timer.Tick -= this._timerTickHandler; + timer.Tick -= _timerTickHandler; timer.Stop(); } private void OnTimerTick(object sender, EventArgs ea) { DispatcherTimer dispatcherTimer = (DispatcherTimer)sender; - lock (this._lock) - RendererApi.IFC(NativeApi.SpRichTextOnTimerTick(this._rtoHandle, (uint)dispatcherTimer.UserData)); + lock (_lock) + RendererApi.IFC(NativeApi.SpRichTextOnTimerTick(_rtoHandle, (uint)dispatcherTimer.UserData)); } private unsafe HRESULT OnReportRun( @@ -440,20 +440,20 @@ namespace Microsoft.Iris.Drawing IntPtr dataPtr) { bool flag = false; - if (this._currentlyMeasuringText != null && _currentlyMeasuringText.Length == nChars) + if (_currentlyMeasuringText != null && _currentlyMeasuringText.Length == nChars) { flag = true; char* pointer = (char*)lpString.ToPointer(); for (int index = 0; index < nChars; ++index) { - if (this._currentlyMeasuringText[index] != pointer[index]) + if (_currentlyMeasuringText[index] != pointer[index]) { flag = false; break; } } } - string content = flag ? this._currentlyMeasuringText : Marshal.PtrToStringUni(lpString, (int)nChars); + string content = flag ? _currentlyMeasuringText : Marshal.PtrToStringUni(lpString, (int)nChars); TextRun run = TextRun.FromRunPacket(hGlyphRunInfo, runPacketPtr, content); if (run != null) ((TextFlow)GCHandle.FromIntPtr(dataPtr).Target).Add(run); diff --git a/UIX/Microsoft/Iris/Drawing/RichTextInfoKey.cs b/UIX/Microsoft/Iris/Drawing/RichTextInfoKey.cs index 16bfdc4..9d18027 100644 --- a/UIX/Microsoft/Iris/Drawing/RichTextInfoKey.cs +++ b/UIX/Microsoft/Iris/Drawing/RichTextInfoKey.cs @@ -34,46 +34,46 @@ namespace Microsoft.Iris.Drawing public RichTextInfoKey(TextRun run, string samplingMode, bool outline, Color textColor) : base(run.Content) { - this._samplingMode = samplingMode; - this._content = run.Content; - this._srcSizeF = run.RenderBounds.Size; - this._naturalSize = run.NaturalExtent; - this._rasterizedOffset = run.RasterizedOffset; - this._fontFaceUniqueId = run.FontFaceUniqueId; - this._fontSize = run.FontSize; - this._fontWeight = run.FontWeight; - this._rasterizerConfig = run.RasterizerConfig; - this._textColor = textColor; - this._flags = 0; + _samplingMode = samplingMode; + _content = run.Content; + _srcSizeF = run.RenderBounds.Size; + _naturalSize = run.NaturalExtent; + _rasterizedOffset = run.RasterizedOffset; + _fontFaceUniqueId = run.FontFaceUniqueId; + _fontSize = run.FontSize; + _fontWeight = run.FontWeight; + _rasterizerConfig = run.RasterizerConfig; + _textColor = textColor; + _flags = 0; if (run.Italic) - this._flags |= 1; + _flags |= 1; if (outline) - this._flags |= 4; + _flags |= 4; switch (run.UnderlineStyle) { case NativeApi.UnderlineStyle.Solid: - this._flags |= 2; + _flags |= 2; break; case NativeApi.UnderlineStyle.Thick: - this._flags |= 8; + _flags |= 8; break; case NativeApi.UnderlineStyle.Dotted: case NativeApi.UnderlineStyle.Dash: case NativeApi.UnderlineStyle.DashDot: case NativeApi.UnderlineStyle.DashDotDot: - this._flags |= 16; + _flags |= 16; break; } - this._hashCode = this._samplingMode.GetHashCode() ^ this._content.GetHashCode() ^ this._srcSizeF.GetHashCode() ^ this._naturalSize.GetHashCode() ^ this._rasterizedOffset.GetHashCode() ^ this._fontFaceUniqueId.GetHashCode() ^ this._fontSize ^ this._fontWeight ^ this._flags ^ _rasterizerConfig ^ this._textColor.GetHashCode(); + _hashCode = _samplingMode.GetHashCode() ^ _content.GetHashCode() ^ _srcSizeF.GetHashCode() ^ _naturalSize.GetHashCode() ^ _rasterizedOffset.GetHashCode() ^ _fontFaceUniqueId.GetHashCode() ^ _fontSize ^ _fontWeight ^ _flags ^ _rasterizerConfig ^ _textColor.GetHashCode(); } public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) return true; - return obj is RichTextInfoKey richTextInfoKey && this._hashCode == richTextInfoKey._hashCode && (this._fontFaceUniqueId == richTextInfoKey._fontFaceUniqueId && this._fontSize == richTextInfoKey._fontSize) && (this._fontWeight == richTextInfoKey._fontWeight && this._flags == richTextInfoKey._flags && (_rasterizerConfig == richTextInfoKey._rasterizerConfig && this._samplingMode.Equals(richTextInfoKey._samplingMode))) && (this._srcSizeF.Equals(richTextInfoKey._srcSizeF) && this._naturalSize.Equals(richTextInfoKey._naturalSize) && (this._rasterizedOffset.Equals(richTextInfoKey._rasterizedOffset) && this._textColor.Equals(richTextInfoKey._textColor))) && this._content.Equals(richTextInfoKey._content); + return obj is RichTextInfoKey richTextInfoKey && _hashCode == richTextInfoKey._hashCode && (_fontFaceUniqueId == richTextInfoKey._fontFaceUniqueId && _fontSize == richTextInfoKey._fontSize) && (_fontWeight == richTextInfoKey._fontWeight && _flags == richTextInfoKey._flags && (_rasterizerConfig == richTextInfoKey._rasterizerConfig && _samplingMode.Equals(richTextInfoKey._samplingMode))) && (_srcSizeF.Equals(richTextInfoKey._srcSizeF) && _naturalSize.Equals(richTextInfoKey._naturalSize) && (_rasterizedOffset.Equals(richTextInfoKey._rasterizedOffset) && _textColor.Equals(richTextInfoKey._textColor))) && _content.Equals(richTextInfoKey._content); } - public override int GetHashCode() => this._hashCode; + public override int GetHashCode() => _hashCode; } } diff --git a/UIX/Microsoft/Iris/Drawing/Rotation.cs b/UIX/Microsoft/Iris/Drawing/Rotation.cs index 0a81cd4..3a628f4 100644 --- a/UIX/Microsoft/Iris/Drawing/Rotation.cs +++ b/UIX/Microsoft/Iris/Drawing/Rotation.cs @@ -22,26 +22,26 @@ namespace Microsoft.Iris.Drawing public Rotation(float angleRadians, Vector3 axis) { - this._axis = axis; - this._angleRad = angleRadians; + _axis = axis; + _angleRad = angleRadians; } public Vector3 Axis { - get => this._axis; - set => this._axis = value; + get => _axis; + set => _axis = value; } public float AngleRadians { - get => this._angleRad; - set => this._angleRad = value; + get => _angleRad; + set => _angleRad = value; } public int AngleDegrees { get => (int)(_angleRad * 180.0 / 3.14159274101257); - set => this._angleRad = (float)(value * 3.14159274101257 / 180.0); + set => _angleRad = (float)(value * 3.14159274101257 / 180.0); } public override bool Equals(object obj) => obj is Rotation rotation && this == rotation; @@ -50,7 +50,7 @@ namespace Microsoft.Iris.Drawing public static bool operator !=(Rotation left, Rotation right) => left.Axis != right.Axis || left.AngleRadians != (double)right.AngleRadians; - public override int GetHashCode() => this.Axis.GetHashCode() ^ this.AngleRadians.GetHashCode(); + public override int GetHashCode() => Axis.GetHashCode() ^ AngleRadians.GetHashCode(); public override string ToString() { @@ -58,7 +58,7 @@ namespace Microsoft.Iris.Drawing stringBuilder.Append("(Axis="); stringBuilder.Append(Axis); stringBuilder.Append(", Angle="); - stringBuilder.Append(this.AngleRadians); + stringBuilder.Append(AngleRadians); stringBuilder.Append(")"); return stringBuilder.ToString(); } diff --git a/UIX/Microsoft/Iris/Drawing/ScavengeImageCache.cs b/UIX/Microsoft/Iris/Drawing/ScavengeImageCache.cs index d4e52e1..0a46bf1 100644 --- a/UIX/Microsoft/Iris/Drawing/ScavengeImageCache.cs +++ b/UIX/Microsoft/Iris/Drawing/ScavengeImageCache.cs @@ -36,21 +36,21 @@ namespace Microsoft.Iris.Drawing private ScavengeImageCache(UISession session) : base(session.RenderSession, "GraphicImageCache") - => this._session = session; + => _session = session; protected override void OnDispose() { - TimeoutManager timeoutManager = this._session.Dispatcher.TimeoutManager; - ScavengeImageCache.ScavengeCallback callback = this._callback; + TimeoutManager timeoutManager = _session.Dispatcher.TimeoutManager; + ScavengeImageCache.ScavengeCallback callback = _callback; if (callback != null) timeoutManager.CancelTimeout(callback); - this._callback = null; + _callback = null; base.OnDispose(); } protected override void ScheduleScavenge() { - if (!this.CleanupPending) + if (!CleanupPending) DeferredCall.Post(DispatchPriority.Idle, s_dhReschedule, this); base.ScheduleScavenge(); } @@ -74,14 +74,14 @@ namespace Microsoft.Iris.Drawing { private ScavengeImageCache _cache; - public ScavengeCallback(ScavengeImageCache cache) => this._cache = cache; + public ScavengeCallback(ScavengeImageCache cache) => _cache = cache; public override void Dispatch() { - if (this._cache._callback != this) + if (_cache._callback != this) return; - this._cache._callback = null; - this._cache.CullObjects(); + _cache._callback = null; + _cache.CullObjects(); } } } diff --git a/UIX/Microsoft/Iris/Drawing/SimpleText.cs b/UIX/Microsoft/Iris/Drawing/SimpleText.cs index 0daae10..120f425 100644 --- a/UIX/Microsoft/Iris/Drawing/SimpleText.cs +++ b/UIX/Microsoft/Iris/Drawing/SimpleText.cs @@ -22,14 +22,14 @@ namespace Microsoft.Iris.Drawing Size sizeMaximumSurface = Size.Zero; if (UISession.Default != null) sizeMaximumSurface = UIImage.MaximumSurfaceSize(UISession.Default); - RendererApi.IFC(NativeApi.SpSimpleTextBuildObject(sizeMaximumSurface, out this._stoHandle)); + RendererApi.IFC(NativeApi.SpSimpleTextBuildObject(sizeMaximumSurface, out _stoHandle)); } public void Dispose() { GC.SuppressFinalize(this); - NativeApi.SpSimpleTextDestroyObject(this._stoHandle); - this._stoHandle = Win32Api.HANDLE.NULL; + NativeApi.SpSimpleTextDestroyObject(_stoHandle); + _stoHandle = Win32Api.HANDLE.NULL; } public unsafe bool CanMeasure(string content, TextStyle textStyle) @@ -41,7 +41,7 @@ namespace Microsoft.Iris.Drawing { _fontFace = chPtr }; - RendererApi.IFC(NativeApi.SpSimpleTextMeasurePossible(this._stoHandle, content, &style, out fPossible)); + RendererApi.IFC(NativeApi.SpSimpleTextMeasurePossible(_stoHandle, content, &style, out fPossible)); } return fPossible; } @@ -76,7 +76,7 @@ namespace Microsoft.Iris.Drawing { _fontFace = chPtr }; - RendererApi.IFC(NativeApi.SpSimpleTextMeasure(this._stoHandle, content, wAlignment, + RendererApi.IFC(NativeApi.SpSimpleTextMeasure(_stoHandle, content, wAlignment, &style, constraint, out hGlyphRunInfo, &rasterizeRunPacket)); } TextRun run = TextRun.FromRunPacket(hGlyphRunInfo, &rasterizeRunPacket, content); diff --git a/UIX/Microsoft/Iris/Drawing/TextFlow.cs b/UIX/Microsoft/Iris/Drawing/TextFlow.cs index bebdfee..cf9417c 100644 --- a/UIX/Microsoft/Iris/Drawing/TextFlow.cs +++ b/UIX/Microsoft/Iris/Drawing/TextFlow.cs @@ -24,49 +24,49 @@ namespace Microsoft.Iris.Drawing internal TextFlow() { - this._bounds = new Rectangle(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue); - this.ResetFitTracking(); - this.ResetVisibleTracking(); + _bounds = new Rectangle(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue); + ResetFitTracking(); + ResetVisibleTracking(); } protected override void OnDispose() { - if (this._runsList != null) + if (_runsList != null) { - if (this._runsList is TextRun runsList) + if (_runsList is TextRun runsList) { runsList.UnregisterUsage(this); } else { - foreach (SharedDisposableObject runs in (Vector)this._runsList) + foreach (SharedDisposableObject runs in (Vector)_runsList) runs.UnregisterUsage(this); } } base.OnDispose(); } - public TextRun this[int index] => this._runsList is TextRun runsList ? runsList : (TextRun)((Vector)this._runsList)[index]; + public TextRun this[int index] => _runsList is TextRun runsList ? runsList : (TextRun)((Vector)_runsList)[index]; public int Count { get { - if (this._runsList is Vector runsList) + if (_runsList is Vector runsList) return runsList.Count; - return this._runsList == null ? 0 : 1; + return _runsList == null ? 0 : 1; } } - public Vector LineBounds => this._lineBounds; + public Vector LineBounds => _lineBounds; internal Rectangle GetLastLineBounds(int lineAlignmentOffset) { Rectangle left = Rectangle.Zero; - for (int index = this.Count - 1; index >= 0; --index) + for (int index = Count - 1; index >= 0; --index) { TextRun run = this[index]; - if (this.IsOnLastLine(run)) + if (IsOnLastLine(run)) { Point position = run.Position; Size size = run.Size; @@ -83,39 +83,39 @@ namespace Microsoft.Iris.Drawing return left; } - internal bool IsOnLastLine(TextRun run) => run.Line == this.LastFitRun.Line; + internal bool IsOnLastLine(TextRun run) => run.Line == LastFitRun.Line; - public Rectangle Bounds => this._bounds; + public Rectangle Bounds => _bounds; - public Rectangle FitBounds => this._fitBounds; + public Rectangle FitBounds => _fitBounds; - public TextRun LastFitRun => this._lastFitRun; + public TextRun LastFitRun => _lastFitRun; - public TextRun FirstFitRunOnFinalLine => this._firstFitOnFinalLineRun; + public TextRun FirstFitRunOnFinalLine => _firstFitOnFinalLineRun; - public int FirstVisibleIndex => this._firstVisibleIndex; + public int FirstVisibleIndex => _firstVisibleIndex; - public int LastVisibleIndex => this._lastVisibleIndex; + public int LastVisibleIndex => _lastVisibleIndex; - public bool HasVisibleRuns => this._firstVisibleIndex != -1; + public bool HasVisibleRuns => _firstVisibleIndex != -1; public void Add(TextRun run) { - this._bounds = Rectangle.Union(this._bounds, run.LayoutBounds); - if (this._runsList == null) + _bounds = Rectangle.Union(_bounds, run.LayoutBounds); + if (_runsList == null) { - this._runsList = run; - this._lineBounds = new Vector(); - this._lineBounds.Add(run.RenderBounds); + _runsList = run; + _lineBounds = new Vector(); + _lineBounds.Add(run.RenderBounds); } else { - if (!(this._runsList is Vector vector)) + if (!(_runsList is Vector vector)) { - object runsList = this._runsList; + object runsList = _runsList; vector = new Vector(); vector.Add(runsList); - this._runsList = vector; + _runsList = vector; } if (run.UnderlineStyle != NativeApi.UnderlineStyle.None) { @@ -131,15 +131,15 @@ namespace Microsoft.Iris.Drawing break; } } - if (this._lineBounds.Count < run.Line) + if (_lineBounds.Count < run.Line) { - this._lineBounds.Add(run.RenderBounds); + _lineBounds.Add(run.RenderBounds); } else { - RectangleF lineBound = (RectangleF)this._lineBounds[run.Line - 1]; + RectangleF lineBound = (RectangleF)_lineBounds[run.Line - 1]; if ((int)lineBound.Y > (int)run.RenderBounds.Y || lineBound.IsEmpty) - this._lineBounds[run.Line - 1] = run.RenderBounds; + _lineBounds[run.Line - 1] = run.RenderBounds; } vector.Add(run); } @@ -148,46 +148,46 @@ namespace Microsoft.Iris.Drawing public void AddFit(TextRun run) { - this._fitBounds = Rectangle.Union(this._fitBounds, run.LayoutBounds); + _fitBounds = Rectangle.Union(_fitBounds, run.LayoutBounds); if (run.LayoutBounds.IsEmpty) return; - if (this._firstFitOnFinalLineRun == null || run.Line > this._firstFitOnFinalLineRun.Line) - this._firstFitOnFinalLineRun = run; - this._lastFitRun = run; + if (_firstFitOnFinalLineRun == null || run.Line > _firstFitOnFinalLineRun.Line) + _firstFitOnFinalLineRun = run; + _lastFitRun = run; } public void AddVisible(int runIndex) { this[runIndex].Visible = true; - if (this._firstVisibleIndex == -1) - this._firstVisibleIndex = runIndex; - this._lastVisibleIndex = runIndex; + if (_firstVisibleIndex == -1) + _firstVisibleIndex = runIndex; + _lastVisibleIndex = runIndex; } public void ResetFitTracking() { - this._lastFitRun = null; - this._fitBounds = new Rectangle(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue); + _lastFitRun = null; + _fitBounds = new Rectangle(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue); } public void ResetVisibleTracking() { - this._firstVisibleIndex = -1; - this._lastVisibleIndex = int.MinValue; + _firstVisibleIndex = -1; + _lastVisibleIndex = int.MinValue; } public void ClearSprites() { - if (this._runsList == null) + if (_runsList == null) return; - if (this._runsList is TextRun runsList) + if (_runsList is TextRun runsList) { runsList.TextSprite = null; runsList.HighlightSprite = null; } else { - foreach (TextRun runs in (Vector)this._runsList) + foreach (TextRun runs in (Vector)_runsList) { runs.TextSprite = null; runs.HighlightSprite = null; diff --git a/UIX/Microsoft/Iris/Drawing/TextImageCache.cs b/UIX/Microsoft/Iris/Drawing/TextImageCache.cs index 0b51b8d..a6f8b65 100644 --- a/UIX/Microsoft/Iris/Drawing/TextImageCache.cs +++ b/UIX/Microsoft/Iris/Drawing/TextImageCache.cs @@ -36,21 +36,21 @@ namespace Microsoft.Iris.Drawing private TextImageCache(UISession session) : base(session.RenderSession, nameof(TextImageCache)) - => this._session = session; + => _session = session; protected override void OnDispose() { - TimeoutManager timeoutManager = this._session.Dispatcher.TimeoutManager; - TextImageCache.ScavengeCallback callback = this._callback; + TimeoutManager timeoutManager = _session.Dispatcher.TimeoutManager; + TextImageCache.ScavengeCallback callback = _callback; if (callback != null) timeoutManager.CancelTimeout(callback); - this._callback = null; + _callback = null; base.OnDispose(); } protected override void ScheduleScavenge() { - if (!this.CleanupPending) + if (!CleanupPending) DeferredCall.Post(DispatchPriority.Idle, s_dhReschedule, this); base.ScheduleScavenge(); } @@ -74,14 +74,14 @@ namespace Microsoft.Iris.Drawing { private TextImageCache _cache; - public ScavengeCallback(TextImageCache cache) => this._cache = cache; + public ScavengeCallback(TextImageCache cache) => _cache = cache; public override void Dispatch() { - if (this._cache._callback != this) + if (_cache._callback != this) return; - this._cache._callback = null; - this._cache.CullObjects(); + _cache._callback = null; + _cache.CullObjects(); } } } diff --git a/UIX/Microsoft/Iris/Drawing/TextImageItem.cs b/UIX/Microsoft/Iris/Drawing/TextImageItem.cs index 8471887..8595e56 100644 --- a/UIX/Microsoft/Iris/Drawing/TextImageItem.cs +++ b/UIX/Microsoft/Iris/Drawing/TextImageItem.cs @@ -26,47 +26,47 @@ namespace Microsoft.Iris.Drawing Color textColor) : base(renderSession, run.Content) { - this._run = run; - this._run.RegisterUsage(this); - this._dib = null; - this._samplingModeName = samplingModeName; - this._outlineFlag = outlineFlag; - this._textColor = textColor; + _run = run; + _run.RegisterUsage(this); + _dib = null; + _samplingModeName = samplingModeName; + _outlineFlag = outlineFlag; + _textColor = textColor; } protected override void OnDispose() { - this._run.UnregisterUsage(this); - this.ReleaseDib(); + _run.UnregisterUsage(this); + ReleaseDib(); base.OnDispose(); } - internal TextRun Run => this._run; + internal TextRun Run => _run; protected override bool EnsureBuffer() { - if (this._dib == null) - this._dib = this._run.Rasterize(this._samplingModeName, this._textColor, this._outlineFlag); + if (_dib == null) + _dib = _run.Rasterize(_samplingModeName, _textColor, _outlineFlag); return true; } - protected override bool DoImageLoad() => this.RenderImage.LoadContent(this._dib.ImageFormat, this._dib.ContentSize, this._dib.Stride, this._dib.Data); + protected override bool DoImageLoad() => RenderImage.LoadContent(_dib.ImageFormat, _dib.ContentSize, _dib.Stride, _dib.Data); protected override void OnImageLoadComplete() { - if (this.HasLoadsInProgress) + if (HasLoadsInProgress) return; - this.ReleaseDib(); + ReleaseDib(); } - public override string ToString() => this._run.Content; + public override string ToString() => _run.Content; private void ReleaseDib() { - if (this._dib == null) + if (_dib == null) return; - this._dib.Dispose(); - this._dib = null; + _dib.Dispose(); + _dib = null; } } } diff --git a/UIX/Microsoft/Iris/Drawing/TextMeasureParams.cs b/UIX/Microsoft/Iris/Drawing/TextMeasureParams.cs index dc71b22..62906ed 100644 --- a/UIX/Microsoft/Iris/Drawing/TextMeasureParams.cs +++ b/UIX/Microsoft/Iris/Drawing/TextMeasureParams.cs @@ -24,25 +24,25 @@ namespace Microsoft.Iris.Drawing { if (!UISession.Default.IsRtl) return; - this._data._flags |= MeasureFlags.IsRtl; + _data._flags |= MeasureFlags.IsRtl; } public void Dispose() { - if (this._formattedRangeStyleFontFaces == null) + if (_formattedRangeStyleFontFaces == null) return; - foreach (GCHandle rangeStyleFontFace in this._formattedRangeStyleFontFaces) + foreach (GCHandle rangeStyleFontFace in _formattedRangeStyleFontFaces) { if (rangeStyleFontFace.IsAllocated) rangeStyleFontFace.Free(); } - this._formattedRangeStyleFontFaces = null; + _formattedRangeStyleFontFaces = null; } public unsafe void SetContent(char* content) { - this._data._flags |= MeasureFlags.Content; - this._data._content = content; + _data._flags |= MeasureFlags.Content; + _data._content = content; } public void SetFormat(LineAlignment lineAlignment, TextStyle style) @@ -50,67 +50,67 @@ namespace Microsoft.Iris.Drawing switch (lineAlignment) { case LineAlignment.Near: - this._data._alignment = 1; + _data._alignment = 1; break; case LineAlignment.Center: - this._data._alignment = 3; + _data._alignment = 3; break; case LineAlignment.Far: - this._data._alignment = 2; + _data._alignment = 2; break; } - this._textStyle = style; + _textStyle = style; } - public void TrimLeftSideBearing() => this._data._flags |= MeasureFlags.TrimLeftSideBearing; + public void TrimLeftSideBearing() => _data._flags |= MeasureFlags.TrimLeftSideBearing; public void SetEditMode(bool inEditMode) { if (inEditMode) - this._data._flags |= MeasureFlags.FormatOnly; + _data._flags |= MeasureFlags.FormatOnly; else - this._data._flags &= ~MeasureFlags.FormatOnly; + _data._flags &= ~MeasureFlags.FormatOnly; } - public void SetScale(float scale) => this._data._scale = scale; + public void SetScale(float scale) => _data._scale = scale; public void SetWordWrap(bool wordWrap) { - this._data._flags |= MeasureFlags.WordWrap; + _data._flags |= MeasureFlags.WordWrap; if (wordWrap) - this._data._flags |= MeasureFlags.WordWrapValue; + _data._flags |= MeasureFlags.WordWrapValue; else - this._data._flags &= ~MeasureFlags.WordWrapValue; + _data._flags &= ~MeasureFlags.WordWrapValue; } public void SetPasswordChar(char passwordChar) { - this._data._flags |= MeasureFlags.PasswordMasked; - this._data._passwordChar = passwordChar; + _data._flags |= MeasureFlags.PasswordMasked; + _data._passwordChar = passwordChar; } - public void SetConstraint(SizeF constraint) => this._data._constraint = constraint; + public void SetConstraint(SizeF constraint) => _data._constraint = constraint; public void AllocateFormattedRanges(int formattedRangeCount, int formattedRangeStylesCount) { - this._formattedRanges = new TextMeasureParams.FormattedRange[formattedRangeCount]; - this._formattedRangeStyles = new TextStyle.MarshalledData[formattedRangeStylesCount]; - this._formattedRangeStyleFontFaces = new GCHandle[formattedRangeStylesCount]; - this._data._formattedRangeCount = formattedRangeCount; - this._data._formattedRangeStylesCount = formattedRangeStylesCount; + _formattedRanges = new TextMeasureParams.FormattedRange[formattedRangeCount]; + _formattedRangeStyles = new TextStyle.MarshalledData[formattedRangeStylesCount]; + _formattedRangeStyleFontFaces = new GCHandle[formattedRangeStylesCount]; + _data._formattedRangeCount = formattedRangeCount; + _data._formattedRangeStylesCount = formattedRangeStylesCount; } - public TextMeasureParams.FormattedRange[] FormattedRanges => this._formattedRanges; + public TextMeasureParams.FormattedRange[] FormattedRanges => _formattedRanges; public unsafe void SetFormattedRangeStyle(int index, TextStyle style) { - this._formattedRangeStyles[index] = new TextStyle.MarshalledData(style); + _formattedRangeStyles[index] = new TextStyle.MarshalledData(style); string fontFace = style.FontFace; if (fontFace == null) return; GCHandle gcHandle = GCHandle.Alloc(fontFace, GCHandleType.Pinned); - this._formattedRangeStyles[index]._fontFace = (char*)gcHandle.AddrOfPinnedObject().ToPointer(); - this._formattedRangeStyleFontFaces[index] = gcHandle; + _formattedRangeStyles[index]._fontFace = (char*)gcHandle.AddrOfPinnedObject().ToPointer(); + _formattedRangeStyleFontFaces[index] = gcHandle; } internal struct MarshalledData diff --git a/UIX/Microsoft/Iris/Drawing/TextRun.cs b/UIX/Microsoft/Iris/Drawing/TextRun.cs index 358a0e9..d4c5a72 100644 --- a/UIX/Microsoft/Iris/Drawing/TextRun.cs +++ b/UIX/Microsoft/Iris/Drawing/TextRun.cs @@ -46,124 +46,124 @@ namespace Microsoft.Iris.Drawing NativeApi.RasterizeRunPacket* runPacketPtr, string content) { - this._hGlyphRunInfo = hGlyphRunInfo; - this._hRasterizeRunPacket = new IntPtr(runPacketPtr); - this._layoutBounds = runPacketPtr->rcLayoutBounds; - this._renderBounds = runPacketPtr->rcfRenderBounds; - this._naturalX = runPacketPtr->naturalX; - this._naturalY = runPacketPtr->naturalY; - this._rasterizeX = runPacketPtr->rasterizeX; - this._rasterizeY = runPacketPtr->rasterizeY; - this._rasterizerConfig = runPacketPtr->AAConfig; - this._runColor = runPacketPtr->clrText; - this._overrideColor = Color.Transparent; - this._highlightColor = runPacketPtr->clrBackground; - this._fontFaceUniqueId = runPacketPtr->fontFaceUniqueId; - this._lfHeight = runPacketPtr->lf.lfHeight; - this._lfWeight = runPacketPtr->lf.lfWeight; - this.SetBit(Bits.Italic, runPacketPtr->lf.lfItalic != 0); - this.SetBit(Bits.Underline, runPacketPtr->lf.lfUnderline != 0); - this.SetBit(Bits.Link, (runPacketPtr->dwEffects & 32) != 0); - this._underlineBounds = runPacketPtr->rcUnderlineBounds; - this._lineNumber = runPacketPtr->nLineNumber; - this._naturalRunExtent = runPacketPtr->sizeNatural; - this._ascenderInset = runPacketPtr->ascenderInset; - this._baselineInset = runPacketPtr->baselineInset; - this._content = content; + _hGlyphRunInfo = hGlyphRunInfo; + _hRasterizeRunPacket = new IntPtr(runPacketPtr); + _layoutBounds = runPacketPtr->rcLayoutBounds; + _renderBounds = runPacketPtr->rcfRenderBounds; + _naturalX = runPacketPtr->naturalX; + _naturalY = runPacketPtr->naturalY; + _rasterizeX = runPacketPtr->rasterizeX; + _rasterizeY = runPacketPtr->rasterizeY; + _rasterizerConfig = runPacketPtr->AAConfig; + _runColor = runPacketPtr->clrText; + _overrideColor = Color.Transparent; + _highlightColor = runPacketPtr->clrBackground; + _fontFaceUniqueId = runPacketPtr->fontFaceUniqueId; + _lfHeight = runPacketPtr->lf.lfHeight; + _lfWeight = runPacketPtr->lf.lfWeight; + SetBit(Bits.Italic, runPacketPtr->lf.lfItalic != 0); + SetBit(Bits.Underline, runPacketPtr->lf.lfUnderline != 0); + SetBit(Bits.Link, (runPacketPtr->dwEffects & 32) != 0); + _underlineBounds = runPacketPtr->rcUnderlineBounds; + _lineNumber = runPacketPtr->nLineNumber; + _naturalRunExtent = runPacketPtr->sizeNatural; + _ascenderInset = runPacketPtr->ascenderInset; + _baselineInset = runPacketPtr->baselineInset; + _content = content; } protected override void OnDispose() { - NativeApi.SpRichTextDestroyGlyphRunInfo(this._hGlyphRunInfo); + NativeApi.SpRichTextDestroyGlyphRunInfo(_hGlyphRunInfo); base.OnDispose(); } - public string Content => this._content; + public string Content => _content; - public RectangleF RenderBounds => this._renderBounds; + public RectangleF RenderBounds => _renderBounds; - public Rectangle LayoutBounds => this._layoutBounds; + public Rectangle LayoutBounds => _layoutBounds; - public Size NaturalExtent => this._naturalRunExtent; + public Size NaturalExtent => _naturalRunExtent; - public Color RunColor => this._runColor; + public Color RunColor => _runColor; public Color OverrideColor { - get => this._overrideColor; - set => this._overrideColor = value; + get => _overrideColor; + set => _overrideColor = value; } - public Color Color => this._overrideColor != Color.Transparent ? this._overrideColor : this._runColor; + public Color Color => _overrideColor != Color.Transparent ? _overrideColor : _runColor; - public bool Highlighted => this._highlightColor.A != 0; + public bool Highlighted => _highlightColor.A != 0; - public Color HighlightColor => this._highlightColor; + public Color HighlightColor => _highlightColor; - public int FontFaceUniqueId => this._fontFaceUniqueId; + public int FontFaceUniqueId => _fontFaceUniqueId; - public int FontSize => this._lfHeight; + public int FontSize => _lfHeight; - public int FontWeight => this._lfWeight; + public int FontWeight => _lfWeight; - public bool Italic => this.GetBit(Bits.Italic); + public bool Italic => GetBit(Bits.Italic); - public bool Underline => this.GetBit(Bits.Underline); + public bool Underline => GetBit(Bits.Underline); - public Point RasterizedOffset => new Point(this._rasterizeX - this._naturalX, this._rasterizeY - this._naturalY); + public Point RasterizedOffset => new Point(_rasterizeX - _naturalX, _rasterizeY - _naturalY); - public int AscenderInset => this._ascenderInset; + public int AscenderInset => _ascenderInset; - public int BaselineInset => this._baselineInset; + public int BaselineInset => _baselineInset; - public int Line => this._lineNumber; + public int Line => _lineNumber; public bool Visible { - get => this.GetBit(Bits.Visible); - set => this.SetBit(Bits.Visible, value); + get => GetBit(Bits.Visible); + set => SetBit(Bits.Visible, value); } public bool IsFragment { - get => this.GetBit(Bits.Fragment); - set => this.SetBit(Bits.Fragment, value); + get => GetBit(Bits.Fragment); + set => SetBit(Bits.Fragment, value); } - public Point Position => new Point(this._layoutBounds.X, this._layoutBounds.Y); + public Point Position => new Point(_layoutBounds.X, _layoutBounds.Y); - public Size Size => new Size(this._layoutBounds.Width, this._layoutBounds.Height); + public Size Size => new Size(_layoutBounds.Width, _layoutBounds.Height); - public byte RasterizerConfig => this._rasterizerConfig; + public byte RasterizerConfig => _rasterizerConfig; - public bool Link => this.GetBit(Bits.Link); + public bool Link => GetBit(Bits.Link); public unsafe NativeApi.UnderlineStyle UnderlineStyle { - get => this._hRasterizeRunPacket == IntPtr.Zero ? NativeApi.UnderlineStyle.None : ((NativeApi.RasterizeRunPacket*)(void*)this._hRasterizeRunPacket)->usUnderlineStyle; + get => _hRasterizeRunPacket == IntPtr.Zero ? NativeApi.UnderlineStyle.None : ((NativeApi.RasterizeRunPacket*)(void*)_hRasterizeRunPacket)->usUnderlineStyle; set { - if (!(this._hRasterizeRunPacket != IntPtr.Zero)) + if (!(_hRasterizeRunPacket != IntPtr.Zero)) return; - ((NativeApi.RasterizeRunPacket*)(void*)this._hRasterizeRunPacket)->usUnderlineStyle = value; + ((NativeApi.RasterizeRunPacket*)(void*)_hRasterizeRunPacket)->usUnderlineStyle = value; } } - public Rectangle UnderlineBounds => this._underlineBounds; + public Rectangle UnderlineBounds => _underlineBounds; internal void ApplyOffset(Point offsetPoint) { - if (!(this._offsetPoint != offsetPoint)) + if (!(_offsetPoint != offsetPoint)) return; - this._renderBounds.X -= _offsetPoint.X; - this._renderBounds.Y -= _offsetPoint.Y; - this._layoutBounds.X -= this._offsetPoint.X; - this._layoutBounds.Y -= this._offsetPoint.Y; - this._renderBounds.X += offsetPoint.X; - this._renderBounds.Y += offsetPoint.Y; - this._layoutBounds.X += offsetPoint.X; - this._layoutBounds.Y += offsetPoint.Y; - this._offsetPoint = offsetPoint; + _renderBounds.X -= _offsetPoint.X; + _renderBounds.Y -= _offsetPoint.Y; + _layoutBounds.X -= _offsetPoint.X; + _layoutBounds.Y -= _offsetPoint.Y; + _renderBounds.X += offsetPoint.X; + _renderBounds.Y += offsetPoint.Y; + _layoutBounds.X += offsetPoint.X; + _layoutBounds.Y += offsetPoint.Y; + _offsetPoint = offsetPoint; } internal Dib Rasterize(string samplingMode, Color textColor, bool outlineFlag) @@ -171,7 +171,7 @@ namespace Microsoft.Iris.Drawing bool shadowMode = false; if (samplingMode == "sdw") shadowMode = true; - return RichText.Rasterize(this._hGlyphRunInfo, outlineFlag, textColor, shadowMode); + return RichText.Rasterize(_hGlyphRunInfo, outlineFlag, textColor, shadowMode); } internal static unsafe TextRun FromRunPacket( @@ -184,20 +184,20 @@ namespace Microsoft.Iris.Drawing public void RemoveSprites(IVisualContainer container) { - if (this.TextSprite != null) + if (TextSprite != null) { container.RemoveChild(TextSprite); - this.TextSprite = null; + TextSprite = null; } - if (this.HighlightSprite == null) + if (HighlightSprite == null) return; container.RemoveChild(HighlightSprite); - this.HighlightSprite = null; + HighlightSprite = null; } - private bool GetBit(TextRun.Bits lookupBit) => ((TextRun.Bits)this._bits & lookupBit) != 0; + private bool GetBit(TextRun.Bits lookupBit) => ((TextRun.Bits)_bits & lookupBit) != 0; - private void SetBit(TextRun.Bits changeBit, bool value) => this._bits = value ? (byte)((TextRun.Bits)this._bits | changeBit) : (byte)((TextRun.Bits)this._bits & ~changeBit); + private void SetBit(TextRun.Bits changeBit, bool value) => _bits = value ? (byte)((TextRun.Bits)_bits | changeBit) : (byte)((TextRun.Bits)_bits & ~changeBit); private enum Bits : byte { diff --git a/UIX/Microsoft/Iris/Drawing/TextStyle.cs b/UIX/Microsoft/Iris/Drawing/TextStyle.cs index 7d7b0f1..f24100b 100644 --- a/UIX/Microsoft/Iris/Drawing/TextStyle.cs +++ b/UIX/Microsoft/Iris/Drawing/TextStyle.cs @@ -21,178 +21,178 @@ namespace Microsoft.Iris.Drawing private Color _textColor; private bool _fragment; - public bool IsInitialized() => this._flags.Data != 0; + public bool IsInitialized() => _flags.Data != 0; public string FontFace { - get => this._fontFace; + get => _fontFace; set { - this._flags[1] = !string.IsNullOrEmpty(value); - this._fontFace = value; + _flags[1] = !string.IsNullOrEmpty(value); + _fontFace = value; } } public float FontSize { - get => this._fontHeightPts; + get => _fontHeightPts; set { - this._flags[2] = true; - this._fontHeightPts = value; + _flags[2] = true; + _fontHeightPts = value; } } public float AltFontSize { - get => _altFontHeightPts == 0.0 ? this._fontHeightPts : this._altFontHeightPts; + get => _altFontHeightPts == 0.0 ? _fontHeightPts : _altFontHeightPts; set { - this._flags[512] = true; - this._altFontHeightPts = value; + _flags[512] = true; + _altFontHeightPts = value; } } public bool Bold { - get => this._flags[65536]; + get => _flags[65536]; set { - this._flags[4] = true; - this._flags[65536] = value; + _flags[4] = true; + _flags[65536] = value; } } public bool Italic { - get => this._flags[131072]; + get => _flags[131072]; set { - this._flags[8] = true; - this._flags[131072] = value; + _flags[8] = true; + _flags[131072] = value; } } public bool Underline { - get => this._flags[262144]; + get => _flags[262144]; set { - this._flags[16] = true; - this._flags[262144] = value; + _flags[16] = true; + _flags[262144] = value; } } public Color Color { - get => this._textColor; + get => _textColor; set { - this._flags[64] = true; - this._textColor = value; + _flags[64] = true; + _textColor = value; } } public float LineSpacing { - get => this._lineSpacing; + get => _lineSpacing; set { - this._flags[32] = true; - this._lineSpacing = value; + _flags[32] = true; + _lineSpacing = value; } } public bool EnableKerning { - get => this._flags[524288]; + get => _flags[524288]; set { - this._flags[128] = true; - this._flags[524288] = value; + _flags[128] = true; + _flags[524288] = value; } } public float CharacterSpacing { - get => this._characterSpacing; + get => _characterSpacing; set { - this._flags[256] = true; - this._characterSpacing = value; + _flags[256] = true; + _characterSpacing = value; } } public bool Fragment { - get => this._fragment; - set => this._fragment = value; + get => _fragment; + set => _fragment = value; } public void Add(TextStyle additional) { - this._fragment = additional._fragment; + _fragment = additional._fragment; if (additional._flags[1]) - this.FontFace = additional.FontFace; + FontFace = additional.FontFace; if (additional._flags[2]) - this.FontSize = additional.FontSize; + FontSize = additional.FontSize; if (additional._flags[512]) - this.AltFontSize = additional._altFontHeightPts; + AltFontSize = additional._altFontHeightPts; if (additional._flags[4]) - this.Bold = additional.Bold; + Bold = additional.Bold; if (additional._flags[8]) - this.Italic = additional.Italic; + Italic = additional.Italic; if (additional._flags[16]) - this.Underline = additional.Underline; + Underline = additional.Underline; if (additional._flags[32]) - this.LineSpacing = additional.LineSpacing; + LineSpacing = additional.LineSpacing; if (additional._flags[128]) - this.EnableKerning = additional.EnableKerning; + EnableKerning = additional.EnableKerning; if (additional._flags[256]) - this.CharacterSpacing = additional.CharacterSpacing; + CharacterSpacing = additional.CharacterSpacing; if (!additional._flags[64]) return; - this.Color = additional.Color; + Color = additional.Color; } - public bool HasColor => this._flags[64]; + public bool HasColor => _flags[64]; public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{TextStyle"); - if (this._flags[1]) + if (_flags[1]) { stringBuilder.Append(" Font = \""); - stringBuilder.Append(this.FontFace); + stringBuilder.Append(FontFace); stringBuilder.Append("\""); } - if (this._flags[2]) + if (_flags[2]) { stringBuilder.Append(" Pt = "); - stringBuilder.Append(this.FontSize); + stringBuilder.Append(FontSize); } - if (this._flags[4]) + if (_flags[4]) { stringBuilder.Append(" Bold = "); - stringBuilder.Append(this.Bold); + stringBuilder.Append(Bold); } - if (this._flags[8]) + if (_flags[8]) { stringBuilder.Append(" Italic = "); - stringBuilder.Append(this.Italic); + stringBuilder.Append(Italic); } - if (this._flags[16]) + if (_flags[16]) { stringBuilder.Append(" Underline = "); - stringBuilder.Append(this.Underline); + stringBuilder.Append(Underline); } - if (this._flags[32]) + if (_flags[32]) { stringBuilder.Append(" LineSpacing = "); - stringBuilder.Append(this.LineSpacing); + stringBuilder.Append(LineSpacing); } - if (this._flags[64]) + if (_flags[64]) { stringBuilder.Append(" Color = "); stringBuilder.Append(Color); @@ -233,13 +233,13 @@ namespace Microsoft.Iris.Drawing public unsafe MarshalledData(TextStyle from) { - this._flags = from._flags.Data; - this._fontHeightPts = from._fontHeightPts; - this._altFontHeightPts = from._altFontHeightPts; - this._lineSpacing = from._lineSpacing; - this._characterSpacing = from._characterSpacing; - this._textColor = from._textColor; - this._fontFace = null; + _flags = from._flags.Data; + _fontHeightPts = from._fontHeightPts; + _altFontHeightPts = from._altFontHeightPts; + _lineSpacing = from._lineSpacing; + _characterSpacing = from._characterSpacing; + _textColor = from._textColor; + _fontFace = null; } } } diff --git a/UIX/Microsoft/Iris/Drawing/UIImage.cs b/UIX/Microsoft/Iris/Drawing/UIImage.cs index 1e21b00..b7ae29a 100644 --- a/UIX/Microsoft/Iris/Drawing/UIImage.cs +++ b/UIX/Microsoft/Iris/Drawing/UIImage.cs @@ -25,32 +25,32 @@ namespace Microsoft.Iris.Drawing public UIImage(Inset nineGrid, Size maximumSize, bool flippable, bool antialiasEdges) { - this._nineGrid = nineGrid; - this._maximumSize = maximumSize; - this._flippable = flippable; - this._antialiasEdges = antialiasEdges; + _nineGrid = nineGrid; + _maximumSize = maximumSize; + _flippable = flippable; + _antialiasEdges = antialiasEdges; } - public void Load() => this.Load(false); + public void Load() => Load(false); private void Load(bool inDraw) { - if (this._status != ImageStatus.PendingLoad) + if (_status != ImageStatus.PendingLoad) return; bool needAsyncLoad; - ImageCacheItem cacheItem = this.GetCacheItem(out needAsyncLoad); + ImageCacheItem cacheItem = GetCacheItem(out needAsyncLoad); if (cacheItem == null) - this.SetStatus(ImageStatus.Error); + SetStatus(ImageStatus.Error); else if (needAsyncLoad) { - this.SetStatus(ImageStatus.Loading); + SetStatus(ImageStatus.Loading); cacheItem.StartLoad(); } else - this.SetStatus(ImageStatus.Complete); + SetStatus(ImageStatus.Complete); } - private ImageCacheItem GetCacheItem() => this.GetCacheItem(out bool _); + private ImageCacheItem GetCacheItem() => GetCacheItem(out bool _); protected abstract ImageCacheItem GetCacheItem(out bool needAsyncLoad); @@ -58,82 +58,82 @@ namespace Microsoft.Iris.Drawing protected void OnHeaderLoadComplete() { - if (this.LoadComplete == null) + if (LoadComplete == null) return; - this.LoadComplete(this, this.Status); + LoadComplete(this, Status); } protected void SetStatus(ImageStatus status) { - this._status = status; - if ((this._status == ImageStatus.Error || this._status == ImageStatus.Complete) && this.LoadComplete != null) - this.LoadComplete(this, this._status); - this.FireNotification(NotificationID.Status); + _status = status; + if ((_status == ImageStatus.Error || _status == ImageStatus.Complete) && LoadComplete != null) + LoadComplete(this, _status); + FireNotification(NotificationID.Status); } - internal IImage RenderImage => this.GetCacheItem()?.RenderImage; + internal IImage RenderImage => GetCacheItem()?.RenderImage; - public ImageStatus Status => this._status; + public ImageStatus Status => _status; public string Source { - get => this._source; + get => _source; set { - if (!(this._source != value)) + if (!(_source != value)) return; - this._source = value; - this.OnImageAttributeChanged(); + _source = value; + OnImageAttributeChanged(); } } public Inset NineGrid { - get => this._nineGrid; + get => _nineGrid; set { - if (!(this._nineGrid != value)) + if (!(_nineGrid != value)) return; - this._nineGrid = value; - this.OnImageAttributeChanged(); + _nineGrid = value; + OnImageAttributeChanged(); } } public Size MaximumSize { - get => this._maximumSize; + get => _maximumSize; set { - if (!(this._maximumSize != value)) + if (!(_maximumSize != value)) return; - this._maximumSize = value; - this.OnImageAttributeChanged(); + _maximumSize = value; + OnImageAttributeChanged(); } } public bool Flippable { - get => this._flippable; + get => _flippable; set { - if (this._flippable == value) + if (_flippable == value) return; - this._flippable = value; - this.OnImageAttributeChanged(); + _flippable = value; + OnImageAttributeChanged(); } } - public bool IsFlipped => this._flippable && UISession.Default.IsRtl; + public bool IsFlipped => _flippable && UISession.Default.IsRtl; public bool AntialiasEdges { - get => this._antialiasEdges; + get => _antialiasEdges; set { - if (this._antialiasEdges == value) + if (_antialiasEdges == value) return; - this._antialiasEdges = value; - this.OnImageAttributeChanged(); + _antialiasEdges = value; + OnImageAttributeChanged(); } } @@ -141,8 +141,8 @@ namespace Microsoft.Iris.Drawing { get { - this.EnsureSizeMetrics(); - return this._contentSize; + EnsureSizeMetrics(); + return _contentSize; } } @@ -150,8 +150,8 @@ namespace Microsoft.Iris.Drawing { get { - this.EnsureSizeMetrics(); - return this._contentSize.Width; + EnsureSizeMetrics(); + return _contentSize.Width; } } @@ -159,14 +159,14 @@ namespace Microsoft.Iris.Drawing { get { - this.EnsureSizeMetrics(); - return this._contentSize.Height; + EnsureSizeMetrics(); + return _contentSize.Height; } } - internal void AddUser(object user) => this.GetCacheItem()?.RegisterUsage(user); + internal void AddUser(object user) => GetCacheItem()?.RegisterUsage(user); - public void RemoveUser(object user) => this.GetCacheItem()?.UnregisterUsage(user); + public void RemoveUser(object user) => GetCacheItem()?.UnregisterUsage(user); internal static Size MaximumSurfaceSize(UISession session) { diff --git a/UIX/Microsoft/Iris/Drawing/UriImage.cs b/UIX/Microsoft/Iris/Drawing/UriImage.cs index d386f4c..2e9e130 100644 --- a/UIX/Microsoft/Iris/Drawing/UriImage.cs +++ b/UIX/Microsoft/Iris/Drawing/UriImage.cs @@ -33,49 +33,49 @@ namespace Microsoft.Iris.Drawing bool antialiasEdges) : base(nineGrid, maximumSize, flippable, antialiasEdges) { - this.Source = source; + Source = source; } private ResourceImageItem FetchOrBuildItem() { - ResourceImageItem resourceImageItem = this.GetResourceFromCache(); + ResourceImageItem resourceImageItem = GetResourceFromCache(); if (resourceImageItem == null) { - resourceImageItem = new ResourceImageItem(UISession.Default.RenderSession, this.Source, ClampSize(this._maximumSize), this.IsFlipped, this._antialiasEdges); - resourceImageItem.LoadCompleteHandler += new ContentLoadCompleteHandler(this.OnLoadComplete); - ScavengeImageCache.Instance.Add(this._cacheKey, resourceImageItem); - this.SetStatus(resourceImageItem.Status); - this._contentSize = new Size(0, 0); + resourceImageItem = new ResourceImageItem(UISession.Default.RenderSession, Source, ClampSize(_maximumSize), IsFlipped, _antialiasEdges); + resourceImageItem.LoadCompleteHandler += new ContentLoadCompleteHandler(OnLoadComplete); + ScavengeImageCache.Instance.Add(_cacheKey, resourceImageItem); + SetStatus(resourceImageItem.Status); + _contentSize = new Size(0, 0); } else if (resourceImageItem.Resource.Status == ResourceStatus.NeedsAcquire || resourceImageItem.Resource.Status == ResourceStatus.Acquiring) - resourceImageItem.LoadCompleteHandler += new ContentLoadCompleteHandler(this.OnLoadComplete); + resourceImageItem.LoadCompleteHandler += new ContentLoadCompleteHandler(OnLoadComplete); return resourceImageItem; } private ResourceImageItem GetResourceFromCache() { - Size maxSize = ClampSize(this._maximumSize); - if (this._cacheKey == null) - this._cacheKey = new ImageCacheKey(this.Source, maxSize, this.IsFlipped, this._antialiasEdges); - return (ResourceImageItem)ScavengeImageCache.Instance.Lookup(this._cacheKey); + Size maxSize = ClampSize(_maximumSize); + if (_cacheKey == null) + _cacheKey = new ImageCacheKey(Source, maxSize, IsFlipped, _antialiasEdges); + return (ResourceImageItem)ScavengeImageCache.Instance.Lookup(_cacheKey); } - protected override void OnImageAttributeChanged() => this._cacheKey = null; + protected override void OnImageAttributeChanged() => _cacheKey = null; private void OnLoadComplete(object owner, ImageStatus status) { - ResourceImageItem resourceFromCache = this.GetResourceFromCache(); + ResourceImageItem resourceFromCache = GetResourceFromCache(); if (resourceFromCache != null) - resourceFromCache.LoadCompleteHandler -= new ContentLoadCompleteHandler(this.OnLoadComplete); - this.SetStatus(status); + resourceFromCache.LoadCompleteHandler -= new ContentLoadCompleteHandler(OnLoadComplete); + SetStatus(status); } protected override ImageCacheItem GetCacheItem(out bool needAsyncLoad) { ResourceImageItem resourceImageItem; - if (!string.IsNullOrEmpty(this.Source)) + if (!string.IsNullOrEmpty(Source)) { - resourceImageItem = this.FetchOrBuildItem(); + resourceImageItem = FetchOrBuildItem(); if (resourceImageItem != null) { needAsyncLoad = resourceImageItem.Resource.Status != ResourceStatus.Available; @@ -96,10 +96,10 @@ namespace Microsoft.Iris.Drawing protected override void EnsureSizeMetrics() { - ImageCacheItem cacheItem = this.GetCacheItem(out bool _); + ImageCacheItem cacheItem = GetCacheItem(out bool _); if (cacheItem == null) return; - this._contentSize = cacheItem.ImageSize; + _contentSize = cacheItem.ImageSize; } public static void RemoveCache( diff --git a/UIX/Microsoft/Iris/Error.cs b/UIX/Microsoft/Iris/Error.cs index 477c149..d787277 100644 --- a/UIX/Microsoft/Iris/Error.cs +++ b/UIX/Microsoft/Iris/Error.cs @@ -18,14 +18,14 @@ namespace Microsoft.Iris public override string ToString() { - string str1 = this.Context; + string str1 = Context; if (str1 != null && str1.StartsWith("file://", StringComparison.Ordinal)) str1 = str1.Substring(7); string str2; - if (this.Line != -1) - str2 = string.Format("{0}({1},{2}) : {3} : {4}", str1, Line, Column, this.Warning ? "warning" : "error", Message); + if (Line != -1) + str2 = string.Format("{0}({1},{2}) : {3} : {4}", str1, Line, Column, Warning ? "warning" : "error", Message); else - str2 = this.Context == null ? string.Format("{0} : {1}", this.Warning ? "warning" : "error", Message) : string.Format("{0} : {1} : {2}", str1, this.Warning ? "warning" : "error", Message); + str2 = Context == null ? string.Format("{0} : {1}", Warning ? "warning" : "error", Message) : string.Format("{0} : {1} : {2}", str1, Warning ? "warning" : "error", Message); return str2; } } diff --git a/UIX/Microsoft/Iris/Group.cs b/UIX/Microsoft/Iris/Group.cs index d15c4d6..291bdba 100644 --- a/UIX/Microsoft/Iris/Group.cs +++ b/UIX/Microsoft/Iris/Group.cs @@ -16,39 +16,39 @@ namespace Microsoft.Iris internal Group(GroupedList groupedList, int startIndex, int count) : base(groupedList, true, null) { - this._groupedList = groupedList; - this._startIndex = startIndex; - this.Count = count; + _groupedList = groupedList; + _startIndex = startIndex; + Count = count; } public int StartIndex { - get => this._startIndex; + get => _startIndex; internal set { - if (this._startIndex == value) + if (_startIndex == value) return; - this._startIndex = value; - this.FirePropertyChanged(nameof(StartIndex)); - this.FirePropertyChanged("EndIndex"); + _startIndex = value; + FirePropertyChanged(nameof(StartIndex)); + FirePropertyChanged("EndIndex"); } } - public int EndIndex => this.StartIndex + this.Count - 1; + public int EndIndex => StartIndex + Count - 1; - internal override void OnCountChanged() => this.FirePropertyChanged("EndIndex"); + internal override void OnCountChanged() => FirePropertyChanged("EndIndex"); - private int GetSourceIndex(int groupedIndex) => this.StartIndex + groupedIndex; + private int GetSourceIndex(int groupedIndex) => StartIndex + groupedIndex; - internal bool ContainsSourceIndex(int sourceIndex) => this.StartIndex <= sourceIndex && sourceIndex <= this.EndIndex; + internal bool ContainsSourceIndex(int sourceIndex) => StartIndex <= sourceIndex && sourceIndex <= EndIndex; - protected override object OnRequestItem(int index) => this._groupedList.Source[this.GetSourceIndex(index)]; + protected override object OnRequestItem(int index) => _groupedList.Source[GetSourceIndex(index)]; protected override void OnRequestSlowData(int groupedIndex) { - if (!(this._groupedList.Source is IVirtualList source) || !source.SlowDataRequestsEnabled) + if (!(_groupedList.Source is IVirtualList source) || !source.SlowDataRequestsEnabled) return; - int sourceIndex = this.GetSourceIndex(groupedIndex); + int sourceIndex = GetSourceIndex(groupedIndex); if (sourceIndex >= source.Count) return; source.NotifyRequestSlowData(sourceIndex); diff --git a/UIX/Microsoft/Iris/GroupedList.cs b/UIX/Microsoft/Iris/GroupedList.cs index 517a47f..533b402 100644 --- a/UIX/Microsoft/Iris/GroupedList.cs +++ b/UIX/Microsoft/Iris/GroupedList.cs @@ -27,87 +27,87 @@ namespace Microsoft.Iris public GroupedList(IList source, IComparer comparer, int count) : base(true) { - this.Comparer = comparer; - this.SetSource(source, count); + Comparer = comparer; + SetSource(source, count); } public IList Source { - get => this._source; - set => this.SetSource(value, 1, false); + get => _source; + set => SetSource(value, 1, false); } - public void SetSource(IList source, int groupCount) => this.SetSource(source, groupCount, false); + public void SetSource(IList source, int groupCount) => SetSource(source, groupCount, false); private void SetSource(IList value, int groupCount, bool disposing) { - if (this._source == value) + if (_source == value) return; - if (this._source is INotifyList sourceNotifyA) - sourceNotifyA.ContentsChanged -= new UIListContentsChangedHandler(this.SourceListModified); - if (this._source is IVirtualList sourceVirtual && sourceVirtual.SlowDataRequestsEnabled) + if (_source is INotifyList sourceNotifyA) + sourceNotifyA.ContentsChanged -= new UIListContentsChangedHandler(SourceListModified); + if (_source is IVirtualList sourceVirtual && sourceVirtual.SlowDataRequestsEnabled) sourceVirtual.SlowDataAcquireCompleteHandler = null; - this._source = value; - if (this._source is INotifyList sourceNotifyB) - sourceNotifyB.ContentsChanged += new UIListContentsChangedHandler(this.SourceListModified); - if (this._source is IVirtualList sourceVirtualB && sourceVirtualB.SlowDataRequestsEnabled) - sourceVirtualB.SlowDataAcquireCompleteHandler = new SlowDataAcquireCompleteHandler(this.SourceSlowDataAcquired); + _source = value; + if (_source is INotifyList sourceNotifyB) + sourceNotifyB.ContentsChanged += new UIListContentsChangedHandler(SourceListModified); + if (_source is IVirtualList sourceVirtualB && sourceVirtualB.SlowDataRequestsEnabled) + sourceVirtualB.SlowDataAcquireCompleteHandler = new SlowDataAcquireCompleteHandler(SourceSlowDataAcquired); if (disposing) return; - this.FirePropertyChanged("Source"); - this.Regroup(groupCount); + FirePropertyChanged("Source"); + Regroup(groupCount); } public IComparer Comparer { - get => this._comparer; + get => _comparer; set { - if (this._comparer == value) + if (_comparer == value) return; - this._comparer = value; - this.Regroup(); - this.FirePropertyChanged(nameof(Comparer)); + _comparer = value; + Regroup(); + FirePropertyChanged(nameof(Comparer)); } } - public void Regroup() => this.Regroup(1); + public void Regroup() => Regroup(1); public void Regroup(int groupCount) { - foreach (ModelItem group in this._groups) + foreach (ModelItem group in _groups) group.Dispose(); - this._groups.Clear(); - this.Clear(); - this.Count = this.Source == null || this.Source.Count <= 0 ? 0 : Math.Max(1, groupCount); + _groups.Clear(); + Clear(); + Count = Source == null || Source.Count <= 0 ? 0 : Math.Max(1, groupCount); } protected override object OnRequestItem(int index) { - if (this._repairGroupsPending && index >= this._groups.Count) + if (_repairGroupsPending && index >= _groups.Count) return null; - this.EnsureGroup(index); - return index >= this._groups.Count ? null : (object)this._groups[index]; + EnsureGroup(index); + return index >= _groups.Count ? null : (object)_groups[index]; } private void ScheduleAdjustCount() { - if (this._adjustCountPending || this.GetCountAdjustment() == 0) + if (_adjustCountPending || GetCountAdjustment() == 0) return; - DeferredCall.Post(DispatchPriority.Housekeeping, new DeferredHandler(this.AdjustCount)); + DeferredCall.Post(DispatchPriority.Housekeeping, new DeferredHandler(AdjustCount)); } private int GetCountAdjustment() { int num1 = 0; - int num2 = this.Source != null ? this.Source.Count : 0; - Group lastGroup = this.GetLastGroup(); + int num2 = Source != null ? Source.Count : 0; + Group lastGroup = GetLastGroup(); int num3 = lastGroup != null ? lastGroup.EndIndex + 1 : 0; int num4 = num2 - num3; - int num5 = this.Count - this._groups.Count; - if (this._groups.Count == this.Count && num4 > 0) + int num5 = Count - _groups.Count; + if (_groups.Count == Count && num4 > 0) { - int num6 = num3 / this._groups.Count; + int num6 = num3 / _groups.Count; num1 = Math.Max(1, num4 / num6); } else if (lastGroup == null || num5 > num4) @@ -117,11 +117,11 @@ namespace Microsoft.Iris private void AdjustCount(object args) { - this._adjustCountPending = false; - int countAdjustment = this.GetCountAdjustment(); + _adjustCountPending = false; + int countAdjustment = GetCountAdjustment(); if (countAdjustment > 0) { - this.AddRange(countAdjustment); + AddRange(countAdjustment); } else { @@ -129,26 +129,26 @@ namespace Microsoft.Iris return; int num = -countAdjustment; for (int index = 0; index < num; ++index) - this.RemoveAt(this.Count - 1); + RemoveAt(Count - 1); } } private bool SourceSlowDataAcquired(IVirtualList list, int sourceIndex) { - Group groupForSourceIndex = this.GetGroupForSourceIndex(sourceIndex); + Group groupForSourceIndex = GetGroupForSourceIndex(sourceIndex); groupForSourceIndex?.NotifySlowDataAcquireComplete(sourceIndex - groupForSourceIndex.StartIndex); return false; } private void EnsureGroup(int maxGroup) { - if (this.Comparer != null && this.Source != null && this.Source.Count > 0) + if (Comparer != null && Source != null && Source.Count > 0) { - int previousGroupIndex = this._groups.Count - 1; - Group lastGroup = this.GetLastGroup(); - this.GroupItems(ref lastGroup, ref previousGroupIndex, this.Source.Count - 1, maxGroup, true, false); + int previousGroupIndex = _groups.Count - 1; + Group lastGroup = GetLastGroup(); + GroupItems(ref lastGroup, ref previousGroupIndex, Source.Count - 1, maxGroup, true, false); } - this.ScheduleAdjustCount(); + ScheduleAdjustCount(); } private void GroupItems( @@ -159,21 +159,21 @@ namespace Microsoft.Iris bool createGroups, bool notify) { - if (this._groups.Count > maxGroup) + if (_groups.Count > maxGroup) return; if (previousGroup == null) { ++previousGroupIndex; - previousGroup = this.InsertGroup(previousGroupIndex, 0, notify); + previousGroup = InsertGroup(previousGroupIndex, 0, notify); } for (int index = previousGroup.EndIndex + 1; index <= endIndex; ++index) { - if (!this.TryInsertItemIntoGroup(previousGroup, index)) + if (!TryInsertItemIntoGroup(previousGroup, index)) { - if (!createGroups || this._groups.Count > maxGroup) + if (!createGroups || _groups.Count > maxGroup) break; ++previousGroupIndex; - previousGroup = this.InsertGroup(previousGroupIndex, index, notify); + previousGroup = InsertGroup(previousGroupIndex, index, notify); } } } @@ -181,13 +181,13 @@ namespace Microsoft.Iris protected override void OnDispose(bool disposing) { if (disposing) - this.SetSource(null, 0, true); + SetSource(null, 0, true); base.OnDispose(disposing); } private void SourceListModified(IList listSender, UIListContentsChangedArgs args) { - if (this.Comparer == null) + if (Comparer == null) return; bool flag = false; switch (args.Type) @@ -196,39 +196,39 @@ namespace Microsoft.Iris case UIListContentsChangeType.AddRange: case UIListContentsChangeType.Insert: case UIListContentsChangeType.InsertRange: - if (this.Count != 0) + if (Count != 0) { - Group lastGroup = this.GetLastGroup(); + Group lastGroup = GetLastGroup(); if (lastGroup != null && args.NewIndex <= lastGroup.EndIndex + 1) { flag = true; int newIndex = args.NewIndex; int num = args.NewIndex + args.Count - 1; int groupIndex; - Group groupForSourceIndex = this.GetGroupForSourceIndex(newIndex - 1, out groupIndex); - for (int index = groupIndex + 1; index < this._groups.Count; ++index) - this._groups[index].StartIndex += args.Count; + Group groupForSourceIndex = GetGroupForSourceIndex(newIndex - 1, out groupIndex); + for (int index = groupIndex + 1; index < _groups.Count; ++index) + _groups[index].StartIndex += args.Count; if (groupForSourceIndex != null && groupForSourceIndex.ContainsSourceIndex(newIndex)) { - this.SplitGroup(groupForSourceIndex, groupIndex, newIndex - 1, num + 1); + SplitGroup(groupForSourceIndex, groupIndex, newIndex - 1, num + 1); break; } break; } break; } - this.Count = 1; + Count = 1; break; case UIListContentsChangeType.Remove: int groupIndex1; - Group groupForSourceIndex1 = this.GetGroupForSourceIndex(args.OldIndex, out groupIndex1); - for (int index = groupIndex1 + 1; index < this._groups.Count; ++index) - --this._groups[index].StartIndex; + Group groupForSourceIndex1 = GetGroupForSourceIndex(args.OldIndex, out groupIndex1); + for (int index = groupIndex1 + 1; index < _groups.Count; ++index) + --_groups[index].StartIndex; if (groupForSourceIndex1 != null) { if (groupForSourceIndex1.Count == 1) { - this.RemoveGroup(groupIndex1); + RemoveGroup(groupIndex1); flag = true; break; } @@ -240,49 +240,49 @@ namespace Microsoft.Iris case UIListContentsChangeType.Modified: throw new NotImplementedException(); default: - this.Regroup(); + Regroup(); break; } - if (!flag || this._repairGroupsPending) + if (!flag || _repairGroupsPending) return; - this._repairGroupsPending = true; - DeferredCall.Post(DispatchPriority.Housekeeping, new DeferredHandler(this.RepairGroups)); + _repairGroupsPending = true; + DeferredCall.Post(DispatchPriority.Housekeeping, new DeferredHandler(RepairGroups)); } private void RepairGroups(object args) { - this._repairGroupsPending = false; - for (int previousGroupIndex = -1; previousGroupIndex < this._groups.Count; ++previousGroupIndex) + _repairGroupsPending = false; + for (int previousGroupIndex = -1; previousGroupIndex < _groups.Count; ++previousGroupIndex) { - Group previousGroup = previousGroupIndex > -1 ? this._groups[previousGroupIndex] : null; - Group group = previousGroupIndex + 1 < this._groups.Count ? this._groups[previousGroupIndex + 1] : null; + Group previousGroup = previousGroupIndex > -1 ? _groups[previousGroupIndex] : null; + Group group = previousGroupIndex + 1 < _groups.Count ? _groups[previousGroupIndex + 1] : null; int num1 = previousGroup != null ? previousGroup.EndIndex + 1 : 0; - int num2 = group != null ? group.StartIndex - 1 : this.Source.Count - 1; + int num2 = group != null ? group.StartIndex - 1 : Source.Count - 1; if (group != null) { - while (num2 >= num1 && this.TryInsertItemIntoGroup(group, num2)) + while (num2 >= num1 && TryInsertItemIntoGroup(group, num2)) --num2; } if (num1 <= num2) - this.GroupItems(ref previousGroup, ref previousGroupIndex, num2, int.MaxValue, group != null, true); - if (this.TryMergeWithNext(previousGroupIndex)) + GroupItems(ref previousGroup, ref previousGroupIndex, num2, int.MaxValue, group != null, true); + if (TryMergeWithNext(previousGroupIndex)) --previousGroupIndex; } - this.AdjustCount(null); + AdjustCount(null); } - private bool IsEqualToNext(int sourceIndex) => this.Comparer.Compare(this.Source[sourceIndex], this.Source[sourceIndex + 1]) == 0; + private bool IsEqualToNext(int sourceIndex) => Comparer.Compare(Source[sourceIndex], Source[sourceIndex + 1]) == 0; private bool TryMergeWithNext(int i) { - if (i >= 0 && i < this._groups.Count - 1) + if (i >= 0 && i < _groups.Count - 1) { - Group group1 = this._groups[i]; - if (this.IsEqualToNext(group1.EndIndex)) + Group group1 = _groups[i]; + if (IsEqualToNext(group1.EndIndex)) { - Group group2 = this._groups[i + 1]; + Group group2 = _groups[i + 1]; group1.AddRange(group2.Count); - this.RemoveGroup(i + 1); + RemoveGroup(i + 1); return true; } } @@ -291,9 +291,9 @@ namespace Microsoft.Iris private void RemoveGroup(int groupIndex) { - this._groups[groupIndex].Dispose(); - this._groups.RemoveAt(groupIndex); - this.RemoveAt(groupIndex); + _groups[groupIndex].Dispose(); + _groups.RemoveAt(groupIndex); + RemoveAt(groupIndex); } private bool TryInsertItemIntoGroup(Group group, int index) @@ -301,7 +301,7 @@ namespace Microsoft.Iris int sourceIndex = index - 1; if (index < group.StartIndex) sourceIndex = index; - if (!this.IsEqualToNext(sourceIndex)) + if (!IsEqualToNext(sourceIndex)) return false; group.StartIndex = Math.Min(group.StartIndex, index); group.Insert(index - group.StartIndex); @@ -317,10 +317,10 @@ namespace Microsoft.Iris int count = group.EndIndex - firstGroupSourceEndIndex; for (int index = 0; index < count; ++index) group.RemoveAt(group.Count - 1); - return this.InsertGroup(groupIndex + 1, secondGroupSourceStartIndex, count, true); + return InsertGroup(groupIndex + 1, secondGroupSourceStartIndex, count, true); } - private Group InsertGroup(int groupInsertIndex, int sourceIndex, bool notify) => this.InsertGroup(groupInsertIndex, sourceIndex, 1, notify); + private Group InsertGroup(int groupInsertIndex, int sourceIndex, bool notify) => InsertGroup(groupInsertIndex, sourceIndex, 1, notify); private Group InsertGroup( int groupInsertIndex, @@ -330,22 +330,22 @@ namespace Microsoft.Iris { Group group = new Group(this, startSourceIndex, count); group.Count = count; - this._groups.Insert(groupInsertIndex, group); + _groups.Insert(groupInsertIndex, group); if (notify) - this.Insert(groupInsertIndex); + Insert(groupInsertIndex); return group; } - private Group GetLastGroup() => this._groups.Count <= 0 ? null : this._groups[this._groups.Count - 1]; + private Group GetLastGroup() => _groups.Count <= 0 ? null : _groups[_groups.Count - 1]; private Group GetGroupForSourceIndex(int sourceIndex, out int groupIndex) { int num1 = 0; - int num2 = this._groups.Count - 1; + int num2 = _groups.Count - 1; groupIndex = num1 + (num2 - num1) / 2; while (num1 <= num2) { - Group group = this._groups[groupIndex]; + Group group = _groups[groupIndex]; if (group.StartIndex <= sourceIndex && sourceIndex <= group.EndIndex) return group; if (group.StartIndex < sourceIndex) @@ -358,11 +358,11 @@ namespace Microsoft.Iris return null; } - public Group GetGroupForSourceIndex(int sourceIndex) => this.GetGroupForSourceIndex(sourceIndex, out int _); + public Group GetGroupForSourceIndex(int sourceIndex) => GetGroupForSourceIndex(sourceIndex, out int _); public int GetGroupIndexForSourceIndex(int sourceIndex) { - for (int index = 0; index < this.Count; ++index) + for (int index = 0; index < Count; ++index) { Group group = (Group)this[index]; if (group != null) diff --git a/UIX/Microsoft/Iris/Image.cs b/UIX/Microsoft/Iris/Image.cs index c8b3ee0..e9f1f9d 100644 --- a/UIX/Microsoft/Iris/Image.cs +++ b/UIX/Microsoft/Iris/Image.cs @@ -57,7 +57,7 @@ namespace Microsoft.Iris { if (source == null) throw new ArgumentNullException(nameof(source)); - this._uiImage = new UriImage(source, inset, new Size(maximumWidth, maximumHeight), flippable, antialiasEdges); + _uiImage = new UriImage(source, inset, new Size(maximumWidth, maximumHeight), flippable, antialiasEdges); } public Image( @@ -101,16 +101,16 @@ namespace Microsoft.Iris if (!ImageFormatUtils.RawImageFormatToSurfaceFormat(format, out surfaceFormat)) throw new ArgumentException(nameof(format)); uniqueID = "RAW:" + uniqueID; - this._uiImage = new RawImage(uniqueID, new Size(imageWidth, imageHeight), stride, surfaceFormat, data, false, Inset.Zero, new Size(maximumWidth, maximumHeight), flippable, anitaliasEdges); + _uiImage = new RawImage(uniqueID, new Size(imageWidth, imageHeight), stride, surfaceFormat, data, false, Inset.Zero, new Size(maximumWidth, maximumHeight), flippable, anitaliasEdges); } - public string Source => this._uiImage.Source; + public string Source => _uiImage.Source; public bool Load() { UIDispatcher.VerifyOnApplicationThread(); - this._uiImage.Load(); - return this._uiImage.Status == ImageStatus.Loading; + _uiImage.Load(); + return _uiImage.Status == ImageStatus.Loading; } public event ImageLoadCompleteHandler ImageLoadComplete @@ -118,21 +118,21 @@ namespace Microsoft.Iris add { UIDispatcher.VerifyOnApplicationThread(); - if (this._uiImage.Status == ImageStatus.PendingLoad) + if (_uiImage.Status == ImageStatus.PendingLoad) throw new InvalidOperationException("Image Load event cannot be used before Load is called"); - if (this._completeHandlers == null) - this._uiImage.LoadComplete += new ContentLoadCompleteHandler(this.OnContentLoadComplete); - this._completeHandlers += value; + if (_completeHandlers == null) + _uiImage.LoadComplete += new ContentLoadCompleteHandler(OnContentLoadComplete); + _completeHandlers += value; } remove { UIDispatcher.VerifyOnApplicationThread(); - if (this._uiImage.Status == ImageStatus.PendingLoad) + if (_uiImage.Status == ImageStatus.PendingLoad) throw new InvalidOperationException("Image Load event cannot be used before Load is called"); - this._completeHandlers -= value; - if (this._completeHandlers != null) + _completeHandlers -= value; + if (_completeHandlers != null) return; - this._uiImage.LoadComplete -= new ContentLoadCompleteHandler(this.OnContentLoadComplete); + _uiImage.LoadComplete -= new ContentLoadCompleteHandler(OnContentLoadComplete); } } @@ -141,7 +141,7 @@ namespace Microsoft.Iris get { UIDispatcher.VerifyOnApplicationThread(); - return this._uiImage.Width; + return _uiImage.Width; } } @@ -150,7 +150,7 @@ namespace Microsoft.Iris get { UIDispatcher.VerifyOnApplicationThread(); - return this._uiImage.Height; + return _uiImage.Height; } } @@ -179,14 +179,14 @@ namespace Microsoft.Iris UriImage.RemoveCache(source, new Size(maximumWidth, maximumHeight), flippable, antialiasEdges); } - private void OnContentLoadComplete(object owner, ImageStatus status) => this._completeHandlers(this); + private void OnContentLoadComplete(object owner, ImageStatus status) => _completeHandlers(this); internal UIImage UIImage { get { UIDispatcher.VerifyOnApplicationThread(); - return this._uiImage; + return _uiImage; } } diff --git a/UIX/Microsoft/Iris/ImageInset.cs b/UIX/Microsoft/Iris/ImageInset.cs index a1cc201..253759a 100644 --- a/UIX/Microsoft/Iris/ImageInset.cs +++ b/UIX/Microsoft/Iris/ImageInset.cs @@ -17,20 +17,20 @@ namespace Microsoft.Iris public ImageInset(int left, int top, int right, int bottom) { - this._left = left; - this._top = top; - this._right = right; - this._bottom = bottom; + _left = left; + _top = top; + _right = right; + _bottom = bottom; } - public int Left => this._left; + public int Left => _left; - public int Top => this._top; + public int Top => _top; - public int Right => this._right; + public int Right => _right; - public int Bottom => this._bottom; + public int Bottom => _bottom; - internal Inset ToInset() => new Inset(this._left, this._top, this._right, this._bottom); + internal Inset ToInset() => new Inset(_left, _top, _right, _bottom); } } diff --git a/UIX/Microsoft/Iris/IndexedTree.cs b/UIX/Microsoft/Iris/IndexedTree.cs index 1312cd3..a4f39d3 100644 --- a/UIX/Microsoft/Iris/IndexedTree.cs +++ b/UIX/Microsoft/Iris/IndexedTree.cs @@ -17,24 +17,24 @@ namespace Microsoft.Iris public IndexedTree() { - this._lastSearchedIndex = -1; - this._lockObj = new object(); + _lastSearchedIndex = -1; + _lockObj = new object(); } private void SetRoot(IndexedTree.TreeNode newValue) { - if (this._root == newValue) + if (_root == newValue) return; - this._root = newValue; - this._lastSearchedIndex = -1; + _root = newValue; + _lastSearchedIndex = -1; } private IndexedTree.TreeNode AcquireTreeNode() { - IndexedTree.TreeNode treeNode = this._poolHead; - if (this._poolHead != null) + IndexedTree.TreeNode treeNode = _poolHead; + if (_poolHead != null) { - this._poolHead = this._poolHead.parent; + _poolHead = _poolHead.parent; treeNode.parent = null; } else @@ -44,50 +44,50 @@ namespace Microsoft.Iris private void ReclaimTreeNode(IndexedTree.TreeNode node) { - node.parent = this._poolHead; + node.parent = _poolHead; node.left = null; node.right = null; - this._poolHead = node; + _poolHead = node; } public void Store(int index, object data) { - lock (this._lockObj) + lock (_lockObj) { - IndexedTree.TreeNode newValue = this.Find(index); + IndexedTree.TreeNode newValue = Find(index); if (newValue == null) { - newValue = this.AcquireTreeNode(); + newValue = AcquireTreeNode(); newValue.delta = index; newValue.parent = null; - if (this._root != null) + if (_root != null) { - this._root.parent = newValue; - if (this._root.delta < index) + _root.parent = newValue; + if (_root.delta < index) { - newValue.left = this._root; - if (this._root.right != null && this._root.right.delta + this._root.delta > index) + newValue.left = _root; + if (_root.right != null && _root.right.delta + _root.delta > index) { - this._root.right.parent = newValue; - newValue.right = this._root.right; - newValue.right.delta = this._root.right.delta + this._root.delta - index; - this._root.right = null; + _root.right.parent = newValue; + newValue.right = _root.right; + newValue.right.delta = _root.right.delta + _root.delta - index; + _root.right = null; } } else { - newValue.right = this._root; - if (this._root.left != null && this._root.left.delta + this._root.delta < index) + newValue.right = _root; + if (_root.left != null && _root.left.delta + _root.delta < index) { - this._root.left.parent = newValue; - newValue.left = this._root.left; - newValue.left.delta = this._root.left.delta + this._root.delta - index; - this._root.left = null; + _root.left.parent = newValue; + newValue.left = _root.left; + newValue.left.delta = _root.left.delta + _root.delta - index; + _root.left = null; } } - this._root.delta -= index; + _root.delta -= index; } - this.SetRoot(newValue); + SetRoot(newValue); } newValue.data = data; } @@ -95,9 +95,9 @@ namespace Microsoft.Iris public void Remove(int index) { - lock (this._lockObj) + lock (_lockObj) { - IndexedTree.TreeNode node = this.Find(index); + IndexedTree.TreeNode node = Find(index); if (node == null) return; IndexedTree.TreeNode treeNode; @@ -106,15 +106,15 @@ namespace Microsoft.Iris if (node.right == null) { IndexedTree.TreeNode left = node.left; - if (node == this._root) - this.SetRoot(left); + if (node == _root) + SetRoot(left); else if (node.IsRightBranch) node.parent.right = left; else node.parent.left = left; left.delta += node.delta; left.parent = node.parent; - this.ReclaimTreeNode(node); + ReclaimTreeNode(node); return; } treeNode = node.left; @@ -126,15 +126,15 @@ namespace Microsoft.Iris } node.data = treeNode.data; node.delta = num1; - if (node == this._root) - this._lastSearchedIndex = -1; + if (node == _root) + _lastSearchedIndex = -1; int num2 = num1 - index; node.left.delta -= num2; node.right.delta -= num2; } IndexedTree.TreeNode right = node.right; - if (node == this._root) - this.SetRoot(right); + if (node == _root) + SetRoot(right); else if (node.IsRightBranch) node.parent.right = right; else @@ -144,15 +144,15 @@ namespace Microsoft.Iris right.delta += node.delta; right.parent = node.parent; } - this.ReclaimTreeNode(node); + ReclaimTreeNode(node); } } public bool TryGetData(int index, out object data) { - lock (this._lockObj) + lock (_lockObj) { - IndexedTree.TreeNode treeNode = this.Find(index); + IndexedTree.TreeNode treeNode = Find(index); data = treeNode == null ? null : treeNode.data; return treeNode != null; } @@ -160,15 +160,15 @@ namespace Microsoft.Iris public void InsertRange(int index, int count) { - lock (this._lockObj) + lock (_lockObj) { - this.Find(index); - if (this._root == null) + Find(index); + if (_root == null) return; - IndexedTree.TreeNode node = this._root; - if (this._root.delta < index) - node = this._root.right; - this.ChangeIndex(node, count); + IndexedTree.TreeNode node = _root; + if (_root.delta < index) + node = _root.right; + ChangeIndex(node, count); } } @@ -184,74 +184,74 @@ namespace Microsoft.Iris public void Insert(int index, bool setValue, object data) { - lock (this._lockObj) + lock (_lockObj) { - this.InsertRange(index, 1); + InsertRange(index, 1); if (!setValue) return; - this.Store(index, data); + Store(index, data); } } public void RemoveIndex(int index) { - lock (this._lockObj) + lock (_lockObj) { - IndexedTree.TreeNode treeNode = this.Find(index); + IndexedTree.TreeNode treeNode = Find(index); if (treeNode != null) { if (treeNode.right != null) --treeNode.right.delta; - this.Remove(index); + Remove(index); } else { - if (this._root == null) + if (_root == null) return; - IndexedTree.TreeNode node = this._root; - if (this._root.delta < index) - node = this._root.right; - this.ChangeIndex(node, -1); + IndexedTree.TreeNode node = _root; + if (_root.delta < index) + node = _root.right; + ChangeIndex(node, -1); } } } public void Clear() { - lock (this._lockObj) - this.SetRoot(null); + lock (_lockObj) + SetRoot(null); } public bool Contains(int index) { - lock (this._lockObj) - return this.Find(index) != null; + lock (_lockObj) + return Find(index) != null; } public object this[int index] { get { - lock (this._lockObj) + lock (_lockObj) { object data; - this.TryGetData(index, out data); + TryGetData(index, out data); return data; } } set { - lock (this._lockObj) - this.Store(index, value); + lock (_lockObj) + Store(index, value); } } private IndexedTree.TreeNode Find(int index) { - if (this._lastSearchedIndex == index && this._root != null) - return this._root.delta != index ? null : this._root; - this._lastSearchedIndex = index; - IndexedTree.TreeNode treeNode = this._root; + if (_lastSearchedIndex == index && _root != null) + return _root.delta != index ? null : _root; + _lastSearchedIndex = index; + IndexedTree.TreeNode treeNode = _root; IndexedTree.TreeNode node = null; int num = 0; bool flag = false; @@ -265,8 +265,8 @@ namespace Microsoft.Iris treeNode = num <= index ? treeNode.right : treeNode.left; } if (node != null) - this.Splay(node); - this._lastSearchedIndex = index; + Splay(node); + _lastSearchedIndex = index; return !flag ? null : treeNode; } @@ -275,27 +275,27 @@ namespace Microsoft.Iris for (IndexedTree.TreeNode parent = node.parent; parent != null; parent = node.parent) { if (parent.parent == null) - this.Zig(node); + Zig(node); else if (node.IsLeftBranch == parent.IsLeftBranch) - this.ZigZig(node, parent); + ZigZig(node, parent); else - this.ZigZag(node); + ZigZag(node); } - this.SetRoot(node); + SetRoot(node); } - private void Zig(IndexedTree.TreeNode item) => this.Rotate(item); + private void Zig(IndexedTree.TreeNode item) => Rotate(item); private void ZigZig(IndexedTree.TreeNode item, IndexedTree.TreeNode parent) { - this.Rotate(parent); - this.Rotate(item); + Rotate(parent); + Rotate(item); } private void ZigZag(IndexedTree.TreeNode item) { - this.Rotate(item); - this.Rotate(item); + Rotate(item); + Rotate(item); } private void Rotate(IndexedTree.TreeNode child) @@ -335,7 +335,7 @@ namespace Microsoft.Iris parent.parent = child; } - public IndexedTree.TreeNode Root => this._root; + public IndexedTree.TreeNode Root => _root; public IndexedTree.TreeEnumerator GetEnumerator() => new IndexedTree.TreeEnumerator(this); @@ -352,9 +352,9 @@ namespace Microsoft.Iris public IndexedTree.TreeNode parent; public object data; - public bool IsLeftBranch => this.delta < 0; + public bool IsLeftBranch => delta < 0; - public bool IsRightBranch => this.delta > 0; + public bool IsRightBranch => delta > 0; } public struct TreeEntry @@ -364,13 +364,13 @@ namespace Microsoft.Iris public TreeEntry(int index, object data) { - this._index = index; - this._data = data; + _index = index; + _data = data; } - public int Index => this._index; + public int Index => _index; - public object Value => this._data; + public object Value => _data; } public struct TreeEnumerator @@ -382,10 +382,10 @@ namespace Microsoft.Iris public TreeEnumerator(IndexedTree tree) { - this._tree = tree; - this._current = this._tree._root; - this._started = false; - this._index = this._current != null ? this._current.delta : -1; + _tree = tree; + _current = _tree._root; + _started = false; + _index = _current != null ? _current.delta : -1; } [Conditional("DEBUG")] @@ -395,50 +395,50 @@ namespace Microsoft.Iris private void MoveToLeftmostChild() { - if (this._current == null) + if (_current == null) return; - while (this._current.left != null) + while (_current.left != null) { - this._current = this._current.left; - this._index += this._current.delta; + _current = _current.left; + _index += _current.delta; } } public bool MoveNext() { - lock (this._tree._lockObj) + lock (_tree._lockObj) { - if (!this._started) + if (!_started) { - this._started = true; - this.MoveToLeftmostChild(); + _started = true; + MoveToLeftmostChild(); } - else if (this._current.right != null) + else if (_current.right != null) { - this._current = this._current.right; - this._index += this._current.delta; - this.MoveToLeftmostChild(); + _current = _current.right; + _index += _current.delta; + MoveToLeftmostChild(); } - else if (this._current.IsLeftBranch) + else if (_current.IsLeftBranch) { - this._index -= this._current.delta; - this._current = this._current.parent; + _index -= _current.delta; + _current = _current.parent; } else { - for (; this._current != null && this._current.IsRightBranch; this._current = this._current.parent) - this._index -= this._current.delta; - if (this._current != null) + for (; _current != null && _current.IsRightBranch; _current = _current.parent) + _index -= _current.delta; + if (_current != null) { - this._index -= this._current.delta; - this._current = this._current.parent; + _index -= _current.delta; + _current = _current.parent; } } - return this._current != null; + return _current != null; } } - public IndexedTree.TreeEntry Current => new IndexedTree.TreeEntry(this._index, this._current.data); + public IndexedTree.TreeEntry Current => new IndexedTree.TreeEntry(_index, _current.data); } } } diff --git a/UIX/Microsoft/Iris/Input/DragDropInfo.cs b/UIX/Microsoft/Iris/Input/DragDropInfo.cs index 926e200..2702d68 100644 --- a/UIX/Microsoft/Iris/Input/DragDropInfo.cs +++ b/UIX/Microsoft/Iris/Input/DragDropInfo.cs @@ -37,16 +37,16 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, DragOperation operation) { - this._modifiers = modifiers; - this._operation = operation; - this.Initialize(rawSource, x, y, EventTypeForDragOperation(operation)); + _modifiers = modifiers; + _operation = operation; + Initialize(rawSource, x, y, EventTypeForDragOperation(operation)); } protected override InputInfo.InfoType PoolType => s_poolType; - public InputModifiers Modifiers => this._modifiers; + public InputModifiers Modifiers => _modifiers; - public DragOperation Operation => this._operation; + public DragOperation Operation => _operation; private static InputEventType EventTypeForDragOperation(DragOperation operation) { diff --git a/UIX/Microsoft/Iris/Input/HIDCommandMapping.cs b/UIX/Microsoft/Iris/Input/HIDCommandMapping.cs index e3d5cf4..ded7143 100644 --- a/UIX/Microsoft/Iris/Input/HIDCommandMapping.cs +++ b/UIX/Microsoft/Iris/Input/HIDCommandMapping.cs @@ -58,9 +58,9 @@ namespace Microsoft.Iris.Input private HIDCommandMapping(CommandCode command, uint usage, uint usagePage) { - this._command = command; - this._usage = usage; - this._usagePage = usagePage; + _command = command; + _usage = usage; + _usagePage = usagePage; } public static CommandCode Find(uint usage, uint usagePage) diff --git a/UIX/Microsoft/Iris/Input/InputDevice.cs b/UIX/Microsoft/Iris/Input/InputDevice.cs index 91b6040..f199f1b 100644 --- a/UIX/Microsoft/Iris/Input/InputDevice.cs +++ b/UIX/Microsoft/Iris/Input/InputDevice.cs @@ -10,8 +10,8 @@ namespace Microsoft.Iris.Input { private InputManager _manager; - internal InputDevice(InputManager manager) => this._manager = manager; + internal InputDevice(InputManager manager) => _manager = manager; - internal InputManager Manager => this._manager; + internal InputManager Manager => _manager; } } diff --git a/UIX/Microsoft/Iris/Input/InputInfo.cs b/UIX/Microsoft/Iris/Input/InputInfo.cs index a06a795..5f85241 100644 --- a/UIX/Microsoft/Iris/Input/InputInfo.cs +++ b/UIX/Microsoft/Iris/Input/InputInfo.cs @@ -19,10 +19,10 @@ namespace Microsoft.Iris.Input protected void Initialize(InputEventType eventType) { - this._eventType = eventType; - this._lockCount = 0; - this._routeTruncated = false; - this._handled = false; + _eventType = eventType; + _lockCount = 0; + _routeTruncated = false; + _handled = false; } [Conditional("DEBUG")] @@ -46,46 +46,46 @@ namespace Microsoft.Iris.Input protected virtual void Zombie() { - this._target = null; - this._eventType = InputEventType.Invalid; + _target = null; + _eventType = InputEventType.Invalid; } protected static InputInfo GetFromPool(InputInfo.InfoType poolType) => s_pools[(int)poolType].GetPooledInfo(); public void ReturnToPool() { - if (!this.Poolable) + if (!Poolable) return; - s_pools[(int)this.PoolType].RecycleInfo(this); + s_pools[(int)PoolType].RecycleInfo(this); } - private bool Poolable => this._lockCount == 0; + private bool Poolable => _lockCount == 0; - public void Lock() => ++this._lockCount; + public void Lock() => ++_lockCount; public void Unlock() { - --this._lockCount; - if (this._lockCount != 0) + --_lockCount; + if (_lockCount != 0) return; - this.ReturnToPool(); + ReturnToPool(); } - public bool Handled => this._handled; + public bool Handled => _handled; - public void MarkHandled() => this._handled = true; + public void MarkHandled() => _handled = true; - public bool RouteTruncated => this._routeTruncated; + public bool RouteTruncated => _routeTruncated; - public ICookedInputSite Target => this._target; + public ICookedInputSite Target => _target; - public virtual InputEventType EventType => this._eventType; + public virtual InputEventType EventType => _eventType; - public void TruncateRoute() => this._routeTruncated = true; + public void TruncateRoute() => _routeTruncated = true; - public virtual void UpdateTarget(ICookedInputSite target) => this._target = target; + public virtual void UpdateTarget(ICookedInputSite target) => _target = target; - public override string ToString() => this.GetType().Name; + public override string ToString() => GetType().Name; private struct InfoPool { @@ -93,15 +93,15 @@ namespace Microsoft.Iris.Input private int _maxEntries; private object _storage; - public void SetLimitMode(bool keepSingle) => this._maxEntries = keepSingle ? 1 : 10; + public void SetLimitMode(bool keepSingle) => _maxEntries = keepSingle ? 1 : 10; public InputInfo GetPooledInfo() { InputInfo inputInfo = null; - if (this._numEntries > 0) + if (_numEntries > 0) { - inputInfo = this._maxEntries != 1 ? ((InputInfo[])this._storage)[this._numEntries - 1] : (InputInfo)this._storage; - --this._numEntries; + inputInfo = _maxEntries != 1 ? ((InputInfo[])_storage)[_numEntries - 1] : (InputInfo)_storage; + --_numEntries; } return inputInfo; } @@ -109,20 +109,20 @@ namespace Microsoft.Iris.Input public bool RecycleInfo(InputInfo info) { bool flag = false; - if (this._numEntries < this._maxEntries) + if (_numEntries < _maxEntries) { info.Zombie(); - if (this._maxEntries == 1) + if (_maxEntries == 1) { - this._storage = info; + _storage = info; } else { - if (this._storage == null) - this._storage = (new InputInfo[this._maxEntries]); - ((InputInfo[])this._storage)[this._numEntries] = info; + if (_storage == null) + _storage = (new InputInfo[_maxEntries]); + ((InputInfo[])_storage)[_numEntries] = info; } - ++this._numEntries; + ++_numEntries; flag = true; } return flag; diff --git a/UIX/Microsoft/Iris/Input/InputItem.cs b/UIX/Microsoft/Iris/Input/InputItem.cs index 048fdf7..83bffa0 100644 --- a/UIX/Microsoft/Iris/Input/InputItem.cs +++ b/UIX/Microsoft/Iris/Input/InputItem.cs @@ -49,41 +49,41 @@ namespace Microsoft.Iris.Input return inputItem; } - public void ReturnToPool() => this.ReturnToPool(true); + public void ReturnToPool() => ReturnToPool(true); private void ReturnToPool(bool returnInfoToo) { if (returnInfoToo) - this._info.ReturnToPool(); - this._manager = null; - this._target = null; - this._info = null; - this._prev = null; - this._next = null; - this._owner = null; + _info.ReturnToPool(); + _manager = null; + _target = null; + _info = null; + _prev = null; + _next = null; + _owner = null; if (s_cachedCount >= 5) return; - this._next = s_cache; + _next = s_cache; s_cache = this; ++s_cachedCount; } - public InputManager Manager => this._manager; + public InputManager Manager => _manager; - public InputInfo Info => this._info; + public InputInfo Info => _info; public override string ToString() => base.ToString() + " -> " + _info + " -> " + DebugHelpers.DEBUG_ObjectToString(_target); public override void Dispatch() { - if (this._info.Target == null) - this._info.UpdateTarget(this._target); - this._info.Lock(); - this._manager.DeliverInput(this._target, this._info); - this._info.Unlock(); - this.ReturnToPool(false); + if (_info.Target == null) + _info.UpdateTarget(_target); + _info.Lock(); + _manager.DeliverInput(_target, _info); + _info.Unlock(); + ReturnToPool(false); } - internal void UpdateInputSite(ICookedInputSite target) => this._target = target; + internal void UpdateInputSite(ICookedInputSite target) => _target = target; } } diff --git a/UIX/Microsoft/Iris/Input/InputManager.cs b/UIX/Microsoft/Iris/Input/InputManager.cs index ceb1404..e9fe091 100644 --- a/UIX/Microsoft/Iris/Input/InputManager.cs +++ b/UIX/Microsoft/Iris/Input/InputManager.cs @@ -42,41 +42,41 @@ namespace Microsoft.Iris.Input internal InputManager(UISession session) { - this._session = session; - this._keyFocusCanBeNull = true; - this._lastInputTime = DateTime.MinValue; - this._inputQueue = new InputQueue(this); - this._resumeInput = new SimpleCallback(this.ResumeInput); - this._refreshHitTargetHandler = new SimpleCallback(this.RefreshHitTargetHandler); + _session = session; + _keyFocusCanBeNull = true; + _lastInputTime = DateTime.MinValue; + _inputQueue = new InputQueue(this); + _resumeInput = new SimpleCallback(ResumeInput); + _refreshHitTargetHandler = new SimpleCallback(RefreshHitTargetHandler); } - internal void ConnectToRenderer() => this.Session.RenderSession.InputSystem.RegisterRawInputCallbacks(this); + internal void ConnectToRenderer() => Session.RenderSession.InputSystem.RegisterRawInputCallbacks(this); internal void PrepareToShutDown() { - this.KeyCoalescePolicy = null; - this.EndKeyCoalesce(); - this.InvalidKeyFocus = null; - this._inputDisabled = true; - this.Session.RenderSession.InputSystem.UnregisterRawInputCallbacks(); - this._inputQueue.PrepareToShutDown(); + KeyCoalescePolicy = null; + EndKeyCoalesce(); + InvalidKeyFocus = null; + _inputDisabled = true; + Session.RenderSession.InputSystem.UnregisterRawInputCallbacks(); + _inputQueue.PrepareToShutDown(); } - internal UISession Session => this._session; + internal UISession Session => _session; - internal InputQueue Queue => this._inputQueue; + internal InputQueue Queue => _inputQueue; - internal InputModifiers Modifiers => this.Keyboard.KeyboardModifiers | this.Mouse.MouseModifiers; + internal InputModifiers Modifiers => Keyboard.KeyboardModifiers | Mouse.MouseModifiers; - internal InputModifiers DragModifiers => this._inputQueue.DragModifiers; + internal InputModifiers DragModifiers => _inputQueue.DragModifiers; internal KeyboardDevice Keyboard { get { - if (this._keyboardDevice == null) - this._keyboardDevice = new KeyboardDevice(this); - return this._keyboardDevice; + if (_keyboardDevice == null) + _keyboardDevice = new KeyboardDevice(this); + return _keyboardDevice; } } @@ -84,9 +84,9 @@ namespace Microsoft.Iris.Input { get { - if (this._mouseDevice == null) - this._mouseDevice = new MouseDevice(this); - return this._mouseDevice; + if (_mouseDevice == null) + _mouseDevice = new MouseDevice(this); + return _mouseDevice; } } @@ -94,53 +94,53 @@ namespace Microsoft.Iris.Input { get { - if (this._remoteDevice == null) - this._remoteDevice = new HidDevice(this); - return this._remoteDevice; + if (_remoteDevice == null) + _remoteDevice = new HidDevice(this); + return _remoteDevice; } } - public DateTime LastInputTime => this._lastInputTime; + public DateTime LastInputTime => _lastInputTime; - public bool InputEnabled => !this._inputDisabled; + public bool InputEnabled => !_inputDisabled; public bool KeyFocusCanBeNull { - get => this._inputDisabled || this._keyFocusCanBeNull; + get => _inputDisabled || _keyFocusCanBeNull; set { - if (this._keyFocusCanBeNull == value) + if (_keyFocusCanBeNull == value) return; - this._keyFocusCanBeNull = value; + _keyFocusCanBeNull = value; if (value) return; - this._inputQueue.RevalidateInputSiteUsage(null, false); + _inputQueue.RevalidateInputSiteUsage(null, false); } } - public ICookedInputSite RawKeyFocus => this._inputQueue.PendingKeyFocus; + public ICookedInputSite RawKeyFocus => _inputQueue.PendingKeyFocus; - public ICookedInputSite RawInstantaneousKeyFocus => this._inputQueue.InstantaneousKeyFocus; + public ICookedInputSite RawInstantaneousKeyFocus => _inputQueue.InstantaneousKeyFocus; - public bool RawKeyFocusIsDefault => this._inputQueue.PendingKeyFocusIsDefault; + public bool RawKeyFocusIsDefault => _inputQueue.PendingKeyFocusIsDefault; public KeyCoalesceFilter KeyCoalescePolicy { - get => this._keyCoalescePolicy; - set => this._keyCoalescePolicy = value; + get => _keyCoalescePolicy; + set => _keyCoalescePolicy = value; } public Point MostRecentPhysicalMousePos { - get => this._physicalMouseOffset; + get => _physicalMouseOffset; set { - if (!(this._physicalMouseOffset != value)) + if (!(_physicalMouseOffset != value)) return; - this._physicalMouseOffset = value; - if (this.MousePositionChanged == null) + _physicalMouseOffset = value; + if (MousePositionChanged == null) return; - this.MousePositionChanged(this, EventArgs.Empty); + MousePositionChanged(this, EventArgs.Empty); } } @@ -156,22 +156,22 @@ namespace Microsoft.Iris.Input public void SuspendInputUntil(DispatchPriority unlockPriority) { - DeferredCall.Post(unlockPriority, this._resumeInput); - this.Session.Dispatcher.BlockInputQueue(true); - ++this._inputSuspendCount; + DeferredCall.Post(unlockPriority, _resumeInput); + Session.Dispatcher.BlockInputQueue(true); + ++_inputSuspendCount; } private void ResumeInput() { - if (this._inputSuspendCount <= 0) + if (_inputSuspendCount <= 0) return; - --this._inputSuspendCount; - if (this._inputSuspendCount != 0) + --_inputSuspendCount; + if (_inputSuspendCount != 0) return; - this.Session.Dispatcher.BlockInputQueue(false); + Session.Dispatcher.BlockInputQueue(false); } - internal void UpdateLastInputTime() => this._lastInputTime = DateTime.UtcNow; + internal void UpdateLastInputTime() => _lastInputTime = DateTime.UtcNow; public InputHandlerFlags InputHandlerMask => InputHandlerFlags.All; @@ -180,32 +180,32 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, ref RawKeyboardData args) { - KeyInfo info = this.Keyboard.OnRawInput(message, modifiers, ref args); + KeyInfo info = Keyboard.OnRawInput(message, modifiers, ref args); if (info != null) - this._inputQueue.RawKeyAction(info); - this.UpdateLastInputTime(); + _inputQueue.RawKeyAction(info); + UpdateLastInputTime(); } public void HandleRawMouseInput(uint message, InputModifiers modifiers, ref RawMouseData args) { - this.Mouse.OnRawInput(message, modifiers, ref args); - this.UpdateLastInputTime(); + Mouse.OnRawInput(message, modifiers, ref args); + UpdateLastInputTime(); } public void HandleRawHidInput(ref RawHidData args) { - KeyActionInfo keyActionInfo = this.Remote.OnRawInput(HIDCommandMapping.Find(args._commandCode, args._usagePage), ref args); + KeyActionInfo keyActionInfo = Remote.OnRawInput(HIDCommandMapping.Find(args._commandCode, args._usagePage), ref args); if (keyActionInfo != null) - this._inputQueue.RawKeyAction(keyActionInfo); - this.UpdateLastInputTime(); + _inputQueue.RawKeyAction(keyActionInfo); + UpdateLastInputTime(); } public void HandleAppCommand(ref RawHidData args) { - KeyActionInfo keyActionInfo = this.Remote.OnRawInput(AppCommandMapping.Find(args._commandCode), ref args); + KeyActionInfo keyActionInfo = Remote.OnRawInput(AppCommandMapping.Find(args._commandCode), ref args); if (keyActionInfo != null) - this._inputQueue.RawKeyAction(keyActionInfo); - this.UpdateLastInputTime(); + _inputQueue.RawKeyAction(keyActionInfo); + UpdateLastInputTime(); } public void HandleRawDragInput(uint message, InputModifiers modifiers, ref RawDragData args) @@ -215,9 +215,9 @@ namespace Microsoft.Iris.Input object data = null; if (message == 0U) data = dataObject.GetExternalData(); - this.Mouse.OnRawInput(message, modifiers, ref args, data); + Mouse.OnRawInput(message, modifiers, ref args, data); } - this.UpdateLastInputTime(); + UpdateLastInputTime(); } internal void RevalidateInputSiteUsage( @@ -225,26 +225,26 @@ namespace Microsoft.Iris.Input bool recursiveFlag, bool knownDisabledFlag) { - if (this._ignoreHungKeyFocus && !knownDisabledFlag) + if (_ignoreHungKeyFocus && !knownDisabledFlag) { - this.StopIgnoringHungKeyFocus(); + StopIgnoringHungKeyFocus(); target = null; recursiveFlag = false; } - this._inputQueue.RevalidateInputSiteUsage(target, recursiveFlag); - if (this._refreshHitTargetPending) + _inputQueue.RevalidateInputSiteUsage(target, recursiveFlag); + if (_refreshHitTargetPending) return; - this._refreshHitTargetPending = true; - DeferredCall.Post(DispatchPriority.RenderSync, this._refreshHitTargetHandler); + _refreshHitTargetPending = true; + DeferredCall.Post(DispatchPriority.RenderSync, _refreshHitTargetHandler); } private void RefreshHitTargetHandler() { - this._refreshHitTargetPending = false; - this.Session.Form.RefreshHitTarget(); + _refreshHitTargetPending = false; + Session.Form.RefreshHitTarget(); } - public bool IsPendingKeyFocusValid() => this.IsValidKeyFocusWorker(this._inputQueue.PendingKeyFocus); + public bool IsPendingKeyFocusValid() => IsValidKeyFocusWorker(_inputQueue.PendingKeyFocus); public void SimulateDragEnter( ICookedInputSite dragSource, @@ -254,10 +254,10 @@ namespace Microsoft.Iris.Input int y, InputModifiers modifiers) { - this._inputQueue.SimulateDragEnter(dragSource, rawTargetSite, data, x, y, modifiers); + _inputQueue.SimulateDragEnter(dragSource, rawTargetSite, data, x, y, modifiers); } - public void SimulateDragOver(InputModifiers modifiers) => this._inputQueue.SimulateDragOver(modifiers); + public void SimulateDragOver(InputModifiers modifiers) => _inputQueue.SimulateDragOver(modifiers); public void SimulateDragOver( IRawInputSite rawTargetSite, @@ -265,7 +265,7 @@ namespace Microsoft.Iris.Input int y, InputModifiers modifiers) { - this._inputQueue.SimulateDragOver(rawTargetSite, x, y, modifiers); + _inputQueue.SimulateDragOver(rawTargetSite, x, y, modifiers); } public void SimulateDragEnd( @@ -273,27 +273,27 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, DragOperation formOperation) { - this._inputQueue.SimulateDragEnd(rawTargetSite, modifiers, formOperation); + _inputQueue.SimulateDragEnd(rawTargetSite, modifiers, formOperation); } - public object GetDragDropValue() => this._inputQueue.GetDragDropValue(); + public object GetDragDropValue() => _inputQueue.GetDragDropValue(); internal bool FilterKeyboardEvent(KeyStateInfo info) { switch (info.Action) { case KeyAction.Up: - this.EndKeyCoalesce(); + EndKeyCoalesce(); break; case KeyAction.Down: if (info.RepeatCount == 2U) { - this.BeginKeyCoalesce(info); + BeginKeyCoalesce(info); break; } - if (info.RepeatCount > 2U && this.CoalesceRepeatedKey(info)) + if (info.RepeatCount > 2U && CoalesceRepeatedKey(info)) return false; - this.EndKeyCoalesce(); + EndKeyCoalesce(); break; } return true; @@ -301,40 +301,40 @@ namespace Microsoft.Iris.Input private bool BeginKeyCoalesce(KeyStateInfo info) { - this.EndKeyCoalesce(); - if (this._keyCoalescePolicy == null || !this._keyCoalescePolicy(info.Key)) + EndKeyCoalesce(); + if (_keyCoalescePolicy == null || !_keyCoalescePolicy(info.Key)) return false; - this.SetCoalesceKeyEvent(info.MakeRepeatableCopy()); + SetCoalesceKeyEvent(info.MakeRepeatableCopy()); return true; } private void SetCoalesceKeyEvent(KeyStateInfo info) { - if (this._currentCoalesceKeyEvent != null) - this._currentCoalesceKeyEvent.Unlock(); - this._currentCoalesceKeyEvent = info; - if (this._currentCoalesceKeyEvent == null) + if (_currentCoalesceKeyEvent != null) + _currentCoalesceKeyEvent.Unlock(); + _currentCoalesceKeyEvent = info; + if (_currentCoalesceKeyEvent == null) return; - this._currentCoalesceKeyEvent.Lock(); + _currentCoalesceKeyEvent.Lock(); } private bool CoalesceRepeatedKey(KeyStateInfo info) { - if (!info.IsRepeatOf(this._currentCoalesceKeyEvent)) + if (!info.IsRepeatOf(_currentCoalesceKeyEvent)) return false; - this.SetCoalesceKeyEvent(info); - if (!this._currentCoalesceUndelivered) + SetCoalesceKeyEvent(info); + if (!_currentCoalesceUndelivered) { - this._currentCoalesceUndelivered = true; - this._inputQueue.RawInputIdleItem(DeferredCall.Create(s_deliverCoalescedKey, this)); + _currentCoalesceUndelivered = true; + _inputQueue.RawInputIdleItem(DeferredCall.Create(s_deliverCoalescedKey, this)); } return true; } private void EndKeyCoalesce() { - this.SetCoalesceKeyEvent(null); - this._currentCoalesceUndelivered = false; + SetCoalesceKeyEvent(null); + _currentCoalesceUndelivered = false; } private static void DeliverCoalescedKey(object args) @@ -350,8 +350,8 @@ namespace Microsoft.Iris.Input public void MapMouseInput(MouseActionInfo info, ICookedInputSite captureSite) { - ICookedInputSite target = this.HitTestInput(info.RawSource, captureSite); - if (!this.IsValidCookedInputSite(target)) + ICookedInputSite target = HitTestInput(info.RawSource, captureSite); + if (!IsValidCookedInputSite(target)) target = null; IRawInputSite naturalHit = info.NaturalHit; ICookedInputSite naturalTarget = null; @@ -365,7 +365,7 @@ namespace Microsoft.Iris.Input ICookedInputSite targetRelative) { ICookedInputSite cookedInputSite = null; - if (!this._inputDisabled) + if (!_inputDisabled) { ITreeNode treeNode = null; if (targetRelative != null) @@ -394,22 +394,22 @@ namespace Microsoft.Iris.Input internal bool IsValidKeyFocusSite(ICookedInputSite target) { - bool flag = this.IsValidKeyFocusWorker(target); - if (this._ignoreHungKeyFocus) + bool flag = IsValidKeyFocusWorker(target); + if (_ignoreHungKeyFocus) { if (flag) - this.StopIgnoringHungKeyFocus(); - else if (target == this._ignoreHungKeyFocusTarget) + StopIgnoringHungKeyFocus(); + else if (target == _ignoreHungKeyFocusTarget) flag = true; else - this.StopIgnoringHungKeyFocus(); + StopIgnoringHungKeyFocus(); } return flag; } private bool IsValidKeyFocusWorker(ICookedInputSite candidate) { - bool flag = this.KeyFocusCanBeNull; + bool flag = KeyFocusCanBeNull; if (candidate is ITreeNode child) { UIZone zone = child.Zone; @@ -421,107 +421,107 @@ namespace Microsoft.Iris.Input internal void RepairInvalidKeyFocus(uint attemptCount) { - if (this._inputQueue.PendingKeyFocus is ITreeNode pendingKeyFocus && pendingKeyFocus.Zone == null) + if (_inputQueue.PendingKeyFocus is ITreeNode pendingKeyFocus && pendingKeyFocus.Zone == null) { - this._inputQueue.RequestKeyFocus(null, KeyFocusReason.Default); - if (this._keyFocusCanBeNull) + _inputQueue.RequestKeyFocus(null, KeyFocusReason.Default); + if (_keyFocusCanBeNull) return; } if (attemptCount <= 1U) { - this.SuspendInputUntil(DispatchPriority.LayoutSync); + SuspendInputUntil(DispatchPriority.LayoutSync); } else { - if (this.InvalidKeyFocus != null) - this.InvalidKeyFocus(this._inputQueue.LastCompletedKeyFocus); - ICookedInputSite pendingKeyFocusB = this._inputQueue.PendingKeyFocus; - if (this.IsValidKeyFocusWorker(pendingKeyFocusB)) + if (InvalidKeyFocus != null) + InvalidKeyFocus(_inputQueue.LastCompletedKeyFocus); + ICookedInputSite pendingKeyFocusB = _inputQueue.PendingKeyFocus; + if (IsValidKeyFocusWorker(pendingKeyFocusB)) return; - if (this._keyFocusCanBeNull) + if (_keyFocusCanBeNull) { - this._inputQueue.RequestKeyFocus(null, KeyFocusReason.Default); + _inputQueue.RequestKeyFocus(null, KeyFocusReason.Default); } else { - this._ignoreHungKeyFocus = true; - this._ignoreHungKeyFocusTarget = pendingKeyFocusB; + _ignoreHungKeyFocus = true; + _ignoreHungKeyFocusTarget = pendingKeyFocusB; } } } private void StopIgnoringHungKeyFocus() { - this._ignoreHungKeyFocus = false; - this._ignoreHungKeyFocusTarget = null; + _ignoreHungKeyFocus = false; + _ignoreHungKeyFocusTarget = null; } internal void RequestHostKeyFocus(ICookedInputSite target) { - if (!this._session.IsValid || target is IInputCustomFocus inputCustomFocus && inputCustomFocus.OverrideHostFocus() || this._session.Form == null) + if (!_session.IsValid || target is IInputCustomFocus inputCustomFocus && inputCustomFocus.OverrideHostFocus() || _session.Form == null) return; - this._session.Form.TakeFocus(); + _session.Form.TakeFocus(); } internal void RequestHostMouseCapture(IRawInputSite rawSource, bool state) { - if (this._session.Form == null) + if (_session.Form == null) return; - this._session.Form.SetCapture(rawSource, state); + _session.Form.SetCapture(rawSource, state); } internal void DeliverInput(ICookedInputSite target, InputInfo info) { - if (info is KeyStateInfo info1 && !this.FilterKeyboardEvent(info1)) + if (info is KeyStateInfo info1 && !FilterKeyboardEvent(info1)) return; - this.DeliverInputWorker(target, info, EventRouteStages.All); + DeliverInputWorker(target, info, EventRouteStages.All); } - public void ForwardInput(ICookedInputSite target, InputInfo info) => this.DeliverInputWorker(target, info, EventRouteStages.Direct); + public void ForwardInput(ICookedInputSite target, InputInfo info) => DeliverInputWorker(target, info, EventRouteStages.Direct); private void DeliverInputWorker( ICookedInputSite target, InputInfo info, EventRouteStages stages) { - if (this._inputDisabled) + if (_inputDisabled) return; - InputManager.ZoneDeliveryInfo inputZoneRouting = this.ComputeInputZoneRouting(target, info); - if (this.CheckFocus(target, ref inputZoneRouting, info) && inputZoneRouting.zone != null) + InputManager.ZoneDeliveryInfo inputZoneRouting = ComputeInputZoneRouting(target, info); + if (CheckFocus(target, ref inputZoneRouting, info) && inputZoneRouting.zone != null) { byte traceLevelForEvent = Trace.GetTraceLevelForEvent(info); EventRouteStages stage = EventRouteStages.None; - if (this.PreviewInput != null && (stages & EventRouteStages.Preview) != EventRouteStages.None) + if (PreviewInput != null && (stages & EventRouteStages.Preview) != EventRouteStages.None) { - this.PreviewInput(this, new InputNotificationEventArgs(info, target, stage)); + PreviewInput(this, new InputNotificationEventArgs(info, target, stage)); if (info.Handled) stage = EventRouteStages.Preview; } if (!info.Handled && (stages & EventRouteStages.Routed) != EventRouteStages.None) { - int num = (int)this.DeliverInputStageWorker(info, EventRouteStages.Routed, ref inputZoneRouting, traceLevelForEvent); + int num = (int)DeliverInputStageWorker(info, EventRouteStages.Routed, ref inputZoneRouting, traceLevelForEvent); if (info.Handled) stage = EventRouteStages.Routed; } if (!info.Handled && (stages & EventRouteStages.Direct) != EventRouteStages.None) { - int num = (int)this.DeliverInputStageWorker(info, EventRouteStages.Direct, ref inputZoneRouting, traceLevelForEvent); + int num = (int)DeliverInputStageWorker(info, EventRouteStages.Direct, ref inputZoneRouting, traceLevelForEvent); if (info.Handled) stage = EventRouteStages.Direct; } if (!info.Handled && (stages & EventRouteStages.Bubbled) != EventRouteStages.None) { - int num = (int)this.DeliverInputStageWorker(info, EventRouteStages.Bubbled, ref inputZoneRouting, traceLevelForEvent); + int num = (int)DeliverInputStageWorker(info, EventRouteStages.Bubbled, ref inputZoneRouting, traceLevelForEvent); if (info.Handled) stage = EventRouteStages.Bubbled; } if (!info.Handled && (stages & EventRouteStages.Unhandled) != EventRouteStages.None) { - int num = (int)this.DeliverInputStageWorker(info, EventRouteStages.Unhandled, ref inputZoneRouting, traceLevelForEvent); + int num = (int)DeliverInputStageWorker(info, EventRouteStages.Unhandled, ref inputZoneRouting, traceLevelForEvent); if (info.Handled) stage = EventRouteStages.Unhandled; } - InputNotificationHandler notificationHandler = !info.Handled ? this.UnhandledInput : this.HandledInput; + InputNotificationHandler notificationHandler = !info.Handled ? UnhandledInput : HandledInput; if (notificationHandler != null) notificationHandler(this, new InputNotificationEventArgs(info, target, stage)); } @@ -582,8 +582,8 @@ namespace Microsoft.Iris.Input InputManager.ZoneDeliveryInfo newFocusInfo = new InputManager.ZoneDeliveryInfo(); if (mouseFocusInfo.State) newFocusInfo = deliveryInfo; - ProcessFocusUpdates(InputDeviceType.Mouse, ref this._mouseFocusZone, newFocusInfo, target as ITreeNode); - this._session.RootZone.UpdateCursor(null); + ProcessFocusUpdates(InputDeviceType.Mouse, ref _mouseFocusZone, newFocusInfo, target as ITreeNode); + _session.RootZone.UpdateCursor(null); } if (mouseFocusInfo.State && target == mouseFocusInfo.Other) flag = false; @@ -594,7 +594,7 @@ namespace Microsoft.Iris.Input InputManager.ZoneDeliveryInfo newFocusInfo = new InputManager.ZoneDeliveryInfo(); if (keyFocusInfo.State) newFocusInfo = deliveryInfo; - ProcessFocusUpdates(InputDeviceType.Keyboard, ref this._keyFocusZone, newFocusInfo, target as ITreeNode); + ProcessFocusUpdates(InputDeviceType.Keyboard, ref _keyFocusZone, newFocusInfo, target as ITreeNode); } if (keyFocusInfo.State && target == keyFocusInfo.Other) flag = false; @@ -639,9 +639,9 @@ namespace Microsoft.Iris.Input zone.UpdateInputFocusStates(focusType, deepFocusFlag, directFocusChild, obj); } - internal InputModifiers HACK_SystemModifiers => this._HACK_sysModifiers; + internal InputModifiers HACK_SystemModifiers => _HACK_sysModifiers; - internal void HACK_UpdateSystemModifiers(InputModifiers modifiers) => this._HACK_sysModifiers = modifiers; + internal void HACK_UpdateSystemModifiers(InputModifiers modifiers) => _HACK_sysModifiers = modifiers; private struct ZoneDeliveryInfo { diff --git a/UIX/Microsoft/Iris/Input/InputQueue.cs b/UIX/Microsoft/Iris/Input/InputQueue.cs index cb86353..6faba4e 100644 --- a/UIX/Microsoft/Iris/Input/InputQueue.cs +++ b/UIX/Microsoft/Iris/Input/InputQueue.cs @@ -50,53 +50,53 @@ namespace Microsoft.Iris.Input public InputQueue(InputManager manager) { - this._inputManager = manager; - this._filterStack = new QueueItem.Stack(); - this._rawMousePos = new Point(); - this._appMousePos = new Point(); - this._desiredKeyFocusReason = KeyFocusReason.Default; - this._inputIdleQueue = new SimpleQueue(); - this._inputIdleQueue.Wake += new EventHandler(this.OnChildQueueWake); - this._invalidKeyFocusCallback = new SimpleCallback(this.InvalidKeyFocusCallback); + _inputManager = manager; + _filterStack = new QueueItem.Stack(); + _rawMousePos = new Point(); + _appMousePos = new Point(); + _desiredKeyFocusReason = KeyFocusReason.Default; + _inputIdleQueue = new SimpleQueue(); + _inputIdleQueue.Wake += new EventHandler(OnChildQueueWake); + _invalidKeyFocusCallback = new SimpleCallback(InvalidKeyFocusCallback); } - public ICookedInputSite InstantaneousKeyFocus => this._currentKeyFocus; + public ICookedInputSite InstantaneousKeyFocus => _currentKeyFocus; - public ICookedInputSite PendingKeyFocus => this._desiredKeyFocus; + public ICookedInputSite PendingKeyFocus => _desiredKeyFocus; - public bool PendingKeyFocusIsDefault => this._desiredKeyFocusReason == KeyFocusReason.Default; + public bool PendingKeyFocusIsDefault => _desiredKeyFocusReason == KeyFocusReason.Default; - public ICookedInputSite LastCompletedKeyFocus => this._lastCompletedKeyFocus; + public ICookedInputSite LastCompletedKeyFocus => _lastCompletedKeyFocus; - public ICookedInputSite CurrentMouseFocus => this._appMouseFocusTarget; + public ICookedInputSite CurrentMouseFocus => _appMouseFocusTarget; - public InputModifiers DragModifiers => this._rawDragModifiers; + public InputModifiers DragModifiers => _rawDragModifiers; - public void RequestKeyFocus(ICookedInputSite desired) => this.RequestKeyFocus(desired, KeyFocusReason.Other); + public void RequestKeyFocus(ICookedInputSite desired) => RequestKeyFocus(desired, KeyFocusReason.Other); public void RequestKeyFocus(ICookedInputSite desired, KeyFocusReason reason) { - if (this._desiredKeyFocus != desired) + if (_desiredKeyFocus != desired) { - this._desiredKeyFocus = desired; - this._desiredKeyFocusReason = reason; + _desiredKeyFocus = desired; + _desiredKeyFocusReason = reason; } else if (reason != KeyFocusReason.Default) - this._desiredKeyFocusReason = reason; + _desiredKeyFocusReason = reason; if (desired != null) - this._inputManager.RequestHostKeyFocus(desired); - if (this._desiredKeyFocus == this._currentKeyFocus) + _inputManager.RequestHostKeyFocus(desired); + if (_desiredKeyFocus == _currentKeyFocus) return; - this.OnWake(); + OnWake(); } public void PrepareToShutDown() { - this.RequestKeyFocus(null); - this.RawMouseLeave(); + RequestKeyFocus(null); + RawMouseLeave(); } - public void RawKeyAction(KeyInfo info) => this.PostItem(this.GenerateGenericInput(info)); + public void RawKeyAction(KeyInfo info) => PostItem(GenerateGenericInput(info)); public void RawMouseMove( IRawInputSite site, @@ -104,28 +104,28 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, ref RawMouseData rawEventData) { - this._rawMouseSite = site; - this._rawMouseNaturalSite = naturalSite; - this._rawMousePos.X = rawEventData._positionX; - this._rawMousePos.Y = rawEventData._positionY; - this._rawScreenPos.X = rawEventData._screenX; - this._rawScreenPos.Y = rawEventData._screenY; - this._rawMouseModifiers = modifiers; - this.SetMouseMoved(); + _rawMouseSite = site; + _rawMouseNaturalSite = naturalSite; + _rawMousePos.X = rawEventData._positionX; + _rawMousePos.Y = rawEventData._positionY; + _rawScreenPos.X = rawEventData._screenX; + _rawScreenPos.Y = rawEventData._screenY; + _rawMouseModifiers = modifiers; + SetMouseMoved(); } public void RawMouseLeave() { - this.CancelMouseCapture(null); - this._mouseWheelDelta = 0; - this._rawMouseSite = null; - this._rawMouseNaturalSite = null; - this._rawMousePos.X = -1; - this._rawMousePos.Y = -1; - this._rawScreenPos.X = -1; - this._rawScreenPos.Y = -1; - this._rawMouseModifiers = InputModifiers.None; - this.SetMouseMoved(); + CancelMouseCapture(null); + _mouseWheelDelta = 0; + _rawMouseSite = null; + _rawMouseNaturalSite = null; + _rawMousePos.X = -1; + _rawMousePos.Y = -1; + _rawScreenPos.X = -1; + _rawScreenPos.Y = -1; + _rawMouseModifiers = InputModifiers.None; + SetMouseMoved(); } public void RawMouseButtonState( @@ -136,17 +136,17 @@ namespace Microsoft.Iris.Input MouseButtons button, bool state) { - this.PostItem(this.GenerateMouseButton(site, naturalSite, this._rawMousePos.X, this._rawMousePos.Y, this._rawScreenPos.X, this._rawScreenPos.Y, modifiers, button, state, message)); + PostItem(GenerateMouseButton(site, naturalSite, _rawMousePos.X, _rawMousePos.Y, _rawScreenPos.X, _rawScreenPos.Y, modifiers, button, state, message)); } public void RawMouseWheel(InputModifiers modifiers, ref RawMouseData rawEventData) { - bool flag = this._mouseWheelDelta != 0; - this._mouseWheelDelta += rawEventData._wheelDelta; - this._rawMouseModifiers = modifiers; - if (flag || this._mouseWheelDelta == 0) + bool flag = _mouseWheelDelta != 0; + _mouseWheelDelta += rawEventData._wheelDelta; + _rawMouseModifiers = modifiers; + if (flag || _mouseWheelDelta == 0) return; - this.OnWake(); + OnWake(); } public void SimulateDragEnter( @@ -157,10 +157,10 @@ namespace Microsoft.Iris.Input int y, InputModifiers modifiers) { - this.SimulateDragDrop(dragSource, rawTargetSite, data, x, y, modifiers, DragOperation.Enter); + SimulateDragDrop(dragSource, rawTargetSite, data, x, y, modifiers, DragOperation.Enter); } - public void SimulateDragOver(InputModifiers modifiers) => this.SimulateDragDrop(this._dragSource, this._rawDropTargetSite, null, this._rawDragPoint.X, this._rawDragPoint.Y, modifiers, DragOperation.Over); + public void SimulateDragOver(InputModifiers modifiers) => SimulateDragDrop(_dragSource, _rawDropTargetSite, null, _rawDragPoint.X, _rawDragPoint.Y, modifiers, DragOperation.Over); public void SimulateDragOver( IRawInputSite rawTargetSite, @@ -168,7 +168,7 @@ namespace Microsoft.Iris.Input int y, InputModifiers modifiers) { - this.SimulateDragDrop(this._dragSource, rawTargetSite, null, x, y, modifiers, DragOperation.Over); + SimulateDragDrop(_dragSource, rawTargetSite, null, x, y, modifiers, DragOperation.Over); } public void SimulateDragEnd( @@ -176,10 +176,10 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, DragOperation formOperation) { - this.PushFilterStack(this.GenerateDragDrop(this._dragSource, null, this._rawDragPoint.X, this._rawDragPoint.Y, modifiers, DragOperation.DragComplete)); - this.SimulateDragDrop(this._dragSource, rawTargetSite, null, this._rawDragPoint.X, this._rawDragPoint.Y, modifiers, formOperation); - this.OnWake(); - this._dragSource = null; + PushFilterStack(GenerateDragDrop(_dragSource, null, _rawDragPoint.X, _rawDragPoint.Y, modifiers, DragOperation.DragComplete)); + SimulateDragDrop(_dragSource, rawTargetSite, null, _rawDragPoint.X, _rawDragPoint.Y, modifiers, formOperation); + OnWake(); + _dragSource = null; } private void SimulateDragDrop( @@ -191,12 +191,12 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, DragOperation formOperation) { - this._dragSource = dragSource; - InputItem dragDropItem = this.GenerateDragDropItem(dragSource, rawTargetSite, data, x, y, modifiers, formOperation); + _dragSource = dragSource; + InputItem dragDropItem = GenerateDragDropItem(dragSource, rawTargetSite, data, x, y, modifiers, formOperation); if (dragDropItem == null) return; - this.PushFilterStack(dragDropItem); - this.OnWake(); + PushFilterStack(dragDropItem); + OnWake(); } public void RawDragDrop( @@ -208,28 +208,28 @@ namespace Microsoft.Iris.Input DragOperation formOperation, RawDragData rawEventData) { - if (this._dragSource == null) + if (_dragSource == null) { - if (formOperation == DragOperation.Over && data == null && this._pendingDragData != null) + if (formOperation == DragOperation.Over && data == null && _pendingDragData != null) { - data = this._pendingDragData; + data = _pendingDragData; formOperation = DragOperation.Enter; } - this._pendingDragData = null; - InputItem dragDropItem = this.GenerateDragDropItem(null, rawSite, data, x, y, modifiers, formOperation); + _pendingDragData = null; + InputItem dragDropItem = GenerateDragDropItem(null, rawSite, data, x, y, modifiers, formOperation); if (dragDropItem == null) return; - this.PostItem(dragDropItem); + PostItem(dragDropItem); } else if (formOperation == DragOperation.Enter) { - this._pendingDragData = data; + _pendingDragData = data; } else { if (formOperation != DragOperation.Leave) return; - this._pendingDragData = null; + _pendingDragData = null; } } @@ -243,53 +243,53 @@ namespace Microsoft.Iris.Input DragOperation formOperation) { InputItem inputItem = null; - IRawInputSite rawDropTargetSite = this._rawDropTargetSite; + IRawInputSite rawDropTargetSite = _rawDropTargetSite; if (formOperation == DragOperation.Enter) - this._dragData = data; - this._rawDropTargetSite = rawSite; - this._rawDragPoint = new Point(x, y); - this._rawDragModifiers = modifiers; + _dragData = data; + _rawDropTargetSite = rawSite; + _rawDragPoint = new Point(x, y); + _rawDragModifiers = modifiers; if (formOperation != DragOperation.Drop) { - this._dragging = true; + _dragging = true; if (rawDropTargetSite == rawSite) { - if (!this._dragOver) + if (!_dragOver) { - this._dragOver = true; - this.OnWake(); + _dragOver = true; + OnWake(); } } else - inputItem = this.GenerateDragDrop(null, rawSite, x, y, modifiers, DragOperation.Over); + inputItem = GenerateDragDrop(null, rawSite, x, y, modifiers, DragOperation.Over); } else { - inputItem = this.GenerateDragDrop(this._appDropTarget, rawSite, x, y, modifiers, DragOperation.Drop); - this._appDropTarget = null; + inputItem = GenerateDragDrop(_appDropTarget, rawSite, x, y, modifiers, DragOperation.Drop); + _appDropTarget = null; } if (formOperation == DragOperation.Drop || formOperation == DragOperation.Leave) { - this._dragOver = false; - this._dragging = false; - this._rawDropTargetSite = null; - this._rawDragPoint = new Point(); - this._rawDragModifiers = InputModifiers.None; + _dragOver = false; + _dragging = false; + _rawDropTargetSite = null; + _rawDragPoint = new Point(); + _rawDragModifiers = InputModifiers.None; if (formOperation == DragOperation.Leave) - this._dragData = null; + _dragData = null; } return inputItem; } public object GetDragDropValue() { - object dragData = this._dragData; - if (!this._dragging) - this._dragData = null; + object dragData = _dragData; + if (!_dragging) + _dragData = null; return dragData; } - public void RawInputIdleItem(QueueItem item) => this._inputIdleQueue.PostItem(item); + public void RawInputIdleItem(QueueItem item) => _inputIdleQueue.PostItem(item); public void RevalidateInputSiteUsage(ICookedInputSite target, bool recursiveFlag) { @@ -298,26 +298,26 @@ namespace Microsoft.Iris.Input { if (!recursiveFlag) { - this._revalidateKeyFocus = true; - this._revalidateMouseFocus = true; - this.SetMouseMoved(); + _revalidateKeyFocus = true; + _revalidateMouseFocus = true; + SetMouseMoved(); return; } flag1 = true; } - this.CancelMouseCapture(target); + CancelMouseCapture(target); bool flag2 = false; - if (!this._mouseMoved && this._appMouseFocusTarget != null && (flag1 || this._appMouseFocusTarget == target || recursiveFlag && this._inputManager.IsSiteInfluencedByPeer(this._appMouseFocusTarget, target))) + if (!_mouseMoved && _appMouseFocusTarget != null && (flag1 || _appMouseFocusTarget == target || recursiveFlag && _inputManager.IsSiteInfluencedByPeer(_appMouseFocusTarget, target))) { - this._revalidateMouseFocus = true; - this.SetMouseMoved(); - if (this._appMouseFocusTarget == this._desiredKeyFocus) + _revalidateMouseFocus = true; + SetMouseMoved(); + if (_appMouseFocusTarget == _desiredKeyFocus) flag2 = true; } - if (this._revalidateKeyFocus || !flag2 && (this._desiredKeyFocus == null || !flag1 && this._desiredKeyFocus != target && (!recursiveFlag || !this._inputManager.IsSiteInfluencedByPeer(this._desiredKeyFocus, target)))) + if (_revalidateKeyFocus || !flag2 && (_desiredKeyFocus == null || !flag1 && _desiredKeyFocus != target && (!recursiveFlag || !_inputManager.IsSiteInfluencedByPeer(_desiredKeyFocus, target)))) return; - this._revalidateKeyFocus = true; - this.OnWake(); + _revalidateKeyFocus = true; + OnWake(); } public override QueueItem GetNextItem() @@ -329,12 +329,12 @@ namespace Microsoft.Iris.Input QueueItem queueItem2; do { - queueItem2 = this.PeekFilterStack(); + queueItem2 = PeekFilterStack(); if (queueItem2 != null) { - queueItem1 = this.FilterItem(queueItem2); + queueItem1 = FilterItem(queueItem2); if (queueItem1 == null) - this.PopFilterStack(); + PopFilterStack(); else goto label_5; } @@ -348,29 +348,29 @@ namespace Microsoft.Iris.Input label_5: if (queueItem1 != queueItem2) { - this.PushFilterStack(queueItem1); + PushFilterStack(queueItem1); queueItem1 = null; } else break; } - this.PopFilterStack(); + PopFilterStack(); label_8: return queueItem1; } - private void PushFilterStack(QueueItem item) => this._filterStack.Push(item); + private void PushFilterStack(QueueItem item) => _filterStack.Push(item); - private QueueItem PopFilterStack() => this._filterStack.Pop(); + private QueueItem PopFilterStack() => _filterStack.Pop(); private QueueItem PeekFilterStack() { - QueueItem queueItem = this._filterStack.Peek(); + QueueItem queueItem = _filterStack.Peek(); if (queueItem == null) { - queueItem = this.GetNextRawInputItem(); + queueItem = GetNextRawInputItem(); if (queueItem != null) - this.PushFilterStack(queueItem); + PushFilterStack(queueItem); } return queueItem; } @@ -382,60 +382,60 @@ namespace Microsoft.Iris.Input switch (inputItem.Info) { case MouseActionInfo mouseActionInfo: - this.MapMouseInput(mouseActionInfo); + MapMouseInput(mouseActionInfo); Point clientOffset = new Point(mouseActionInfo.X, mouseActionInfo.Y); switch (mouseActionInfo) { case MouseMoveInfo _: - QueueItem queueItem1 = this.UpdateMouseFocus(mouseActionInfo.Target, mouseActionInfo.RawSource, clientOffset); + QueueItem queueItem1 = UpdateMouseFocus(mouseActionInfo.Target, mouseActionInfo.RawSource, clientOffset); if (queueItem1 != null) return queueItem1; - if (this.IsAppMouseMove(mouseActionInfo)) + if (IsAppMouseMove(mouseActionInfo)) { - this.FinalizeMouseHit(inputItem, mouseActionInfo); + FinalizeMouseHit(inputItem, mouseActionInfo); break; } item = null; break; case MouseButtonInfo mouseButtonInfo: - if (this.IsAppMouseMove(mouseActionInfo)) + if (IsAppMouseMove(mouseActionInfo)) { InputModifiers modifiers1 = mouseButtonInfo.Modifiers; - InputModifiers modifiersForButtons = this.GetModifiersForButtons(mouseButtonInfo.Button); + InputModifiers modifiersForButtons = GetModifiersForButtons(mouseButtonInfo.Button); InputModifiers modifiers2 = !mouseButtonInfo.IsDown ? modifiers1 | modifiersForButtons : modifiers1 & ~modifiersForButtons; - return this.GenerateMouseMove(mouseActionInfo.RawSource, mouseActionInfo.NaturalHit, mouseActionInfo.X, mouseActionInfo.Y, mouseButtonInfo.ScreenX, mouseButtonInfo.ScreenY, modifiers2); + return GenerateMouseMove(mouseActionInfo.RawSource, mouseActionInfo.NaturalHit, mouseActionInfo.X, mouseActionInfo.Y, mouseButtonInfo.ScreenX, mouseButtonInfo.ScreenY, modifiers2); } - this.FinalizeMouseHit(inputItem, mouseActionInfo); - this.UpdateMouseCapture(mouseActionInfo.RawSource, mouseActionInfo.Target, mouseButtonInfo.Modifiers); - this._appMouseFocusButtons = mouseButtonInfo.Modifiers & InputModifiers.AllButtons; + FinalizeMouseHit(inputItem, mouseActionInfo); + UpdateMouseCapture(mouseActionInfo.RawSource, mouseActionInfo.Target, mouseButtonInfo.Modifiers); + _appMouseFocusButtons = mouseButtonInfo.Modifiers & InputModifiers.AllButtons; break; case MouseWheelInfo _: - inputItem.UpdateInputSite(this._appMouseFocusTarget); + inputItem.UpdateInputSite(_appMouseFocusTarget); break; } break; case MouseFocusInfo mouseFocusInfo: - if (!mouseFocusInfo.State && this._appMouseFocusButtons != InputModifiers.None) + if (!mouseFocusInfo.State && _appMouseFocusButtons != InputModifiers.None) { - QueueItem queueItem2 = this.UpdateOrphanedButtons(mouseFocusInfo.RawSource, mouseFocusInfo.X, mouseFocusInfo.Y); + QueueItem queueItem2 = UpdateOrphanedButtons(mouseFocusInfo.RawSource, mouseFocusInfo.X, mouseFocusInfo.Y); if (queueItem2 != null) return queueItem2; break; } break; case KeyActionInfo _: - QueueItem queueItem3 = this.UpdateKeyFocus(); + QueueItem queueItem3 = UpdateKeyFocus(); if (queueItem3 != null) return queueItem3; - inputItem.UpdateInputSite(this._currentKeyFocus); + inputItem.UpdateInputSite(_currentKeyFocus); break; case DragDropInfo dragDropInfo: if (dragDropInfo.Operation == DragOperation.Over) { - InputItem inputItemB = this.UpdateDragOver(this._inputManager.HitTestInput(this._rawDropTargetSite, null)); + InputItem inputItemB = UpdateDragOver(_inputManager.HitTestInput(_rawDropTargetSite, null)); if (inputItemB != null) return inputItemB; - inputItemB.UpdateInputSite(this._appDropTarget); + inputItemB.UpdateInputSite(_appDropTarget); break; } break; @@ -463,94 +463,94 @@ namespace Microsoft.Iris.Input private QueueItem GetNextRawInputItem() { QueueItem queueItem; - if ((queueItem = this.InjectRawInput_Prty()) == null && (queueItem = this.InjectRawInput_Norm()) == null) - queueItem = this.InjectRawInput_Idle(); + if ((queueItem = InjectRawInput_Prty()) == null && (queueItem = InjectRawInput_Norm()) == null) + queueItem = InjectRawInput_Idle(); return queueItem; } - private QueueItem InjectRawInput_Prty() => this.UpdateKeyFocus(); + private QueueItem InjectRawInput_Prty() => UpdateKeyFocus(); private QueueItem InjectRawInput_Norm() => base.GetNextItem(); private QueueItem InjectRawInput_Idle() { - if (this._mouseWheelDelta != 0) + if (_mouseWheelDelta != 0) { - QueueItem mouseWheel = this.GenerateMouseWheel(this._rawMouseSite, this._rawMouseNaturalSite, this._rawMousePos.X, this._rawMousePos.Y, this._rawScreenPos.X, this._rawScreenPos.Y, this._rawMouseModifiers, this._mouseWheelDelta); - this._mouseWheelDelta = 0; + QueueItem mouseWheel = GenerateMouseWheel(_rawMouseSite, _rawMouseNaturalSite, _rawMousePos.X, _rawMousePos.Y, _rawScreenPos.X, _rawScreenPos.Y, _rawMouseModifiers, _mouseWheelDelta); + _mouseWheelDelta = 0; return mouseWheel; } - if (this._mouseMoved) + if (_mouseMoved) { - QueueItem mouseMove = this.GenerateMouseMove(this._rawMouseSite, this._rawMouseNaturalSite, this._rawMousePos.X, this._rawMousePos.Y, this._rawScreenPos.X, this._rawScreenPos.Y, this._rawMouseModifiers); - this._mouseMoved = false; + QueueItem mouseMove = GenerateMouseMove(_rawMouseSite, _rawMouseNaturalSite, _rawMousePos.X, _rawMousePos.Y, _rawScreenPos.X, _rawScreenPos.Y, _rawMouseModifiers); + _mouseMoved = false; return mouseMove; } - if (!this._dragOver) - return this._inputIdleQueue.GetNextItem(); - InputItem dragDrop = this.GenerateDragDrop(null, this._rawDropTargetSite, this._rawDragPoint.X, this._rawDragPoint.Y, this._rawDragModifiers, DragOperation.Over); - this._dragOver = false; + if (!_dragOver) + return _inputIdleQueue.GetNextItem(); + InputItem dragDrop = GenerateDragDrop(null, _rawDropTargetSite, _rawDragPoint.X, _rawDragPoint.Y, _rawDragModifiers, DragOperation.Over); + _dragOver = false; return dragDrop; } - private void OnChildQueueWake(object sender, EventArgs args) => this.OnWake(); + private void OnChildQueueWake(object sender, EventArgs args) => OnWake(); - private void MapMouseInput(MouseActionInfo info) => this._inputManager.MapMouseInput(info, this._appMouseFocusCapture); + private void MapMouseInput(MouseActionInfo info) => _inputManager.MapMouseInput(info, _appMouseFocusCapture); private void FinalizeMouseHit(InputItem item, MouseActionInfo mouse) { item.UpdateInputSite(mouse.Target); - this._appMousePos = new Point(mouse.X, mouse.Y); - this._appNaturalTarget = mouse.NaturalHit; + _appMousePos = new Point(mouse.X, mouse.Y); + _appNaturalTarget = mouse.NaturalHit; } private QueueItem CheckForInvalidKeyFocus() { QueueItem queueItem = null; - if (!this.IsValidInputSite(this._desiredKeyFocus) || !this._inputManager.IsValidKeyFocusSite(this._desiredKeyFocus)) + if (!IsValidInputSite(_desiredKeyFocus) || !_inputManager.IsValidKeyFocusSite(_desiredKeyFocus)) { - ++this._keyFocusRepairCount; - this._revalidateKeyFocus = true; - queueItem = this.GenerateInvalidKeyFocusCallback(); + ++_keyFocusRepairCount; + _revalidateKeyFocus = true; + queueItem = GenerateInvalidKeyFocusCallback(); } else { - int focusRepairCount = (int)this._keyFocusRepairCount; - this._keyFocusRepairCount = 0U; - this._revalidateKeyFocus = false; + int focusRepairCount = (int)_keyFocusRepairCount; + _keyFocusRepairCount = 0U; + _revalidateKeyFocus = false; } return queueItem; } - private void InvalidKeyFocusCallback() => this._inputManager.RepairInvalidKeyFocus(this._keyFocusRepairCount); + private void InvalidKeyFocusCallback() => _inputManager.RepairInvalidKeyFocus(_keyFocusRepairCount); private QueueItem UpdateKeyFocus() { QueueItem queueItem = null; - if (this._revalidateKeyFocus || this._currentKeyFocus != this._desiredKeyFocus) + if (_revalidateKeyFocus || _currentKeyFocus != _desiredKeyFocus) { - queueItem = this.CheckForInvalidKeyFocus(); - if (queueItem == null && this._currentKeyFocus != this._desiredKeyFocus) + queueItem = CheckForInvalidKeyFocus(); + if (queueItem == null && _currentKeyFocus != _desiredKeyFocus) { - if (this._currentKeyFocus != null) + if (_currentKeyFocus != null) { - if (!this.IsValidInputSite(this._currentKeyFocus)) - this._currentKeyFocus = null; - queueItem = this.GenerateKeyFocus(this._currentKeyFocus, false, this._desiredKeyFocus, this._desiredKeyFocusReason); - this._currentKeyFocus = null; + if (!IsValidInputSite(_currentKeyFocus)) + _currentKeyFocus = null; + queueItem = GenerateKeyFocus(_currentKeyFocus, false, _desiredKeyFocus, _desiredKeyFocusReason); + _currentKeyFocus = null; } - if (queueItem == null && this._desiredKeyFocus != null) + if (queueItem == null && _desiredKeyFocus != null) { - this._currentKeyFocus = this._desiredKeyFocus; - if (!this.IsValidInputSite(this._lastCompletedKeyFocus)) - this._lastCompletedKeyFocus = null; - queueItem = this.GenerateKeyFocus(this._currentKeyFocus, true, this._lastCompletedKeyFocus, this._desiredKeyFocusReason); + _currentKeyFocus = _desiredKeyFocus; + if (!IsValidInputSite(_lastCompletedKeyFocus)) + _lastCompletedKeyFocus = null; + queueItem = GenerateKeyFocus(_currentKeyFocus, true, _lastCompletedKeyFocus, _desiredKeyFocusReason); } - if (this._currentKeyFocus == this._desiredKeyFocus) - this._lastCompletedKeyFocus = this._currentKeyFocus; + if (_currentKeyFocus == _desiredKeyFocus) + _lastCompletedKeyFocus = _currentKeyFocus; } - if (queueItem == null && this._currentKeyFocus != null) - queueItem = this.GenerateKeyFocus(this._currentKeyFocus, true, this._lastCompletedKeyFocus, KeyFocusReason.Validation); + if (queueItem == null && _currentKeyFocus != null) + queueItem = GenerateKeyFocus(_currentKeyFocus, true, _lastCompletedKeyFocus, KeyFocusReason.Validation); } return queueItem; } @@ -561,34 +561,34 @@ namespace Microsoft.Iris.Input Point clientOffset) { QueueItem queueItem = null; - if (this._revalidateMouseFocus || this._appMouseFocusTarget != target) + if (_revalidateMouseFocus || _appMouseFocusTarget != target) { - this._revalidateMouseFocus = false; - if (this._appMouseFocusTarget != target) + _revalidateMouseFocus = false; + if (_appMouseFocusTarget != target) { - if (this._appMouseFocusTarget != null) + if (_appMouseFocusTarget != null) { - if (!this.IsValidInputSite(this._appMouseFocusTarget)) - this._appMouseFocusTarget = null; - queueItem = this.GenerateMouseFocus(this._appMouseFocusTarget, this._appMouseFocusSite, this._appMousePos.X, this._appMousePos.Y, false, target); - this._appMouseFocusSite = null; - this._appMouseFocusTarget = null; - this._appMousePos.X = -1; - this._appMousePos.Y = -1; + if (!IsValidInputSite(_appMouseFocusTarget)) + _appMouseFocusTarget = null; + queueItem = GenerateMouseFocus(_appMouseFocusTarget, _appMouseFocusSite, _appMousePos.X, _appMousePos.Y, false, target); + _appMouseFocusSite = null; + _appMouseFocusTarget = null; + _appMousePos.X = -1; + _appMousePos.Y = -1; } if (queueItem == null && target != null) { - this._appMouseFocusSite = site; - this._appMouseFocusTarget = target; - if (!this.IsValidInputSite(this._lastCompletedMouseFocus)) - this._lastCompletedMouseFocus = null; - queueItem = this.GenerateMouseFocus(this._appMouseFocusTarget, this._appMouseFocusSite, clientOffset.X, clientOffset.Y, true, this._lastCompletedMouseFocus); + _appMouseFocusSite = site; + _appMouseFocusTarget = target; + if (!IsValidInputSite(_lastCompletedMouseFocus)) + _lastCompletedMouseFocus = null; + queueItem = GenerateMouseFocus(_appMouseFocusTarget, _appMouseFocusSite, clientOffset.X, clientOffset.Y, true, _lastCompletedMouseFocus); } - if (this._appMouseFocusTarget == target) - this._lastCompletedMouseFocus = this._appMouseFocusTarget; + if (_appMouseFocusTarget == target) + _lastCompletedMouseFocus = _appMouseFocusTarget; } - if (queueItem == null && this._appMouseFocusTarget != null) - queueItem = this.GenerateMouseFocus(this._appMouseFocusTarget, this._appMouseFocusSite, clientOffset.X, clientOffset.Y, true, this._lastCompletedMouseFocus); + if (queueItem == null && _appMouseFocusTarget != null) + queueItem = GenerateMouseFocus(_appMouseFocusTarget, _appMouseFocusSite, clientOffset.X, clientOffset.Y, true, _lastCompletedMouseFocus); } return queueItem; } @@ -602,96 +602,96 @@ namespace Microsoft.Iris.Input ICookedInputSite cookedInputSite = null; if (flag) cookedInputSite = target; - if (this._appMouseFocusCapture == cookedInputSite) + if (_appMouseFocusCapture == cookedInputSite) return; - this._inputManager.RequestHostMouseCapture(site, cookedInputSite != null); - this._appMouseFocusCapture = cookedInputSite; - this.SetMouseMoved(); + _inputManager.RequestHostMouseCapture(site, cookedInputSite != null); + _appMouseFocusCapture = cookedInputSite; + SetMouseMoved(); } private QueueItem UpdateOrphanedButtons(IRawInputSite site, int x, int y) { MouseButtons button; uint message; - if ((this._appMouseFocusButtons & InputModifiers.LeftMouse) != InputModifiers.None) + if ((_appMouseFocusButtons & InputModifiers.LeftMouse) != InputModifiers.None) { - this._appMouseFocusButtons &= ~InputModifiers.LeftMouse; + _appMouseFocusButtons &= ~InputModifiers.LeftMouse; button = MouseButtons.Left; message = 514U; } - else if ((this._appMouseFocusButtons & InputModifiers.MiddleMouse) != InputModifiers.None) + else if ((_appMouseFocusButtons & InputModifiers.MiddleMouse) != InputModifiers.None) { - this._appMouseFocusButtons &= ~InputModifiers.MiddleMouse; + _appMouseFocusButtons &= ~InputModifiers.MiddleMouse; button = MouseButtons.Middle; message = 520U; } - else if ((this._appMouseFocusButtons & InputModifiers.RightMouse) != InputModifiers.None) + else if ((_appMouseFocusButtons & InputModifiers.RightMouse) != InputModifiers.None) { - this._appMouseFocusButtons &= ~InputModifiers.RightMouse; + _appMouseFocusButtons &= ~InputModifiers.RightMouse; button = MouseButtons.Right; message = 517U; } - else if ((this._appMouseFocusButtons & InputModifiers.XMouse1) != InputModifiers.None) + else if ((_appMouseFocusButtons & InputModifiers.XMouse1) != InputModifiers.None) { - this._appMouseFocusButtons &= ~InputModifiers.XMouse1; + _appMouseFocusButtons &= ~InputModifiers.XMouse1; button = MouseButtons.XButton1; message = 524U; } - else if ((this._appMouseFocusButtons & InputModifiers.XMouse2) != InputModifiers.None) + else if ((_appMouseFocusButtons & InputModifiers.XMouse2) != InputModifiers.None) { - this._appMouseFocusButtons &= ~InputModifiers.XMouse2; + _appMouseFocusButtons &= ~InputModifiers.XMouse2; button = MouseButtons.XButton2; message = 524U; } else { - this._appMouseFocusButtons = InputModifiers.None; + _appMouseFocusButtons = InputModifiers.None; return null; } - return this.GenerateMouseButton(site, null, x, y, this._rawScreenPos.X, this._rawScreenPos.Y, this._appMouseFocusButtons, button, false, message); + return GenerateMouseButton(site, null, x, y, _rawScreenPos.X, _rawScreenPos.Y, _appMouseFocusButtons, button, false, message); } private InputItem UpdateDragOver(ICookedInputSite target) { - if (target != this._appDropTarget) + if (target != _appDropTarget) { - if (this._appDropTarget != null) + if (_appDropTarget != null) { - ICookedInputSite appDropTarget = this._appDropTarget; - this._appDropTarget = null; - return this.GenerateDragDrop(appDropTarget, null, this._rawDragPoint.X, this._rawDragPoint.Y, this._rawMouseModifiers, DragOperation.Leave); + ICookedInputSite appDropTarget = _appDropTarget; + _appDropTarget = null; + return GenerateDragDrop(appDropTarget, null, _rawDragPoint.X, _rawDragPoint.Y, _rawMouseModifiers, DragOperation.Leave); } if (target != null) { - this._appDropTarget = target; - return this.GenerateDragDrop(target, this._rawDropTargetSite, this._rawDragPoint.X, this._rawDragPoint.Y, this._rawDragModifiers, DragOperation.Enter); + _appDropTarget = target; + return GenerateDragDrop(target, _rawDropTargetSite, _rawDragPoint.X, _rawDragPoint.Y, _rawDragModifiers, DragOperation.Enter); } } return null; } - private bool IsAppMouseMove(MouseActionInfo mouseInfo) => mouseInfo.Target != this._appMouseFocusTarget || mouseInfo.NaturalHit != this._appNaturalTarget || mouseInfo.X != this._appMousePos.X || mouseInfo.Y != this._appMousePos.Y; + private bool IsAppMouseMove(MouseActionInfo mouseInfo) => mouseInfo.Target != _appMouseFocusTarget || mouseInfo.NaturalHit != _appNaturalTarget || mouseInfo.X != _appMousePos.X || mouseInfo.Y != _appMousePos.Y; - private bool IsValidInputSite(ICookedInputSite target) => target == null || this._inputManager.IsValidCookedInputSite(target); + private bool IsValidInputSite(ICookedInputSite target) => target == null || _inputManager.IsValidCookedInputSite(target); private void SetMouseMoved() { - if (this._mouseMoved) + if (_mouseMoved) return; - this._mouseMoved = true; - this.OnWake(); + _mouseMoved = true; + OnWake(); } private void CancelMouseCapture(ICookedInputSite cancelSite) { - if (this._appMouseFocusCapture == null || cancelSite != this._appMouseFocusCapture && cancelSite != null) + if (_appMouseFocusCapture == null || cancelSite != _appMouseFocusCapture && cancelSite != null) return; - this.UpdateMouseCapture(this._appMouseFocusCapture.RawInputSource, null, InputModifiers.None); + UpdateMouseCapture(_appMouseFocusCapture.RawInputSource, null, InputModifiers.None); } - private QueueItem GenerateGenericInput(InputInfo info) => InputItem.Create(this._inputManager, null, info); + private QueueItem GenerateGenericInput(InputInfo info) => InputItem.Create(_inputManager, null, info); - private QueueItem GenerateInvalidKeyFocusCallback() => DeferredCall.Create(this._invalidKeyFocusCallback); + private QueueItem GenerateInvalidKeyFocusCallback() => DeferredCall.Create(_invalidKeyFocusCallback); private QueueItem GenerateKeyFocus( ICookedInputSite target, @@ -699,7 +699,7 @@ namespace Microsoft.Iris.Input ICookedInputSite other, KeyFocusReason reason) { - return InputItem.Create(this._inputManager, target, KeyFocusInfo.Create(focus, other, reason)); + return InputItem.Create(_inputManager, target, KeyFocusInfo.Create(focus, other, reason)); } private InputItem GenerateMouseFocus( @@ -710,7 +710,7 @@ namespace Microsoft.Iris.Input bool focus, ICookedInputSite other) { - return InputItem.Create(this._inputManager, target, MouseFocusInfo.Create(site, x, y, focus, other)); + return InputItem.Create(_inputManager, target, MouseFocusInfo.Create(site, x, y, focus, other)); } private InputItem GenerateMouseMove( @@ -722,7 +722,7 @@ namespace Microsoft.Iris.Input int screenY, InputModifiers modifiers) { - return InputItem.Create(this._inputManager, null, MouseMoveInfo.Create(site, naturalSite, x, y, screenX, screenY, modifiers)); + return InputItem.Create(_inputManager, null, MouseMoveInfo.Create(site, naturalSite, x, y, screenX, screenY, modifiers)); } private InputItem GenerateMouseButton( @@ -737,7 +737,7 @@ namespace Microsoft.Iris.Input bool state, uint message) { - return InputItem.Create(this._inputManager, null, MouseButtonInfo.Create(site, naturalSite, x, y, screenX, screenY, modifiers, button, state, message)); + return InputItem.Create(_inputManager, null, MouseButtonInfo.Create(site, naturalSite, x, y, screenX, screenY, modifiers, button, state, message)); } private InputItem GenerateMouseWheel( @@ -750,7 +750,7 @@ namespace Microsoft.Iris.Input InputModifiers modifiers, int wheelDelta) { - return InputItem.Create(this._inputManager, null, MouseWheelInfo.Create(site, naturalSite, x, y, screenX, screenY, modifiers, wheelDelta)); + return InputItem.Create(_inputManager, null, MouseWheelInfo.Create(site, naturalSite, x, y, screenX, screenY, modifiers, wheelDelta)); } private InputItem GenerateDragDrop( @@ -762,7 +762,7 @@ namespace Microsoft.Iris.Input DragOperation operation) { InputInfo info = DragDropInfo.Create(rawSite, x, y, modifiers, operation); - return InputItem.Create(this._inputManager, cookedSite, info); + return InputItem.Create(_inputManager, cookedSite, info); } } } diff --git a/UIX/Microsoft/Iris/Input/KeyActionInfo.cs b/UIX/Microsoft/Iris/Input/KeyActionInfo.cs index 3bc0d60..5e836b1 100644 --- a/UIX/Microsoft/Iris/Input/KeyActionInfo.cs +++ b/UIX/Microsoft/Iris/Input/KeyActionInfo.cs @@ -31,15 +31,15 @@ namespace Microsoft.Iris.Input int scanCode, ushort eventFlags) { - this._systemKey = systemKey; - this._action = action; - this._deviceType = deviceType; - this._modifiers = modifiers; - this._repeatCount = repeatCount; - this._nativeMessageID = nativeMessageID; - this._scanCode = scanCode; - this._eventFlags = eventFlags; - this.Initialize(eventType); + _systemKey = systemKey; + _action = action; + _deviceType = deviceType; + _modifiers = modifiers; + _repeatCount = repeatCount; + _nativeMessageID = nativeMessageID; + _scanCode = scanCode; + _eventFlags = eventFlags; + Initialize(eventType); } protected void Initialize( @@ -47,25 +47,25 @@ namespace Microsoft.Iris.Input InputEventType eventType, InputDeviceType deviceType) { - this.Initialize(action, eventType, deviceType, InputModifiers.None, 1U, false, 0U, 0, 0); + Initialize(action, eventType, deviceType, InputModifiers.None, 1U, false, 0U, 0, 0); } - public KeyAction Action => this._action; + public KeyAction Action => _action; - public InputDeviceType DeviceType => this._deviceType; + public InputDeviceType DeviceType => _deviceType; - public InputModifiers Modifiers => this._modifiers; + public InputModifiers Modifiers => _modifiers; - public uint RepeatCount => this._repeatCount; + public uint RepeatCount => _repeatCount; - public bool SystemKey => this._systemKey; + public bool SystemKey => _systemKey; - public uint NativeMessageID => this._nativeMessageID; + public uint NativeMessageID => _nativeMessageID; - public int ScanCode => this._scanCode; + public int ScanCode => _scanCode; - public ushort KeyboardFlags => this._eventFlags; + public ushort KeyboardFlags => _eventFlags; - public bool IsRepeatOf(KeyActionInfo other) => other != null && this._action == other._action && (this._deviceType == other._deviceType && this._systemKey == other._systemKey) && this._modifiers == other._modifiers; + public bool IsRepeatOf(KeyActionInfo other) => other != null && _action == other._action && (_deviceType == other._deviceType && _systemKey == other._systemKey) && _modifiers == other._modifiers; } } diff --git a/UIX/Microsoft/Iris/Input/KeyCharacterInfo.cs b/UIX/Microsoft/Iris/Input/KeyCharacterInfo.cs index 1696e4d..1c4c1fc 100644 --- a/UIX/Microsoft/Iris/Input/KeyCharacterInfo.cs +++ b/UIX/Microsoft/Iris/Input/KeyCharacterInfo.cs @@ -46,14 +46,14 @@ namespace Microsoft.Iris.Input int scanCode, ushort eventFlags) { - this._character = character; - this.Initialize(action, InputEventType.KeyCharacter, deviceType, modifiers, repeatCount, systemKey, nativeMessageID, scanCode, eventFlags); + _character = character; + Initialize(action, InputEventType.KeyCharacter, deviceType, modifiers, repeatCount, systemKey, nativeMessageID, scanCode, eventFlags); } - public char Character => this._character; + public char Character => _character; protected override InputInfo.InfoType PoolType => s_poolType; - public override string ToString() => InvariantString.Format("{0}({1}, Key={2})", this.GetType().Name, Action, _character); + public override string ToString() => InvariantString.Format("{0}({1}, Key={2})", GetType().Name, Action, _character); } } diff --git a/UIX/Microsoft/Iris/Input/KeyCommandInfo.cs b/UIX/Microsoft/Iris/Input/KeyCommandInfo.cs index f2d2ef8..63eec4e 100644 --- a/UIX/Microsoft/Iris/Input/KeyCommandInfo.cs +++ b/UIX/Microsoft/Iris/Input/KeyCommandInfo.cs @@ -31,14 +31,14 @@ namespace Microsoft.Iris.Input private void Initialize(KeyAction action, InputDeviceType deviceType, CommandCode command) { - this._command = command; - this.Initialize(action, action == KeyAction.Down ? InputEventType.CommandDown : InputEventType.CommandUp, deviceType); + _command = command; + Initialize(action, action == KeyAction.Down ? InputEventType.CommandDown : InputEventType.CommandUp, deviceType); } - public CommandCode Command => this._command; + public CommandCode Command => _command; protected override InputInfo.InfoType PoolType => s_poolType; - public override string ToString() => InvariantString.Format("{0}({1}, Command={2})", this.GetType().Name, Action, _command); + public override string ToString() => InvariantString.Format("{0}({1}, Command={2})", GetType().Name, Action, _command); } } diff --git a/UIX/Microsoft/Iris/Input/KeyFocusInfo.cs b/UIX/Microsoft/Iris/Input/KeyFocusInfo.cs index 3b42e99..1ad242f 100644 --- a/UIX/Microsoft/Iris/Input/KeyFocusInfo.cs +++ b/UIX/Microsoft/Iris/Input/KeyFocusInfo.cs @@ -31,23 +31,23 @@ namespace Microsoft.Iris.Input private void Initialize(bool state, ICookedInputSite other, KeyFocusReason focusReason) { - this._state = state; - this._other = other; - this._focusReason = focusReason; - this.Initialize(state ? InputEventType.GainKeyFocus : InputEventType.LoseKeyFocus); + _state = state; + _other = other; + _focusReason = focusReason; + Initialize(state ? InputEventType.GainKeyFocus : InputEventType.LoseKeyFocus); } protected override void Zombie() { base.Zombie(); - this._other = null; + _other = null; } - public bool State => this._state; + public bool State => _state; - public ICookedInputSite Other => this._other; + public ICookedInputSite Other => _other; - public KeyFocusReason FocusReason => this._focusReason; + public KeyFocusReason FocusReason => _focusReason; protected override InputInfo.InfoType PoolType => s_poolType; } diff --git a/UIX/Microsoft/Iris/Input/KeyStateInfo.cs b/UIX/Microsoft/Iris/Input/KeyStateInfo.cs index e86e297..1df0586 100644 --- a/UIX/Microsoft/Iris/Input/KeyStateInfo.cs +++ b/UIX/Microsoft/Iris/Input/KeyStateInfo.cs @@ -46,18 +46,18 @@ namespace Microsoft.Iris.Input int scanCode, ushort eventFlags) { - this._key = key; - this.Initialize(action, action == KeyAction.Down ? InputEventType.KeyDown : InputEventType.KeyUp, deviceType, modifiers, repeatCount, systemKey, nativeMessageID, scanCode, eventFlags); + _key = key; + Initialize(action, action == KeyAction.Down ? InputEventType.KeyDown : InputEventType.KeyUp, deviceType, modifiers, repeatCount, systemKey, nativeMessageID, scanCode, eventFlags); } - public bool IsRepeatOf(KeyStateInfo other) => other != null && this._key == other._key && this.IsRepeatOf((KeyActionInfo)other); + public bool IsRepeatOf(KeyStateInfo other) => other != null && _key == other._key && IsRepeatOf((KeyActionInfo)other); - public KeyStateInfo MakeRepeatableCopy() => Create(this.Action, this.DeviceType, this.Modifiers, this.RepeatCount, this._key, this.SystemKey, this.NativeMessageID, this.ScanCode, this.KeyboardFlags); + public KeyStateInfo MakeRepeatableCopy() => Create(Action, DeviceType, Modifiers, RepeatCount, _key, SystemKey, NativeMessageID, ScanCode, KeyboardFlags); - public Keys Key => this._key; + public Keys Key => _key; protected override InputInfo.InfoType PoolType => s_poolType; - public override string ToString() => InvariantString.Format("{0}({1}, Key={2})", this.GetType().Name, Action, _key); + public override string ToString() => InvariantString.Format("{0}({1}, Key={2})", GetType().Name, Action, _key); } } diff --git a/UIX/Microsoft/Iris/Input/KeyboardDevice.cs b/UIX/Microsoft/Iris/Input/KeyboardDevice.cs index 3010f89..0743d58 100644 --- a/UIX/Microsoft/Iris/Input/KeyboardDevice.cs +++ b/UIX/Microsoft/Iris/Input/KeyboardDevice.cs @@ -24,38 +24,38 @@ namespace Microsoft.Iris.Input public KeyboardDevice(InputManager manager) : base(manager) { - this._keyStates = new ExpandableArray(4); - this.Reset(); + _keyStates = new ExpandableArray(4); + Reset(); } public InputModifiers KeyboardModifiers { get { - if (this._modifiersDirty) - this.UpdateModifierState(); - return this._keyModifiers & InputModifiers.AllKeys; + if (_modifiersDirty) + UpdateModifierState(); + return _keyModifiers & InputModifiers.AllKeys; } } - public bool Alt => (this.KeyboardModifiers & InputModifiers.AltKey) != InputModifiers.None; + public bool Alt => (KeyboardModifiers & InputModifiers.AltKey) != InputModifiers.None; - public bool Ctrl => (this.KeyboardModifiers & InputModifiers.ControlKey) != InputModifiers.None; + public bool Ctrl => (KeyboardModifiers & InputModifiers.ControlKey) != InputModifiers.None; - public bool Shift => (this.KeyboardModifiers & InputModifiers.ShiftKey) != InputModifiers.None; + public bool Shift => (KeyboardModifiers & InputModifiers.ShiftKey) != InputModifiers.None; - public bool Win => (this.KeyboardModifiers & InputModifiers.WindowsKey) != InputModifiers.None; + public bool Win => (KeyboardModifiers & InputModifiers.WindowsKey) != InputModifiers.None; internal KeyInfo OnRawInput( uint message, InputModifiers modifiers, ref RawKeyboardData args) { - this.Manager.HACK_UpdateSystemModifiers(modifiers); - return message == 2U || message == 5U ? this.OnRawKeyCharacter(message, ref args) : this.OnRawKeyState(message, modifiers, ref args); + Manager.HACK_UpdateSystemModifiers(modifiers); + return message == 2U || message == 5U ? OnRawKeyCharacter(message, ref args) : OnRawKeyState(message, modifiers, ref args); } - internal KeyInfo OnRawKeyCharacter(uint message, ref RawKeyboardData args) => KeyCharacterInfo.Create(KeyAction.Character, args._deviceType, this.Manager.Modifiers, args._repCount, (char)args._virtualKey, message == 5U, message, args._scanCode, args._flags); + internal KeyInfo OnRawKeyCharacter(uint message, ref RawKeyboardData args) => KeyCharacterInfo.Create(KeyAction.Character, args._deviceType, Manager.Modifiers, args._repCount, (char)args._virtualKey, message == 5U, message, args._scanCode, args._flags); internal KeyInfo OnRawKeyState( uint message, @@ -82,9 +82,9 @@ namespace Microsoft.Iris.Input default: return null; } - if (this.TrackKey(action, args._virtualKey, args._scanCode)) + if (TrackKey(action, args._virtualKey, args._scanCode)) { - InputModifiers modifiers = this.Manager.Modifiers & ~this.MapKeyToModifier(args._virtualKey); + InputModifiers modifiers = Manager.Modifiers & ~MapKeyToModifier(args._virtualKey); keyStateInfo = KeyStateInfo.Create(action, args._deviceType, modifiers, args._repCount, args._virtualKey, systemKey, message, args._scanCode, args._flags); } return keyStateInfo; @@ -92,7 +92,7 @@ namespace Microsoft.Iris.Input public bool IsKeyDown(Keys key) { - foreach (KeyboardDevice.KeyState keyState in this._keyStates) + foreach (KeyboardDevice.KeyState keyState in _keyStates) { if (keyState.VKey == key && keyState.IsDown) return true; @@ -102,7 +102,7 @@ namespace Microsoft.Iris.Input public bool IsKeyHandled(Keys key) { - foreach (KeyboardDevice.KeyState keyState in this._keyStates) + foreach (KeyboardDevice.KeyState keyState in _keyStates) { if (keyState.VKey == key) return keyState.IsHandled; @@ -112,7 +112,7 @@ namespace Microsoft.Iris.Input internal void MarkKeyHandled(Keys key) { - foreach (KeyboardDevice.KeyState keyState in this._keyStates) + foreach (KeyboardDevice.KeyState keyState in _keyStates) { if (keyState.VKey == key && keyState.IsDown) { @@ -124,9 +124,9 @@ namespace Microsoft.Iris.Input public void Reset() { - this._keyStates.Clear(); - this._modifiersDirty = true; - this._keyModifiers = InputModifiers.None; + _keyStates.Clear(); + _modifiersDirty = true; + _keyModifiers = InputModifiers.None; } private bool TrackKey(KeyAction action, Keys vkey, int scanCode) @@ -134,15 +134,15 @@ namespace Microsoft.Iris.Input bool flag = false; if (vkey == Keys.None) return false; - if (this.IsModifier(vkey)) - this.MarkModifiersInvalid(); + if (IsModifier(vkey)) + MarkModifiersInvalid(); switch (action) { case KeyAction.Up: - flag = this.TrackKeyUp(vkey, scanCode); + flag = TrackKeyUp(vkey, scanCode); break; case KeyAction.Down: - flag = this.TrackKeyDown(vkey, scanCode); + flag = TrackKeyDown(vkey, scanCode); break; } return flag; @@ -151,9 +151,9 @@ namespace Microsoft.Iris.Input private bool TrackKeyDown(Keys vkey, int scanCode) { KeyboardDevice.KeyState keyState1 = null; - for (int index = 0; index < this._keyStates.Length; ++index) + for (int index = 0; index < _keyStates.Length; ++index) { - KeyboardDevice.KeyState keyState2 = (KeyboardDevice.KeyState)this._keyStates[index]; + KeyboardDevice.KeyState keyState2 = (KeyboardDevice.KeyState)_keyStates[index]; if (keyState2 != null) { if (keyState2.IsDown) @@ -166,7 +166,7 @@ namespace Microsoft.Iris.Input } else { - this._keyStates[index] = null; + _keyStates[index] = null; keyState2.Dispose(); } } @@ -174,7 +174,7 @@ namespace Microsoft.Iris.Input if (keyState1 == null) { KeyboardDevice.KeyState keyState2 = new KeyboardDevice.KeyState(vkey, scanCode); - this._keyStates.Add(keyState2); + _keyStates.Add(keyState2); keyState2.IsDown = true; } return true; @@ -184,7 +184,7 @@ namespace Microsoft.Iris.Input { KeyboardDevice.KeyState keyState1 = null; bool flag = false; - foreach (KeyboardDevice.KeyState keyState2 in this._keyStates) + foreach (KeyboardDevice.KeyState keyState2 in _keyStates) { if (keyState2.VKey == vkey && keyState2.ScanCode == scanCode) { @@ -201,9 +201,9 @@ namespace Microsoft.Iris.Input return flag; } - private bool IsModifier(Keys vkey) => this.MapKeyToModifier(vkey) != InputModifiers.None; + private bool IsModifier(Keys vkey) => MapKeyToModifier(vkey) != InputModifiers.None; - private void MarkModifiersInvalid() => this._modifiersDirty = true; + private void MarkModifiersInvalid() => _modifiersDirty = true; private InputModifiers MapKeyToModifier(Keys vkey) { @@ -231,15 +231,15 @@ namespace Microsoft.Iris.Input private void UpdateModifierState() { - if (!this._modifiersDirty) + if (!_modifiersDirty) return; - this._keyModifiers = InputModifiers.None; - foreach (KeyboardDevice.KeyState keyState in this._keyStates) + _keyModifiers = InputModifiers.None; + foreach (KeyboardDevice.KeyState keyState in _keyStates) { if (keyState.IsDown) - this._keyModifiers |= this.MapKeyToModifier(keyState.VKey); + _keyModifiers |= MapKeyToModifier(keyState.VKey); } - this._modifiersDirty = false; + _modifiersDirty = false; } private class KeyState @@ -251,35 +251,35 @@ namespace Microsoft.Iris.Input public KeyState(Keys vkey, int scanCode) { - this._vkey = vkey; - this._scanCode = scanCode; - this._down = false; - this._handled = false; + _vkey = vkey; + _scanCode = scanCode; + _down = false; + _handled = false; } - public void Dispose() => this.Dispose(true); + public void Dispose() => Dispose(true); protected void Dispose(bool inDispose) { if (!inDispose) return; - this._vkey = Keys.None; - this._scanCode = -1; + _vkey = Keys.None; + _scanCode = -1; } - public Keys VKey => this._vkey; + public Keys VKey => _vkey; - public int ScanCode => this._scanCode; + public int ScanCode => _scanCode; public bool IsDown { - get => this._down; - set => this._down = value; + get => _down; + set => _down = value; } - public bool IsHandled => this._handled; + public bool IsHandled => _handled; - public void MarkHandled() => this._handled = true; + public void MarkHandled() => _handled = true; } } } diff --git a/UIX/Microsoft/Iris/Input/MouseActionInfo.cs b/UIX/Microsoft/Iris/Input/MouseActionInfo.cs index 249edb5..eccd369 100644 --- a/UIX/Microsoft/Iris/Input/MouseActionInfo.cs +++ b/UIX/Microsoft/Iris/Input/MouseActionInfo.cs @@ -30,43 +30,43 @@ namespace Microsoft.Iris.Input MouseButtons button, int wheelDelta) { - this._naturalHit = rawNatural; - this._modifiers = modifiers; - this._screenX = screenX; - this._screenY = screenY; - this._wheelDelta = wheelDelta; - this._nativeMessageID = messageID; - this._button = button; - this.Initialize(rawSource, x, y, eventType); + _naturalHit = rawNatural; + _modifiers = modifiers; + _screenX = screenX; + _screenY = screenY; + _wheelDelta = wheelDelta; + _nativeMessageID = messageID; + _button = button; + Initialize(rawSource, x, y, eventType); } protected override void Zombie() { base.Zombie(); - this._naturalHit = null; - this._naturalTarget = null; + _naturalHit = null; + _naturalTarget = null; } - public uint NativeMessageID => this._nativeMessageID; + public uint NativeMessageID => _nativeMessageID; - public IRawInputSite NaturalHit => this._naturalHit; + public IRawInputSite NaturalHit => _naturalHit; - public ICookedInputSite NaturalTarget => this._naturalTarget; + public ICookedInputSite NaturalTarget => _naturalTarget; - public InputModifiers Modifiers => this._modifiers; + public InputModifiers Modifiers => _modifiers; - public MouseButtons Button => this._button; + public MouseButtons Button => _button; - public int ScreenX => this._screenX; + public int ScreenX => _screenX; - public int ScreenY => this._screenY; + public int ScreenY => _screenY; - public int WheelDelta => this._wheelDelta; + public int WheelDelta => _wheelDelta; public void SetMappedTargets(ICookedInputSite target, ICookedInputSite naturalTarget) { - this.UpdateTarget(target); - this._naturalTarget = naturalTarget; + UpdateTarget(target); + _naturalTarget = naturalTarget; } } } diff --git a/UIX/Microsoft/Iris/Input/MouseButtonInfo.cs b/UIX/Microsoft/Iris/Input/MouseButtonInfo.cs index 1f894ba..779e25e 100644 --- a/UIX/Microsoft/Iris/Input/MouseButtonInfo.cs +++ b/UIX/Microsoft/Iris/Input/MouseButtonInfo.cs @@ -49,17 +49,17 @@ namespace Microsoft.Iris.Input bool state, uint messageID) { - this._state = state; - this._doubleClick = false; - this.Initialize(rawSource, rawNatural, x, y, screenX, screenY, modifiers, EventTypeForMouseButton(state, button, modifiers), messageID, button, 0); + _state = state; + _doubleClick = false; + Initialize(rawSource, rawNatural, x, y, screenX, screenY, modifiers, EventTypeForMouseButton(state, button, modifiers), messageID, button, 0); } - public override InputEventType EventType => this._doubleClick ? InputEventType.MouseDoubleClick : this._eventType; + public override InputEventType EventType => _doubleClick ? InputEventType.MouseDoubleClick : _eventType; public override void UpdateTarget(ICookedInputSite target) { base.UpdateTarget(target); - this._doubleClick = (this.Modifiers & InputModifiers.DoubleClick) != InputModifiers.None && target != null && target.AllowDoubleClicks; + _doubleClick = (Modifiers & InputModifiers.DoubleClick) != InputModifiers.None && target != null && target.AllowDoubleClicks; } private static InputEventType EventTypeForMouseButton( @@ -71,10 +71,10 @@ namespace Microsoft.Iris.Input return !state ? (!flag ? InputEventType.MouseSecondaryUp : InputEventType.MousePrimaryUp) : (!flag ? InputEventType.MouseSecondaryDown : InputEventType.MousePrimaryDown); } - public bool IsDown => this._state; + public bool IsDown => _state; protected override InputInfo.InfoType PoolType => s_poolType; - public override string ToString() => InvariantString.Format("{0}({1}, Button={2})", this.GetType().Name, this._state ? "Down" : "Up", Button); + public override string ToString() => InvariantString.Format("{0}({1}, Button={2})", GetType().Name, _state ? "Down" : "Up", Button); } } diff --git a/UIX/Microsoft/Iris/Input/MouseDevice.cs b/UIX/Microsoft/Iris/Input/MouseDevice.cs index a222025..85b2669 100644 --- a/UIX/Microsoft/Iris/Input/MouseDevice.cs +++ b/UIX/Microsoft/Iris/Input/MouseDevice.cs @@ -31,13 +31,13 @@ namespace Microsoft.Iris.Input { } - public InputModifiers MouseModifiers => this.Manager.HACK_SystemModifiers & InputModifiers.AllMouse; + public InputModifiers MouseModifiers => Manager.HACK_SystemModifiers & InputModifiers.AllMouse; public bool OnRawInput(uint message, InputModifiers modifiers, ref RawMouseData args) { IRawInputSite visCapture = args._visCapture; IRawInputSite visNatural = args._visNatural; - this.Manager.HACK_UpdateSystemModifiers(modifiers); + Manager.HACK_UpdateSystemModifiers(modifiers); switch (message) { case 512: @@ -53,11 +53,11 @@ namespace Microsoft.Iris.Input case 523: case 524: case 525: - this.Manager.MostRecentPhysicalMousePos = new Point(args._physicalX, args._physicalY); - this.Manager.Queue.RawMouseMove(visCapture, visNatural, this.Manager.Modifiers, ref args); + Manager.MostRecentPhysicalMousePos = new Point(args._physicalX, args._physicalY); + Manager.Queue.RawMouseMove(visCapture, visNatural, Manager.Modifiers, ref args); break; case 675: - this.Manager.Queue.RawMouseLeave(); + Manager.Queue.RawMouseLeave(); break; } bool state = false; @@ -77,10 +77,10 @@ namespace Microsoft.Iris.Input case 517: case 520: case 524: - this.Manager.Queue.RawMouseButtonState(message, visCapture, visNatural, this.Manager.Modifiers, args._button, state); + Manager.Queue.RawMouseButtonState(message, visCapture, visNatural, Manager.Modifiers, args._button, state); break; case 522: - this.Manager.Queue.RawMouseWheel(this.Manager.Modifiers, ref args); + Manager.Queue.RawMouseWheel(Manager.Modifiers, ref args); break; } return true; @@ -92,11 +92,11 @@ namespace Microsoft.Iris.Input ref RawDragData args, object data) { - this.Manager.HACK_UpdateSystemModifiers(modifiers); - this.Manager.MostRecentPhysicalMousePos = new Point(args._positionX, args._positionY); + Manager.HACK_UpdateSystemModifiers(modifiers); + Manager.MostRecentPhysicalMousePos = new Point(args._positionX, args._positionY); IRawInputSite visCapture = args._visCapture; DragOperation formOperation = (DragOperation)message; - this.Manager.Queue.RawDragDrop(visCapture, data, args._positionX, args._positionY, modifiers, formOperation, args); + Manager.Queue.RawDragDrop(visCapture, data, args._positionX, args._positionY, modifiers, formOperation, args); return true; } } diff --git a/UIX/Microsoft/Iris/Input/MouseFocusInfo.cs b/UIX/Microsoft/Iris/Input/MouseFocusInfo.cs index f62fe83..01c6664 100644 --- a/UIX/Microsoft/Iris/Input/MouseFocusInfo.cs +++ b/UIX/Microsoft/Iris/Input/MouseFocusInfo.cs @@ -37,20 +37,20 @@ namespace Microsoft.Iris.Input bool state, ICookedInputSite other) { - this._state = state; - this._other = other; - this.Initialize(rawSource, x, y, state ? InputEventType.GainMouseFocus : InputEventType.LoseMouseFocus); + _state = state; + _other = other; + Initialize(rawSource, x, y, state ? InputEventType.GainMouseFocus : InputEventType.LoseMouseFocus); } protected override void Zombie() { base.Zombie(); - this._other = null; + _other = null; } - public ICookedInputSite Other => this._other; + public ICookedInputSite Other => _other; - public bool State => this._state; + public bool State => _state; protected override InputInfo.InfoType PoolType => s_poolType; } diff --git a/UIX/Microsoft/Iris/Input/MouseInfo.cs b/UIX/Microsoft/Iris/Input/MouseInfo.cs index 00437bb..391ae87 100644 --- a/UIX/Microsoft/Iris/Input/MouseInfo.cs +++ b/UIX/Microsoft/Iris/Input/MouseInfo.cs @@ -14,22 +14,22 @@ namespace Microsoft.Iris.Input protected void Initialize(IRawInputSite rawSource, int x, int y, InputEventType eventType) { - this._rawSource = rawSource; - this._x = x; - this._y = y; - this.Initialize(eventType); + _rawSource = rawSource; + _x = x; + _y = y; + Initialize(eventType); } protected override void Zombie() { base.Zombie(); - this._rawSource = null; + _rawSource = null; } - public IRawInputSite RawSource => this._rawSource; + public IRawInputSite RawSource => _rawSource; - public int X => this._x; + public int X => _x; - public int Y => this._y; + public int Y => _y; } } diff --git a/UIX/Microsoft/Iris/Input/MouseWheelInfo.cs b/UIX/Microsoft/Iris/Input/MouseWheelInfo.cs index dee9f6a..14d6fea 100644 --- a/UIX/Microsoft/Iris/Input/MouseWheelInfo.cs +++ b/UIX/Microsoft/Iris/Input/MouseWheelInfo.cs @@ -34,7 +34,7 @@ namespace Microsoft.Iris.Input return mouseWheelInfo; } - public override string ToString() => InvariantString.Format("{0}(Delta={1})", this.GetType().Name, WheelDelta); + public override string ToString() => InvariantString.Format("{0}(Delta={1})", GetType().Name, WheelDelta); protected override InputInfo.InfoType PoolType => s_poolType; } diff --git a/UIX/Microsoft/Iris/InputHandlers/ClickHandler.cs b/UIX/Microsoft/Iris/InputHandlers/ClickHandler.cs index c6f80d5..486c3f9 100644 --- a/UIX/Microsoft/Iris/InputHandlers/ClickHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/ClickHandler.cs @@ -33,174 +33,174 @@ namespace Microsoft.Iris.InputHandlers public ClickHandler() { - this._clickType = ClickType.Key | ClickType.GamePad | ClickType.LeftMouse; - this._clickCount = ClickCount.Single; - this._repeat = true; - this._repeatDelay = DefaultRepeatDelay; - this._repeatRate = DefaultRepeatRate; - this._handle = true; + _clickType = ClickType.Key | ClickType.GamePad | ClickType.LeftMouse; + _clickCount = ClickCount.Single; + _repeat = true; + _repeatDelay = DefaultRepeatDelay; + _repeatRate = DefaultRepeatRate; + _handle = true; } protected override void OnDispose() { - if (this._repeatTimer != null) - this._repeatTimer.Enabled = false; + if (_repeatTimer != null) + _repeatTimer.Enabled = false; base.OnDispose(); } protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - if (this.ShouldHandleEvent(ClickType.Mouse)) - this.UI.MouseInteractive = true; - if (!this.ShouldHandleEvent(ClickType.Key | ClickType.GamePad)) + if (ShouldHandleEvent(ClickType.Mouse)) + UI.MouseInteractive = true; + if (!ShouldHandleEvent(ClickType.Key | ClickType.GamePad)) return; - this.UI.KeyInteractive = true; + UI.KeyInteractive = true; } public ClickType ClickType { - get => this._clickType; + get => _clickType; set { - if (this._clickType == value) + if (_clickType == value) return; - this._clickType = value; - this.FireNotification(NotificationID.ClickType); + _clickType = value; + FireNotification(NotificationID.ClickType); } } public ClickCount ClickCount { - get => this._clickCount; + get => _clickCount; set { - if (this._clickCount == value) + if (_clickCount == value) return; - this._clickCount = value; - this.FireNotification(NotificationID.ClickCount); + _clickCount = value; + FireNotification(NotificationID.ClickCount); } } public bool Repeat { - get => this._repeat; + get => _repeat; set { - if (this._repeat == value) + if (_repeat == value) return; - this._repeat = value; - this.FireNotification(NotificationID.Repeat); + _repeat = value; + FireNotification(NotificationID.Repeat); } } public int RepeatDelay { - get => this._repeatDelay; + get => _repeatDelay; set { - if (this._repeatDelay == value) + if (_repeatDelay == value) return; - this._repeatDelay = value; - this.FireNotification(NotificationID.RepeatDelay); + _repeatDelay = value; + FireNotification(NotificationID.RepeatDelay); } } public int RepeatRate { - get => this._repeatRate; + get => _repeatRate; set { - if (this._repeatRate == value) + if (_repeatRate == value) return; - this._repeatRate = value; - this.FireNotification(NotificationID.RepeatRate); + _repeatRate = value; + FireNotification(NotificationID.RepeatRate); } } - public bool Clicking => this._clickTypeInProgress != ClickType.None && this._clickValidPosition; + public bool Clicking => _clickTypeInProgress != ClickType.None && _clickValidPosition; - public object EventContext => this.CheckEventContext(ref this._eventContext); + public object EventContext => CheckEventContext(ref _eventContext); public IUICommand Command { - get => this._command; + get => _command; set { - if (this._command == value) + if (_command == value) return; - this._command = value; - this.FireNotification(NotificationID.Command); + _command = value; + FireNotification(NotificationID.Command); } } public bool Handle { - get => this._handle; + get => _handle; set { - if (this._handle == value) + if (_handle == value) return; - this._handle = value; - this.FireNotification(NotificationID.Handle); + _handle = value; + FireNotification(NotificationID.Handle); } } private void InvokeCommand() { - this.FireNotification(NotificationID.Invoked); - if (this._command == null) + FireNotification(NotificationID.Invoked); + if (_command == null) return; - this._command.Invoke(); + _command.Invoke(); } private void BeginClick(ClickType clickType, bool validPosition) { - if (this._clickTypeInProgress == ClickType.None) + if (_clickTypeInProgress == ClickType.None) { - this._clickTypeInProgress = clickType; - this._clickValidPosition = validPosition; + _clickTypeInProgress = clickType; + _clickValidPosition = validPosition; if (validPosition) - this.FireNotification(NotificationID.Clicking); + FireNotification(NotificationID.Clicking); } - else if (this._clickTypeInProgress != clickType) - this.CancelClick(ClickType.Any); - this.SetEventContext(null, ref this._eventContext, NotificationID.EventContext); + else if (_clickTypeInProgress != clickType) + CancelClick(ClickType.Any); + SetEventContext(null, ref _eventContext, NotificationID.EventContext); } private void EndClick(ICookedInputSite clickTarget, ClickType clickType) { - if (this._clickTypeInProgress == ClickType.None) + if (_clickTypeInProgress == ClickType.None) return; - this.SetEventContext(clickTarget, ref this._eventContext, NotificationID.EventContext); - if (this._clickTypeInProgress == clickType && this._clickValidPosition) - this.InvokeCommand(); - this.CancelClick(ClickType.Any); + SetEventContext(clickTarget, ref _eventContext, NotificationID.EventContext); + if (_clickTypeInProgress == clickType && _clickValidPosition) + InvokeCommand(); + CancelClick(ClickType.Any); } private void UpdateClickValidPosition(bool validPosition) { - bool clicking = this.Clicking; - this._clickValidPosition = validPosition; - if (this.Clicking == clicking) + bool clicking = Clicking; + _clickValidPosition = validPosition; + if (Clicking == clicking) return; - this.FireNotification(NotificationID.Clicking); + FireNotification(NotificationID.Clicking); } private void CancelClick(ClickType clickType) { - if (this._clickTypeInProgress != ClickType.None && Library.Bits.TestAllFlags((uint)clickType, (uint)this._clickTypeInProgress)) + if (_clickTypeInProgress != ClickType.None && Library.Bits.TestAllFlags((uint)clickType, (uint)_clickTypeInProgress)) { - bool clicking = this.Clicking; - this._clickTypeInProgress = ClickType.None; - if (this.Clicking != clicking) - this.FireNotification(NotificationID.Clicking); + bool clicking = Clicking; + _clickTypeInProgress = ClickType.None; + if (Clicking != clicking) + FireNotification(NotificationID.Clicking); } - if (this._repeatTimer == null) + if (_repeatTimer == null) return; - this._repeatTimer.Enabled = false; + _repeatTimer.Enabled = false; } private bool ShouldHandleEvent( @@ -208,10 +208,10 @@ namespace Microsoft.Iris.InputHandlers InputHandlerModifiers modifiers, ClickCount count) { - return this.ShouldHandleEvent(type) && this._clickCount == count && this.ShouldHandleEvent(modifiers); + return ShouldHandleEvent(type) && _clickCount == count && ShouldHandleEvent(modifiers); } - private bool ShouldHandleEvent(ClickType type) => Library.Bits.TestAnyFlags((uint)this._clickType, (uint)type); + private bool ShouldHandleEvent(ClickType type) => Library.Bits.TestAnyFlags((uint)_clickType, (uint)type); private bool OnClickEvent( ICookedInputSite clickTarget, @@ -219,7 +219,7 @@ namespace Microsoft.Iris.InputHandlers InputHandlerTransition transition, InputHandlerModifiers modifiers) { - return this.OnClickEvent(clickTarget, type, transition, modifiers, ClickCount.Single); + return OnClickEvent(clickTarget, type, transition, modifiers, ClickCount.Single); } private bool OnClickEvent( @@ -229,22 +229,22 @@ namespace Microsoft.Iris.InputHandlers InputHandlerModifiers modifiers, ClickCount count) { - if (!this.ShouldHandleEvent(type, modifiers, count)) + if (!ShouldHandleEvent(type, modifiers, count)) return false; if (transition == InputHandlerTransition.Up) { - if (this.HandlerTransition != InputHandlerTransition.Down) - this.EndClick(clickTarget, type); - if (this._repeatTimer != null) - this._repeatTimer.Enabled = false; + if (HandlerTransition != InputHandlerTransition.Down) + EndClick(clickTarget, type); + if (_repeatTimer != null) + _repeatTimer.Enabled = false; } else { - this.BeginClick(type, true); - if (this.HandlerTransition == InputHandlerTransition.Down) + BeginClick(type, true); + if (HandlerTransition == InputHandlerTransition.Down) { - this.EndClick(clickTarget, type); - this.StartRepeat(new ClickHandler.ClickInfo() + EndClick(clickTarget, type); + StartRepeat(new ClickHandler.ClickInfo() { type = type, transition = transition, @@ -271,39 +271,39 @@ namespace Microsoft.Iris.InputHandlers private void StartRepeat(ClickHandler.ClickInfo clickInfo) { - if (!this.Repeat) + if (!Repeat) return; - if (this._repeatTimer == null) + if (_repeatTimer == null) { - this._repeatTimer = new DispatcherTimer(); - this._repeatTimer.Tick += new EventHandler(this.SimulateClickEvent); - this._repeatTimer.AutoRepeat = true; + _repeatTimer = new DispatcherTimer(); + _repeatTimer.Tick += new EventHandler(SimulateClickEvent); + _repeatTimer.AutoRepeat = true; } - this._repeatTimer.Interval = this.RepeatDelay; - this._repeatTimer.UserData = clickInfo; - this._repeatTimer.Enabled = true; + _repeatTimer.Interval = RepeatDelay; + _repeatTimer.UserData = clickInfo; + _repeatTimer.Enabled = true; } private void SimulateClickEvent(object sender, EventArgs args) { bool flag = false; - ClickHandler.ClickInfo userData = (ClickHandler.ClickInfo)this._repeatTimer.UserData; - if (this.Enabled && this.Repeat && this._clickValidPosition && (userData.target == null || userData.target.IsValid)) + ClickHandler.ClickInfo userData = (ClickHandler.ClickInfo)_repeatTimer.UserData; + if (Enabled && Repeat && _clickValidPosition && (userData.target == null || userData.target.IsValid)) { - this.OnClickEvent(userData.target, userData.type, userData.transition, userData.modifiers, userData.count); + OnClickEvent(userData.target, userData.type, userData.transition, userData.modifiers, userData.count); flag = true; } if (flag) { - this._repeatTimer.Enabled = false; - this._repeatTimer = null; - this.StartRepeat(userData); - this._repeatTimer.Interval = this.RepeatRate; + _repeatTimer.Enabled = false; + _repeatTimer = null; + StartRepeat(userData); + _repeatTimer.Interval = RepeatRate; } else { - this._repeatTimer.Enabled = false; - this._repeatTimer = null; + _repeatTimer.Enabled = false; + _repeatTimer = null; } } @@ -313,55 +313,55 @@ namespace Microsoft.Iris.InputHandlers protected override void OnMousePrimaryDown(UIClass ui, MouseButtonInfo info) { - if (!this.OnClickEvent(info.Target, this.GetClickType(info.Button), InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, GetClickType(info.Button), InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !_handle) return; info.MarkHandled(); } protected override void OnMouseSecondaryDown(UIClass ui, MouseButtonInfo info) { - if (!this.OnClickEvent(info.Target, this.GetClickType(info.Button), InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, GetClickType(info.Button), InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !_handle) return; info.MarkHandled(); } protected override void OnMousePrimaryUp(UIClass ui, MouseButtonInfo info) { - if (!this.OnClickEvent(info.Target, this.GetClickType(info.Button), InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, GetClickType(info.Button), InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !_handle) return; info.MarkHandled(); } protected override void OnMouseSecondaryUp(UIClass ui, MouseButtonInfo info) { - if (!this.OnClickEvent(info.Target, this.GetClickType(info.Button), InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, GetClickType(info.Button), InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !_handle) return; info.MarkHandled(); } protected override void OnMouseDoubleClick(UIClass ui, MouseButtonInfo info) { - ClickType clickType = this.GetClickType(info.Button); - if (!this.OnClickEvent(info.Target, clickType, InputHandlerTransition.Down, GetModifiers(info.Modifiers), ClickCount.Double)) + ClickType clickType = GetClickType(info.Button); + if (!OnClickEvent(info.Target, clickType, InputHandlerTransition.Down, GetModifiers(info.Modifiers), ClickCount.Double)) return; - this.OnClickEvent(info.Target, clickType, InputHandlerTransition.Up, GetModifiers(info.Modifiers), ClickCount.Double); - if (!this._handle) + OnClickEvent(info.Target, clickType, InputHandlerTransition.Up, GetModifiers(info.Modifiers), ClickCount.Double); + if (!_handle) return; info.MarkHandled(); } protected override void OnMouseMove(UIClass ui, MouseMoveInfo info) { - if (!this.ShouldHandleEvent(ClickType.Mouse)) + if (!ShouldHandleEvent(ClickType.Mouse)) return; - this.UpdateClickValidPosition(this.UI.HasDescendant(info.NaturalTarget as UIClass)); + UpdateClickValidPosition(UI.HasDescendant(info.NaturalTarget as UIClass)); } protected override void OnLoseMouseFocus(UIClass ui, MouseFocusInfo info) { - if (!this.ShouldHandleEvent(ClickType.Mouse)) + if (!ShouldHandleEvent(ClickType.Mouse)) return; - this.CancelClick(ClickType.Mouse); + CancelClick(ClickType.Mouse); } protected override void OnKeyDown(UIClass ui, KeyStateInfo info) @@ -371,30 +371,30 @@ namespace Microsoft.Iris.InputHandlers switch (info.Key) { case Keys.Enter: - if (!this.OnClickEvent(info.Target, ClickType.EnterKey, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.EnterKey, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; case Keys.Escape: - if (!this.Clicking) + if (!Clicking) break; - this.CancelClick(ClickType.Any); - if (this._handle) + CancelClick(ClickType.Any); + if (_handle) info.MarkHandled(); - this._handleEscape = true; + _handleEscape = true; break; case Keys.Space: - if (!this.OnClickEvent(info.Target, ClickType.SpaceKey, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.SpaceKey, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; case Keys.GamePadA: - if (!this.OnClickEvent(info.Target, ClickType.GamePadA, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.GamePadA, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; case Keys.GamePadStart: - if (!this.OnClickEvent(info.Target, ClickType.GamePadStart, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.GamePadStart, InputHandlerTransition.Down, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; @@ -406,29 +406,29 @@ namespace Microsoft.Iris.InputHandlers switch (info.Key) { case Keys.Enter: - if (!this.OnClickEvent(info.Target, ClickType.EnterKey, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.EnterKey, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; case Keys.Escape: - if (!this._handleEscape) + if (!_handleEscape) break; - if (this._handle) + if (_handle) info.MarkHandled(); - this._handleEscape = false; + _handleEscape = false; break; case Keys.Space: - if (!this.OnClickEvent(info.Target, ClickType.SpaceKey, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.SpaceKey, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; case Keys.GamePadA: - if (!this.OnClickEvent(info.Target, ClickType.GamePadA, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.GamePadA, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; case Keys.GamePadStart: - if (!this.OnClickEvent(info.Target, ClickType.GamePadStart, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !this._handle) + if (!OnClickEvent(info.Target, ClickType.GamePadStart, InputHandlerTransition.Up, GetModifiers(info.Modifiers)) || !_handle) break; info.MarkHandled(); break; @@ -440,17 +440,17 @@ namespace Microsoft.Iris.InputHandlers switch (info.Character) { case '\r': - if (!this.ShouldHandleEvent(ClickType.EnterKey, GetModifiers(info.Modifiers), ClickCount.Single) || !this._handle) + if (!ShouldHandleEvent(ClickType.EnterKey, GetModifiers(info.Modifiers), ClickCount.Single) || !_handle) break; info.MarkHandled(); break; case '\x001B': - if (!this._handleEscape || !this._handle) + if (!_handleEscape || !_handle) break; info.MarkHandled(); break; case ' ': - if (!this.ShouldHandleEvent(ClickType.SpaceKey, GetModifiers(info.Modifiers), ClickCount.Single) || !this._handle) + if (!ShouldHandleEvent(ClickType.SpaceKey, GetModifiers(info.Modifiers), ClickCount.Single) || !_handle) break; info.MarkHandled(); break; @@ -459,15 +459,15 @@ namespace Microsoft.Iris.InputHandlers protected override void OnLoseKeyFocus(UIClass ui, KeyFocusInfo info) { - if (this.ShouldHandleEvent(ClickType.SpaceKey)) - this.CancelClick(ClickType.SpaceKey); - if (this.ShouldHandleEvent(ClickType.EnterKey)) - this.CancelClick(ClickType.EnterKey); - if (this.ShouldHandleEvent(ClickType.GamePadA)) - this.CancelClick(ClickType.GamePadA); - if (this.ShouldHandleEvent(ClickType.GamePadStart)) - this.CancelClick(ClickType.GamePadStart); - this._handleEscape = false; + if (ShouldHandleEvent(ClickType.SpaceKey)) + CancelClick(ClickType.SpaceKey); + if (ShouldHandleEvent(ClickType.EnterKey)) + CancelClick(ClickType.EnterKey); + if (ShouldHandleEvent(ClickType.GamePadA)) + CancelClick(ClickType.GamePadA); + if (ShouldHandleEvent(ClickType.GamePadStart)) + CancelClick(ClickType.GamePadStart); + _handleEscape = false; } private struct ClickInfo diff --git a/UIX/Microsoft/Iris/InputHandlers/DragHandler.cs b/UIX/Microsoft/Iris/InputHandlers/DragHandler.cs index f1a55c0..738b85e 100644 --- a/UIX/Microsoft/Iris/InputHandlers/DragHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/DragHandler.cs @@ -39,178 +39,178 @@ namespace Microsoft.Iris.InputHandlers private List _addedContexts; private List _removedContexts; - public DragHandler() => this._beginDragPolicy = BeginDragPolicy.Down; + public DragHandler() => _beginDragPolicy = BeginDragPolicy.Down; public override void OnZoneDetached() { - this.CancelDrag(); + CancelDrag(); base.OnZoneDetached(); } protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (this.HandleDirect) - this.UI.MouseInteractive = true; - if (this._relativeTo != null) + if (HandleDirect) + UI.MouseInteractive = true; + if (_relativeTo != null) return; - this.SetRelativeTo(null); + SetRelativeTo(null); } public BeginDragPolicy BeginDragPolicy { - get => this._beginDragPolicy; + get => _beginDragPolicy; set { - if (this._beginDragPolicy == value) + if (_beginDragPolicy == value) return; - this._beginDragPolicy = value; - this.FireNotification(NotificationID.BeginDragPolicy); + _beginDragPolicy = value; + FireNotification(NotificationID.BeginDragPolicy); } } - public bool Dragging => this._inDrag; + public bool Dragging => _inDrag; private void SetDragging(bool value) { - if (this._inDrag == value) + if (_inDrag == value) return; - this._inDrag = value; - this.FireNotification(NotificationID.Dragging); + _inDrag = value; + FireNotification(NotificationID.Dragging); } - public Vector2 BeginPosition => this.NormalizeCoordinates(this._beginPosition); + public Vector2 BeginPosition => NormalizeCoordinates(_beginPosition); private void SetBeginPosition(Vector2 relativeCoordinate) { - if (!(this._beginPosition != relativeCoordinate)) + if (!(_beginPosition != relativeCoordinate)) return; - this._beginPosition = relativeCoordinate; - this.FireNotification(NotificationID.BeginPosition); - this.FireNotification(NotificationID.RelativeDragSize); + _beginPosition = relativeCoordinate; + FireNotification(NotificationID.BeginPosition); + FireNotification(NotificationID.RelativeDragSize); } - public Vector2 EndPosition => this.NormalizeCoordinates(this._endPosition); + public Vector2 EndPosition => NormalizeCoordinates(_endPosition); private void SetEndPosition(Vector2 relativeCoordinate) { - if (!(this._endPosition != relativeCoordinate)) + if (!(_endPosition != relativeCoordinate)) return; - this._endPosition = relativeCoordinate; - this.FireNotification(NotificationID.EndPosition); - this.FireNotification(NotificationID.RelativeDragSize); + _endPosition = relativeCoordinate; + FireNotification(NotificationID.EndPosition); + FireNotification(NotificationID.RelativeDragSize); } - public Size ScreenDragSize => (this.ScreenEndPosition - this.ScreenBeginPosition).ToSize(); + public Size ScreenDragSize => (ScreenEndPosition - ScreenBeginPosition).ToSize(); public Vector2 LocalDragSize { get { - Size screenDragSize = this.ScreenDragSize; - Vector3 vector3 = this._relativeTo != null ? this._relativeTo.ComputeEffectiveScale() : Vector3.UnitVector; + Size screenDragSize = ScreenDragSize; + Vector3 vector3 = _relativeTo != null ? _relativeTo.ComputeEffectiveScale() : Vector3.UnitVector; return new Vector2(screenDragSize.Width / vector3.X, screenDragSize.Height / vector3.Y); } } - public Vector2 RelativeDragSize => this.EndPosition - this.BeginPosition; + public Vector2 RelativeDragSize => EndPosition - BeginPosition; - public InputHandlerModifiers ActiveModifiers => this._activeModifiers; + public InputHandlerModifiers ActiveModifiers => _activeModifiers; private void SetActiveModifiers(InputHandlerModifiers value) { - if (this._activeModifiers == value) + if (_activeModifiers == value) return; - this._activeModifiers = value; - this.FireNotification(NotificationID.ActiveModifiers); + _activeModifiers = value; + FireNotification(NotificationID.ActiveModifiers); } public CursorID DragCursor { - get => this._dragCursor; + get => _dragCursor; set { - if (this._dragCursor == value) + if (_dragCursor == value) return; - this._dragCursor = value; - this.FireNotification(NotificationID.DragCursor); + _dragCursor = value; + FireNotification(NotificationID.DragCursor); } } private Point ScreenBeginPosition { - get => this._screenBeginPosition; + get => _screenBeginPosition; set { - if (!(this._screenBeginPosition != value)) + if (!(_screenBeginPosition != value)) return; - this._screenBeginPosition = value; - this.FireNotification(NotificationID.ScreenDragSize); - this.FireNotification(NotificationID.LocalDragSize); + _screenBeginPosition = value; + FireNotification(NotificationID.ScreenDragSize); + FireNotification(NotificationID.LocalDragSize); } } private Point ScreenEndPosition { - get => this._screenEndPosition; + get => _screenEndPosition; set { - if (!(this._screenEndPosition != value)) + if (!(_screenEndPosition != value)) return; - this._screenEndPosition = value; - this.FireNotification(NotificationID.ScreenDragSize); - this.FireNotification(NotificationID.LocalDragSize); + _screenEndPosition = value; + FireNotification(NotificationID.ScreenDragSize); + FireNotification(NotificationID.LocalDragSize); } } public bool CancelOnEscape { - get => this._cancelOnEscape; + get => _cancelOnEscape; set { - if (this._cancelOnEscape == value) + if (_cancelOnEscape == value) return; - if (this.Dragging) - this.HookSessionInput(value); - this._cancelOnEscape = value; - this.FireNotification(NotificationID.CancelOnEscape); + if (Dragging) + HookSessionInput(value); + _cancelOnEscape = value; + FireNotification(NotificationID.CancelOnEscape); } } public ViewItem RelativeTo { - get => !this._hasRelativeTo ? null : this._relativeTo; + get => !_hasRelativeTo ? null : _relativeTo; set { - bool hasRelativeTo = this._hasRelativeTo; - this._hasRelativeTo = value != null; - ViewItem relativeTo = this._relativeTo; - this.SetRelativeTo(value); - if (hasRelativeTo == this._hasRelativeTo && relativeTo == this._relativeTo) + bool hasRelativeTo = _hasRelativeTo; + _hasRelativeTo = value != null; + ViewItem relativeTo = _relativeTo; + SetRelativeTo(value); + if (hasRelativeTo == _hasRelativeTo && relativeTo == _relativeTo) return; - this.FireNotification(NotificationID.RelativeTo); + FireNotification(NotificationID.RelativeTo); } } private void SetRelativeTo(ViewItem relativeTo) { - if (this._relativeTo == relativeTo && relativeTo != null) + if (_relativeTo == relativeTo && relativeTo != null) return; - LayoutCompleteEventHandler completeEventHandler = new LayoutCompleteEventHandler(this.OnRelativeToLayoutComplete); - if (this._relativeTo != null) - this._relativeTo.LayoutComplete -= completeEventHandler; - this._relativeTo = relativeTo; - if (this._relativeTo == null && this.UI != null) - this._relativeTo = this.UI.RootItem; - if (this._relativeTo == null) + LayoutCompleteEventHandler completeEventHandler = new LayoutCompleteEventHandler(OnRelativeToLayoutComplete); + if (_relativeTo != null) + _relativeTo.LayoutComplete -= completeEventHandler; + _relativeTo = relativeTo; + if (_relativeTo == null && UI != null) + _relativeTo = UI.RootItem; + if (_relativeTo == null) return; - this._relativeTo.LayoutComplete += completeEventHandler; + _relativeTo.LayoutComplete += completeEventHandler; } public void ResetDragOrigin() { - this.SetBeginPosition(this._endPosition); - this.ScreenBeginPosition = this.ScreenEndPosition; + SetBeginPosition(_endPosition); + ScreenBeginPosition = ScreenEndPosition; } private void BeginDrag( @@ -220,62 +220,62 @@ namespace Microsoft.Iris.InputHandlers Point screenEnd, InputHandlerModifiers modifiers) { - this.SetDragging(true); - this._pendingDrag = false; - this._contextBounds = RectangleF.Zero; - if (this.CancelOnEscape) - this.HookSessionInput(true); - this.SetBeginPosition(relativeBegin); - this.SetEndPosition(relativeEnd); - this.ScreenBeginPosition = screenBegin; - this.ScreenEndPosition = screenEnd; - this.SetActiveModifiers(modifiers); - this.FireNotification(NotificationID.Started); - this.UpdateCursor(); + SetDragging(true); + _pendingDrag = false; + _contextBounds = RectangleF.Zero; + if (CancelOnEscape) + HookSessionInput(true); + SetBeginPosition(relativeBegin); + SetEndPosition(relativeEnd); + ScreenBeginPosition = screenBegin; + ScreenEndPosition = screenEnd; + SetActiveModifiers(modifiers); + FireNotification(NotificationID.Started); + UpdateCursor(); } private void EndDrag(bool completed) { - if (this.Dragging) + if (Dragging) { - if (this.CancelOnEscape) - this.HookSessionInput(false); - this.SetDragging(false); + if (CancelOnEscape) + HookSessionInput(false); + SetDragging(false); if (completed) - this.FireNotification(NotificationID.Ended); + FireNotification(NotificationID.Ended); else - this.FireNotification(NotificationID.Canceled); - this.UpdateCursor(); + FireNotification(NotificationID.Canceled); + UpdateCursor(); } - this._pendingDrag = false; + _pendingDrag = false; } private void InDrag(Vector2 uiPoint, Point screenPoint, InputHandlerModifiers modifiers) { - if (screenPoint != this.ScreenEndPosition) + if (screenPoint != ScreenEndPosition) { - this.SetEndPosition(this.TransformToRelative(uiPoint)); - this.ScreenEndPosition = screenPoint; + SetEndPosition(TransformToRelative(uiPoint)); + ScreenEndPosition = screenPoint; } - this.SetActiveModifiers(modifiers); + SetActiveModifiers(modifiers); } protected override void OnMousePrimaryDown(UIClass ui, MouseButtonInfo info) { - if (!this.Dragging) + if (!Dragging) { - Vector2 relative = this.TransformToRelative(this.TransformToUI(new Point(info.X, info.Y), (UIClass)info.Target)); + Vector2 relative = TransformToRelative(TransformToUI(new Point(info.X, info.Y), (UIClass)info.Target)); Point point = new Point(info.ScreenX, info.ScreenY); - if (this.BeginDragPolicy == BeginDragPolicy.Down) + if (BeginDragPolicy == BeginDragPolicy.Down) { - this.BeginDrag(relative, relative, point, point, GetModifiers(info.Modifiers)); + BeginDrag(relative, relative, point, point, GetModifiers(info.Modifiers)); info.MarkHandled(); } else { - this._pendingDrag = true; - this._initialPosition = relative; - this._initialScreenPosition = point; + _pendingDrag = true; + _initialPosition = relative; + _initialScreenPosition = point; } } base.OnMousePrimaryDown(ui, info); @@ -283,10 +283,10 @@ namespace Microsoft.Iris.InputHandlers protected override void OnMousePrimaryUp(UIClass ui, MouseButtonInfo info) { - bool dragging = this.Dragging; - if (dragging || this._pendingDrag) + bool dragging = Dragging; + if (dragging || _pendingDrag) { - this.EndDrag(true); + EndDrag(true); if (dragging) info.MarkHandled(); } @@ -296,19 +296,19 @@ namespace Microsoft.Iris.InputHandlers protected override void OnMouseMove(UIClass ui, MouseMoveInfo info) { if ((info.Modifiers & InputModifiers.LeftMouse) == InputModifiers.None) - this.EndDrag(true); - else if (this.Dragging || this._pendingDrag) + EndDrag(true); + else if (Dragging || _pendingDrag) { - Vector2 ui1 = this.TransformToUI(new Point(info.X, info.Y), (UIClass)info.Target); + Vector2 ui1 = TransformToUI(new Point(info.X, info.Y), (UIClass)info.Target); Point point = new Point(info.ScreenX, info.ScreenY); - if (this.Dragging) + if (Dragging) { - this.InDrag(ui1, point, GetModifiers(info.Modifiers)); + InDrag(ui1, point, GetModifiers(info.Modifiers)); info.MarkHandled(); } - else if (Math.Abs(point.X - this._initialScreenPosition.X) >= Win32Api.GetSystemMetrics(68) || Math.Abs(point.Y - this._initialScreenPosition.Y) >= Win32Api.GetSystemMetrics(69)) + else if (Math.Abs(point.X - _initialScreenPosition.X) >= Win32Api.GetSystemMetrics(68) || Math.Abs(point.Y - _initialScreenPosition.Y) >= Win32Api.GetSystemMetrics(69)) { - this.BeginDrag(this._initialPosition, this.TransformToRelative(ui1), this._initialScreenPosition, point, GetModifiers(info.Modifiers)); + BeginDrag(_initialPosition, TransformToRelative(ui1), _initialScreenPosition, point, GetModifiers(info.Modifiers)); info.MarkHandled(); } } @@ -317,37 +317,37 @@ namespace Microsoft.Iris.InputHandlers protected override void OnLoseMouseFocus(UIClass ui, MouseFocusInfo info) { - this.CancelDrag(); + CancelDrag(); base.OnLoseMouseFocus(ui, info); } - private void OnRelativeToLayoutComplete(object sender) => this.SetLastLayoutSize(this._relativeTo.LayoutSize); + private void OnRelativeToLayoutComplete(object sender) => SetLastLayoutSize(_relativeTo.LayoutSize); protected void SetLastLayoutSize(Size size) { - Vector2 beginPosition = this.BeginPosition; - Vector2 endPosition = this.EndPosition; - Vector2 relativeDragSize = this.RelativeDragSize; - this._lastKnownSize = size; - if (!this.Dragging) + Vector2 beginPosition = BeginPosition; + Vector2 endPosition = EndPosition; + Vector2 relativeDragSize = RelativeDragSize; + _lastKnownSize = size; + if (!Dragging) return; - Point client = this._relativeTo.ScreenToClient(this._screenEndPosition); - this.SetEndPosition(new Vector2(client.X, client.Y)); - if (beginPosition != this.BeginPosition) - this.FireNotification(NotificationID.BeginPosition); - if (endPosition != this.EndPosition) - this.FireNotification(NotificationID.EndPosition); - if (!(relativeDragSize != this.RelativeDragSize)) + Point client = _relativeTo.ScreenToClient(_screenEndPosition); + SetEndPosition(new Vector2(client.X, client.Y)); + if (beginPosition != BeginPosition) + FireNotification(NotificationID.BeginPosition); + if (endPosition != EndPosition) + FireNotification(NotificationID.EndPosition); + if (!(relativeDragSize != RelativeDragSize)) return; - this.FireNotification(NotificationID.RelativeDragSize); + FireNotification(NotificationID.RelativeDragSize); } private void HookSessionInput(bool hook) { if (hook) - this.UI.SessionInput += new SessionInputHandler(this.OnSessionInput); + UI.SessionInput += new SessionInputHandler(OnSessionInput); else - this.UI.SessionInput -= new SessionInputHandler(this.OnSessionInput); + UI.SessionInput -= new SessionInputHandler(OnSessionInput); } private void OnSessionInput(InputInfo originalEvent, EventRouteStages stageHandled) @@ -355,15 +355,15 @@ namespace Microsoft.Iris.InputHandlers if (!(originalEvent is KeyStateInfo keyStateInfo)) return; if (keyStateInfo.Key == Keys.Escape) - this.CancelDrag(); + CancelDrag(); keyStateInfo.MarkHandled(); } private Vector2 TransformToRelative(Vector2 uiPoint) { - if (this._relativeTo != null) + if (_relativeTo != null) { - RectangleF rectangleF = this._relativeTo.TransformFromAncestor(this.UI.RootItem, new RectangleF(uiPoint.X, uiPoint.Y, 0.0f, 0.0f)); + RectangleF rectangleF = _relativeTo.TransformFromAncestor(UI.RootItem, new RectangleF(uiPoint.X, uiPoint.Y, 0.0f, 0.0f)); uiPoint.X = rectangleF.X; uiPoint.Y = rectangleF.Y; } @@ -373,8 +373,8 @@ namespace Microsoft.Iris.InputHandlers private RectangleF TransformFromRelative(RectangleF relativeBounds) { RectangleF rectangleF = relativeBounds; - if (this._relativeTo != null) - rectangleF = this._relativeTo.TransformToAncestor(this.UI.RootItem, relativeBounds); + if (_relativeTo != null) + rectangleF = _relativeTo.TransformToAncestor(UI.RootItem, relativeBounds); return rectangleF; } @@ -382,46 +382,46 @@ namespace Microsoft.Iris.InputHandlers { float x = uiPoint.X; float y = uiPoint.Y; - if (reference != this.UI) + if (reference != UI) { RectangleF rect = new RectangleF(x, y, 0.0f, 0.0f); - RectangleF ancestor = reference.RootItem.TransformToAncestor(this.UI.RootItem, rect); + RectangleF ancestor = reference.RootItem.TransformToAncestor(UI.RootItem, rect); x = ancestor.X; y = ancestor.Y; } return new Vector2(x, y); } - private Vector2 NormalizeCoordinates(Vector2 pt) => this._lastKnownSize.Width == 0 || this._lastKnownSize.Height == 0 ? Vector2.Zero : new Vector2(pt.X / _lastKnownSize.Width, pt.Y / _lastKnownSize.Height); + private Vector2 NormalizeCoordinates(Vector2 pt) => _lastKnownSize.Width == 0 || _lastKnownSize.Height == 0 ? Vector2.Zero : new Vector2(pt.X / _lastKnownSize.Width, pt.Y / _lastKnownSize.Height); - internal override CursorID GetCursor() => this._dragCursor != CursorID.NotSpecified && this.Dragging ? this._dragCursor : CursorID.NotSpecified; + internal override CursorID GetCursor() => _dragCursor != CursorID.NotSpecified && Dragging ? _dragCursor : CursorID.NotSpecified; - public void CancelDrag() => this.EndDrag(false); + public void CancelDrag() => EndDrag(false); private void GetDragBounds(out RectangleF relativeBounds, out RectangleF uiBounds) { - relativeBounds = new RectangleF(Math.Min(this._beginPosition.X, this._endPosition.X), Math.Min(this._beginPosition.Y, this._endPosition.Y), Math.Abs(this._beginPosition.X - this._endPosition.X), Math.Abs(this._beginPosition.Y - this._endPosition.Y)); - uiBounds = this.TransformFromRelative(relativeBounds); + relativeBounds = new RectangleF(Math.Min(_beginPosition.X, _endPosition.X), Math.Min(_beginPosition.Y, _endPosition.Y), Math.Abs(_beginPosition.X - _endPosition.X), Math.Abs(_beginPosition.Y - _endPosition.Y)); + uiBounds = TransformFromRelative(relativeBounds); } public IList GetEventContexts() { IList added = new List(); RectangleF uiBounds; - this.GetDragBounds(out RectangleF _, out uiBounds); - GetEventContexts(this.UI, added, null, RectangleF.Zero, uiBounds); + GetDragBounds(out RectangleF _, out uiBounds); + GetEventContexts(UI, added, null, RectangleF.Zero, uiBounds); return added; } public IList GetAddedEventContexts() { - this.UpdateEventContexts(); + UpdateEventContexts(); return _addedContexts; } public IList GetRemovedEventContexts() { - this.UpdateEventContexts(); + UpdateEventContexts(); return _removedContexts; } @@ -429,13 +429,13 @@ namespace Microsoft.Iris.InputHandlers { RectangleF relativeBounds; RectangleF uiBounds; - this.GetDragBounds(out relativeBounds, out uiBounds); - if (!(relativeBounds != this._contextBounds)) + GetDragBounds(out relativeBounds, out uiBounds); + if (!(relativeBounds != _contextBounds)) return; - this._addedContexts = new List(); - this._removedContexts = new List(); - GetEventContexts(this.UI, _addedContexts, _removedContexts, this.TransformFromRelative(this._contextBounds), uiBounds); - this._contextBounds = relativeBounds; + _addedContexts = new List(); + _removedContexts = new List(); + GetEventContexts(UI, _addedContexts, _removedContexts, TransformFromRelative(_contextBounds), uiBounds); + _contextBounds = relativeBounds; } private static void GetEventContexts( diff --git a/UIX/Microsoft/Iris/InputHandlers/DragSourceHandler.cs b/UIX/Microsoft/Iris/InputHandlers/DragSourceHandler.cs index e8235b5..4f145a4 100644 --- a/UIX/Microsoft/Iris/InputHandlers/DragSourceHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/DragSourceHandler.cs @@ -28,143 +28,143 @@ namespace Microsoft.Iris.InputHandlers internal DragSourceHandler() { - this._moveCursor = CursorID.Move; - this._copyCursor = CursorID.Copy; - this._cancelCursor = CursorID.Cancel; + _moveCursor = CursorID.Move; + _copyCursor = CursorID.Copy; + _cancelCursor = CursorID.Cancel; } public override void OnZoneDetached() { - if (this.Dragging) - this.EndDrag(null, InputModifiers.None, DropAction.None); + if (Dragging) + EndDrag(null, InputModifiers.None, DropAction.None); base.OnZoneDetached(); } protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.MouseInteractive = true; + UI.MouseInteractive = true; } public object Value { - get => this._value; + get => _value; set { - if (this._value == value) + if (_value == value) return; - this._value = value; - this.FireNotification(NotificationID.Value); + _value = value; + FireNotification(NotificationID.Value); } } public DropAction AllowedDropActions { - get => this._allowedDropActions; + get => _allowedDropActions; set { - if (this._allowedDropActions == value) + if (_allowedDropActions == value) return; - this._allowedDropActions = value; - this.FireNotification(NotificationID.AllowedDropActions); + _allowedDropActions = value; + FireNotification(NotificationID.AllowedDropActions); } } - public DropAction CurrentDropAction => this._currentDropAction; + public DropAction CurrentDropAction => _currentDropAction; private void SetCurrentDropAction(DropAction value) { - if (this._currentDropAction == value) + if (_currentDropAction == value) return; - this._currentDropAction = value; - this.FireNotification(NotificationID.CurrentDropAction); - this.UpdateCursor(); + _currentDropAction = value; + FireNotification(NotificationID.CurrentDropAction); + UpdateCursor(); } public bool Dragging => DragDropHelper.DraggingInternally && DragDropHelper.SourceHandler == this; public CursorID MoveCursor { - get => this._moveCursor; + get => _moveCursor; set { - if (this._moveCursor == value) + if (_moveCursor == value) return; - this._moveCursor = value; - this.FireNotification(NotificationID.MoveCursor); + _moveCursor = value; + FireNotification(NotificationID.MoveCursor); } } public CursorID CopyCursor { - get => this._copyCursor; + get => _copyCursor; set { - if (this._copyCursor == value) + if (_copyCursor == value) return; - this._copyCursor = value; - this.FireNotification(NotificationID.CopyCursor); + _copyCursor = value; + FireNotification(NotificationID.CopyCursor); } } public CursorID CancelCursor { - get => this._cancelCursor; + get => _cancelCursor; set { - if (this._cancelCursor == value) + if (_cancelCursor == value) return; - this._cancelCursor = value; - this.FireNotification(NotificationID.CancelCursor); + _cancelCursor = value; + FireNotification(NotificationID.CancelCursor); } } protected override void OnMousePrimaryDown(UIClass ui, MouseButtonInfo info) { - this._pendingDrag = true; - this._initialX = info.ScreenX; - this._initialY = info.ScreenY; + _pendingDrag = true; + _initialX = info.ScreenX; + _initialY = info.ScreenY; base.OnMousePrimaryDown(ui, info); } protected override void OnMouseMove(UIClass ui, MouseMoveInfo info) { - if (this.Dragging) + if (Dragging) { DragDropHelper.Requery(info.NaturalHit, info.ScreenX, info.ScreenY, info.Modifiers); info.MarkHandled(); } - else if (this._pendingDrag) + else if (_pendingDrag) { - if (Math.Abs(info.ScreenX - this._initialX) >= Win32Api.GetSystemMetrics(68) || Math.Abs(info.ScreenY - this._initialY) >= Win32Api.GetSystemMetrics(69)) + if (Math.Abs(info.ScreenX - _initialX) >= Win32Api.GetSystemMetrics(68) || Math.Abs(info.ScreenY - _initialY) >= Win32Api.GetSystemMetrics(69)) { - this._pendingDrag = false; + _pendingDrag = false; DragDropHelper.BeginDrag(this, info.Target, info.NaturalHit, 0, 0, info.Modifiers); - this.UI.SessionInput += new SessionInputHandler(this.OnSessionInput); - this.FireNotification(NotificationID.Dragging); - this.FireNotification(NotificationID.Started); - this.UpdateCursor(); + UI.SessionInput += new SessionInputHandler(OnSessionInput); + FireNotification(NotificationID.Dragging); + FireNotification(NotificationID.Started); + UpdateCursor(); info.MarkHandled(); } } - else if (this._dragCanceled) + else if (_dragCanceled) info.MarkHandled(); base.OnMouseMove(ui, info); } protected override void OnMousePrimaryUp(UIClass sender, MouseButtonInfo info) { - this._pendingDrag = false; - if (this.Dragging) + _pendingDrag = false; + if (Dragging) { - this.EndDrag(info?.NaturalHit, info.Modifiers, this.CurrentDropAction); + EndDrag(info?.NaturalHit, info.Modifiers, CurrentDropAction); info.MarkHandled(); } - else if (this._dragCanceled) + else if (_dragCanceled) { - this._dragCanceled = false; + _dragCanceled = false; info.MarkHandled(); } base.OnMousePrimaryUp(sender, info); @@ -191,8 +191,8 @@ namespace Microsoft.Iris.InputHandlers DragDropHelper.Requery(modifiers); break; case Keys.Escape: - this.EndDrag(null, keyStateInfo.Modifiers, DropAction.None); - this._dragCanceled = true; + EndDrag(null, keyStateInfo.Modifiers, DropAction.None); + _dragCanceled = true; break; } keyStateInfo.MarkHandled(); @@ -207,70 +207,70 @@ namespace Microsoft.Iris.InputHandlers protected override void OnLoseKeyFocus(UIClass sender, KeyFocusInfo info) { - this._pendingDrag = false; - if (this.Dragging) - this.EndDrag(null, DragDropHelper.Modifiers, DropAction.None); + _pendingDrag = false; + if (Dragging) + EndDrag(null, DragDropHelper.Modifiers, DropAction.None); base.OnLoseKeyFocus(sender, info); } protected override void OnLoseMouseFocus(UIClass sender, MouseFocusInfo info) { - this._pendingDrag = false; - if (this.Dragging) - this.EndDrag(null, DragDropHelper.Modifiers, DropAction.None); + _pendingDrag = false; + if (Dragging) + EndDrag(null, DragDropHelper.Modifiers, DropAction.None); base.OnLoseMouseFocus(sender, info); } private void EndDrag(IRawInputSite target, InputModifiers modifiers, DropAction action) { - this.UI.SessionInput -= new SessionInputHandler(this.OnSessionInput); + UI.SessionInput -= new SessionInputHandler(OnSessionInput); DragDropHelper.EndDrag(target, modifiers, action); } internal void OnEndDrag(DropAction action) { - this.FireNotification(NotificationID.Dragging); + FireNotification(NotificationID.Dragging); switch (action) { case DropAction.None: - this.FireNotification(NotificationID.Canceled); + FireNotification(NotificationID.Canceled); break; case DropAction.Copy: - this.FireNotification(NotificationID.Copied); + FireNotification(NotificationID.Copied); break; case DropAction.Move: - this.FireNotification(NotificationID.Moved); + FireNotification(NotificationID.Moved); break; } - this.UpdateCursor(); + UpdateCursor(); } internal void UpdateCurrentAction() { - DropAction dropAction = DragDropHelper.AllowedDropActions & this.AllowedDropActions; + DropAction dropAction = DragDropHelper.AllowedDropActions & AllowedDropActions; if ((dropAction & DropAction.All) == DropAction.All) { if ((DragDropHelper.Modifiers & InputModifiers.ControlKey) == InputModifiers.ControlKey) - this.SetCurrentDropAction(DropAction.Copy); + SetCurrentDropAction(DropAction.Copy); else - this.SetCurrentDropAction(DropAction.Move); + SetCurrentDropAction(DropAction.Move); } else - this.SetCurrentDropAction(dropAction); + SetCurrentDropAction(dropAction); } internal override CursorID GetCursor() { - if (this.Dragging) + if (Dragging) { - switch (this.CurrentDropAction) + switch (CurrentDropAction) { case DropAction.None: - return this.CancelCursor; + return CancelCursor; case DropAction.Copy: - return this.CopyCursor; + return CopyCursor; case DropAction.Move: - return this.MoveCursor; + return MoveCursor; } } return CursorID.NotSpecified; diff --git a/UIX/Microsoft/Iris/InputHandlers/DropTargetHandler.cs b/UIX/Microsoft/Iris/InputHandlers/DropTargetHandler.cs index 06c1f15..71baa80 100644 --- a/UIX/Microsoft/Iris/InputHandlers/DropTargetHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/DropTargetHandler.cs @@ -23,46 +23,46 @@ namespace Microsoft.Iris.InputHandlers protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.MouseInteractive = true; + UI.MouseInteractive = true; } public DropAction AllowedDropActions { - get => this._allowedDropActions; + get => _allowedDropActions; set { - if (this._allowedDropActions == value) + if (_allowedDropActions == value) return; - this._allowedDropActions = value; - this.FireNotification(NotificationID.AllowedDropActions); - if (!this.Dragging) + _allowedDropActions = value; + FireNotification(NotificationID.AllowedDropActions); + if (!Dragging) return; DragDropHelper.OnAllowedDropActionsChanged(); } } - public bool Dragging => this._dragging; + public bool Dragging => _dragging; - public object EventContext => this.CheckEventContext(ref this._eventContext); + public object EventContext => CheckEventContext(ref _eventContext); protected override void OnDragEnter(UIClass ui, DragDropInfo info) { - this._dragging = true; + _dragging = true; DragDropHelper.TargetHandler = this; - this.FireNotification(NotificationID.Dragging); - this.FireNotification(NotificationID.DragEnter); - this.SetEventContext(info.Target, ref this._eventContext, NotificationID.EventContext); + FireNotification(NotificationID.Dragging); + FireNotification(NotificationID.DragEnter); + SetEventContext(info.Target, ref _eventContext, NotificationID.EventContext); info.MarkHandled(); base.OnDragEnter(ui, info); } protected override void OnDragOver(UIClass ui, DragDropInfo info) { - if (this.Dragging) + if (Dragging) { - this.FireNotification(NotificationID.DragOver); + FireNotification(NotificationID.DragOver); info.MarkHandled(); } base.OnDragOver(ui, info); @@ -70,20 +70,20 @@ namespace Microsoft.Iris.InputHandlers protected override void OnDragLeave(UIClass ui, DragDropInfo info) { - if (this.Dragging) + if (Dragging) { - this.EndDrag(NotificationID.DragLeave); + EndDrag(NotificationID.DragLeave); info.MarkHandled(); - this.SetEventContext(null, ref this._eventContext, NotificationID.EventContext); + SetEventContext(null, ref _eventContext, NotificationID.EventContext); } base.OnDragLeave(ui, info); } protected override void OnDropped(UIClass ui, DragDropInfo info) { - if (this.Dragging) + if (Dragging) { - this.EndDrag(NotificationID.Dropped); + EndDrag(NotificationID.Dropped); info.MarkHandled(); } base.OnDropped(ui, info); @@ -91,9 +91,9 @@ namespace Microsoft.Iris.InputHandlers private void EndDrag(string eventName) { - this._dragging = false; - this.FireNotification(NotificationID.Dragging); - this.FireNotification(eventName); + _dragging = false; + FireNotification(NotificationID.Dragging); + FireNotification(eventName); DragDropHelper.TargetHandler = null; } diff --git a/UIX/Microsoft/Iris/InputHandlers/EventContext.cs b/UIX/Microsoft/Iris/InputHandlers/EventContext.cs index 22c9687..e3e50a5 100644 --- a/UIX/Microsoft/Iris/InputHandlers/EventContext.cs +++ b/UIX/Microsoft/Iris/InputHandlers/EventContext.cs @@ -13,17 +13,17 @@ namespace Microsoft.Iris.InputHandlers { private object _value; - protected override void ConfigureInteractivity() => this.UI.SetEventContext(this); + protected override void ConfigureInteractivity() => UI.SetEventContext(this); public object Value { - get => this._value; + get => _value; set { - if (this._value == value) + if (_value == value) return; - this._value = value; - this.FireNotification(NotificationID.Value); + _value = value; + FireNotification(NotificationID.Value); } } } diff --git a/UIX/Microsoft/Iris/InputHandlers/FocusHandler.cs b/UIX/Microsoft/Iris/InputHandlers/FocusHandler.cs index 119b585..1bed1be 100644 --- a/UIX/Microsoft/Iris/InputHandlers/FocusHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/FocusHandler.cs @@ -18,49 +18,49 @@ namespace Microsoft.Iris.InputHandlers private WeakReference _gainedEventContext; private WeakReference _lostEventContext; - public FocusHandler() => this._changeReason = FocusChangeReason.Any; + public FocusHandler() => _changeReason = FocusChangeReason.Any; protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.KeyInteractive = true; + UI.KeyInteractive = true; } public FocusChangeReason Reason { - get => this._changeReason; + get => _changeReason; set { - if (this._changeReason == value) + if (_changeReason == value) return; - this._changeReason = value; - this.FireNotification(NotificationID.Reason); + _changeReason = value; + FireNotification(NotificationID.Reason); } } - public object GainedEventContext => this.CheckEventContext(ref this._gainedEventContext); + public object GainedEventContext => CheckEventContext(ref _gainedEventContext); - public object LostEventContext => this.CheckEventContext(ref this._lostEventContext); + public object LostEventContext => CheckEventContext(ref _lostEventContext); protected override void OnGainKeyFocus(UIClass ui, KeyFocusInfo info) { - if (!this.ShouldHandleEvent(info)) + if (!ShouldHandleEvent(info)) return; - this.SetEventContext(info.Target, ref this._gainedEventContext, NotificationID.GainedEventContext); - this.FireNotification(NotificationID.GainedFocus); + SetEventContext(info.Target, ref _gainedEventContext, NotificationID.GainedEventContext); + FireNotification(NotificationID.GainedFocus); } protected override void OnLoseKeyFocus(UIClass ui, KeyFocusInfo info) { - if (!this.ShouldHandleEvent(info)) + if (!ShouldHandleEvent(info)) return; - this.SetEventContext(info.Target, ref this._lostEventContext, NotificationID.LostEventContext); - this.FireNotification(NotificationID.LostFocus); + SetEventContext(info.Target, ref _lostEventContext, NotificationID.LostEventContext); + FireNotification(NotificationID.LostFocus); } - private bool ShouldHandleEvent(KeyFocusInfo info) => Library.Bits.TestAnyFlags((uint)this.Reason, (uint)GetFocusChangeReason(info)) && this.ShouldHandleEvent(GetModifiers(UISession.Default.InputManager.Modifiers)); + private bool ShouldHandleEvent(KeyFocusInfo info) => Library.Bits.TestAnyFlags((uint)Reason, (uint)GetFocusChangeReason(info)) && ShouldHandleEvent(GetModifiers(UISession.Default.InputManager.Modifiers)); private static FocusChangeReason GetFocusChangeReason(KeyFocusInfo info) { diff --git a/UIX/Microsoft/Iris/InputHandlers/KeyHandler.cs b/UIX/Microsoft/Iris/InputHandlers/KeyHandler.cs index b095d13..df19f37 100644 --- a/UIX/Microsoft/Iris/InputHandlers/KeyHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/KeyHandler.cs @@ -29,101 +29,101 @@ namespace Microsoft.Iris.InputHandlers public KeyHandler() { - this._handle = true; - this.HandlerTransition = InputHandlerTransition.Down; - this._key = KeyHandlerKey.None; - this._repeat = true; + _handle = true; + HandlerTransition = InputHandlerTransition.Down; + _key = KeyHandlerKey.None; + _repeat = true; } protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.KeyInteractive = true; + UI.KeyInteractive = true; } - public bool Pressing => this._pressing; + public bool Pressing => _pressing; public KeyHandlerKey Key { - get => this._key; + get => _key; set { - if (this._key == value) + if (_key == value) return; - this._key = value; - this.FireNotification(NotificationID.Key); + _key = value; + FireNotification(NotificationID.Key); } } public IUICommand Command { - get => this._command; + get => _command; set { - if (this._command == value) + if (_command == value) return; - this._command = value; - this.FireNotification(NotificationID.Command); + _command = value; + FireNotification(NotificationID.Command); } } public bool Handle { - get => this._handle; + get => _handle; set { - if (this._handle == value) + if (_handle == value) return; - this._handle = value; - this.FireNotification(NotificationID.Handle); + _handle = value; + FireNotification(NotificationID.Handle); } } public bool StopRoute { - get => this._stopRoute; + get => _stopRoute; set { - this._stopRoute = value; - this.FireNotification(NotificationID.StopRoute); + _stopRoute = value; + FireNotification(NotificationID.StopRoute); } } public bool Repeat { - get => this._repeat; + get => _repeat; set { - if (this._repeat == value) + if (_repeat == value) return; - this._repeat = value; - this.FireNotification(NotificationID.Repeat); + _repeat = value; + FireNotification(NotificationID.Repeat); } } - public object EventContext => this.CheckEventContext(ref this._eventContext); + public object EventContext => CheckEventContext(ref _eventContext); public bool TrackInvokedKeys { - get => this._invokedKeys != null; + get => _invokedKeys != null; set { - if (this.TrackInvokedKeys == value) + if (TrackInvokedKeys == value) return; - this._invokedKeys = !value ? null : new ArrayList(); - this.FireNotification(NotificationID.TrackInvokedKeys); + _invokedKeys = !value ? null : new ArrayList(); + FireNotification(NotificationID.TrackInvokedKeys); } } public void GetInvokedKeys(IList copyTo) { - if (this.TrackInvokedKeys) + if (TrackInvokedKeys) { - foreach (object invokedKey in this._invokedKeys) + foreach (object invokedKey in _invokedKeys) copyTo.Add(invokedKey); - this._invokedKeys.Clear(); + _invokedKeys.Clear(); } else ErrorManager.ReportError("KeyHandler needs to be marked TrackInvokedKeys=\"true\" in order to call GetInvokedKeys()"); @@ -133,63 +133,63 @@ namespace Microsoft.Iris.InputHandlers { Keys key = info.Key; InputHandlerModifiers modifiers = GetModifiers(info.Modifiers); - if (key != (Keys)this._key) + if (key != (Keys)_key) TranslateKey(ref key, ref modifiers); - if (!this.KeyMatches(key) || !this.ShouldHandleEvent(modifiers)) + if (!KeyMatches(key) || !ShouldHandleEvent(modifiers)) return; bool flag; - if (!this._pressing) + if (!_pressing) { - this._pressing = true; - this.FireNotification(NotificationID.Pressing); + _pressing = true; + FireNotification(NotificationID.Pressing); flag = true; } else - flag = this._repeat; + flag = _repeat; if (flag) { - if (this.HandlerTransition == InputHandlerTransition.Down) - this.InvokeCommand(key); - if (this._handle) + if (HandlerTransition == InputHandlerTransition.Down) + InvokeCommand(key); + if (_handle) info.MarkHandled(); } - if (this._stopRoute) + if (_stopRoute) info.TruncateRoute(); - this.SetEventContext(info.Target, ref this._eventContext, NotificationID.EventContext); + SetEventContext(info.Target, ref _eventContext, NotificationID.EventContext); } protected override void OnKeyUp(UIClass ui, KeyStateInfo info) { Keys key = info.Key; InputHandlerModifiers modifiers = GetModifiers(info.Modifiers); - if (key != (Keys)this._key) + if (key != (Keys)_key) TranslateKey(ref key, ref modifiers); - if (!this.KeyMatches(key) || !this.ShouldHandleEvent(modifiers)) + if (!KeyMatches(key) || !ShouldHandleEvent(modifiers)) return; - this._pressing = false; - this.FireNotification(NotificationID.Pressing); - if (this.HandlerTransition == InputHandlerTransition.Up) - this.InvokeCommand(key); - if (this._handle) + _pressing = false; + FireNotification(NotificationID.Pressing); + if (HandlerTransition == InputHandlerTransition.Up) + InvokeCommand(key); + if (_handle) info.MarkHandled(); - if (this._stopRoute) + if (_stopRoute) info.TruncateRoute(); - this.SetEventContext(info.Target, ref this._eventContext, NotificationID.EventContext); + SetEventContext(info.Target, ref _eventContext, NotificationID.EventContext); } protected override void OnLoseKeyFocus(UIClass ui, KeyFocusInfo info) { - if (!this._pressing) + if (!_pressing) return; - this._pressing = false; - this.FireNotification(NotificationID.Pressing); + _pressing = false; + FireNotification(NotificationID.Pressing); } private bool KeyMatches(Keys candidate) { - if (this._key >= KeyHandlerKey.None) - return candidate == (Keys)this._key; - return this._key == KeyHandlerKey.Any && candidate != Keys.None; + if (_key >= KeyHandlerKey.None) + return candidate == (Keys)_key; + return _key == KeyHandlerKey.Any && candidate != Keys.None; } public static void TranslateKey(ref Keys key, ref InputHandlerModifiers modifiers) => TranslateKey(ref key, ref modifiers, Orientation.Horizontal); @@ -260,14 +260,14 @@ namespace Microsoft.Iris.InputHandlers private void InvokeCommand(Keys key) { - this.FireNotification(NotificationID.Invoked); - if (this._command != null) - this._command.Invoke(); - if (!this.TrackInvokedKeys) + FireNotification(NotificationID.Invoked); + if (_command != null) + _command.Invoke(); + if (!TrackInvokedKeys) return; - this._invokedKeys.Add((KeyHandlerKey)key); + _invokedKeys.Add((KeyHandlerKey)key); } - public override string ToString() => InvariantString.Format("{0}({1})", this.GetType().Name, _key); + public override string ToString() => InvariantString.Format("{0}({1})", GetType().Name, _key); } } diff --git a/UIX/Microsoft/Iris/InputHandlers/ModifierInputHandler.cs b/UIX/Microsoft/Iris/InputHandlers/ModifierInputHandler.cs index 7cf2d84..573970d 100644 --- a/UIX/Microsoft/Iris/InputHandlers/ModifierInputHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/ModifierInputHandler.cs @@ -17,47 +17,47 @@ namespace Microsoft.Iris.InputHandlers public ModifierInputHandler() { - this._handlerTransition = InputHandlerTransition.Up; - this._requiredModifiers = InputHandlerModifiers.None; - this._disallowedModifiers = InputHandlerModifiers.None; + _handlerTransition = InputHandlerTransition.Up; + _requiredModifiers = InputHandlerModifiers.None; + _disallowedModifiers = InputHandlerModifiers.None; } public InputHandlerTransition HandlerTransition { - get => this._handlerTransition; + get => _handlerTransition; set { - if (this._handlerTransition == value) + if (_handlerTransition == value) return; - this._handlerTransition = value; - this.FireNotification(NotificationID.HandlerTransition); + _handlerTransition = value; + FireNotification(NotificationID.HandlerTransition); } } public InputHandlerModifiers RequiredModifiers { - get => this._requiredModifiers; + get => _requiredModifiers; set { - if (this._requiredModifiers == value) + if (_requiredModifiers == value) return; - this._requiredModifiers = value; - this.FireNotification(NotificationID.RequiredModifiers); + _requiredModifiers = value; + FireNotification(NotificationID.RequiredModifiers); } } public InputHandlerModifiers DisallowedModifiers { - get => this._disallowedModifiers; + get => _disallowedModifiers; set { - if (this._disallowedModifiers == value) + if (_disallowedModifiers == value) return; - this._disallowedModifiers = value; - this.FireNotification(NotificationID.DisallowedModifiers); + _disallowedModifiers = value; + FireNotification(NotificationID.DisallowedModifiers); } } - protected bool ShouldHandleEvent(InputHandlerModifiers modifiers) => (this._disallowedModifiers == InputHandlerModifiers.None || !Library.Bits.TestAnyFlags((uint)modifiers, (uint)this._disallowedModifiers)) && (this._requiredModifiers == InputHandlerModifiers.None || Library.Bits.TestAllFlags((uint)modifiers, (uint)this._requiredModifiers)); + protected bool ShouldHandleEvent(InputHandlerModifiers modifiers) => (_disallowedModifiers == InputHandlerModifiers.None || !Library.Bits.TestAnyFlags((uint)modifiers, (uint)_disallowedModifiers)) && (_requiredModifiers == InputHandlerModifiers.None || Library.Bits.TestAllFlags((uint)modifiers, (uint)_requiredModifiers)); } } diff --git a/UIX/Microsoft/Iris/InputHandlers/MouseWheelHandler.cs b/UIX/Microsoft/Iris/InputHandlers/MouseWheelHandler.cs index 1f2226b..7f88bb2 100644 --- a/UIX/Microsoft/Iris/InputHandlers/MouseWheelHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/MouseWheelHandler.cs @@ -14,36 +14,36 @@ namespace Microsoft.Iris.InputHandlers { private bool _handle; - public MouseWheelHandler() => this._handle = true; + public MouseWheelHandler() => _handle = true; protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.MouseInteractive = true; - this.UI.KeyInteractive = true; + UI.MouseInteractive = true; + UI.KeyInteractive = true; } public bool Handle { - get => this._handle; + get => _handle; set { - if (this._handle == value) + if (_handle == value) return; - this._handle = value; - this.FireNotification(NotificationID.Handle); + _handle = value; + FireNotification(NotificationID.Handle); } } protected override void OnMouseWheel(UIClass ui, MouseWheelInfo info) { if (info.WheelDelta > 0) - this.FireNotification(NotificationID.UpInvoked); + FireNotification(NotificationID.UpInvoked); else - this.FireNotification(NotificationID.DownInvoked); - if (!this._handle) + FireNotification(NotificationID.DownInvoked); + if (!_handle) return; info.MarkHandled(); } diff --git a/UIX/Microsoft/Iris/InputHandlers/ScrollingHandler.cs b/UIX/Microsoft/Iris/InputHandlers/ScrollingHandler.cs index 6d4e617..bbd223e 100644 --- a/UIX/Microsoft/Iris/InputHandlers/ScrollingHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/ScrollingHandler.cs @@ -28,205 +28,205 @@ namespace Microsoft.Iris.InputHandlers public ScrollingHandler() { - this._handleDirectionalKeysFlag = true; - this._handlePageKeysFlag = true; - this._handlePageCommandsFlag = true; - this._handleHomeEndKeysFlag = true; - this._handleMouseWheelFlag = true; - this._useFocusBehavior = true; - this.HandlerStage = InputHandlerStage.Direct | InputHandlerStage.Bubbled; + _handleDirectionalKeysFlag = true; + _handlePageKeysFlag = true; + _handlePageCommandsFlag = true; + _handleHomeEndKeysFlag = true; + _handleMouseWheelFlag = true; + _useFocusBehavior = true; + HandlerStage = InputHandlerStage.Direct | InputHandlerStage.Bubbled; } protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - if (this._handleDirectionalKeysFlag || this._handlePageKeysFlag || (this._handleHomeEndKeysFlag || this._handlePageCommandsFlag)) - this.UI.KeyInteractive = true; - if (!this._handleMouseWheelFlag) + if (_handleDirectionalKeysFlag || _handlePageKeysFlag || (_handleHomeEndKeysFlag || _handlePageCommandsFlag)) + UI.KeyInteractive = true; + if (!_handleMouseWheelFlag) return; - this.UI.MouseInteractive = true; + UI.MouseInteractive = true; } public bool HandleDirectionalKeys { - get => this._handleDirectionalKeysFlag; + get => _handleDirectionalKeysFlag; set { - if (this._handleDirectionalKeysFlag == value) + if (_handleDirectionalKeysFlag == value) return; - this._handleDirectionalKeysFlag = value; - this.FireNotification(NotificationID.HandleDirectionalKeys); + _handleDirectionalKeysFlag = value; + FireNotification(NotificationID.HandleDirectionalKeys); } } public bool HandlePageKeys { - get => this._handlePageKeysFlag; + get => _handlePageKeysFlag; set { - if (this._handlePageKeysFlag == value) + if (_handlePageKeysFlag == value) return; - this._handlePageKeysFlag = value; - this.FireNotification(NotificationID.HandlePageKeys); + _handlePageKeysFlag = value; + FireNotification(NotificationID.HandlePageKeys); } } public bool HandleHomeEndKeys { - get => this._handleHomeEndKeysFlag; + get => _handleHomeEndKeysFlag; set { - if (this._handleHomeEndKeysFlag == value) + if (_handleHomeEndKeysFlag == value) return; - this._handleHomeEndKeysFlag = value; - this.FireNotification(NotificationID.HandleHomeEndKeys); + _handleHomeEndKeysFlag = value; + FireNotification(NotificationID.HandleHomeEndKeys); } } public bool HandlePageCommands { - get => this._handlePageCommandsFlag; + get => _handlePageCommandsFlag; set { - if (this._handlePageCommandsFlag == value) + if (_handlePageCommandsFlag == value) return; - this._handlePageCommandsFlag = value; - this.FireNotification(NotificationID.HandlePageCommands); + _handlePageCommandsFlag = value; + FireNotification(NotificationID.HandlePageCommands); } } public bool HandleMouseWheel { - get => this._handleMouseWheelFlag; + get => _handleMouseWheelFlag; set { - if (this._handleMouseWheelFlag == value) + if (_handleMouseWheelFlag == value) return; - this._handleMouseWheelFlag = value; - this.FireNotification(NotificationID.HandleMouseWheel); + _handleMouseWheelFlag = value; + FireNotification(NotificationID.HandleMouseWheel); } } public ScrollModel ScrollModel { - get => this._model; + get => _model; set { - if (this._model == value) + if (_model == value) return; - this._model = value; - this.FireNotification(NotificationID.ScrollModel); + _model = value; + FireNotification(NotificationID.ScrollModel); } } public bool UseFocusBehavior { - get => this._useFocusBehavior; + get => _useFocusBehavior; set { - if (this._useFocusBehavior == value) + if (_useFocusBehavior == value) return; - this._useFocusBehavior = value; - this.FireNotification(NotificationID.UseFocusBehavior); + _useFocusBehavior = value; + FireNotification(NotificationID.UseFocusBehavior); } } - private bool ValidScrollModel => this._model != null && this._model.Enabled; + private bool ValidScrollModel => _model != null && _model.Enabled; protected override void OnGainKeyFocus(UIClass sender, KeyFocusInfo info) { - if (!this.ValidScrollModel || !this._useFocusBehavior) + if (!ValidScrollModel || !_useFocusBehavior) return; - this._model.NotifyFocusChange(info.Target as UIClass); + _model.NotifyFocusChange(info.Target as UIClass); } protected override void OnKeyDown(UIClass ui, KeyStateInfo info) { - if (!this.ValidScrollModel) + if (!ValidScrollModel) return; - if (info.Key != this._currentCampingKey) - this.EndCamp(); + if (info.Key != _currentCampingKey) + EndCamp(); Keys key = info.Key; InputHandlerModifiers modifiers = GetModifiers(info.Modifiers); - KeyHandler.TranslateKey(ref key, ref modifiers, this.Orientation); - switch (this.ShouldHandleKey(key)) + KeyHandler.TranslateKey(ref key, ref modifiers, Orientation); + switch (ShouldHandleKey(key)) { case HandleKeyPolicy.None: return; case HandleKeyPolicy.Up: - this._model.ScrollUp(this._useFocusBehavior); + _model.ScrollUp(_useFocusBehavior); break; case HandleKeyPolicy.Down: - this._model.ScrollDown(this._useFocusBehavior); + _model.ScrollDown(_useFocusBehavior); break; case HandleKeyPolicy.PageUp: - this._model.PageUp(this._useFocusBehavior); + _model.PageUp(_useFocusBehavior); break; case HandleKeyPolicy.PageDown: - this._model.PageDown(this._useFocusBehavior); + _model.PageDown(_useFocusBehavior); break; case HandleKeyPolicy.Home: - this._model.Home(this._useFocusBehavior); + _model.Home(_useFocusBehavior); break; case HandleKeyPolicy.End: - this._model.End(this._useFocusBehavior); + _model.End(_useFocusBehavior); break; } - this.BeginCamp(info.Key); + BeginCamp(info.Key); info.MarkHandled(); } private void BeginCamp(Keys key) { - if (!this.IsCamping) - this._model.BeginCamp(); - this._currentCampingKey = key; + if (!IsCamping) + _model.BeginCamp(); + _currentCampingKey = key; } private void EndCamp() { - if (!this.IsCamping) + if (!IsCamping) return; - this._model.EndCamp(); - this._currentCampingKey = Keys.None; + _model.EndCamp(); + _currentCampingKey = Keys.None; } - private bool IsCamping => this._currentCampingKey != Keys.None; + private bool IsCamping => _currentCampingKey != Keys.None; protected override void OnKeyUp(UIClass ui, KeyStateInfo info) { - if (!this.ValidScrollModel) + if (!ValidScrollModel) return; - if (info.Key == this._currentCampingKey) - this.EndCamp(); + if (info.Key == _currentCampingKey) + EndCamp(); Keys key = info.Key; InputHandlerModifiers modifiers = GetModifiers(info.Modifiers); - KeyHandler.TranslateKey(ref key, ref modifiers, this.Orientation); - if (this.ShouldHandleKey(key) == HandleKeyPolicy.None) + KeyHandler.TranslateKey(ref key, ref modifiers, Orientation); + if (ShouldHandleKey(key) == HandleKeyPolicy.None) return; info.MarkHandled(); } - protected override void OnLoseDeepKeyFocus() => this.EndCamp(); + protected override void OnLoseDeepKeyFocus() => EndCamp(); protected override void OnCommandDown(UIClass ui, KeyCommandInfo info) { - if (!this.ValidScrollModel || info.Action != KeyAction.Down) + if (!ValidScrollModel || info.Action != KeyAction.Down) return; switch (info.Command) { case CommandCode.ChannelUp: - if (!this._handlePageCommandsFlag) + if (!_handlePageCommandsFlag) break; - this._model.PageUp(); + _model.PageUp(); info.MarkHandled(); break; case CommandCode.ChannelDown: - if (!this._handlePageCommandsFlag) + if (!_handlePageCommandsFlag) break; - this._model.PageDown(); + _model.PageDown(); info.MarkHandled(); break; } @@ -238,7 +238,7 @@ namespace Microsoft.Iris.InputHandlers { case CommandCode.ChannelUp: case CommandCode.ChannelDown: - if (!this._handlePageCommandsFlag) + if (!_handlePageCommandsFlag) break; info.MarkHandled(); break; @@ -247,16 +247,16 @@ namespace Microsoft.Iris.InputHandlers protected override void OnMouseWheel(UIClass ui, MouseWheelInfo info) { - if (!this._handleMouseWheelFlag || !this.ValidScrollModel || this.InputHasKeyModifiers(info)) + if (!_handleMouseWheelFlag || !ValidScrollModel || InputHasKeyModifiers(info)) return; - this._cumulativeMouseWheelDelta += -info.WheelDelta; - if (Math.Abs(this._cumulativeMouseWheelDelta) >= 120) + _cumulativeMouseWheelDelta += -info.WheelDelta; + if (Math.Abs(_cumulativeMouseWheelDelta) >= 120) { - if (this._cumulativeMouseWheelDelta > 0) - this._model.ScrollDown(this._cumulativeMouseWheelDelta / 120); + if (_cumulativeMouseWheelDelta > 0) + _model.ScrollDown(_cumulativeMouseWheelDelta / 120); else - this._model.ScrollUp(Math.Abs(this._cumulativeMouseWheelDelta / 120)); - this._cumulativeMouseWheelDelta %= 120; + _model.ScrollUp(Math.Abs(_cumulativeMouseWheelDelta / 120)); + _cumulativeMouseWheelDelta %= 120; } info.MarkHandled(); } @@ -267,56 +267,56 @@ namespace Microsoft.Iris.InputHandlers switch (key) { case Keys.PageUp: - if (this._handlePageKeysFlag) + if (_handlePageKeysFlag) { handleKeyPolicy = HandleKeyPolicy.PageUp; break; } break; case Keys.Next: - if (this._handlePageKeysFlag) + if (_handlePageKeysFlag) { handleKeyPolicy = HandleKeyPolicy.PageDown; break; } break; case Keys.End: - if (this._handleHomeEndKeysFlag) + if (_handleHomeEndKeysFlag) { handleKeyPolicy = HandleKeyPolicy.End; break; } break; case Keys.Home: - if (this._handleHomeEndKeysFlag) + if (_handleHomeEndKeysFlag) { handleKeyPolicy = HandleKeyPolicy.Home; break; } break; case Keys.Left: - if (this._handleDirectionalKeysFlag && this.Orientation == Orientation.Horizontal) + if (_handleDirectionalKeysFlag && Orientation == Orientation.Horizontal) { - handleKeyPolicy = this.UI.Zone.Session.IsRtl ? HandleKeyPolicy.Down : HandleKeyPolicy.Up; + handleKeyPolicy = UI.Zone.Session.IsRtl ? HandleKeyPolicy.Down : HandleKeyPolicy.Up; break; } break; case Keys.Up: - if (this._handleDirectionalKeysFlag && this.Orientation == Orientation.Vertical) + if (_handleDirectionalKeysFlag && Orientation == Orientation.Vertical) { handleKeyPolicy = HandleKeyPolicy.Up; break; } break; case Keys.Right: - if (this._handleDirectionalKeysFlag && this.Orientation == Orientation.Horizontal) + if (_handleDirectionalKeysFlag && Orientation == Orientation.Horizontal) { - handleKeyPolicy = this.UI.Zone.Session.IsRtl ? HandleKeyPolicy.Up : HandleKeyPolicy.Down; + handleKeyPolicy = UI.Zone.Session.IsRtl ? HandleKeyPolicy.Up : HandleKeyPolicy.Down; break; } break; case Keys.Down: - if (this._handleDirectionalKeysFlag && this.Orientation == Orientation.Vertical) + if (_handleDirectionalKeysFlag && Orientation == Orientation.Vertical) { handleKeyPolicy = HandleKeyPolicy.Down; break; @@ -331,7 +331,7 @@ namespace Microsoft.Iris.InputHandlers get { Orientation orientation = Orientation.Horizontal; - if (this._model.TargetViewItem is Scroller targetViewItem) + if (_model.TargetViewItem is Scroller targetViewItem) orientation = targetViewItem.Orientation; return orientation; } diff --git a/UIX/Microsoft/Iris/InputHandlers/ShortcutHandler.cs b/UIX/Microsoft/Iris/InputHandlers/ShortcutHandler.cs index 4d7fb9b..077395e 100644 --- a/UIX/Microsoft/Iris/InputHandlers/ShortcutHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/ShortcutHandler.cs @@ -18,77 +18,77 @@ namespace Microsoft.Iris.InputHandlers private IUICommand _command; private bool _handle; - public ShortcutHandler() => this._handle = true; + public ShortcutHandler() => _handle = true; protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.KeyInteractive = true; + UI.KeyInteractive = true; } public ShortcutHandlerCommand Shortcut { - get => this._shortcut; + get => _shortcut; set { - if (this._shortcut == value) + if (_shortcut == value) return; - this._shortcut = value; - this.FireNotification(NotificationID.Shortcut); + _shortcut = value; + FireNotification(NotificationID.Shortcut); } } public IUICommand Command { - get => this._command; + get => _command; set { - if (this._command == value) + if (_command == value) return; - this._command = value; - this.FireNotification(NotificationID.Command); + _command = value; + FireNotification(NotificationID.Command); } } public bool Handle { - get => this._handle; + get => _handle; set { - if (this._handle == value) + if (_handle == value) return; - this._handle = value; - this.FireNotification(NotificationID.Handle); + _handle = value; + FireNotification(NotificationID.Handle); } } protected override void OnCommandDown(UIClass ui, KeyCommandInfo info) { - if (info.Command != (CommandCode)this._shortcut) + if (info.Command != (CommandCode)_shortcut) return; - this.InvokeCommand(); - if (!this._handle) + InvokeCommand(); + if (!_handle) return; info.MarkHandled(); } protected override void OnCommandUp(UIClass ui, KeyCommandInfo info) { - if (info.Command != (CommandCode)this._shortcut || !this._handle) + if (info.Command != (CommandCode)_shortcut || !_handle) return; info.MarkHandled(); } private void InvokeCommand() { - this.FireNotification(NotificationID.Invoked); - if (this._command == null) + FireNotification(NotificationID.Invoked); + if (_command == null) return; - this._command.Invoke(); + _command.Invoke(); } - public override string ToString() => InvariantString.Format("{0}({1})", this.GetType().Name, _shortcut); + public override string ToString() => InvariantString.Format("{0}({1})", GetType().Name, _shortcut); } } diff --git a/UIX/Microsoft/Iris/InputHandlers/TextEditingHandler.cs b/UIX/Microsoft/Iris/InputHandlers/TextEditingHandler.cs index 0de2f63..8c2dc40 100644 --- a/UIX/Microsoft/Iris/InputHandlers/TextEditingHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/TextEditingHandler.cs @@ -60,183 +60,183 @@ namespace Microsoft.Iris.InputHandlers public TextEditingHandler() { - this._caretInfo = new CaretInfo(); - this._editControl = new RichText(true, this); - this._maxLengthChangedHandler = new EventHandler(this.OnEditableTextMaxLengthChanged); - this._readOnlyChangedHandler = new EventHandler(this.OnEditableTextReadOnlyChanged); - this._valueChangedHandler = new EventHandler(this.OnEditableTextValueChanged); - this._activationStateHandler = new EventHandler(this.OnActivationChanged); - this.SetBit(Bits.AcceptsEnter); + _caretInfo = new CaretInfo(); + _editControl = new RichText(true, this); + _maxLengthChangedHandler = new EventHandler(OnEditableTextMaxLengthChanged); + _readOnlyChangedHandler = new EventHandler(OnEditableTextReadOnlyChanged); + _valueChangedHandler = new EventHandler(OnEditableTextValueChanged); + _activationStateHandler = new EventHandler(OnActivationChanged); + SetBit(Bits.AcceptsEnter); } protected override void OnDispose() { base.OnDispose(); - this.RemoveEditableTextEventHandlers(); - this.UnregisterImeMessageHandler(); - if (this._activationStateNotifier != null) - this.UpdateActivationStateHandler(false); - this.HorizontalScrollModel = null; - this.VerticalScrollModel = null; - this._editControl.Dispose(); + RemoveEditableTextEventHandlers(); + UnregisterImeMessageHandler(); + if (_activationStateNotifier != null) + UpdateActivationStateHandler(false); + HorizontalScrollModel = null; + VerticalScrollModel = null; + _editControl.Dispose(); } protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.MouseInteractive = true; - this.UI.KeyInteractive = true; + UI.MouseInteractive = true; + UI.KeyInteractive = true; } public override void OnZoneAttached() { - if (!this.UI.DirectKeyFocus) + if (!UI.DirectKeyFocus) return; - this.UpdateActivationStateHandler(true); + UpdateActivationStateHandler(true); } private void OnActivationChanged(object sender, EventArgs ea) { - this.WindowIsActivated = this._activationStateNotifier.ActivationState; - this.UpdateCaretVisibility(); + WindowIsActivated = _activationStateNotifier.ActivationState; + UpdateCaretVisibility(); } public EditableTextData EditableTextData { - get => this._editData; + get => _editData; set { - if (this._editData == value) + if (_editData == value) return; - this.RemoveEditableTextEventHandlers(); - this._editData = value; - if (this._editData != null) + RemoveEditableTextEventHandlers(); + _editData = value; + if (_editData != null) { - this.AddEditableTextEventHandlers(); - this.UpdateMaxLengthOnRichEdit(); - this.UpdateReadOnlyOnRichEdit(); - this.UpdateContentOnRichEdit(); + AddEditableTextEventHandlers(); + UpdateMaxLengthOnRichEdit(); + UpdateReadOnlyOnRichEdit(); + UpdateContentOnRichEdit(); } - this.FireThreadSafeNotification(NotificationID.EditableTextData); + FireThreadSafeNotification(NotificationID.EditableTextData); } } private void RemoveEditableTextEventHandlers() { - if (this._editData == null) + if (_editData == null) return; - this._editData.MaxLengthChanged -= this._maxLengthChangedHandler; - this._editData.ReadOnlyChanged -= this._readOnlyChangedHandler; - this._editData.ValueChanged -= this._valueChangedHandler; + _editData.MaxLengthChanged -= _maxLengthChangedHandler; + _editData.ReadOnlyChanged -= _readOnlyChangedHandler; + _editData.ValueChanged -= _valueChangedHandler; } private void AddEditableTextEventHandlers() { - this._editData.MaxLengthChanged += this._maxLengthChangedHandler; - this._editData.ReadOnlyChanged += this._readOnlyChangedHandler; - this._editData.ValueChanged += this._valueChangedHandler; + _editData.MaxLengthChanged += _maxLengthChangedHandler; + _editData.ReadOnlyChanged += _readOnlyChangedHandler; + _editData.ValueChanged += _valueChangedHandler; } - private void UnregisterImeMessageHandler() => RendererApi.IFC(NativeApi.SpUnregisterImeCallbacks(this._ImeCallbackToken)); + private void UnregisterImeMessageHandler() => RendererApi.IFC(NativeApi.SpUnregisterImeCallbacks(_ImeCallbackToken)); - private void OnEditableTextMaxLengthChanged(object sender, EventArgs unused) => this.UpdateMaxLengthOnRichEdit(); + private void OnEditableTextMaxLengthChanged(object sender, EventArgs unused) => UpdateMaxLengthOnRichEdit(); - private void OnEditableTextReadOnlyChanged(object sender, EventArgs unused) => this.UpdateReadOnlyOnRichEdit(); + private void OnEditableTextReadOnlyChanged(object sender, EventArgs unused) => UpdateReadOnlyOnRichEdit(); private void OnEditableTextValueChanged(object sender, EventArgs unused) { - if (this.InsideValueChangeOnEditableTextData) + if (InsideValueChangeOnEditableTextData) return; - this.UpdateContentOnRichEdit(); + UpdateContentOnRichEdit(); } private void UpdateContentOnRichEdit() { - if (this._editData == null) + if (_editData == null) return; - this.InsideContentChangeOnRichEdit = true; - this._editControl.Content = this._editData.Value; - if (this._textDisplay != null) - this._textDisplay.MarkScaleDirty(); - this.InsideContentChangeOnRichEdit = false; + InsideContentChangeOnRichEdit = true; + _editControl.Content = _editData.Value; + if (_textDisplay != null) + _textDisplay.MarkScaleDirty(); + InsideContentChangeOnRichEdit = false; } private void UpdateReadOnlyOnRichEdit() { - this._editControl.ReadOnly = this._editData.ReadOnly; - this.UpdateSelectionAndReadOnlyCommands(); + _editControl.ReadOnly = _editData.ReadOnly; + UpdateSelectionAndReadOnlyCommands(); } - private void UpdateMaxLengthOnRichEdit() => this._editControl.MaxLength = this._editData.MaxLength; + private void UpdateMaxLengthOnRichEdit() => _editControl.MaxLength = _editData.MaxLength; public Text TextDisplay { - get => this._textDisplay; + get => _textDisplay; set { - if (this._textDisplay == value) + if (_textDisplay == value) return; - LayoutCompleteEventHandler completeEventHandler = new LayoutCompleteEventHandler(this.TextLayoutComplete); - if (this._textDisplay != null) + LayoutCompleteEventHandler completeEventHandler = new LayoutCompleteEventHandler(TextLayoutComplete); + if (_textDisplay != null) { - this._textDisplay.ExternalRasterizer = null; - this._textDisplay.ExternalEditingHandler = null; - this._textDisplay.LayoutComplete -= completeEventHandler; + _textDisplay.ExternalRasterizer = null; + _textDisplay.ExternalEditingHandler = null; + _textDisplay.LayoutComplete -= completeEventHandler; } - this._textDisplay = value; - if (this._textDisplay != null) + _textDisplay = value; + if (_textDisplay != null) { - this._textDisplay.ExternalRasterizer = this._editControl; - this._textDisplay.ExternalEditingHandler = this; - this._textDisplay.OnDisplayedContentChange(); - this._textDisplay.LayoutComplete += completeEventHandler; - this.InputOffsetDirty = true; + _textDisplay.ExternalRasterizer = _editControl; + _textDisplay.ExternalEditingHandler = this; + _textDisplay.OnDisplayedContentChange(); + _textDisplay.LayoutComplete += completeEventHandler; + InputOffsetDirty = true; } - this.FireThreadSafeNotification(NotificationID.TextDisplay); + FireThreadSafeNotification(NotificationID.TextDisplay); } } - private void TextLayoutComplete(object sender) => this.InputOffsetDirty = true; + private void TextLayoutComplete(object sender) => InputOffsetDirty = true; - private void FireTypingInputRejectedEvent() => this.FireThreadSafeNotification(NotificationID.TypingInputRejected); + private void FireTypingInputRejectedEvent() => FireThreadSafeNotification(NotificationID.TypingInputRejected); public bool DetectUrls { - get => this.GetBit(Bits.DetectUrls); + get => GetBit(Bits.DetectUrls); set { - if (!this.ChangeBit(Bits.DetectUrls, value)) + if (!ChangeBit(Bits.DetectUrls, value)) return; - this._editControl.DetectUrls = value; - this.FireThreadSafeNotification(NotificationID.DetectUrls); + _editControl.DetectUrls = value; + FireThreadSafeNotification(NotificationID.DetectUrls); } } public Color LinkColor { - get => this._linkColor; + get => _linkColor; set { - if (!(this._linkColor != value)) + if (!(_linkColor != value)) return; - this._linkColor = value; - this.FireThreadSafeNotification(NotificationID.LinkColor); + _linkColor = value; + FireThreadSafeNotification(NotificationID.LinkColor); } } - private void FireLinkClicked() => this.FireThreadSafeNotification(NotificationID.LinkClicked); + private void FireLinkClicked() => FireThreadSafeNotification(NotificationID.LinkClicked); public string LinkClickedParameter { - get => this._linkClickedParameter; + get => _linkClickedParameter; private set { - if (!(this._linkClickedParameter != value)) + if (!(_linkClickedParameter != value)) return; - this._linkClickedParameter = value; - this.FireThreadSafeNotification(NotificationID.LinkClickedParameter); + _linkClickedParameter = value; + FireThreadSafeNotification(NotificationID.LinkClickedParameter); } } @@ -249,60 +249,60 @@ namespace Microsoft.Iris.InputHandlers cursorId = CursorID.IBeam; break; } - if (cursorId != this._cursor) + if (cursorId != _cursor) { - this._cursor = cursorId; - this.UpdateCursor(); + _cursor = cursorId; + UpdateCursor(); } return new HRESULT(0); } - internal override CursorID GetCursor() => this._cursor; + internal override CursorID GetCursor() => _cursor; private bool IgnoreReadOnlyChar(char character) => character == '\r' || character == '\t'; protected override void OnKeyDown(UIClass ui, KeyStateInfo info) { - bool flag = this.ForwardKeyStateChange(info); + bool flag = ForwardKeyStateChange(info); switch (info.Key) { case Keys.Back: - if (this._editData.ReadOnly) - this.FireTypingInputRejectedEvent(); + if (_editData.ReadOnly) + FireTypingInputRejectedEvent(); info.MarkHandled(); break; case Keys.Tab: if (flag) info.MarkHandled(); - this.HandledTabKeyDown = info.Handled; + HandledTabKeyDown = info.Handled; break; case Keys.Enter: - if (!info.Handled && this.AcceptsEnter && (info.Modifiers == InputModifiers.None && !this._editData.ReadOnly)) + if (!info.Handled && AcceptsEnter && (info.Modifiers == InputModifiers.None && !_editData.ReadOnly)) { - this._editData.Submit(); + _editData.Submit(); info.MarkHandled(); } - this.HandledEnterKeyDown = info.Handled; + HandledEnterKeyDown = info.Handled; break; } } protected override void OnKeyCharacter(UIClass ui, KeyCharacterInfo info) { - if (this.ForwardKeyCharacter(info) && !info.Handled && (this._editData.ReadOnly && !this.IgnoreReadOnlyChar(info.Character))) - this.FireTypingInputRejectedEvent(); + if (ForwardKeyCharacter(info) && !info.Handled && (_editData.ReadOnly && !IgnoreReadOnlyChar(info.Character))) + FireTypingInputRejectedEvent(); switch (info.Character) { case '\b': info.MarkHandled(); break; case '\t': - if (!this.HandledTabKeyDown) + if (!HandledTabKeyDown) break; info.MarkHandled(); break; case '\r': - if (!this.HandledEnterKeyDown) + if (!HandledEnterKeyDown) break; info.MarkHandled(); break; @@ -311,23 +311,23 @@ namespace Microsoft.Iris.InputHandlers protected override void OnKeyUp(UIClass ui, KeyStateInfo info) { - this.ForwardKeyStateChange(info); + ForwardKeyStateChange(info); switch (info.Key) { case Keys.Back: info.MarkHandled(); break; case Keys.Tab: - if (!this.HandledTabKeyDown) + if (!HandledTabKeyDown) break; info.MarkHandled(); - this.HandledTabKeyDown = false; + HandledTabKeyDown = false; break; case Keys.Enter: - if (!this.HandledEnterKeyDown) + if (!HandledEnterKeyDown) break; info.MarkHandled(); - this.HandledEnterKeyDown = false; + HandledEnterKeyDown = false; break; } } @@ -338,10 +338,10 @@ namespace Microsoft.Iris.InputHandlers switch (info.Key) { case Keys.Tab: - flag = info.Action != KeyAction.Down ? this.HandledTabKeyDown : this.AcceptsTab; + flag = info.Action != KeyAction.Down ? HandledTabKeyDown : AcceptsTab; break; case Keys.Enter: - flag = info.Action != KeyAction.Down ? this.HandledEnterKeyDown : this.AcceptsEnter; + flag = info.Action != KeyAction.Down ? HandledEnterKeyDown : AcceptsEnter; break; } return flag; @@ -353,10 +353,10 @@ namespace Microsoft.Iris.InputHandlers switch (info.Character) { case '\t': - flag = this.HandledTabKeyDown; + flag = HandledTabKeyDown; break; case '\r': - flag = this.HandledEnterKeyDown; + flag = HandledEnterKeyDown; break; } return flag; @@ -364,45 +364,45 @@ namespace Microsoft.Iris.InputHandlers private bool ForwardKeyStateChange(KeyStateInfo info) { - if (!this.ForwardKeyToRichEdit(info)) + if (!ForwardKeyToRichEdit(info)) return false; - if (this._editControl.ForwardKeyStateNotification(info.NativeMessageID, (int)info.Key, info.ScanCode, (int)info.RepeatCount, (uint)info.Modifiers, info.KeyboardFlags)) + if (_editControl.ForwardKeyStateNotification(info.NativeMessageID, (int)info.Key, info.ScanCode, (int)info.RepeatCount, (uint)info.Modifiers, info.KeyboardFlags)) info.MarkHandled(); return true; } private bool ForwardKeyCharacter(KeyCharacterInfo info) { - if (!this.ForwardKeyCharacterToRichEdit(info)) + if (!ForwardKeyCharacterToRichEdit(info)) return false; - if (this._editControl.ForwardKeyCharacterNotification(info.NativeMessageID, info.Character, info.ScanCode, (int)info.RepeatCount, (uint)info.Modifiers, info.KeyboardFlags)) + if (_editControl.ForwardKeyCharacterNotification(info.NativeMessageID, info.Character, info.ScanCode, (int)info.RepeatCount, (uint)info.Modifiers, info.KeyboardFlags)) info.MarkHandled(); return true; } protected override void OnGainKeyFocus(UIClass ui, KeyFocusInfo info) { - RendererApi.IFC(NativeApi.SpRegisterImeCallbacks(this, out this._ImeCallbackToken)); - this._editControl.NotifyOfFocusChange(true); - if (this.Overtype) - this.SelectAll(); - this.DeliverPendingPointerDown(); - if (this.UI.IsZoned) - this.UpdateActivationStateHandler(true); - if (!this._textDisplay.UsePasswordMask && !this._textDisplay.DisableIme) + RendererApi.IFC(NativeApi.SpRegisterImeCallbacks(this, out _ImeCallbackToken)); + _editControl.NotifyOfFocusChange(true); + if (Overtype) + SelectAll(); + DeliverPendingPointerDown(); + if (UI.IsZoned) + UpdateActivationStateHandler(true); + if (!_textDisplay.UsePasswordMask && !_textDisplay.DisableIme) return; - RendererApi.IFC(NativeApi.SpPostDeferredImeMessage(1032U, new UIntPtr(this._ImeCallbackToken), UIntPtr.Zero)); + RendererApi.IFC(NativeApi.SpPostDeferredImeMessage(1032U, new UIntPtr(_ImeCallbackToken), UIntPtr.Zero)); } protected override void OnLoseKeyFocus(UIClass ui, KeyFocusInfo info) { - this._editControl.NotifyOfFocusChange(false); - this.HandledEnterKeyDown = false; - this.HandledTabKeyDown = false; - if (this.UI.IsZoned) - this.UpdateActivationStateHandler(false); - this.ClearPendingPointerDown(); - RendererApi.IFC(NativeApi.SpUnregisterImeCallbacks(this._ImeCallbackToken)); + _editControl.NotifyOfFocusChange(false); + HandledEnterKeyDown = false; + HandledTabKeyDown = false; + if (UI.IsZoned) + UpdateActivationStateHandler(false); + ClearPendingPointerDown(); + RendererApi.IFC(NativeApi.SpUnregisterImeCallbacks(_ImeCallbackToken)); } protected override void OnLoseMouseFocus(UIClass ui, MouseFocusInfo info) @@ -413,64 +413,64 @@ namespace Microsoft.Iris.InputHandlers { if (add) { - this._activationStateNotifier = UI.Zone.Form; - this._activationStateNotifier.ActivationChange += this._activationStateHandler; - this.OnActivationChanged(null, EventArgs.Empty); + _activationStateNotifier = UI.Zone.Form; + _activationStateNotifier.ActivationChange += _activationStateHandler; + OnActivationChanged(null, EventArgs.Empty); } else { - this._activationStateNotifier.ActivationChange -= this._activationStateHandler; - this._activationStateNotifier = null; + _activationStateNotifier.ActivationChange -= _activationStateHandler; + _activationStateNotifier = null; } } - protected override void OnMouseDoubleClick(UIClass ui, MouseButtonInfo info) => this.ForwardMouseInput(info); + protected override void OnMouseDoubleClick(UIClass ui, MouseButtonInfo info) => ForwardMouseInput(info); - protected override void OnMouseMove(UIClass ui, MouseMoveInfo info) => this.ForwardMouseInput(info); + protected override void OnMouseMove(UIClass ui, MouseMoveInfo info) => ForwardMouseInput(info); protected override void OnMousePrimaryDown(UIClass ui, MouseButtonInfo info) { - this._pendingPointerDown = info; + _pendingPointerDown = info; info.Lock(); - if (!this.UI.DirectKeyFocus && this.HandlerStage == InputHandlerStage.Direct && this.UI.KeyFocusOnMouseDown) + if (!UI.DirectKeyFocus && HandlerStage == InputHandlerStage.Direct && UI.KeyFocusOnMouseDown) return; - this.DeliverPendingPointerDown(); + DeliverPendingPointerDown(); } private void DeliverPendingPointerDown() { - if (this._pendingPointerDown == null) + if (_pendingPointerDown == null) return; - this.MousePrimaryDown = true; - MouseButtonInfo pendingPointerDown = (MouseButtonInfo)this._pendingPointerDown; - this._savedMouseYPositionToWorkAroundRichEditBug = pendingPointerDown.Y; - this.ForwardMouseInput(pendingPointerDown); - this.ClearPendingPointerDown(); + MousePrimaryDown = true; + MouseButtonInfo pendingPointerDown = (MouseButtonInfo)_pendingPointerDown; + _savedMouseYPositionToWorkAroundRichEditBug = pendingPointerDown.Y; + ForwardMouseInput(pendingPointerDown); + ClearPendingPointerDown(); } private void ClearPendingPointerDown() { - if (this._pendingPointerDown == null) + if (_pendingPointerDown == null) return; - this._pendingPointerDown.Unlock(); - this._pendingPointerDown = null; + _pendingPointerDown.Unlock(); + _pendingPointerDown = null; } protected override void OnMousePrimaryUp(UIClass ui, MouseButtonInfo info) { - this.MousePrimaryDown = false; - this.ForwardMouseInput(info); + MousePrimaryDown = false; + ForwardMouseInput(info); } - protected override void OnMouseSecondaryDown(UIClass ui, MouseButtonInfo info) => this.ForwardMouseInput(info); + protected override void OnMouseSecondaryDown(UIClass ui, MouseButtonInfo info) => ForwardMouseInput(info); - protected override void OnMouseSecondaryUp(UIClass ui, MouseButtonInfo info) => this.ForwardMouseInput(info); + protected override void OnMouseSecondaryUp(UIClass ui, MouseButtonInfo info) => ForwardMouseInput(info); protected override void OnMouseWheel(UIClass ui, MouseWheelInfo info) { - if (!this._textDisplay.WordWrap) + if (!_textDisplay.WordWrap) return; - this.ForwardMouseInput(info); + ForwardMouseInput(info); } private bool ForwardMouseInput( @@ -481,57 +481,57 @@ namespace Microsoft.Iris.InputHandlers int inputY, int wheelDelta) { - if (this.InputOffsetDirty) + if (InputOffsetDirty) { Vector3 parentOffsetPxlVector; ViewItem.GetAccumulatedOffsetAndScale(_textDisplay, UI.RootItem, out parentOffsetPxlVector, out Vector3 _); - this._inputOffset = new Point((int)Math.Floor(parentOffsetPxlVector.X), (int)Math.Floor(parentOffsetPxlVector.Y)); - this.InputOffsetDirty = false; + _inputOffset = new Point((int)Math.Floor(parentOffsetPxlVector.X), (int)Math.Floor(parentOffsetPxlVector.Y)); + InputOffsetDirty = false; } - int x = inputX - this._inputOffset.X; - int y = inputY - this._inputOffset.Y; - if (this.MousePrimaryDown && this._textDisplay != null && !this._textDisplay.WordWrap) - y = this._savedMouseYPositionToWorkAroundRichEditBug - this._inputOffset.Y; - return this._editControl.ForwardMouseInput(nativeMessageID, (uint)modifiers, (int)button, x, y, wheelDelta); + int x = inputX - _inputOffset.X; + int y = inputY - _inputOffset.Y; + if (MousePrimaryDown && _textDisplay != null && !_textDisplay.WordWrap) + y = _savedMouseYPositionToWorkAroundRichEditBug - _inputOffset.Y; + return _editControl.ForwardMouseInput(nativeMessageID, (uint)modifiers, (int)button, x, y, wheelDelta); } private void ForwardMouseInput(MouseActionInfo info) { - if (!this.ForwardMouseInput(info.NativeMessageID, info.Modifiers, info.Button, info.X, info.Y, info.WheelDelta)) + if (!ForwardMouseInput(info.NativeMessageID, info.Modifiers, info.Button, info.X, info.Y, info.WheelDelta)) return; info.MarkHandled(); } public bool Overtype { - get => this.GetBit(Bits.Overtype); + get => GetBit(Bits.Overtype); set { - if (!this.ChangeBit(Bits.Overtype, value)) + if (!ChangeBit(Bits.Overtype, value)) return; - this.FireThreadSafeNotification(NotificationID.Overtype); + FireThreadSafeNotification(NotificationID.Overtype); } } public bool AcceptsTab { - get => this.GetBit(Bits.AcceptsTab); + get => GetBit(Bits.AcceptsTab); set { - if (!this.ChangeBit(Bits.AcceptsTab, value)) + if (!ChangeBit(Bits.AcceptsTab, value)) return; - this.FireThreadSafeNotification(NotificationID.AcceptsTab); + FireThreadSafeNotification(NotificationID.AcceptsTab); } } public bool AcceptsEnter { - get => this.GetBit(Bits.AcceptsEnter); + get => GetBit(Bits.AcceptsEnter); set { - if (!this.ChangeBit(Bits.AcceptsEnter, value)) + if (!ChangeBit(Bits.AcceptsEnter, value)) return; - this.FireThreadSafeNotification(NotificationID.AcceptsEnter); + FireThreadSafeNotification(NotificationID.AcceptsEnter); } } @@ -539,131 +539,131 @@ namespace Microsoft.Iris.InputHandlers { set { - if (!this.ChangeBit(Bits.WordWrap, value)) + if (!ChangeBit(Bits.WordWrap, value)) return; - this._editControl.SetWordWrap(value); + _editControl.SetWordWrap(value); if (!value) return; - this.UpdateContentOnRichEdit(); + UpdateContentOnRichEdit(); } } - public CaretInfo CaretInfo => this._caretInfo; + public CaretInfo CaretInfo => _caretInfo; private void CreateCommands() { - if (this.GetBit(Bits.CommandsCreated)) + if (GetBit(Bits.CommandsCreated)) return; - this.SetBit(Bits.CommandsCreated); - this._undoCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(this._editControl.Undo)); - this._cutCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(this._editControl.Cut)); - this._copyCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(this._editControl.Copy)); - this._pasteCommand = new TextEditingHandler.TextPasteCommand(new SimpleCallback(this._editControl.Paste)); - this._deleteCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(this._editControl.Delete)); - this._selectAllCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(this.SelectAll)); - this.UpdateSelectionAndReadOnlyCommands(); - this.UpdateTextBasedCommandAvailability(); + SetBit(Bits.CommandsCreated); + _undoCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(_editControl.Undo)); + _cutCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(_editControl.Cut)); + _copyCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(_editControl.Copy)); + _pasteCommand = new TextEditingHandler.TextPasteCommand(new SimpleCallback(_editControl.Paste)); + _deleteCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(_editControl.Delete)); + _selectAllCommand = new TextEditingHandler.TextEditingCommand(new SimpleCallback(SelectAll)); + UpdateSelectionAndReadOnlyCommands(); + UpdateTextBasedCommandAvailability(); } public IUICommand UndoCommand { get { - this.CreateCommands(); + CreateCommands(); return _undoCommand; } } - public void Undo() => this._editControl.Undo(); + public void Undo() => _editControl.Undo(); public IUICommand CutCommand { get { - this.CreateCommands(); + CreateCommands(); return _cutCommand; } } - public void Cut() => this._editControl.Cut(); + public void Cut() => _editControl.Cut(); public IUICommand CopyCommand { get { - this.CreateCommands(); + CreateCommands(); return _copyCommand; } } - public void Copy() => this._editControl.Copy(); + public void Copy() => _editControl.Copy(); public IUICommand PasteCommand { get { - this.CreateCommands(); + CreateCommands(); return _pasteCommand; } } - public void Paste() => this._editControl.Paste(); + public void Paste() => _editControl.Paste(); public IUICommand DeleteCommand { get { - this.CreateCommands(); + CreateCommands(); return _deleteCommand; } } - public void Delete() => this._editControl.Delete(); + public void Delete() => _editControl.Delete(); public IUICommand SelectAllCommand { get { - this.CreateCommands(); + CreateCommands(); return _selectAllCommand; } } public void SelectAll() { - string str = this._editData != null ? this._editData.Value : null; + string str = _editData != null ? _editData.Value : null; if (string.IsNullOrEmpty(str)) return; - this.SelectionRange = new Range(0, str.Length); + SelectionRange = new Range(0, str.Length); } public Range SelectionRange { - get => this._selection; + get => _selection; set { - if (this._selection.IsEqual(value)) + if (_selection.IsEqual(value)) return; - this._editControl.SetSelectionRange(value.Begin, value.End); + _editControl.SetSelectionRange(value.Begin, value.End); } } private void UpdateTextBasedCommandAvailability() { - this._undoCommand.Available = this._editControl.CanUndo; - this._selectAllCommand.Available = this._editData != null && !string.IsNullOrEmpty(this._editData.Value); + _undoCommand.Available = _editControl.CanUndo; + _selectAllCommand.Available = _editData != null && !string.IsNullOrEmpty(_editData.Value); } private void UpdateSelectionAndReadOnlyCommands() { - if (!this.GetBit(Bits.CommandsCreated)) + if (!GetBit(Bits.CommandsCreated)) return; - bool flag1 = !this._selection.IsEmpty; - bool flag2 = this._editData == null || this._editData.ReadOnly; - this._cutCommand.Available = flag1 && !flag2; - this._copyCommand.Available = flag1; - this._deleteCommand.Available = flag1 && !flag2; - this._pasteCommand.TextIsReadOnly = flag2; + bool flag1 = !_selection.IsEmpty; + bool flag2 = _editData == null || _editData.ReadOnly; + _cutCommand.Available = flag1 && !flag2; + _copyCommand.Available = flag1; + _deleteCommand.Available = flag1 && !flag2; + _pasteCommand.TextIsReadOnly = flag2; } HRESULT IRichTextCallbacks.TextChanged() @@ -673,13 +673,13 @@ namespace Microsoft.Iris.InputHandlers Application.DeferredInvoke(args => ((IRichTextCallbacks)args).TextChanged(), this, DeferredInvokePriority.Normal); return new HRESULT(0); } - if (this.GetBit(Bits.CommandsCreated)) - this.UpdateTextBasedCommandAvailability(); - if (this._editData != null && !this.InsideContentChangeOnRichEdit) + if (GetBit(Bits.CommandsCreated)) + UpdateTextBasedCommandAvailability(); + if (_editData != null && !InsideContentChangeOnRichEdit) { - this.InsideValueChangeOnEditableTextData = true; - this._editData.Value = this._editControl.SimpleContent; - this.InsideValueChangeOnEditableTextData = false; + InsideValueChangeOnEditableTextData = true; + _editData.Value = _editControl.SimpleContent; + InsideValueChangeOnEditableTextData = false; } return new HRESULT(0); } @@ -691,9 +691,9 @@ namespace Microsoft.Iris.InputHandlers Application.DeferredInvoke(args => ((IRichTextCallbacks)args).InvalidateContent(), this, DeferredInvokePriority.Normal); return new HRESULT(0); } - if (this._textDisplay != null) - this._textDisplay.OnDisplayedContentChange(); - this.RefreshCaretPosition(); + if (_textDisplay != null) + _textDisplay.OnDisplayedContentChange(); + RefreshCaretPosition(); return new HRESULT(0); } @@ -701,75 +701,75 @@ namespace Microsoft.Iris.InputHandlers int selectionStart, int selectionEnd) { - this._selection = new Range(selectionStart, selectionEnd); - this.FireThreadSafeNotification(NotificationID.SelectionRange); - this.UpdateSelectionAndReadOnlyCommands(); + _selection = new Range(selectionStart, selectionEnd); + FireThreadSafeNotification(NotificationID.SelectionRange); + UpdateSelectionAndReadOnlyCommands(); return new HRESULT(0); } HRESULT IRichTextCallbacks.MaxLengthExceeded() { - this.FireTypingInputRejectedEvent(); + FireTypingInputRejectedEvent(); return new HRESULT(0); } HRESULT IRichTextCallbacks.SetTimer(uint id, uint timeout) { - this._editControl.SetTimer(id, timeout); + _editControl.SetTimer(id, timeout); return new HRESULT(0); } HRESULT IRichTextCallbacks.KillTimer(uint id) { - this._editControl.KillTimer(id); + _editControl.KillTimer(id); return new HRESULT(0); } HRESULT IRichTextCallbacks.CreateCaret(int width, int height) { - this._caretInfo.CreateCaret(new Size(width, height)); + _caretInfo.CreateCaret(new Size(width, height)); return new HRESULT(0); } HRESULT IRichTextCallbacks.SetCaretPos(int x, int y) { - this._caretInfo.SetCaretPosition(new Point(x, y)); + _caretInfo.SetCaretPosition(new Point(x, y)); return new HRESULT(0); } HRESULT IRichTextCallbacks.ShowCaret(bool visible) { - this.RichEditCaretVisible = visible; - this.UpdateCaretVisibility(); + RichEditCaretVisible = visible; + UpdateCaretVisibility(); return new HRESULT(0); } HRESULT IRichTextCallbacks.ClientToWindow(Point pt, out Point ppt) { - ppt = this._textDisplay == null ? new Point(0, 0) : this._textDisplay.ClientToWindow(pt); + ppt = _textDisplay == null ? new Point(0, 0) : _textDisplay.ClientToWindow(pt); return new HRESULT(0); } HRESULT IRichTextCallbacks.ClientToScreen(Point pt, out Point ppt) { - ppt = this._textDisplay.ClientToScreen(pt); + ppt = _textDisplay.ClientToScreen(pt); return new HRESULT(0); } HRESULT IRichTextCallbacks.LinkClicked(int start, int end) { - string str = this._editData != null ? this._editData.Value : string.Empty; + string str = _editData != null ? _editData.Value : string.Empty; if (string.IsNullOrEmpty(str)) { - this.LinkClickedParameter = string.Empty; + LinkClickedParameter = string.Empty; } else { end = end >= 0 ? Math.Min(str.Length, end) : str.Length; start = Math.Min(start, end); - this.LinkClickedParameter = str.Substring(start, end - start); + LinkClickedParameter = str.Substring(start, end - start); } - this.FireLinkClicked(); + FireLinkClicked(); return new HRESULT(0); } @@ -781,25 +781,25 @@ namespace Microsoft.Iris.InputHandlers switch (message) { case 269: - this.InImeCompositionMode = true; + InImeCompositionMode = true; break; case 270: - this.InImeCompositionMode = false; + InImeCompositionMode = false; break; } - return this._editControl.ForwardImeMessage(message, wParam, lParam); + return _editControl.ForwardImeMessage(message, wParam, lParam); } public bool InImeCompositionMode { - get => this._InImeMode; + get => _InImeMode; set { - if (this._InImeMode == value) + if (_InImeMode == value) return; - this.CaretInfo.IgnoreIdealWidth = value; - this._InImeMode = value; - this.FireThreadSafeNotification(NotificationID.InImeCompositionMode); + CaretInfo.IgnoreIdealWidth = value; + _InImeMode = value; + FireThreadSafeNotification(NotificationID.InImeCompositionMode); } } @@ -810,15 +810,15 @@ namespace Microsoft.Iris.InputHandlers int viewExtent, int scrollPosition) { - if (whichBarInt == 1 && this._verticalScrollModel != null) + if (whichBarInt == 1 && _verticalScrollModel != null) { - this.SetScrollRange(ref this._pendingVerticalScrollState, minPosition, extent, viewExtent, scrollPosition); - this.ScheduleScrollbarUpdate(true); + SetScrollRange(ref _pendingVerticalScrollState, minPosition, extent, viewExtent, scrollPosition); + ScheduleScrollbarUpdate(true); } - else if (this._horizontalScrollModel != null) + else if (_horizontalScrollModel != null) { - this.SetScrollRange(ref this._pendingHorizontalScrollState, minPosition, extent, viewExtent, scrollPosition); - this.ScheduleScrollbarUpdate(false); + SetScrollRange(ref _pendingHorizontalScrollState, minPosition, extent, viewExtent, scrollPosition); + ScheduleScrollbarUpdate(false); } return new HRESULT(0); } @@ -845,15 +845,15 @@ namespace Microsoft.Iris.InputHandlers ScrollbarEnableFlags flags) { ScrollbarType whichBar = (ScrollbarType)whichBarInt; - if (this.IsVerticalScrollbar(whichBar) && this._verticalScrollModel != null) + if (IsVerticalScrollbar(whichBar) && _verticalScrollModel != null) { - this.EnableScrollbar(ref this._pendingVerticalScrollState, flags); - this.ScheduleScrollbarUpdate(true); + EnableScrollbar(ref _pendingVerticalScrollState, flags); + ScheduleScrollbarUpdate(true); } - if (this.IsHorizontalScrollbar(whichBar) && this._horizontalScrollModel != null) + if (IsHorizontalScrollbar(whichBar) && _horizontalScrollModel != null) { - this.EnableScrollbar(ref this._pendingHorizontalScrollState, flags); - this.ScheduleScrollbarUpdate(false); + EnableScrollbar(ref _pendingHorizontalScrollState, flags); + ScheduleScrollbarUpdate(false); } return new HRESULT(0); } @@ -883,47 +883,47 @@ namespace Microsoft.Iris.InputHandlers private void ScheduleScrollbarUpdate(bool vertical) { - bool flag = !this.GetBit(Bits.PendingVerticalScrollbarUpdate) && !this.GetBit(Bits.PendingHorizontalScrollbarUpdate); + bool flag = !GetBit(Bits.PendingVerticalScrollbarUpdate) && !GetBit(Bits.PendingHorizontalScrollbarUpdate); if (vertical) - this.SetBit(Bits.PendingVerticalScrollbarUpdate); + SetBit(Bits.PendingVerticalScrollbarUpdate); else - this.SetBit(Bits.PendingHorizontalScrollbarUpdate); + SetBit(Bits.PendingHorizontalScrollbarUpdate); if (!flag) return; - if (this._updateScrollbars == null) - this._updateScrollbars = new SimpleCallback(this.UpdateScrollbars); - DeferredCall.Post(DispatchPriority.Normal, this._updateScrollbars); + if (_updateScrollbars == null) + _updateScrollbars = new SimpleCallback(UpdateScrollbars); + DeferredCall.Post(DispatchPriority.Normal, _updateScrollbars); } private void UpdateScrollbars() { - if (this.GetBit(Bits.PendingVerticalScrollbarUpdate)) + if (GetBit(Bits.PendingVerticalScrollbarUpdate)) { - this.ClearBit(Bits.PendingVerticalScrollbarUpdate); - this._verticalScrollModel.UpdateState(this._pendingVerticalScrollState); - this._pendingVerticalScrollState = new TextScrollModel.State(); + ClearBit(Bits.PendingVerticalScrollbarUpdate); + _verticalScrollModel.UpdateState(_pendingVerticalScrollState); + _pendingVerticalScrollState = new TextScrollModel.State(); } - if (!this.GetBit(Bits.PendingHorizontalScrollbarUpdate)) + if (!GetBit(Bits.PendingHorizontalScrollbarUpdate)) return; - this.ClearBit(Bits.PendingHorizontalScrollbarUpdate); - this._horizontalScrollModel.UpdateState(this._pendingHorizontalScrollState); - this._pendingHorizontalScrollState = new TextScrollModel.State(); + ClearBit(Bits.PendingHorizontalScrollbarUpdate); + _horizontalScrollModel.UpdateState(_pendingHorizontalScrollState); + _pendingHorizontalScrollState = new TextScrollModel.State(); } public TextScrollModel HorizontalScrollModel { get { - if (this._horizontalScrollModel == null) - this.StoreScrollModel(ref this._horizontalScrollModel, new TextScrollModel()); - return this._horizontalScrollModel; + if (_horizontalScrollModel == null) + StoreScrollModel(ref _horizontalScrollModel, new TextScrollModel()); + return _horizontalScrollModel; } set { - if (this._horizontalScrollModel == value) + if (_horizontalScrollModel == value) return; - this.StoreScrollModel(ref this._horizontalScrollModel, value); - this.FireThreadSafeNotification(NotificationID.HorizontalScrollModel); + StoreScrollModel(ref _horizontalScrollModel, value); + FireThreadSafeNotification(NotificationID.HorizontalScrollModel); } } @@ -931,16 +931,16 @@ namespace Microsoft.Iris.InputHandlers { get { - if (this._verticalScrollModel == null) - this.StoreScrollModel(ref this._verticalScrollModel, new TextScrollModel()); - return this._verticalScrollModel; + if (_verticalScrollModel == null) + StoreScrollModel(ref _verticalScrollModel, new TextScrollModel()); + return _verticalScrollModel; } set { - if (this._verticalScrollModel == value) + if (_verticalScrollModel == value) return; - this.StoreScrollModel(ref this._verticalScrollModel, value); - this.FireThreadSafeNotification(NotificationID.VerticalScrollModel); + StoreScrollModel(ref _verticalScrollModel, value); + FireThreadSafeNotification(NotificationID.VerticalScrollModel); } } @@ -951,84 +951,84 @@ namespace Microsoft.Iris.InputHandlers storage = newDude; if (storage != null) storage.AttachCallbacks(this); - this._editControl.SetScrollbars(this._horizontalScrollModel != null, this._verticalScrollModel != null); + _editControl.SetScrollbars(_horizontalScrollModel != null, _verticalScrollModel != null); } - private ScrollbarType WhichScrollbar(TextScrollModel who) => who != this._verticalScrollModel ? ScrollbarType.Horizontal : ScrollbarType.Vertical; + private ScrollbarType WhichScrollbar(TextScrollModel who) => who != _verticalScrollModel ? ScrollbarType.Horizontal : ScrollbarType.Vertical; - void ITextScrollModelCallback.ScrollUp(TextScrollModel who) => this._editControl.ScrollUp(this.WhichScrollbar(who)); + void ITextScrollModelCallback.ScrollUp(TextScrollModel who) => _editControl.ScrollUp(WhichScrollbar(who)); - void ITextScrollModelCallback.ScrollDown(TextScrollModel who) => this._editControl.ScrollDown(this.WhichScrollbar(who)); + void ITextScrollModelCallback.ScrollDown(TextScrollModel who) => _editControl.ScrollDown(WhichScrollbar(who)); - void ITextScrollModelCallback.PageUp(TextScrollModel who) => this._editControl.PageUp(this.WhichScrollbar(who)); + void ITextScrollModelCallback.PageUp(TextScrollModel who) => _editControl.PageUp(WhichScrollbar(who)); - void ITextScrollModelCallback.PageDown(TextScrollModel who) => this._editControl.PageDown(this.WhichScrollbar(who)); + void ITextScrollModelCallback.PageDown(TextScrollModel who) => _editControl.PageDown(WhichScrollbar(who)); void ITextScrollModelCallback.ScrollToPosition( TextScrollModel who, int whereTo) { - this._editControl.ScrollToPosition(this.WhichScrollbar(who), whereTo); + _editControl.ScrollToPosition(WhichScrollbar(who), whereTo); } - private void UpdateCaretVisibility() => this.CaretInfo.SetVisible(this.RichEditCaretVisible && this.WindowIsActivated); + private void UpdateCaretVisibility() => CaretInfo.SetVisible(RichEditCaretVisible && WindowIsActivated); private void RefreshCaretPosition() { - if (!this.CaretInfo.Visible || this.MousePrimaryDown || this._editControl == null) + if (!CaretInfo.Visible || MousePrimaryDown || _editControl == null) return; - this._editControl.NotifyOfFocusChange(true); + _editControl.NotifyOfFocusChange(true); } private bool HandledTabKeyDown { - get => this.GetBit(Bits.HandledTabKeyDown); - set => this.SetBit(Bits.HandledTabKeyDown, value); + get => GetBit(Bits.HandledTabKeyDown); + set => SetBit(Bits.HandledTabKeyDown, value); } private bool HandledEnterKeyDown { - get => this.GetBit(Bits.HandledEnterKeyDown); - set => this.SetBit(Bits.HandledEnterKeyDown, value); + get => GetBit(Bits.HandledEnterKeyDown); + set => SetBit(Bits.HandledEnterKeyDown, value); } private bool InputOffsetDirty { - get => this.GetBit(Bits.InputOffsetDirty); - set => this.SetBit(Bits.InputOffsetDirty, value); + get => GetBit(Bits.InputOffsetDirty); + set => SetBit(Bits.InputOffsetDirty, value); } private bool MousePrimaryDown { - get => this.GetBit(Bits.MousePrimaryDown); - set => this.SetBit(Bits.MousePrimaryDown, value); + get => GetBit(Bits.MousePrimaryDown); + set => SetBit(Bits.MousePrimaryDown, value); } private bool InsideValueChangeOnEditableTextData { - get => this.GetBit(Bits.InsideValueChangeOnEditableTextData); - set => this.SetBit(Bits.InsideValueChangeOnEditableTextData, value); + get => GetBit(Bits.InsideValueChangeOnEditableTextData); + set => SetBit(Bits.InsideValueChangeOnEditableTextData, value); } private bool InsideContentChangeOnRichEdit { - get => this.GetBit(Bits.InsideContentChangeOnRichEdit); - set => this.SetBit(Bits.InsideContentChangeOnRichEdit, value); + get => GetBit(Bits.InsideContentChangeOnRichEdit); + set => SetBit(Bits.InsideContentChangeOnRichEdit, value); } private bool RichEditCaretVisible { - get => this.GetBit(Bits.RichEditCaretVisible); - set => this.SetBit(Bits.RichEditCaretVisible, value); + get => GetBit(Bits.RichEditCaretVisible); + set => SetBit(Bits.RichEditCaretVisible, value); } private bool WindowIsActivated { - get => this.GetBit(Bits.WindowIsActivated); - set => this.SetBit(Bits.WindowIsActivated, value); + get => GetBit(Bits.WindowIsActivated); + set => SetBit(Bits.WindowIsActivated, value); } - private bool GetBit(TextEditingHandler.Bits lookupBit) => ((TextEditingHandler.Bits)this._bits & lookupBit) != 0; + private bool GetBit(TextEditingHandler.Bits lookupBit) => ((TextEditingHandler.Bits)_bits & lookupBit) != 0; private void SetBit(TextEditingHandler.Bits changeBit) { @@ -1036,7 +1036,7 @@ namespace Microsoft.Iris.InputHandlers textEditingHandler._bits = (uint)((TextEditingHandler.Bits)textEditingHandler._bits | changeBit); } - private void SetBit(TextEditingHandler.Bits changeBit, bool value) => this._bits = value ? (uint)((TextEditingHandler.Bits)this._bits | changeBit) : (uint)((TextEditingHandler.Bits)this._bits & ~changeBit); + private void SetBit(TextEditingHandler.Bits changeBit, bool value) => _bits = value ? (uint)((TextEditingHandler.Bits)_bits | changeBit) : (uint)((TextEditingHandler.Bits)_bits & ~changeBit); private void ClearBit(TextEditingHandler.Bits changeBit) { @@ -1046,10 +1046,10 @@ namespace Microsoft.Iris.InputHandlers private bool ChangeBit(TextEditingHandler.Bits changeBit, bool value) { - uint num = value ? (uint)((TextEditingHandler.Bits)this._bits | changeBit) : (uint)((TextEditingHandler.Bits)this._bits & ~changeBit); - bool flag = (int)num != (int)this._bits; + uint num = value ? (uint)((TextEditingHandler.Bits)_bits | changeBit) : (uint)((TextEditingHandler.Bits)_bits & ~changeBit); + bool flag = (int)num != (int)_bits; if (flag) - this._bits = num; + _bits = num; return flag; } @@ -1077,12 +1077,12 @@ namespace Microsoft.Iris.InputHandlers { private SimpleCallback _onInvoked; - public TextEditingCommand(SimpleCallback onInvoked) => this._onInvoked = onInvoked; + public TextEditingCommand(SimpleCallback onInvoked) => _onInvoked = onInvoked; protected override void OnInvoked() { base.OnInvoked(); - this._onInvoked(); + _onInvoked(); } } @@ -1097,7 +1097,7 @@ namespace Microsoft.Iris.InputHandlers bool IUICommand.Available { - get => Clipboard.ContainsText() && !this._isReadOnly; + get => Clipboard.ContainsText() && !_isReadOnly; set { } @@ -1105,8 +1105,8 @@ namespace Microsoft.Iris.InputHandlers public bool TextIsReadOnly { - get => this._isReadOnly; - set => this._isReadOnly = value; + get => _isReadOnly; + set => _isReadOnly = value; } } } diff --git a/UIX/Microsoft/Iris/InputHandlers/TypingHandler.cs b/UIX/Microsoft/Iris/InputHandlers/TypingHandler.cs index 4e7d2d9..f542dba 100644 --- a/UIX/Microsoft/Iris/InputHandlers/TypingHandler.cs +++ b/UIX/Microsoft/Iris/InputHandlers/TypingHandler.cs @@ -22,77 +22,77 @@ namespace Microsoft.Iris.InputHandlers protected override void ConfigureInteractivity() { base.ConfigureInteractivity(); - if (!this.HandleDirect) + if (!HandleDirect) return; - this.UI.MouseInteractive = true; - this.UI.KeyInteractive = true; + UI.MouseInteractive = true; + UI.KeyInteractive = true; } public bool SubmitOnEnter { - get => this._submitOnEnter; + get => _submitOnEnter; set { - if (this._submitOnEnter == value) + if (_submitOnEnter == value) return; - this._submitOnEnter = value; - this.FireNotification(NotificationID.SubmitOnEnter); + _submitOnEnter = value; + FireNotification(NotificationID.SubmitOnEnter); } } public bool TreatEscapeAsBackspace { - get => this._treatEscapeAsBackspace; + get => _treatEscapeAsBackspace; set { - if (this._treatEscapeAsBackspace == value) + if (_treatEscapeAsBackspace == value) return; - this._treatEscapeAsBackspace = value; - this.FireNotification(NotificationID.TreatEscapeAsBackspace); + _treatEscapeAsBackspace = value; + FireNotification(NotificationID.TreatEscapeAsBackspace); } } - private void FireTypingInputRejectedEvent() => this.FireNotification(NotificationID.TypingInputRejected); + private void FireTypingInputRejectedEvent() => FireNotification(NotificationID.TypingInputRejected); public EditableTextData EditableTextData { - get => this._edit; + get => _edit; set { - if (this._edit == value) + if (_edit == value) return; - this._edit = value; - this.FireNotification(NotificationID.EditableTextData); + _edit = value; + FireNotification(NotificationID.EditableTextData); } } protected override void OnKeyDown(UIClass ui, KeyStateInfo info) { - if (this.ShouldIgnoreInput(info) || this._edit == null) + if (ShouldIgnoreInput(info) || _edit == null) return; switch (info.Key) { case Keys.Back: - if (this.IsEditableTextEmpty() && !this._handlingBackspaceFlag) + if (IsEditableTextEmpty() && !_handlingBackspaceFlag) break; info.MarkHandled(); break; case Keys.Enter: - if (!this._submitOnEnter) + if (!_submitOnEnter) break; - this._edit.Submit(); + _edit.Submit(); info.MarkHandled(); break; case Keys.Escape: - if (!this._treatEscapeAsBackspace) + if (!_treatEscapeAsBackspace) break; goto case Keys.Back; case Keys.Delete: - if (this.IsEditableTextEmpty()) + if (IsEditableTextEmpty()) break; - this.RemoveChar(); + RemoveChar(); info.MarkHandled(); - this._handlingDeleteFlag = true; + _handlingDeleteFlag = true; break; case Keys.NumPad0: case Keys.NumPad1: @@ -111,35 +111,35 @@ namespace Microsoft.Iris.InputHandlers protected override void OnKeyCharacter(UIClass ui, KeyCharacterInfo info) { - if (this.ShouldIgnoreInput(info) || this._edit == null) + if (ShouldIgnoreInput(info) || _edit == null) return; switch (info.Character) { case '\b': - if (!this.IsEditableTextEmpty()) + if (!IsEditableTextEmpty()) { - this.RemoveChar(); + RemoveChar(); info.MarkHandled(); - this._handlingBackspaceFlag = true; + _handlingBackspaceFlag = true; break; } - if (!this._handlingBackspaceFlag) + if (!_handlingBackspaceFlag) break; info.MarkHandled(); break; case '\t': break; case '\r': - if (!this._submitOnEnter) + if (!_submitOnEnter) break; info.MarkHandled(); break; case '\x001B': - if (!this._treatEscapeAsBackspace) + if (!_treatEscapeAsBackspace) break; goto case '\b'; default: - this.InputChar(info.Character); + InputChar(info.Character); info.MarkHandled(); break; } @@ -147,30 +147,30 @@ namespace Microsoft.Iris.InputHandlers protected override void OnKeyUp(UIClass ui, KeyStateInfo info) { - if (this.ShouldIgnoreInput(info) || this._edit == null) + if (ShouldIgnoreInput(info) || _edit == null) return; switch (info.Key) { case Keys.Back: - if (!this._handlingBackspaceFlag) + if (!_handlingBackspaceFlag) break; info.MarkHandled(); - this._handlingBackspaceFlag = false; + _handlingBackspaceFlag = false; break; case Keys.Enter: - if (!this._submitOnEnter) + if (!_submitOnEnter) break; info.MarkHandled(); break; case Keys.Escape: - if (!this._treatEscapeAsBackspace) + if (!_treatEscapeAsBackspace) break; goto case Keys.Back; case Keys.Delete: - if (!this._handlingDeleteFlag) + if (!_handlingDeleteFlag) break; info.MarkHandled(); - this._handlingDeleteFlag = false; + _handlingDeleteFlag = false; break; case Keys.NumPad0: case Keys.NumPad1: @@ -189,36 +189,36 @@ namespace Microsoft.Iris.InputHandlers private void RemoveChar() { - if (this._edit == null || this.IsEditableTextEmpty()) + if (_edit == null || IsEditableTextEmpty()) return; - if (!this._edit.ReadOnly) - this._edit.Value = this._edit.Value.Substring(0, this._edit.Value.Length - 1); + if (!_edit.ReadOnly) + _edit.Value = _edit.Value.Substring(0, _edit.Value.Length - 1); else - this.FireTypingInputRejectedEvent(); + FireTypingInputRejectedEvent(); } private void Clear() { - if (this._edit == null || this.IsEditableTextEmpty()) + if (_edit == null || IsEditableTextEmpty()) return; - if (!this._edit.ReadOnly) - this._edit.Value = string.Empty; + if (!_edit.ReadOnly) + _edit.Value = string.Empty; else - this.FireTypingInputRejectedEvent(); + FireTypingInputRejectedEvent(); } private void InputChar(char ch) { - if (this._edit == null) + if (_edit == null) return; - if (!this._edit.ReadOnly && (this.IsEditableTextEmpty() || this._edit.Value.Length < this._edit.MaxLength)) - this._edit.Value += (string)(object)ch; + if (!_edit.ReadOnly && (IsEditableTextEmpty() || _edit.Value.Length < _edit.MaxLength)) + _edit.Value += (string)(object)ch; else - this.FireTypingInputRejectedEvent(); + FireTypingInputRejectedEvent(); } private bool ShouldIgnoreInput(KeyActionInfo info) => (info.Modifiers & InputModifiers.ControlKey) == InputModifiers.ControlKey || (info.Modifiers & InputModifiers.AltKey) == InputModifiers.AltKey || (info.Modifiers & InputModifiers.WindowsKey) == InputModifiers.WindowsKey; - private bool IsEditableTextEmpty() => string.IsNullOrEmpty(this._edit.Value); + private bool IsEditableTextEmpty() => string.IsNullOrEmpty(_edit.Value); } } diff --git a/UIX/Microsoft/Iris/Layout/AreaOfInterest.cs b/UIX/Microsoft/Iris/Layout/AreaOfInterest.cs index c9d54c8..3728698 100644 --- a/UIX/Microsoft/Iris/Layout/AreaOfInterest.cs +++ b/UIX/Microsoft/Iris/Layout/AreaOfInterest.cs @@ -37,12 +37,12 @@ namespace Microsoft.Iris.Layout public AreaOfInterest(Rectangle rectangle, Rectangle displayRectangle, AreaOfInterestID id) { - this._rectangle = rectangle; - this._displayRectangle = displayRectangle; - this._id = id; + _rectangle = rectangle; + _displayRectangle = displayRectangle; + _id = id; } - public AreaOfInterest Transform(Point offset) => new AreaOfInterest(Rectangle.Offset(this._rectangle, offset), Rectangle.Offset(this._displayRectangle, offset), this.Id); + public AreaOfInterest Transform(Point offset) => new AreaOfInterest(Rectangle.Offset(_rectangle, offset), Rectangle.Offset(_displayRectangle, offset), Id); public static void AddAreaOfInterest( AreaOfInterest interest, @@ -60,7 +60,7 @@ namespace Microsoft.Iris.Layout public override string ToString() => InvariantString.Format("AreaOfInterest(\"{0}\", {1}, {2})", Id, Rectangle, DisplayRectangle); - public override int GetHashCode() => this._rectangle.GetHashCode() ^ this._displayRectangle.GetHashCode() ^ this._id.GetHashCode(); + public override int GetHashCode() => _rectangle.GetHashCode() ^ _displayRectangle.GetHashCode() ^ _id.GetHashCode(); public override bool Equals(object other) { @@ -74,20 +74,20 @@ namespace Microsoft.Iris.Layout } } - public bool Equals(AreaOfInterest other) => this._rectangle == other._rectangle && this._displayRectangle == other._displayRectangle && this._id == other._id; + public bool Equals(AreaOfInterest other) => _rectangle == other._rectangle && _displayRectangle == other._displayRectangle && _id == other._id; public static bool operator ==(AreaOfInterest a, AreaOfInterest b) => a._rectangle == b._rectangle && a._displayRectangle == b._displayRectangle && a._id == b._id; public static bool operator !=(AreaOfInterest a, AreaOfInterest b) => a._rectangle != b._rectangle || a._displayRectangle != b._displayRectangle || a._id != b._id; - public Rectangle Rectangle => this._rectangle; + public Rectangle Rectangle => _rectangle; public Rectangle DisplayRectangle { - get => this._displayRectangle; - set => this._displayRectangle = value; + get => _displayRectangle; + set => _displayRectangle = value; } - public AreaOfInterestID Id => this._id; + public AreaOfInterestID Id => _id; } } diff --git a/UIX/Microsoft/Iris/Layout/AreaOfInterestLayoutInput.cs b/UIX/Microsoft/Iris/Layout/AreaOfInterestLayoutInput.cs index 3b46a0f..94ca62b 100644 --- a/UIX/Microsoft/Iris/Layout/AreaOfInterestLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layout/AreaOfInterestLayoutInput.cs @@ -17,8 +17,8 @@ namespace Microsoft.Iris.Layout public AreaOfInterestLayoutInput(AreaOfInterestID idName, Inset margins) { - this._id = idName; - this._margins = margins; + _id = idName; + _margins = margins; } public AreaOfInterestLayoutInput() @@ -27,16 +27,16 @@ namespace Microsoft.Iris.Layout public AreaOfInterestID Id { - get => this._id; - set => this._id = value; + get => _id; + set => _id = value; } - public Inset Margins => this._margins; + public Inset Margins => _margins; DataCookie ILayoutInput.Data => Data; public static DataCookie Data => s_dataProperty; - public override string ToString() => InvariantString.Format("{0}({1})", this.GetType().Name, _id); + public override string ToString() => InvariantString.Format("{0}({1})", GetType().Name, _id); } } diff --git a/UIX/Microsoft/Iris/Layout/ExtendedLayoutOutput.cs b/UIX/Microsoft/Iris/Layout/ExtendedLayoutOutput.cs index 1c124e3..d69e6b7 100644 --- a/UIX/Microsoft/Iris/Layout/ExtendedLayoutOutput.cs +++ b/UIX/Microsoft/Iris/Layout/ExtendedLayoutOutput.cs @@ -12,7 +12,7 @@ namespace Microsoft.Iris.Layout { public ExtendedLayoutOutput nextOutput; - private DataCookie Data => this.OutputID; + private DataCookie Data => OutputID; public abstract DataCookie OutputID { get; } } diff --git a/UIX/Microsoft/Iris/Layout/ItemAlignment.cs b/UIX/Microsoft/Iris/Layout/ItemAlignment.cs index f553272..b0cca63 100644 --- a/UIX/Microsoft/Iris/Layout/ItemAlignment.cs +++ b/UIX/Microsoft/Iris/Layout/ItemAlignment.cs @@ -16,27 +16,27 @@ namespace Microsoft.Iris.Layout public ItemAlignment(Alignment horizontal, Alignment vertical) { - this._horizontal = horizontal; - this._vertical = vertical; + _horizontal = horizontal; + _vertical = vertical; } public Alignment Horizontal { - get => this._horizontal; - set => this._horizontal = value; + get => _horizontal; + set => _horizontal = value; } public Alignment Vertical { - get => this._vertical; - set => this._vertical = value; + get => _vertical; + set => _vertical = value; } - public Alignment GetAlignment(Orientation orientation) => orientation != Orientation.Horizontal ? this.Vertical : this.Horizontal; + public Alignment GetAlignment(Orientation orientation) => orientation != Orientation.Horizontal ? Vertical : Horizontal; public override bool Equals(object obj) => obj is ItemAlignment itemAlignment && this == itemAlignment; - public override int GetHashCode() => (int)((Alignment)((int)this.Horizontal << 16) ^ this.Vertical); + public override int GetHashCode() => (int)((Alignment)((int)Horizontal << 16) ^ Vertical); public static bool operator ==(ItemAlignment left, ItemAlignment right) => left.Horizontal == right.Horizontal && left.Vertical == right.Vertical; diff --git a/UIX/Microsoft/Iris/Layout/LayoutNodeEnumerator.cs b/UIX/Microsoft/Iris/Layout/LayoutNodeEnumerator.cs index 8ac9439..b8c7d8a 100644 --- a/UIX/Microsoft/Iris/Layout/LayoutNodeEnumerator.cs +++ b/UIX/Microsoft/Iris/Layout/LayoutNodeEnumerator.cs @@ -16,29 +16,29 @@ namespace Microsoft.Iris.Layout public LayoutNodeEnumerator(ILayoutNode start) { - this._start = start; - this._current = null; - this._haventStartedYet = true; + _start = start; + _current = null; + _haventStartedYet = true; } public bool MoveNext() { - if (this._current != null) - this._current = this._current.NextVisibleSibling; - else if (this._haventStartedYet) + if (_current != null) + _current = _current.NextVisibleSibling; + else if (_haventStartedYet) { - this._current = this._start; - this._haventStartedYet = false; + _current = _start; + _haventStartedYet = false; } - return this._current != null; + return _current != null; } - public ILayoutNode Current => this._current; + public ILayoutNode Current => _current; public void Reset() { - this._current = null; - this._haventStartedYet = true; + _current = null; + _haventStartedYet = true; } } } diff --git a/UIX/Microsoft/Iris/Layout/LayoutSlot.cs b/UIX/Microsoft/Iris/Layout/LayoutSlot.cs index 81e35cf..3761971 100644 --- a/UIX/Microsoft/Iris/Layout/LayoutSlot.cs +++ b/UIX/Microsoft/Iris/Layout/LayoutSlot.cs @@ -27,50 +27,50 @@ namespace Microsoft.Iris.Layout Rectangle viewBounds, Rectangle viewPeripheralBounds) { - this._bounds = extent; - this._offset = offset; - this._viewBounds = viewBounds; - this._peripheralViewBounds = viewPeripheralBounds; + _bounds = extent; + _offset = offset; + _viewBounds = viewBounds; + _peripheralViewBounds = viewPeripheralBounds; } public Size Bounds { - get => this._bounds; - set => this._bounds = value; + get => _bounds; + set => _bounds = value; } public Point Offset { - get => this._offset; - set => this._offset = value; + get => _offset; + set => _offset = value; } public Rectangle View { - get => this._viewBounds; - set => this._viewBounds = value; + get => _viewBounds; + set => _viewBounds = value; } public Rectangle PeripheralView { - get => this._peripheralViewBounds; - set => this._peripheralViewBounds = value; + get => _peripheralViewBounds; + set => _peripheralViewBounds = value; } public void Deflate(Inset inset) { int num1 = inset.Left + inset.Right; int num2 = inset.Top + inset.Bottom; - this._bounds.Width -= num1; - if (this._bounds.Width < 0) - this._bounds.Width = 0; - this._bounds.Height -= num2; - if (this._bounds.Height < 0) - this._bounds.Height = 0; - this._viewBounds.X -= inset.Left; - this._viewBounds.Y -= inset.Top; - this._peripheralViewBounds.X -= inset.Left; - this._peripheralViewBounds.Y -= inset.Top; + _bounds.Width -= num1; + if (_bounds.Width < 0) + _bounds.Width = 0; + _bounds.Height -= num2; + if (_bounds.Height < 0) + _bounds.Height = 0; + _viewBounds.X -= inset.Left; + _viewBounds.Y -= inset.Top; + _peripheralViewBounds.X -= inset.Left; + _peripheralViewBounds.Y -= inset.Top; } public static bool operator ==(LayoutSlot left, LayoutSlot right) => left._bounds == right._bounds && left._offset == right._offset && left._viewBounds == right._viewBounds && left._peripheralViewBounds == right._peripheralViewBounds; @@ -79,12 +79,12 @@ namespace Microsoft.Iris.Layout public override bool Equals(object obj) => obj is LayoutSlot layoutSlot && this == layoutSlot; - public override int GetHashCode() => this._bounds.GetHashCode() ^ this._offset.GetHashCode() ^ this._viewBounds.GetHashCode() ^ this._peripheralViewBounds.GetHashCode(); + public override int GetHashCode() => _bounds.GetHashCode() ^ _offset.GetHashCode() ^ _viewBounds.GetHashCode() ^ _peripheralViewBounds.GetHashCode(); public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.Append(this.GetType().Name); + stringBuilder.Append(GetType().Name); stringBuilder.Append("("); stringBuilder.Append("Bounds="); stringBuilder.Append(_bounds); @@ -92,7 +92,7 @@ namespace Microsoft.Iris.Layout stringBuilder.Append(_offset); stringBuilder.Append(", View="); stringBuilder.Append(_viewBounds); - if (this._peripheralViewBounds != this._viewBounds) + if (_peripheralViewBounds != _viewBounds) { stringBuilder.Append(", Peripheral="); stringBuilder.Append(_peripheralViewBounds); diff --git a/UIX/Microsoft/Iris/Layout/SharedSize.cs b/UIX/Microsoft/Iris/Layout/SharedSize.cs index 2ecc3b1..a12660b 100644 --- a/UIX/Microsoft/Iris/Layout/SharedSize.cs +++ b/UIX/Microsoft/Iris/Layout/SharedSize.cs @@ -24,45 +24,45 @@ namespace Microsoft.Iris.Layout public SharedSize() { - this._minimumSize = Size.Zero; - this._maximumSize = Size.Zero; - this._desiredSize = Size.Zero; - this._accumulatingSize = true; + _minimumSize = Size.Zero; + _maximumSize = Size.Zero; + _desiredSize = Size.Zero; + _accumulatingSize = true; } public Size MaximumSize { - get => this._maximumSize; + get => _maximumSize; set { - if (!(this._maximumSize != value)) + if (!(_maximumSize != value)) return; - Size size1 = this.Size; - this._maximumSize = value; - Size size2 = this.Size; - this.FireNotification(NotificationID.MaximumSize); + Size size1 = Size; + _maximumSize = value; + Size size2 = Size; + FireNotification(NotificationID.MaximumSize); if (!(size1 != size2)) return; - this.FireNotification(NotificationID.Size); - this.InvalidateDependents(true); + FireNotification(NotificationID.Size); + InvalidateDependents(true); } } public Size MinimumSize { - get => this._minimumSize; + get => _minimumSize; set { - if (!(this._minimumSize != value)) + if (!(_minimumSize != value)) return; - Size size1 = this.Size; - this._minimumSize = value; - Size size2 = this.Size; - this.FireNotification(NotificationID.MinimumSize); + Size size1 = Size; + _minimumSize = value; + Size size2 = Size; + FireNotification(NotificationID.MinimumSize); if (!(size1 != size2)) return; - this.FireNotification(NotificationID.Size); - this.InvalidateDependents(true); + FireNotification(NotificationID.Size); + InvalidateDependents(true); } } @@ -70,62 +70,62 @@ namespace Microsoft.Iris.Layout { get { - Size size = Size.Max(this._desiredSize, this.MinimumSize); - Size maximumSize = this.MaximumSize; + Size size = Size.Max(_desiredSize, MinimumSize); + Size maximumSize = MaximumSize; if (maximumSize.Width > 0) size.Width = Math.Min(size.Width, maximumSize.Width); if (maximumSize.Height > 0) size.Height = Math.Min(size.Height, maximumSize.Height); return size; } - set => this.SetSize(value, true); + set => SetSize(value, true); } public void AutoSize() { - this.SetSize(Size.Zero, false); - this.InvalidateDependents(true); + SetSize(Size.Zero, false); + InvalidateDependents(true); } private void SetSize(Size value, bool stopAccumulating) { - if (this._desiredSize != value) + if (_desiredSize != value) { - Size size1 = this.Size; - this._desiredSize = value; - Size size2 = this.Size; + Size size1 = Size; + _desiredSize = value; + Size size2 = Size; if (size1 != size2) { - this.FireNotification(NotificationID.Size); + FireNotification(NotificationID.Size); if (stopAccumulating) - this.InvalidateDependents(true); + InvalidateDependents(true); } } - this._accumulatingSize = !stopAccumulating; + _accumulatingSize = !stopAccumulating; } public void Register(ViewItem viewitem) { - if (this._dependents == null) - this._dependents = new Vector(); - this._dependents.Add(viewitem); + if (_dependents == null) + _dependents = new Vector(); + _dependents.Add(viewitem); } - public void Unregister(ViewItem viewitem) => this._dependents.Remove(viewitem); + public void Unregister(ViewItem viewitem) => _dependents.Remove(viewitem); public void AdjustConstraint(ref Size constraint, ref Size minSize, SharedSizePolicy policy) { - Size size1 = this.Size; - Size maximumSize = this.MaximumSize; + Size size1 = Size; + Size maximumSize = MaximumSize; Size size2 = constraint; Size size3 = size1; Size size4 = minSize; if ((policy & SharedSizePolicy.SharesWidth) != 0) { - if (!this._accumulatingSize) + if (!_accumulatingSize) { int num = Math.Max(size4.Width, Math.Min(size1.Width, size2.Width)); - if (num >= this.MinimumSize.Width && (num <= maximumSize.Width || maximumSize.Width == 0)) + if (num >= MinimumSize.Width && (num <= maximumSize.Width || maximumSize.Width == 0)) { size4.Width = num; size2.Width = num; @@ -145,10 +145,10 @@ namespace Microsoft.Iris.Layout } if ((policy & SharedSizePolicy.SharesHeight) != 0) { - if (!this._accumulatingSize) + if (!_accumulatingSize) { int num = Math.Max(size4.Height, Math.Min(size1.Height, size2.Height)); - if (num >= this.MinimumSize.Height && (num <= maximumSize.Height || maximumSize.Height == 0)) + if (num >= MinimumSize.Height && (num <= maximumSize.Height || maximumSize.Height == 0)) { size4.Height = num; size2.Height = num; @@ -172,38 +172,38 @@ namespace Microsoft.Iris.Layout public void AccumulateSize(Size size, SharedSizePolicy policy) { - if (!this._accumulatingSize) + if (!_accumulatingSize) return; - Size size1 = this.Size; + Size size1 = Size; if ((policy & SharedSizePolicy.ContributesToWidth) != 0 && size.Width > size1.Width) size1.Width = size.Width; if ((policy & SharedSizePolicy.ContributesToHeight) != 0 && size.Height > size1.Height) size1.Height = size.Height; - this.SetSize(size1, false); - this.EnsureApplySize(); + SetSize(size1, false); + EnsureApplySize(); } private void EnsureApplySize() { - if (this._applyPending) + if (_applyPending) return; - this._applyPending = true; - DeferredCall.Post(DispatchPriority.LayoutPass2, new SimpleCallback(this.ApplySize)); + _applyPending = true; + DeferredCall.Post(DispatchPriority.LayoutPass2, new SimpleCallback(ApplySize)); } private void ApplySize() { - this._accumulatingSize = false; - this._applyPending = false; - this.InvalidateDependents(false); + _accumulatingSize = false; + _applyPending = false; + InvalidateDependents(false); } private void InvalidateDependents(bool forceInvalid) { - if (this._dependents == null) + if (_dependents == null) return; - Size size1 = this.Size; - foreach (ViewItem dependent in this._dependents) + Size size1 = Size; + foreach (ViewItem dependent in _dependents) { if (forceInvalid) { diff --git a/UIX/Microsoft/Iris/Layouts/AnchorEdge.cs b/UIX/Microsoft/Iris/Layouts/AnchorEdge.cs index b869508..1d41568 100644 --- a/UIX/Microsoft/Iris/Layouts/AnchorEdge.cs +++ b/UIX/Microsoft/Iris/Layouts/AnchorEdge.cs @@ -26,65 +26,65 @@ namespace Microsoft.Iris.Layouts public AnchorEdge(string id, float percent) { - this.Id = id; - this.Percent = percent; + Id = id; + Percent = percent; } public string Id { - get => this._idName; - set => this._idName = value; + get => _idName; + set => _idName = value; } public float Percent { - get => this._percentValue; - set => this._percentValue = value; + get => _percentValue; + set => _percentValue = value; } public int Offset { - get => this._offsetValue; - set => this._offsetValue = value; + get => _offsetValue; + set => _offsetValue = value; } public float MaximumPercent { - get => this._maximumPercentValue; + get => _maximumPercentValue; set { - this._maximumPercentValue = value; - this._maximumSetFlag = true; + _maximumPercentValue = value; + _maximumSetFlag = true; } } public int MaximumOffset { - get => this._maximumOffsetValue; + get => _maximumOffsetValue; set { - this._maximumOffsetValue = value; - this._maximumSetFlag = true; + _maximumOffsetValue = value; + _maximumSetFlag = true; } } public float MinimumPercent { - get => this._minimumPercentValue; + get => _minimumPercentValue; set { - this._minimumPercentValue = value; - this._minimumSetFlag = true; + _minimumPercentValue = value; + _minimumSetFlag = true; } } public int MinimumOffset { - get => this._minimumOffsetValue; + get => _minimumOffsetValue; set { - this._minimumOffsetValue = value; - this._minimumSetFlag = true; + _minimumOffsetValue = value; + _minimumSetFlag = true; } } @@ -92,27 +92,27 @@ namespace Microsoft.Iris.Layouts { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); - stringBuilder.Append(this._idName); + stringBuilder.Append(_idName); stringBuilder.Append(", "); - stringBuilder.Append(this._percentValue); - if (this._offsetValue != 0) + stringBuilder.Append(_percentValue); + if (_offsetValue != 0) { stringBuilder.Append(", "); - stringBuilder.Append(this._offsetValue); + stringBuilder.Append(_offsetValue); } if (_maximumPercentValue > 0.0) { stringBuilder.Append(", MaximumPercent="); - stringBuilder.Append(this._maximumPercentValue); + stringBuilder.Append(_maximumPercentValue); stringBuilder.Append(", MaximumOffset="); - stringBuilder.Append(this._maximumOffsetValue); + stringBuilder.Append(_maximumOffsetValue); } if (_minimumPercentValue > 0.0) { stringBuilder.Append(", MinimumPercent="); - stringBuilder.Append(this._minimumPercentValue); + stringBuilder.Append(_minimumPercentValue); stringBuilder.Append(", MinimumOffset="); - stringBuilder.Append(this._minimumOffsetValue); + stringBuilder.Append(_minimumOffsetValue); } stringBuilder.Append(")"); return stringBuilder.ToString(); @@ -130,13 +130,13 @@ namespace Microsoft.Iris.Layouts public override bool Equals(object obj) { AnchorEdge anchorEdge = obj as AnchorEdge; - return (object)anchorEdge != null && this.Id == anchorEdge.Id && (Percent == (double)anchorEdge.Percent && this.Offset == anchorEdge.Offset) && (this.MaximumSet == anchorEdge.MaximumSet && MaximumPercent == (double)anchorEdge.MaximumPercent && (this.MaximumOffset == anchorEdge.MaximumOffset && this.MinimumSet == anchorEdge.MinimumSet)) && MinimumPercent == (double)anchorEdge.MinimumPercent && this.MinimumOffset == anchorEdge.MinimumOffset; + return (object)anchorEdge != null && Id == anchorEdge.Id && (Percent == (double)anchorEdge.Percent && Offset == anchorEdge.Offset) && (MaximumSet == anchorEdge.MaximumSet && MaximumPercent == (double)anchorEdge.MaximumPercent && (MaximumOffset == anchorEdge.MaximumOffset && MinimumSet == anchorEdge.MinimumSet)) && MinimumPercent == (double)anchorEdge.MinimumPercent && MinimumOffset == anchorEdge.MinimumOffset; } - public override int GetHashCode() => (this.Id != null ? this.Id.GetHashCode() : 0) ^ this.Percent.GetHashCode() ^ this.Offset << 8 ^ this.MaximumSet.GetHashCode() ^ this.MaximumPercent.GetHashCode() ^ this.MaximumOffset << 16 ^ this.MinimumSet.GetHashCode() ^ this.MinimumPercent.GetHashCode() ^ this.MinimumOffset << 24; + public override int GetHashCode() => (Id != null ? Id.GetHashCode() : 0) ^ Percent.GetHashCode() ^ Offset << 8 ^ MaximumSet.GetHashCode() ^ MaximumPercent.GetHashCode() ^ MaximumOffset << 16 ^ MinimumSet.GetHashCode() ^ MinimumPercent.GetHashCode() ^ MinimumOffset << 24; - internal bool MaximumSet => this._maximumSetFlag; + internal bool MaximumSet => _maximumSetFlag; - internal bool MinimumSet => this._minimumSetFlag; + internal bool MinimumSet => _minimumSetFlag; } } diff --git a/UIX/Microsoft/Iris/Layouts/AnchorLayout.cs b/UIX/Microsoft/Iris/Layouts/AnchorLayout.cs index 4fc2a24..595ded8 100644 --- a/UIX/Microsoft/Iris/Layouts/AnchorLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/AnchorLayout.cs @@ -26,20 +26,20 @@ namespace Microsoft.Iris.Layouts public bool SizeToHorizontalChildren { - get => this._sizeToHorizontalChildrenFlag; - set => this._sizeToHorizontalChildrenFlag = value; + get => _sizeToHorizontalChildrenFlag; + set => _sizeToHorizontalChildrenFlag = value; } public bool SizeToVerticalChildren { - get => this._sizeToVerticalChildrenFlag; - set => this._sizeToVerticalChildrenFlag = value; + get => _sizeToVerticalChildrenFlag; + set => _sizeToVerticalChildrenFlag = value; } public ItemAlignment DefaultChildAlignment { - get => this._defaultChildAlignment; - set => this._defaultChildAlignment = value; + get => _defaultChildAlignment; + set => _defaultChildAlignment = value; } Size ILayout.Measure(ILayoutNode layoutNode, Size constraint) @@ -66,9 +66,9 @@ namespace Microsoft.Iris.Layouts if (layoutNode.LayoutChildrenCount == 0) { packet.Records.Clear(); - if (!this._sizeToHorizontalChildrenFlag) + if (!_sizeToHorizontalChildrenFlag) zero.Width = constraint.Width; - if (!this._sizeToVerticalChildrenFlag) + if (!_sizeToVerticalChildrenFlag) zero.Height = constraint.Height; layoutNode.RequestMoreChildren(int.MaxValue); return zero; @@ -93,7 +93,7 @@ namespace Microsoft.Iris.Layouts if (record.Phase == LayoutPhase.Untouched) { packet.CircularityBreakerRecord = null; - this.MeasureChild(packet, record); + MeasureChild(packet, record); } } if (packet.CircularitiesDetected) @@ -107,22 +107,22 @@ namespace Microsoft.Iris.Layouts foreach (AnchorLayout.Record record in packet.Records) { if (record.Phase == LayoutPhase.Untouched) - this.MeasureChild(packet, record); + MeasureChild(packet, record); } } Size size = constraint; - if (this._sizeToHorizontalChildrenFlag || this._sizeToVerticalChildrenFlag) + if (_sizeToHorizontalChildrenFlag || _sizeToVerticalChildrenFlag) { - if (this._sizeToHorizontalChildrenFlag) + if (_sizeToHorizontalChildrenFlag) size.Width = packet.TotalBounds.Width; - if (this._sizeToVerticalChildrenFlag) + if (_sizeToVerticalChildrenFlag) size.Height = packet.TotalBounds.Height; foreach (AnchorLayout.Record record in packet.Records) { Rectangle bounds = record.Bounds; - if (this._sizeToHorizontalChildrenFlag) + if (_sizeToHorizontalChildrenFlag) bounds.X -= packet.TotalBounds.X; - if (this._sizeToVerticalChildrenFlag) + if (_sizeToVerticalChildrenFlag) bounds.Y -= packet.TotalBounds.Y; record.Bounds = bounds; } @@ -137,10 +137,10 @@ namespace Microsoft.Iris.Layouts record.Phase = LayoutPhase.InProgress; bool allArrangePhase = true; bool anyArrangePhase = false; - int edge1 = this.ComputeEdge(packet, "Left", input.Left, s_anchorParent0, Orientation.Horizontal, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); - int edge2 = this.ComputeEdge(packet, "Top", input.Top, s_anchorParent0, Orientation.Vertical, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); - int edge3 = this.ComputeEdge(packet, "Right", input.Right, s_anchorParent1, Orientation.Horizontal, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); - int edge4 = this.ComputeEdge(packet, "Bottom", input.Bottom, s_anchorParent1, Orientation.Vertical, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); + int edge1 = ComputeEdge(packet, "Left", input.Left, s_anchorParent0, Orientation.Horizontal, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); + int edge2 = ComputeEdge(packet, "Top", input.Top, s_anchorParent0, Orientation.Vertical, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); + int edge3 = ComputeEdge(packet, "Right", input.Right, s_anchorParent1, Orientation.Horizontal, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); + int edge4 = ComputeEdge(packet, "Bottom", input.Bottom, s_anchorParent1, Orientation.Vertical, record, out AnchorLayout.Record _, ref allArrangePhase, ref anyArrangePhase); if (anyArrangePhase) { if (!allArrangePhase) @@ -201,7 +201,7 @@ namespace Microsoft.Iris.Layouts ref bool anyArrangePhase) { anchor = anchor != null ? anchor : fallback; - recordRef = this.GetReferenceRecord(packet, anchor.Id); + recordRef = GetReferenceRecord(packet, anchor.Id); if (recordRef == null) { allArrangePhase = false; @@ -316,10 +316,10 @@ namespace Microsoft.Iris.Layouts AnchorLayoutInput input = record2.Input; bool flag = false; AnchorLayout.Record recordRef; - int edge1 = this.ComputeEdge(measureData, "Left", input.Left, null, Orientation.Horizontal, record2, out recordRef, ref flag, ref flag); - int edge2 = this.ComputeEdge(measureData, "Top", input.Top, null, Orientation.Vertical, record2, out recordRef, ref flag, ref flag); - int edge3 = this.ComputeEdge(measureData, "Right", input.Right, null, Orientation.Horizontal, record2, out recordRef, ref flag, ref flag); - int edge4 = this.ComputeEdge(measureData, "Bottom", input.Bottom, null, Orientation.Vertical, record2, out recordRef, ref flag, ref flag); + int edge1 = ComputeEdge(measureData, "Left", input.Left, null, Orientation.Horizontal, record2, out recordRef, ref flag, ref flag); + int edge2 = ComputeEdge(measureData, "Top", input.Top, null, Orientation.Vertical, record2, out recordRef, ref flag, ref flag); + int edge3 = ComputeEdge(measureData, "Right", input.Right, null, Orientation.Horizontal, record2, out recordRef, ref flag, ref flag); + int edge4 = ComputeEdge(measureData, "Bottom", input.Bottom, null, Orientation.Vertical, record2, out recordRef, ref flag, ref flag); int width = edge3 - edge1; int height = edge4 - edge2; record2.LayoutNode.Measure(new Size(width, height)); @@ -342,11 +342,11 @@ namespace Microsoft.Iris.Layouts if (record.ID == id) { if (record.Phase == LayoutPhase.Untouched) - this.MeasureChild(packet, record); + MeasureChild(packet, record); return record; } } - ErrorManager.ReportError("Anchor layout: {0} cannot find the '{1}' child", this.GetType().Name, id); + ErrorManager.ReportError("Anchor layout: {0} cannot find the '{1}' child", GetType().Name, id); return null; } @@ -372,26 +372,26 @@ namespace Microsoft.Iris.Layouts public bool Invalid; private static AnchorLayoutInput s_defaultInput = new AnchorLayoutInput(); - public Record(ILayoutNode layoutNode) => this.Initialize(layoutNode); + public Record(ILayoutNode layoutNode) => Initialize(layoutNode); public void Initialize(ILayoutNode layoutNode) { - this.LayoutNode = layoutNode; - this.Input = layoutNode.GetLayoutInput(InputData) as AnchorLayoutInput; - if (this.Input == null) - this.Input = s_defaultInput; - this.ID = ((ViewItem)layoutNode).Name; - this.Bounds = Rectangle.Zero; - this.Phase = LayoutPhase.Untouched; - this.Visible = true; - this.Invalid = false; + LayoutNode = layoutNode; + Input = layoutNode.GetLayoutInput(InputData) as AnchorLayoutInput; + if (Input == null) + Input = s_defaultInput; + ID = ((ViewItem)layoutNode).Name; + Bounds = Rectangle.Zero; + Phase = LayoutPhase.Untouched; + Visible = true; + Invalid = false; } public Record(string idName, Rectangle bounds, AnchorLayout.LayoutPhase phaseOverride) { - this.ID = idName; - this.Bounds = bounds; - this.Phase = phaseOverride; + ID = idName; + Bounds = bounds; + Phase = phaseOverride; } public override string ToString() => string.Format("AnchorLayout.Record({0}, Phase={1})", ID, Phase); diff --git a/UIX/Microsoft/Iris/Layouts/AnchorLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/AnchorLayoutInput.cs index de15e6c..4b270ba 100644 --- a/UIX/Microsoft/Iris/Layouts/AnchorLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/AnchorLayoutInput.cs @@ -20,44 +20,44 @@ namespace Microsoft.Iris.Layouts public AnchorEdge Left { - get => this._anchorLeft; - set => this._anchorLeft = value; + get => _anchorLeft; + set => _anchorLeft = value; } public AnchorEdge Top { - get => this._anchorTop; - set => this._anchorTop = value; + get => _anchorTop; + set => _anchorTop = value; } public AnchorEdge Right { - get => this._anchorRight; - set => this._anchorRight = value; + get => _anchorRight; + set => _anchorRight = value; } public AnchorEdge Bottom { - get => this._anchorBottom; - set => this._anchorBottom = value; + get => _anchorBottom; + set => _anchorBottom = value; } public bool ContributesToWidth { - get => this._contributesToWidthFlag; - set => this._contributesToWidthFlag = value; + get => _contributesToWidthFlag; + set => _contributesToWidthFlag = value; } public bool ContributesToHeight { - get => this._contributesToHeightFlag; - set => this._contributesToHeightFlag = value; + get => _contributesToHeightFlag; + set => _contributesToHeightFlag = value; } DataCookie ILayoutInput.Data => Data; internal static DataCookie Data => AnchorLayout.InputData; - public override string ToString() => InvariantString.Format("AnchorLayoutInput(Left={0}, Top={1}, Right={2}, Bottom={3}{4}{5})", Left, Top, Right, Bottom, this.ContributesToWidth ? ", ContributesToWidth=true" : string.Empty, this.ContributesToHeight ? ", ContributesToHeight=true" : string.Empty); + public override string ToString() => InvariantString.Format("AnchorLayoutInput(Left={0}, Top={1}, Right={2}, Bottom={3}{4}{5})", Left, Top, Right, Bottom, ContributesToWidth ? ", ContributesToWidth=true" : string.Empty, ContributesToHeight ? ", ContributesToHeight=true" : string.Empty); } } diff --git a/UIX/Microsoft/Iris/Layouts/DockLayout.cs b/UIX/Microsoft/Iris/Layouts/DockLayout.cs index 88b50c4..3a579e9 100644 --- a/UIX/Microsoft/Iris/Layouts/DockLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/DockLayout.cs @@ -22,14 +22,14 @@ namespace Microsoft.Iris.Layouts public DockLayoutInput DefaultLayoutInput { - get => this._defaultLayoutInput; - set => this._defaultLayoutInput = value; + get => _defaultLayoutInput; + set => _defaultLayoutInput = value; } public ItemAlignment DefaultChildAlignment { - get => this._defaultChildAlignment; - set => this._defaultChildAlignment = value; + get => _defaultChildAlignment; + set => _defaultChildAlignment = value; } Size ILayout.Measure(ILayoutNode layoutNode, Size constraint) @@ -42,7 +42,7 @@ namespace Microsoft.Iris.Layouts { Size size2 = layoutChild.Measure(constraint1); sz2_1 = Size.Max(size1 - constraint1 + size2, sz2_1); - DockLayoutInput layoutInputForNode = this.GetLayoutInputForNode(layoutChild); + DockLayoutInput layoutInputForNode = GetLayoutInputForNode(layoutChild); if (layoutInputForNode == DockLayoutInput.Left || layoutInputForNode == DockLayoutInput.Right) constraint1.Width -= size2.Width; else if (layoutInputForNode == DockLayoutInput.Top || layoutInputForNode == DockLayoutInput.Bottom) @@ -55,7 +55,7 @@ namespace Microsoft.Iris.Layouts Size sz2_2 = Size.Zero; foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren) { - if (this.GetLayoutInputForNode(layoutChild) == DockLayoutInput.Client) + if (GetLayoutInputForNode(layoutChild) == DockLayoutInput.Client) sz2_2 = Size.Max(layoutChild.Measure(constraint1), sz2_2); } sz2_1 = Size.Max(size1 - constraint1 + sz2_2, sz2_1); @@ -73,7 +73,7 @@ namespace Microsoft.Iris.Layouts { Size desiredSize = layoutChild.DesiredSize; Rectangle bounds2 = bounds1; - DockLayoutInput layoutInputForNode = this.GetLayoutInputForNode(layoutChild); + DockLayoutInput layoutInputForNode = GetLayoutInputForNode(layoutChild); if (layoutInputForNode == DockLayoutInput.Left) { bounds2.Width = desiredSize.Width; @@ -109,7 +109,7 @@ namespace Microsoft.Iris.Layouts return; foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren) { - if (this.GetLayoutInputForNode(layoutChild) == DockLayoutInput.Client) + if (GetLayoutInputForNode(layoutChild) == DockLayoutInput.Client) layoutChild.Arrange(slot, bounds1); } } @@ -117,7 +117,7 @@ namespace Microsoft.Iris.Layouts private DockLayoutInput GetLayoutInputForNode(ILayoutNode node) { if (!(node.GetLayoutInput(s_dataProperty) is DockLayoutInput dockLayoutInput)) - dockLayoutInput = this._defaultLayoutInput ?? s_defaultLayoutInput; + dockLayoutInput = _defaultLayoutInput ?? s_defaultLayoutInput; return dockLayoutInput; } } diff --git a/UIX/Microsoft/Iris/Layouts/DockLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/DockLayoutInput.cs index ba24341..9643f33 100644 --- a/UIX/Microsoft/Iris/Layouts/DockLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/DockLayoutInput.cs @@ -39,6 +39,6 @@ namespace Microsoft.Iris.Layouts } } - public override string ToString() => InvariantString.Format("{0}(Position={1})", this.GetType().Name, PositionString); + public override string ToString() => InvariantString.Format("{0}(Position={1})", GetType().Name, PositionString); } } diff --git a/UIX/Microsoft/Iris/Layouts/FlowLayout.cs b/UIX/Microsoft/Iris/Layouts/FlowLayout.cs index 30d700e..173ae88 100644 --- a/UIX/Microsoft/Iris/Layouts/FlowLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/FlowLayout.cs @@ -27,62 +27,62 @@ namespace Microsoft.Iris.Layouts public FlowLayout() { - this._orientationFlow = Orientation.Horizontal; - this._minimumSampleSizeValue = 3; + _orientationFlow = Orientation.Horizontal; + _minimumSampleSizeValue = 3; } public Orientation Orientation { - get => this._orientationFlow; - set => this._orientationFlow = value; + get => _orientationFlow; + set => _orientationFlow = value; } public MajorMinor Spacing { - get => this._spacingMajorMinor; - set => this._spacingMajorMinor = value; + get => _spacingMajorMinor; + set => _spacingMajorMinor = value; } public bool AllowWrap { - get => this._allowWrapFlag; - set => this._allowWrapFlag = value; + get => _allowWrapFlag; + set => _allowWrapFlag = value; } public StripAlignment StripAlignment { - get => this._stripAlignment; - set => this._stripAlignment = value; + get => _stripAlignment; + set => _stripAlignment = value; } public RepeatPolicy Repeat { - get => this._repeat; - set => this._repeat = value; + get => _repeat; + set => _repeat = value; } public MajorMinor RepeatGap { - get => this._repeatGapMajorMinor; - set => this._repeatGapMajorMinor = value; + get => _repeatGapMajorMinor; + set => _repeatGapMajorMinor = value; } public MissingItemPolicy MissingItemPolicy { - get => this._policyForMissingItems; - set => this._policyForMissingItems = value; + get => _policyForMissingItems; + set => _policyForMissingItems = value; } public int MinimumSampleSize { - get => this._minimumSampleSizeValue; - set => this._minimumSampleSizeValue = value; + get => _minimumSampleSizeValue; + set => _minimumSampleSizeValue = value; } public ItemAlignment DefaultChildAlignment { - get => this._defaultChildAlignment; - set => this._defaultChildAlignment = value; + get => _defaultChildAlignment; + set => _defaultChildAlignment = value; } Size ILayout.Measure(ILayoutNode layoutNode, Size constraint) @@ -96,24 +96,24 @@ namespace Microsoft.Iris.Layouts packet.Clear(); packet.Subject = layoutNode; packet.Constraint = constraint; - packet.Available = new MajorMinor(constraint, this.Orientation); + packet.Available = new MajorMinor(constraint, Orientation); packet.Cache = (FlowSizeMemoryLayoutInput)packet.Subject.GetLayoutInput(FlowSizeMemoryLayoutInput.Data); - packet.RepeatOrientation = this.Orientation; - if (this.AllowWrap) - packet.RepeatOrientation = this.Orientation == Orientation.Vertical ? Orientation.Horizontal : Orientation.Vertical; - this.DetermineCount(packet); + packet.RepeatOrientation = Orientation; + if (AllowWrap) + packet.RepeatOrientation = Orientation == Orientation.Vertical ? Orientation.Horizontal : Orientation.Vertical; + DetermineCount(packet); if (layoutNode.LayoutChildrenCount == 0) { if (packet.PotentialCount > 0) layoutNode.RequestMoreChildren(1); return Size.Zero; } - this.CreateRecordsFromChildren(packet); - this.HandleMissingRecords(packet); - this.MeasureRecords(packet); + CreateRecordsFromChildren(packet); + HandleMissingRecords(packet); + MeasureRecords(packet); if (packet.DesiredSize.IsEmpty && packet.PotentialCount != layoutNode.LayoutChildrenCount) layoutNode.RequestMoreChildren(1); - return packet.DesiredSize.ToSize(this.Orientation); + return packet.DesiredSize.ToSize(Orientation); } void ILayout.Arrange(ILayoutNode layoutNode, LayoutSlot slot) @@ -130,15 +130,15 @@ namespace Microsoft.Iris.Layouts measureData.ViewStart = new MajorMinor(new Size(view.Location), measureData.RepeatOrientation); measureData.ViewSize = new MajorMinor(view.Size, measureData.RepeatOrientation); measureData.ViewEnd = measureData.ViewStart + measureData.ViewSize; - this.DetermineRepeatPolicy(measureData); - this.ArrangeChildren(measureData); - this.CalculateVisualIntersections(measureData); - this.RequestMissingChildren(measureData); + DetermineRepeatPolicy(measureData); + ArrangeChildren(measureData); + CalculateVisualIntersections(measureData); + RequestMissingChildren(measureData); MajorMinor majorMinor = measureData.DesiredSize; if (measureData.Repeat) { majorMinor = new MajorMinor(measureData.Available.Major, measureData.DesiredSize.Minor); - Rectangle rectangle = new Rectangle(new MajorMinor(-measureData.Available.Major / 2, 0).ToPoint(this._orientationFlow), majorMinor.ToSize(this._orientationFlow)); + Rectangle rectangle = new Rectangle(new MajorMinor(-measureData.Available.Major / 2, 0).ToPoint(_orientationFlow), majorMinor.ToSize(_orientationFlow)); layoutNode.AddAreaOfInterest(new AreaOfInterest(rectangle, AreaOfInterestID.ScrollableRange)); } layoutNode.SetVisibleIndexRange(measureData.BeginVisible, measureData.EndVisible, measureData.BeginVisibleOffscreen, measureData.EndVisibleOffscreen, measureData.FocusedItem); @@ -170,7 +170,7 @@ namespace Microsoft.Iris.Layouts private void CreateRecordsFromChildren(FlowLayout.Packet packet) { - this.InitializeRecordList(ref packet.Records, packet.PotentialCount); + InitializeRecordList(ref packet.Records, packet.PotentialCount); Vector availableDataIndices = packet.AvailableDataIndices; Vector availableVirtualIndices = packet.AvailableVirtualIndices; bool flag = false; @@ -180,7 +180,7 @@ namespace Microsoft.Iris.Layouts int virtualIndex; int dataIndex; IndexType type; - this.GetIndex(layoutChild, childIndex, packet.PotentialCount, out virtualIndex, out dataIndex, out int _, out type); + GetIndex(layoutChild, childIndex, packet.PotentialCount, out virtualIndex, out dataIndex, out int _, out type); Vector vector = packet.Records; if (type == IndexType.Content) { @@ -190,7 +190,7 @@ namespace Microsoft.Iris.Layouts { if (!flag) { - this.InitializeRecordList(ref packet.Dividers, packet.PotentialCount); + InitializeRecordList(ref packet.Dividers, packet.PotentialCount); flag = true; } vector = packet.Dividers; @@ -213,7 +213,7 @@ namespace Microsoft.Iris.Layouts else { layoutChild.Measure(packet.Constraint); - record2.Size = new MajorMinor(layoutChild.DesiredSize, this.Orientation); + record2.Size = new MajorMinor(layoutChild.DesiredSize, Orientation); record2.SizeValid = true; } } @@ -235,8 +235,8 @@ namespace Microsoft.Iris.Layouts break; if (!knownSiz.IsEmpty) { - MajorMinor majorMinor = new MajorMinor(knownSiz, this.Orientation); - if (!this.AllowWrap) + MajorMinor majorMinor = new MajorMinor(knownSiz, Orientation); + if (!AllowWrap) majorMinor = new MajorMinor(majorMinor.Major, 0); FlowLayout.Record record = packet.Records[index]; if (!Record.IsNullOrEmpty(record)) @@ -287,10 +287,10 @@ namespace Microsoft.Iris.Layouts int count = packet.AvailableDataIndices.Count; if (packet.PotentialCount - count == 0) return; - MissingItemPolicy missingItemPolicy = this.MissingItemPolicy; - if (count < this._minimumSampleSizeValue) + MissingItemPolicy missingItemPolicy = MissingItemPolicy; + if (count < _minimumSampleSizeValue) missingItemPolicy = MissingItemPolicy.Wait; - MajorMinor a = this.MissingItemPolicy != MissingItemPolicy.SizeToSmallest ? MajorMinor.Zero : new MajorMinor(16777215, 16777215); + MajorMinor a = MissingItemPolicy != MissingItemPolicy.SizeToSmallest ? MajorMinor.Zero : new MajorMinor(16777215, 16777215); for (int index = 0; index < packet.Records.Count; ++index) { FlowLayout.Record record = packet.Records[index]; @@ -347,7 +347,7 @@ namespace Microsoft.Iris.Layouts for (int index = 0; index < packet.Records.Count; ++index) { FlowLayout.Record record = packet.Records[index]; - this.MeasureRecord(packet, record, offset); + MeasureRecord(packet, record, offset); MajorMinor majorMinor1 = offset + record.Size; MajorMinor majorMinor2 = packet.Available - majorMinor1; if (majorMinor2.Minor < 0) @@ -357,18 +357,18 @@ namespace Microsoft.Iris.Layouts } if (majorMinor2.Major < 0) { - if (this.AllowWrap) + if (AllowWrap) { if (num2 == 0) { record.SizeValid = false; break; } - this.FinalizeStrip(packet, stripSize, offset, ref zero); + FinalizeStrip(packet, stripSize, offset, ref zero); ++num1; num2 = 0; stripSize = MajorMinor.Zero; - offset = new MajorMinor(0, zero.Minor + this.Spacing.Minor); + offset = new MajorMinor(0, zero.Minor + Spacing.Minor); --index; } else @@ -378,13 +378,13 @@ namespace Microsoft.Iris.Layouts { record.Strip = num1; record.Offset = offset; - FlowLayout.Record divider = this.GetDivider(packet, record); + FlowLayout.Record divider = GetDivider(packet, record); if (divider != null) { if (num2 > 0) { MajorMinor majorMinor3 = offset; - majorMinor3.Major -= (this.Spacing.Major + divider.Size.Major) / 2; + majorMinor3.Major -= (Spacing.Major + divider.Size.Major) / 2; divider.Offset = majorMinor3; divider.Strip = num1; } @@ -393,14 +393,14 @@ namespace Microsoft.Iris.Layouts } ++num2; stripSize = new MajorMinor(majorMinor1.Major, Math.Max(record.Size.Minor, stripSize.Minor)); - offset.Major = majorMinor1.Major + this.Spacing.Major; + offset.Major = majorMinor1.Major + Spacing.Major; lastLaidOutIndex = index; } } if (num2 != 0) { - this.HandleLastItem(packet, ref lastLaidOutIndex, ref offset, ref stripSize); - this.FinalizeStrip(packet, stripSize, offset, ref zero); + HandleLastItem(packet, ref lastLaidOutIndex, ref offset, ref stripSize); + FinalizeStrip(packet, stripSize, offset, ref zero); } packet.LastLaidOutRecord = lastLaidOutIndex; packet.StoppedAtRecord = count; @@ -414,20 +414,20 @@ namespace Microsoft.Iris.Layouts { if (record.SizeValid) return; - Size childConstraint = this.GetChildConstraint(packet, offset); + Size childConstraint = GetChildConstraint(packet, offset); record.Size = MajorMinor.Zero; if (record.Nodes != null && record.Nodes.Count > 0) { for (int index = 0; index < record.Nodes.Count; ++index) { ILayoutNode node = record.Nodes[index]; - this.GetIndex(node, 0, packet.PotentialCount, out int _, out int _, out int _, out IndexType _); + GetIndex(node, 0, packet.PotentialCount, out int _, out int _, out int _, out IndexType _); node.Measure(childConstraint); - MajorMinor a = new MajorMinor(node.DesiredSize, this.Orientation); + MajorMinor a = new MajorMinor(node.DesiredSize, Orientation); record.Size = index <= 0 || a.Equals(record.Size) ? a : MajorMinor.Max(a, record.Size); } packet.Cache.KnownSizes.ExpandTo(record.Index + 1); - packet.Cache.KnownSizes[record.Index] = record.Size.ToSize(this.Orientation); + packet.Cache.KnownSizes[record.Index] = record.Size.ToSize(Orientation); } else record.Size = record.CachedSize; @@ -437,7 +437,7 @@ namespace Microsoft.Iris.Layouts private Size GetChildConstraint(FlowLayout.Packet packet, MajorMinor offset) { Size constraint = packet.Constraint; - return this.AllowWrap ? constraint : (packet.Available - offset).ToSize(this.Orientation); + return AllowWrap ? constraint : (packet.Available - offset).ToSize(Orientation); } private void FinalizeStrip( @@ -469,26 +469,26 @@ namespace Microsoft.Iris.Layouts FlowLayout.Record record = packet.Records[index]; if (ListUtility.IsNullOrEmpty(record.Nodes)) return; - Size size = (packet.Available - offset).ToSize(this.Orientation); + Size size = (packet.Available - offset).ToSize(Orientation); foreach (ILayoutNode node in record.Nodes) node.Measure(size); Size desiredSize = record.Nodes[0].DesiredSize; if (desiredSize.Width > size.Width || desiredSize.Height > size.Height) return; - record.Size = new MajorMinor(desiredSize, this.Orientation); + record.Size = new MajorMinor(desiredSize, Orientation); record.SizeValid = true; int major = offset.Major + record.Size.Major; - offset = new MajorMinor(major + this.Spacing.Major, offset.Minor); + offset = new MajorMinor(major + Spacing.Major, offset.Minor); lastLaidOutIndex = index; stripSize = new MajorMinor(major, Math.Max(record.Size.Minor, stripSize.Minor)); } private void DetermineRepeatPolicy(FlowLayout.Packet packet) { - MajorMinor majorMinor = new MajorMinor(packet.Slot.View.Size, this.Orientation); + MajorMinor majorMinor = new MajorMinor(packet.Slot.View.Size, Orientation); bool flag1 = packet.DesiredSize.Major <= majorMinor.Major; bool flag2; - switch (this.Repeat) + switch (Repeat) { case RepeatPolicy.WhenTooBig: flag2 = !flag1; @@ -519,19 +519,19 @@ namespace Microsoft.Iris.Layouts int major2 = packet.ViewStart.Major; int major3 = packet.ViewEnd.Major; int major4 = packet.PeripheralEnd.Major; - packet.BeginVisibleOffscreen = this.IndexFromPosition(packet, major1, false) - 1; + packet.BeginVisibleOffscreen = IndexFromPosition(packet, major1, false) - 1; packet.BeginVisible = packet.BeginVisibleOffscreen; if (major2 != major1) - packet.BeginVisible = this.IndexFromPosition(packet, major2, false) - 1; - packet.EndVisible = this.IndexFromPosition(packet, major3, false); + packet.BeginVisible = IndexFromPosition(packet, major2, false) - 1; + packet.EndVisible = IndexFromPosition(packet, major3, false); packet.EndVisibleOffscreen = packet.EndVisible; if (major4 == major3) return; - packet.EndVisibleOffscreen = this.IndexFromPosition(packet, major4, false); + packet.EndVisibleOffscreen = IndexFromPosition(packet, major4, false); } } - private int GetRepeatMajor(FlowLayout.Packet packet, MajorMinor majorMinor) => this.Orientation != packet.RepeatOrientation ? majorMinor.Minor : majorMinor.Major; + private int GetRepeatMajor(FlowLayout.Packet packet, MajorMinor majorMinor) => Orientation != packet.RepeatOrientation ? majorMinor.Minor : majorMinor.Major; private int IndexFromPosition(FlowLayout.Packet packet, int position, bool exactMatch) { @@ -539,14 +539,14 @@ namespace Microsoft.Iris.Layouts int generationValue = 0; if (packet.PotentialCount == packet.LastLaidOutRecord + 1) { - int itemsCount = this.GetRepeatMajor(packet, packet.DesiredSize) + this.GetRepeatMajor(packet, this.RepeatGap); + int itemsCount = GetRepeatMajor(packet, packet.DesiredSize) + GetRepeatMajor(packet, RepeatGap); ListUtility.GetWrappedIndex(position, itemsCount, out dataIndex1, out generationValue); } int dataIndex2 = packet.PotentialCount; for (int index = 0; index < packet.Records.Count; ++index) { FlowLayout.Record record = packet.Records[index]; - if (exactMatch && this.GetRepeatMajor(packet, record.Offset) <= dataIndex1 && this.GetRepeatMajor(packet, record.Offset) + this.GetRepeatMajor(packet, record.Size) >= dataIndex1) + if (exactMatch && GetRepeatMajor(packet, record.Offset) <= dataIndex1 && GetRepeatMajor(packet, record.Offset) + GetRepeatMajor(packet, record.Size) >= dataIndex1) { dataIndex2 = record.Index; break; @@ -556,7 +556,7 @@ namespace Microsoft.Iris.Layouts dataIndex2 = packet.PotentialCount; break; } - if (this.GetRepeatMajor(packet, record.Offset) >= dataIndex1 || index > packet.LastLaidOutRecord) + if (GetRepeatMajor(packet, record.Offset) >= dataIndex1 || index > packet.LastLaidOutRecord) { dataIndex2 = record.Index; break; @@ -595,12 +595,12 @@ namespace Microsoft.Iris.Layouts private void RequestMissingChildren(FlowLayout.Packet packet) { - this.FilterIntersectionPoints(packet); + FilterIntersectionPoints(packet); int visibleOffscreen = packet.BeginVisibleOffscreen; int num1 = packet.EndVisibleOffscreen - 1; int num2 = -1; - if (packet.AvailableDataIndices.Count < this._minimumSampleSizeValue) - num2 = this._minimumSampleSizeValue; + if (packet.AvailableDataIndices.Count < _minimumSampleSizeValue) + num2 = _minimumSampleSizeValue; Vector indiciesList = null; for (int index = visibleOffscreen; index <= num1; ++index) { @@ -629,7 +629,7 @@ namespace Microsoft.Iris.Layouts int dataIndex; int generationValue; IndexType type; - this.GetIndex(layoutChild, childIndex, packet.PotentialCount, out virtualIndex, out dataIndex, out generationValue, out type); + GetIndex(layoutChild, childIndex, packet.PotentialCount, out virtualIndex, out dataIndex, out generationValue, out type); FlowLayout.Record record = type != IndexType.Content ? packet.Dividers[dataIndex] : packet.Records[dataIndex]; if (!record.SizeValid) { @@ -640,12 +640,12 @@ namespace Microsoft.Iris.Layouts if (type == IndexType.Content && strip != record.Strip) { strip = record.Strip; - majorMinor1 = this.GetStripOffset(packet, strip); + majorMinor1 = GetStripOffset(packet, strip); } - MajorMinor majorMinor2 = this.PositionFromIndex(packet, record.Offset, generationValue); + MajorMinor majorMinor2 = PositionFromIndex(packet, record.Offset, generationValue); majorMinor2.Major += majorMinor1.Major; - Size size = new MajorMinor(new MajorMinor(layoutChild.DesiredSize, this.Orientation).Major, majorMinor1.Minor).ToSize(this.Orientation); - Rectangle bounds = new Rectangle(majorMinor2.ToPoint(this.Orientation), size); + Size size = new MajorMinor(new MajorMinor(layoutChild.DesiredSize, Orientation).Major, majorMinor1.Minor).ToSize(Orientation); + Rectangle bounds = new Rectangle(majorMinor2.ToPoint(Orientation), size); layoutChild.Arrange(packet.Slot, bounds); if (layoutChild.ContainsAreaOfInterest(AreaOfInterestID.Focus)) packet.FocusedItem = new int?(virtualIndex); @@ -660,8 +660,8 @@ namespace Microsoft.Iris.Layouts if (strip >= 0 && strip < packet.StripSizes.Count) { MajorMinor stripSiz = packet.StripSizes[strip]; - MajorMinor majorMinor1 = new MajorMinor(packet.Slot.Bounds, this.Orientation); - switch (this.StripAlignment) + MajorMinor majorMinor1 = new MajorMinor(packet.Slot.Bounds, Orientation); + switch (StripAlignment) { case StripAlignment.Center: zero.Major = (majorMinor1.Major - stripSiz.Major) / 2; @@ -670,9 +670,9 @@ namespace Microsoft.Iris.Layouts zero.Major = majorMinor1.Major - stripSiz.Major; break; } - if (!this.AllowWrap) + if (!AllowWrap) { - MajorMinor majorMinor2 = new MajorMinor(packet.Slot.Bounds, this.Orientation); + MajorMinor majorMinor2 = new MajorMinor(packet.Slot.Bounds, Orientation); zero.Minor = majorMinor2.Minor; } else @@ -689,10 +689,10 @@ namespace Microsoft.Iris.Layouts if (generationValue == 0) return recordoffset; MajorMinor majorMinor = recordoffset; - if (this.Orientation == packet.RepeatOrientation) - majorMinor.Major = ListUtility.GetUnwrappedIndex(majorMinor.Major, generationValue, packet.DesiredSize.Major + this.RepeatGap.Major); + if (Orientation == packet.RepeatOrientation) + majorMinor.Major = ListUtility.GetUnwrappedIndex(majorMinor.Major, generationValue, packet.DesiredSize.Major + RepeatGap.Major); else - majorMinor.Minor = ListUtility.GetUnwrappedIndex(majorMinor.Minor, generationValue, packet.DesiredSize.Minor + this.RepeatGap.Minor); + majorMinor.Minor = ListUtility.GetUnwrappedIndex(majorMinor.Minor, generationValue, packet.DesiredSize.Minor + RepeatGap.Minor); return majorMinor; } @@ -708,18 +708,18 @@ namespace Microsoft.Iris.Layouts public static bool IsNullOrEmpty(FlowLayout.Record record) => record == null || record.Index == int.MinValue; - public void Clear() => this.Initialize(RecordSourceType.Unspecified); + public void Clear() => Initialize(RecordSourceType.Unspecified); public void Initialize(FlowLayout.RecordSourceType source) { - this.Index = int.MinValue; - if (this.Nodes != null) - this.Nodes.Clear(); - this.Size = MajorMinor.Zero; - this.SizeValid = false; - this.CachedSize = MajorMinor.Zero; - this.Offset = MajorMinor.Zero; - this.Strip = 0; + Index = int.MinValue; + if (Nodes != null) + Nodes.Clear(); + Size = MajorMinor.Zero; + SizeValid = false; + CachedSize = MajorMinor.Zero; + Offset = MajorMinor.Zero; + Strip = 0; } public override string ToString() => InvariantString.Format("Record[{0}] Size:{1}", Index, Size); @@ -765,25 +765,25 @@ namespace Microsoft.Iris.Layouts public void Clear() { - this.PeripheralStart = MajorMinor.Zero; - this.PeripheralSize = MajorMinor.Zero; - this.PeripheralEnd = MajorMinor.Zero; - this.ViewStart = MajorMinor.Zero; - this.ViewSize = MajorMinor.Zero; - this.ViewEnd = MajorMinor.Zero; - this.PotentialCount = 0; - this.AvailableVirtualIndices.Clear(); - this.AvailableDataIndices.Clear(); - this.DesiredSize = MajorMinor.Zero; - this.StripSizes.Clear(); - this.LastLaidOutRecord = 0; - this.StoppedAtRecord = 0; - this.Repeat = false; - this.BeginVisibleOffscreen = 0; - this.BeginVisible = 0; - this.EndVisible = 0; - this.EndVisibleOffscreen = 0; - this.FocusedItem = new int?(); + PeripheralStart = MajorMinor.Zero; + PeripheralSize = MajorMinor.Zero; + PeripheralEnd = MajorMinor.Zero; + ViewStart = MajorMinor.Zero; + ViewSize = MajorMinor.Zero; + ViewEnd = MajorMinor.Zero; + PotentialCount = 0; + AvailableVirtualIndices.Clear(); + AvailableDataIndices.Clear(); + DesiredSize = MajorMinor.Zero; + StripSizes.Clear(); + LastLaidOutRecord = 0; + StoppedAtRecord = 0; + Repeat = false; + BeginVisibleOffscreen = 0; + BeginVisible = 0; + EndVisible = 0; + EndVisibleOffscreen = 0; + FocusedItem = new int?(); } } } diff --git a/UIX/Microsoft/Iris/Layouts/FlowSizeMemoryLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/FlowSizeMemoryLayoutInput.cs index 2843d6d..62f4734 100644 --- a/UIX/Microsoft/Iris/Layouts/FlowSizeMemoryLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/FlowSizeMemoryLayoutInput.cs @@ -16,12 +16,12 @@ namespace Microsoft.Iris.Layouts private static readonly DataCookie s_dataProperty = DataCookie.ReserveSlot(); private Vector _cache; - public FlowSizeMemoryLayoutInput() => this._cache = new Vector(); + public FlowSizeMemoryLayoutInput() => _cache = new Vector(); public Vector KnownSizes { - get => this._cache; - set => this._cache = value; + get => _cache; + set => _cache = value; } DataCookie ILayoutInput.Data => Data; @@ -33,7 +33,7 @@ namespace Microsoft.Iris.Layouts StringBuilder stringBuilder = new StringBuilder(); bool flag = true; int num = 0; - foreach (Size size in this._cache) + foreach (Size size in _cache) { if (!flag) stringBuilder.Append(", "); @@ -44,7 +44,7 @@ namespace Microsoft.Iris.Layouts stringBuilder.Append(size); ++num; } - return InvariantString.Format("{0}({1})", this.GetType().Name, stringBuilder); + return InvariantString.Format("{0}({1})", GetType().Name, stringBuilder); } } } diff --git a/UIX/Microsoft/Iris/Layouts/GridLayout.cs b/UIX/Microsoft/Iris/Layouts/GridLayout.cs index edf740a..a5b7989 100644 --- a/UIX/Microsoft/Iris/Layouts/GridLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/GridLayout.cs @@ -30,108 +30,108 @@ namespace Microsoft.Iris.Layouts { } - public GridLayout(Orientation o) => this._orientation = o; + public GridLayout(Orientation o) => _orientation = o; public Orientation Orientation { - get => this._orientation; + get => _orientation; set { - if (this._orientation == value) + if (_orientation == value) return; - this._orientation = value; + _orientation = value; } } public bool AllowWrap { - get => this._allowWrap; + get => _allowWrap; set { - if (this._allowWrap == value) + if (_allowWrap == value) return; - this._allowWrap = value; + _allowWrap = value; } } public Size ReferenceSize { - get => this._referenceSize; + get => _referenceSize; set { - if (!(this._referenceSize != value)) + if (!(_referenceSize != value)) return; - this._referenceSize = value; + _referenceSize = value; } } public int Rows { - get => this._rows; + get => _rows; set { - if (this._rows == value) + if (_rows == value) return; - this._rows = value; + _rows = value; } } public int Columns { - get => this._columns; + get => _columns; set { - if (this._columns == value) + if (_columns == value) return; - this._columns = value; + _columns = value; } } public Size Spacing { - get => this._spacing; + get => _spacing; set { - if (!(this._spacing != value)) + if (!(_spacing != value)) return; - this._spacing = value; + _spacing = value; } } public RepeatPolicy Repeat { - get => this._repeat; + get => _repeat; set { - if (this._repeat == value) + if (_repeat == value) return; - this._repeat = value; + _repeat = value; } } public int RepeatGap { - get => this._repeatGap; + get => _repeatGap; set { - if (this._repeatGap == value) + if (_repeatGap == value) return; - this._repeatGap = value; + _repeatGap = value; } } public ItemAlignment DefaultChildAlignment { - get => this._defaultChildAlignment; - set => this._defaultChildAlignment = value; + get => _defaultChildAlignment; + set => _defaultChildAlignment = value; } Size ILayout.Measure(ILayoutNode layoutNode, Size constraint) { - GridLayout.GeneralFlowInfo generalFlowInfo = this.CalculateGeneralFlowInfo(layoutNode, constraint); + GridLayout.GeneralFlowInfo generalFlowInfo = CalculateGeneralFlowInfo(layoutNode, constraint); layoutNode.MeasureData = generalFlowInfo; if (generalFlowInfo.itemsCount <= 0 || !generalFlowInfo.referenceExtent.IsEmpty) - return generalFlowInfo.usedSize.ToSize(this.Orientation); + return generalFlowInfo.usedSize.ToSize(Orientation); layoutNode.RequestMoreChildren(1); return Size.Zero; } @@ -140,9 +140,9 @@ namespace Microsoft.Iris.Layouts { GridLayout.GeneralFlowInfo measureData = (GridLayout.GeneralFlowInfo)layoutNode.MeasureData; measureData.slot = slot; - MajorMinor majorMinor1 = new MajorMinor(slot.View.Size, this.Orientation); - MajorMinor majorMinor2 = new MajorMinor(slot.PeripheralView.Size, this.Orientation); - MajorMinor majorMinor3 = new MajorMinor(slot.View.Location.ToSize(), this.Orientation); + MajorMinor majorMinor1 = new MajorMinor(slot.View.Size, Orientation); + MajorMinor majorMinor2 = new MajorMinor(slot.PeripheralView.Size, Orientation); + MajorMinor majorMinor3 = new MajorMinor(slot.View.Location.ToSize(), Orientation); bool flag1 = measureData.availableSpace.Major != majorMinor2.Major || majorMinor3.Major != 0; bool flag2 = measureData.availableSpace.Minor != majorMinor2.Minor || majorMinor3.Minor != 0; MajorMinor majorMinor4 = majorMinor2 + measureData.spacing; @@ -155,7 +155,7 @@ namespace Microsoft.Iris.Layouts a.Minor = Math.Min(a.Minor, measureData.fitItems.Minor); bool flag3 = !measureData.wrapping ? measureData.totalItems.Major <= a.Major : measureData.totalItems.Minor <= a.Minor; bool flag4; - switch (this._repeat) + switch (_repeat) { case RepeatPolicy.WhenTooBig: flag4 = !flag3; @@ -173,7 +173,7 @@ namespace Microsoft.Iris.Layouts if (!flag4) a = MajorMinor.Min(a, measureData.totalItems); else - measureData.wrapping |= this.AllowWrap; + measureData.wrapping |= AllowWrap; measureData.repeating = flag4; measureData.allowPartialItemsMajor = roundUp1; measureData.allowPartialItemsMinor = roundUp2; @@ -182,7 +182,7 @@ namespace Microsoft.Iris.Layouts { GridLayout.IndexRangeInfo indicesInfo; Vector indicesToDisplayList; - this.ArrangeChildren(layoutNode, measureData, out indicesInfo, out indicesToDisplayList); + ArrangeChildren(layoutNode, measureData, out indicesInfo, out indicesToDisplayList); if (indicesToDisplayList != null) layoutNode.RequestSpecificChildren(indicesToDisplayList); layoutNode.SetVisibleIndexRange(indicesInfo.realBeginIndex, indicesInfo.realEndIndex, indicesInfo.beginIndex, indicesInfo.endIndex, measureData.focusedItemIndex); @@ -195,7 +195,7 @@ namespace Microsoft.Iris.Layouts zero.Minor = -usedSize.Minor / 2; else zero.Major = -usedSize.Major / 2; - Rectangle rectangle = new Rectangle(zero.ToPoint(this.Orientation), usedSize.ToSize(this.Orientation)); + Rectangle rectangle = new Rectangle(zero.ToPoint(Orientation), usedSize.ToSize(Orientation)); layoutNode.AddAreaOfInterest(new AreaOfInterest(rectangle, AreaOfInterestID.ScrollableRange)); } @@ -211,18 +211,18 @@ namespace Microsoft.Iris.Layouts private Size GetReferenceSize(ILayoutNode layoutNode, Size constraint) { - Size referenceSize = this.ReferenceSize; - if (referenceSize.Width == 0.0 && this.Columns != 0) + Size referenceSize = ReferenceSize; + if (referenceSize.Width == 0.0 && Columns != 0) { - int num = (constraint.Width - this.Spacing.Width * (this.Columns - 1)) / this.Columns; + int num = (constraint.Width - Spacing.Width * (Columns - 1)) / Columns; if (num <= 0) return Size.Zero; referenceSize.Width = num; constraint.Width = num; } - if (referenceSize.Height == 0.0 && this.Rows != 0) + if (referenceSize.Height == 0.0 && Rows != 0) { - int num = (constraint.Height - this.Spacing.Height * (this.Rows - 1)) / this.Rows; + int num = (constraint.Height - Spacing.Height * (Rows - 1)) / Rows; if (num <= 0) return Size.Zero; referenceSize.Height = num; @@ -248,8 +248,8 @@ namespace Microsoft.Iris.Layouts ILayoutNode layoutNode, Size constraint) { - int itemCount = this.GetItemCount(layoutNode); - Size size1 = this.GetReferenceSize(layoutNode, constraint); + int itemCount = GetItemCount(layoutNode); + Size size1 = GetReferenceSize(layoutNode, constraint); GridLayout.GeneralFlowInfo generalFlowInfo = new GridLayout.GeneralFlowInfo(itemCount, size1, constraint); if (itemCount == 0 || size1.IsEmpty) return generalFlowInfo; @@ -260,32 +260,32 @@ namespace Microsoft.Iris.Layouts generalFlowInfo.referenceExtent = Size.Zero; return generalFlowInfo; } - bool flag = this.AllowWrap; - if (this.Orientation == Orientation.Vertical && this.Columns > 1) + bool flag = AllowWrap; + if (Orientation == Orientation.Vertical && Columns > 1) flag = true; - else if (this.Orientation == Orientation.Horizontal && this.Rows > 1) + else if (Orientation == Orientation.Horizontal && Rows > 1) flag = true; - MajorMinor majorMinor1 = new MajorMinor(size1, this.Orientation); + MajorMinor majorMinor1 = new MajorMinor(size1, Orientation); MajorMinor a = new MajorMinor(0, majorMinor1.Minor); - if (!flag && new MajorMinor(this.ReferenceSize, this.Orientation).Minor == 0) + if (!flag && new MajorMinor(ReferenceSize, Orientation).Minor == 0) { - majorMinor1.Minor = new MajorMinor(constraint, this.Orientation).Minor; - size1 = majorMinor1.ToSize(this.Orientation); + majorMinor1.Minor = new MajorMinor(constraint, Orientation).Minor; + size1 = majorMinor1.ToSize(Orientation); } foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren) { Size size2 = layoutChild.Measure(size1); - a = MajorMinor.Max(a, new MajorMinor(size2, this.Orientation)); + a = MajorMinor.Max(a, new MajorMinor(size2, Orientation)); } if (!flag) { majorMinor1.Minor = a.Minor; - size1 = majorMinor1.ToSize(this.Orientation); + size1 = majorMinor1.ToSize(Orientation); } - MajorMinor majorMinor2 = new MajorMinor(size1, this.Orientation); - MajorMinor majorMinor3 = new MajorMinor(this.Spacing, this.Orientation); + MajorMinor majorMinor2 = new MajorMinor(size1, Orientation); + MajorMinor majorMinor3 = new MajorMinor(Spacing, Orientation); MajorMinor majorMinor4 = majorMinor2 + majorMinor3; - MajorMinor majorMinor5 = new MajorMinor(constraint, this.Orientation); + MajorMinor majorMinor5 = new MajorMinor(constraint, Orientation); MajorMinor majorMinor6 = majorMinor5 + majorMinor3; MajorMinor zero1 = MajorMinor.Zero; zero1.Major = DivideIntegers(majorMinor6.Major, majorMinor4.Major, false); @@ -301,12 +301,12 @@ namespace Microsoft.Iris.Layouts zero2.Minor = Math.Min(zero2.Minor, zero1.Minor); } MajorMinor majorMinor7 = majorMinor4 * zero2 - majorMinor3; - MajorMinor majorMinor8 = new MajorMinor(this.RepeatGap, 0); + MajorMinor majorMinor8 = new MajorMinor(RepeatGap, 0); if (flag) majorMinor8 = majorMinor8.Swap(); MajorMinor majorMinor9 = majorMinor7 + majorMinor8; MajorMinor majorMinor10 = majorMinor7; - if (this.Repeat == RepeatPolicy.WhenTooSmall || this.Repeat == RepeatPolicy.Always) + if (Repeat == RepeatPolicy.WhenTooSmall || Repeat == RepeatPolicy.Always) { if (flag) majorMinor10.Minor = majorMinor5.Minor; @@ -331,7 +331,7 @@ namespace Microsoft.Iris.Layouts out GridLayout.IndexRangeInfo indicesInfo, out Vector indicesToDisplayList) { - indicesInfo = this.GetIndexRange(layoutNode, generalInfo); + indicesInfo = GetIndexRange(layoutNode, generalInfo); indicesToDisplayList = null; if (indicesInfo.nonEmptyRange) { @@ -344,7 +344,7 @@ namespace Microsoft.Iris.Layouts Size referenceExtent = generalInfo.referenceExtent; if (!generalInfo.wrapping) { - if (this.Orientation == Orientation.Horizontal) + if (Orientation == Orientation.Horizontal) referenceExtent.Height = generalInfo.slot.Bounds.Height; else referenceExtent.Width = generalInfo.slot.Bounds.Width; @@ -359,7 +359,7 @@ namespace Microsoft.Iris.Layouts idx = layoutInput.Index.Value; int type = (int)layoutInput.Type; } - Point offset = this.PositionFromIndex(layoutNode, idx, generalInfo, out MajorMinor _); + Point offset = PositionFromIndex(layoutNode, idx, generalInfo, out MajorMinor _); if (indicesToDisplayList != null) indicesToDisplayList.Remove(idx); Rectangle rectangle2 = new Rectangle(offset, referenceExtent); @@ -381,22 +381,22 @@ namespace Microsoft.Iris.Layouts { if (generalInfo.totalItems.IsEmpty) return new GridLayout.IndexRangeInfo(); - MajorMinor position1 = new MajorMinor(generalInfo.slot.PeripheralView.Location.ToSize(), this.Orientation); - MajorMinor position2 = new MajorMinor(generalInfo.slot.View.Location.ToSize(), this.Orientation); - MajorMinor majorMinor1 = new MajorMinor(generalInfo.slot.PeripheralView.Size, this.Orientation); - MajorMinor majorMinor2 = new MajorMinor(generalInfo.slot.View.Size, this.Orientation); + MajorMinor position1 = new MajorMinor(generalInfo.slot.PeripheralView.Location.ToSize(), Orientation); + MajorMinor position2 = new MajorMinor(generalInfo.slot.View.Location.ToSize(), Orientation); + MajorMinor majorMinor1 = new MajorMinor(generalInfo.slot.PeripheralView.Size, Orientation); + MajorMinor majorMinor2 = new MajorMinor(generalInfo.slot.View.Size, Orientation); MajorMinor position3 = position1 + majorMinor1; MajorMinor position4 = position2 + majorMinor2; bool flag1 = true; bool flag2 = true; int index1; - bool flag3 = flag1 & this.GetViewIntersectionFromPosition(layoutNode, position1, generalInfo, ViewIntersectionType.BeginOffscreen, out index1); + bool flag3 = flag1 & GetViewIntersectionFromPosition(layoutNode, position1, generalInfo, ViewIntersectionType.BeginOffscreen, out index1); int index2; - bool flag4 = flag2 & this.GetViewIntersectionFromPosition(layoutNode, position2, generalInfo, ViewIntersectionType.BeginOnscreen, out index2); + bool flag4 = flag2 & GetViewIntersectionFromPosition(layoutNode, position2, generalInfo, ViewIntersectionType.BeginOnscreen, out index2); int index3; - bool flag5 = flag3 & this.GetViewIntersectionFromPosition(layoutNode, position3, generalInfo, ViewIntersectionType.EndOnscreen, out index3); + bool flag5 = flag3 & GetViewIntersectionFromPosition(layoutNode, position3, generalInfo, ViewIntersectionType.EndOnscreen, out index3); int index4; - bool flag6 = flag4 & this.GetViewIntersectionFromPosition(layoutNode, position4, generalInfo, ViewIntersectionType.EndOffscreen, out index4); + bool flag6 = flag4 & GetViewIntersectionFromPosition(layoutNode, position4, generalInfo, ViewIntersectionType.EndOffscreen, out index4); return !flag5 ? new GridLayout.IndexRangeInfo() : new GridLayout.IndexRangeInfo(index1, index3, index2, index4, generalInfo); } @@ -409,14 +409,14 @@ namespace Microsoft.Iris.Layouts int dataIndex; int generationValue; ListUtility.GetWrappedIndex(idx, generalInfo.itemsCount, out dataIndex, out generationValue); - index = this.PositionFromIndex(dataIndex, generalInfo.totalItems); + index = PositionFromIndex(dataIndex, generalInfo.totalItems); MajorMinor majorMinor1 = index * generalInfo.referenceWithSpacing; MajorMinor majorMinor2 = generalInfo.repeatInstanceSize * new MajorMinor(generationValue, generationValue); if (generalInfo.wrapping) majorMinor2.Major = 0; else majorMinor2.Minor = 0; - return (majorMinor1 + majorMinor2).ToPoint(this.Orientation); + return (majorMinor1 + majorMinor2).ToPoint(Orientation); } private MajorMinor PositionFromIndex(int idx, MajorMinor totalItems) @@ -484,7 +484,7 @@ namespace Microsoft.Iris.Layouts if (generalInfo.wrapping) { if (!flag3) - zero.Minor = this.ApplyEdgeBias(biasUp, result2, generalInfo.reference.Minor, generalInfo.allowPartialItemsMinor, zero.Minor); + zero.Minor = ApplyEdgeBias(biasUp, result2, generalInfo.reference.Minor, generalInfo.allowPartialItemsMinor, zero.Minor); int max = generalInfo.totalItems.Major - 1; bool flag4 = zero.Minor == generalInfo.totalItems.Minor - 1; bool flag5 = generalInfo.totalItems.Minor * generalInfo.totalItems.Major > generalInfo.itemsCount; @@ -500,9 +500,9 @@ namespace Microsoft.Iris.Layouts { zero.Minor = 0; if (!flag2) - zero.Major = this.ApplyEdgeBias(biasUp, result1, generalInfo.reference.Major, generalInfo.allowPartialItemsMajor, zero.Major); + zero.Major = ApplyEdgeBias(biasUp, result1, generalInfo.reference.Major, generalInfo.allowPartialItemsMajor, zero.Major); } - index = this.IndexFromGridPosition(zero, generation, generalInfo, out int _); + index = IndexFromGridPosition(zero, generation, generalInfo, out int _); } return !flag1; } @@ -572,19 +572,19 @@ namespace Microsoft.Iris.Layouts this.itemsCount = itemsCount; this.referenceExtent = referenceExtent; this.constraint = constraint; - this.repeating = false; - this.reference = MajorMinor.Zero; - this.spacing = MajorMinor.Zero; - this.referenceWithSpacing = MajorMinor.Zero; - this.availableSpace = MajorMinor.Zero; - this.viewSize = MajorMinor.Zero; - this.totalItems = MajorMinor.Zero; - this.repeatInstanceSize = MajorMinor.Zero; - this.usedSize = MajorMinor.Zero; - this.wrapping = false; - this.allowPartialItemsMajor = false; - this.allowPartialItemsMinor = false; - this.focusedItemIndex = new int?(); + repeating = false; + reference = MajorMinor.Zero; + spacing = MajorMinor.Zero; + referenceWithSpacing = MajorMinor.Zero; + availableSpace = MajorMinor.Zero; + viewSize = MajorMinor.Zero; + totalItems = MajorMinor.Zero; + repeatInstanceSize = MajorMinor.Zero; + usedSize = MajorMinor.Zero; + wrapping = false; + allowPartialItemsMajor = false; + allowPartialItemsMinor = false; + focusedItemIndex = new int?(); } } @@ -608,11 +608,11 @@ namespace Microsoft.Iris.Layouts NormalizeRange(beginIndex, endIndex, generalInfo.itemsCount, out beginIndex, out endIndex); NormalizeRange(realBeginIndex, realEndIndex, generalInfo.itemsCount, out realBeginIndex, out realEndIndex); } - this._beginIndex = beginIndex; - this._endIndex = endIndex; - this._realBeginIndex = realBeginIndex; - this._realEndIndex = realEndIndex; - this._isValid = true; + _beginIndex = beginIndex; + _endIndex = endIndex; + _realBeginIndex = realBeginIndex; + _realEndIndex = realEndIndex; + _isValid = true; } private static void NormalizeRange( @@ -636,15 +636,15 @@ namespace Microsoft.Iris.Layouts normalizedEnd = Math2.Clamp(normalizedEnd, 0, itemsCount); } - public int beginIndex => this._beginIndex; + public int beginIndex => _beginIndex; - public int endIndex => this._endIndex; + public int endIndex => _endIndex; - public int realBeginIndex => this._realBeginIndex; + public int realBeginIndex => _realBeginIndex; - public int realEndIndex => this._realEndIndex; + public int realEndIndex => _realEndIndex; - public bool nonEmptyRange => this._isValid; + public bool nonEmptyRange => _isValid; } } } diff --git a/UIX/Microsoft/Iris/Layouts/KeepAliveLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/KeepAliveLayoutInput.cs index 23abe89..70f71cd 100644 --- a/UIX/Microsoft/Iris/Layouts/KeepAliveLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/KeepAliveLayoutInput.cs @@ -18,14 +18,14 @@ namespace Microsoft.Iris.Layouts public int Count { - get => this._count; - set => this._count = value; + get => _count; + set => _count = value; } DataCookie ILayoutInput.Data => Data; public static DataCookie Data => s_dataProperty; - public override string ToString() => InvariantString.Format("{0}", this.GetType().Name); + public override string ToString() => InvariantString.Format("{0}", GetType().Name); } } diff --git a/UIX/Microsoft/Iris/Layouts/MajorMinor.cs b/UIX/Microsoft/Iris/Layouts/MajorMinor.cs index c51fc21..0b0acd7 100644 --- a/UIX/Microsoft/Iris/Layouts/MajorMinor.cs +++ b/UIX/Microsoft/Iris/Layouts/MajorMinor.cs @@ -28,12 +28,12 @@ namespace Microsoft.Iris.Layouts switch (o) { case Orientation.Horizontal: - this.major = size.Width; - this.minor = size.Height; + major = size.Width; + minor = size.Height; break; default: - this.major = size.Height; - this.minor = size.Width; + major = size.Height; + minor = size.Width; break; } } @@ -54,13 +54,13 @@ namespace Microsoft.Iris.Layouts switch (o) { case Orientation.Horizontal: - return new Size(this.major, this.minor); + return new Size(major, minor); default: - return new Size(this.minor, this.major); + return new Size(minor, major); } } - public Point ToPoint(Orientation o) => this.ToSize(o).ToPoint(); + public Point ToPoint(Orientation o) => ToSize(o).ToPoint(); public static MajorMinor Min(MajorMinor a, MajorMinor b) => new MajorMinor(Math.Min(a.Major, b.Major), Math.Min(a.Minor, b.Minor)); @@ -82,23 +82,23 @@ namespace Microsoft.Iris.Layouts public override bool Equals(object obj) => obj is MajorMinor majorMinor && majorMinor == this; - public override int GetHashCode() => this.major ^ this.minor; + public override int GetHashCode() => major ^ minor; - public MajorMinor Swap() => new MajorMinor(this.Minor, this.Major); + public MajorMinor Swap() => new MajorMinor(Minor, Major); public int Major { - get => this.major; - set => this.major = value; + get => major; + set => major = value; } public int Minor { - get => this.minor; - set => this.minor = value; + get => minor; + set => minor = value; } - public bool IsEmpty => this.Major == 0 || this.Minor == 0; + public bool IsEmpty => Major == 0 || Minor == 0; public override string ToString() => InvariantString.Format("(Major={0}, Minor={1})", Major, Minor); } diff --git a/UIX/Microsoft/Iris/Layouts/PlacementMode.cs b/UIX/Microsoft/Iris/Layouts/PlacementMode.cs index 68cdddb..f080c1c 100644 --- a/UIX/Microsoft/Iris/Layouts/PlacementMode.cs +++ b/UIX/Microsoft/Iris/Layouts/PlacementMode.cs @@ -24,18 +24,18 @@ namespace Microsoft.Iris.Layouts public PopupPosition[] PopupPositions { - get => this._popupPositions; + get => _popupPositions; set { - this._popupPositions = value; - this._usesTargetSize = false; - if (this._popupPositions == null) + _popupPositions = value; + _usesTargetSize = false; + if (_popupPositions == null) return; - for (int index = 0; index < this._popupPositions.Length; ++index) + for (int index = 0; index < _popupPositions.Length; ++index) { - if (this._popupPositions[index].Target != InterestPoint.TopLeft) + if (_popupPositions[index].Target != InterestPoint.TopLeft) { - this._usesTargetSize = true; + _usesTargetSize = true; break; } } @@ -44,11 +44,11 @@ namespace Microsoft.Iris.Layouts public MouseTarget MouseTarget { - get => this._mouseTarget; - set => this._mouseTarget = value; + get => _mouseTarget; + set => _mouseTarget = value; } - internal bool UsesTargetSize => this._usesTargetSize; + internal bool UsesTargetSize => _usesTargetSize; public override string ToString() { diff --git a/UIX/Microsoft/Iris/Layouts/PopupLayout.cs b/UIX/Microsoft/Iris/Layouts/PopupLayout.cs index b5bcfad..f74349b 100644 --- a/UIX/Microsoft/Iris/Layouts/PopupLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/PopupLayout.cs @@ -55,7 +55,7 @@ namespace Microsoft.Iris.Layouts ViewItem child = (ViewItem)layoutChild; Point zero = Point.Zero; Size size = Size.Zero; - RectangleF placementTargetRect = this.GetPlacementTargetRect(child, viewItem, layoutInput, slot); + RectangleF placementTargetRect = GetPlacementTargetRect(child, viewItem, layoutInput, slot); if (layoutInput.ConstrainToTarget) { size = new Size((int)placementTargetRect.Width, (int)placementTargetRect.Height); @@ -63,11 +63,11 @@ namespace Microsoft.Iris.Layouts } else size = layoutChild.DesiredSize; - Point childPosition = this.GetChildPosition(viewItem, layoutBounds, layoutInput, layoutChild, child, slot, placementTargetRect); + Point childPosition = GetChildPosition(viewItem, layoutBounds, layoutInput, layoutChild, child, slot, placementTargetRect); layoutChild.Arrange(slot, new Rectangle(childPosition, size)); } } - this.HookMousePositionChanged(viewItem, hook); + HookMousePositionChanged(viewItem, hook); } private Point GetChildPosition( @@ -83,9 +83,9 @@ namespace Microsoft.Iris.Layouts if (placement == null || ListUtility.IsNullOrEmpty(placement.PopupPositions)) return Point.Zero; PointF[] interestPoints = InterestPointsFromRect(placementRect); - PointF[] childInterestPoints = this.GetChildInterestPoints(childNode); - this.GetBounds(interestPoints); - RectangleF bounds = this.GetBounds(childInterestPoints); + PointF[] childInterestPoints = GetChildInterestPoints(childNode); + GetBounds(interestPoints); + RectangleF bounds = GetBounds(childInterestPoints); double width = bounds.Width; double height = bounds.Height; bool flag1 = layoutInput.RespectMenuDropAlignment && Win32Api.GetMenuDropAlignment(); @@ -121,7 +121,7 @@ namespace Microsoft.Iris.Layouts layoutInput.FlippedHorizontally = (flipDirection & FlipDirection.Horizontal) == FlipDirection.Horizontal; layoutInput.FlippedVertically = (flipDirection & FlipDirection.Vertical) == FlipDirection.Vertical; if (layoutInput.StayInBounds) - bestPosition = this.NudgeIntoBounds(layoutBounds, bestPosition, bounds, placement); + bestPosition = NudgeIntoBounds(layoutBounds, bestPosition, bounds, placement); return new Point((int)bestPosition.X, (int)bestPosition.Y); } @@ -138,7 +138,7 @@ namespace Microsoft.Iris.Layouts if (layoutInput.TargetIsMouse || layoutInput.TargetIsFollowMouse) { if (layoutInput.MouseRect == RectangleF.Zero || layoutInput.TargetIsFollowMouse) - layoutInput.MouseRect = this.GetMouseRect(placement); + layoutInput.MouseRect = GetMouseRect(placement); rectangleF = layoutInput.MouseRect; flag = true; } @@ -231,40 +231,40 @@ namespace Microsoft.Iris.Layouts private void HookMousePositionChanged(ViewItem subject, bool hook) { - if ((this._followMouseSubjects != null && this._followMouseSubjects.Contains(subject)) == hook) + if ((_followMouseSubjects != null && _followMouseSubjects.Contains(subject)) == hook) return; if (hook) { - if (this._followMouseSubjects == null) + if (_followMouseSubjects == null) { - this._followMouseSubjects = new Vector(); - UISession.Default.InputManager.MousePositionChanged += new EventHandler(this.OnMousePositionChanged); + _followMouseSubjects = new Vector(); + UISession.Default.InputManager.MousePositionChanged += new EventHandler(OnMousePositionChanged); } - this._followMouseSubjects.Add(subject); + _followMouseSubjects.Add(subject); } else { - this._followMouseSubjects.Remove(subject); - if (this._followMouseSubjects.Count != 0) + _followMouseSubjects.Remove(subject); + if (_followMouseSubjects.Count != 0) return; - this._followMouseSubjects = null; - UISession.Default.InputManager.MousePositionChanged -= new EventHandler(this.OnMousePositionChanged); + _followMouseSubjects = null; + UISession.Default.InputManager.MousePositionChanged -= new EventHandler(OnMousePositionChanged); } } private void OnMousePositionChanged(object sender, EventArgs args) { - for (int index = 0; index < this._followMouseSubjects.Count; ++index) + for (int index = 0; index < _followMouseSubjects.Count; ++index) { - ViewItem followMouseSubject = this._followMouseSubjects[index]; + ViewItem followMouseSubject = _followMouseSubjects[index]; if (followMouseSubject.Layout == this && !followMouseSubject.IsDisposed) { followMouseSubject.MarkLayoutInvalid(); } else { - this.HookMousePositionChanged(followMouseSubject, false); - if (this._followMouseSubjects == null) + HookMousePositionChanged(followMouseSubject, false); + if (_followMouseSubjects == null) break; --index; } diff --git a/UIX/Microsoft/Iris/Layouts/PopupLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/PopupLayoutInput.cs index 20c7eec..d1a7092 100644 --- a/UIX/Microsoft/Iris/Layouts/PopupLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/PopupLayoutInput.cs @@ -28,45 +28,45 @@ namespace Microsoft.Iris.Layouts public PopupLayoutInput() { - this._stayInBounds = true; - this._respectMenuDropAlignment = true; - this.Placement = PlacementMode.Origin; + _stayInBounds = true; + _respectMenuDropAlignment = true; + Placement = PlacementMode.Origin; } public ViewItem PlacementTarget { - get => this._target; - set => this._target = value; + get => _target; + set => _target = value; } public PlacementMode Placement { - get => this._placementMode; - set => this._placementMode = value; + get => _placementMode; + set => _placementMode = value; } public Point Offset { - get => this._offset; - set => this._offset = value; + get => _offset; + set => _offset = value; } public bool StayInBounds { - get => this._stayInBounds; - set => this._stayInBounds = value; + get => _stayInBounds; + set => _stayInBounds = value; } public bool RespectMenuDropAlignment { - get => this._respectMenuDropAlignment; - set => this._respectMenuDropAlignment = value; + get => _respectMenuDropAlignment; + set => _respectMenuDropAlignment = value; } public bool ConstrainToTarget { - get => this._constrainToTarget; - set => this._constrainToTarget = value; + get => _constrainToTarget; + set => _constrainToTarget = value; } DataCookie ILayoutInput.Data => Data; @@ -75,37 +75,37 @@ namespace Microsoft.Iris.Layouts internal RectangleF MouseRect { - get => this._mouseRect; - set => this._mouseRect = value; + get => _mouseRect; + set => _mouseRect = value; } public bool FlippedHorizontally { - get => this._flippedHorizontally; + get => _flippedHorizontally; set { - if (this._flippedHorizontally == value) + if (_flippedHorizontally == value) return; - this._flippedHorizontally = value; - this.FireNotification(NotificationID.FlippedHorizontally); + _flippedHorizontally = value; + FireNotification(NotificationID.FlippedHorizontally); } } public bool FlippedVertically { - get => this._flippedVertically; + get => _flippedVertically; set { - if (this._flippedVertically == value) + if (_flippedVertically == value) return; - this._flippedVertically = value; - this.FireNotification(NotificationID.FlippedVertically); + _flippedVertically = value; + FireNotification(NotificationID.FlippedVertically); } } - internal bool TargetIsMouse => this._placementMode != null && this._placementMode.MouseTarget == MouseTarget.Fixed; + internal bool TargetIsMouse => _placementMode != null && _placementMode.MouseTarget == MouseTarget.Fixed; - internal bool TargetIsFollowMouse => this._placementMode != null && this._placementMode.MouseTarget == MouseTarget.Follow; + internal bool TargetIsFollowMouse => _placementMode != null && _placementMode.MouseTarget == MouseTarget.Follow; internal static PopupLayoutInput Default { diff --git a/UIX/Microsoft/Iris/Layouts/PopupPosition.cs b/UIX/Microsoft/Iris/Layouts/PopupPosition.cs index 2ebfc6d..1f47a5a 100644 --- a/UIX/Microsoft/Iris/Layouts/PopupPosition.cs +++ b/UIX/Microsoft/Iris/Layouts/PopupPosition.cs @@ -14,27 +14,27 @@ namespace Microsoft.Iris.Layouts public PopupPosition(InterestPoint target, InterestPoint popup, FlipDirection flipDirection) { - this._target = target; - this._popup = popup; - this._flipDirection = flipDirection; + _target = target; + _popup = popup; + _flipDirection = flipDirection; } public InterestPoint Target { - get => this._target; - set => this._target = value; + get => _target; + set => _target = value; } public InterestPoint Popup { - get => this._popup; - set => this._popup = value; + get => _popup; + set => _popup = value; } public FlipDirection Flipped { - get => this._flipDirection; - set => this._flipDirection = value; + get => _flipDirection; + set => _flipDirection = value; } } } diff --git a/UIX/Microsoft/Iris/Layouts/RotateLayout.cs b/UIX/Microsoft/Iris/Layouts/RotateLayout.cs index 415c282..38702ff 100644 --- a/UIX/Microsoft/Iris/Layouts/RotateLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/RotateLayout.cs @@ -16,20 +16,20 @@ namespace Microsoft.Iris.Layouts public int AngleDegrees { - get => this._angleDegrees; - set => this._angleDegrees = value; + get => _angleDegrees; + set => _angleDegrees = value; } public ItemAlignment DefaultChildAlignment => ItemAlignment.Default; - private bool IsVertical => this.AngleDegrees == 90 || this.AngleDegrees == 270; + private bool IsVertical => AngleDegrees == 90 || AngleDegrees == 270; Size ILayout.Measure(ILayoutNode layoutNode, Size constraint) { - if (this.IsVertical) + if (IsVertical) constraint = new Size(constraint.Height, constraint.Width); Size size = DefaultLayout.Measure(layoutNode, constraint); - if (this.IsVertical) + if (IsVertical) size = new Size(size.Height, size.Width); return size; } @@ -39,7 +39,7 @@ namespace Microsoft.Iris.Layouts if (layoutNode.LayoutChildrenCount <= 0) return; Rectangle rectangle = new Rectangle(slot.Bounds); - switch (this.AngleDegrees) + switch (AngleDegrees) { case 90: Point offset1 = new Point(rectangle.Width, rectangle.Width); @@ -61,7 +61,7 @@ namespace Microsoft.Iris.Layouts break; } Rotation rotation = Rotation.Default; - rotation.AngleDegrees = this.AngleDegrees; + rotation.AngleDegrees = AngleDegrees; foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren) layoutChild.Arrange(slot, rectangle, Vector3.UnitVector, rotation); } diff --git a/UIX/Microsoft/Iris/Layouts/ScaleLayout.cs b/UIX/Microsoft/Iris/Layouts/ScaleLayout.cs index 1f658c7..b070cdb 100644 --- a/UIX/Microsoft/Iris/Layouts/ScaleLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/ScaleLayout.cs @@ -20,27 +20,27 @@ namespace Microsoft.Iris.Layouts public ScaleLayout() { - this._minimumScale = new Vector2(0.0f, 0.0f); - this._maximumScale = new Vector2(1f, 1f); - this._maintainAspectRatio = true; + _minimumScale = new Vector2(0.0f, 0.0f); + _maximumScale = new Vector2(1f, 1f); + _maintainAspectRatio = true; } public Vector2 MinimumScale { - get => this._minimumScale; - set => this._minimumScale = value; + get => _minimumScale; + set => _minimumScale = value; } public Vector2 MaximumScale { - get => this._maximumScale; - set => this._maximumScale = value; + get => _maximumScale; + set => _maximumScale = value; } public bool MaintainAspectRatio { - get => this._maintainAspectRatio; - set => this._maintainAspectRatio = value; + get => _maintainAspectRatio; + set => _maintainAspectRatio = value; } public ItemAlignment DefaultChildAlignment => ItemAlignment.Default; @@ -48,22 +48,22 @@ namespace Microsoft.Iris.Layouts Size ILayout.Measure(ILayoutNode layoutNode, Size constraint) { Size zero = Size.Zero; - Size constraint1 = new Size(this.UnscaleConstraint(constraint.Width, this.MinimumScale.X), this.UnscaleConstraint(constraint.Height, this.MinimumScale.Y)); + Size constraint1 = new Size(UnscaleConstraint(constraint.Width, MinimumScale.X), UnscaleConstraint(constraint.Height, MinimumScale.Y)); Size size = DefaultLayout.Measure(layoutNode, constraint1); SizeF sizeF = new SizeF(1f, 1f); if (!size.IsZero) sizeF = new SizeF(constraint.Width / (float)size.Width, constraint.Height / (float)size.Height); - if (this._maintainAspectRatio) + if (_maintainAspectRatio) { float num = Math.Min(sizeF.Width, sizeF.Height); sizeF = new SizeF(num, num); } - sizeF.Width = Math.Max(sizeF.Width, this.MinimumScale.X); - sizeF.Height = Math.Max(sizeF.Height, this.MinimumScale.Y); + sizeF.Width = Math.Max(sizeF.Width, MinimumScale.X); + sizeF.Height = Math.Max(sizeF.Height, MinimumScale.Y); if (MaximumScale.X != 0.0) - sizeF.Width = Math.Min(sizeF.Width, this.MaximumScale.X); + sizeF.Width = Math.Min(sizeF.Width, MaximumScale.X); if (MaximumScale.Y != 0.0) - sizeF.Height = Math.Min(sizeF.Height, this.MaximumScale.Y); + sizeF.Height = Math.Min(sizeF.Height, MaximumScale.Y); layoutNode.MeasureData = sizeF; size.Width = (int)Math.Round(size.Width * (double)sizeF.Width); size.Height = (int)Math.Round(size.Height * (double)sizeF.Height); diff --git a/UIX/Microsoft/Iris/Layouts/ScrollIntoViewDisposition.cs b/UIX/Microsoft/Iris/Layouts/ScrollIntoViewDisposition.cs index a05271e..0aa22e4 100644 --- a/UIX/Microsoft/Iris/Layouts/ScrollIntoViewDisposition.cs +++ b/UIX/Microsoft/Iris/Layouts/ScrollIntoViewDisposition.cs @@ -27,113 +27,113 @@ namespace Microsoft.Iris.Layouts public ScrollIntoViewDisposition(int paddingValue) { - this.Reset(); - this._beginPadding = this._endPadding = paddingValue; + Reset(); + _beginPadding = _endPadding = paddingValue; } public void CopyFrom(ScrollIntoViewDisposition other) { - this._beginPadding = other._beginPadding; - this._endPadding = other._endPadding; - this._lockedPosition = other._lockedPosition; - this._lockedAlignment = other._lockedAlignment; - this._locked = other._locked; - this._enabled = other._enabled; - this._positioningPolicy = other._positioningPolicy; - this._relativeBeginPadding = other._relativeBeginPadding; - this._relativeEndPadding = other._relativeEndPadding; + _beginPadding = other._beginPadding; + _endPadding = other._endPadding; + _lockedPosition = other._lockedPosition; + _lockedAlignment = other._lockedAlignment; + _locked = other._locked; + _enabled = other._enabled; + _positioningPolicy = other._positioningPolicy; + _relativeBeginPadding = other._relativeBeginPadding; + _relativeEndPadding = other._relativeEndPadding; } public void Reset() { - this._beginPadding = this._endPadding = 0; - this._lockedPosition = -1f; - this._lockedAlignment = 0.5f; - this._enabled = true; - this._locked = false; - this._positioningPolicy = ContentPositioningPolicy.RespectPaddingAndLocking; - this._relativeBeginPadding = RelativeEdge.Near; - this._relativeEndPadding = RelativeEdge.Far; + _beginPadding = _endPadding = 0; + _lockedPosition = -1f; + _lockedAlignment = 0.5f; + _enabled = true; + _locked = false; + _positioningPolicy = ContentPositioningPolicy.RespectPaddingAndLocking; + _relativeBeginPadding = RelativeEdge.Near; + _relativeEndPadding = RelativeEdge.Far; } - public bool IsDefault => this._beginPadding == 0 && this._endPadding == 0 && (this.BeginPaddingRelativeTo == RelativeEdge.Near && this.EndPaddingRelativeTo == RelativeEdge.Far) && !this.Locked; + public bool IsDefault => _beginPadding == 0 && _endPadding == 0 && (BeginPaddingRelativeTo == RelativeEdge.Near && EndPaddingRelativeTo == RelativeEdge.Far) && !Locked; public int Padding { - get => this.BeginPadding; + get => BeginPadding; set { - this.EndPadding = value; - this.BeginPadding = value; + EndPadding = value; + BeginPadding = value; } } public int BeginPadding { - get => this._beginPadding; - set => this._beginPadding = value; + get => _beginPadding; + set => _beginPadding = value; } public int EndPadding { - get => this._endPadding; - set => this._endPadding = value; + get => _endPadding; + set => _endPadding = value; } public RelativeEdge BeginPaddingRelativeTo { - get => this._relativeBeginPadding; - set => this._relativeBeginPadding = value; + get => _relativeBeginPadding; + set => _relativeBeginPadding = value; } public RelativeEdge EndPaddingRelativeTo { - get => this._relativeEndPadding; - set => this._relativeEndPadding = value; + get => _relativeEndPadding; + set => _relativeEndPadding = value; } public bool Locked { - get => this._locked; - set => this._locked = value; + get => _locked; + set => _locked = value; } public float LockedPosition { - get => this._lockedPosition; - set => this._lockedPosition = value; + get => _lockedPosition; + set => _lockedPosition = value; } public float LockedAlignment { - get => this._lockedAlignment; - set => this._lockedAlignment = value; + get => _lockedAlignment; + set => _lockedAlignment = value; } public bool Enabled { - get => this._enabled; - set => this._enabled = value; + get => _enabled; + set => _enabled = value; } public ContentPositioningPolicy ContentPositioningBehavior { - get => this._positioningPolicy; - set => this._positioningPolicy = value; + get => _positioningPolicy; + set => _positioningPolicy = value; } public override string ToString() { - string str1 = InvariantString.Format("{0}(", this.GetType().Name); + string str1 = InvariantString.Format("{0}(", GetType().Name); string str2; - if (!this._enabled) + if (!_enabled) { str2 = InvariantString.Format("{0}Disabled", str1); } else { str2 = InvariantString.Format("{0}(BeginPadding={1}({2}), EndPadding={3}({4})", str1, _beginPadding, _relativeBeginPadding, _endPadding, _relativeEndPadding); - if (this.Locked) + if (Locked) str2 = InvariantString.Format("{0}, LockedPosition={1}, LockedAlignment={2}", str2, _lockedPosition, _lockedAlignment); } return str2 + ")"; diff --git a/UIX/Microsoft/Iris/Layouts/ScrollingLayout.cs b/UIX/Microsoft/Iris/Layouts/ScrollingLayout.cs index 580c921..12dd386 100644 --- a/UIX/Microsoft/Iris/Layouts/ScrollingLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/ScrollingLayout.cs @@ -20,29 +20,29 @@ namespace Microsoft.Iris.Layouts public ScrollingLayout(Orientation orientation, int prefetch) { - this._orientation = orientation; - this._prefetch = prefetch; + _orientation = orientation; + _prefetch = prefetch; } public Orientation Orientation { - get => this._orientation; + get => _orientation; set { - if (this._orientation == value) + if (_orientation == value) return; - this._orientation = value; + _orientation = value; } } public int Prefetch { - get => this._prefetch; + get => _prefetch; set { - if (this._prefetch == value) + if (_prefetch == value) return; - this._prefetch = value; + _prefetch = value; } } @@ -53,7 +53,7 @@ namespace Microsoft.Iris.Layouts Size size; if (!(layoutNode.GetLayoutInput(ScrollingLayoutInput.Data) is ScrollingLayoutInput layoutInput) || layoutInput.Enabled) { - Size infiniteConstraint = this.GetInfiniteConstraint(constraint); + Size infiniteConstraint = GetInfiniteConstraint(constraint); size = DefaultLayout.Measure(layoutNode, infiniteConstraint); layoutNode.MeasureData = size; } @@ -72,7 +72,7 @@ namespace Microsoft.Iris.Layouts { if (sli.Enabled) { - scrollingLayoutOutput = this.Arrange(layoutNode, slot, sli, ref scrollAmount); + scrollingLayoutOutput = Arrange(layoutNode, slot, sli, ref scrollAmount); } else { @@ -95,13 +95,13 @@ namespace Microsoft.Iris.Layouts { LayoutSlot childSlot; Rectangle viewBounds; - this.GetChildSlot(slot, scrollAmount, out childSlot, out viewBounds); + GetChildSlot(slot, scrollAmount, out childSlot, out viewBounds); int num = scrollAmount; - ScrollingLayoutOutput scrollingLayoutOutput = this.ArrangeChildren(layoutNode, slot, childSlot, viewBounds, sli, true, ref scrollAmount); + ScrollingLayoutOutput scrollingLayoutOutput = ArrangeChildren(layoutNode, slot, childSlot, viewBounds, sli, true, ref scrollAmount); if (num != scrollAmount) { - this.GetChildSlot(slot, scrollAmount, out childSlot, out viewBounds); - scrollingLayoutOutput = this.ArrangeChildren(layoutNode, slot, childSlot, viewBounds, sli, false, ref scrollAmount); + GetChildSlot(slot, scrollAmount, out childSlot, out viewBounds); + scrollingLayoutOutput = ArrangeChildren(layoutNode, slot, childSlot, viewBounds, sli, false, ref scrollAmount); } return scrollingLayoutOutput; } @@ -112,10 +112,10 @@ namespace Microsoft.Iris.Layouts out LayoutSlot childSlot, out Rectangle viewBounds) { - Size infiniteConstraint = this.GetInfiniteConstraint(slot.Bounds); + Size infiniteConstraint = GetInfiniteConstraint(slot.Bounds); Size bounds = slot.Bounds; viewBounds = new Rectangle(Point.Zero, bounds); - Point offset = this.ScrollAmountToOffset(this._prefetch); + Point offset = ScrollAmountToOffset(_prefetch); Rectangle viewPeripheralBounds = viewBounds; viewPeripheralBounds.Inflate(offset.X, offset.Y); childSlot = new LayoutSlot(infiniteConstraint, slot.Offset, viewBounds, viewPeripheralBounds); @@ -135,7 +135,7 @@ namespace Microsoft.Iris.Layouts bool flag1 = false; VisibleIndexRangeLayoutOutput rangeLayoutOutput = null; Rectangle rectangle1 = Rectangle.Zero; - Rectangle bounds = new Rectangle(new MajorMinor(-scrollAmount, 0).ToPoint(this.Orientation), Size.Max(slot.Bounds, (Size)layoutNode.MeasureData)); + Rectangle bounds = new Rectangle(new MajorMinor(-scrollAmount, 0).ToPoint(Orientation), Size.Max(slot.Bounds, (Size)layoutNode.MeasureData)); foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren) { layoutChild.Arrange(childSlot, bounds); @@ -146,7 +146,7 @@ namespace Microsoft.Iris.Layouts flag2 = layoutChild.TryGetAreaOfInterest(AreaOfInterestID.Focus, out area1); if (flag2) areaOfInterestBounds = area1.Rectangle; - if (this.IsFocusAreaOfInterest(area1.Id) && !sli.ScrollIntoViewDisposition.Enabled) + if (IsFocusAreaOfInterest(area1.Id) && !sli.ScrollIntoViewDisposition.Enabled) DisallowScrollFocusIntoView(); scrollAreaOfInterestIntoView &= ScrollFocusIntoView; if (area1.Id == AreaOfInterestID.ScrollIntoViewRequest && !areaOfInterestBounds.IsZero) @@ -160,7 +160,7 @@ namespace Microsoft.Iris.Layouts rectangle2 = Rectangle.Union(rectangle2, area2.Rectangle); rectangle1 = Rectangle.Union(rectangle1, rectangle2); } - ScrollingLayoutOutput scrollAmount1 = this.CalculateScrollAmount(layoutNode, viewBounds, rectangle1, sli, applyPendingScrollData, scrollAreaOfInterestIntoView, areaOfInterestBounds, ref scrollAmount); + ScrollingLayoutOutput scrollAmount1 = CalculateScrollAmount(layoutNode, viewBounds, rectangle1, sli, applyPendingScrollData, scrollAreaOfInterestIntoView, areaOfInterestBounds, ref scrollAmount); scrollAmount1.VisibleIndices = rangeLayoutOutput; scrollAmount1.ProcessedExplicitScrollIntoViewRequest = flag1; scrollAmount1.ScrollFocusIntoView = ScrollFocusIntoView; @@ -179,11 +179,11 @@ namespace Microsoft.Iris.Layouts Rectangle areaOfInterestBounds, ref int scrollAmount) { - int space1 = this.ItemToSpace(viewBounds.Size); - int space2 = this.ItemToSpace(scrollableBounds.Size); + int space1 = ItemToSpace(viewBounds.Size); + int space2 = ItemToSpace(scrollableBounds.Size); int num1 = -(space1 - space2); int num2 = (int)Math.Round(space1 * (double)sli.PageStep); - int num3 = this.ItemToSpace(scrollableBounds.Location.ToSize()); + int num3 = ItemToSpace(scrollableBounds.Location.ToSize()); int num4 = num3 + num1; if (num1 < 0) { @@ -192,9 +192,9 @@ namespace Microsoft.Iris.Layouts } if (!areaOfInterestBounds.IsZero && scrollAreaOfInterestIntoView) { - scrollAmount = this.ScrollIntoView(layoutNode, areaOfInterestBounds, scrollAmount, space1, space2, num3, num4, sli.ScrollIntoViewDisposition); + scrollAmount = ScrollIntoView(layoutNode, areaOfInterestBounds, scrollAmount, space1, space2, num3, num4, sli.ScrollIntoViewDisposition); if (sli.SecondaryScrollIntoViewDisposition != null && sli.SecondaryScrollIntoViewDisposition.Enabled) - scrollAmount = this.ScrollIntoView(layoutNode, areaOfInterestBounds, scrollAmount, space1, space2, num3, num4, sli.SecondaryScrollIntoViewDisposition); + scrollAmount = ScrollIntoView(layoutNode, areaOfInterestBounds, scrollAmount, space1, space2, num3, num4, sli.SecondaryScrollIntoViewDisposition); scrollAmount = Math.Max(scrollAmount, num3); scrollAmount = Math.Min(scrollAmount, num4); } @@ -220,7 +220,7 @@ namespace Microsoft.Iris.Layouts } else scrollAmount = 0; - int space3 = this.ItemToSpace(scrollableBounds.Location.ToSize()); + int space3 = ItemToSpace(scrollableBounds.Location.ToSize()); bool flag1 = -scrollAmount < space3; bool flag2 = -scrollAmount + space2 > space1; float num6 = 1f; @@ -261,8 +261,8 @@ namespace Microsoft.Iris.Layouts ScrollIntoViewDisposition scrollIntoView) { Rectangle rectangle = areaOfInterestBounds; - int num1 = this.ItemToSpace(rectangle.Location.ToSize()); - int space = this.ItemToSpace(rectangle.Size); + int num1 = ItemToSpace(rectangle.Location.ToSize()); + int space = ItemToSpace(rectangle.Size); int num2 = num1 + space; int num3 = scrollAmount; int num4 = viewMajorSpace; @@ -315,14 +315,14 @@ namespace Microsoft.Iris.Layouts return scrollAmount; } - private int ItemToSpace(Size size) => new MajorMinor(size, this._orientation).Major; + private int ItemToSpace(Size size) => new MajorMinor(size, _orientation).Major; - protected Point ScrollAmountToOffset(int scrollAmount) => new MajorMinor(scrollAmount, 0).ToPoint(this._orientation); + protected Point ScrollAmountToOffset(int scrollAmount) => new MajorMinor(scrollAmount, 0).ToPoint(_orientation); - protected Size GetInfiniteConstraint(Size maxExtent) => new MajorMinor(maxExtent, this._orientation) + protected Size GetInfiniteConstraint(Size maxExtent) => new MajorMinor(maxExtent, _orientation) { Major = 16777215 - }.ToSize(this._orientation); + }.ToSize(_orientation); public static void ResetScrollFocusIntoView() => s_allowScrollFocusIntoView = true; diff --git a/UIX/Microsoft/Iris/Layouts/ScrollingLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/ScrollingLayoutInput.cs index ce08f15..ffbd89e 100644 --- a/UIX/Microsoft/Iris/Layouts/ScrollingLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/ScrollingLayoutInput.cs @@ -24,96 +24,96 @@ namespace Microsoft.Iris.Layouts public ScrollingLayoutInput() { - this._pageStep = 1f; - this._enabled = true; - this._scrollIntoView = new ScrollIntoViewDisposition(); + _pageStep = 1f; + _enabled = true; + _scrollIntoView = new ScrollIntoViewDisposition(); } public bool Enabled { - get => this._enabled; + get => _enabled; set { - if (value == this._enabled) + if (value == _enabled) return; - this._enabled = value; + _enabled = value; if (!value) return; - this._scrollAmount = 0; - this._pendingScrollAmount = 0; - this._pendingPageCommands = 0; - this._pendingScrollPosition = 0.0f; - this._havePendingScrollPosition = false; + _scrollAmount = 0; + _pendingScrollAmount = 0; + _pendingPageCommands = 0; + _pendingScrollPosition = 0.0f; + _havePendingScrollPosition = false; } } - public void Scroll(int amount) => this._scrollAmount += amount; + public void Scroll(int amount) => _scrollAmount += amount; - public void PageUp() => --this._pendingPageCommands; + public void PageUp() => --_pendingPageCommands; - public void PageDown() => ++this._pendingPageCommands; + public void PageDown() => ++_pendingPageCommands; - public void Home() => this.ScrollToPosition(0.0f); + public void Home() => ScrollToPosition(0.0f); - public void End() => this.ScrollToPosition(1f); + public void End() => ScrollToPosition(1f); public void ScrollToPosition(float position) { - this._havePendingScrollPosition = true; - this._pendingScrollPosition = position; + _havePendingScrollPosition = true; + _pendingScrollPosition = position; } public bool GetPendingScrollPosition(out float position) { - if (!this._havePendingScrollPosition) + if (!_havePendingScrollPosition) { position = 0.0f; return false; } - position = this._pendingScrollPosition; + position = _pendingScrollPosition; return true; } public bool GetPendingPageRequests(out int amount) { - amount = this._pendingPageCommands; - return this._pendingPageCommands != 0; + amount = _pendingPageCommands; + return _pendingPageCommands != 0; } - internal int ScrollAmount => this._scrollAmount; + internal int ScrollAmount => _scrollAmount; - internal void SetScrollAmount(int scrollAmount) => this._pendingScrollAmount = scrollAmount; + internal void SetScrollAmount(int scrollAmount) => _pendingScrollAmount = scrollAmount; internal void OnLayoutComplete() { - this.SecondaryScrollIntoViewDisposition = null; - this._havePendingScrollPosition = false; - this._pendingPageCommands = 0; - this._scrollAmount = this._pendingScrollAmount; + SecondaryScrollIntoViewDisposition = null; + _havePendingScrollPosition = false; + _pendingPageCommands = 0; + _scrollAmount = _pendingScrollAmount; } internal float PageStep { - get => this._pageStep; - set => this._pageStep = value; + get => _pageStep; + set => _pageStep = value; } public ScrollIntoViewDisposition ScrollIntoViewDisposition { - get => this._scrollIntoView; - set => this._scrollIntoView = value; + get => _scrollIntoView; + set => _scrollIntoView = value; } public ScrollIntoViewDisposition SecondaryScrollIntoViewDisposition { - get => this._secondaryScrollIntoView; - set => this._secondaryScrollIntoView = value; + get => _secondaryScrollIntoView; + set => _secondaryScrollIntoView = value; } DataCookie ILayoutInput.Data => Data; public static DataCookie Data => s_dataProperty; - public override string ToString() => InvariantString.Format("{0}(ScrollAmount={1}, PageAmount={2}, PageStep={3}, Disposition=({4}))", this.GetType().Name, _pendingScrollAmount, _pendingPageCommands, _pageStep, _scrollIntoView); + public override string ToString() => InvariantString.Format("{0}(ScrollAmount={1}, PageAmount={2}, PageStep={3}, Disposition=({4}))", GetType().Name, _pendingScrollAmount, _pendingPageCommands, _pageStep, _scrollIntoView); } } diff --git a/UIX/Microsoft/Iris/Layouts/ScrollingLayoutOutput.cs b/UIX/Microsoft/Iris/Layouts/ScrollingLayoutOutput.cs index e194005..8068111 100644 --- a/UIX/Microsoft/Iris/Layouts/ScrollingLayoutOutput.cs +++ b/UIX/Microsoft/Iris/Layouts/ScrollingLayoutOutput.cs @@ -25,62 +25,62 @@ namespace Microsoft.Iris.Layouts public bool CanScrollNegative { - get => this._canScrollNegative; - set => this._canScrollNegative = value; + get => _canScrollNegative; + set => _canScrollNegative = value; } public bool CanScrollPositive { - get => this._canScrollPositive; - set => this._canScrollPositive = value; + get => _canScrollPositive; + set => _canScrollPositive = value; } public float CurrentPage { - get => this._currentPage; - set => this._currentPage = value; + get => _currentPage; + set => _currentPage = value; } public float TotalPages { - get => this._totalPages; - set => this._totalPages = value; + get => _totalPages; + set => _totalPages = value; } public float ViewNear { - get => this._viewNear; - set => this._viewNear = value; + get => _viewNear; + set => _viewNear = value; } public float ViewFar { - get => this._viewFar; - set => this._viewFar = value; + get => _viewFar; + set => _viewFar = value; } public bool ProcessedExplicitScrollIntoViewRequest { - get => this._processedScrollIntoViewRequest; - set => this._processedScrollIntoViewRequest = value; + get => _processedScrollIntoViewRequest; + set => _processedScrollIntoViewRequest = value; } public bool ScrollFocusIntoView { - get => this._scrollFocusIntoView; - set => this._scrollFocusIntoView = value; + get => _scrollFocusIntoView; + set => _scrollFocusIntoView = value; } public VisibleIndexRangeLayoutOutput VisibleIndices { - get => this._visibleIndices; - set => this._visibleIndices = value; + get => _visibleIndices; + set => _visibleIndices = value; } public override DataCookie OutputID => DataCookie; public static DataCookie DataCookie => s_dataProperty; - public override string ToString() => InvariantString.Format("{0}(CanScrollNegative={1}, CanScrollPositive={2}, CurrentPage={3}, TotalPages={4})", this.GetType().Name, _canScrollNegative, _canScrollPositive, _currentPage, _totalPages); + public override string ToString() => InvariantString.Format("{0}(CanScrollNegative={1}, CanScrollPositive={2}, CurrentPage={3}, TotalPages={4})", GetType().Name, _canScrollNegative, _canScrollPositive, _currentPage, _totalPages); } } diff --git a/UIX/Microsoft/Iris/Layouts/StackLayout.cs b/UIX/Microsoft/Iris/Layouts/StackLayout.cs index 602270c..d6c4539 100644 --- a/UIX/Microsoft/Iris/Layouts/StackLayout.cs +++ b/UIX/Microsoft/Iris/Layouts/StackLayout.cs @@ -28,7 +28,7 @@ namespace Microsoft.Iris.Layouts int num = 0; foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren) { - StackLayoutInput layoutInputForNode = this.GetLayoutInputForNode(layoutChild); + StackLayoutInput layoutInputForNode = GetLayoutInputForNode(layoutChild); Size size2 = layoutChild.Measure(constraint); size1.Height = Math.Max(size1.Height, layoutChild.DesiredSize.Height); if (layoutInputForNode.Priority == StackPriority.High) @@ -56,7 +56,7 @@ namespace Microsoft.Iris.Layouts if (x < width1) { int width3 = width1 - x; - StackLayoutInput layoutInputForNode = this.GetLayoutInputForNode(layoutChild); + StackLayoutInput layoutInputForNode = GetLayoutInputForNode(layoutChild); if (layoutInputForNode.Priority == StackPriority.High) { if (layoutChild.DesiredSize.Width > width3) diff --git a/UIX/Microsoft/Iris/Layouts/StackLayoutInput.cs b/UIX/Microsoft/Iris/Layouts/StackLayoutInput.cs index ece6fa3..21049be 100644 --- a/UIX/Microsoft/Iris/Layouts/StackLayoutInput.cs +++ b/UIX/Microsoft/Iris/Layouts/StackLayoutInput.cs @@ -15,18 +15,18 @@ namespace Microsoft.Iris.Layouts private StackPriority _priority; private Size _minimumSize; - public StackLayoutInput() => this.Priority = StackPriority.Low; + public StackLayoutInput() => Priority = StackPriority.Low; public StackPriority Priority { - get => this._priority; - set => this._priority = value; + get => _priority; + set => _priority = value; } public Size MinimumSize { - get => this._minimumSize; - set => this._minimumSize = value; + get => _minimumSize; + set => _minimumSize = value; } DataCookie ILayoutInput.Data => StackLayout.Data; diff --git a/UIX/Microsoft/Iris/Library/AncestorEnumerator.cs b/UIX/Microsoft/Iris/Library/AncestorEnumerator.cs index 3818842..d7b591f 100644 --- a/UIX/Microsoft/Iris/Library/AncestorEnumerator.cs +++ b/UIX/Microsoft/Iris/Library/AncestorEnumerator.cs @@ -16,14 +16,14 @@ namespace Microsoft.Iris.Library internal AncestorEnumerator(TreeNode nodeStart) { - this._nodeStart = nodeStart; - this._nodeCurrent = null; - this._nodeNext = this._nodeStart; + _nodeStart = nodeStart; + _nodeCurrent = null; + _nodeNext = _nodeStart; } object IEnumerator.Current => _nodeCurrent; - public TreeNode Current => this._nodeCurrent; + public TreeNode Current => _nodeCurrent; IEnumerator IEnumerable.GetEnumerator() => this; @@ -31,16 +31,16 @@ namespace Microsoft.Iris.Library public void Reset() { - this._nodeCurrent = null; - this._nodeNext = this._nodeStart; + _nodeCurrent = null; + _nodeNext = _nodeStart; } public bool MoveNext() { - this._nodeCurrent = this._nodeNext; - if (this._nodeNext == null) + _nodeCurrent = _nodeNext; + if (_nodeNext == null) return false; - this._nodeNext = this._nodeNext.Parent; + _nodeNext = _nodeNext.Parent; return true; } } diff --git a/UIX/Microsoft/Iris/Library/DataCookie.cs b/UIX/Microsoft/Iris/Library/DataCookie.cs index 1e701c7..b969807 100644 --- a/UIX/Microsoft/Iris/Library/DataCookie.cs +++ b/UIX/Microsoft/Iris/Library/DataCookie.cs @@ -11,7 +11,7 @@ namespace Microsoft.Iris.Library public static readonly DataCookie NULL = new DataCookie(); private uint m_value; - private DataCookie(uint value) => this.m_value = value; + private DataCookie(uint value) => m_value = value; public static bool operator ==(DataCookie hl, DataCookie hr) => (int)hl.m_value == (int)hr.m_value; @@ -30,7 +30,7 @@ namespace Microsoft.Iris.Library return (int)m_value == (int)num; } - public override int GetHashCode() => (int)this.m_value; + public override int GetHashCode() => (int)m_value; internal static DataCookie FromUInt32(uint value) => new DataCookie(value); diff --git a/UIX/Microsoft/Iris/Library/DisposableNotifyObjectBase.cs b/UIX/Microsoft/Iris/Library/DisposableNotifyObjectBase.cs index afefdbc..17bc32a 100644 --- a/UIX/Microsoft/Iris/Library/DisposableNotifyObjectBase.cs +++ b/UIX/Microsoft/Iris/Library/DisposableNotifyObjectBase.cs @@ -16,10 +16,10 @@ namespace Microsoft.Iris.Library { } - protected void FireNotification(string id) => this._notifier.Fire(id); + protected void FireNotification(string id) => _notifier.Fire(id); - protected void FireThreadSafeNotification(string id) => this._notifier.FireThreadSafe(id); + protected void FireThreadSafeNotification(string id) => _notifier.FireThreadSafe(id); - public void AddListener(Listener listener) => this._notifier.AddListener(listener); + public void AddListener(Listener listener) => _notifier.AddListener(listener); } } diff --git a/UIX/Microsoft/Iris/Library/DisposableObject.cs b/UIX/Microsoft/Iris/Library/DisposableObject.cs index cbce743..5d8ff38 100644 --- a/UIX/Microsoft/Iris/Library/DisposableObject.cs +++ b/UIX/Microsoft/Iris/Library/DisposableObject.cs @@ -16,19 +16,19 @@ namespace Microsoft.Iris.Library { } - public bool IsDisposed => this._isDisposed; + public bool IsDisposed => _isDisposed; - public void DeclareOwner(object owner) => this.OnOwnerDeclared(owner); + public void DeclareOwner(object owner) => OnOwnerDeclared(owner); - public void TransferOwnership(object owner) => this.OnOwnerDeclared(owner); + public void TransferOwnership(object owner) => OnOwnerDeclared(owner); protected virtual void OnOwnerDeclared(object owner) { } - public void Dispose(object owner) => this.OnDispose(); + public void Dispose(object owner) => OnDispose(); - protected virtual void OnDispose() => this._isDisposed = true; + protected virtual void OnDispose() => _isDisposed = true; [Conditional("DEBUG")] public void DEBUG_DeclareDisposeUnnecessary() diff --git a/UIX/Microsoft/Iris/Library/DynamicData.cs b/UIX/Microsoft/Iris/Library/DynamicData.cs index 49f1700..57e6042 100644 --- a/UIX/Microsoft/Iris/Library/DynamicData.cs +++ b/UIX/Microsoft/Iris/Library/DynamicData.cs @@ -12,31 +12,31 @@ namespace Microsoft.Iris.Library { private SmartMap _dataMap; - public void Create() => this._dataMap = new SmartMap(); + public void Create() => _dataMap = new SmartMap(); - public object GetData(DataCookie cookie) => this._dataMap[GetKey(cookie)]; + public object GetData(DataCookie cookie) => _dataMap[GetKey(cookie)]; - public void SetData(DataCookie cookie, object value) => this._dataMap[GetKey(cookie)] = value; + public void SetData(DataCookie cookie, object value) => _dataMap[GetKey(cookie)] = value; - public Delegate GetEventHandler(EventCookie cookie) => this._dataMap[GetKey(cookie)] as Delegate; + public Delegate GetEventHandler(EventCookie cookie) => _dataMap[GetKey(cookie)] as Delegate; public bool AddEventHandler(EventCookie cookie, Delegate handlerToAdd) { uint key = GetKey(cookie); - Delegate data = this._dataMap[key] as Delegate; - this._dataMap[key] = Delegate.Combine(data, handlerToAdd); + Delegate data = _dataMap[key] as Delegate; + _dataMap[key] = Delegate.Combine(data, handlerToAdd); return (object)data == null; } public bool RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) { uint key = GetKey(cookie); - Delegate @delegate = Delegate.Remove(this._dataMap[key] as Delegate, handlerToRemove); - this._dataMap[key] = @delegate; + Delegate @delegate = Delegate.Remove(_dataMap[key] as Delegate, handlerToRemove); + _dataMap[key] = @delegate; return (object)@delegate == null; } - public void RemoveEventHandlers(EventCookie cookie) => this._dataMap[GetKey(cookie)] = null; + public void RemoveEventHandlers(EventCookie cookie) => _dataMap[GetKey(cookie)] = null; private static uint GetKey(DataCookie cookie) => DataCookie.ToUInt32(cookie); diff --git a/UIX/Microsoft/Iris/Library/EventCookie.cs b/UIX/Microsoft/Iris/Library/EventCookie.cs index 4f5a437..692042d 100644 --- a/UIX/Microsoft/Iris/Library/EventCookie.cs +++ b/UIX/Microsoft/Iris/Library/EventCookie.cs @@ -11,7 +11,7 @@ namespace Microsoft.Iris.Library public static readonly EventCookie NULL = new EventCookie(); private uint m_value; - private EventCookie(uint value) => this.m_value = value; + private EventCookie(uint value) => m_value = value; public static bool operator ==(EventCookie hl, EventCookie hr) => (int)hl.m_value == (int)hr.m_value; @@ -30,7 +30,7 @@ namespace Microsoft.Iris.Library return (int)m_value == (int)num; } - public override int GetHashCode() => (int)this.m_value; + public override int GetHashCode() => (int)m_value; internal static EventCookie FromUInt32(uint value) => new EventCookie(value); diff --git a/UIX/Microsoft/Iris/Library/ExpandableArray.cs b/UIX/Microsoft/Iris/Library/ExpandableArray.cs index 3d9e160..5e122bb 100644 --- a/UIX/Microsoft/Iris/Library/ExpandableArray.cs +++ b/UIX/Microsoft/Iris/Library/ExpandableArray.cs @@ -16,9 +16,9 @@ namespace Microsoft.Iris.Library private int _generation; private int _lockCount; - public ExpandableArray(int initialSize) => this._array = new object[initialSize]; + public ExpandableArray(int initialSize) => _array = new object[initialSize]; - public int Length => this._array.Length; + public int Length => _array.Length; public bool IsFixedSize => false; @@ -26,26 +26,26 @@ namespace Microsoft.Iris.Library public object this[int index] { - get => this._array[index]; - set => this.SetItem(index, value); + get => _array[index]; + set => SetItem(index, value); } public int Add(object value) { int index = 0; - while (index < this._array.Length && this._array[index] != null) + while (index < _array.Length && _array[index] != null) ++index; - this.SetItem(index, value); + SetItem(index, value); return index; } public void Clear() { - this.IncrementGeneration(); + IncrementGeneration(); Array.Clear(_array, 0, _array.Length); } - public bool Contains(object value) => this._array.Contains(value); + public bool Contains(object value) => _array.Contains(value); public int IndexOf(object value) => Array.IndexOf(_array, value); @@ -66,9 +66,9 @@ namespace Microsoft.Iris.Library get { int num = 0; - for (int index = 0; index < this._array.Length; ++index) + for (int index = 0; index < _array.Length; ++index) { - if (this._array[index] != null) + if (_array[index] != null) ++num; } return num; @@ -79,39 +79,39 @@ namespace Microsoft.Iris.Library public object SyncRoot => (object)null; - public void CopyTo(Array array, int index) => this._array.CopyTo(array, index); + public void CopyTo(Array array, int index) => _array.CopyTo(array, index); public ExpandableArray.NullSkippingEnumerator GetEnumerator() => new ExpandableArray.NullSkippingEnumerator(this); - public void LockArray() => ++this._lockCount; + public void LockArray() => ++_lockCount; - public void UnlockArray() => --this._lockCount; + public void UnlockArray() => --_lockCount; private void IncrementGeneration() { - ++this._generation; - if (this._generation != int.MaxValue) + ++_generation; + if (_generation != int.MaxValue) return; - this._generation = 0; + _generation = 0; } private void ExpandArray(int index) { - int length = this._array.Length; + int length = _array.Length; while (index >= length) length <<= 1; object[] objArray = new object[length]; - for (int index1 = 0; index1 < this._array.Length; ++index1) - objArray[index1] = this._array[index1]; - this._array = objArray; + for (int index1 = 0; index1 < _array.Length; ++index1) + objArray[index1] = _array[index1]; + _array = objArray; } private void SetItem(int index, object value) { - this.IncrementGeneration(); - if (index >= this._array.Length) - this.ExpandArray(index); - this._array[index] = value; + IncrementGeneration(); + if (index >= _array.Length) + ExpandArray(index); + _array[index] = value; } public struct NullSkippingEnumerator : IEnumerator @@ -122,26 +122,26 @@ namespace Microsoft.Iris.Library public NullSkippingEnumerator(ExpandableArray array) { - this._array = array; - this._position = -1; - this._generation = array._generation; + _array = array; + _position = -1; + _generation = array._generation; } public object Current { get { - this.CheckGeneration(); - return this._array[this._position]; + CheckGeneration(); + return _array[_position]; } } public bool MoveNext() { - this.CheckGeneration(); - for (++this._position; this._position < this._array.Length; ++this._position) + CheckGeneration(); + for (++_position; _position < _array.Length; ++_position) { - if (this._array[this._position] != null) + if (_array[_position] != null) return true; } return false; @@ -149,8 +149,8 @@ namespace Microsoft.Iris.Library public void Reset() { - this.CheckGeneration(); - this._position = -1; + CheckGeneration(); + _position = -1; } private void CheckGeneration() diff --git a/UIX/Microsoft/Iris/Library/NotifyObjectBase.cs b/UIX/Microsoft/Iris/Library/NotifyObjectBase.cs index a974fec..2431ec5 100644 --- a/UIX/Microsoft/Iris/Library/NotifyObjectBase.cs +++ b/UIX/Microsoft/Iris/Library/NotifyObjectBase.cs @@ -16,10 +16,10 @@ namespace Microsoft.Iris.Library { } - protected void FireNotification(string id) => this._notifier.Fire(id); + protected void FireNotification(string id) => _notifier.Fire(id); - protected void FireThreadSafeNotification(string id) => this._notifier.FireThreadSafe(id); + protected void FireThreadSafeNotification(string id) => _notifier.FireThreadSafe(id); - public void AddListener(Listener listener) => this._notifier.AddListener(listener); + public void AddListener(Listener listener) => _notifier.AddListener(listener); } } diff --git a/UIX/Microsoft/Iris/Library/Result.cs b/UIX/Microsoft/Iris/Library/Result.cs index aa9dd3f..be54b35 100644 --- a/UIX/Microsoft/Iris/Library/Result.cs +++ b/UIX/Microsoft/Iris/Library/Result.cs @@ -19,12 +19,12 @@ namespace Microsoft.Iris.Library public static Result Fail(string format, object param1, object param2, object param3) => new Result(string.Format(format, param1, param2, param3)); - public bool Failed => this._error != null; + public bool Failed => _error != null; - public string Error => this._error; + public string Error => _error; - public override string ToString() => this._error; + public override string ToString() => _error; - private Result(string error) => this._error = error; + private Result(string error) => _error = error; } } diff --git a/UIX/Microsoft/Iris/Library/SharedDisposableObject.cs b/UIX/Microsoft/Iris/Library/SharedDisposableObject.cs index d3307fc..1811f57 100644 --- a/UIX/Microsoft/Iris/Library/SharedDisposableObject.cs +++ b/UIX/Microsoft/Iris/Library/SharedDisposableObject.cs @@ -10,18 +10,18 @@ namespace Microsoft.Iris.Library { private int _usageCount; - public SharedDisposableObject() => this.DeclareOwner(this); + public SharedDisposableObject() => DeclareOwner(this); protected override void OnDispose() => base.OnDispose(); - public virtual void RegisterUsage(object consumer) => ++this._usageCount; + public virtual void RegisterUsage(object consumer) => ++_usageCount; public virtual void UnregisterUsage(object consumer) { - --this._usageCount; - if (this._usageCount != 0) + --_usageCount; + if (_usageCount != 0) return; - this.Dispose(this); + Dispose(this); } } } diff --git a/UIX/Microsoft/Iris/Library/SmartMap.cs b/UIX/Microsoft/Iris/Library/SmartMap.cs index 907c495..3c76aca 100644 --- a/UIX/Microsoft/Iris/Library/SmartMap.cs +++ b/UIX/Microsoft/Iris/Library/SmartMap.cs @@ -17,36 +17,36 @@ namespace Microsoft.Iris.Library get { int num = 0; - if (this._listEntries != null) - num = this._listEntries.Length; + if (_listEntries != null) + num = _listEntries.Length; return num; } } - public bool IsEmpty => this.Count == 0; + public bool IsEmpty => Count == 0; public object this[uint key] { get { - int index = this.IndexOf(key); - return index < 0 ? null : this._listEntries[index].dataObject; + int index = IndexOf(key); + return index < 0 ? null : _listEntries[index].dataObject; } set { - int slotIndex = this.IndexOf(key); + int slotIndex = IndexOf(key); if (value != null) { if (slotIndex >= 0) - this._listEntries[slotIndex].dataObject = value; + _listEntries[slotIndex].dataObject = value; else - this.Add(key, value, ~slotIndex); + Add(key, value, ~slotIndex); } else { if (slotIndex < 0) return; - this.Remove(key, slotIndex); + Remove(key, slotIndex); } } } @@ -56,11 +56,11 @@ namespace Microsoft.Iris.Library get { uint[] numArray = null; - if (this._listEntries != null) + if (_listEntries != null) { - numArray = new uint[this._listEntries.Length]; - for (int index = 0; index < this._listEntries.Length; ++index) - numArray[index] = this._listEntries[index].key; + numArray = new uint[_listEntries.Length]; + for (int index = 0; index < _listEntries.Length; ++index) + numArray[index] = _listEntries[index].key; } return numArray; } @@ -71,11 +71,11 @@ namespace Microsoft.Iris.Library get { object[] objArray = null; - if (this._listEntries != null) + if (_listEntries != null) { - objArray = new object[this._listEntries.Length]; - for (int index = 0; index < this._listEntries.Length; ++index) - objArray[index] = this._listEntries[index].dataObject; + objArray = new object[_listEntries.Length]; + for (int index = 0; index < _listEntries.Length; ++index) + objArray[index] = _listEntries[index].dataObject; } return objArray; } @@ -83,9 +83,9 @@ namespace Microsoft.Iris.Library public bool Lookup(object desired, out uint key) { - if (this._listEntries != null) + if (_listEntries != null) { - foreach (SmartMap.Entry listEntry in this._listEntries) + foreach (SmartMap.Entry listEntry in _listEntries) { if (listEntry.dataObject == desired) { @@ -100,18 +100,18 @@ namespace Microsoft.Iris.Library private int IndexOf(uint key) { - if (this._listEntries == null) + if (_listEntries == null) return -1; uint num1 = uint.MaxValue; int index1 = 0; - if (this._listEntries.Length > 4) + if (_listEntries.Length > 4) { int num2 = 0; - int num3 = this._listEntries.Length - 1; + int num3 = _listEntries.Length - 1; while (num2 <= num3) { index1 = (num3 + num2) / 2; - num1 = this._listEntries[index1].key; + num1 = _listEntries[index1].key; if ((int)key == (int)num1) return index1; if (key < num1) @@ -122,10 +122,10 @@ namespace Microsoft.Iris.Library } else { - for (int index2 = 0; index2 < this._listEntries.Length; ++index2) + for (int index2 = 0; index2 < _listEntries.Length; ++index2) { index1 = index2; - num1 = this._listEntries[index1].key; + num1 = _listEntries[index1].key; if ((int)key == (int)num1) return index1; if (key < num1) @@ -140,34 +140,34 @@ namespace Microsoft.Iris.Library private void Add(uint key, object dataObject, int slotIndex) { SmartMap.Entry[] entryArray; - if (this._listEntries == null) + if (_listEntries == null) { entryArray = new SmartMap.Entry[1]; } else { - int length = this._listEntries.Length; + int length = _listEntries.Length; entryArray = new SmartMap.Entry[length + 1]; Array.Copy(_listEntries, entryArray, slotIndex); Array.Copy(_listEntries, slotIndex, entryArray, slotIndex + 1, length - slotIndex); } - this._listEntries = entryArray; - this._listEntries[slotIndex].key = key; - this._listEntries[slotIndex].dataObject = dataObject; + _listEntries = entryArray; + _listEntries[slotIndex].key = key; + _listEntries[slotIndex].dataObject = dataObject; } private void Remove(uint key, int slotIndex) { - int length = this._listEntries.Length; + int length = _listEntries.Length; if (length > 0) { SmartMap.Entry[] entryArray = new SmartMap.Entry[length - 1]; Array.Copy(_listEntries, entryArray, slotIndex); Array.Copy(_listEntries, slotIndex + 1, entryArray, slotIndex, length - (slotIndex + 1)); - this._listEntries = entryArray; + _listEntries = entryArray; } else - this._listEntries = null; + _listEntries = null; } private struct Entry diff --git a/UIX/Microsoft/Iris/Library/StackIListEnumerator.cs b/UIX/Microsoft/Iris/Library/StackIListEnumerator.cs index 7cff01d..a997e17 100644 --- a/UIX/Microsoft/Iris/Library/StackIListEnumerator.cs +++ b/UIX/Microsoft/Iris/Library/StackIListEnumerator.cs @@ -16,16 +16,16 @@ namespace Microsoft.Iris.Library internal StackIListEnumerator(IList list) { - this._list = list; - this._currentIndex = -1; + _list = list; + _currentIndex = -1; } public StackIListEnumerator GetEnumerator() => this; - public bool MoveNext() => ++this._currentIndex < this._list.Count; + public bool MoveNext() => ++_currentIndex < _list.Count; - public object Current => this._list[this._currentIndex]; + public object Current => _list[_currentIndex]; - public void Reset() => this._currentIndex = -1; + public void Reset() => _currentIndex = -1; } } diff --git a/UIX/Microsoft/Iris/Library/StackIListReverseEnumerator.cs b/UIX/Microsoft/Iris/Library/StackIListReverseEnumerator.cs index 5197a35..f043ebd 100644 --- a/UIX/Microsoft/Iris/Library/StackIListReverseEnumerator.cs +++ b/UIX/Microsoft/Iris/Library/StackIListReverseEnumerator.cs @@ -15,16 +15,16 @@ namespace Microsoft.Iris.Library public StackIListReverseEnumerator(IList list) { - this._list = list; - this._currentIndex = list.Count; + _list = list; + _currentIndex = list.Count; } public StackIListReverseEnumerator GetEnumerator() => this; - public bool MoveNext() => --this._currentIndex >= 0; + public bool MoveNext() => --_currentIndex >= 0; - public object Current => this._list[this._currentIndex]; + public object Current => _list[_currentIndex]; - public void Reset() => this._currentIndex = this._list.Count; + public void Reset() => _currentIndex = _list.Count; } } diff --git a/UIX/Microsoft/Iris/Library/TreeNode.cs b/UIX/Microsoft/Iris/Library/TreeNode.cs index 10731a6..e9482c9 100644 --- a/UIX/Microsoft/Iris/Library/TreeNode.cs +++ b/UIX/Microsoft/Iris/Library/TreeNode.cs @@ -23,28 +23,28 @@ namespace Microsoft.Iris.Library public TreeNode() { - this._dataMap = new DynamicData(); - this._dataMap.Create(); + _dataMap = new DynamicData(); + _dataMap.Create(); } protected override void OnDispose() { base.OnDispose(); - this.ChangeParent(null); - this.RemoveEventHandlers(s_deepParentChangeEvent); + ChangeParent(null); + RemoveEventHandlers(s_deepParentChangeEvent); } - public bool IsZoned => this._zone != null; + public bool IsZoned => _zone != null; - public void ChangeParent(TreeNode nodeNewParent) => this.ChangeParent(nodeNewParent, null, LinkType.First); + public void ChangeParent(TreeNode nodeNewParent) => ChangeParent(nodeNewParent, null, LinkType.First); public void ChangeParent(TreeNode nodeNewParent, TreeNode nodeSibling, TreeNode.LinkType lt) { - if (this._nodeParent == nodeNewParent) + if (_nodeParent == nodeNewParent) return; UIZone zone = null; - TreeNode nodeParent = this._nodeParent; - if (this._nodeParent != null) + TreeNode nodeParent = _nodeParent; + if (_nodeParent != null) { DoUnlink(this); nodeParent.OnChildrenChanged(); @@ -55,34 +55,34 @@ namespace Microsoft.Iris.Library zone = nodeNewParent.Zone; nodeNewParent.OnChildrenChanged(); } - this.PropagateZone(zone); - this.FireTreeChangeWorker(); + PropagateZone(zone); + FireTreeChangeWorker(); } public void PropagateZone(UIZone zone) { - if (this._zone == zone) + if (_zone == zone) return; - if (this._zone != null) - this.OnZoneDetached(); - this._zone = zone; + if (_zone != null) + OnZoneDetached(); + _zone = zone; if (zone != null) - this.OnZoneAttached(); - foreach (TreeNode child in this.Children) + OnZoneAttached(); + foreach (TreeNode child in Children) child.PropagateZone(zone); } public void MoveNode(TreeNode nodeSibling, TreeNode.LinkType lt) { - TreeNode nodeParent = this._nodeParent; + TreeNode nodeParent = _nodeParent; DoUnlink(this); DoLink(nodeParent, this, nodeSibling, lt); } public void RemoveAllChildren(bool disposeChildrenFlag) { - while (this._nodeFirstChild != null) - this._nodeFirstChild.ChangeParent(null); + while (_nodeFirstChild != null) + _nodeFirstChild.ChangeParent(null); } protected virtual void OnZoneAttached() @@ -99,29 +99,29 @@ namespace Microsoft.Iris.Library public event EventHandler DeepParentChange { - add => this.AddEventHandler(s_deepParentChangeEvent, value); - remove => this.RemoveEventHandler(s_deepParentChangeEvent, value); + add => AddEventHandler(s_deepParentChangeEvent, value); + remove => RemoveEventHandler(s_deepParentChangeEvent, value); } - public UIZone Zone => this._zone; + public UIZone Zone => _zone; - UIZone ITreeNode.Zone => this._zone; + UIZone ITreeNode.Zone => _zone; - public UISession UISession => this._zone.Session; + public UISession UISession => _zone.Session; - public bool HasChildren => this._nodeFirstChild != null; + public bool HasChildren => _nodeFirstChild != null; public abstract bool IsRoot { get; } ITreeNode ITreeNode.Parent => _nodeParent; - public TreeNode Parent => this._nodeParent; + public TreeNode Parent => _nodeParent; - public TreeNode NextSibling => this._nodeNext; + public TreeNode NextSibling => _nodeNext; - public TreeNode PreviousSibling => this._nodePrevious; + public TreeNode PreviousSibling => _nodePrevious; - public TreeNode FirstSibling => this._nodeParent == null ? this : this._nodeParent._nodeFirstChild; + public TreeNode FirstSibling => _nodeParent == null ? this : _nodeParent._nodeFirstChild; public TreeNode LastSibling { @@ -134,9 +134,9 @@ namespace Microsoft.Iris.Library } } - public TreeNode FirstChild => this._nodeFirstChild; + public TreeNode FirstChild => _nodeFirstChild; - public TreeNode LastChild => this._nodeFirstChild != null ? this._nodeFirstChild.LastSibling : null; + public TreeNode LastChild => _nodeFirstChild != null ? _nodeFirstChild.LastSibling : null; public TreeNodeCollection Children => new TreeNodeCollection(this); @@ -157,7 +157,7 @@ namespace Microsoft.Iris.Library get { int num = 0; - for (TreeNode treeNode = this._nodeFirstChild; treeNode != null; treeNode = treeNode._nodeNext) + for (TreeNode treeNode = _nodeFirstChild; treeNode != null; treeNode = treeNode._nodeNext) ++num; return num; } @@ -229,24 +229,24 @@ namespace Microsoft.Iris.Library private void FireTreeChangeWorker() { - foreach (TreeNode child in this.Children) + foreach (TreeNode child in Children) child.FireTreeChangeWorker(); - if (!(this.GetEventHandler(s_deepParentChangeEvent) is EventHandler eventHandler)) + if (!(GetEventHandler(s_deepParentChangeEvent) is EventHandler eventHandler)) return; eventHandler(this, EventArgs.Empty); } - protected object GetData(DataCookie cookie) => this._dataMap.GetData(cookie); + protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie); - protected void SetData(DataCookie cookie, object value) => this._dataMap.SetData(cookie, value); + protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value); - protected Delegate GetEventHandler(EventCookie cookie) => this._dataMap.GetEventHandler(cookie); + protected Delegate GetEventHandler(EventCookie cookie) => _dataMap.GetEventHandler(cookie); - protected bool AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => this._dataMap.AddEventHandler(cookie, handlerToAdd); + protected bool AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => _dataMap.AddEventHandler(cookie, handlerToAdd); - protected bool RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => this._dataMap.RemoveEventHandler(cookie, handlerToRemove); + protected bool RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => _dataMap.RemoveEventHandler(cookie, handlerToRemove); - protected void RemoveEventHandlers(EventCookie cookie) => this._dataMap.RemoveEventHandlers(cookie); + protected void RemoveEventHandlers(EventCookie cookie) => _dataMap.RemoveEventHandlers(cookie); private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie); diff --git a/UIX/Microsoft/Iris/Library/TreeNodeCollection.cs b/UIX/Microsoft/Iris/Library/TreeNodeCollection.cs index 6f455a1..f7a64cf 100644 --- a/UIX/Microsoft/Iris/Library/TreeNodeCollection.cs +++ b/UIX/Microsoft/Iris/Library/TreeNodeCollection.cs @@ -13,9 +13,9 @@ namespace Microsoft.Iris.Library { private TreeNode _nodeSubject; - internal TreeNodeCollection(TreeNode nodeSubject) => this._nodeSubject = nodeSubject; + internal TreeNodeCollection(TreeNode nodeSubject) => _nodeSubject = nodeSubject; - public int Count => this._nodeSubject.ChildCount; + public int Count => _nodeSubject.ChildCount; bool ICollection.IsSynchronized => false; @@ -51,9 +51,9 @@ namespace Microsoft.Iris.Library } } - IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - public TreeNodeEnumerator GetEnumerator() => new TreeNodeEnumerator(this._nodeSubject); + public TreeNodeEnumerator GetEnumerator() => new TreeNodeEnumerator(_nodeSubject); void ICollection.CopyTo(Array destList, int destIndex) { @@ -65,23 +65,23 @@ namespace Microsoft.Iris.Library int IList.Add(object value) { - this.Add((TreeNode)value); - return this._nodeSubject.ChildCount - 1; + Add((TreeNode)value); + return _nodeSubject.ChildCount - 1; } - public void Add(TreeNode nodeChild) => nodeChild.ChangeParent(this._nodeSubject, null, TreeNode.LinkType.Last); + public void Add(TreeNode nodeChild) => nodeChild.ChangeParent(_nodeSubject, null, TreeNode.LinkType.Last); - public void Clear() => this._nodeSubject.RemoveAllChildren(true); + public void Clear() => _nodeSubject.RemoveAllChildren(true); - bool IList.Contains(object nodeChild) => this.Contains((TreeNode)nodeChild); + bool IList.Contains(object nodeChild) => Contains((TreeNode)nodeChild); - public bool Contains(TreeNode nodeChild) => nodeChild.Parent == this._nodeSubject; + public bool Contains(TreeNode nodeChild) => nodeChild.Parent == _nodeSubject; - int IList.IndexOf(object nodeChild) => this.IndexOf((TreeNode)nodeChild); + int IList.IndexOf(object nodeChild) => IndexOf((TreeNode)nodeChild); public int IndexOf(TreeNode nodeChild) { - if (nodeChild.Parent != this._nodeSubject) + if (nodeChild.Parent != _nodeSubject) return -1; int num = 0; foreach (TreeNode treeNode in this) @@ -93,21 +93,21 @@ namespace Microsoft.Iris.Library return -1; } - void IList.Insert(int insertAtIndex, object nodeChild) => this.Insert(insertAtIndex, (TreeNode)nodeChild); + void IList.Insert(int insertAtIndex, object nodeChild) => Insert(insertAtIndex, (TreeNode)nodeChild); public void Insert(int insertAtIndex, TreeNode nodeChild) { TreeNode nodeSibling = null; TreeNode.LinkType lt = TreeNode.LinkType.Last; - if (insertAtIndex < this.Count) + if (insertAtIndex < Count) { nodeSibling = this[insertAtIndex]; lt = TreeNode.LinkType.Before; } - nodeChild.ChangeParent(this._nodeSubject, nodeSibling, lt); + nodeChild.ChangeParent(_nodeSubject, nodeSibling, lt); } - void IList.Remove(object nodeChild) => this.Remove((TreeNode)nodeChild); + void IList.Remove(object nodeChild) => Remove((TreeNode)nodeChild); public void Remove(TreeNode nodeChild) => nodeChild.ChangeParent(null); diff --git a/UIX/Microsoft/Iris/Library/TreeNodeEnumerator.cs b/UIX/Microsoft/Iris/Library/TreeNodeEnumerator.cs index 393ae89..117e292 100644 --- a/UIX/Microsoft/Iris/Library/TreeNodeEnumerator.cs +++ b/UIX/Microsoft/Iris/Library/TreeNodeEnumerator.cs @@ -16,27 +16,27 @@ namespace Microsoft.Iris.Library internal TreeNodeEnumerator(TreeNode nodeParent) { - this._nodeParent = nodeParent; - this._nodeCurrent = null; - this._nodeNext = nodeParent.FirstChild; + _nodeParent = nodeParent; + _nodeCurrent = null; + _nodeNext = nodeParent.FirstChild; } object IEnumerator.Current => _nodeCurrent; - public TreeNode Current => this._nodeCurrent; + public TreeNode Current => _nodeCurrent; public void Reset() { - this._nodeCurrent = null; - this._nodeNext = this._nodeParent.FirstChild; + _nodeCurrent = null; + _nodeNext = _nodeParent.FirstChild; } public bool MoveNext() { - this._nodeCurrent = this._nodeNext; - if (this._nodeNext == null) + _nodeCurrent = _nodeNext; + if (_nodeNext == null) return false; - this._nodeNext = this._nodeNext.NextSibling; + _nodeNext = _nodeNext.NextSibling; return true; } } diff --git a/UIX/Microsoft/Iris/ListContentsChangedArgs.cs b/UIX/Microsoft/Iris/ListContentsChangedArgs.cs index 0a0fad8..7605847 100644 --- a/UIX/Microsoft/Iris/ListContentsChangedArgs.cs +++ b/UIX/Microsoft/Iris/ListContentsChangedArgs.cs @@ -21,10 +21,10 @@ namespace Microsoft.Iris int newIndex, int count) { - this._count = count; - this._type = type; - this._oldIndex = oldIndex; - this._newIndex = newIndex; + _count = count; + _type = type; + _oldIndex = oldIndex; + _newIndex = newIndex; } internal ListContentsChangedArgs(ListContentsChangeType type, int oldIndex, int newIndex) @@ -32,12 +32,12 @@ namespace Microsoft.Iris { } - public ListContentsChangeType Type => this._type; + public ListContentsChangeType Type => _type; - public int OldIndex => this._oldIndex; + public int OldIndex => _oldIndex; - public int NewIndex => this._newIndex; + public int NewIndex => _newIndex; - public int Count => this._count; + public int Count => _count; } } diff --git a/UIX/Microsoft/Iris/ListContentsChangedProxy.cs b/UIX/Microsoft/Iris/ListContentsChangedProxy.cs index f5d37c6..a205d0a 100644 --- a/UIX/Microsoft/Iris/ListContentsChangedProxy.cs +++ b/UIX/Microsoft/Iris/ListContentsChangedProxy.cs @@ -59,7 +59,7 @@ namespace Microsoft.Iris throw new ArgumentException("Unexpected ListContentsChangeType"); } ListContentsChangedArgs args = new ListContentsChangedArgs(type, internalArgs.OldIndex, internalArgs.NewIndex, internalArgs.Count); - this._method(senderList, args); + _method(senderList, args); } } } diff --git a/UIX/Microsoft/Iris/ListDataSet.cs b/UIX/Microsoft/Iris/ListDataSet.cs index 7f5903b..f62c2e5 100644 --- a/UIX/Microsoft/Iris/ListDataSet.cs +++ b/UIX/Microsoft/Iris/ListDataSet.cs @@ -28,25 +28,25 @@ namespace Microsoft.Iris public ListDataSet(IModelItemOwner owner, IList source) : base(owner) - => this._sourceList = source; + => _sourceList = source; public IList Source { get { - using (this.ThreadValidator) - return this._sourceList; + using (ThreadValidator) + return _sourceList; } set { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._sourceList == value) + if (_sourceList == value) return; - this._sourceList = !(this._sourceList is IVirtualList) ? value : throw new ArgumentException(InvariantString.Format("ListDataSet does not support IVirtualList. Cannot associate with source list: {0}", value)); - this.FirePropertyChanged(nameof(Source)); - this.FirePropertyChanged("Count"); - this.FireSetChanged(UIListContentsChangeType.Reset, -1, -1); + _sourceList = !(_sourceList is IVirtualList) ? value : throw new ArgumentException(InvariantString.Format("ListDataSet does not support IVirtualList. Cannot associate with source list: {0}", value)); + FirePropertyChanged(nameof(Source)); + FirePropertyChanged("Count"); + FireSetChanged(UIListContentsChangeType.Reset, -1, -1); } } } @@ -55,8 +55,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._sourceList == null ? 0 : this._sourceList.Count; + using (ThreadValidator) + return _sourceList == null ? 0 : _sourceList.Count; } } @@ -64,8 +64,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._sourceList != null && this._sourceList.IsSynchronized; + using (ThreadValidator) + return _sourceList != null && _sourceList.IsSynchronized; } } @@ -73,8 +73,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._sourceList == null ? null : this._sourceList.SyncRoot; + using (ThreadValidator) + return _sourceList == null ? null : _sourceList.SyncRoot; } } @@ -82,8 +82,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._sourceList == null || this._sourceList.IsReadOnly; + using (ThreadValidator) + return _sourceList == null || _sourceList.IsReadOnly; } } @@ -91,8 +91,8 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._sourceList == null || this._sourceList.IsFixedSize; + using (ThreadValidator) + return _sourceList == null || _sourceList.IsFixedSize; } } @@ -100,127 +100,127 @@ namespace Microsoft.Iris { get { - using (this.ThreadValidator) - return this._sourceList == null ? null : this._sourceList[itemIndex]; + using (ThreadValidator) + return _sourceList == null ? null : _sourceList[itemIndex]; } set { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._sourceList == null) + if (_sourceList == null) throw new InvalidOperationException("Cannot use the this indexer without first specifying a Source for this ListDataSet."); - if (itemIndex < 0 || itemIndex >= this.Count) + if (itemIndex < 0 || itemIndex >= Count) throw new ArgumentOutOfRangeException(nameof(itemIndex), itemIndex, "Given index is out of the range of this list."); - if (this._sourceList[itemIndex] == value) + if (_sourceList[itemIndex] == value) return; - this._sourceList[itemIndex] = value; - this.FireSetChanged(UIListContentsChangeType.Modified, itemIndex, itemIndex); + _sourceList[itemIndex] = value; + FireSetChanged(UIListContentsChangeType.Modified, itemIndex, itemIndex); } } } public virtual void Clear() { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._sourceList == null) + if (_sourceList == null) return; - this._sourceList.Clear(); - this.FireSetChanged(UIListContentsChangeType.Clear, -1, -1); - this.FirePropertyChanged("Count"); + _sourceList.Clear(); + FireSetChanged(UIListContentsChangeType.Clear, -1, -1); + FirePropertyChanged("Count"); } } public virtual void CopyTo(Array array, int index) { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._sourceList == null) + if (_sourceList == null) throw new NotImplementedException("The \"CopyTo\" operation is not supported by this ListDataSet"); - this._sourceList.CopyTo(array, index); + _sourceList.CopyTo(array, index); } } public void CopyFrom(IEnumerable source) { - using (this.ThreadValidator) + using (ThreadValidator) { if (source == null) throw new ArgumentNullException(nameof(source)); foreach (object obj in source) - this.Add(obj); + Add(obj); } } public virtual IEnumerator GetEnumerator() { - using (this.ThreadValidator) - return this._sourceList != null ? this._sourceList.GetEnumerator() : throw new NotImplementedException("The \"GetEnumerator\" operation is not supported by this UIDataSet"); + using (ThreadValidator) + return _sourceList != null ? _sourceList.GetEnumerator() : throw new NotImplementedException("The \"GetEnumerator\" operation is not supported by this UIDataSet"); } public bool Contains(object item) { - using (this.ThreadValidator) - return this._sourceList != null && this._sourceList.Contains(item); + using (ThreadValidator) + return _sourceList != null && _sourceList.Contains(item); } public int IndexOf(object item) { - using (this.ThreadValidator) - return this._sourceList == null ? -1 : this._sourceList.IndexOf(item); + using (ThreadValidator) + return _sourceList == null ? -1 : _sourceList.IndexOf(item); } public void Remove(object item) { - using (this.ThreadValidator) + using (ThreadValidator) { - int index = this.IndexOf(item); + int index = IndexOf(item); if (index <= -1) return; - this.RemoveAt(index); + RemoveAt(index); } } public void RemoveAt(int index) { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._sourceList == null) + if (_sourceList == null) throw new ArgumentException(InvariantString.Format("Empty list cannot remove item at index {0}", index)); object obj = this[index]; - this._sourceList.RemoveAt(index); - this.FireSetChanged(UIListContentsChangeType.Remove, index, -1); - this.FirePropertyChanged("Count"); + _sourceList.RemoveAt(index); + FireSetChanged(UIListContentsChangeType.Remove, index, -1); + FirePropertyChanged("Count"); } } public void Move(int oldIndex, int newIndex) { - using (this.ThreadValidator) + using (ThreadValidator) { - if (this._sourceList == null) + if (_sourceList == null) throw new ArgumentException(InvariantString.Format("Empty list cannot move item from {0} to {1}", oldIndex, newIndex)); object obj = this[oldIndex]; - if (this._sourceList is INotifyList sourceList) + if (_sourceList is INotifyList sourceList) { sourceList.Move(oldIndex, newIndex); } else { - this._sourceList.RemoveAt(oldIndex); - this._sourceList.Insert(newIndex, obj); + _sourceList.RemoveAt(oldIndex); + _sourceList.Insert(newIndex, obj); } - this.FireSetChanged(UIListContentsChangeType.Move, oldIndex, newIndex); + FireSetChanged(UIListContentsChangeType.Move, oldIndex, newIndex); } } public int Reorder(IList indices, int newIndex) { - using (this.ThreadValidator) + using (ThreadValidator) { if (indices == null) throw new ArgumentNullException(nameof(indices)); - if (newIndex < 0 || newIndex > this.Count) + if (newIndex < 0 || newIndex > Count) throw new ArgumentOutOfRangeException(nameof(newIndex), "newIndex must be greater than 0 and less than or equal to the size of the collection"); int[] numArray = null; if (indices.IsReadOnly) @@ -230,7 +230,7 @@ namespace Microsoft.Iris { if (!(index2 is int num)) throw new ArgumentException("indices[" + index1 + "] does not contain an int", nameof(indices)); - if (num < 0 || num >= this.Count) + if (num < 0 || num >= Count) throw new ArgumentOutOfRangeException(nameof(indices), "indices[" + index1 + "] must be greater than 0 and less than the size of the collection"); if (numArray != null) numArray[index1] = num; @@ -249,7 +249,7 @@ namespace Microsoft.Iris } if (index3 != newIndex) { - this.Move(index3, newIndex); + Move(index3, newIndex); for (int index4 = index2 + 1; index4 < indices.Count; ++index4) { int index5 = (int)indices[index4]; @@ -269,49 +269,49 @@ namespace Microsoft.Iris public void Insert(int index, object item) { - using (this.ThreadValidator) + using (ThreadValidator) { - this._sourceList.Insert(index, item); - this.FireSetChanged(UIListContentsChangeType.Insert, -1, index); - this.FirePropertyChanged("Count"); + _sourceList.Insert(index, item); + FireSetChanged(UIListContentsChangeType.Insert, -1, index); + FirePropertyChanged("Count"); } } public int Add(object item) { - using (this.ThreadValidator) + using (ThreadValidator) { - int newIndex = this._sourceList != null ? this._sourceList.Add(item) : throw new ArgumentException("Empty list cannot add items."); - this.FireSetChanged(UIListContentsChangeType.Add, -1, newIndex); - this.FirePropertyChanged("Count"); + int newIndex = _sourceList != null ? _sourceList.Add(item) : throw new ArgumentException("Empty list cannot add items."); + FireSetChanged(UIListContentsChangeType.Add, -1, newIndex); + FirePropertyChanged("Count"); return newIndex; } } public void Sort(IComparer comparer) { - using (this.ThreadValidator) + using (ThreadValidator) { if (comparer == null) throw new ArgumentException("Must provide a valid IComparer"); - this.SortWorker(comparer); + SortWorker(comparer); } } public void Sort() { - using (this.ThreadValidator) - this.SortWorker(null); + using (ThreadValidator) + SortWorker(null); } private void SortWorker(IComparer cmp) { - for (int index1 = 0; index1 < this.Count; ++index1) + for (int index1 = 0; index1 < Count; ++index1) { - for (int index2 = index1 + 1; index2 < this.Count; ++index2) + for (int index2 = index1 + 1; index2 < Count; ++index2) { - if (this.Compare(this[index1], this[index2], cmp) > 0) - this.Move(index2, index1); + if (Compare(this[index1], this[index2], cmp) > 0) + Move(index2, index1); } } } @@ -327,13 +327,13 @@ namespace Microsoft.Iris { add { - using (this.ThreadValidator) - this.AddEventHandler(s_listContentsChangedEvent, value); + using (ThreadValidator) + AddEventHandler(s_listContentsChangedEvent, value); } remove { - using (this.ThreadValidator) - this.RemoveEventHandler(s_listContentsChangedEvent, value); + using (ThreadValidator) + RemoveEventHandler(s_listContentsChangedEvent, value); } } @@ -341,25 +341,25 @@ namespace Microsoft.Iris { add { - using (this.ThreadValidator) - this.AddEventHandler(s_listContentsChangedEvent, ListContentsChangedProxy.Thunk(value)); + using (ThreadValidator) + AddEventHandler(s_listContentsChangedEvent, ListContentsChangedProxy.Thunk(value)); } remove { - using (this.ThreadValidator) - this.RemoveEventHandler(s_listContentsChangedEvent, ListContentsChangedProxy.Thunk(value)); + using (ThreadValidator) + RemoveEventHandler(s_listContentsChangedEvent, ListContentsChangedProxy.Thunk(value)); } } internal void FireSetChanged(UIListContentsChangeType type, int oldIndex, int newIndex) { - UIListContentsChangedHandler eventHandler = (UIListContentsChangedHandler)this.GetEventHandler(s_listContentsChangedEvent); + UIListContentsChangedHandler eventHandler = (UIListContentsChangedHandler)GetEventHandler(s_listContentsChangedEvent); if (eventHandler != null) { UIListContentsChangedArgs args = new UIListContentsChangedArgs(type, oldIndex, newIndex); eventHandler(this, args); } - this.FirePropertyChanged("ContentsChanged"); + FirePropertyChanged("ContentsChanged"); } } } diff --git a/UIX/Microsoft/Iris/Markup/AliasMapping.cs b/UIX/Microsoft/Iris/Markup/AliasMapping.cs index ad18efc..3cd0268 100644 --- a/UIX/Microsoft/Iris/Markup/AliasMapping.cs +++ b/UIX/Microsoft/Iris/Markup/AliasMapping.cs @@ -14,9 +14,9 @@ namespace Microsoft.Iris.Markup public AliasMapping(string alias, LoadResult loadResult, string targetType) { - this.Alias = alias; - this.LoadResult = loadResult; - this.TargetType = targetType; + Alias = alias; + LoadResult = loadResult; + TargetType = targetType; } } } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyConstructorSchema.cs b/UIX/Microsoft/Iris/Markup/AssemblyConstructorSchema.cs index ec0c53b..d99d391 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyConstructorSchema.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyConstructorSchema.cs @@ -20,19 +20,19 @@ namespace Microsoft.Iris.Markup TypeSchema[] parameterTypes) : base(owner) { - this._constructorInfo = constructorInfo; - this._parameterTypes = parameterTypes; + _constructorInfo = constructorInfo; + _parameterTypes = parameterTypes; } - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; public override object Construct(object[] parameters) { object[] paramters = AssemblyLoadResult.UnwrapObjectList(parameters); - AssemblyTypeSchema owner = (AssemblyTypeSchema)this.Owner; - if (this._constructor == null) - this._constructor = ReflectionHelper.CreateMethodInvoke(_constructorInfo); - object instance = this._constructor(null, paramters); + AssemblyTypeSchema owner = (AssemblyTypeSchema)Owner; + if (_constructor == null) + _constructor = ReflectionHelper.CreateMethodInvoke(_constructorInfo); + object instance = _constructor(null, paramters); return AssemblyLoadResult.WrapObject(owner, instance); } } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyEventSchema.cs b/UIX/Microsoft/Iris/Markup/AssemblyEventSchema.cs index 432c6d1..9d0be86 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyEventSchema.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyEventSchema.cs @@ -14,8 +14,8 @@ namespace Microsoft.Iris.Markup public AssemblyEventSchema(AssemblyTypeSchema owner, EventInfo eventInfo) : base(owner) - => this._eventInfo = eventInfo; + => _eventInfo = eventInfo; - public override string Name => this._eventInfo.Name; + public override string Name => _eventInfo.Name; } } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyLoadResult.cs b/UIX/Microsoft/Iris/Markup/AssemblyLoadResult.cs index b07c2fe..1bcdcc4 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyLoadResult.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyLoadResult.cs @@ -165,13 +165,13 @@ namespace Microsoft.Iris.Markup s_typeCache = null; } - public string Namespace => this._namespace; + public string Namespace => _namespace; public override LoadResultStatus Status => LoadResultStatus.Success; public override TypeSchema FindType(string name) { - Type type = this._assembly.GetType(this._namespacePrefix + name, false); + Type type = _assembly.GetType(_namespacePrefix + name, false); if (type == null) return null; if (type.IsVisible) @@ -315,16 +315,16 @@ namespace Microsoft.Iris.Markup public override string GetCompilerReferenceName() => base.GetCompilerReferenceName() ?? string.Format("{0}{1}/{2}", "assembly://", _assembly.GetName().Name, _namespace); - internal Assembly Assembly => this._assembly; + internal Assembly Assembly => _assembly; private AssemblyLoadResult(Assembly assembly, string ns, string uri) : base(uri) { - this._assembly = assembly; - this._namespace = ns; + _assembly = assembly; + _namespace = ns; if (ns == null) return; - this._namespacePrefix = ns + "."; + _namespacePrefix = ns + "."; } internal struct MapAssemblyKey @@ -334,21 +334,21 @@ namespace Microsoft.Iris.Markup public MapAssemblyKey(Assembly assembly, string ns) { - this._assembly = assembly; - this._namespace = ns; + _assembly = assembly; + _namespace = ns; } public override bool Equals(object obj) { AssemblyLoadResult.MapAssemblyKey mapAssemblyKey = (AssemblyLoadResult.MapAssemblyKey)obj; - return this._assembly == mapAssemblyKey._assembly && this._namespace == mapAssemblyKey._namespace; + return _assembly == mapAssemblyKey._assembly && _namespace == mapAssemblyKey._namespace; } public override int GetHashCode() { - int hashCode = this._assembly.GetHashCode(); - if (this._namespace != null) - hashCode ^= this._namespace.GetHashCode(); + int hashCode = _assembly.GetHashCode(); + if (_namespace != null) + hashCode ^= _namespace.GetHashCode(); return hashCode; } } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataQuery.cs b/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataQuery.cs index 24d2041..254626d 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataQuery.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataQuery.cs @@ -15,47 +15,47 @@ namespace Microsoft.Iris.Markup public AssemblyMarkupDataQuery(MarkupDataQuerySchema type, AssemblyDataProviderWrapper provider) : base(type) { - this._externalQuery = provider.ConstructQuery(type); - this._externalQuery.DeclareOwner(this); - this._externalQuery.SetInternalObject(this); - this.ApplyDefaultValues(); + _externalQuery = provider.ConstructQuery(type); + _externalQuery.DeclareOwner(this); + _externalQuery.SetInternalObject(this); + ApplyDefaultValues(); } public override void NotifyInitialized() { base.NotifyInitialized(); - if (this._externalQuery == null) + if (_externalQuery == null) return; - this._externalQuery.OnInitialize(); + _externalQuery.OnInitialize(); } protected override void OnDispose() { base.OnDispose(); - if (this._externalQuery == null) + if (_externalQuery == null) return; - this._externalQuery.Dispose(this); + _externalQuery.Dispose(this); } - public override void Refresh() => this._externalQuery.Refresh(); + public override void Refresh() => _externalQuery.Refresh(); public override object Result { - get => AssemblyLoadResult.WrapObject(this._externalQuery.Result); - set => this._externalQuery.Result = AssemblyLoadResult.UnwrapObject(value); + get => AssemblyLoadResult.WrapObject(_externalQuery.Result); + set => _externalQuery.Result = AssemblyLoadResult.UnwrapObject(value); } - public override DataProviderQueryStatus Status => this._externalQuery.Status; + public override DataProviderQueryStatus Status => _externalQuery.Status; public override bool Enabled { - get => this._externalQuery.Enabled; - set => this._externalQuery.Enabled = value; + get => _externalQuery.Enabled; + set => _externalQuery.Enabled = value; } protected override bool ExternalObjectGetProperty(string propertyName, out object value) { - object property = this._externalQuery.GetProperty(propertyName); + object property = _externalQuery.GetProperty(propertyName); value = AssemblyLoadResult.WrapObject(property); return true; } @@ -63,7 +63,7 @@ namespace Microsoft.Iris.Markup protected override bool ExternalObjectSetProperty(string propertyName, object value) { object obj = AssemblyLoadResult.UnwrapObject(value); - this._externalQuery.SetProperty(propertyName, obj); + _externalQuery.SetProperty(propertyName, obj); return true; } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataType.cs b/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataType.cs index ffa5c3a..85b65ba 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataType.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyMarkupDataType.cs @@ -14,11 +14,11 @@ namespace Microsoft.Iris.Markup public AssemblyMarkupDataType(MarkupDataTypeSchema type, IDataProviderObject externalObject) : base(type) - => this._externalObject = externalObject; + => _externalObject = externalObject; protected override bool ExternalObjectGetProperty(string propertyName, out object value) { - object property = this._externalObject.GetProperty(propertyName); + object property = _externalObject.GetProperty(propertyName); value = AssemblyLoadResult.WrapObject(property); return true; } @@ -26,7 +26,7 @@ namespace Microsoft.Iris.Markup protected override bool ExternalObjectSetProperty(string propertyName, object value) { object obj = AssemblyLoadResult.UnwrapObject(value); - this._externalObject.SetProperty(propertyName, obj); + _externalObject.SetProperty(propertyName, obj); return true; } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyMethodSchema.cs b/UIX/Microsoft/Iris/Markup/AssemblyMethodSchema.cs index a3f3141..89f7ca6 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyMethodSchema.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyMethodSchema.cs @@ -21,26 +21,26 @@ namespace Microsoft.Iris.Markup TypeSchema[] parameterTypes) : base(owner) { - this._methodInfo = methodInfo; - this._parameterTypes = parameterTypes; - this._returnTypeSchema = AssemblyLoadResult.MapType(this._methodInfo.ReturnType); + _methodInfo = methodInfo; + _parameterTypes = parameterTypes; + _returnTypeSchema = AssemblyLoadResult.MapType(_methodInfo.ReturnType); } - public override string Name => this._methodInfo.Name; + public override string Name => _methodInfo.Name; - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; - public override TypeSchema ReturnType => this._returnTypeSchema; + public override TypeSchema ReturnType => _returnTypeSchema; - public override bool IsStatic => this._methodInfo.IsStatic; + public override bool IsStatic => _methodInfo.IsStatic; public override object Invoke(object instance, object[] parameters) { object target = AssemblyLoadResult.UnwrapObject(instance); object[] paramters = AssemblyLoadResult.UnwrapObjectList(parameters); - if (this._method == null) - this._method = ReflectionHelper.CreateMethodInvoke(_methodInfo); - return AssemblyLoadResult.WrapObject(this._returnTypeSchema, this._method(target, paramters)); + if (_method == null) + _method = ReflectionHelper.CreateMethodInvoke(_methodInfo); + return AssemblyLoadResult.WrapObject(_returnTypeSchema, _method(target, paramters)); } } } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyObjectProxyHelper.cs b/UIX/Microsoft/Iris/Markup/AssemblyObjectProxyHelper.cs index cd1ae3c..a89bda7 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyObjectProxyHelper.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyObjectProxyHelper.cs @@ -135,11 +135,11 @@ namespace Microsoft.Iris.Markup { this.type = type; this.proxyType = proxyType; - this.equivalents = null; + equivalents = null; if (equivalence == null) return; - this.equivalents = new Vector(1); - this.equivalents.Add(equivalence); + equivalents = new Vector(1); + equivalents.Add(equivalence); } } @@ -152,9 +152,9 @@ namespace Microsoft.Iris.Markup { private object _frameworkObject; - public WrappedFrameworkObject(object frameworkObject) => this._frameworkObject = frameworkObject; + public WrappedFrameworkObject(object frameworkObject) => _frameworkObject = frameworkObject; - public object FrameworkObject => this._frameworkObject; + public object FrameworkObject => _frameworkObject; } public interface IAssemblyProxyObject @@ -175,78 +175,78 @@ namespace Microsoft.Iris.Markup private bool _hasPropertyChangedHandlerAttached; private NotifyService _notifier = new NotifyService(); - public ProxyObject(object assemblyObject) => this._assemblyObject = assemblyObject; + public ProxyObject(object assemblyObject) => _assemblyObject = assemblyObject; - public void SetIntrinsicState(bool isDisposable, bool notifiesOnChange) => this._isDisposable = isDisposable; + public void SetIntrinsicState(bool isDisposable, bool notifiesOnChange) => _isDisposable = isDisposable; protected override void OnDispose() { - if (this._hasPropertyChangedHandlerAttached) + if (_hasPropertyChangedHandlerAttached) { - ((INotifyPropertyChanged)this._assemblyObject).PropertyChanged -= new PropertyChangedEventHandler(this.OnPropertyChanged); - this._hasPropertyChangedHandlerAttached = false; + ((INotifyPropertyChanged)_assemblyObject).PropertyChanged -= new PropertyChangedEventHandler(OnPropertyChanged); + _hasPropertyChangedHandlerAttached = false; } - this._notifier.ClearListeners(); - if (this._isDisposable && (!(this._assemblyObject is ModelItem) || this._isModelItemOwner)) - ((IDisposable)this._assemblyObject).Dispose(); + _notifier.ClearListeners(); + if (_isDisposable && (!(_assemblyObject is ModelItem) || _isModelItemOwner)) + ((IDisposable)_assemblyObject).Dispose(); base.OnDispose(); } protected override void OnOwnerDeclared(object owner) { base.OnOwnerDeclared(owner); - if (!(this._assemblyObject is ModelItem assemblyObject)) + if (!(_assemblyObject is ModelItem assemblyObject)) return; assemblyObject.Owner = this; } public void AddListener(Listener listener) { - if (!this._hasPropertyChangedHandlerAttached) + if (!_hasPropertyChangedHandlerAttached) { - ((INotifyPropertyChanged)this._assemblyObject).PropertyChanged += new PropertyChangedEventHandler(this.OnPropertyChanged); - this._hasPropertyChangedHandlerAttached = true; + ((INotifyPropertyChanged)_assemblyObject).PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged); + _hasPropertyChangedHandlerAttached = true; } - this._notifier.AddListener(listener); + _notifier.AddListener(listener); } private void OnPropertyChanged(object sender, PropertyChangedEventArgs args) { - this._notifier.FireThreadSafe(args.PropertyName); - if (this._notifier.HasListeners) + _notifier.FireThreadSafe(args.PropertyName); + if (_notifier.HasListeners) return; - ((INotifyPropertyChanged)this._assemblyObject).PropertyChanged -= new PropertyChangedEventHandler(this.OnPropertyChanged); - this._hasPropertyChangedHandlerAttached = false; + ((INotifyPropertyChanged)_assemblyObject).PropertyChanged -= new PropertyChangedEventHandler(OnPropertyChanged); + _hasPropertyChangedHandlerAttached = false; } public void RegisterObject(ModelItem modelItem) { - if (modelItem != this._assemblyObject) + if (modelItem != _assemblyObject) throw new ArgumentException("Unexpected model item provided for ownership registration"); - this._isModelItemOwner = true; + _isModelItemOwner = true; } public void UnregisterObject(ModelItem modelItem) { - if (!this._isModelItemOwner || modelItem != this._assemblyObject) + if (!_isModelItemOwner || modelItem != _assemblyObject) throw new ArgumentException("Unexpected model item provided for ownership unregistration"); - this._isModelItemOwner = false; + _isModelItemOwner = false; } - public object AssemblyObject => this._assemblyObject; + public object AssemblyObject => _assemblyObject; - public TypeSchema TypeSchema => AssemblyLoadResult.MapType(this._assemblyObject.GetType()); + public TypeSchema TypeSchema => AssemblyLoadResult.MapType(_assemblyObject.GetType()); public override bool Equals(object rhs) { if (rhs is AssemblyObjectProxyHelper.IAssemblyProxyObject) rhs = ((AssemblyObjectProxyHelper.IAssemblyProxyObject)rhs).AssemblyObject; - return this._assemblyObject.Equals(rhs); + return _assemblyObject.Equals(rhs); } - public override int GetHashCode() => this._assemblyObject.GetHashCode(); + public override int GetHashCode() => _assemblyObject.GetHashCode(); - public override string ToString() => this._assemblyObject.ToString(); + public override string ToString() => _assemblyObject.ToString(); } private class ProxyCommand : AssemblyObjectProxyHelper.ProxyObject, IUICommand @@ -256,19 +256,19 @@ namespace Microsoft.Iris.Markup { } - protected ICommand ExternalCommand => (ICommand)this._assemblyObject; + protected ICommand ExternalCommand => (ICommand)_assemblyObject; public bool Available { - get => this.ExternalCommand.Available; - set => this.ExternalCommand.Available = value; + get => ExternalCommand.Available; + set => ExternalCommand.Available = value; } public InvokePriority Priority { get { - switch (this.ExternalCommand.Priority) + switch (ExternalCommand.Priority) { case InvokePolicy.Synchronous: case InvokePolicy.AsynchronousNormal: @@ -280,13 +280,13 @@ namespace Microsoft.Iris.Markup set { if (value == InvokePriority.Normal) - this.ExternalCommand.Priority = InvokePolicy.AsynchronousNormal; + ExternalCommand.Priority = InvokePolicy.AsynchronousNormal; else - this.ExternalCommand.Priority = InvokePolicy.AsynchronousLowPri; + ExternalCommand.Priority = InvokePolicy.AsynchronousLowPri; } } - public void Invoke() => this.ExternalCommand.Invoke(); + public void Invoke() => ExternalCommand.Invoke(); } private class ProxyValueRange : AssemblyObjectProxyHelper.ProxyObject, IUIValueRange @@ -296,17 +296,17 @@ namespace Microsoft.Iris.Markup { } - protected IValueRange ExternalRange => (IValueRange)this._assemblyObject; + protected IValueRange ExternalRange => (IValueRange)_assemblyObject; - public object ObjectValue => AssemblyLoadResult.WrapObject(this.ExternalRange.Value); + public object ObjectValue => AssemblyLoadResult.WrapObject(ExternalRange.Value); - public bool HasPreviousValue => this.ExternalRange.HasPreviousValue; + public bool HasPreviousValue => ExternalRange.HasPreviousValue; - public bool HasNextValue => this.ExternalRange.HasNextValue; + public bool HasNextValue => ExternalRange.HasNextValue; - public void PreviousValue() => this.ExternalRange.PreviousValue(); + public void PreviousValue() => ExternalRange.PreviousValue(); - public void NextValue() => this.ExternalRange.NextValue(); + public void NextValue() => ExternalRange.NextValue(); } private class ProxyList : @@ -320,61 +320,61 @@ namespace Microsoft.Iris.Markup public ProxyList(object assemblyObject) : base(assemblyObject) - => this._canSearch = assemblyObject is ISearchableList; + => _canSearch = assemblyObject is ISearchableList; - protected IList ExternalList => (IList)this._assemblyObject; + protected IList ExternalList => (IList)_assemblyObject; - public int Add(object value) => this.ExternalList.Add(AssemblyLoadResult.UnwrapObject(value)); + public int Add(object value) => ExternalList.Add(AssemblyLoadResult.UnwrapObject(value)); - public void Clear() => this.ExternalList.Clear(); + public void Clear() => ExternalList.Clear(); - public bool Contains(object value) => this.ExternalList.Contains(AssemblyLoadResult.UnwrapObject(value)); + public bool Contains(object value) => ExternalList.Contains(AssemblyLoadResult.UnwrapObject(value)); - public int IndexOf(object value) => this.ExternalList.IndexOf(AssemblyLoadResult.UnwrapObject(value)); + public int IndexOf(object value) => ExternalList.IndexOf(AssemblyLoadResult.UnwrapObject(value)); - public void Insert(int index, object value) => this.ExternalList.Insert(index, AssemblyLoadResult.UnwrapObject(value)); + public void Insert(int index, object value) => ExternalList.Insert(index, AssemblyLoadResult.UnwrapObject(value)); - public bool IsFixedSize => this.ExternalList.IsFixedSize; + public bool IsFixedSize => ExternalList.IsFixedSize; - public bool IsReadOnly => this.ExternalList.IsReadOnly; + public bool IsReadOnly => ExternalList.IsReadOnly; - public void Remove(object value) => this.ExternalList.Remove(AssemblyLoadResult.UnwrapObject(value)); + public void Remove(object value) => ExternalList.Remove(AssemblyLoadResult.UnwrapObject(value)); - public void RemoveAt(int index) => this.ExternalList.RemoveAt(index); + public void RemoveAt(int index) => ExternalList.RemoveAt(index); public object this[int index] { - get => AssemblyLoadResult.WrapObject(this.ExternalList[index]); - set => this.ExternalList[index] = AssemblyLoadResult.UnwrapObject(value); + get => AssemblyLoadResult.WrapObject(ExternalList[index]); + set => ExternalList[index] = AssemblyLoadResult.UnwrapObject(value); } public void CopyTo(Array array, int index) { int index1 = index; - for (int index2 = 0; index2 < this.ExternalList.Count; ++index2) + for (int index2 = 0; index2 < ExternalList.Count; ++index2) { - array.SetValue(AssemblyLoadResult.WrapObject(this.ExternalList[index2]), index1); + array.SetValue(AssemblyLoadResult.WrapObject(ExternalList[index2]), index1); ++index1; } } - public int Count => this.ExternalList.Count; + public int Count => ExternalList.Count; - public bool IsSynchronized => this.ExternalList.IsSynchronized; + public bool IsSynchronized => ExternalList.IsSynchronized; - public object SyncRoot => this.ExternalList.SyncRoot; + public object SyncRoot => ExternalList.SyncRoot; - public IEnumerator GetEnumerator() => new AssemblyObjectProxyHelper.ProxyListEnumerator(this.ExternalList.GetEnumerator()); + public IEnumerator GetEnumerator() => new AssemblyObjectProxyHelper.ProxyListEnumerator(ExternalList.GetEnumerator()); - public bool CanSearch => this._canSearch; + public bool CanSearch => _canSearch; - public int SearchForString(string searchString) => this._canSearch ? ((ISearchableList)this.ExternalList).SearchForString(searchString) : -1; + public int SearchForString(string searchString) => _canSearch ? ((ISearchableList)ExternalList).SearchForString(searchString) : -1; public virtual void Move(int oldIndex, int newIndex) { - object external = this.ExternalList[oldIndex]; - this.RemoveAt(oldIndex); - this.Insert(newIndex, external); + object external = ExternalList[oldIndex]; + RemoveAt(oldIndex); + Insert(newIndex, external); } } @@ -382,13 +382,13 @@ namespace Microsoft.Iris.Markup { private IEnumerator _assemblyEnumerator; - public ProxyListEnumerator(object assemblyObject) => this._assemblyEnumerator = (IEnumerator)assemblyObject; + public ProxyListEnumerator(object assemblyObject) => _assemblyEnumerator = (IEnumerator)assemblyObject; - public bool MoveNext() => this._assemblyEnumerator.MoveNext(); + public bool MoveNext() => _assemblyEnumerator.MoveNext(); - public void Reset() => this._assemblyEnumerator.Reset(); + public void Reset() => _assemblyEnumerator.Reset(); - public object Current => AssemblyLoadResult.WrapObject(this._assemblyEnumerator.Current); + public object Current => AssemblyLoadResult.WrapObject(_assemblyEnumerator.Current); public object AssemblyObject => _assemblyEnumerator; } @@ -406,43 +406,43 @@ namespace Microsoft.Iris.Markup public ProxyNotifyList(object assemblyObject, bool isNotifyList) : base(assemblyObject) - => this._isNotifyList = isNotifyList; + => _isNotifyList = isNotifyList; public ProxyNotifyList(object assemblyObject) : this(assemblyObject, true) { } - protected INotifyList ExternalNotifyList => (INotifyList)this._assemblyObject; + protected INotifyList ExternalNotifyList => (INotifyList)_assemblyObject; - public override void Move(int oldIndex, int newIndex) => this.ExternalNotifyList.Move(oldIndex, newIndex); + public override void Move(int oldIndex, int newIndex) => ExternalNotifyList.Move(oldIndex, newIndex); public event UIListContentsChangedHandler ContentsChanged { add { - if (!this._isNotifyList) + if (!_isNotifyList) return; - if (this._listContentsChangedHandler == null) + if (_listContentsChangedHandler == null) { - this._listContentsChangedHandler = new UIListContentsChangedHandler(this.OnListContentsChanged); - this.ExternalNotifyList.ContentsChanged += this._listContentsChangedHandler; + _listContentsChangedHandler = new UIListContentsChangedHandler(OnListContentsChanged); + ExternalNotifyList.ContentsChanged += _listContentsChangedHandler; } - this._handlersAttachedToMe = Delegate.Combine(this._handlersAttachedToMe, value); + _handlersAttachedToMe = Delegate.Combine(_handlersAttachedToMe, value); } remove { - if (!this._isNotifyList) + if (!_isNotifyList) return; - this._handlersAttachedToMe = Delegate.Remove(this._handlersAttachedToMe, value); - if ((object)this._handlersAttachedToMe != null) + _handlersAttachedToMe = Delegate.Remove(_handlersAttachedToMe, value); + if ((object)_handlersAttachedToMe != null) return; - this.ExternalNotifyList.ContentsChanged -= this._listContentsChangedHandler; - this._listContentsChangedHandler = null; + ExternalNotifyList.ContentsChanged -= _listContentsChangedHandler; + _listContentsChangedHandler = null; } } - private void OnListContentsChanged(IList senderList, UIListContentsChangedArgs args) => ((UIListContentsChangedHandler)this._handlersAttachedToMe)(this, args); + private void OnListContentsChanged(IList senderList, UIListContentsChangedArgs args) => ((UIListContentsChangedHandler)_handlersAttachedToMe)(this, args); } private class ProxyVirtualNotifyList : @@ -461,44 +461,44 @@ namespace Microsoft.Iris.Markup { } - protected IVirtualList ExternalVirtualList => (IVirtualList)this._assemblyObject; + protected IVirtualList ExternalVirtualList => (IVirtualList)_assemblyObject; public void RequestItem(int index, ItemRequestCallback callback) { - if (this._itemCallbacks == null) - this._itemCallbacks = new Dictionary(); - this._itemCallbacks[index] = callback; - if (this._onItemGeneratedCallback == null) - this._onItemGeneratedCallback = new ItemRequestCallback(this.OnItemGenerated); - this.ExternalVirtualList.RequestItem(index, this._onItemGeneratedCallback); + if (_itemCallbacks == null) + _itemCallbacks = new Dictionary(); + _itemCallbacks[index] = callback; + if (_onItemGeneratedCallback == null) + _onItemGeneratedCallback = new ItemRequestCallback(OnItemGenerated); + ExternalVirtualList.RequestItem(index, _onItemGeneratedCallback); } - public bool IsItemAvailable(int index) => this.ExternalVirtualList.IsItemAvailable(index); + public bool IsItemAvailable(int index) => ExternalVirtualList.IsItemAvailable(index); - public void NotifyVisualsCreated(int index) => this.ExternalVirtualList.NotifyVisualsCreated(index); + public void NotifyVisualsCreated(int index) => ExternalVirtualList.NotifyVisualsCreated(index); - public void NotifyVisualsReleased(int index) => this.ExternalVirtualList.NotifyVisualsReleased(index); + public void NotifyVisualsReleased(int index) => ExternalVirtualList.NotifyVisualsReleased(index); - public bool SlowDataRequestsEnabled => this.ExternalVirtualList.SlowDataRequestsEnabled; + public bool SlowDataRequestsEnabled => ExternalVirtualList.SlowDataRequestsEnabled; - public void NotifyRequestSlowData(int index) => this.ExternalVirtualList.NotifyRequestSlowData(index); + public void NotifyRequestSlowData(int index) => ExternalVirtualList.NotifyRequestSlowData(index); public Repeater RepeaterHost { - get => this.ExternalVirtualList.RepeaterHost; - set => this.ExternalVirtualList.RepeaterHost = value; + get => ExternalVirtualList.RepeaterHost; + set => ExternalVirtualList.RepeaterHost = value; } public SlowDataAcquireCompleteHandler SlowDataAcquireCompleteHandler { - get => this.ExternalVirtualList.SlowDataAcquireCompleteHandler; - set => this.ExternalVirtualList.SlowDataAcquireCompleteHandler = value; + get => ExternalVirtualList.SlowDataAcquireCompleteHandler; + set => ExternalVirtualList.SlowDataAcquireCompleteHandler = value; } private void OnItemGenerated(object sender, int index, object item) { - ItemRequestCallback itemCallback = (ItemRequestCallback)this._itemCallbacks[index]; - this._itemCallbacks.Remove(index); + ItemRequestCallback itemCallback = (ItemRequestCallback)_itemCallbacks[index]; + _itemCallbacks.Remove(index); itemCallback(this, index, AssemblyLoadResult.WrapObject(item)); } } @@ -515,11 +515,11 @@ namespace Microsoft.Iris.Markup { } - protected Group ExternalGroup => (Group)this._assemblyObject; + protected Group ExternalGroup => (Group)_assemblyObject; - public int StartIndex => this.ExternalGroup.StartIndex; + public int StartIndex => ExternalGroup.StartIndex; - public int EndIndex => this.ExternalGroup.EndIndex; + public int EndIndex => ExternalGroup.EndIndex; } private class ProxyDictionary : @@ -533,11 +533,11 @@ namespace Microsoft.Iris.Markup { } - protected IDictionary ExternalDictionary => (IDictionary)this._assemblyObject; + protected IDictionary ExternalDictionary => (IDictionary)_assemblyObject; - public bool IsReadOnly => this.ExternalDictionary.IsReadOnly; + public bool IsReadOnly => ExternalDictionary.IsReadOnly; - public bool Contains(object key) => this.ExternalDictionary.Contains(AssemblyLoadResult.WrapObject(key)); + public bool Contains(object key) => ExternalDictionary.Contains(AssemblyLoadResult.WrapObject(key)); public bool IsFixedSize => false; @@ -545,9 +545,9 @@ namespace Microsoft.Iris.Markup { } - public void Clear() => this.ExternalDictionary.Clear(); + public void Clear() => ExternalDictionary.Clear(); - public void Add(object key, object value) => this.ExternalDictionary.Add(AssemblyLoadResult.WrapObject(key), AssemblyLoadResult.WrapObject(value)); + public void Add(object key, object value) => ExternalDictionary.Add(AssemblyLoadResult.WrapObject(key), AssemblyLoadResult.WrapObject(value)); public ICollection Keys => (ICollection)null; @@ -555,15 +555,15 @@ namespace Microsoft.Iris.Markup public object this[object key] { - get => AssemblyLoadResult.UnwrapObject(this.ExternalDictionary[AssemblyLoadResult.WrapObject(key)]); - set => this.ExternalDictionary[AssemblyLoadResult.WrapObject(key)] = AssemblyLoadResult.WrapObject(value); + get => AssemblyLoadResult.UnwrapObject(ExternalDictionary[AssemblyLoadResult.WrapObject(key)]); + set => ExternalDictionary[AssemblyLoadResult.WrapObject(key)] = AssemblyLoadResult.WrapObject(value); } public void CopyTo(Array array, int index) { } - public int Count => this.ExternalDictionary.Count; + public int Count => ExternalDictionary.Count; public bool IsSynchronized => false; @@ -582,51 +582,51 @@ namespace Microsoft.Iris.Markup { private IList _uixList; - public ReverseProxyList(IList uixList) => this._uixList = uixList; + public ReverseProxyList(IList uixList) => _uixList = uixList; public object FrameworkObject => _uixList; - public int Add(object value) => this._uixList.Add(AssemblyLoadResult.WrapObject(value)); + public int Add(object value) => _uixList.Add(AssemblyLoadResult.WrapObject(value)); - public void Clear() => this._uixList.Clear(); + public void Clear() => _uixList.Clear(); - public bool Contains(object value) => this._uixList.Contains(AssemblyLoadResult.WrapObject(value)); + public bool Contains(object value) => _uixList.Contains(AssemblyLoadResult.WrapObject(value)); - public int IndexOf(object value) => this._uixList.IndexOf(AssemblyLoadResult.WrapObject(value)); + public int IndexOf(object value) => _uixList.IndexOf(AssemblyLoadResult.WrapObject(value)); - public void Insert(int index, object value) => this._uixList.Insert(index, AssemblyLoadResult.WrapObject(value)); + public void Insert(int index, object value) => _uixList.Insert(index, AssemblyLoadResult.WrapObject(value)); - public bool IsFixedSize => this._uixList.IsFixedSize; + public bool IsFixedSize => _uixList.IsFixedSize; - public bool IsReadOnly => this._uixList.IsReadOnly; + public bool IsReadOnly => _uixList.IsReadOnly; - public void Remove(object value) => this._uixList.Remove(AssemblyLoadResult.WrapObject(value)); + public void Remove(object value) => _uixList.Remove(AssemblyLoadResult.WrapObject(value)); - public void RemoveAt(int index) => this._uixList.RemoveAt(index); + public void RemoveAt(int index) => _uixList.RemoveAt(index); public object this[int index] { - get => AssemblyLoadResult.UnwrapObject(this._uixList[index]); - set => this._uixList[index] = AssemblyLoadResult.WrapObject(value); + get => AssemblyLoadResult.UnwrapObject(_uixList[index]); + set => _uixList[index] = AssemblyLoadResult.WrapObject(value); } public void CopyTo(Array array, int index) { int index1 = index; - for (int index2 = 0; index2 < this._uixList.Count; ++index2) + for (int index2 = 0; index2 < _uixList.Count; ++index2) { - array.SetValue(AssemblyLoadResult.UnwrapObject(this._uixList[index2]), index1); + array.SetValue(AssemblyLoadResult.UnwrapObject(_uixList[index2]), index1); ++index1; } } - public int Count => this._uixList.Count; + public int Count => _uixList.Count; - public bool IsSynchronized => this._uixList.IsSynchronized; + public bool IsSynchronized => _uixList.IsSynchronized; - public object SyncRoot => this._uixList.SyncRoot; + public object SyncRoot => _uixList.SyncRoot; - public IEnumerator GetEnumerator() => new AssemblyObjectProxyHelper.ReverseProxyListEnumerator(this._uixList.GetEnumerator()); + public IEnumerator GetEnumerator() => new AssemblyObjectProxyHelper.ReverseProxyListEnumerator(_uixList.GetEnumerator()); } private class ReverseProxyListEnumerator : @@ -635,13 +635,13 @@ namespace Microsoft.Iris.Markup { private IEnumerator _uixEnumerator; - public ReverseProxyListEnumerator(IEnumerator uixEnumerator) => this._uixEnumerator = uixEnumerator; + public ReverseProxyListEnumerator(IEnumerator uixEnumerator) => _uixEnumerator = uixEnumerator; - public bool MoveNext() => this._uixEnumerator.MoveNext(); + public bool MoveNext() => _uixEnumerator.MoveNext(); - public void Reset() => this._uixEnumerator.Reset(); + public void Reset() => _uixEnumerator.Reset(); - public object Current => AssemblyLoadResult.UnwrapObject(this._uixEnumerator.Current); + public object Current => AssemblyLoadResult.UnwrapObject(_uixEnumerator.Current); public object FrameworkObject => _uixEnumerator; } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyPropertySchema.cs b/UIX/Microsoft/Iris/Markup/AssemblyPropertySchema.cs index 983f37d..602dde8 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyPropertySchema.cs @@ -20,22 +20,22 @@ namespace Microsoft.Iris.Markup public AssemblyPropertySchema(AssemblyTypeSchema owner, PropertyInfo propertyInfo) : base(owner) { - this._propertyInfo = propertyInfo; - this._propertyTypeSchema = AssemblyLoadResult.MapType(this._propertyInfo.PropertyType); - this._isStatic = (this._propertyInfo.GetGetMethod() ?? this._propertyInfo.GetSetMethod()).IsStatic; + _propertyInfo = propertyInfo; + _propertyTypeSchema = AssemblyLoadResult.MapType(_propertyInfo.PropertyType); + _isStatic = (_propertyInfo.GetGetMethod() ?? _propertyInfo.GetSetMethod()).IsStatic; } - public override string Name => this._propertyInfo.Name; + public override string Name => _propertyInfo.Name; - public override TypeSchema PropertyType => this._propertyTypeSchema; + public override TypeSchema PropertyType => _propertyTypeSchema; public override TypeSchema AlternateType => (TypeSchema)null; - public override bool CanRead => this._propertyInfo.CanRead; + public override bool CanRead => _propertyInfo.CanRead; - public override bool CanWrite => this._propertyInfo.CanWrite; + public override bool CanWrite => _propertyInfo.CanWrite; - public override bool IsStatic => this._isStatic; + public override bool IsStatic => _isStatic; public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None; @@ -47,31 +47,31 @@ namespace Microsoft.Iris.Markup { get { - AssemblyTypeSchema owner = (AssemblyTypeSchema)this.Owner; - return !this._isStatic && owner.NotifiesOnChange; + AssemblyTypeSchema owner = (AssemblyTypeSchema)Owner; + return !_isStatic && owner.NotifiesOnChange; } } public override object GetValue(object instance) { object target = AssemblyLoadResult.UnwrapObject(instance); - if (this._getMethod == null) - this._getMethod = ReflectionHelper.CreateMethodInvoke(this._propertyInfo.GetGetMethod()); - return AssemblyLoadResult.WrapObject(this._propertyTypeSchema, this._getMethod(target, null)); + if (_getMethod == null) + _getMethod = ReflectionHelper.CreateMethodInvoke(_propertyInfo.GetGetMethod()); + return AssemblyLoadResult.WrapObject(_propertyTypeSchema, _getMethod(target, null)); } public override void SetValue(ref object instance, object value) { object target = AssemblyLoadResult.UnwrapObject(instance); object obj1 = AssemblyLoadResult.UnwrapObject(value); - if (this._setMethod == null) + if (_setMethod == null) { - this._setMethod = ReflectionHelper.CreateMethodInvoke(this._propertyInfo.GetSetMethod()); - this._setMethodParams = new object[1]; + _setMethod = ReflectionHelper.CreateMethodInvoke(_propertyInfo.GetSetMethod()); + _setMethodParams = new object[1]; } - this._setMethodParams[0] = obj1; - object obj2 = this._setMethod(target, this._setMethodParams); - this._setMethodParams[0] = null; + _setMethodParams[0] = obj1; + object obj2 = _setMethod(target, _setMethodParams); + _setMethodParams[0] = null; } } } diff --git a/UIX/Microsoft/Iris/Markup/AssemblyTypeSchema.cs b/UIX/Microsoft/Iris/Markup/AssemblyTypeSchema.cs index 95878b7..86bfe09 100644 --- a/UIX/Microsoft/Iris/Markup/AssemblyTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/AssemblyTypeSchema.cs @@ -29,23 +29,23 @@ namespace Microsoft.Iris.Markup protected AssemblyTypeSchema(Type type, TypeSchema baseType) : base(AssemblyLoadResult.MapAssembly(type.Assembly, type.Namespace)) { - this._type = type; - this._baseType = baseType; - this._isFrameworkEnum = type.IsEnum && Enum.GetUnderlyingType(type) == typeof(int); - this._notifiesOnChange = typeof(INotifyPropertyChanged).IsAssignableFrom(this._type); - this._isDisposable = typeof(IDisposable).IsAssignableFrom(this._type); + _type = type; + _baseType = baseType; + _isFrameworkEnum = type.IsEnum && Enum.GetUnderlyingType(type) == typeof(int); + _notifiesOnChange = typeof(INotifyPropertyChanged).IsAssignableFrom(_type); + _isDisposable = typeof(IDisposable).IsAssignableFrom(_type); } protected override void OnDispose() { base.OnDispose(); - foreach (KeyValueEntry keyValueEntry in this._constructorCache) + foreach (KeyValueEntry keyValueEntry in _constructorCache) keyValueEntry.Value.Dispose(this); - foreach (KeyValueEntry keyValueEntry in this._propertyCache) + foreach (KeyValueEntry keyValueEntry in _propertyCache) keyValueEntry.Value.Dispose(this); - foreach (KeyValueEntry keyValueEntry in this._methodCache) + foreach (KeyValueEntry keyValueEntry in _methodCache) keyValueEntry.Value.Dispose(this); - foreach (KeyValueEntry keyValueEntry in this._eventCache) + foreach (KeyValueEntry keyValueEntry in _eventCache) keyValueEntry.Value.Dispose(this); } @@ -53,9 +53,9 @@ namespace Microsoft.Iris.Markup { get { - string str = this._type.Name; - if (this._type.IsGenericType) - str = this._type.ToString().Substring(((AssemblyLoadResult)this.Owner).Namespace.Length + 1); + string str = _type.Name; + if (_type.IsGenericType) + str = _type.ToString().Substring(((AssemblyLoadResult)Owner).Namespace.Length + 1); return str; } } @@ -66,38 +66,38 @@ namespace Microsoft.Iris.Markup { get { - if (this._baseType == null && this != AssemblyLoadResult.ObjectTypeSchema) + if (_baseType == null && this != AssemblyLoadResult.ObjectTypeSchema) { - if (this._type.BaseType != null) - this._baseType = AssemblyLoadResult.MapType(this._type.BaseType); - else if (this._type.IsInterface) - this._baseType = AssemblyLoadResult.ObjectTypeSchema; + if (_type.BaseType != null) + _baseType = AssemblyLoadResult.MapType(_type.BaseType); + else if (_type.IsInterface) + _baseType = AssemblyLoadResult.ObjectTypeSchema; } - return this._baseType; + return _baseType; } } - public override bool Contractual => this._type.IsInterface; + public override bool Contractual => _type.IsInterface; - public override Type RuntimeType => this._type; + public override Type RuntimeType => _type; - public Type InternalType => this._type; + public Type InternalType => _type; - public override bool IsNativeAssignableFrom(object check) => this.InternalType.IsAssignableFrom(AssemblyLoadResult.UnwrapObject(check).GetType()); + public override bool IsNativeAssignableFrom(object check) => InternalType.IsAssignableFrom(AssemblyLoadResult.UnwrapObject(check).GetType()); public override bool IsNativeAssignableFrom(TypeSchema checkSchema) { Type c = checkSchema.RuntimeType; if (checkSchema is AssemblyTypeSchema assemblyTypeSchema) c = assemblyTypeSchema.InternalType; - return this.InternalType.IsAssignableFrom(c); + return InternalType.IsAssignableFrom(c); } - public override bool Disposable => this._isDisposable; + public override bool Disposable => _isDisposable; - public override object ConstructDefault() => AssemblyLoadResult.WrapObject(this, Activator.CreateInstance(this._type)); + public override object ConstructDefault() => AssemblyLoadResult.WrapObject(this, Activator.CreateInstance(_type)); - public override bool HasDefaultConstructor => this._type.IsValueType || this._type.GetConstructor(Type.EmptyTypes) != null; + public override bool HasDefaultConstructor => _type.IsValueType || _type.GetConstructor(Type.EmptyTypes) != null; public override bool HasInitializer => false; @@ -108,23 +108,23 @@ namespace Microsoft.Iris.Markup public override ConstructorSchema FindConstructor(TypeSchema[] parameters) { ConstructorSchema constructorSchema; - if (!this._constructorCache.TryGetValue(new MethodSignatureKey(parameters), out constructorSchema)) + if (!_constructorCache.TryGetValue(new MethodSignatureKey(parameters), out constructorSchema)) { ConstructorInfo[] constructors; - if (!this.s_constructorInfosCache.TryGetValue(this._type, out constructors)) + if (!s_constructorInfosCache.TryGetValue(_type, out constructors)) { - constructors = this._type.GetConstructors(BindingFlags.Instance | BindingFlags.Public); - this.s_constructorInfosCache[this._type] = constructors; + constructors = _type.GetConstructors(BindingFlags.Instance | BindingFlags.Public); + s_constructorInfosCache[_type] = constructors; } if (constructors != null) { foreach (ConstructorInfo constructorInfo in constructors) { TypeSchema[] schemaParameters = null; - if (this.CheckForMethodSignatureMatch(constructorInfo, null, parameters, out schemaParameters)) + if (CheckForMethodSignatureMatch(constructorInfo, null, parameters, out schemaParameters)) { constructorSchema = new AssemblyConstructorSchema(this, constructorInfo, schemaParameters); - this._constructorCache[new MethodSignatureKey(schemaParameters)] = constructorSchema; + _constructorCache[new MethodSignatureKey(schemaParameters)] = constructorSchema; break; } } @@ -136,13 +136,13 @@ namespace Microsoft.Iris.Markup public override PropertySchema FindProperty(string name) { PropertySchema propertySchema; - if (!this._propertyCache.TryGetValue(name, out propertySchema)) + if (!_propertyCache.TryGetValue(name, out propertySchema)) { - PropertyInfo propertyHelper = GetPropertyHelper(this._type, name); + PropertyInfo propertyHelper = GetPropertyHelper(_type, name); if (propertyHelper != null) { propertySchema = new AssemblyPropertySchema(this, propertyHelper); - this._propertyCache[name] = propertySchema; + _propertyCache[name] = propertySchema; } } return propertySchema; @@ -182,23 +182,23 @@ namespace Microsoft.Iris.Markup public override MethodSchema FindMethod(string name, TypeSchema[] parameters) { MethodSchema methodSchema; - if (!this._methodCache.TryGetValue(new MethodSignatureKey(name, parameters), out methodSchema)) + if (!_methodCache.TryGetValue(new MethodSignatureKey(name, parameters), out methodSchema)) { MethodInfo[] methodInfoArray = null; - if (!this.s_methodInfosCache.TryGetValue(this._type, out methodInfoArray)) + if (!s_methodInfosCache.TryGetValue(_type, out methodInfoArray)) { - methodInfoArray = this._type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); - this.s_methodInfosCache[this._type] = methodInfoArray; + methodInfoArray = _type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); + s_methodInfosCache[_type] = methodInfoArray; } if (methodInfoArray != null) { foreach (MethodInfo methodInfo in methodInfoArray) { TypeSchema[] schemaParameters; - if (this.CheckForMethodSignatureMatch(methodInfo, name, parameters, out schemaParameters)) + if (CheckForMethodSignatureMatch(methodInfo, name, parameters, out schemaParameters)) { methodSchema = new AssemblyMethodSchema(this, methodInfo, schemaParameters); - this._methodCache[new MethodSignatureKey(name, schemaParameters)] = methodSchema; + _methodCache[new MethodSignatureKey(name, schemaParameters)] = methodSchema; break; } } @@ -233,13 +233,13 @@ namespace Microsoft.Iris.Markup public override EventSchema FindEvent(string name) { EventSchema eventSchema; - if (!this._eventCache.TryGetValue(name, out eventSchema)) + if (!_eventCache.TryGetValue(name, out eventSchema)) { - EventInfo eventInfo = this._type.GetEvent(name); + EventInfo eventInfo = _type.GetEvent(name); if (eventInfo != null) { eventSchema = new AssemblyEventSchema(this, eventInfo); - this._eventCache[name] = eventSchema; + _eventCache[name] = eventSchema; } } return eventSchema; @@ -247,11 +247,11 @@ namespace Microsoft.Iris.Markup public override object FindCanonicalInstance(string name) { - if (this._type.IsEnum) + if (_type.IsEnum) { try { - return Enum.Parse(this._type, name); + return Enum.Parse(_type, name); } catch (ArgumentException ex) { @@ -267,26 +267,26 @@ namespace Microsoft.Iris.Markup TypeSchema fromType, out object instance) { - if (this._isFrameworkEnum && Int32Schema.Type.IsAssignableFrom(fromType)) + if (_isFrameworkEnum && Int32Schema.Type.IsAssignableFrom(fromType)) { - instance = Enum.ToObject(this._type, (int)from); + instance = Enum.ToObject(_type, (int)from); return Result.Success; } instance = null; return Result.Fail("Unimplemented"); } - public override bool SupportsTypeConversion(TypeSchema fromType) => this._isFrameworkEnum && Int32Schema.Type.IsAssignableFrom(fromType); + public override bool SupportsTypeConversion(TypeSchema fromType) => _isFrameworkEnum && Int32Schema.Type.IsAssignableFrom(fromType); public override void EncodeBinary(ByteCodeWriter writer, object instance) { - if (this._type.IsEnum) + if (_type.IsEnum) { writer.WriteInt32((int)instance); } else { - if (this._type != typeof(Guid)) + if (_type != typeof(Guid)) return; writer.Write(((Guid)instance).ToByteArray(), 16U); } @@ -295,9 +295,9 @@ namespace Microsoft.Iris.Markup public override object DecodeBinary(ByteCodeReader reader) { object obj; - if (this._type.IsEnum) - obj = Enum.ToObject(this._type, reader.ReadInt32()); - else if (this._type == typeof(Guid)) + if (_type.IsEnum) + obj = Enum.ToObject(_type, reader.ReadInt32()); + else if (_type == typeof(Guid)) { byte[] b = new byte[16]; for (int index = 0; index < 16; ++index) @@ -313,9 +313,9 @@ namespace Microsoft.Iris.Markup { get { - if (this._type == typeof(Guid)) + if (_type == typeof(Guid)) return true; - return this._type.IsEnum && Enum.GetUnderlyingType(this._type) == typeof(int); + return _type.IsEnum && Enum.GetUnderlyingType(_type) == typeof(int); } } @@ -327,14 +327,14 @@ namespace Microsoft.Iris.Markup public override bool SupportsOperation(OperationType op) => op == OperationType.RelationalEquals || op == OperationType.RelationalNotEquals; - public override bool IsNullAssignable => !this._type.IsValueType; + public override bool IsNullAssignable => !_type.IsValueType; public override int FindTypeHint => -1; - public bool NotifiesOnChange => this._notifiesOnChange; + public bool NotifiesOnChange => _notifiesOnChange; - public override bool IsRuntimeImmutable => this._type.IsEnum; + public override bool IsRuntimeImmutable => _type.IsEnum; - public override bool IsEnum => this._isFrameworkEnum; + public override bool IsEnum => _isFrameworkEnum; } } diff --git a/UIX/Microsoft/Iris/Markup/ByteCodeWriter.cs b/UIX/Microsoft/Iris/Markup/ByteCodeWriter.cs index b1ea953..372a4f6 100644 --- a/UIX/Microsoft/Iris/Markup/ByteCodeWriter.cs +++ b/UIX/Microsoft/Iris/Markup/ByteCodeWriter.cs @@ -20,107 +20,107 @@ namespace Microsoft.Iris.Markup private byte[] _currentBlock; private ArrayList _blockList = new ArrayList(); - public uint DataSize => this._totalSize; + public uint DataSize => _totalSize; public void WriteByte(byte value) { - this._scratch[0] = value; - this.Write(this._scratch, 1U); + _scratch[0] = value; + Write(_scratch, 1U); } public void WriteByte(OpCode value) { - this._scratch[0] = (byte)value; - this.Write(this._scratch, 1U); + _scratch[0] = (byte)value; + Write(_scratch, 1U); } public void WriteBool(bool value) { - this._scratch[0] = 0; - if (value) this._scratch[0] = 1; - this.Write(this._scratch, 1U); + _scratch[0] = 0; + if (value) _scratch[0] = 1; + Write(_scratch, 1U); } public void WriteChar(char value) { - this._scratch[0] = (byte)value; - this._scratch[1] = (byte)((uint)value >> 8); - this.Write(this._scratch, 2U); + _scratch[0] = (byte)value; + _scratch[1] = (byte)((uint)value >> 8); + Write(_scratch, 2U); } public void WriteUInt16(ushort value) { - this._scratch[0] = (byte)value; - this._scratch[1] = (byte)((uint)value >> 8); - this.Write(this._scratch, 2U); + _scratch[0] = (byte)value; + _scratch[1] = (byte)((uint)value >> 8); + Write(_scratch, 2U); } public void WriteUInt16(int rawValue) { ushort num = (ushort)rawValue; - this._scratch[0] = (byte)num; - this._scratch[1] = (byte)((uint)num >> 8); - this.Write(this._scratch, 2U); + _scratch[0] = (byte)num; + _scratch[1] = (byte)((uint)num >> 8); + Write(_scratch, 2U); } public void WriteUInt16(uint rawValue) { ushort num = (ushort)rawValue; - this._scratch[0] = (byte)num; - this._scratch[1] = (byte)((uint)num >> 8); - this.Write(this._scratch, 2U); + _scratch[0] = (byte)num; + _scratch[1] = (byte)((uint)num >> 8); + Write(_scratch, 2U); } public void WriteInt32(int value) { - this._scratch[0] = (byte)value; - this._scratch[1] = (byte)(value >> 8); - this._scratch[2] = (byte)(value >> 16); - this._scratch[3] = (byte)(value >> 24); - this.Write(this._scratch, 4U); + _scratch[0] = (byte)value; + _scratch[1] = (byte)(value >> 8); + _scratch[2] = (byte)(value >> 16); + _scratch[3] = (byte)(value >> 24); + Write(_scratch, 4U); } public void WriteUInt32(uint value) { - this._scratch[0] = (byte)value; - this._scratch[1] = (byte)(value >> 8); - this._scratch[2] = (byte)(value >> 16); - this._scratch[3] = (byte)(value >> 24); - this.Write(this._scratch, 4U); + _scratch[0] = (byte)value; + _scratch[1] = (byte)(value >> 8); + _scratch[2] = (byte)(value >> 16); + _scratch[3] = (byte)(value >> 24); + Write(_scratch, 4U); } - public void WriteInt64(long value) => this.WriteUInt64((ulong)value); + public void WriteInt64(long value) => WriteUInt64((ulong)value); public void WriteUInt64(ulong value) { - this._scratch[0] = (byte)value; - this._scratch[1] = (byte)(value >> 8); - this._scratch[2] = (byte)(value >> 16); - this._scratch[3] = (byte)(value >> 24); - this._scratch[4] = (byte)(value >> 32); - this._scratch[5] = (byte)(value >> 40); - this._scratch[6] = (byte)(value >> 48); - this._scratch[7] = (byte)(value >> 56); - this.Write(this._scratch, 8U); + _scratch[0] = (byte)value; + _scratch[1] = (byte)(value >> 8); + _scratch[2] = (byte)(value >> 16); + _scratch[3] = (byte)(value >> 24); + _scratch[4] = (byte)(value >> 32); + _scratch[5] = (byte)(value >> 40); + _scratch[6] = (byte)(value >> 48); + _scratch[7] = (byte)(value >> 56); + Write(_scratch, 8U); } public unsafe void WriteSingle(float value) { uint num = *(uint*)&value; - this._scratch[0] = (byte)num; - this._scratch[1] = (byte)(num >> 8); - this._scratch[2] = (byte)(num >> 16); - this._scratch[3] = (byte)(num >> 24); - this.Write(this._scratch, 4U); + _scratch[0] = (byte)num; + _scratch[1] = (byte)(num >> 8); + _scratch[2] = (byte)(num >> 16); + _scratch[3] = (byte)(num >> 24); + Write(_scratch, 4U); } - public unsafe void WriteDouble(double value) => this.WriteInt64(*(long*)&value); + public unsafe void WriteDouble(double value) => WriteInt64(*(long*)&value); public void WriteString(string value) { if (value == null) { - this.WriteUInt16(ushort.MaxValue); + WriteUInt16(ushort.MaxValue); } else { @@ -138,91 +138,91 @@ namespace Microsoft.Iris.Markup uint length = (uint)value.Length; if (!flag) length |= 32768U; - this.WriteUInt16((ushort)length); + WriteUInt16((ushort)length); foreach (char ch in value) { if (flag) - this.WriteChar(ch); + WriteChar(ch); else - this.WriteByte((byte)ch); + WriteByte((byte)ch); } } } - public void Write(ByteCodeReader value) => this.Write(value, 0U); + public void Write(ByteCodeReader value) => Write(value, 0U); public unsafe void Write(ByteCodeReader value, uint offset) { IntPtr intPtr = value.ToIntPtr(out uint size); if (offset > size) throw new ArgumentOutOfRangeException(nameof(offset)); - this.Write(new IntPtr(intPtr.ToInt64() + offset), (uint)(size - offset)); + Write(new IntPtr(intPtr.ToInt64() + offset), (uint)(size - offset)); } public unsafe void Write(byte[] buffer, uint count) { fixed (byte* pbData = buffer) - this.Write(pbData, count); + Write(pbData, count); } - public unsafe void Write(IntPtr buffer, uint count) => this.Write((byte*)buffer.ToPointer(), count); + public unsafe void Write(IntPtr buffer, uint count) => Write((byte*)buffer.ToPointer(), count); private unsafe void Write(byte* pbData, uint cbData) { while (cbData > 0U) { - if (this._cbFreeInBlock == 0U) + if (_cbFreeInBlock == 0U) { - this._currentBlock = new byte[4096]; - this._blockList.Add(_currentBlock); - this._cbFreeInBlock = 4096U; + _currentBlock = new byte[4096]; + _blockList.Add(_currentBlock); + _cbFreeInBlock = 4096U; } - uint num1 = cbData <= this._cbFreeInBlock ? cbData : this._cbFreeInBlock; - uint num2 = 4096U - this._cbFreeInBlock; - Marshal.Copy(new IntPtr(pbData), this._currentBlock, (int)num2, (int)num1); + uint num1 = cbData <= _cbFreeInBlock ? cbData : _cbFreeInBlock; + uint num2 = 4096U - _cbFreeInBlock; + Marshal.Copy(new IntPtr(pbData), _currentBlock, (int)num2, (int)num1); pbData += (int)num1; cbData -= num1; - this._cbFreeInBlock -= num1; - this._totalSize += num1; + _cbFreeInBlock -= num1; + _totalSize += num1; } } public void Overwrite(uint offset, uint value) { - if (offset + 4U > this._totalSize) + if (offset + 4U > _totalSize) throw new ArgumentException("Invalid offset"); - this.OverwriteByte(offset, (byte)value); - this.OverwriteByte(offset + 1U, (byte)(value >> 8)); - this.OverwriteByte(offset + 2U, (byte)(value >> 16)); - this.OverwriteByte(offset + 3U, (byte)(value >> 24)); + OverwriteByte(offset, (byte)value); + OverwriteByte(offset + 1U, (byte)(value >> 8)); + OverwriteByte(offset + 2U, (byte)(value >> 16)); + OverwriteByte(offset + 3U, (byte)(value >> 24)); } - private void OverwriteByte(uint offset, byte value) => ((byte[])this._blockList[(int)(offset / 4096U)])[(offset % 4096U)] = value; + private void OverwriteByte(uint offset, byte value) => ((byte[])_blockList[(int)(offset / 4096U)])[(offset % 4096U)] = value; private unsafe byte* ComposeFinalBuffer(out uint totalSize) { - byte* pointer = (byte*)NativeApi.MemAlloc(this._totalSize, false).ToPointer(); + byte* pointer = (byte*)NativeApi.MemAlloc(_totalSize, false).ToPointer(); byte* numPtr = pointer; - for (int index = 0; index < this._blockList.Count - 1; ++index) + for (int index = 0; index < _blockList.Count - 1; ++index) { - Marshal.Copy((byte[])this._blockList[index], 0, new IntPtr(numPtr), 4096); + Marshal.Copy((byte[])_blockList[index], 0, new IntPtr(numPtr), 4096); numPtr += 4096; } - uint num = 4096U - this._cbFreeInBlock; - if (this._currentBlock != null && num != 0U) - Marshal.Copy(this._currentBlock, 0, new IntPtr(numPtr), (int)num); - totalSize = this._totalSize; - this._blockList.Clear(); - this._currentBlock = null; - this._cbFreeInBlock = 0U; - this._totalSize = 0U; + uint num = 4096U - _cbFreeInBlock; + if (_currentBlock != null && num != 0U) + Marshal.Copy(_currentBlock, 0, new IntPtr(numPtr), (int)num); + totalSize = _totalSize; + _blockList.Clear(); + _currentBlock = null; + _cbFreeInBlock = 0U; + _totalSize = 0U; return pointer; } public unsafe ByteCodeReader CreateReader() { uint totalSize; - return new ByteCodeReader(new IntPtr(this.ComposeFinalBuffer(out totalSize)), totalSize, true); + return new ByteCodeReader(new IntPtr(ComposeFinalBuffer(out totalSize)), totalSize, true); } } } diff --git a/UIX/Microsoft/Iris/Markup/ClassMethodSchema.cs b/UIX/Microsoft/Iris/Markup/ClassMethodSchema.cs index bd0feb2..6c12625 100644 --- a/UIX/Microsoft/Iris/Markup/ClassMethodSchema.cs +++ b/UIX/Microsoft/Iris/Markup/ClassMethodSchema.cs @@ -20,6 +20,6 @@ namespace Microsoft.Iris.Markup protected override IMarkupTypeBase GetMarkupTypeBase(object instance) => instance == null ? ((ClassTypeSchema)Owner).SharedInstance : (IMarkupTypeBase)instance; - public override bool IsStatic => ((ClassTypeSchema)this.Owner).IsShared; + public override bool IsStatic => ((ClassTypeSchema)Owner).IsShared; } } diff --git a/UIX/Microsoft/Iris/Markup/ClassPropertySchema.cs b/UIX/Microsoft/Iris/Markup/ClassPropertySchema.cs index 9cf093c..63e1ec0 100644 --- a/UIX/Microsoft/Iris/Markup/ClassPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/ClassPropertySchema.cs @@ -15,18 +15,18 @@ namespace Microsoft.Iris.Markup { } - public override bool IsStatic => ((ClassTypeSchema)this.Owner).IsShared; + public override bool IsStatic => ((ClassTypeSchema)Owner).IsShared; public override object GetValue(object instance) { - ClassTypeSchema owner = (ClassTypeSchema)this.Owner; - return (instance == null ? owner.SharedInstance : (Class)instance).GetProperty(this.Name); + ClassTypeSchema owner = (ClassTypeSchema)Owner; + return (instance == null ? owner.SharedInstance : (Class)instance).GetProperty(Name); } public override void SetValue(ref object instance, object value) { - ClassTypeSchema owner = (ClassTypeSchema)this.Owner; - (instance == null ? owner.SharedInstance : (Class)instance).SetProperty(this.Name, value); + ClassTypeSchema owner = (ClassTypeSchema)Owner; + (instance == null ? owner.SharedInstance : (Class)instance).SetProperty(Name, value); } } } diff --git a/UIX/Microsoft/Iris/Markup/ClassTypeSchema.cs b/UIX/Microsoft/Iris/Markup/ClassTypeSchema.cs index 1157a67..463f19b 100644 --- a/UIX/Microsoft/Iris/Markup/ClassTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/ClassTypeSchema.cs @@ -23,10 +23,10 @@ namespace Microsoft.Iris.Markup protected override void OnDispose() { base.OnDispose(); - if (this._sharedInstance == null) + if (_sharedInstance == null) return; - this._sharedInstance.Dispose(this); - this._sharedInstance = null; + _sharedInstance.Dispose(this); + _sharedInstance = null; } public override MarkupType MarkupType => MarkupType.Class; @@ -35,31 +35,31 @@ namespace Microsoft.Iris.Markup public override Type RuntimeType => typeof(Class); - public override object ConstructDefault() => this._isShared ? SharedInstance : this.ConstructNewInstance(); + public override object ConstructDefault() => _isShared ? SharedInstance : ConstructNewInstance(); - public override void InitializeInstance(ref object instance) => this.InitializeInstance((IMarkupTypeBase)instance); + public override void InitializeInstance(ref object instance) => InitializeInstance((IMarkupTypeBase)instance); - public override bool HasInitializer => !this._isShared; + public override bool HasInitializer => !_isShared; - public override bool Disposable => !this._isShared && base.Disposable; + public override bool Disposable => !_isShared && base.Disposable; - public bool IsShared => this._isShared; + public bool IsShared => _isShared; - public void MarkShareable() => this._isShared = true; + public void MarkShareable() => _isShared = true; public Class SharedInstance { get { - if (!this._isShared) + if (!_isShared) return null; - if (this._sharedInstance == null) + if (_sharedInstance == null) { - this._sharedInstance = this.ConstructNewInstance(); - this._sharedInstance.DeclareOwner(this); - this.InitializeInstance(_sharedInstance); + _sharedInstance = ConstructNewInstance(); + _sharedInstance.DeclareOwner(this); + InitializeInstance(_sharedInstance); } - return this._sharedInstance; + return _sharedInstance; } } diff --git a/UIX/Microsoft/Iris/Markup/CompiledMarkupLoadResult.cs b/UIX/Microsoft/Iris/Markup/CompiledMarkupLoadResult.cs index 6cd38a5..ec03f39 100644 --- a/UIX/Microsoft/Iris/Markup/CompiledMarkupLoadResult.cs +++ b/UIX/Microsoft/Iris/Markup/CompiledMarkupLoadResult.cs @@ -19,53 +19,53 @@ namespace Microsoft.Iris.Markup public CompiledMarkupLoadResult(Resource resource, string uri) : base(uri) { - this._resource = resource; + _resource = resource; if (uri != resource.Uri) - this._uriUnderlying = resource.Uri; - this._loader = CompiledMarkupLoader.Load(this, resource); + _uriUnderlying = resource.Uri; + _loader = CompiledMarkupLoader.Load(this, resource); } public override bool IsSource => false; - public override MarkupConstantsTable ConstantsTable => this._binaryDataTable.ConstantsTable; + public override MarkupConstantsTable ConstantsTable => _binaryDataTable.ConstantsTable; - public override MarkupImportTables ImportTables => this._binaryDataTable.ImportTables; + public override MarkupImportTables ImportTables => _binaryDataTable.ImportTables; - public void SetAddressOfLineNumberData(IntPtr address) => this._addressOfLineNumberData = address; + public void SetAddressOfLineNumberData(IntPtr address) => _addressOfLineNumberData = address; public override MarkupLineNumberTable LineNumberTable { get { - if (this._lineNumberTable == null) - this._lineNumberTable = CompiledMarkupLoader.DecodeLineNumberTable(this._addressOfLineNumberData); - return this._lineNumberTable; + if (_lineNumberTable == null) + _lineNumberTable = CompiledMarkupLoader.DecodeLineNumberTable(_addressOfLineNumberData); + return _lineNumberTable; } } public override void Load(LoadPass currentPass) { - if (this._loader == null) + if (_loader == null) return; ErrorManager.EnterContext(ErrorContextUri); - this._loader.Depersist(currentPass); + _loader.Depersist(currentPass); ErrorManager.ExitContext(); if (currentPass != LoadPass.Done) return; - this.LoadComplete(); + LoadComplete(); } private void LoadComplete() { - if (this._resource != null) + if (_resource != null) { - this._resource.Free(); - this._resource = null; + _resource.Free(); + _resource = null; } - this._loader = null; - if (this.Status != LoadResultStatus.Loading) + _loader = null; + if (Status != LoadResultStatus.Loading) return; - this.SetStatus(LoadResultStatus.Success); + SetStatus(LoadResultStatus.Success); } } } diff --git a/UIX/Microsoft/Iris/Markup/CompiledMarkupLoader.cs b/UIX/Microsoft/Iris/Markup/CompiledMarkupLoader.cs index b7c7c77..9dee442 100644 --- a/UIX/Microsoft/Iris/Markup/CompiledMarkupLoader.cs +++ b/UIX/Microsoft/Iris/Markup/CompiledMarkupLoader.cs @@ -28,202 +28,200 @@ namespace Microsoft.Iris.Markup private uint _lineNumberTableEnd; private TypeSchema[][] _typeSchemaArrays; - public static CompiledMarkupLoader Load( - CompiledMarkupLoadResult loadResult, - Resource resource) + public static CompiledMarkupLoader Load(CompiledMarkupLoadResult loadResult, Resource resource) { return new CompiledMarkupLoader(loadResult, resource); } private CompiledMarkupLoader(CompiledMarkupLoadResult loadResultTarget, Resource resource) { - this._loadResultTarget = loadResultTarget; - this._reader = new ByteCodeReader(resource.Buffer, resource.Length, false); + _loadResultTarget = loadResultTarget; + _reader = new ByteCodeReader(resource.Buffer, resource.Length, false); if (resource is DllResource) - this._reader.MarkAsInFixedMemory(); - uint num1 = this._reader.ReadUInt32(); - uint num2 = this._reader.ReadUInt32(); + _reader.MarkAsInFixedMemory(); + uint num1 = _reader.ReadUInt32(); + uint num2 = _reader.ReadUInt32(); if (num1 != 440551765U) - this.ReportError("Invalid compiled UIX file"); + ReportError("Invalid compiled UIX file"); if (num2 == 1012U) return; - this.ReportError("Compiled UIX file '{0}' was compiled for the runtime with version {1}, but the current runtime is version {2}", resource.Uri, num2.ToString(), 1012U.ToString()); + ReportError("Compiled UIX file '{0}' was compiled for the runtime with version {1}, but the current runtime is version {2}", resource.Uri, num2.ToString(), 1012U.ToString()); } public void Depersist(LoadPass currentPass) { - if (this._currentDepersistPass >= currentPass) + if (_currentDepersistPass >= currentPass) return; - this._currentDepersistPass = currentPass; - if (this._binaryDataTableLoadResult != null) - this._binaryDataTableLoadResult.Load(this._currentDepersistPass); - if (this._currentDepersistPass == LoadPass.DeclareTypes) - this.DoLoadPassDeclareTypes(); - else if (this._currentDepersistPass == LoadPass.PopulatePublicModel) - this.DoLoadPassPopulatePublicModel(); - else if (this._currentDepersistPass == LoadPass.Full) + _currentDepersistPass = currentPass; + if (_binaryDataTableLoadResult != null) + _binaryDataTableLoadResult.Load(_currentDepersistPass); + if (_currentDepersistPass == LoadPass.DeclareTypes) + DoLoadPassDeclareTypes(); + else if (_currentDepersistPass == LoadPass.PopulatePublicModel) + DoLoadPassPopulatePublicModel(); + else if (_currentDepersistPass == LoadPass.Full) { - this.DoLoadPassFull(); + DoLoadPassFull(); } else { - foreach (MarkupTypeSchema markupTypeSchema in this._loadResultTarget.ExportTable) + foreach (MarkupTypeSchema markupTypeSchema in _loadResultTarget.ExportTable) markupTypeSchema.Seal(); - this._reader = null; + _reader = null; } - foreach (LoadResult dependency in this._loadResultTarget.Dependencies) + foreach (LoadResult dependency in _loadResultTarget.Dependencies) { - if (dependency != this._loadResultTarget) + if (dependency != _loadResultTarget) { - dependency.Load(this._currentDepersistPass); + dependency.Load(_currentDepersistPass); if (dependency.Status == LoadResultStatus.Error) - this.MarkHasErrors(); + MarkHasErrors(); } } } private void DoLoadPassDeclareTypes() { - if (this.HasErrors) + if (HasErrors) return; - this.DepersistTableOfContents(); - if (this.HasErrors) + DepersistTableOfContents(); + if (HasErrors) return; - this.DepersistDependencies(); - if (this.HasErrors) + DepersistDependencies(); + if (HasErrors) return; - this.DepersistTypeExportDeclarations(); - if (!this.HasErrors) + DepersistTypeExportDeclarations(); + if (!HasErrors) ; } private void DoLoadPassPopulatePublicModel() { - if (this.HasErrors) + if (HasErrors) return; - this.DepersistTypeImportTable(); - if (this.HasErrors) + DepersistTypeImportTable(); + if (HasErrors) return; - this.DepersistTypeExportDefinitions(); - if (!this.HasErrors) + DepersistTypeExportDefinitions(); + if (!HasErrors) ; } private void DoLoadPassFull() { - if (this.HasErrors) + if (HasErrors) return; - this.DepersistMemberImportTables(); - if (this.HasErrors) + DepersistMemberImportTables(); + if (HasErrors) return; - this.DepersistDataMappingsTable(); - if (this.HasErrors) + DepersistDataMappingsTable(); + if (HasErrors) return; - this.DepersistConstantsTable(); - if (this.HasErrors) + DepersistConstantsTable(); + if (HasErrors) return; - this.DepersistLineNumberTable(); - if (this.HasErrors) + DepersistLineNumberTable(); + if (HasErrors) return; - this.DepersistObjectSection(); - if (!this.HasErrors) + DepersistObjectSection(); + if (!HasErrors) ; } private void DepersistTableOfContents() { - this._objectSectionStart = this._reader.ReadUInt32(); - this._objectSectionEnd = this._reader.ReadUInt32(); - this._lineNumberTableStart = this._reader.ReadUInt32(); - this._lineNumberTableEnd = this._reader.ReadUInt32(); - string uri = this._reader.ReadString(); + _objectSectionStart = _reader.ReadUInt32(); + _objectSectionEnd = _reader.ReadUInt32(); + _lineNumberTableStart = _reader.ReadUInt32(); + _lineNumberTableEnd = _reader.ReadUInt32(); + string uri = _reader.ReadString(); if (uri != null) { - this._binaryDataTableLoadResult = MarkupSystem.ResolveLoadResult(uri, this._loadResultTarget.IslandReferences) as MarkupLoadResult; - if (this._binaryDataTableLoadResult != null) + _binaryDataTableLoadResult = MarkupSystem.ResolveLoadResult(uri, _loadResultTarget.IslandReferences) as MarkupLoadResult; + if (_binaryDataTableLoadResult != null) { - this._binaryDataTableLoadResult.Load(this._currentDepersistPass); - this._binaryDataTable = this._binaryDataTableLoadResult.BinaryDataTable; - this._loadResultTarget.SetBinaryDataTable(this._binaryDataTable); - if (this._binaryDataTable.SharedDependenciesTableWithBinaryDataTable == null) - this._binaryDataTable.SharedDependenciesTableWithBinaryDataTable = new LoadResult[1] + _binaryDataTableLoadResult.Load(_currentDepersistPass); + _binaryDataTable = _binaryDataTableLoadResult.BinaryDataTable; + _loadResultTarget.SetBinaryDataTable(_binaryDataTable); + if (_binaryDataTable.SharedDependenciesTableWithBinaryDataTable == null) + _binaryDataTable.SharedDependenciesTableWithBinaryDataTable = new LoadResult[1] { _binaryDataTableLoadResult }; - this._loadResultTarget.SetDependenciesTable(this._binaryDataTable.SharedDependenciesTableWithBinaryDataTable); - this._usingSharedDataTable = true; + _loadResultTarget.SetDependenciesTable(_binaryDataTable.SharedDependenciesTableWithBinaryDataTable); + _usingSharedDataTable = true; } else - this.MarkHasErrors(); + MarkHasErrors(); } else - this.DepersistBinaryDataTable(this._reader.ReadUInt32()); + DepersistBinaryDataTable(_reader.ReadUInt32()); } private void DepersistDependencies() { - if (this._usingSharedDataTable) + if (_usingSharedDataTable) return; - ushort num = this._reader.ReadUInt16(); + ushort num = _reader.ReadUInt16(); LoadResult[] dependenciesTable = new LoadResult[num]; for (ushort index = 0; index < num; ++index) { - this._reader.ReadBool(); - string uri = this.ReadDataTableString(); - LoadResult loadResult = MarkupSystem.ResolveLoadResult(uri, this._loadResultTarget.IslandReferences); + _reader.ReadBool(); + string uri = ReadDataTableString(); + LoadResult loadResult = MarkupSystem.ResolveLoadResult(uri, _loadResultTarget.IslandReferences); if (loadResult == null || loadResult.Status == LoadResultStatus.Error) { - this.ReportError("Import of '{0}' failed", uri); + ReportError("Import of '{0}' failed", uri); return; } dependenciesTable[index] = loadResult; } - this._loadResultTarget.SetDependenciesTable(dependenciesTable); + _loadResultTarget.SetDependenciesTable(dependenciesTable); } private void DepersistTypeExportDeclarations() { - ushort num1 = this._reader.ReadUInt16(); + ushort num1 = _reader.ReadUInt16(); TypeSchema[] exportTable = new TypeSchema[num1]; for (int index = 0; index < num1; ++index) { - string name = this.ReadDataTableString(); - MarkupTypeSchema markupTypeSchema = MarkupTypeSchema.Build(this.MarkupTypeToDefinition((MarkupType)this._reader.ReadInt32()), _loadResultTarget, name); + string name = ReadDataTableString(); + MarkupTypeSchema markupTypeSchema = MarkupTypeSchema.Build(MarkupTypeToDefinition((MarkupType)_reader.ReadInt32()), _loadResultTarget, name); exportTable[index] = markupTypeSchema; } - this._loadResultTarget.SetExportTable(exportTable); - ushort num2 = this._reader.ReadUInt16(); + _loadResultTarget.SetExportTable(exportTable); + ushort num2 = _reader.ReadUInt16(); if (num2 <= 0) return; AliasMapping[] aliasTable = new AliasMapping[num2]; for (int index1 = 0; index1 < num2; ++index1) { - string alias = this.ReadDataTableString(); - ushort index2 = this._reader.ReadUInt16(); - string targetType = this.ReadDataTableString(); - LoadResult dependent = this.MapIndexToDependent(index2); + string alias = ReadDataTableString(); + ushort index2 = _reader.ReadUInt16(); + string targetType = ReadDataTableString(); + LoadResult dependent = MapIndexToDependent(index2); aliasTable[index1] = new AliasMapping(alias, dependent, targetType); } - this._loadResultTarget.SetAliasTable(aliasTable); + _loadResultTarget.SetAliasTable(aliasTable); } private void DepersistTypeImportTable() { - if (this._usingSharedDataTable) + if (_usingSharedDataTable) return; MarkupImportTables importTables = new MarkupImportTables(); - this._loadResultTarget.BinaryDataTable.SetImportTables(importTables); - ushort num = this._reader.ReadUInt16(); + _loadResultTarget.BinaryDataTable.SetImportTables(importTables); + ushort num = _reader.ReadUInt16(); if (num <= 0) return; TypeSchema[] typeSchemaArray = new TypeSchema[num]; for (ushort index = 0; index < num; ++index) { - LoadResult dependent = this.MapIndexToDependent(this._reader.ReadUInt16()); - string name = this.ReadDataTableString(); + LoadResult dependent = MapIndexToDependent(_reader.ReadUInt16()); + string name = ReadDataTableString(); TypeSchema type = dependent.FindType(name); if (type == null) - this.ReportError("Import of {0} named '{1}' from '{2}' failed", "type", name, dependent.Uri); + ReportError("Import of {0} named '{1}' from '{2}' failed", "type", name, dependent.Uri); else typeSchemaArray[index] = type; } @@ -232,54 +230,54 @@ namespace Microsoft.Iris.Markup private void DepersistTypeExportDefinitions() { - TypeSchema[] typeImports = this._loadResultTarget.ImportTables.TypeImports; - foreach (MarkupTypeSchema markupTypeSchema in this._loadResultTarget.ExportTable) + TypeSchema[] typeImports = _loadResultTarget.ImportTables.TypeImports; + foreach (MarkupTypeSchema markupTypeSchema in _loadResultTarget.ExportTable) { MarkupType markupType = markupTypeSchema.MarkupType; - TypeSchema definition = this.MarkupTypeToDefinition(markupType); - uint typeDepth = this._reader.ReadUInt16(); + TypeSchema definition = MarkupTypeToDefinition(markupType); + uint typeDepth = _reader.ReadUInt16(); markupTypeSchema.SetTypeDepth(typeDepth); if (typeDepth > 1U) { - ushort num = this._reader.ReadUInt16(); + ushort num = _reader.ReadUInt16(); TypeSchema typeSchema = typeImports[num]; markupTypeSchema.SetBaseType((MarkupTypeSchema)typeSchema); } - uint offset1 = this._reader.ReadUInt32(); + uint offset1 = _reader.ReadUInt32(); markupTypeSchema.SetInitializePropertiesOffset(offset1); - uint offset2 = this._reader.ReadUInt32(); + uint offset2 = _reader.ReadUInt32(); markupTypeSchema.SetInitializeLocalsInputOffset(offset2); - uint offset3 = this._reader.ReadUInt32(); + uint offset3 = _reader.ReadUInt32(); markupTypeSchema.SetInitializeContentOffset(offset3); - markupTypeSchema.SetInitialEvaluateOffsets(this.ReadUInt32ArrayHelper()); - markupTypeSchema.SetFinalEvaluateOffsets(this.ReadUInt32ArrayHelper()); - markupTypeSchema.SetRefreshListenerGroupOffsets(this.ReadUInt32ArrayHelper()); - uint listenerCount = this._reader.ReadUInt32(); + markupTypeSchema.SetInitialEvaluateOffsets(ReadUInt32ArrayHelper()); + markupTypeSchema.SetFinalEvaluateOffsets(ReadUInt32ArrayHelper()); + markupTypeSchema.SetRefreshListenerGroupOffsets(ReadUInt32ArrayHelper()); + uint listenerCount = _reader.ReadUInt32(); markupTypeSchema.SetListenerCount(listenerCount); - uint num1 = this._reader.ReadUInt32(); + uint num1 = _reader.ReadUInt32(); if (num1 > 0U) { SymbolReference[] symbolTable = new SymbolReference[num1]; for (int index = 0; index < num1; ++index) { - SymbolReference symbolReference = new SymbolReference(this.ReadDataTableString(), (SymbolOrigin)this._reader.ReadByte()); + SymbolReference symbolReference = new SymbolReference(ReadDataTableString(), (SymbolOrigin)_reader.ReadByte()); symbolTable[index] = symbolReference; } markupTypeSchema.SetSymbolReferenceTable(symbolTable); } - this.DepersistInheritedSymbolTable(markupTypeSchema); - int totalPropertiesAndLocalsCount = this._reader.ReadInt32(); + DepersistInheritedSymbolTable(markupTypeSchema); + int totalPropertiesAndLocalsCount = _reader.ReadInt32(); markupTypeSchema.SetTotalPropertiesAndLocalsCount(totalPropertiesAndLocalsCount); if (markupType == MarkupType.UI) { - ushort num2 = this._reader.ReadUInt16(); + ushort num2 = _reader.ReadUInt16(); if (num2 > 0) { NamedContentRecord[] namedContentTable = new NamedContentRecord[num2]; for (int index = 0; index < num2; ++index) { - string name = this.ReadDataTableString(); - uint offset4 = this._reader.ReadUInt32(); + string name = ReadDataTableString(); + uint offset4 = _reader.ReadUInt32(); namedContentTable[index] = new NamedContentRecord(name); namedContentTable[index].SetOffset(offset4); } @@ -288,43 +286,43 @@ namespace Microsoft.Iris.Markup } else { - if (this._reader.ReadBool()) + if (_reader.ReadBool()) ((ClassTypeSchema)markupTypeSchema).MarkShareable(); if (markupType == MarkupType.Effect) { EffectClassTypeSchema effectClassTypeSchema = (EffectClassTypeSchema)markupTypeSchema; - effectClassTypeSchema.SetTechniqueOffsets(this.ReadUInt32ArrayHelper()); - effectClassTypeSchema.SetInstancePropertyAssignments(this.ReadUInt32ArrayHelper()); - effectClassTypeSchema.SetDynamicElementAssignments(this.ReadStringArrayHelper()); - int symbolIndex = this._reader.ReadInt32(); + effectClassTypeSchema.SetTechniqueOffsets(ReadUInt32ArrayHelper()); + effectClassTypeSchema.SetInstancePropertyAssignments(ReadUInt32ArrayHelper()); + effectClassTypeSchema.SetDynamicElementAssignments(ReadStringArrayHelper()); + int symbolIndex = _reader.ReadInt32(); effectClassTypeSchema.SetDefaultElementSymbolIndex(symbolIndex); } if (markupType == MarkupType.DataQuery) { MarkupDataQuerySchema markupDataQuerySchema = (MarkupDataQuerySchema)markupTypeSchema; - markupDataQuerySchema.ProviderName = this.ReadDataTableString(); - ushort index = this._reader.ReadUInt16(); - markupDataQuerySchema.ResultType = this.MapIndexToType(index); + markupDataQuerySchema.ProviderName = ReadDataTableString(); + ushort index = _reader.ReadUInt16(); + markupDataQuerySchema.ResultType = MapIndexToType(index); } } - ushort num3 = this._reader.ReadUInt16(); + ushort num3 = _reader.ReadUInt16(); if (num3 > 0) { PropertySchema[] properties = new PropertySchema[num3]; for (int index1 = 0; index1 < num3; ++index1) { - string name = this.ReadDataTableString(); - bool requiredForCreation = this._reader.ReadBool(); - bool flag = this._reader.ReadBool(); + string name = ReadDataTableString(); + bool requiredForCreation = _reader.ReadBool(); + bool flag = _reader.ReadBool(); PropertyOverrideCriteriaTypeConstraint criteriaTypeConstraint = null; if (flag) { - ushort num2 = this._reader.ReadUInt16(); - ushort num4 = this._reader.ReadUInt16(); + ushort num2 = _reader.ReadUInt16(); + ushort num4 = _reader.ReadUInt16(); TypeSchema constraint = typeImports[num2]; criteriaTypeConstraint = new PropertyOverrideCriteriaTypeConstraint(typeImports[num4], constraint); } - ushort num5 = this._reader.ReadUInt16(); + ushort num5 = _reader.ReadUInt16(); TypeSchema propertyType = typeImports[num5]; MarkupPropertySchema markupPropertySchema = MarkupPropertySchema.Build(definition, markupTypeSchema, name, propertyType); markupPropertySchema.SetRequiredForCreation(requiredForCreation); @@ -332,111 +330,111 @@ namespace Microsoft.Iris.Markup if (markupType == MarkupType.DataType) { MarkupDataTypePropertySchema typePropertySchema = (MarkupDataTypePropertySchema)markupPropertySchema; - ushort index2 = this._reader.ReadUInt16(); + ushort index2 = _reader.ReadUInt16(); if (index2 != ushort.MaxValue) - typePropertySchema.SetUnderlyingCollectionType(this.MapIndexToType(index2)); + typePropertySchema.SetUnderlyingCollectionType(MapIndexToType(index2)); } if (markupType == MarkupType.DataQuery) { MarkupDataQueryPropertySchema queryPropertySchema = (MarkupDataQueryPropertySchema)markupPropertySchema; - if (this._reader.ReadBool()) - queryPropertySchema.DefaultValue = queryPropertySchema.PropertyType.DecodeBinary(this._reader); - queryPropertySchema.InvalidatesQuery = this._reader.ReadBool(); - ushort index2 = this._reader.ReadUInt16(); + if (_reader.ReadBool()) + queryPropertySchema.DefaultValue = queryPropertySchema.PropertyType.DecodeBinary(_reader); + queryPropertySchema.InvalidatesQuery = _reader.ReadBool(); + ushort index2 = _reader.ReadUInt16(); if (index2 != ushort.MaxValue) - queryPropertySchema.SetUnderlyingCollectionType(this.MapIndexToType(index2)); + queryPropertySchema.SetUnderlyingCollectionType(MapIndexToType(index2)); } properties[index1] = markupPropertySchema; } markupTypeSchema.SetPropertyList(properties); } - MethodSchema[] methods = this.ReadMarkupMethodArrayHelper(definition, markupTypeSchema); + MethodSchema[] methods = ReadMarkupMethodArrayHelper(definition, markupTypeSchema); if (methods != null) markupTypeSchema.SetMethodList(methods); - MethodSchema[] virtualMethods = this.ReadMarkupMethodArrayHelper(definition, markupTypeSchema); + MethodSchema[] virtualMethods = ReadMarkupMethodArrayHelper(definition, markupTypeSchema); if (virtualMethods != null) markupTypeSchema.SetVirtualMethodList(virtualMethods); } - foreach (MarkupTypeSchema markupTypeSchema in this._loadResultTarget.ExportTable) + foreach (MarkupTypeSchema markupTypeSchema in _loadResultTarget.ExportTable) markupTypeSchema.BuildProperties(); } private void DepersistMemberImportTables() { - if (this._usingSharedDataTable) + if (_usingSharedDataTable) return; - MarkupImportTables importTables = this._loadResultTarget.ImportTables; - ushort num1 = this._reader.ReadUInt16(); + MarkupImportTables importTables = _loadResultTarget.ImportTables; + ushort num1 = _reader.ReadUInt16(); if (num1 > 0) { ConstructorSchema[] constructorSchemaArray = new ConstructorSchema[num1]; for (int index1 = 0; index1 < num1; ++index1) { - TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16()); - ushort num2 = this._reader.ReadUInt16(); + TypeSchema type = MapIndexToType(_reader.ReadUInt16()); + ushort num2 = _reader.ReadUInt16(); TypeSchema[] parameters = TypeSchema.EmptyList; if (num2 > 0) { - parameters = this.GetTempParameterArray(num2); + parameters = GetTempParameterArray(num2); for (ushort index2 = 0; index2 < num2; ++index2) { - ushort index3 = this._reader.ReadUInt16(); - parameters[index2] = this.MapIndexToType(index3); + ushort index3 = _reader.ReadUInt16(); + parameters[index2] = MapIndexToType(index3); } } ConstructorSchema constructor = type.FindConstructor(parameters); if (constructor == null) - this.ReportError("Import of {0} named '{1}' from '{2}' failed", "constructor", type.Name, type.Owner.Uri); + ReportError("Import of {0} named '{1}' from '{2}' failed", "constructor", type.Name, type.Owner.Uri); else constructorSchemaArray[index1] = constructor; } importTables.ConstructorImports = constructorSchemaArray; } - ushort num3 = this._reader.ReadUInt16(); + ushort num3 = _reader.ReadUInt16(); if (num3 > 0) { PropertySchema[] propertySchemaArray = new PropertySchema[num3]; for (int index = 0; index < num3; ++index) { - TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16()); - string name = this.ReadDataTableString(); + TypeSchema type = MapIndexToType(_reader.ReadUInt16()); + string name = ReadDataTableString(); PropertySchema property = type.FindProperty(name); if (property == null) - this.ReportError("Import of {0} named '{1}' from '{2}' failed", "property", name, type.Name); + ReportError("Import of {0} named '{1}' from '{2}' failed", "property", name, type.Name); else propertySchemaArray[index] = property; } importTables.PropertyImports = propertySchemaArray; } - ushort num4 = this._reader.ReadUInt16(); + ushort num4 = _reader.ReadUInt16(); if (num4 > 0) { MethodSchema[] methodSchemaArray = new MethodSchema[num4]; for (int index1 = 0; index1 < num4; ++index1) { MethodSchema methodSchema = null; - TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16()); - if (!this._reader.ReadBool()) + TypeSchema type = MapIndexToType(_reader.ReadUInt16()); + if (!_reader.ReadBool()) { - string name = this.ReadDataTableString(); - ushort num2 = this._reader.ReadUInt16(); + string name = ReadDataTableString(); + ushort num2 = _reader.ReadUInt16(); TypeSchema[] parameters = TypeSchema.EmptyList; if (num2 > 0) { - parameters = this.GetTempParameterArray(num2); + parameters = GetTempParameterArray(num2); for (ushort index2 = 0; index2 < num2; ++index2) { - ushort index3 = this._reader.ReadUInt16(); - parameters[index2] = this.MapIndexToType(index3); + ushort index3 = _reader.ReadUInt16(); + parameters[index2] = MapIndexToType(index3); } } methodSchema = type.FindMethod(name, parameters); if (methodSchema == null) - this.ReportError("Import of {0} named '{1}' from '{2}' failed", "method", name, type.Name); + ReportError("Import of {0} named '{1}' from '{2}' failed", "method", name, type.Name); } else { - int num2 = this._reader.ReadInt32(); + int num2 = _reader.ReadInt32(); if (type is MarkupTypeSchema markupTypeSchema) { foreach (MarkupMethodSchema virtualMethod in markupTypeSchema.VirtualMethods) @@ -449,23 +447,23 @@ namespace Microsoft.Iris.Markup } } if (methodSchema == null) - this.ReportError("Import of virtual method with index {0} from '{1}' failed", num2.ToString(), type.Name); + ReportError("Import of virtual method with index {0} from '{1}' failed", num2.ToString(), type.Name); } methodSchemaArray[index1] = methodSchema; } importTables.MethodImports = methodSchemaArray; } - ushort num5 = this._reader.ReadUInt16(); + ushort num5 = _reader.ReadUInt16(); if (num5 <= 0) return; EventSchema[] eventSchemaArray = new EventSchema[num5]; for (int index = 0; index < num5; ++index) { - TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16()); - string name = this.ReadDataTableString(); + TypeSchema type = MapIndexToType(_reader.ReadUInt16()); + string name = ReadDataTableString(); EventSchema eventSchema = type.FindEvent(name); if (eventSchema == null) - this.ReportError("Import of {0} named '{1}' from '{2}' failed", "event", name, type.Name); + ReportError("Import of {0} named '{1}' from '{2}' failed", "event", name, type.Name); else eventSchemaArray[index] = eventSchema; } @@ -474,37 +472,34 @@ namespace Microsoft.Iris.Markup private void DepersistDataMappingsTable() { - ushort num1 = this._reader.ReadUInt16(); + ushort num1 = _reader.ReadUInt16(); if (num1 <= 0) return; MarkupDataMapping[] dataMappingsTable = new MarkupDataMapping[num1]; for (int index1 = 0; index1 < num1; ++index1) { MarkupDataMapping markupDataMapping = new MarkupDataMapping(null); - ushort index2 = this._reader.ReadUInt16(); - markupDataMapping.TargetType = (MarkupDataTypeSchema)this.MapIndexToType(index2); - markupDataMapping.Provider = this.ReadDataTableString(); - ushort num2 = this._reader.ReadUInt16(); + ushort index2 = _reader.ReadUInt16(); + markupDataMapping.TargetType = (MarkupDataTypeSchema)MapIndexToType(index2); + markupDataMapping.Provider = ReadDataTableString(); + ushort num2 = _reader.ReadUInt16(); markupDataMapping.Mappings = new MarkupDataMappingEntry[num2]; for (int index3 = 0; index3 < num2; ++index3) { MarkupDataMappingEntry dataMappingEntry = new MarkupDataMappingEntry(); - dataMappingEntry.Source = this.ReadDataTableString(); - dataMappingEntry.Target = this.ReadDataTableString(); - ushort num3 = this._reader.ReadUInt16(); - dataMappingEntry.Property = (MarkupDataTypePropertySchema)this._loadResultTarget.ImportTables.PropertyImports[num3]; - dataMappingEntry.DefaultValue = !this._reader.ReadBool() ? MarkupDataProvider.GetDefaultValueForType(dataMappingEntry.Property.PropertyType) : dataMappingEntry.Property.PropertyType.DecodeBinary(this._reader); + dataMappingEntry.Source = ReadDataTableString(); + dataMappingEntry.Target = ReadDataTableString(); + ushort num3 = _reader.ReadUInt16(); + dataMappingEntry.Property = (MarkupDataTypePropertySchema)_loadResultTarget.ImportTables.PropertyImports[num3]; + dataMappingEntry.DefaultValue = !_reader.ReadBool() ? MarkupDataProvider.GetDefaultValueForType(dataMappingEntry.Property.PropertyType) : dataMappingEntry.Property.PropertyType.DecodeBinary(_reader); markupDataMapping.Mappings[index3] = dataMappingEntry; } dataMappingsTable[index1] = markupDataMapping; } - this._loadResultTarget.SetDataMappingsTable(dataMappingsTable); + _loadResultTarget.SetDataMappingsTable(dataMappingsTable); } - public static void DecodeInheritableSymbolTable( - MarkupTypeSchema typeExport, - ByteCodeReader reader, - IntPtr startAddress) + public static void DecodeInheritableSymbolTable(MarkupTypeSchema typeExport, ByteCodeReader reader, IntPtr startAddress) { if (reader == null) { @@ -539,38 +534,38 @@ namespace Microsoft.Iris.Markup private void DepersistInheritedSymbolTable(MarkupTypeSchema typeExport) { - if (this._reader.IsInFixedMemory) + if (_reader.IsInFixedMemory) { - typeExport.SetAddressOfInheritableSymbolTable(this._reader.CurrentAddress); - uint num = this._reader.ReadUInt32(); - this._reader.CurrentOffset += num; + typeExport.SetAddressOfInheritableSymbolTable(_reader.CurrentAddress); + uint num = _reader.ReadUInt32(); + _reader.CurrentOffset += num; } else - DecodeInheritableSymbolTable(typeExport, this._reader, IntPtr.Zero); + DecodeInheritableSymbolTable(typeExport, _reader, IntPtr.Zero); } private void DepersistConstantsTable() { - ushort num = this._reader.ReadUInt16(); + ushort num = _reader.ReadUInt16(); if (num <= 0) return; object[] runtimeList = new object[num]; MarkupConstantsTable constantsTable = new MarkupConstantsTable(runtimeList); - if (!this._reader.IsInFixedMemory) + if (!_reader.IsInFixedMemory) { - this._reader.CurrentOffset += (uint)((num + 1) * 4); + _reader.CurrentOffset += (uint)((num + 1) * 4); for (int index = 0; index < num; ++index) { - object obj = DepersistConstant(this._reader, _loadResultTarget); + object obj = DepersistConstant(_reader, _loadResultTarget); runtimeList[index] = obj; } } else { - ByteCodeReader constantsTableReader = new ByteCodeReader(this._reader.CurrentAddress, ByteCodeReader.ReadUInt32(this._reader.GetAddress(this._reader.CurrentOffset + num * 4U)), false); + ByteCodeReader constantsTableReader = new ByteCodeReader(_reader.CurrentAddress, ByteCodeReader.ReadUInt32(_reader.GetAddress(_reader.CurrentOffset + num * 4U)), false); constantsTable.SetConstantsTableReader(constantsTableReader, _loadResultTarget); } - this._loadResultTarget.BinaryDataTable.SetConstantsTable(constantsTable); + _loadResultTarget.BinaryDataTable.SetConstantsTable(constantsTable); } public static object DepersistConstant(ByteCodeReader reader, MarkupLoadResult loadResult) @@ -596,8 +591,7 @@ namespace Microsoft.Iris.Markup return instance; } - private static MarkupLineNumberTable DecodeLineNumberTable( - ByteCodeReader reader) + private static MarkupLineNumberTable DecodeLineNumberTable(ByteCodeReader reader) { ushort num = reader.ReadUInt16(); ulong[] runtimeList = new ulong[num]; @@ -614,56 +608,56 @@ namespace Microsoft.Iris.Markup private void DepersistLineNumberTable() { - if (this._reader.IsInFixedMemory) + if (_reader.IsInFixedMemory) { - this._loadResultTarget.SetAddressOfLineNumberData(this._reader.GetAddress(this._lineNumberTableStart)); + _loadResultTarget.SetAddressOfLineNumberData(_reader.GetAddress(_lineNumberTableStart)); } else { - uint currentOffset = this._reader.CurrentOffset; - this._reader.CurrentOffset = this._lineNumberTableStart; - this._loadResultTarget.SetLineNumberTable(DecodeLineNumberTable(this._reader)); - this._reader.CurrentOffset = currentOffset; + uint currentOffset = _reader.CurrentOffset; + _reader.CurrentOffset = _lineNumberTableStart; + _loadResultTarget.SetLineNumberTable(DecodeLineNumberTable(_reader)); + _reader.CurrentOffset = currentOffset; } } private void DepersistObjectSection() { - uint num = this._objectSectionEnd - this._objectSectionStart; + uint num = _objectSectionEnd - _objectSectionStart; ByteCodeReader reader; - if (this._reader.IsInFixedMemory) + if (_reader.IsInFixedMemory) { - reader = new ByteCodeReader(this._reader.GetAddress(this._objectSectionStart), num, false); + reader = new ByteCodeReader(_reader.GetAddress(_objectSectionStart), num, false); } else { ByteCodeWriter byteCodeWriter = new ByteCodeWriter(); - byteCodeWriter.Write(this._reader.GetAddress(this._objectSectionStart), num); + byteCodeWriter.Write(_reader.GetAddress(_objectSectionStart), num); reader = byteCodeWriter.CreateReader(); } - this._loadResultTarget.SetObjectSection(reader); + _loadResultTarget.SetObjectSection(reader); } private void DepersistBinaryDataTable(uint binaryDataTableOffset) { - uint currentOffset = this._reader.CurrentOffset; - this._reader.CurrentOffset = binaryDataTableOffset; - int stringCount = this._reader.ReadInt32(); - this._binaryDataTable = new MarkupBinaryDataTable(null, stringCount); - if (!this._reader.IsInFixedMemory) + uint currentOffset = _reader.CurrentOffset; + _reader.CurrentOffset = binaryDataTableOffset; + int stringCount = _reader.ReadInt32(); + _binaryDataTable = new MarkupBinaryDataTable(null, stringCount); + if (!_reader.IsInFixedMemory) { - this._reader.CurrentOffset += (uint)((stringCount + 1) * 4); - Vector strings = this._binaryDataTable.Strings; + _reader.CurrentOffset += (uint)((stringCount + 1) * 4); + Vector strings = _binaryDataTable.Strings; for (int index = 0; index < stringCount; ++index) { - string str = this._reader.ReadString(); + string str = _reader.ReadString(); strings[index] = str; } } else - this._binaryDataTable.SetStringTableReader(new ByteCodeReader(this._reader.CurrentAddress, ByteCodeReader.ReadUInt32(this._reader.GetAddress(this._reader.CurrentOffset + (uint)(stringCount * 4))), false)); - this._loadResultTarget.SetBinaryDataTable(this._binaryDataTable); - this._reader.CurrentOffset = currentOffset; + _binaryDataTable.SetStringTableReader(new ByteCodeReader(_reader.CurrentAddress, ByteCodeReader.ReadUInt32(_reader.GetAddress(_reader.CurrentOffset + (uint)(stringCount * 4))), false)); + _loadResultTarget.SetBinaryDataTable(_binaryDataTable); + _reader.CurrentOffset = currentOffset; } private LoadResult MapIndexToDependent(ushort index) @@ -678,19 +672,17 @@ namespace Microsoft.Iris.Markup loadResult = MarkupSystem.UIXGlobal; break; default: - loadResult = this._binaryDataTableLoadResult == null ? this._loadResultTarget.Dependencies[index] : this._binaryDataTableLoadResult.Dependencies[index]; + loadResult = _binaryDataTableLoadResult == null ? _loadResultTarget.Dependencies[index] : _binaryDataTableLoadResult.Dependencies[index]; break; } return loadResult; } - private TypeSchema MapIndexToType(ushort index) => this._loadResultTarget.ImportTables.TypeImports[index]; + private TypeSchema MapIndexToType(ushort index) => _loadResultTarget.ImportTables.TypeImports[index]; - private string ReadDataTableString() => this._binaryDataTable.GetStringByIndex(this._reader.ReadInt32()); + private string ReadDataTableString() => _binaryDataTable.GetStringByIndex(_reader.ReadInt32()); - private static string ReadDataTableString( - ByteCodeReader reader, - MarkupBinaryDataTable binaryDataTable) + private static string ReadDataTableString(ByteCodeReader reader, MarkupBinaryDataTable binaryDataTable) { int index = reader.ReadInt32(); return binaryDataTable.GetStringByIndex(index); @@ -698,54 +690,52 @@ namespace Microsoft.Iris.Markup private uint[] ReadUInt32ArrayHelper() { - uint num = this._reader.ReadUInt32(); + uint num = _reader.ReadUInt32(); if (num <= 0U) return null; uint[] numArray = new uint[num]; for (int index = 0; index < num; ++index) - numArray[index] = this._reader.ReadUInt32(); + numArray[index] = _reader.ReadUInt32(); return numArray; } private string[] ReadStringArrayHelper() { - uint num = this._reader.ReadUInt32(); + uint num = _reader.ReadUInt32(); if (num <= 0U) return null; string[] strArray = new string[num]; for (int index = 0; index < num; ++index) - strArray[index] = this.ReadDataTableString(); + strArray[index] = ReadDataTableString(); return strArray; } - private MethodSchema[] ReadMarkupMethodArrayHelper( - TypeSchema markupTypeDefinition, - MarkupTypeSchema typeExport) + private MethodSchema[] ReadMarkupMethodArrayHelper(TypeSchema markupTypeDefinition, MarkupTypeSchema typeExport) { MethodSchema[] methodSchemaArray = null; - ushort num1 = this._reader.ReadUInt16(); + ushort num1 = _reader.ReadUInt16(); if (num1 > 0) { methodSchemaArray = new MethodSchema[num1]; for (int index1 = 0; index1 < num1; ++index1) { - string name = this.ReadDataTableString(); - TypeSchema type = this.MapIndexToType(this._reader.ReadUInt16()); - uint num2 = this._reader.ReadUInt32(); + string name = ReadDataTableString(); + TypeSchema type = MapIndexToType(_reader.ReadUInt16()); + uint num2 = _reader.ReadUInt32(); TypeSchema[] parameterTypes = TypeSchema.EmptyList; if (num2 > 0U) { parameterTypes = new TypeSchema[num2]; for (int index2 = 0; index2 < num2; ++index2) { - ushort index3 = this._reader.ReadUInt16(); - parameterTypes[index2] = this.MapIndexToType(index3); + ushort index3 = _reader.ReadUInt16(); + parameterTypes[index2] = MapIndexToType(index3); } } - string[] parameterNames = this.ReadStringArrayHelper() ?? MarkupMethodSchema.s_emptyStringArray; - int virtualId = this._reader.ReadInt32(); - bool isVirtualThunk = this._reader.ReadBool(); - uint codeOffset = this._reader.ReadUInt32(); + string[] parameterNames = ReadStringArrayHelper() ?? MarkupMethodSchema.s_emptyStringArray; + int virtualId = _reader.ReadInt32(); + bool isVirtualThunk = _reader.ReadBool(); + uint codeOffset = _reader.ReadUInt32(); MarkupMethodSchema markupMethodSchema = MarkupMethodSchema.Build(markupTypeDefinition, typeExport, name, type, parameterTypes, parameterNames, isVirtualThunk); markupMethodSchema.SetCodeOffset(codeOffset); markupMethodSchema.SetVirtualId(virtualId); @@ -774,37 +764,37 @@ namespace Microsoft.Iris.Markup private TypeSchema[] GetTempParameterArray(int count) { - if (this._typeSchemaArrays == null) - this._typeSchemaArrays = new TypeSchema[5][]; - if (count >= this._typeSchemaArrays.Length) + if (_typeSchemaArrays == null) + _typeSchemaArrays = new TypeSchema[5][]; + if (count >= _typeSchemaArrays.Length) return new TypeSchema[count]; int index = count - 1; - if (this._typeSchemaArrays[index] == null) - this._typeSchemaArrays[index] = new TypeSchema[count]; - return this._typeSchemaArrays[index]; + if (_typeSchemaArrays[index] == null) + _typeSchemaArrays[index] = new TypeSchema[count]; + return _typeSchemaArrays[index]; } - public void ReportError(string error, string param0, string param1, string param2) => this.ReportError(string.Format(error, param0, param1, param2)); + public void ReportError(string error, string param0, string param1, string param2) => ReportError(string.Format(error, param0, param1, param2)); - public void ReportError(string error, string param0, string param1) => this.ReportError(string.Format(error, param0, param1)); + public void ReportError(string error, string param0, string param1) => ReportError(string.Format(error, param0, param1)); - public void ReportError(string error, string param0) => this.ReportError(string.Format(error, param0)); + public void ReportError(string error, string param0) => ReportError(string.Format(error, param0)); public void ReportError(string error) { - this.MarkHasErrors(); + MarkHasErrors(); ErrorManager.ReportError(error); } public void MarkHasErrors() { - if (this._hasErrors) + if (_hasErrors) return; - this._hasErrors = true; - this._loadResultTarget.MarkLoadFailed(); + _hasErrors = true; + _loadResultTarget.MarkLoadFailed(); } - public bool HasErrors => this._hasErrors; + public bool HasErrors => _hasErrors; public static bool IsUIB(Resource resource) { diff --git a/UIX/Microsoft/Iris/Markup/ConstructorSchema.cs b/UIX/Microsoft/Iris/Markup/ConstructorSchema.cs index feef60e..4315870 100644 --- a/UIX/Microsoft/Iris/Markup/ConstructorSchema.cs +++ b/UIX/Microsoft/Iris/Markup/ConstructorSchema.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.Markup public ConstructorSchema(TypeSchema owner) { - this._owner = owner; - this.DeclareOwner(owner); + _owner = owner; + DeclareOwner(owner); } - public TypeSchema Owner => this._owner; + public TypeSchema Owner => _owner; public abstract TypeSchema[] ParameterTypes { get; } diff --git a/UIX/Microsoft/Iris/Markup/DelegateListener.cs b/UIX/Microsoft/Iris/Markup/DelegateListener.cs index 6eedcb5..e92d9b0 100644 --- a/UIX/Microsoft/Iris/Markup/DelegateListener.cs +++ b/UIX/Microsoft/Iris/Markup/DelegateListener.cs @@ -15,21 +15,21 @@ namespace Microsoft.Iris.Markup string watch, DelegateListener.OnNotifyCallback callback) { - this._watch = watch; - this._onNotify = callback; + _watch = watch; + _onNotify = callback; notifier.AddListener(this); } public override void Dispose() { base.Dispose(); - this._onNotify = null; + _onNotify = null; } public override void OnNotify() { base.OnNotify(); - this._onNotify(this); + _onNotify(this); } public delegate void OnNotifyCallback(DelegateListener listener); diff --git a/UIX/Microsoft/Iris/Markup/DestructiveListener.cs b/UIX/Microsoft/Iris/Markup/DestructiveListener.cs index b224599..bc0015e 100644 --- a/UIX/Microsoft/Iris/Markup/DestructiveListener.cs +++ b/UIX/Microsoft/Iris/Markup/DestructiveListener.cs @@ -17,14 +17,14 @@ namespace Microsoft.Iris.Markup uint scriptId, uint refreshId) { - this.Reset(notifier, watch, scriptHost, scriptId); - this._refreshId = refreshId; + Reset(notifier, watch, scriptHost, scriptId); + _refreshId = refreshId; } public override void OnNotify() { base.OnNotify(); - this.ScriptHost.ScheduleScriptRun(this._refreshId, true); + ScriptHost.ScheduleScriptRun(_refreshId, true); } } } diff --git a/UIX/Microsoft/Iris/Markup/EffectClassTypeSchema.cs b/UIX/Microsoft/Iris/Markup/EffectClassTypeSchema.cs index 5815c56..8b0401e 100644 --- a/UIX/Microsoft/Iris/Markup/EffectClassTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/EffectClassTypeSchema.cs @@ -30,7 +30,7 @@ namespace Microsoft.Iris.Markup protected override void SealWorker() { base.SealWorker(); - this._defaultProperty = this.FindPropertyDeep("Default"); + _defaultProperty = FindPropertyDeep("Default"); } public override MarkupType MarkupType => MarkupType.Effect; @@ -38,31 +38,31 @@ namespace Microsoft.Iris.Markup protected override void OnDispose() { base.OnDispose(); - if (this._effectTemplate == null) + if (_effectTemplate == null) return; - this._effectTemplate.UnregisterUsage(this); - this._effectTemplate = null; + _effectTemplate.UnregisterUsage(this); + _effectTemplate = null; } protected override TypeSchema DefaultBase => EffectInstanceSchema.Type; public override Type RuntimeType => typeof(EffectClass); - public string DefaultElementSymbol => this._defaultElementSymbolIndex >= 0 ? this.SymbolReferenceTable[this._defaultElementSymbolIndex].Symbol : null; + public string DefaultElementSymbol => _defaultElementSymbolIndex >= 0 ? SymbolReferenceTable[_defaultElementSymbolIndex].Symbol : null; protected override Class ConstructNewInstance() { - this.EnsureEffectTemplate(); - return new EffectClass(this, this._effectTemplate); + EnsureEffectTemplate(); + return new EffectClass(this, _effectTemplate); } protected override bool RunInitialEvaluates(IMarkupTypeBase scriptHost) { bool flag = true; - if (this._instancePropertyAssignments != null && this._templateIndexBuilt >= 0) + if (_instancePropertyAssignments != null && _templateIndexBuilt >= 0) { ErrorManager.EnterContext(this); - flag = this.RunInitializeScript(scriptHost, this._instancePropertyAssignments[this._templateIndexBuilt]); + flag = RunInitializeScript(scriptHost, _instancePropertyAssignments[_templateIndexBuilt]); ErrorManager.ExitContext(); } return flag && base.RunInitialEvaluates(scriptHost); @@ -70,16 +70,16 @@ namespace Microsoft.Iris.Markup private void EnsureEffectTemplate() { - if (this._effectTemplate != null) + if (_effectTemplate != null) return; - this._effectTemplate = UISession.Default.RenderSession.CreateEffectTemplate(this, this.Name); + _effectTemplate = UISession.Default.RenderSession.CreateEffectTemplate(this, Name); ErrorManager.EnterContext(this); Class @class = new Class(this); @class.DeclareOwner(this); - this._templateIndexBuilt = -1; - for (int index = 0; index < this._techniqueOffsets.Length; ++index) + _templateIndexBuilt = -1; + for (int index = 0; index < _techniqueOffsets.Length; ++index) { - object obj = this.RunAtOffset(@class, this._techniqueOffsets[index]); + object obj = RunAtOffset(@class, _techniqueOffsets[index]); if (obj == Interpreter.ScriptError) { if (!ErrorManager.IgnoringErrors) @@ -88,14 +88,14 @@ namespace Microsoft.Iris.Markup else { EffectInput input = (EffectInput)obj; - if (this._dynamicElementAssignments != null) + if (_dynamicElementAssignments != null) { - foreach (string elementAssignment in this._dynamicElementAssignments) - this._effectTemplate.AddEffectProperty(elementAssignment); + foreach (string elementAssignment in _dynamicElementAssignments) + _effectTemplate.AddEffectProperty(elementAssignment); } - if (this._effectTemplate.Build(input)) + if (_effectTemplate.Build(input)) { - this._templateIndexBuilt = index; + _templateIndexBuilt = index; break; } } @@ -104,20 +104,20 @@ namespace Microsoft.Iris.Markup ErrorManager.ExitContext(); } - public uint[] TechniqueOffsets => this._techniqueOffsets; + public uint[] TechniqueOffsets => _techniqueOffsets; - public uint[] InstancePropertyAssignments => this._instancePropertyAssignments; + public uint[] InstancePropertyAssignments => _instancePropertyAssignments; - public string[] DynamicElementAssignments => this._dynamicElementAssignments; + public string[] DynamicElementAssignments => _dynamicElementAssignments; - public int DefaultElementSymbolIndex => this._defaultElementSymbolIndex; + public int DefaultElementSymbolIndex => _defaultElementSymbolIndex; - public void SetTechniqueOffsets(uint[] techniqueOffsets) => this._techniqueOffsets = techniqueOffsets; + public void SetTechniqueOffsets(uint[] techniqueOffsets) => _techniqueOffsets = techniqueOffsets; - public void SetInstancePropertyAssignments(uint[] instancePropertyAssignments) => this._instancePropertyAssignments = instancePropertyAssignments; + public void SetInstancePropertyAssignments(uint[] instancePropertyAssignments) => _instancePropertyAssignments = instancePropertyAssignments; - public void SetDynamicElementAssignments(string[] dynamicElementAssignments) => this._dynamicElementAssignments = dynamicElementAssignments; + public void SetDynamicElementAssignments(string[] dynamicElementAssignments) => _dynamicElementAssignments = dynamicElementAssignments; - public void SetDefaultElementSymbolIndex(int symbolIndex) => this._defaultElementSymbolIndex = symbolIndex; + public void SetDefaultElementSymbolIndex(int symbolIndex) => _defaultElementSymbolIndex = symbolIndex; } } diff --git a/UIX/Microsoft/Iris/Markup/EnumSchema.cs b/UIX/Microsoft/Iris/Markup/EnumSchema.cs index 98b0e91..35f2b7a 100644 --- a/UIX/Microsoft/Iris/Markup/EnumSchema.cs +++ b/UIX/Microsoft/Iris/Markup/EnumSchema.cs @@ -33,20 +33,20 @@ namespace Microsoft.Iris.Markup string[] names, int[] values) { - this._name = enumName; - this._enumType = runtimeType; - this._isFlags = isFlags; - this._names = names; - this._values = values; + _name = enumName; + _enumType = runtimeType; + _isFlags = isFlags; + _names = names; + _values = values; } protected virtual void InitializeNameToValueMap() { - this._nameToValueMap = new Map(this._names.Length); - for (int index = 0; index < this._names.Length; ++index) - this._nameToValueMap[this._names[index]] = this._values[index]; - this._names = null; - this._values = null; + _nameToValueMap = new Map(_names.Length); + for (int index = 0; index < _names.Length; ++index) + _nameToValueMap[_names[index]] = _values[index]; + _names = null; + _values = null; } [Conditional("DEBUG")] @@ -59,7 +59,7 @@ namespace Microsoft.Iris.Markup get { Vector vector = new Vector(); - foreach (string key in this.NameToValueMap.Keys) + foreach (string key in NameToValueMap.Keys) vector.Add(key); return vector; } @@ -69,15 +69,15 @@ namespace Microsoft.Iris.Markup { get { - if (this._nameToValueMap == null) - this.InitializeNameToValueMap(); - return this._nameToValueMap; + if (_nameToValueMap == null) + InitializeNameToValueMap(); + return _nameToValueMap; } } - protected bool IsFlags => this._isFlags; + protected bool IsFlags => _isFlags; - public override string Name => this._name; + public override string Name => _name; public override string AlternateName => (string)null; @@ -85,15 +85,15 @@ namespace Microsoft.Iris.Markup public override bool Contractual => false; - public override Type RuntimeType => this._enumType; + public override Type RuntimeType => _enumType; - public override bool IsNativeAssignableFrom(object check) => this.RuntimeType.IsAssignableFrom(check.GetType()); + public override bool IsNativeAssignableFrom(object check) => RuntimeType.IsAssignableFrom(check.GetType()); public override bool IsNativeAssignableFrom(TypeSchema check) => false; public override bool Disposable => false; - public override object ConstructDefault() => this.EnumValueToObject(0); + public override object ConstructDefault() => EnumValueToObject(0); public override bool HasDefaultConstructor => true; @@ -114,12 +114,12 @@ namespace Microsoft.Iris.Markup public override object FindCanonicalInstance(string name) { int num; - return this.NameToValue(name, out num) ? this.EnumValueToObject(num) : null; + return NameToValue(name, out num) ? EnumValueToObject(num) : null; } - public bool NameToValue(string name, out int value) => this.NameToValueMap.TryGetValue(name, out value); + public bool NameToValue(string name, out int value) => NameToValueMap.TryGetValue(name, out value); - protected virtual object EnumValueToObject(int value) => Enum.ToObject(this._enumType, value); + protected virtual object EnumValueToObject(int value) => Enum.ToObject(_enumType, value); protected virtual int ValueFromObject(object obj) => (int)obj; @@ -129,19 +129,19 @@ namespace Microsoft.Iris.Markup { instance = null; int num1 = 0; - if (this._isFlags && value.IndexOf(',') >= 0) + if (_isFlags && value.IndexOf(',') >= 0) { foreach (string name in StringUtility.SplitAndTrim(',', value)) { int num2; - if (!this.NameToValue(name, out num2)) + if (!NameToValue(name, out num2)) return Result.Fail("Unable to convert \"{0}\" to type '{1}'", name, _name); num1 |= num2; } } - else if (!this.NameToValue(value, out num1)) + else if (!NameToValue(value, out num1)) return Result.Fail("Unable to convert \"{0}\" to type '{1}'", value, _name); - instance = this.EnumValueToObject(num1); + instance = EnumValueToObject(num1); return Result.Success; } @@ -152,10 +152,10 @@ namespace Microsoft.Iris.Markup { Result result; if (StringSchema.Type.IsAssignableFrom(fromType)) - result = this.ConvertFromString((string)from, out instance); + result = ConvertFromString((string)from, out instance); else if (Int32Schema.Type.IsAssignableFrom(fromType)) { - instance = this.EnumValueToObject((int)from); + instance = EnumValueToObject((int)from); result = Result.Success; } else @@ -168,9 +168,9 @@ namespace Microsoft.Iris.Markup public override bool SupportsTypeConversion(TypeSchema fromType) => StringSchema.Type.IsAssignableFrom(fromType) || Int32Schema.Type.IsAssignableFrom(fromType); - public override void EncodeBinary(ByteCodeWriter writer, object instance) => writer.WriteInt32(this.ValueFromObject(instance)); + public override void EncodeBinary(ByteCodeWriter writer, object instance) => writer.WriteInt32(ValueFromObject(instance)); - public override object DecodeBinary(ByteCodeReader reader) => this.EnumValueToObject(reader.ReadInt32()); + public override object DecodeBinary(ByteCodeReader reader) => EnumValueToObject(reader.ReadInt32()); public override bool SupportsBinaryEncoding => true; diff --git a/UIX/Microsoft/Iris/Markup/EventSchema.cs b/UIX/Microsoft/Iris/Markup/EventSchema.cs index 58e9a09..ba5914d 100644 --- a/UIX/Microsoft/Iris/Markup/EventSchema.cs +++ b/UIX/Microsoft/Iris/Markup/EventSchema.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.Markup public EventSchema(TypeSchema owner) { - this._owner = owner; - this.DeclareOwner(owner); + _owner = owner; + DeclareOwner(owner); } - public TypeSchema Owner => this._owner; + public TypeSchema Owner => _owner; public abstract string Name { get; } } diff --git a/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyPrimitiveTypeSchema.cs b/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyPrimitiveTypeSchema.cs index ca72ca2..546c322 100644 --- a/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyPrimitiveTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyPrimitiveTypeSchema.cs @@ -15,28 +15,28 @@ namespace Microsoft.Iris.Markup public FrameworkCompatibleAssemblyPrimitiveTypeSchema(TypeSchema frameworkSchema) : base(frameworkSchema.RuntimeType) - => this._frameworkSchema = frameworkSchema; + => _frameworkSchema = frameworkSchema; public override Result TypeConverter( object from, TypeSchema fromType, out object instance) { - return this._frameworkSchema.TypeConverter(from, fromType, out instance); + return _frameworkSchema.TypeConverter(from, fromType, out instance); } - public override bool SupportsTypeConversion(TypeSchema fromType) => this._frameworkSchema.SupportsTypeConversion(fromType); + public override bool SupportsTypeConversion(TypeSchema fromType) => _frameworkSchema.SupportsTypeConversion(fromType); - public override void EncodeBinary(ByteCodeWriter writer, object instance) => this._frameworkSchema.EncodeBinary(writer, instance); + public override void EncodeBinary(ByteCodeWriter writer, object instance) => _frameworkSchema.EncodeBinary(writer, instance); - public override object DecodeBinary(ByteCodeReader reader) => this._frameworkSchema.DecodeBinary(reader); + public override object DecodeBinary(ByteCodeReader reader) => _frameworkSchema.DecodeBinary(reader); - public override bool SupportsBinaryEncoding => this._frameworkSchema.SupportsBinaryEncoding; + public override bool SupportsBinaryEncoding => _frameworkSchema.SupportsBinaryEncoding; - public override bool IsRuntimeImmutable => this._frameworkSchema.IsRuntimeImmutable; + public override bool IsRuntimeImmutable => _frameworkSchema.IsRuntimeImmutable; - public override object PerformOperation(object left, object right, OperationType op) => this._frameworkSchema.PerformOperation(left, right, op); + public override object PerformOperation(object left, object right, OperationType op) => _frameworkSchema.PerformOperation(left, right, op); - public override bool SupportsOperation(OperationType op) => this._frameworkSchema.SupportsOperation(op); + public override bool SupportsOperation(OperationType op) => _frameworkSchema.SupportsOperation(op); } } diff --git a/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyTypeSchema.cs b/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyTypeSchema.cs index e10a6bc..17149e5 100644 --- a/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/FrameworkCompatibleAssemblyTypeSchema.cs @@ -38,14 +38,14 @@ namespace Microsoft.Iris.Markup TypeSchema baseType) : base(assemblyType, baseType) { - this._frameworkType = frameworkType; - this._constructDefaultType = constructDefaultType; + _frameworkType = frameworkType; + _constructDefaultType = constructDefaultType; } - public override Type RuntimeType => this._frameworkType; + public override Type RuntimeType => _frameworkType; - public override bool HasDefaultConstructor => base.HasDefaultConstructor || this._constructDefaultType != null; + public override bool HasDefaultConstructor => base.HasDefaultConstructor || _constructDefaultType != null; - public override object ConstructDefault() => base.HasDefaultConstructor ? base.ConstructDefault() : AssemblyLoadResult.WrapObject(this, Activator.CreateInstance(this._constructDefaultType)); + public override object ConstructDefault() => base.HasDefaultConstructor ? base.ConstructDefault() : AssemblyLoadResult.WrapObject(this, Activator.CreateInstance(_constructDefaultType)); } } diff --git a/UIX/Microsoft/Iris/Markup/InterpreterContext.cs b/UIX/Microsoft/Iris/Markup/InterpreterContext.cs index 017c3bb..1318d8d 100644 --- a/UIX/Microsoft/Iris/Markup/InterpreterContext.cs +++ b/UIX/Microsoft/Iris/Markup/InterpreterContext.cs @@ -23,23 +23,23 @@ namespace Microsoft.Iris.Markup { } - string IErrorContextSource.GetErrorContextDescription() => this._type.Owner.ErrorContextUri; + string IErrorContextSource.GetErrorContextDescription() => _type.Owner.ErrorContextUri; void IErrorContextSource.GetErrorPosition(ref int line, ref int column) { - uint currentOffset = this._loadResult.ObjectSection.CurrentOffset; + uint currentOffset = _loadResult.ObjectSection.CurrentOffset; if (currentOffset > 0U) --currentOffset; - this._loadResult.LineNumberTable.Lookup(currentOffset, out line, out column); + _loadResult.LineNumberTable.Lookup(currentOffset, out line, out column); } - public IMarkupTypeBase Instance => this._instance; + public IMarkupTypeBase Instance => _instance; - public MarkupTypeSchema MarkupType => this._type; + public MarkupTypeSchema MarkupType => _type; - public uint InitialBytecodeOffset => this._initialBytecodeOffset; + public uint InitialBytecodeOffset => _initialBytecodeOffset; - public MarkupLoadResult LoadResult => this._loadResult; + public MarkupLoadResult LoadResult => _loadResult; public object ReadSymbol(SymbolReference symbolRef) { @@ -47,13 +47,13 @@ namespace Microsoft.Iris.Markup switch (symbolRef.Origin) { case SymbolOrigin.ScopedLocal: - this._scopedLocals.TryGetValue(symbolRef.Symbol, out obj); + _scopedLocals.TryGetValue(symbolRef.Symbol, out obj); break; case SymbolOrigin.Parameter: - obj = this._parameterContext.ReadParameter(symbolRef.Symbol); + obj = _parameterContext.ReadParameter(symbolRef.Symbol); break; default: - obj = this._instance.ReadSymbol(symbolRef); + obj = _instance.ReadSymbol(symbolRef); break; } return obj; @@ -64,15 +64,15 @@ namespace Microsoft.Iris.Markup switch (symbolRef.Origin) { case SymbolOrigin.ScopedLocal: - if (this._scopedLocals == null) - this._scopedLocals = new Map(); - this._scopedLocals[symbolRef.Symbol] = value; + if (_scopedLocals == null) + _scopedLocals = new Map(); + _scopedLocals[symbolRef.Symbol] = value; break; case SymbolOrigin.Parameter: - this._parameterContext.WriteParameter(symbolRef.Symbol, value); + _parameterContext.WriteParameter(symbolRef.Symbol, value); break; default: - this._instance.WriteSymbol(symbolRef, value); + _instance.WriteSymbol(symbolRef, value); break; } } @@ -81,7 +81,7 @@ namespace Microsoft.Iris.Markup { if (symbolRef.Origin != SymbolOrigin.ScopedLocal) return; - this._scopedLocals.Remove(symbolRef.Symbol); + _scopedLocals.Remove(symbolRef.Symbol); } public static InterpreterContext Acquire( diff --git a/UIX/Microsoft/Iris/Markup/Listener.cs b/UIX/Microsoft/Iris/Markup/Listener.cs index 63851a6..c3a7248 100644 --- a/UIX/Microsoft/Iris/Markup/Listener.cs +++ b/UIX/Microsoft/Iris/Markup/Listener.cs @@ -10,11 +10,11 @@ namespace Microsoft.Iris.Markup { protected string _watch; - public string Watch => this._watch; + public string Watch => _watch; public override void Dispose() { - this._watch = null; + _watch = null; base.Dispose(); } diff --git a/UIX/Microsoft/Iris/Markup/ListenerEncodeMode.cs b/UIX/Microsoft/Iris/Markup/ListenerEncodeMode.cs index 84d5aef..e14f781 100644 --- a/UIX/Microsoft/Iris/Markup/ListenerEncodeMode.cs +++ b/UIX/Microsoft/Iris/Markup/ListenerEncodeMode.cs @@ -16,18 +16,18 @@ namespace Microsoft.Iris.Markup public ListenerEncodeMode(MarkupTypeSchema typeSchema) { - this._typeSchema = typeSchema; + _typeSchema = typeSchema; if (typeSchema.MarkupTypeBase == null) return; - this._totalListenersOnBaseType = typeSchema.MarkupTypeBase.TotalListenerCount; + _totalListenersOnBaseType = typeSchema.MarkupTypeBase.TotalListenerCount; } - public uint SequentialListenerIndex(uint localListenerIndex) => this._totalListenersOnBaseType + localListenerIndex; + public uint SequentialListenerIndex(uint localListenerIndex) => _totalListenersOnBaseType + localListenerIndex; - public uint ScriptId => this._typeSchema.EncodeScriptOffsetAsId(this.TriggerContainer.ActionCode.EncodeStartOffset); + public uint ScriptId => _typeSchema.EncodeScriptOffsetAsId(TriggerContainer.ActionCode.EncodeStartOffset); - public uint RefreshId => this._typeSchema.EncodeScriptOffsetAsId(this.TriggerContainer.SourceExpression.EncodeStartOffset); + public uint RefreshId => _typeSchema.EncodeScriptOffsetAsId(TriggerContainer.SourceExpression.EncodeStartOffset); - public bool RunOnNonTailTrigger => this.TriggerContainer.SourceExpression.ExpressionType != ExpressionType.Call || ((ValidateExpressionCall)this.TriggerContainer.SourceExpression).FoundMemberType != SchemaType.Event; + public bool RunOnNonTailTrigger => TriggerContainer.SourceExpression.ExpressionType != ExpressionType.Call || ((ValidateExpressionCall)TriggerContainer.SourceExpression).FoundMemberType != SchemaType.Event; } } diff --git a/UIX/Microsoft/Iris/Markup/ListenerNodeBase.cs b/UIX/Microsoft/Iris/Markup/ListenerNodeBase.cs index d1e8031..0ffd048 100644 --- a/UIX/Microsoft/Iris/Markup/ListenerNodeBase.cs +++ b/UIX/Microsoft/Iris/Markup/ListenerNodeBase.cs @@ -15,48 +15,48 @@ namespace Microsoft.Iris.Markup protected ListenerNodeBase() { - this._next = null; - this._prev = null; + _next = null; + _prev = null; } public virtual void Dispose() { - if (!this.IsLinked) + if (!IsLinked) return; - this.Unlink(); + Unlink(); } - public ListenerNodeBase Next => this._next; + public ListenerNodeBase Next => _next; - public bool IsLinked => this._next != null && this._prev != null; + public bool IsLinked => _next != null && _prev != null; public void AddPrevious(ListenerNodeBase node) { - if (this._prev == null) + if (_prev == null) { - this._prev = this; - this._next = this; + _prev = this; + _next = this; } - node._prev = this._prev; + node._prev = _prev; node._next = this; - this._prev._next = node; - this._prev = node; + _prev._next = node; + _prev = node; } public void Unlink() { - if (this._prev == this._next) + if (_prev == _next) { - this._prev._next = null; - this._prev._prev = null; + _prev._next = null; + _prev._prev = null; } else { - this._prev._next = this._next; - this._next._prev = this._prev; + _prev._next = _next; + _next._prev = _prev; } - this._prev = null; - this._next = null; + _prev = null; + _next = null; } [Conditional("DEBUG")] diff --git a/UIX/Microsoft/Iris/Markup/Listeners.cs b/UIX/Microsoft/Iris/Markup/Listeners.cs index abbd262..2fcb094 100644 --- a/UIX/Microsoft/Iris/Markup/Listeners.cs +++ b/UIX/Microsoft/Iris/Markup/Listeners.cs @@ -12,26 +12,26 @@ namespace Microsoft.Iris.Markup { protected Vector _listenerList; - protected Listeners(Vector listeners) => this._listenerList = listeners; + protected Listeners(Vector listeners) => _listenerList = listeners; - protected Listeners(int listenerCount) => this.AddEntries(listenerCount); + protected Listeners(int listenerCount) => AddEntries(listenerCount); public void AddEntries(int listenerCount) { - if (this._listenerList == null) - this._listenerList = new Vector(listenerCount); + if (_listenerList == null) + _listenerList = new Vector(listenerCount); else - this._listenerList.Capacity += listenerCount; + _listenerList.Capacity += listenerCount; for (int index = 0; index < listenerCount; ++index) - this._listenerList.Add(null); + _listenerList.Add(null); } protected override void OnDispose() { base.OnDispose(); - for (int index = 0; index < this._listenerList.Count; ++index) - this._listenerList[index]?.Dispose(); - this._listenerList = null; + for (int index = 0; index < _listenerList.Count; ++index) + _listenerList[index]?.Dispose(); + _listenerList = null; } } } diff --git a/UIX/Microsoft/Iris/Markup/LoadResult.cs b/UIX/Microsoft/Iris/Markup/LoadResult.cs index 82098c0..66a02c8 100644 --- a/UIX/Microsoft/Iris/Markup/LoadResult.cs +++ b/UIX/Microsoft/Iris/Markup/LoadResult.cs @@ -18,26 +18,26 @@ namespace Microsoft.Iris.Markup private string _compilerReferenceName; public static LoadResult[] EmptyList = new LoadResult[0]; - public LoadResult(string uri) => this._uri = uri; + public LoadResult(string uri) => _uri = uri; protected override void OnDispose() => base.OnDispose(); - public string Uri => this._uri; + public string Uri => _uri; - public string UnderlyingUri => this._uriUnderlying; + public string UnderlyingUri => _uriUnderlying; - public string ErrorContextUri => this._uriUnderlying == null ? this._uri : this._uriUnderlying; + public string ErrorContextUri => _uriUnderlying == null ? _uri : _uriUnderlying; - public uint IslandReferences => this._islandReferences; + public uint IslandReferences => _islandReferences; public void AddReference(uint islandId) { - if (((int)this._islandReferences & (int)islandId) != 0) + if (((int)_islandReferences & (int)islandId) != 0) return; - if (this._islandReferences == 0U) - this.RegisterUsage(this); - this._islandReferences |= islandId; - foreach (LoadResult dependency in this.Dependencies) + if (_islandReferences == 0U) + RegisterUsage(this); + _islandReferences |= islandId; + foreach (LoadResult dependency in Dependencies) { if (dependency != this) dependency.AddReference(islandId); @@ -46,41 +46,41 @@ namespace Microsoft.Iris.Markup public void RemoveReferenceDeep(uint islandId) { - if ((this._islandReferences & islandId) <= 0U) + if ((_islandReferences & islandId) <= 0U) return; - this._islandReferences &= ~islandId; - foreach (LoadResult dependency in this.Dependencies) + _islandReferences &= ~islandId; + foreach (LoadResult dependency in Dependencies) { if (dependency != this) dependency.RemoveReferenceDeep(islandId); } - if (this._islandReferences != 0U) + if (_islandReferences != 0U) return; - this.UnregisterUsage(this); - foreach (LoadResult dependency in this.Dependencies) + UnregisterUsage(this); + foreach (LoadResult dependency in Dependencies) { if (dependency != this) dependency.UnregisterUsage(this); } } - public void RemoveAllReferences() => this.RemoveReferenceDeep(this.IslandReferences); + public void RemoveAllReferences() => RemoveReferenceDeep(IslandReferences); protected void RegisterDependenciesUsage() { - foreach (LoadResult dependency in this.Dependencies) + foreach (LoadResult dependency in Dependencies) { if (dependency != this) { dependency.RegisterUsage(this); - dependency.AddReference(this._islandReferences); + dependency.AddReference(_islandReferences); } } } - public void RegisterProxyUsage() => this.RegisterUsage(this); + public void RegisterProxyUsage() => RegisterUsage(this); - public void UnregisterProxyUsage() => this.UnregisterUsage(this); + public void UnregisterProxyUsage() => UnregisterUsage(this); public virtual void Load(LoadPass pass) { @@ -98,20 +98,20 @@ namespace Microsoft.Iris.Markup public void SetCompilerReferenceName(string name) { - if (this._compilerReferenceName == null) + if (_compilerReferenceName == null) { - this._compilerReferenceName = name; + _compilerReferenceName = name; } else { - if (name.Equals(this._compilerReferenceName, StringComparison.OrdinalIgnoreCase)) + if (name.Equals(_compilerReferenceName, StringComparison.OrdinalIgnoreCase)) return; ErrorManager.ReportWarning("Multiple names '{0}' and '{1}' used to refer to the same entity. The first name will be used for all references to this item within compiled UIB files", _compilerReferenceName, name); } } - public virtual string GetCompilerReferenceName() => this._compilerReferenceName; + public virtual string GetCompilerReferenceName() => _compilerReferenceName; - public override string ToString() => this._uri; + public override string ToString() => _uri; } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupBinaryDataTable.cs b/UIX/Microsoft/Iris/Markup/MarkupBinaryDataTable.cs index 7c78753..dcf84df 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupBinaryDataTable.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupBinaryDataTable.cs @@ -18,9 +18,9 @@ namespace Microsoft.Iris.Markup public MarkupBinaryDataTable(string uri, int stringCount) { - this._uri = uri; - this._strings = new Vector(stringCount); - this._strings.ExpandTo(stringCount); + _uri = uri; + _strings = new Vector(stringCount); + _strings.ExpandTo(stringCount); } public MarkupBinaryDataTable(string uri) @@ -28,52 +28,52 @@ namespace Microsoft.Iris.Markup { } - public void SetStringTableReader(ByteCodeReader stringTableReader) => this._stringTableReader = stringTableReader; + public void SetStringTableReader(ByteCodeReader stringTableReader) => _stringTableReader = stringTableReader; - public string Uri => this._uri; + public string Uri => _uri; public int GetIndexOrAdd(string s) { - int num = this._strings.IndexOf(s); + int num = _strings.IndexOf(s); if (num == -1) { - this._strings.Add(s); - num = this._strings.Count - 1; + _strings.Add(s); + num = _strings.Count - 1; } return num; } public string GetStringByIndex(int index) { - string str = this._strings[index]; + string str = _strings[index]; if (str == null) { - this._stringTableReader.CurrentOffset = (uint)(index * 4); - this._stringTableReader.CurrentOffset = this._stringTableReader.ReadUInt32(); - str = this._stringTableReader.ReadString(); - this._strings[index] = str; + _stringTableReader.CurrentOffset = (uint)(index * 4); + _stringTableReader.CurrentOffset = _stringTableReader.ReadUInt32(); + str = _stringTableReader.ReadString(); + _strings[index] = str; } return str; } - public Vector Strings => this._strings; + public Vector Strings => _strings; - public MarkupConstantsTable ConstantsTable => this._constantsTable; + public MarkupConstantsTable ConstantsTable => _constantsTable; - public MarkupImportTables ImportTables => this._importTables; + public MarkupImportTables ImportTables => _importTables; - public SourceMarkupImportTables SourceMarkupImportTables => this._sourceMarkupImportTables; + public SourceMarkupImportTables SourceMarkupImportTables => _sourceMarkupImportTables; - public void SetConstantsTable(MarkupConstantsTable constantsTable) => this._constantsTable = constantsTable; + public void SetConstantsTable(MarkupConstantsTable constantsTable) => _constantsTable = constantsTable; - public void SetImportTables(MarkupImportTables importTables) => this._importTables = importTables; + public void SetImportTables(MarkupImportTables importTables) => _importTables = importTables; - public void SetSourceMarkupImportTables(SourceMarkupImportTables sourceMarkupImportTables) => this._sourceMarkupImportTables = sourceMarkupImportTables; + public void SetSourceMarkupImportTables(SourceMarkupImportTables sourceMarkupImportTables) => _sourceMarkupImportTables = sourceMarkupImportTables; public LoadResult[] SharedDependenciesTableWithBinaryDataTable { - get => this._sharedDependenciesTable; - set => this._sharedDependenciesTable = value; + get => _sharedDependenciesTable; + set => _sharedDependenciesTable = value; } } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupCompiler.cs b/UIX/Microsoft/Iris/Markup/MarkupCompiler.cs index 30d4005..30f5148 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupCompiler.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupCompiler.cs @@ -113,250 +113,250 @@ namespace Microsoft.Iris.Markup MarkupLoadResult loadResult, MarkupBinaryDataTable sharedBinaryDataTable) { - this._writer = new ByteCodeWriter(); - this._loadResult = loadResult; - this.PersistHeader(); - this.PersistTableOfContents(sharedBinaryDataTable); - this.PersistDependencies(); - this.PersistTypeExportDeclarations(); - this.PersistTypeImportTable(); - this.PersistTypeExportDefinitions(); - this.PersistMemberImportTables(); - this.PersistDataMappingsTable(); - this.PersistConstantsTable(); - this.PersistBinaryDataTable(); - this.PersistObjectSection(); - this.PersistLineNumberTable(); - return this._writer; + _writer = new ByteCodeWriter(); + _loadResult = loadResult; + PersistHeader(); + PersistTableOfContents(sharedBinaryDataTable); + PersistDependencies(); + PersistTypeExportDeclarations(); + PersistTypeImportTable(); + PersistTypeExportDefinitions(); + PersistMemberImportTables(); + PersistDataMappingsTable(); + PersistConstantsTable(); + PersistBinaryDataTable(); + PersistObjectSection(); + PersistLineNumberTable(); + return _writer; } private void PersistHeader() { - this._writer.WriteUInt32(440551765U); - this._writer.WriteUInt32(1012U); + _writer.WriteUInt32(440551765U); + _writer.WriteUInt32(1012U); } private void PersistTableOfContents(MarkupBinaryDataTable sharedBinaryDataTable) { - this._objectSectionStartFixup = this._writer.DataSize; - this._writer.WriteUInt32(uint.MaxValue); - this._objectSectionEndFixup = this._writer.DataSize; - this._writer.WriteUInt32(uint.MaxValue); - this._lineNumberTableStartFixup = this._writer.DataSize; - this._writer.WriteUInt32(uint.MaxValue); - this._lineNumberTableEndFixup = this._writer.DataSize; - this._writer.WriteUInt32(uint.MaxValue); + _objectSectionStartFixup = _writer.DataSize; + _writer.WriteUInt32(uint.MaxValue); + _objectSectionEndFixup = _writer.DataSize; + _writer.WriteUInt32(uint.MaxValue); + _lineNumberTableStartFixup = _writer.DataSize; + _writer.WriteUInt32(uint.MaxValue); + _lineNumberTableEndFixup = _writer.DataSize; + _writer.WriteUInt32(uint.MaxValue); if (sharedBinaryDataTable != null) { - this._binaryDataTable = sharedBinaryDataTable; - this._writer.WriteString(this._binaryDataTable.Uri); - this._usingSharedBinaryDataTable = true; + _binaryDataTable = sharedBinaryDataTable; + _writer.WriteString(_binaryDataTable.Uri); + _usingSharedBinaryDataTable = true; } else { - this._writer.WriteString(null); - this._usingSharedBinaryDataTable = false; - this._binaryDataTable = this._loadResult.BinaryDataTable; - if (this._binaryDataTable == null) - this._binaryDataTable = new MarkupBinaryDataTable(null, 0); - this._binaryDataTableSectionOffsetFixup = this._writer.DataSize; - this._writer.WriteUInt32(uint.MaxValue); + _writer.WriteString(null); + _usingSharedBinaryDataTable = false; + _binaryDataTable = _loadResult.BinaryDataTable; + if (_binaryDataTable == null) + _binaryDataTable = new MarkupBinaryDataTable(null, 0); + _binaryDataTableSectionOffsetFixup = _writer.DataSize; + _writer.WriteUInt32(uint.MaxValue); } } private void PersistDependencies() { - if (this._usingSharedBinaryDataTable) + if (_usingSharedBinaryDataTable) return; - this._writer.WriteUInt16(this._loadResult.Dependencies.Length); - foreach (LoadResult dependency in this._loadResult.Dependencies) + _writer.WriteUInt16(_loadResult.Dependencies.Length); + foreach (LoadResult dependency in _loadResult.Dependencies) { - this._writer.WriteBool(dependency is MarkupLoadResult); - this.WriteDataTableString(dependency.GetCompilerReferenceName() ?? dependency.Uri); + _writer.WriteBool(dependency is MarkupLoadResult); + WriteDataTableString(dependency.GetCompilerReferenceName() ?? dependency.Uri); } } private void PersistTypeExportDeclarations() { - this._writer.WriteUInt16(this._loadResult.ExportTable.Length); - foreach (MarkupTypeSchema markupTypeSchema in this._loadResult.ExportTable) + _writer.WriteUInt16(_loadResult.ExportTable.Length); + foreach (MarkupTypeSchema markupTypeSchema in _loadResult.ExportTable) { MarkupType markupType = markupTypeSchema.MarkupType; - this.WriteDataTableString(markupTypeSchema.Name); - this._writer.WriteInt32((int)markupType); + WriteDataTableString(markupTypeSchema.Name); + _writer.WriteInt32((int)markupType); } - if (this._loadResult.AliasTable == null) + if (_loadResult.AliasTable == null) { - this._writer.WriteUInt16(0); + _writer.WriteUInt16(0); } else { - this._writer.WriteUInt16(this._loadResult.AliasTable.Length); - foreach (AliasMapping aliasMapping in this._loadResult.AliasTable) + _writer.WriteUInt16(_loadResult.AliasTable.Length); + foreach (AliasMapping aliasMapping in _loadResult.AliasTable) { - this.WriteDataTableString(aliasMapping.Alias); - this._writer.WriteUInt16(this.MapDependentToIndex(aliasMapping.LoadResult)); - this.WriteDataTableString(aliasMapping.TargetType); + WriteDataTableString(aliasMapping.Alias); + _writer.WriteUInt16(MapDependentToIndex(aliasMapping.LoadResult)); + WriteDataTableString(aliasMapping.TargetType); } } } private void PersistTypeImportTable() { - if (this._usingSharedBinaryDataTable) + if (_usingSharedBinaryDataTable) return; - this._writer.WriteUInt16(this._loadResult.ImportTables.TypeImports.Length); - foreach (TypeSchema typeImport in this._loadResult.ImportTables.TypeImports) + _writer.WriteUInt16(_loadResult.ImportTables.TypeImports.Length); + foreach (TypeSchema typeImport in _loadResult.ImportTables.TypeImports) { - this._writer.WriteUInt16(this.MapDependentToIndex(typeImport.Owner)); - this.WriteDataTableString(typeImport.Name); + _writer.WriteUInt16(MapDependentToIndex(typeImport.Owner)); + WriteDataTableString(typeImport.Name); } } private void PersistTypeExportDefinitions() { - foreach (MarkupTypeSchema markupTypeSchema in this._loadResult.ExportTable) + foreach (MarkupTypeSchema markupTypeSchema in _loadResult.ExportTable) { MarkupType markupType = markupTypeSchema.MarkupType; - this._writer.WriteUInt16(markupTypeSchema.TypeDepth); + _writer.WriteUInt16(markupTypeSchema.TypeDepth); if (markupTypeSchema.TypeDepth > 1U) - this._writer.WriteUInt16(this.MapTypeToIndex(markupTypeSchema.Base)); - this._writer.WriteUInt32(markupTypeSchema.InitializePropertiesOffset); - this._writer.WriteUInt32(markupTypeSchema.InitializeLocalsInputOffset); - this._writer.WriteUInt32(markupTypeSchema.InitializeContentOffset); - this.WriteUInt32ArrayHelper(markupTypeSchema.InitialEvaluateOffsets, "InitialEvaluateOffsets"); - this.WriteUInt32ArrayHelper(markupTypeSchema.FinalEvaluateOffsets, "FinalEvaluateOffsets"); - this.WriteUInt32ArrayHelper(markupTypeSchema.RefreshGroupOffsets, "RefreshGroupOffsets"); - this._writer.WriteUInt32(markupTypeSchema.ListenerCount); + _writer.WriteUInt16(MapTypeToIndex(markupTypeSchema.Base)); + _writer.WriteUInt32(markupTypeSchema.InitializePropertiesOffset); + _writer.WriteUInt32(markupTypeSchema.InitializeLocalsInputOffset); + _writer.WriteUInt32(markupTypeSchema.InitializeContentOffset); + WriteUInt32ArrayHelper(markupTypeSchema.InitialEvaluateOffsets, "InitialEvaluateOffsets"); + WriteUInt32ArrayHelper(markupTypeSchema.FinalEvaluateOffsets, "FinalEvaluateOffsets"); + WriteUInt32ArrayHelper(markupTypeSchema.RefreshGroupOffsets, "RefreshGroupOffsets"); + _writer.WriteUInt32(markupTypeSchema.ListenerCount); uint num1 = 0; if (markupTypeSchema.SymbolReferenceTable != null) num1 = (uint)markupTypeSchema.SymbolReferenceTable.Length; - this._writer.WriteUInt32(num1); + _writer.WriteUInt32(num1); if (num1 != 0U) { foreach (SymbolReference symbolReference in markupTypeSchema.SymbolReferenceTable) { - this.WriteDataTableString(symbolReference.Symbol); - this._writer.WriteByte((byte)symbolReference.Origin); + WriteDataTableString(symbolReference.Symbol); + _writer.WriteByte((byte)symbolReference.Origin); } } - uint dataSize1 = this._writer.DataSize; - this._writer.WriteUInt32(uint.MaxValue); - uint dataSize2 = this._writer.DataSize; + uint dataSize1 = _writer.DataSize; + _writer.WriteUInt32(uint.MaxValue); + uint dataSize2 = _writer.DataSize; uint num2 = 0; if (markupTypeSchema.InheritableSymbolsTable != null) num2 = (uint)markupTypeSchema.InheritableSymbolsTable.Length; - this._writer.WriteUInt32(num2); + _writer.WriteUInt32(num2); if (num2 != 0U) { foreach (SymbolRecord symbolRecord in markupTypeSchema.InheritableSymbolsTable) { - this.WriteDataTableString(symbolRecord.Name); - this._writer.WriteByte((byte)symbolRecord.SymbolOrigin); - this._writer.WriteUInt16(this.MapTypeToIndex(symbolRecord.Type)); + WriteDataTableString(symbolRecord.Name); + _writer.WriteByte((byte)symbolRecord.SymbolOrigin); + _writer.WriteUInt16(MapTypeToIndex(symbolRecord.Type)); } } - uint num3 = this._writer.DataSize - dataSize2; - this._writer.Overwrite(dataSize1, num3); - this._writer.WriteInt32(markupTypeSchema.TotalPropertiesAndLocalsCount); + uint num3 = _writer.DataSize - dataSize2; + _writer.Overwrite(dataSize1, num3); + _writer.WriteInt32(markupTypeSchema.TotalPropertiesAndLocalsCount); if (markupType == MarkupType.UI) { UIClassTypeSchema uiClassTypeSchema = (UIClassTypeSchema)markupTypeSchema; ushort num4 = 0; if (uiClassTypeSchema.NamedContentTable != null) num4 = (ushort)uiClassTypeSchema.NamedContentTable.Length; - this._writer.WriteUInt16(num4); + _writer.WriteUInt16(num4); if (num4 != 0) { foreach (NamedContentRecord namedContentRecord in uiClassTypeSchema.NamedContentTable) { - this.WriteDataTableString(namedContentRecord.Name); - this._writer.WriteUInt32(namedContentRecord.Offset); + WriteDataTableString(namedContentRecord.Name); + _writer.WriteUInt32(namedContentRecord.Offset); } } } else { - this._writer.WriteBool(((ClassTypeSchema)markupTypeSchema).IsShared); + _writer.WriteBool(((ClassTypeSchema)markupTypeSchema).IsShared); if (markupType == MarkupType.Effect) { EffectClassTypeSchema effectClassTypeSchema = (EffectClassTypeSchema)markupTypeSchema; - this.WriteUInt32ArrayHelper(effectClassTypeSchema.TechniqueOffsets, "TechniqueOffsets"); - this.WriteUInt32ArrayHelper(effectClassTypeSchema.InstancePropertyAssignments, "InstancePropertyAssignments"); - this.WriteStringArrayHelper(effectClassTypeSchema.DynamicElementAssignments, "DynamicElementAssignments"); - this._writer.WriteInt32(effectClassTypeSchema.DefaultElementSymbolIndex); + WriteUInt32ArrayHelper(effectClassTypeSchema.TechniqueOffsets, "TechniqueOffsets"); + WriteUInt32ArrayHelper(effectClassTypeSchema.InstancePropertyAssignments, "InstancePropertyAssignments"); + WriteStringArrayHelper(effectClassTypeSchema.DynamicElementAssignments, "DynamicElementAssignments"); + _writer.WriteInt32(effectClassTypeSchema.DefaultElementSymbolIndex); } if (markupType == MarkupType.DataQuery) { MarkupDataQuerySchema markupDataQuerySchema = (MarkupDataQuerySchema)markupTypeSchema; - this.WriteDataTableString(markupDataQuerySchema.ProviderName); - this._writer.WriteUInt16(this.MapTypeToIndex(markupDataQuerySchema.ResultType)); + WriteDataTableString(markupDataQuerySchema.ProviderName); + _writer.WriteUInt16(MapTypeToIndex(markupDataQuerySchema.ResultType)); } } PropertySchema[] properties = markupTypeSchema.Properties; - this._writer.WriteUInt16(properties.Length); + _writer.WriteUInt16(properties.Length); foreach (MarkupPropertySchema markupPropertySchema in properties) { - this.WriteDataTableString(markupPropertySchema.Name); - this._writer.WriteBool(markupPropertySchema.RequiredForCreation); + WriteDataTableString(markupPropertySchema.Name); + _writer.WriteBool(markupPropertySchema.RequiredForCreation); if (markupPropertySchema.OverrideCriteria != null) { PropertyOverrideCriteriaTypeConstraint overrideCriteria = (PropertyOverrideCriteriaTypeConstraint)markupPropertySchema.OverrideCriteria; - this._writer.WriteBool(true); - ushort index1 = this.MapTypeToIndex(overrideCriteria.Constraint); - ushort index2 = this.MapTypeToIndex(overrideCriteria.Use); - this._writer.WriteUInt16(index1); - this._writer.WriteUInt16(index2); + _writer.WriteBool(true); + ushort index1 = MapTypeToIndex(overrideCriteria.Constraint); + ushort index2 = MapTypeToIndex(overrideCriteria.Use); + _writer.WriteUInt16(index1); + _writer.WriteUInt16(index2); } else - this._writer.WriteBool(false); - this._writer.WriteUInt16(this.MapTypeToIndex(markupPropertySchema.PropertyType)); + _writer.WriteBool(false); + _writer.WriteUInt16(MapTypeToIndex(markupPropertySchema.PropertyType)); if (markupType == MarkupType.DataType) { MarkupDataTypePropertySchema typePropertySchema = (MarkupDataTypePropertySchema)markupPropertySchema; - this._writer.WriteUInt16(typePropertySchema.AlternateType != null ? this.MapTypeToIndex(typePropertySchema.AlternateType) : ushort.MaxValue); + _writer.WriteUInt16(typePropertySchema.AlternateType != null ? MapTypeToIndex(typePropertySchema.AlternateType) : ushort.MaxValue); } if (markupType == MarkupType.DataQuery) { MarkupDataQueryPropertySchema queryPropertySchema = (MarkupDataQueryPropertySchema)markupPropertySchema; if (queryPropertySchema.DefaultValue != null) { - this._writer.WriteBool(true); - queryPropertySchema.PropertyType.EncodeBinary(this._writer, queryPropertySchema.DefaultValue); + _writer.WriteBool(true); + queryPropertySchema.PropertyType.EncodeBinary(_writer, queryPropertySchema.DefaultValue); } else - this._writer.WriteBool(false); - this._writer.WriteBool(queryPropertySchema.InvalidatesQuery); - this._writer.WriteUInt16(queryPropertySchema.AlternateType != null ? this.MapTypeToIndex(queryPropertySchema.AlternateType) : ushort.MaxValue); + _writer.WriteBool(false); + _writer.WriteBool(queryPropertySchema.InvalidatesQuery); + _writer.WriteUInt16(queryPropertySchema.AlternateType != null ? MapTypeToIndex(queryPropertySchema.AlternateType) : ushort.MaxValue); } } - this.WriteMarkupMethodArrayHelper(markupTypeSchema.Methods, "METHODS"); - this.WriteMarkupMethodArrayHelper(markupTypeSchema.VirtualMethods, "VIRTUAL METHODS"); + WriteMarkupMethodArrayHelper(markupTypeSchema.Methods, "METHODS"); + WriteMarkupMethodArrayHelper(markupTypeSchema.VirtualMethods, "VIRTUAL METHODS"); } } private void PersistMemberImportTables() { - if (this._usingSharedBinaryDataTable) + if (_usingSharedBinaryDataTable) return; - this._writer.WriteUInt16(this._loadResult.ImportTables.ConstructorImports.Length); - foreach (ConstructorSchema constructorImport in this._loadResult.ImportTables.ConstructorImports) + _writer.WriteUInt16(_loadResult.ImportTables.ConstructorImports.Length); + foreach (ConstructorSchema constructorImport in _loadResult.ImportTables.ConstructorImports) { - this._writer.WriteUInt16(this.MapTypeToIndex(constructorImport.Owner)); - this._writer.WriteUInt16(constructorImport.ParameterTypes.Length); + _writer.WriteUInt16(MapTypeToIndex(constructorImport.Owner)); + _writer.WriteUInt16(constructorImport.ParameterTypes.Length); foreach (TypeSchema parameterType in constructorImport.ParameterTypes) - this._writer.WriteUInt16(this.MapTypeToIndex(parameterType)); + _writer.WriteUInt16(MapTypeToIndex(parameterType)); } - this._writer.WriteUInt16(this._loadResult.ImportTables.PropertyImports.Length); - foreach (PropertySchema propertyImport in this._loadResult.ImportTables.PropertyImports) + _writer.WriteUInt16(_loadResult.ImportTables.PropertyImports.Length); + foreach (PropertySchema propertyImport in _loadResult.ImportTables.PropertyImports) { - this._writer.WriteUInt16(this.MapTypeToIndex(propertyImport.Owner)); - this.WriteDataTableString(propertyImport.Name); + _writer.WriteUInt16(MapTypeToIndex(propertyImport.Owner)); + WriteDataTableString(propertyImport.Name); } - this._writer.WriteUInt16(this._loadResult.ImportTables.MethodImports.Length); - foreach (MethodSchema methodImport in this._loadResult.ImportTables.MethodImports) + _writer.WriteUInt16(_loadResult.ImportTables.MethodImports.Length); + foreach (MethodSchema methodImport in _loadResult.ImportTables.MethodImports) { - this._writer.WriteUInt16(this.MapTypeToIndex(methodImport.Owner)); + _writer.WriteUInt16(MapTypeToIndex(methodImport.Owner)); bool flag = false; MarkupMethodSchema markupMethodSchema = null; if (methodImport is MarkupMethodSchema) @@ -364,51 +364,51 @@ namespace Microsoft.Iris.Markup markupMethodSchema = (MarkupMethodSchema)methodImport; flag = markupMethodSchema.IsVirtual && !markupMethodSchema.IsVirtualThunk; } - this._writer.WriteBool(flag); + _writer.WriteBool(flag); if (!flag) { - this.WriteDataTableString(methodImport.Name); - this._writer.WriteUInt16(methodImport.ParameterTypes.Length); + WriteDataTableString(methodImport.Name); + _writer.WriteUInt16(methodImport.ParameterTypes.Length); foreach (TypeSchema parameterType in methodImport.ParameterTypes) - this._writer.WriteUInt16(this.MapTypeToIndex(parameterType)); + _writer.WriteUInt16(MapTypeToIndex(parameterType)); } else - this._writer.WriteInt32(markupMethodSchema.VirtualId); + _writer.WriteInt32(markupMethodSchema.VirtualId); } - this._writer.WriteUInt16(this._loadResult.ImportTables.EventImports.Length); - foreach (EventSchema eventImport in this._loadResult.ImportTables.EventImports) + _writer.WriteUInt16(_loadResult.ImportTables.EventImports.Length); + foreach (EventSchema eventImport in _loadResult.ImportTables.EventImports) { - this._writer.WriteUInt16(this.MapTypeToIndex(eventImport.Owner)); - this.WriteDataTableString(eventImport.Name); + _writer.WriteUInt16(MapTypeToIndex(eventImport.Owner)); + WriteDataTableString(eventImport.Name); } } private void PersistDataMappingsTable() { - if (this._loadResult.DataMappingsTable == null) + if (_loadResult.DataMappingsTable == null) { - this._writer.WriteUInt16(0); + _writer.WriteUInt16(0); } else { - this._writer.WriteUInt16(this._loadResult.DataMappingsTable.Length); - foreach (MarkupDataMapping markupDataMapping in this._loadResult.DataMappingsTable) + _writer.WriteUInt16(_loadResult.DataMappingsTable.Length); + foreach (MarkupDataMapping markupDataMapping in _loadResult.DataMappingsTable) { - this._writer.WriteUInt16(this.MapTypeToIndex(markupDataMapping.TargetType)); - this.WriteDataTableString(markupDataMapping.Provider); - this._writer.WriteUInt16(markupDataMapping.Mappings.Length); + _writer.WriteUInt16(MapTypeToIndex(markupDataMapping.TargetType)); + WriteDataTableString(markupDataMapping.Provider); + _writer.WriteUInt16(markupDataMapping.Mappings.Length); foreach (MarkupDataMappingEntry mapping in markupDataMapping.Mappings) { - this.WriteDataTableString(mapping.Source); - this.WriteDataTableString(mapping.Target); - this._writer.WriteUInt16(this.MapPropertyToIndex(mapping.Property)); + WriteDataTableString(mapping.Source); + WriteDataTableString(mapping.Target); + _writer.WriteUInt16(MapPropertyToIndex(mapping.Property)); if (mapping.DefaultValue != null && mapping.Property.PropertyType.SupportsBinaryEncoding) { - this._writer.WriteBool(true); - mapping.Property.PropertyType.EncodeBinary(this._writer, mapping.DefaultValue); + _writer.WriteBool(true); + mapping.Property.PropertyType.EncodeBinary(_writer, mapping.DefaultValue); } else - this._writer.WriteBool(false); + _writer.WriteBool(false); } } } @@ -416,96 +416,96 @@ namespace Microsoft.Iris.Markup private void PersistConstantsTable() { - if (!this._usingSharedBinaryDataTable) + if (!_usingSharedBinaryDataTable) { - int length = this._loadResult.ConstantsTable.PersistList.Length; - this._writer.WriteUInt16(length); - uint dataSize = this._writer.DataSize; + int length = _loadResult.ConstantsTable.PersistList.Length; + _writer.WriteUInt16(length); + uint dataSize = _writer.DataSize; uint offset = dataSize; for (int index = 0; index <= length; ++index) - this._writer.WriteUInt32(uint.MaxValue); - foreach (MarkupConstantPersist persist in this._loadResult.ConstantsTable.PersistList) + _writer.WriteUInt32(uint.MaxValue); + foreach (MarkupConstantPersist persist in _loadResult.ConstantsTable.PersistList) { - this._writer.Overwrite(offset, this._writer.DataSize - dataSize); + _writer.Overwrite(offset, _writer.DataSize - dataSize); offset += 4U; - ushort index = this.MapTypeToIndex(persist.Type); + ushort index = MapTypeToIndex(persist.Type); MarkupConstantPersistMode constantPersistMode = persist.Mode; if (persist.Type == StringSchema.Type) constantPersistMode = MarkupConstantPersistMode.FromString; - this._writer.WriteUInt16(index); - this._writer.WriteByte((byte)constantPersistMode); + _writer.WriteUInt16(index); + _writer.WriteByte((byte)constantPersistMode); switch (constantPersistMode) { case MarkupConstantPersistMode.Binary: - this._loadResult.ImportTables.TypeImports[index].EncodeBinary(this._writer, persist.Data); + _loadResult.ImportTables.TypeImports[index].EncodeBinary(_writer, persist.Data); break; case MarkupConstantPersistMode.FromString: case MarkupConstantPersistMode.Canonical: - this.WriteDataTableString((string)persist.Data); + WriteDataTableString((string)persist.Data); break; } } - this._writer.Overwrite(offset, this._writer.DataSize - dataSize); + _writer.Overwrite(offset, _writer.DataSize - dataSize); } else - this._writer.WriteUInt16(0); + _writer.WriteUInt16(0); } private void PersistBinaryDataTable() { - if (this._binaryDataTableSectionOffsetFixup != uint.MaxValue) + if (_binaryDataTableSectionOffsetFixup != uint.MaxValue) { - uint dataSize1 = this._writer.DataSize; - Vector strings = this._binaryDataTable.Strings; - this._writer.WriteInt32(strings.Count); - uint dataSize2 = this._writer.DataSize; + uint dataSize1 = _writer.DataSize; + Vector strings = _binaryDataTable.Strings; + _writer.WriteInt32(strings.Count); + uint dataSize2 = _writer.DataSize; uint offset = dataSize2; for (int index = 0; index <= strings.Count; ++index) - this._writer.WriteUInt32(uint.MaxValue); + _writer.WriteUInt32(uint.MaxValue); foreach (string str in strings) { - this._writer.Overwrite(offset, this._writer.DataSize - dataSize2); + _writer.Overwrite(offset, _writer.DataSize - dataSize2); offset += 4U; - this._writer.WriteString(str); + _writer.WriteString(str); } - this._writer.Overwrite(offset, this._writer.DataSize - dataSize2); - this._writer.Overwrite(this._binaryDataTableSectionOffsetFixup, dataSize1); + _writer.Overwrite(offset, _writer.DataSize - dataSize2); + _writer.Overwrite(_binaryDataTableSectionOffsetFixup, dataSize1); } - this._binaryDataTablePersisted = true; + _binaryDataTablePersisted = true; } private void PersistLineNumberTable() { - this._writer.Overwrite(this._lineNumberTableStartFixup, this._writer.DataSize); - this._writer.WriteUInt16(this._loadResult.LineNumberTable.PersistList.Length); - foreach (ulong persist in this._loadResult.LineNumberTable.PersistList) - this._writer.WriteUInt64(persist); - this._writer.Overwrite(this._lineNumberTableEndFixup, this._writer.DataSize); + _writer.Overwrite(_lineNumberTableStartFixup, _writer.DataSize); + _writer.WriteUInt16(_loadResult.LineNumberTable.PersistList.Length); + foreach (ulong persist in _loadResult.LineNumberTable.PersistList) + _writer.WriteUInt64(persist); + _writer.Overwrite(_lineNumberTableEndFixup, _writer.DataSize); } private void PersistObjectSection() { - this._writer.Overwrite(this._objectSectionStartFixup, this._writer.DataSize); - this._writer.Write(this._loadResult.ObjectSection); - this._loadResult.ObjectSection.ToIntPtr(out uint _); - this._writer.Overwrite(this._objectSectionEndFixup, this._writer.DataSize); + _writer.Overwrite(_objectSectionStartFixup, _writer.DataSize); + _writer.Write(_loadResult.ObjectSection); + _loadResult.ObjectSection.ToIntPtr(out uint _); + _writer.Overwrite(_objectSectionEndFixup, _writer.DataSize); } private ushort MapDependentToIndex(LoadResult dependent) { if (dependent == MarkupSystem.UIXGlobal) return 65534; - if (dependent == this._loadResult) + if (dependent == _loadResult) return 65533; - int num = this._usingSharedBinaryDataTable ? this._binaryDataTable.SourceMarkupImportTables.ImportedLoadResults.IndexOf(dependent) : Array.IndexOf(this._loadResult.Dependencies, dependent); + int num = _usingSharedBinaryDataTable ? _binaryDataTable.SourceMarkupImportTables.ImportedLoadResults.IndexOf(dependent) : Array.IndexOf(_loadResult.Dependencies, dependent); return num >= 0 ? (ushort)num : ushort.MaxValue; } private ushort MapTypeToIndex(TypeSchema type) { - for (ushort index = 0; index < (ushort)this._loadResult.ImportTables.TypeImports.Length; ++index) + for (ushort index = 0; index < (ushort)_loadResult.ImportTables.TypeImports.Length; ++index) { - TypeSchema typeImport = this._loadResult.ImportTables.TypeImports[index]; + TypeSchema typeImport = _loadResult.ImportTables.TypeImports[index]; if (type == typeImport) return index; } @@ -514,9 +514,9 @@ namespace Microsoft.Iris.Markup private ushort MapPropertyToIndex(PropertySchema property) { - for (ushort index = 0; index < (ushort)this._loadResult.ImportTables.PropertyImports.Length; ++index) + for (ushort index = 0; index < (ushort)_loadResult.ImportTables.PropertyImports.Length; ++index) { - PropertySchema propertyImport = this._loadResult.ImportTables.PropertyImports[index]; + PropertySchema propertyImport = _loadResult.ImportTables.PropertyImports[index]; if (property == propertyImport) return index; } @@ -525,27 +525,27 @@ namespace Microsoft.Iris.Markup private ushort MapMethodToIndex(MethodSchema method) { - for (ushort index = 0; index < (ushort)this._loadResult.ImportTables.MethodImports.Length; ++index) + for (ushort index = 0; index < (ushort)_loadResult.ImportTables.MethodImports.Length; ++index) { - MethodSchema methodImport = this._loadResult.ImportTables.MethodImports[index]; + MethodSchema methodImport = _loadResult.ImportTables.MethodImports[index]; if (method == methodImport) return index; } return ushort.MaxValue; } - private void WriteDataTableString(string s) => this._writer.WriteInt32(this._binaryDataTable.GetIndexOrAdd(s)); + private void WriteDataTableString(string s) => _writer.WriteInt32(_binaryDataTable.GetIndexOrAdd(s)); private void WriteUInt32ArrayHelper(uint[] array, string debugName) { uint num1 = 0; if (array != null) num1 = (uint)array.Length; - this._writer.WriteUInt32(num1); + _writer.WriteUInt32(num1); if (num1 == 0U) return; foreach (uint num2 in array) - this._writer.WriteUInt32(num2); + _writer.WriteUInt32(num2); } private void WriteStringArrayHelper(string[] array, string debugName) @@ -553,27 +553,27 @@ namespace Microsoft.Iris.Markup uint num = 0; if (array != null) num = (uint)array.Length; - this._writer.WriteUInt32(num); + _writer.WriteUInt32(num); if (num == 0U) return; foreach (string s in array) - this.WriteDataTableString(s); + WriteDataTableString(s); } private void WriteMarkupMethodArrayHelper(MethodSchema[] methods, string debugName) { - this._writer.WriteUInt16(methods.Length); + _writer.WriteUInt16(methods.Length); foreach (MarkupMethodSchema method in methods) { - this.WriteDataTableString(method.Name); - this._writer.WriteUInt16(this.MapTypeToIndex(method.ReturnType)); - this._writer.WriteInt32(method.ParameterTypes.Length); + WriteDataTableString(method.Name); + _writer.WriteUInt16(MapTypeToIndex(method.ReturnType)); + _writer.WriteInt32(method.ParameterTypes.Length); foreach (TypeSchema parameterType in method.ParameterTypes) - this._writer.WriteUInt16(this.MapTypeToIndex(parameterType)); - this.WriteStringArrayHelper(method.ParameterNames, "ParameterNames"); - this._writer.WriteInt32(method.VirtualId); - this._writer.WriteBool(method.IsVirtualThunk); - this._writer.WriteUInt32(method.CodeOffset); + _writer.WriteUInt16(MapTypeToIndex(parameterType)); + WriteStringArrayHelper(method.ParameterNames, "ParameterNames"); + _writer.WriteInt32(method.VirtualId); + _writer.WriteBool(method.IsVirtualThunk); + _writer.WriteUInt32(method.CodeOffset); } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupConstantsTable.cs b/UIX/Microsoft/Iris/Markup/MarkupConstantsTable.cs index 6ad91b0..a84fa0b 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupConstantsTable.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupConstantsTable.cs @@ -17,19 +17,19 @@ namespace Microsoft.Iris.Markup private ByteCodeReader _constantsTableReader; private MarkupLoadResult _loadResultOwner; - public MarkupConstantsTable() => this._lookupTable = new Dictionary(new MarkupConstantsTable.MarkupConstantEqualityComparer()); + public MarkupConstantsTable() => _lookupTable = new Dictionary(new MarkupConstantsTable.MarkupConstantEqualityComparer()); - public MarkupConstantsTable(object[] runtimeList) => this._runtimeList = runtimeList; + public MarkupConstantsTable(object[] runtimeList) => _runtimeList = runtimeList; public void SetConstantsTableReader( ByteCodeReader constantsTableReader, MarkupLoadResult loadResultOwner) { - this._constantsTableReader = constantsTableReader; - this._loadResultOwner = loadResultOwner; + _constantsTableReader = constantsTableReader; + _loadResultOwner = loadResultOwner; } - public int Add(TypeSchema type, object value, MarkupConstantPersistMode persistMode) => this.Add(type, value, persistMode, value); + public int Add(TypeSchema type, object value, MarkupConstantPersistMode persistMode) => Add(type, value, persistMode, value); public int Add( TypeSchema type, @@ -54,42 +54,42 @@ namespace Microsoft.Iris.Markup key.Persist.Type = null; } int count; - if (!this._lookupTable.TryGetValue(key, out count)) + if (!_lookupTable.TryGetValue(key, out count)) { - count = this._lookupTable.Count; - this._lookupTable.Add(key, count); + count = _lookupTable.Count; + _lookupTable.Add(key, count); } return count; } public object Get(int index) { - object obj = this._runtimeList[index]; + object obj = _runtimeList[index]; if (obj == null) { - this._constantsTableReader.CurrentOffset = (uint)(index * 4); - this._constantsTableReader.CurrentOffset = this._constantsTableReader.ReadUInt32(); - obj = CompiledMarkupLoader.DepersistConstant(this._constantsTableReader, this._loadResultOwner); - this._runtimeList[index] = obj; + _constantsTableReader.CurrentOffset = (uint)(index * 4); + _constantsTableReader.CurrentOffset = _constantsTableReader.ReadUInt32(); + obj = CompiledMarkupLoader.DepersistConstant(_constantsTableReader, _loadResultOwner); + _runtimeList[index] = obj; } return obj; } public void PrepareForRuntimeUse() { - this._runtimeList = new object[this._lookupTable.Count]; + _runtimeList = new object[_lookupTable.Count]; if (MarkupSystem.CompileMode) - this._persistList = new MarkupConstantPersist[this._lookupTable.Count]; - foreach (KeyValuePair keyValuePair in this._lookupTable) + _persistList = new MarkupConstantPersist[_lookupTable.Count]; + foreach (KeyValuePair keyValuePair in _lookupTable) { - this._runtimeList[keyValuePair.Value] = keyValuePair.Key.Value; + _runtimeList[keyValuePair.Value] = keyValuePair.Key.Value; if (MarkupSystem.CompileMode) - this._persistList[keyValuePair.Value] = keyValuePair.Key.Persist; + _persistList[keyValuePair.Value] = keyValuePair.Key.Persist; } - this._lookupTable = null; + _lookupTable = null; } - public MarkupConstantPersist[] PersistList => this._persistList; + public MarkupConstantPersist[] PersistList => _persistList; [Conditional("DEBUG")] public void DEBUG_DumpTable() diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataMapping.cs b/UIX/Microsoft/Iris/Markup/MarkupDataMapping.cs index 4dda8b8..8a9b10b 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataMapping.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataMapping.cs @@ -14,30 +14,30 @@ namespace Microsoft.Iris.Markup private string _provider; private object _assemblyDataProviderCookie; - public MarkupDataMapping(string name) => this._name = name; + public MarkupDataMapping(string name) => _name = name; public MarkupDataTypeSchema TargetType { - get => this._targetType; - set => this._targetType = value; + get => _targetType; + set => _targetType = value; } public string Provider { - get => this._provider; - set => this._provider = value; + get => _provider; + set => _provider = value; } public MarkupDataMappingEntry[] Mappings { - get => this._mappings; - set => this._mappings = value; + get => _mappings; + set => _mappings = value; } public object AssemblyDataProviderCookie { - get => this._assemblyDataProviderCookie; - set => this._assemblyDataProviderCookie = value; + get => _assemblyDataProviderCookie; + set => _assemblyDataProviderCookie = value; } public override string ToString() => string.Format("({0}, {1})", _provider, _targetType); diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataMappingEntry.cs b/UIX/Microsoft/Iris/Markup/MarkupDataMappingEntry.cs index dfc3db1..a9ec449 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataMappingEntry.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataMappingEntry.cs @@ -15,26 +15,26 @@ namespace Microsoft.Iris.Markup public string Source { - get => this._source; - set => this._source = value; + get => _source; + set => _source = value; } public string Target { - get => this._target; - set => this._target = value; + get => _target; + set => _target = value; } public MarkupDataTypePropertySchema Property { - get => this._property; - set => this._property = value; + get => _property; + set => _property = value; } public object DefaultValue { - get => this._defaultValue; - set => this._defaultValue = value; + get => _defaultValue; + set => _defaultValue = value; } } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataProvider.cs b/UIX/Microsoft/Iris/Markup/MarkupDataProvider.cs index dc0070b..0ad6b6b 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataProvider.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataProvider.cs @@ -88,13 +88,13 @@ namespace Microsoft.Iris.Markup public MappingKey(MarkupDataTypeSchema targetType, string provider) { - this._targetType = targetType; - this._provider = provider; + _targetType = targetType; + _provider = provider; } - public override bool Equals(object rhs) => rhs is MarkupDataProvider.MappingKey mappingKey && this._targetType == mappingKey._targetType && this._provider == mappingKey._provider; + public override bool Equals(object rhs) => rhs is MarkupDataProvider.MappingKey mappingKey && _targetType == mappingKey._targetType && _provider == mappingKey._provider; - public override int GetHashCode() => this._targetType.GetHashCode() ^ this._provider.GetHashCode(); + public override int GetHashCode() => _targetType.GetHashCode() ^ _provider.GetHashCode(); } } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataQuery.cs b/UIX/Microsoft/Iris/Markup/MarkupDataQuery.cs index 3266518..ce925ea 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataQuery.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataQuery.cs @@ -12,12 +12,12 @@ namespace Microsoft.Iris.Markup public MarkupDataQuery(MarkupDataQuerySchema type) : base(type) - => this._owner = type; + => _owner = type; protected void ApplyDefaultValues() { Map map = null; - for (MarkupDataQuerySchema owner = this._owner; owner != null; owner = owner.Base as MarkupDataQuerySchema) + for (MarkupDataQuerySchema owner = _owner; owner != null; owner = owner.Base as MarkupDataQuerySchema) { foreach (MarkupDataQueryPropertySchema property in owner.Properties) { diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataQueryPreDefinedPropertySchema.cs b/UIX/Microsoft/Iris/Markup/MarkupDataQueryPreDefinedPropertySchema.cs index 6637626..b0ca5e9 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataQueryPreDefinedPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataQueryPreDefinedPropertySchema.cs @@ -19,17 +19,17 @@ namespace Microsoft.Iris.Markup SetValueHandler setValueHandler) : base(owner, name, propertyType) { - this.InvalidatesQuery = false; - this._getValueHandler = getValueHandler; - this._setValueHandler = setValueHandler; + InvalidatesQuery = false; + _getValueHandler = getValueHandler; + _setValueHandler = setValueHandler; } - public override bool CanWrite => this._setValueHandler != null; + public override bool CanWrite => _setValueHandler != null; - public override ExpressionRestriction ExpressionRestriction => !this.CanWrite ? ExpressionRestriction.ReadOnly : ExpressionRestriction.None; + public override ExpressionRestriction ExpressionRestriction => !CanWrite ? ExpressionRestriction.ReadOnly : ExpressionRestriction.None; - public override object GetValue(object instance) => this._getValueHandler(instance); + public override object GetValue(object instance) => _getValueHandler(instance); - public override void SetValue(ref object instance, object value) => this._setValueHandler(ref instance, value); + public override void SetValue(ref object instance, object value) => _setValueHandler(ref instance, value); } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataQueryPropertySchema.cs b/UIX/Microsoft/Iris/Markup/MarkupDataQueryPropertySchema.cs index 802bdf9..a4616f4 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataQueryPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataQueryPropertySchema.cs @@ -22,18 +22,18 @@ namespace Microsoft.Iris.Markup public object DefaultValue { - get => this._defaultValue; - set => this._defaultValue = value; + get => _defaultValue; + set => _defaultValue = value; } public bool InvalidatesQuery { - get => this._invalidatesQuery; - set => this._invalidatesQuery = value; + get => _invalidatesQuery; + set => _invalidatesQuery = value; } - public override TypeSchema AlternateType => this._underlyingCollectionType; + public override TypeSchema AlternateType => _underlyingCollectionType; - public void SetUnderlyingCollectionType(TypeSchema underlyingCollectionType) => this._underlyingCollectionType = underlyingCollectionType; + public void SetUnderlyingCollectionType(TypeSchema underlyingCollectionType) => _underlyingCollectionType = underlyingCollectionType; } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataQuerySchema.cs b/UIX/Microsoft/Iris/Markup/MarkupDataQuerySchema.cs index c34e7e2..9d65508 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataQuerySchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataQuerySchema.cs @@ -27,26 +27,26 @@ namespace Microsoft.Iris.Markup protected override void OnDispose() { base.OnDispose(); - if (this._predefinedProperties != null) + if (_predefinedProperties != null) { - foreach (DisposableObject predefinedProperty in this._predefinedProperties) + foreach (DisposableObject predefinedProperty in _predefinedProperties) predefinedProperty.Dispose(this); } - if (this._refreshMethod == null) + if (_refreshMethod == null) return; - this._refreshMethod.Dispose(this); + _refreshMethod.Dispose(this); } public override void BuildProperties() { base.BuildProperties(); - this._predefinedProperties = new MarkupDataQueryPreDefinedPropertySchema[3] + _predefinedProperties = new MarkupDataQueryPreDefinedPropertySchema[3] { - this._resultProperty = new MarkupDataQueryPreDefinedPropertySchema(this, this._resultType != null ? this._resultType : ObjectSchema.Type, "Result", new GetValueHandler(GetResultProperty), null), + _resultProperty = new MarkupDataQueryPreDefinedPropertySchema(this, _resultType != null ? _resultType : ObjectSchema.Type, "Result", new GetValueHandler(GetResultProperty), null), new MarkupDataQueryPreDefinedPropertySchema(this, UIXLoadResultExports.DataQueryStatusType, "Status", new GetValueHandler(GetStatusProperty), null), new MarkupDataQueryPreDefinedPropertySchema(this, BooleanSchema.Type, "Enabled", new GetValueHandler(GetEnabledProperty), new SetValueHandler(SetEnabledProperty)) }; - this._refreshMethod = new MarkupDataQueryRefreshMethodSchema(this); + _refreshMethod = new MarkupDataQueryRefreshMethodSchema(this); } public override MarkupType MarkupType => MarkupType.DataQuery; @@ -57,7 +57,7 @@ namespace Microsoft.Iris.Markup public override object ConstructDefault() { - IDataProvider dataProvider = MarkupDataProvider.GetDataProvider(this._providerName); + IDataProvider dataProvider = MarkupDataProvider.GetDataProvider(_providerName); if (dataProvider != null) return dataProvider.Build(this); ErrorManager.ReportError("Could not find provider '{0}'; verify that it has been registered", _providerName); @@ -66,7 +66,7 @@ namespace Microsoft.Iris.Markup public override PropertySchema FindProperty(string name) { - foreach (PropertySchema predefinedProperty in this._predefinedProperties) + foreach (PropertySchema predefinedProperty in _predefinedProperties) { if (name == predefinedProperty.Name) return predefinedProperty; @@ -74,21 +74,21 @@ namespace Microsoft.Iris.Markup return base.FindProperty(name); } - public override MethodSchema FindMethod(string name, TypeSchema[] parameters) => this._refreshMethod.Name == name && parameters.Length == 0 ? _refreshMethod : base.FindMethod(name, parameters); + public override MethodSchema FindMethod(string name, TypeSchema[] parameters) => _refreshMethod.Name == name && parameters.Length == 0 ? _refreshMethod : base.FindMethod(name, parameters); public string ProviderName { - get => this._providerName; - set => this._providerName = value; + get => _providerName; + set => _providerName = value; } public TypeSchema ResultType { - get => this._resultType; - set => this._resultType = value; + get => _resultType; + set => _resultType = value; } - public bool InvalidatesQuery(string propertyName) => this.FindPropertyDeep(propertyName) is MarkupDataQueryPropertySchema propertyDeep && propertyDeep.InvalidatesQuery; + public bool InvalidatesQuery(string propertyName) => FindPropertyDeep(propertyName) is MarkupDataQueryPropertySchema propertyDeep && propertyDeep.InvalidatesQuery; private static object GetResultProperty(object instance) => ((MarkupDataQuery)instance).Result; diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataTypeBaseObject.cs b/UIX/Microsoft/Iris/Markup/MarkupDataTypeBaseObject.cs index a034e78..ec45760 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataTypeBaseObject.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataTypeBaseObject.cs @@ -21,12 +21,12 @@ namespace Microsoft.Iris.Markup public override object ReadSymbol(SymbolReference symbolRef) { object obj; - return symbolRef.Origin == SymbolOrigin.Properties && this.ExternalObjectGetProperty(symbolRef.Symbol, out obj) ? obj : base.ReadSymbol(symbolRef); + return symbolRef.Origin == SymbolOrigin.Properties && ExternalObjectGetProperty(symbolRef.Symbol, out obj) ? obj : base.ReadSymbol(symbolRef); } public override void WriteSymbol(SymbolReference symbolRef, object value) { - if (symbolRef.Origin == SymbolOrigin.Properties && this.ExternalObjectSetProperty(symbolRef.Symbol, value)) + if (symbolRef.Origin == SymbolOrigin.Properties && ExternalObjectSetProperty(symbolRef.Symbol, value)) return; base.WriteSymbol(symbolRef, value); } @@ -34,12 +34,12 @@ namespace Microsoft.Iris.Markup public override object GetProperty(string name) { object obj; - return this.ExternalObjectGetProperty(name, out obj) ? obj : base.GetProperty(name); + return ExternalObjectGetProperty(name, out obj) ? obj : base.GetProperty(name); } public override void SetProperty(string name, object value) { - if (this.ExternalObjectSetProperty(name, value)) + if (ExternalObjectSetProperty(name, value)) return; base.SetProperty(name, value); } @@ -47,7 +47,7 @@ namespace Microsoft.Iris.Markup public void FireNotificationThreadSafe(string property) { property = NotifyService.CanonicalizeString(property); - this._notifier.FireThreadSafe(property); + _notifier.FireThreadSafe(property); } protected virtual bool ExternalObjectGetProperty(string propertyName, out object value) diff --git a/UIX/Microsoft/Iris/Markup/MarkupDataTypePropertySchema.cs b/UIX/Microsoft/Iris/Markup/MarkupDataTypePropertySchema.cs index 06a4de9..940e430 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupDataTypePropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupDataTypePropertySchema.cs @@ -18,8 +18,8 @@ namespace Microsoft.Iris.Markup { } - public override TypeSchema AlternateType => this._underlyingCollectionType; + public override TypeSchema AlternateType => _underlyingCollectionType; - public void SetUnderlyingCollectionType(TypeSchema underlyingCollectionType) => this._underlyingCollectionType = underlyingCollectionType; + public void SetUnderlyingCollectionType(TypeSchema underlyingCollectionType) => _underlyingCollectionType = underlyingCollectionType; } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupEncoder.cs b/UIX/Microsoft/Iris/Markup/MarkupEncoder.cs index 7d22fc7..0bb25ab 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupEncoder.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupEncoder.cs @@ -24,8 +24,8 @@ namespace Microsoft.Iris.Markup MarkupConstantsTable constantsTable, MarkupLineNumberTable lineNumberTable) { - this._constantsTable = constantsTable; - this._lineNumberTable = lineNumberTable; + _constantsTable = constantsTable; + _lineNumberTable = lineNumberTable; } public ByteCodeReader EncodeOBJECTSection( @@ -33,15 +33,15 @@ namespace Microsoft.Iris.Markup string uri, string sourceFilePathBestGuess) { - this._sourceFilePathBestGuess = sourceFilePathBestGuess; - this._writer = new ByteCodeWriter(); + _sourceFilePathBestGuess = sourceFilePathBestGuess; + _writer = new ByteCodeWriter(); if (parseResult.ClassList.Count > 0) { for (int index = 0; index < parseResult.ClassList.Count; ++index) - this.EncodeClass(parseResult.ClassList[index]); + EncodeClass(parseResult.ClassList[index]); } - ByteCodeReader reader = this._writer.CreateReader(); - this._writer = null; + ByteCodeReader reader = _writer.CreateReader(); + _writer = null; return reader; } @@ -58,48 +58,48 @@ namespace Microsoft.Iris.Markup int totalInitialEvaluates = 0; int totalFinalEvaluates = 0; if (cls.ActionList.Count > 0) - this.EncodeScript(cls.ActionList, out totalInitialEvaluates, out totalFinalEvaluates); + EncodeScript(cls.ActionList, out totalInitialEvaluates, out totalFinalEvaluates); if (cls.TriggerList.Count > 0) - this.EncodeListenerGroupRefresh(cls); + EncodeListenerGroupRefresh(cls); if (cls.MethodList != null && cls.MethodList.Count > 0) - this.EncodeMethods(cls.TypeExport, cls.MethodList); + EncodeMethods(cls.TypeExport, cls.MethodList); if (cls.FoundPropertiesValidateProperty != null) { - uint offset = this.GetOffset(); + uint offset = GetOffset(); cls.TypeExport.SetInitializePropertiesOffset(offset); - this.EncodeInitializeProperty(cls.FoundPropertiesValidateProperty); + EncodeInitializeProperty(cls.FoundPropertiesValidateProperty); cls.RemoveProperty(cls.FoundPropertiesValidateProperty); - this._writer.WriteByte(OpCode.ReturnVoid); + _writer.WriteByte(OpCode.ReturnVoid); } if (ui != null && ui.FoundContentValidateProperty != null) { - uint offset = this.GetOffset(); + uint offset = GetOffset(); cls.TypeExport.SetInitializeContentOffset(offset); - this.EncodeInitializeProperty(ui.FoundContentValidateProperty); + EncodeInitializeProperty(ui.FoundContentValidateProperty); cls.RemoveProperty(ui.FoundContentValidateProperty); - this._writer.WriteByte(OpCode.ReturnVoid); + _writer.WriteByte(OpCode.ReturnVoid); } if (validateEffect != null) - this.EncodeTechniquesProperty((EffectClassTypeSchema)cls.TypeExport, validateEffect); - uint offset1 = this.GetOffset(); + EncodeTechniquesProperty((EffectClassTypeSchema)cls.TypeExport, validateEffect); + uint offset1 = GetOffset(); cls.TypeExport.SetInitializeLocalsInputOffset(offset1); for (ValidateProperty property = cls.PropertyList; property != null; property = property.Next) - this.EncodeInitializeProperty(property); + EncodeInitializeProperty(property); if (cls.TypeExport.ListenerCount > 0U) - this.EncodeListenerInitialize(cls); + EncodeListenerInitialize(cls); if (totalInitialEvaluates > 0) - this.EstablishInitialOrFinalEvaluateOffsets(cls, totalInitialEvaluates, true); + EstablishInitialOrFinalEvaluateOffsets(cls, totalInitialEvaluates, true); if (totalFinalEvaluates > 0) - this.EstablishInitialOrFinalEvaluateOffsets(cls, totalFinalEvaluates, false); - this._writer.WriteByte(OpCode.ReturnVoid); + EstablishInitialOrFinalEvaluateOffsets(cls, totalFinalEvaluates, false); + _writer.WriteByte(OpCode.ReturnVoid); if (ui == null) return; - this.EncodeNamedContent(ui); + EncodeNamedContent(ui); } else { - this.EncodeObjectBySource(cls.IndirectedObject); - this._writer.WriteByte(OpCode.ReturnValue); + EncodeObjectBySource(cls.IndirectedObject); + _writer.WriteByte(OpCode.ReturnValue); } } @@ -109,47 +109,47 @@ namespace Microsoft.Iris.Markup { if (objectTag.DynamicConstructionType != null) { - this.EncodeObjectBySource(objectTag.DynamicConstructionType); - this._writer.WriteByte(OpCode.ConstructObjectIndirect); - this._writer.WriteUInt16(objectTag.FoundTypeIndex); + EncodeObjectBySource(objectTag.DynamicConstructionType); + _writer.WriteByte(OpCode.ConstructObjectIndirect); + _writer.WriteUInt16(objectTag.FoundTypeIndex); bool forceVerifyValues = objectTag.FoundType is MarkupTypeSchema; - this.EncodeInitializeProperties(objectTag, forceVerifyValues); - this.EncodeObjectBySource(objectTag.DynamicConstructionType); + EncodeInitializeProperties(objectTag, forceVerifyValues); + EncodeObjectBySource(objectTag.DynamicConstructionType); if (!objectTag.FoundType.HasInitializer) return; - this._writer.WriteByte(OpCode.InitializeInstanceIndirect); + _writer.WriteByte(OpCode.InitializeInstanceIndirect); } else { - this._writer.WriteByte(OpCode.ConstructObject); - this._writer.WriteUInt16(objectTag.FoundTypeIndex); - this.EncodeInitializeProperties(objectTag); - this.EncodeInitializeInstance(objectTag.FoundType, objectTag.FoundTypeIndex); + _writer.WriteByte(OpCode.ConstructObject); + _writer.WriteUInt16(objectTag.FoundTypeIndex); + EncodeInitializeProperties(objectTag); + EncodeInitializeInstance(objectTag.FoundType, objectTag.FoundTypeIndex); } } else - this.EncodeObjectBySource(objectTag.IndirectedObject); + EncodeObjectBySource(objectTag.IndirectedObject); } - private void EncodeInitializeProperties(ValidateObjectTag objectTag) => this.EncodeInitializeProperties(objectTag, false); + private void EncodeInitializeProperties(ValidateObjectTag objectTag) => EncodeInitializeProperties(objectTag, false); private void EncodeInitializeProperties(ValidateObjectTag objectTag, bool forceVerifyValues) { if (objectTag.PropertyCount <= 0) return; for (ValidateProperty property = objectTag.PropertyList; property != null; property = property.Next) - this.EncodeInitializeProperty(property, objectTag.DynamicConstructionType); + EncodeInitializeProperty(property, objectTag.DynamicConstructionType); } private void EncodeInitializeInstance(TypeSchema type, int typeIndex) { if (!type.HasInitializer) return; - this._writer.WriteByte(OpCode.InitializeInstance); - this._writer.WriteUInt16(typeIndex); + _writer.WriteByte(OpCode.InitializeInstance); + _writer.WriteUInt16(typeIndex); } - private void EncodeInitializeProperty(ValidateProperty property) => this.EncodeInitializeProperty(property, null); + private void EncodeInitializeProperty(ValidateProperty property) => EncodeInitializeProperty(property, null); private void EncodeInitializeProperty( ValidateProperty property, @@ -159,26 +159,26 @@ namespace Microsoft.Iris.Markup return; if (property.ValueApplyMode == ValueApplyMode.SingleValueSet) { - this.EncodeObjectBySource(property.Value); - this.RecordLineNumber(property); + EncodeObjectBySource(property.Value); + RecordLineNumber(property); if (dynamicConstructionType == null) { - this._writer.WriteByte(OpCode.PropertyInitialize); - this._writer.WriteUInt16(property.FoundPropertyIndex); + _writer.WriteByte(OpCode.PropertyInitialize); + _writer.WriteUInt16(property.FoundPropertyIndex); } else { - this.EncodeObjectBySource(dynamicConstructionType); - this._writer.WriteByte(OpCode.PropertyInitializeIndirect); - this._writer.WriteUInt16(property.FoundPropertyIndex); + EncodeObjectBySource(dynamicConstructionType); + _writer.WriteByte(OpCode.PropertyInitializeIndirect); + _writer.WriteUInt16(property.FoundPropertyIndex); } } else { if ((property.ValueApplyMode & ValueApplyMode.CollectionPopulateAndSet) != ValueApplyMode.SingleValueSet) { - this._writer.WriteByte(OpCode.ConstructObject); - this._writer.WriteUInt16(property.FoundPropertyTypeIndex); + _writer.WriteByte(OpCode.ConstructObject); + _writer.WriteUInt16(property.FoundPropertyTypeIndex); } for (ValidateObjectTag next = (ValidateObjectTag)property.Value; next != null; next = next.Next) { @@ -187,41 +187,41 @@ namespace Microsoft.Iris.Markup uint fixUpLocation = uint.MaxValue; if (property.ShouldSkipDictionaryAddIfContains) { - this._writer.WriteByte(OpCode.JumpIfDictionaryContains); - this._writer.WriteUInt16((property.ValueApplyMode & ValueApplyMode.CollectionAdd) != ValueApplyMode.SingleValueSet ? property.FoundPropertyIndex : -1); - this._writer.WriteUInt16(this._constantsTable.Add(StringSchema.Type, next.Name, MarkupConstantPersistMode.Binary)); - fixUpLocation = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); + _writer.WriteByte(OpCode.JumpIfDictionaryContains); + _writer.WriteUInt16((property.ValueApplyMode & ValueApplyMode.CollectionAdd) != ValueApplyMode.SingleValueSet ? property.FoundPropertyIndex : -1); + _writer.WriteUInt16(_constantsTable.Add(StringSchema.Type, next.Name, MarkupConstantPersistMode.Binary)); + fixUpLocation = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); } - this.EncodeConstructObject(next); + EncodeConstructObject(next); if ((property.ValueApplyMode & ValueApplyMode.MultiValueDictionary) != ValueApplyMode.SingleValueSet) { - this._writer.WriteByte(OpCode.PropertyDictionaryAdd); - this._writer.WriteUInt16((property.ValueApplyMode & ValueApplyMode.CollectionAdd) != ValueApplyMode.SingleValueSet ? property.FoundPropertyIndex : -1); - this._writer.WriteUInt16(this._constantsTable.Add(StringSchema.Type, next.Name, MarkupConstantPersistMode.Binary)); + _writer.WriteByte(OpCode.PropertyDictionaryAdd); + _writer.WriteUInt16((property.ValueApplyMode & ValueApplyMode.CollectionAdd) != ValueApplyMode.SingleValueSet ? property.FoundPropertyIndex : -1); + _writer.WriteUInt16(_constantsTable.Add(StringSchema.Type, next.Name, MarkupConstantPersistMode.Binary)); } else { - this._writer.WriteByte(OpCode.PropertyListAdd); - this._writer.WriteUInt16((property.ValueApplyMode & ValueApplyMode.CollectionAdd) != ValueApplyMode.SingleValueSet ? property.FoundPropertyIndex : -1); + _writer.WriteByte(OpCode.PropertyListAdd); + _writer.WriteUInt16((property.ValueApplyMode & ValueApplyMode.CollectionAdd) != ValueApplyMode.SingleValueSet ? property.FoundPropertyIndex : -1); } if (fixUpLocation != uint.MaxValue) - this.FixUpJumpOffset(fixUpLocation); + FixUpJumpOffset(fixUpLocation); } } if ((property.ValueApplyMode & ValueApplyMode.CollectionPopulateAndSet) == ValueApplyMode.SingleValueSet) return; if (dynamicConstructionType == null) { - this._writer.WriteByte(OpCode.PropertyInitialize); - this._writer.WriteUInt16(property.FoundPropertyIndex); + _writer.WriteByte(OpCode.PropertyInitialize); + _writer.WriteUInt16(property.FoundPropertyIndex); } else { - this.EncodeObjectBySource(dynamicConstructionType); - this.RecordLineNumber(property); - this._writer.WriteByte(OpCode.PropertyInitializeIndirect); - this._writer.WriteUInt16(property.FoundPropertyIndex); + EncodeObjectBySource(dynamicConstructionType); + RecordLineNumber(property); + _writer.WriteByte(OpCode.PropertyInitializeIndirect); + _writer.WriteUInt16(property.FoundPropertyIndex); } } } @@ -231,16 +231,16 @@ namespace Microsoft.Iris.Markup switch (obj.ObjectSourceType) { case ObjectSourceType.ObjectTag: - this.EncodeConstructObject((ValidateObjectTag)obj); + EncodeConstructObject((ValidateObjectTag)obj); break; case ObjectSourceType.FromString: - this.EncodeFromString((ValidateFromString)obj); + EncodeFromString((ValidateFromString)obj); break; case ObjectSourceType.Code: - this.EncodeCode((ValidateCode)obj); + EncodeCode((ValidateCode)obj); break; case ObjectSourceType.Expression: - this.EncodeExpression((ValidateExpression)obj, null); + EncodeExpression((ValidateExpression)obj, null); break; } } @@ -261,30 +261,30 @@ namespace Microsoft.Iris.Markup persistMode = MarkupConstantPersistMode.FromString; persistData = fromString.FromString; } - int rawValue = this._constantsTable.Add(fromString.ObjectType, fromString.FromStringInstance, persistMode, persistData); - this._writer.WriteByte(OpCode.PushConstant); - this._writer.WriteUInt16(rawValue); + int rawValue = _constantsTable.Add(fromString.ObjectType, fromString.FromStringInstance, persistMode, persistData); + _writer.WriteByte(OpCode.PushConstant); + _writer.WriteUInt16(rawValue); } else if (fromString.ObjectType.SupportsBinaryEncoding) { - this._writer.WriteByte(OpCode.ConstructFromBinary); - this._writer.WriteUInt16(fromString.TypeHintIndex); - fromString.ObjectType.EncodeBinary(this._writer, fromString.FromStringInstance); + _writer.WriteByte(OpCode.ConstructFromBinary); + _writer.WriteUInt16(fromString.TypeHintIndex); + fromString.ObjectType.EncodeBinary(_writer, fromString.FromStringInstance); } else { - int rawValue = this._constantsTable.Add(StringSchema.Type, fromString.FromString, MarkupConstantPersistMode.FromString); - this._writer.WriteByte(OpCode.ConstructFromString); - this._writer.WriteUInt16(fromString.TypeHintIndex); - this._writer.WriteUInt16(rawValue); + int rawValue = _constantsTable.Add(StringSchema.Type, fromString.FromString, MarkupConstantPersistMode.FromString); + _writer.WriteByte(OpCode.ConstructFromString); + _writer.WriteUInt16(fromString.TypeHintIndex); + _writer.WriteUInt16(rawValue); } } private void EncodeCanonicalInstance(object instance, TypeSchema type, string memberName) { - int rawValue = this._constantsTable.Add(type, instance, MarkupConstantPersistMode.Canonical, memberName); - this._writer.WriteByte(OpCode.PushConstant); - this._writer.WriteUInt16(rawValue); + int rawValue = _constantsTable.Add(type, instance, MarkupConstantPersistMode.Canonical, memberName); + _writer.WriteByte(OpCode.PushConstant); + _writer.WriteUInt16(rawValue); } private void EncodeNamedContent(ValidateUI ui) @@ -295,203 +295,203 @@ namespace Microsoft.Iris.Markup int index = 0; foreach (ValidateProperty namedContentProperty in ui.FoundNamedContentProperties) { - uint offset = this.GetOffset(); + uint offset = GetOffset(); namedContentTable[index].SetOffset(offset); - this.EncodeObjectBySource(namedContentProperty.Value); - this._writer.WriteByte(OpCode.ReturnValue); + EncodeObjectBySource(namedContentProperty.Value); + _writer.WriteByte(OpCode.ReturnValue); ++index; } } private void EncodeCode(ValidateCode code) { - uint offset = this.GetOffset(); + uint offset = GetOffset(); code.TrackEncodingOffset(offset); - this.EncodeStatement(code.StatementCompound); + EncodeStatement(code.StatementCompound); if (code.ReturnStatements != null) { foreach (ValidateStatementReturn returnStatement in code.ReturnStatements) { if (!returnStatement.IsTrailingReturn) - this.FixUpJumpOffset(returnStatement.JumpFixupOffset); + FixUpJumpOffset(returnStatement.JumpFixupOffset); } } if (code.Embedded) return; if (code.ObjectType != VoidSchema.Type) - this._writer.WriteByte(OpCode.ReturnValue); + _writer.WriteByte(OpCode.ReturnValue); else - this._writer.WriteByte(OpCode.ReturnVoid); + _writer.WriteByte(OpCode.ReturnVoid); } private void EncodeStatement(ValidateStatement statement) { - this.RecordLineNumber(statement); + RecordLineNumber(statement); if (statement.StatementType != StatementType.Compound) - this.DeclareDebugPoint(statement.Line, statement.Column); + DeclareDebugPoint(statement.Line, statement.Column); switch (statement.StatementType) { case StatementType.Assignment: ValidateStatementAssignment statementAssignment = (ValidateStatementAssignment)statement; if (statementAssignment.DeclaredScopedLocal != null) - this.EncodeStatement(statementAssignment.DeclaredScopedLocal); - this.EncodeExpression(statementAssignment.RValue); - this.EncodeExpression(statementAssignment.LValue); - this._writer.WriteByte(OpCode.DiscardValue); + EncodeStatement(statementAssignment.DeclaredScopedLocal); + EncodeExpression(statementAssignment.RValue); + EncodeExpression(statementAssignment.LValue); + _writer.WriteByte(OpCode.DiscardValue); break; case StatementType.Expression: ValidateStatementExpression statementExpression = (ValidateStatementExpression)statement; - this.EncodeExpression(statementExpression.Expression); + EncodeExpression(statementExpression.Expression); if (statementExpression.Expression.ObjectType == VoidSchema.Type) break; - this._writer.WriteByte(OpCode.DiscardValue); + _writer.WriteByte(OpCode.DiscardValue); break; case StatementType.ForEach: ValidateStatementForEach statementForEach = (ValidateStatementForEach)statement; - this.EncodeScopedLocal(statementForEach.ScopedLocal); - this.EncodeExpression(statementForEach.Expression); - this._writer.WriteByte(OpCode.MethodInvoke); - this._writer.WriteUInt16(statementForEach.FoundGetEnumeratorIndex); - uint offset1 = this.GetOffset(); - this._writer.WriteByte(OpCode.MethodInvokePeek); - this._writer.WriteUInt16(statementForEach.FoundMoveNextIndex); - this._writer.WriteByte(OpCode.JumpIfFalse); - uint offset2 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this._writer.WriteByte(OpCode.PropertyGetPeek); - this._writer.WriteUInt16(statementForEach.FoundCurrentIndex); - this._writer.WriteByte(OpCode.VerifyTypeCast); - this._writer.WriteUInt16(statementForEach.ScopedLocal.FoundTypeIndex); - this._writer.WriteByte(OpCode.WriteSymbol); - this._writer.WriteUInt16(statementForEach.ScopedLocal.FoundSymbolIndex); - this.EncodeStatement(statementForEach.StatementCompound); - this._writer.WriteByte(OpCode.Jump); - this._writer.WriteUInt32(offset1); - this.FixUpJumpOffset(offset2); - uint offset3 = this.GetOffset(); - this._writer.WriteByte(OpCode.DiscardValue); - this.EncodeScopedLocalsWipe(statementForEach.ScopedLocalsToClear); + EncodeScopedLocal(statementForEach.ScopedLocal); + EncodeExpression(statementForEach.Expression); + _writer.WriteByte(OpCode.MethodInvoke); + _writer.WriteUInt16(statementForEach.FoundGetEnumeratorIndex); + uint offset1 = GetOffset(); + _writer.WriteByte(OpCode.MethodInvokePeek); + _writer.WriteUInt16(statementForEach.FoundMoveNextIndex); + _writer.WriteByte(OpCode.JumpIfFalse); + uint offset2 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + _writer.WriteByte(OpCode.PropertyGetPeek); + _writer.WriteUInt16(statementForEach.FoundCurrentIndex); + _writer.WriteByte(OpCode.VerifyTypeCast); + _writer.WriteUInt16(statementForEach.ScopedLocal.FoundTypeIndex); + _writer.WriteByte(OpCode.WriteSymbol); + _writer.WriteUInt16(statementForEach.ScopedLocal.FoundSymbolIndex); + EncodeStatement(statementForEach.StatementCompound); + _writer.WriteByte(OpCode.Jump); + _writer.WriteUInt32(offset1); + FixUpJumpOffset(offset2); + uint offset3 = GetOffset(); + _writer.WriteByte(OpCode.DiscardValue); + EncodeScopedLocalsWipe(statementForEach.ScopedLocalsToClear); foreach (ValidateStatementBreak breakStatement in statementForEach.BreakStatements) { if (breakStatement.IsContinue) - this.FixUpJumpOffset(breakStatement.JumpFixupOffset, offset1); + FixUpJumpOffset(breakStatement.JumpFixupOffset, offset1); else - this.FixUpJumpOffset(breakStatement.JumpFixupOffset, offset3); + FixUpJumpOffset(breakStatement.JumpFixupOffset, offset3); } break; case StatementType.While: ValidateStatementWhile validateStatementWhile = (ValidateStatementWhile)statement; - uint offset4 = this.GetOffset(); + uint offset4 = GetOffset(); if (validateStatementWhile.IsDoWhile) - this.EncodeStatement(validateStatementWhile.Body); - this.EncodeExpression(validateStatementWhile.Condition); - this._writer.WriteByte(OpCode.JumpIfFalse); - uint offset5 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); + EncodeStatement(validateStatementWhile.Body); + EncodeExpression(validateStatementWhile.Condition); + _writer.WriteByte(OpCode.JumpIfFalse); + uint offset5 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); if (!validateStatementWhile.IsDoWhile) - this.EncodeStatement(validateStatementWhile.Body); - this._writer.WriteByte(OpCode.Jump); - this._writer.WriteUInt32(offset4); - this.FixUpJumpOffset(offset5); - uint offset6 = this.GetOffset(); + EncodeStatement(validateStatementWhile.Body); + _writer.WriteByte(OpCode.Jump); + _writer.WriteUInt32(offset4); + FixUpJumpOffset(offset5); + uint offset6 = GetOffset(); foreach (ValidateStatementBreak breakStatement in validateStatementWhile.BreakStatements) { if (breakStatement.IsContinue) - this.FixUpJumpOffset(breakStatement.JumpFixupOffset, offset4); + FixUpJumpOffset(breakStatement.JumpFixupOffset, offset4); else - this.FixUpJumpOffset(breakStatement.JumpFixupOffset, offset6); + FixUpJumpOffset(breakStatement.JumpFixupOffset, offset6); } break; case StatementType.If: ValidateStatementIf validateStatementIf = (ValidateStatementIf)statement; - this.EncodeExpression(validateStatementIf.Condition); - this._writer.WriteByte(OpCode.JumpIfFalse); - uint offset7 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this.EncodeStatement(validateStatementIf.StatementCompound); - this.FixUpJumpOffset(offset7); + EncodeExpression(validateStatementIf.Condition); + _writer.WriteByte(OpCode.JumpIfFalse); + uint offset7 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + EncodeStatement(validateStatementIf.StatementCompound); + FixUpJumpOffset(offset7); break; case StatementType.IfElse: ValidateStatementIfElse validateStatementIfElse = (ValidateStatementIfElse)statement; - this.EncodeExpression(validateStatementIfElse.Condition); - this._writer.WriteByte(OpCode.JumpIfFalse); - uint offset8 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this.EncodeStatement(validateStatementIfElse.StatementCompoundTrue); - this._writer.WriteByte(OpCode.Jump); - uint offset9 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this.FixUpJumpOffset(offset8); - this.EncodeStatement(validateStatementIfElse.StatementCompoundFalse); - this.FixUpJumpOffset(offset9); + EncodeExpression(validateStatementIfElse.Condition); + _writer.WriteByte(OpCode.JumpIfFalse); + uint offset8 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + EncodeStatement(validateStatementIfElse.StatementCompoundTrue); + _writer.WriteByte(OpCode.Jump); + uint offset9 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + FixUpJumpOffset(offset8); + EncodeStatement(validateStatementIfElse.StatementCompoundFalse); + FixUpJumpOffset(offset9); break; case StatementType.Return: ValidateStatementReturn validateStatementReturn = (ValidateStatementReturn)statement; if (validateStatementReturn.Expression != null) - this.EncodeExpression(validateStatementReturn.Expression); + EncodeExpression(validateStatementReturn.Expression); if (validateStatementReturn.IsTrailingReturn) break; - this.EncodeScopedLocalsWipe(validateStatementReturn.ScopedLocalsToClear); - this._writer.WriteByte(OpCode.Jump); - uint offset10 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); + EncodeScopedLocalsWipe(validateStatementReturn.ScopedLocalsToClear); + _writer.WriteByte(OpCode.Jump); + uint offset10 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); validateStatementReturn.TrackJumpFixupOffset(offset10); break; case StatementType.ScopedLocal: - this.EncodeScopedLocal((ValidateStatementScopedLocal)statement); + EncodeScopedLocal((ValidateStatementScopedLocal)statement); break; case StatementType.Compound: ValidateStatementCompound statementCompound = (ValidateStatementCompound)statement; for (ValidateStatement statement1 = statementCompound.StatementList; statement1 != null; statement1 = statement1.Next) - this.EncodeStatement(statement1); - this.EncodeScopedLocalsWipe(statementCompound.ScopedLocalsToClear); + EncodeStatement(statement1); + EncodeScopedLocalsWipe(statementCompound.ScopedLocalsToClear); break; case StatementType.Break: ValidateStatementBreak validateStatementBreak = (ValidateStatementBreak)statement; - this.EncodeScopedLocalsWipe(validateStatementBreak.ScopedLocalsToClear); - this._writer.WriteByte(OpCode.Jump); - uint offset11 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); + EncodeScopedLocalsWipe(validateStatementBreak.ScopedLocalsToClear); + _writer.WriteByte(OpCode.Jump); + uint offset11 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); validateStatementBreak.TrackJumpFixupOffset(offset11); break; } } - private void EncodeExpression(ValidateExpression expression) => this.EncodeExpression(expression, null); + private void EncodeExpression(ValidateExpression expression) => EncodeExpression(expression, null); private void EncodeExpression( ValidateExpression expression, ListenerEncodeMode listenerEncodeMode) { - this.RecordLineNumber(expression); - expression.TrackEncodingOffset(this.GetOffset()); + RecordLineNumber(expression); + expression.TrackEncodingOffset(GetOffset()); switch (expression.ExpressionType) { case ExpressionType.Assignment: ValidateExpressionAssignment expressionAssignment = (ValidateExpressionAssignment)expression; if (!expressionAssignment.IsIndexAssignment) - this.EncodeExpression(expressionAssignment.RValue); - this.EncodeExpression(expressionAssignment.LValue); + EncodeExpression(expressionAssignment.RValue); + EncodeExpression(expressionAssignment.LValue); break; case ExpressionType.Symbol: bool flag1 = true; ValidateExpressionSymbol expressionSymbol = (ValidateExpressionSymbol)expression; if (expressionSymbol.NotifyIndex >= 0 && listenerEncodeMode != null) { - this.EncodeListenerHookup(listenerEncodeMode, expressionSymbol.NotifyIndex, ListenerType.Symbol, expressionSymbol.FoundSymbolIndex, expressionSymbol.IsNotifierRoot); + EncodeListenerHookup(listenerEncodeMode, expressionSymbol.NotifyIndex, ListenerType.Symbol, expressionSymbol.FoundSymbolIndex, expressionSymbol.IsNotifierRoot); flag1 = !expressionSymbol.IsNotifierRoot; } if (!flag1) break; - this._writer.WriteByte(expressionSymbol.Usage != ExpressionUsage.RValue ? OpCode.WriteSymbolPeek : OpCode.LookupSymbol); - this._writer.WriteUInt16(expressionSymbol.FoundSymbolIndex); + _writer.WriteByte(expressionSymbol.Usage != ExpressionUsage.RValue ? OpCode.WriteSymbolPeek : OpCode.LookupSymbol); + _writer.WriteUInt16(expressionSymbol.FoundSymbolIndex); break; case ExpressionType.Call: ValidateExpressionCall validateExpressionCall = (ValidateExpressionCall)expression; bool flag2 = false; if (validateExpressionCall.Target != null) { - this.EncodeExpression(validateExpressionCall.Target, listenerEncodeMode); + EncodeExpression(validateExpressionCall.Target, listenerEncodeMode); flag2 = true; } switch (validateExpressionCall.FoundMemberType) @@ -500,167 +500,167 @@ namespace Microsoft.Iris.Markup bool flag3 = true; if (validateExpressionCall.NotifyIndex >= 0 && listenerEncodeMode != null) { - this.EncodeListenerHookup(listenerEncodeMode, validateExpressionCall.NotifyIndex, ListenerType.Property, validateExpressionCall.FoundMemberIndex, validateExpressionCall.IsNotifierRoot); + EncodeListenerHookup(listenerEncodeMode, validateExpressionCall.NotifyIndex, ListenerType.Property, validateExpressionCall.FoundMemberIndex, validateExpressionCall.IsNotifierRoot); flag3 = !validateExpressionCall.IsNotifierRoot; } if (!flag3) return; OpCode opCode = validateExpressionCall.Usage != ExpressionUsage.RValue ? (flag2 ? OpCode.PropertyAssign : OpCode.PropertyAssignStatic) : (flag2 ? OpCode.PropertyGet : OpCode.PropertyGetStatic); - this.RecordLineNumber(expression); - this._writer.WriteByte(opCode); - this._writer.WriteUInt16(validateExpressionCall.FoundMemberIndex); + RecordLineNumber(expression); + _writer.WriteByte(opCode); + _writer.WriteUInt16(validateExpressionCall.FoundMemberIndex); return; case SchemaType.Method: if (validateExpressionCall.ParameterList != ValidateParameter.EmptyList) { for (ValidateParameter validateParameter = validateExpressionCall.ParameterList; validateParameter != null; validateParameter = validateParameter.Next) - this.EncodeExpression(validateParameter.Expression); + EncodeExpression(validateParameter.Expression); } - this.RecordLineNumber(expression); - this._writer.WriteByte(validateExpressionCall.IsIndexAssignment ? (flag2 ? OpCode.MethodInvokePushLastParam : OpCode.MethodInvokeStaticPushLastParam) : (flag2 ? OpCode.MethodInvoke : OpCode.MethodInvokeStatic)); - this._writer.WriteUInt16(validateExpressionCall.FoundMemberIndex); + RecordLineNumber(expression); + _writer.WriteByte(validateExpressionCall.IsIndexAssignment ? (flag2 ? OpCode.MethodInvokePushLastParam : OpCode.MethodInvokeStaticPushLastParam) : (flag2 ? OpCode.MethodInvoke : OpCode.MethodInvokeStatic)); + _writer.WriteUInt16(validateExpressionCall.FoundMemberIndex); return; case SchemaType.Event: if (validateExpressionCall.NotifyIndex < 0 || listenerEncodeMode == null) return; - this.EncodeListenerHookup(listenerEncodeMode, validateExpressionCall.NotifyIndex, ListenerType.Event, validateExpressionCall.FoundMemberIndex, validateExpressionCall.IsNotifierRoot); + EncodeListenerHookup(listenerEncodeMode, validateExpressionCall.NotifyIndex, ListenerType.Event, validateExpressionCall.FoundMemberIndex, validateExpressionCall.IsNotifierRoot); return; case SchemaType.CanonicalInstance: - this.EncodeCanonicalInstance(validateExpressionCall.FoundCanonicalInstance, validateExpressionCall.ObjectType, validateExpressionCall.MemberName); + EncodeCanonicalInstance(validateExpressionCall.FoundCanonicalInstance, validateExpressionCall.ObjectType, validateExpressionCall.MemberName); return; default: return; } case ExpressionType.Cast: ValidateExpressionCast validateExpressionCast = (ValidateExpressionCast)expression; - this.EncodeExpression(validateExpressionCast.Castee, listenerEncodeMode); - this.RecordLineNumber(expression); + EncodeExpression(validateExpressionCast.Castee, listenerEncodeMode); + RecordLineNumber(expression); if (validateExpressionCast.FoundCastMethod == CastMethod.Cast) { - this._writer.WriteByte(OpCode.VerifyTypeCast); - this._writer.WriteUInt16(validateExpressionCast.FoundTypeCastIndex); + _writer.WriteByte(OpCode.VerifyTypeCast); + _writer.WriteUInt16(validateExpressionCast.FoundTypeCastIndex); break; } - this._writer.WriteByte(OpCode.ConvertType); - this._writer.WriteUInt16(validateExpressionCast.FoundTypeCastIndex); - this._writer.WriteUInt16(validateExpressionCast.FoundCasteeTypeIndex); + _writer.WriteByte(OpCode.ConvertType); + _writer.WriteUInt16(validateExpressionCast.FoundTypeCastIndex); + _writer.WriteUInt16(validateExpressionCast.FoundCasteeTypeIndex); break; case ExpressionType.New: ValidateExpressionNew validateExpressionNew = (ValidateExpressionNew)expression; if (!validateExpressionNew.IsParameterizedConstruction) { - this._writer.WriteByte(OpCode.ConstructObject); - this._writer.WriteUInt16(validateExpressionNew.FoundConstructTypeIndex); + _writer.WriteByte(OpCode.ConstructObject); + _writer.WriteUInt16(validateExpressionNew.FoundConstructTypeIndex); } else { for (ValidateParameter validateParameter = validateExpressionNew.ParameterList; validateParameter != null; validateParameter = validateParameter.Next) - this.EncodeExpression(validateParameter.Expression); - this.RecordLineNumber(expression); - this._writer.WriteByte(OpCode.ConstructObjectParam); - this._writer.WriteUInt16(validateExpressionNew.FoundConstructTypeIndex); - this._writer.WriteUInt16(validateExpressionNew.FoundParameterizedConstructorIndex); + EncodeExpression(validateParameter.Expression); + RecordLineNumber(expression); + _writer.WriteByte(OpCode.ConstructObjectParam); + _writer.WriteUInt16(validateExpressionNew.FoundConstructTypeIndex); + _writer.WriteUInt16(validateExpressionNew.FoundParameterizedConstructorIndex); } - this.EncodeInitializeInstance(validateExpressionNew.FoundConstructType, validateExpressionNew.FoundConstructTypeIndex); + EncodeInitializeInstance(validateExpressionNew.FoundConstructType, validateExpressionNew.FoundConstructTypeIndex); break; case ExpressionType.Operation: ValidateExpressionOperation expressionOperation = (ValidateExpressionOperation)expression; - this.EncodeExpression(expressionOperation.LeftSide); + EncodeExpression(expressionOperation.LeftSide); uint fixUpLocation = uint.MaxValue; if (expressionOperation.FoundOperationTargetType == BooleanSchema.Type && (expressionOperation.Op == OperationType.LogicalAnd || expressionOperation.Op == OperationType.LogicalOr)) { - this.RecordLineNumber(expression); - this._writer.WriteByte(expressionOperation.Op == OperationType.LogicalOr ? OpCode.JumpIfTruePeek : OpCode.JumpIfFalsePeek); - fixUpLocation = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); + RecordLineNumber(expression); + _writer.WriteByte(expressionOperation.Op == OperationType.LogicalOr ? OpCode.JumpIfTruePeek : OpCode.JumpIfFalsePeek); + fixUpLocation = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); } if (expressionOperation.RightSide != null) - this.EncodeExpression(expressionOperation.RightSide); - this.RecordLineNumber(expression); - this._writer.WriteByte(OpCode.Operation); - this._writer.WriteUInt16(expressionOperation.FoundOperationTargetTypeIndex); - this._writer.WriteByte((byte)expressionOperation.Op); + EncodeExpression(expressionOperation.RightSide); + RecordLineNumber(expression); + _writer.WriteByte(OpCode.Operation); + _writer.WriteUInt16(expressionOperation.FoundOperationTargetTypeIndex); + _writer.WriteByte((byte)expressionOperation.Op); if (fixUpLocation == uint.MaxValue) break; - this.FixUpJumpOffset(fixUpLocation); + FixUpJumpOffset(fixUpLocation); break; case ExpressionType.IsCheck: ValidateExpressionIsCheck expressionIsCheck = (ValidateExpressionIsCheck)expression; - this.EncodeExpression(expressionIsCheck.Expression); - this.RecordLineNumber(expression); - this._writer.WriteByte(OpCode.IsCheck); - this._writer.WriteUInt16(expressionIsCheck.TypeIdentifier.FoundTypeIndex); + EncodeExpression(expressionIsCheck.Expression); + RecordLineNumber(expression); + _writer.WriteByte(OpCode.IsCheck); + _writer.WriteUInt16(expressionIsCheck.TypeIdentifier.FoundTypeIndex); break; case ExpressionType.As: ValidateExpressionAs validateExpressionAs = (ValidateExpressionAs)expression; - this.EncodeExpression(validateExpressionAs.Expression); - this.RecordLineNumber(expression); - this._writer.WriteByte(OpCode.As); - this._writer.WriteUInt16(validateExpressionAs.TypeIdentifier.FoundTypeIndex); + EncodeExpression(validateExpressionAs.Expression); + RecordLineNumber(expression); + _writer.WriteByte(OpCode.As); + _writer.WriteUInt16(validateExpressionAs.TypeIdentifier.FoundTypeIndex); break; case ExpressionType.Constant: ValidateExpressionConstant expressionConstant = (ValidateExpressionConstant)expression; if (expressionConstant.ConstantType != ConstantType.Null) { - int rawValue = this._constantsTable.Add(expressionConstant.ObjectType, expressionConstant.FoundConstant, MarkupConstantPersistMode.Binary); - this._writer.WriteByte(OpCode.PushConstant); - this._writer.WriteUInt16(rawValue); + int rawValue = _constantsTable.Add(expressionConstant.ObjectType, expressionConstant.FoundConstant, MarkupConstantPersistMode.Binary); + _writer.WriteByte(OpCode.PushConstant); + _writer.WriteUInt16(rawValue); break; } - this._writer.WriteByte(OpCode.PushNull); + _writer.WriteByte(OpCode.PushNull); break; case ExpressionType.DeclareTrigger: - this.EncodeExpression(((ValidateExpressionDeclareTrigger)expression).Expression); + EncodeExpression(((ValidateExpressionDeclareTrigger)expression).Expression); break; case ExpressionType.TypeOf: ValidateExpressionTypeOf expressionTypeOf = (ValidateExpressionTypeOf)expression; - this._writer.WriteByte(OpCode.TypeOf); - this._writer.WriteUInt16(expressionTypeOf.TypeIdentifier.FoundTypeIndex); + _writer.WriteByte(OpCode.TypeOf); + _writer.WriteUInt16(expressionTypeOf.TypeIdentifier.FoundTypeIndex); break; case ExpressionType.List: ArrayList expressions = ((ValidateExpressionList)expression).Expressions; for (int index = 0; index < expressions.Count; ++index) { ValidateExpression expression1 = (ValidateExpression)expressions[index]; - this.EncodeExpression(expression1); + EncodeExpression(expression1); if (index < expressions.Count - 1 && expression1.ObjectType != VoidSchema.Type) - this._writer.WriteByte(OpCode.DiscardValue); + _writer.WriteByte(OpCode.DiscardValue); } break; case ExpressionType.Index: - this.EncodeExpression(((ValidateExpressionIndex)expression).CallExpression); + EncodeExpression(((ValidateExpressionIndex)expression).CallExpression); break; case ExpressionType.Ternary: ValidateExpressionTernary expressionTernary = (ValidateExpressionTernary)expression; - this.EncodeExpression(expressionTernary.Condition); - this._writer.WriteByte(OpCode.JumpIfFalse); - uint offset1 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this.EncodeExpression(expressionTernary.TrueClause); - this._writer.WriteByte(OpCode.Jump); - uint offset2 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this.FixUpJumpOffset(offset1); - this.EncodeExpression(expressionTernary.FalseClause); - this.FixUpJumpOffset(offset2); + EncodeExpression(expressionTernary.Condition); + _writer.WriteByte(OpCode.JumpIfFalse); + uint offset1 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + EncodeExpression(expressionTernary.TrueClause); + _writer.WriteByte(OpCode.Jump); + uint offset2 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + FixUpJumpOffset(offset1); + EncodeExpression(expressionTernary.FalseClause); + FixUpJumpOffset(offset2); break; case ExpressionType.NullCoalescing: ValidateExpressionNullCoalescing expressionNullCoalescing = (ValidateExpressionNullCoalescing)expression; - this.EncodeExpression(expressionNullCoalescing.Condition); - this._writer.WriteByte(OpCode.JumpIfNullPeek); - uint offset3 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this._writer.WriteByte(OpCode.Jump); - uint offset4 = this.GetOffset(); - this._writer.WriteUInt32(uint.MaxValue); - this.FixUpJumpOffset(offset3); - this._writer.WriteByte(OpCode.DiscardValue); - this.EncodeExpression(expressionNullCoalescing.NullClause); - this.FixUpJumpOffset(offset4); + EncodeExpression(expressionNullCoalescing.Condition); + _writer.WriteByte(OpCode.JumpIfNullPeek); + uint offset3 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + _writer.WriteByte(OpCode.Jump); + uint offset4 = GetOffset(); + _writer.WriteUInt32(uint.MaxValue); + FixUpJumpOffset(offset3); + _writer.WriteByte(OpCode.DiscardValue); + EncodeExpression(expressionNullCoalescing.NullClause); + FixUpJumpOffset(offset4); break; case ExpressionType.This: case ExpressionType.BaseClass: - this._writer.WriteByte(OpCode.PushThis); + _writer.WriteByte(OpCode.PushThis); break; } } @@ -671,13 +671,13 @@ namespace Microsoft.Iris.Markup return; if (!statementScopedLocal.FoundType.IsNullAssignable) { - this._writer.WriteByte(OpCode.ConstructObject); - this._writer.WriteUInt16(statementScopedLocal.FoundTypeIndex); + _writer.WriteByte(OpCode.ConstructObject); + _writer.WriteUInt16(statementScopedLocal.FoundTypeIndex); } else - this._writer.WriteByte(OpCode.PushNull); - this._writer.WriteByte(OpCode.WriteSymbol); - this._writer.WriteUInt16(statementScopedLocal.FoundSymbolIndex); + _writer.WriteByte(OpCode.PushNull); + _writer.WriteByte(OpCode.WriteSymbol); + _writer.WriteUInt16(statementScopedLocal.FoundSymbolIndex); } private void EncodeScopedLocalsWipe(Vector scopedLocalsToClear) @@ -686,8 +686,8 @@ namespace Microsoft.Iris.Markup return; foreach (int rawValue in scopedLocalsToClear) { - this._writer.WriteByte(OpCode.ClearSymbol); - this._writer.WriteUInt16(rawValue); + _writer.WriteByte(OpCode.ClearSymbol); + _writer.WriteUInt16(rawValue); } } @@ -701,21 +701,21 @@ namespace Microsoft.Iris.Markup uint rawValue = listenerEncodeMode.SequentialListenerIndex((uint)localListenerIndex); if (isRoot) { - this._writer.WriteByte(OpCode.Listen); - this._writer.WriteUInt16(rawValue); - this._writer.WriteByte((byte)listenerType); - this._writer.WriteUInt16(targetIndex); - this._writer.WriteUInt32(listenerEncodeMode.ScriptId); + _writer.WriteByte(OpCode.Listen); + _writer.WriteUInt16(rawValue); + _writer.WriteByte((byte)listenerType); + _writer.WriteUInt16(targetIndex); + _writer.WriteUInt32(listenerEncodeMode.ScriptId); } else { uint num = listenerEncodeMode.RunOnNonTailTrigger ? listenerEncodeMode.ScriptId : uint.MaxValue; - this._writer.WriteByte(OpCode.DestructiveListen); - this._writer.WriteUInt16(rawValue); - this._writer.WriteByte((byte)listenerType); - this._writer.WriteUInt16(targetIndex); - this._writer.WriteUInt32(num); - this._writer.WriteUInt32(listenerEncodeMode.RefreshId); + _writer.WriteByte(OpCode.DestructiveListen); + _writer.WriteUInt16(rawValue); + _writer.WriteByte((byte)listenerType); + _writer.WriteUInt16(targetIndex); + _writer.WriteUInt32(num); + _writer.WriteUInt32(listenerEncodeMode.RefreshId); } return isRoot; } @@ -733,7 +733,7 @@ namespace Microsoft.Iris.Markup ++totalInitialEvaluates; if (action.FinalEvaluate) ++totalFinalEvaluates; - this.EncodeCode(action); + EncodeCode(action); } } @@ -741,8 +741,8 @@ namespace Microsoft.Iris.Markup { foreach (ValidateMethod method in methodList) { - uint offset = this.GetOffset(); - this.EncodeCode(method.Body); + uint offset = GetOffset(); + EncodeCode(method.Body); uint codeOffset = typeSchema.EncodeScriptOffsetAsId(offset); method.MethodExport.SetCodeOffset(codeOffset); } @@ -755,15 +755,15 @@ namespace Microsoft.Iris.Markup foreach (TriggerRecord triggerRecord in triggerList) { listenerEncodeMode.TriggerContainer = triggerRecord; - this.EncodeExpression(triggerRecord.SourceExpression, listenerEncodeMode); - this._writer.WriteByte(37); + EncodeExpression(triggerRecord.SourceExpression, listenerEncodeMode); + _writer.WriteByte(37); } } private void EncodeListenerInitialize(ValidateClass cls) { - this._writer.WriteByte(OpCode.ConstructListenerStorage); - this._writer.WriteUInt16(cls.TypeExport.ListenerCount); + _writer.WriteByte(OpCode.ConstructListenerStorage); + _writer.WriteUInt16(cls.TypeExport.ListenerCount); Vector triggerList = cls.TriggerList; uint[] refreshGroupOffsets = new uint[triggerList.Count]; for (int index = 0; index < triggerList.Count; ++index) @@ -808,9 +808,9 @@ namespace Microsoft.Iris.Markup int num = 0; for (ValidateObjectTag objectTag = validateObjectTag1; objectTag != null; objectTag = objectTag.Next) { - techniqueOffsets[num++] = this.GetOffset(); - this.EncodeConstructObject(objectTag); - this._writer.WriteByte(OpCode.ReturnValue); + techniqueOffsets[num++] = GetOffset(); + EncodeConstructObject(objectTag); + _writer.WriteByte(OpCode.ReturnValue); } typeExport.SetTechniqueOffsets(techniqueOffsets); validateEffect.RemoveProperty(validateEffect.FoundTechniquesValidateProperty); @@ -818,27 +818,27 @@ namespace Microsoft.Iris.Markup return; uint[] instancePropertyAssignments = new uint[length]; for (int index = 0; index < length; ++index) - instancePropertyAssignments[index] = this.GetOffset(); + instancePropertyAssignments[index] = GetOffset(); foreach (KeyValueEntry propertyAssignment in validateEffect.FoundInstancePropertyAssignments) { int elementSymbolIndex = validateEffect.GetElementSymbolIndex(propertyAssignment.Key); - this._writer.WriteByte(OpCode.LookupSymbol); - this._writer.WriteUInt16(elementSymbolIndex); + _writer.WriteByte(OpCode.LookupSymbol); + _writer.WriteUInt16(elementSymbolIndex); for (ValidateProperty next = propertyAssignment.Value; next != null; next = next.Next) - this.EncodeInitializeProperty(next); - this._writer.WriteByte(OpCode.DiscardValue); + EncodeInitializeProperty(next); + _writer.WriteByte(OpCode.DiscardValue); } - this._writer.WriteByte(OpCode.ReturnVoid); + _writer.WriteByte(OpCode.ReturnVoid); typeExport.SetInstancePropertyAssignments(instancePropertyAssignments); } - private uint GetOffset() => this._writer.DataSize; + private uint GetOffset() => _writer.DataSize; - private void FixUpJumpOffset(uint fixUpLocation, uint fixedOffset) => this._writer.Overwrite(fixUpLocation, fixedOffset); + private void FixUpJumpOffset(uint fixUpLocation, uint fixedOffset) => _writer.Overwrite(fixUpLocation, fixedOffset); - private void FixUpJumpOffset(uint fixUpLocation) => this.FixUpJumpOffset(fixUpLocation, this.GetOffset()); + private void FixUpJumpOffset(uint fixUpLocation) => FixUpJumpOffset(fixUpLocation, GetOffset()); - private void RecordLineNumber(Validate validate) => this._lineNumberTable.AddRecord(this.GetOffset(), validate.Line, validate.Column); + private void RecordLineNumber(Validate validate) => _lineNumberTable.AddRecord(GetOffset(), validate.Line, validate.Column); [Conditional("DEBUG")] private void DEBUG_EmitStart() diff --git a/UIX/Microsoft/Iris/Markup/MarkupError.cs b/UIX/Microsoft/Iris/Markup/MarkupError.cs index e61aa5f..83f6f2b 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupError.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupError.cs @@ -15,26 +15,26 @@ namespace Microsoft.Iris.Markup internal MarkupError(ErrorRecord error) { - this._error = error; - this._context = error.Context; - if (this._context == null || error.Line == -1) + _error = error; + _context = error.Context; + if (_context == null || error.Line == -1) return; if (error.Column != -1) - this._context = string.Format("{0} ({1},{2})", _context, error.Line, error.Column); + _context = string.Format("{0} ({1},{2})", _context, error.Line, error.Column); else - this._context = string.Format("{0} ({1})", _context, error.Line); + _context = string.Format("{0} ({1})", _context, error.Line); } - public bool IsError => !this._error.Warning; + public bool IsError => !_error.Warning; - public string Message => this._error.Message; + public string Message => _error.Message; - public string Context => this._context; + public string Context => _context; - public string Uri => this._error.Context; + public string Uri => _error.Context; - public int Line => this._error.Line; + public int Line => _error.Line; - public int Column => this._error.Column; + public int Column => _error.Column; } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupLineNumberTable.cs b/UIX/Microsoft/Iris/Markup/MarkupLineNumberTable.cs index 161e31e..7d2b495 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupLineNumberTable.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupLineNumberTable.cs @@ -21,37 +21,37 @@ namespace Microsoft.Iris.Markup private Vector _lookupTable; private ulong[] _runtimeList; - public MarkupLineNumberTable() => this._lookupTable = new Vector(); + public MarkupLineNumberTable() => _lookupTable = new Vector(); - public MarkupLineNumberTable(ulong[] runtimeList) => this._runtimeList = runtimeList; + public MarkupLineNumberTable(ulong[] runtimeList) => _runtimeList = runtimeList; public void AddRecord(uint offset, int line, int column) { ulong num = Pack(offset, line, column); - if (this._lookupTable.Count > 0 && (int)UnpackOffset(this._lookupTable[this._lookupTable.Count - 1]) == (int)offset) - this._lookupTable[this._lookupTable.Count - 1] = num; + if (_lookupTable.Count > 0 && (int)UnpackOffset(_lookupTable[_lookupTable.Count - 1]) == (int)offset) + _lookupTable[_lookupTable.Count - 1] = num; else - this._lookupTable.Add(num); + _lookupTable.Add(num); } public void PrepareForRuntimeUse() { - this._runtimeList = new ulong[this._lookupTable.Count]; - for (int index = 0; index < this._lookupTable.Count; ++index) - this._runtimeList[index] = this._lookupTable[index]; - this._lookupTable = null; + _runtimeList = new ulong[_lookupTable.Count]; + for (int index = 0; index < _lookupTable.Count; ++index) + _runtimeList[index] = _lookupTable[index]; + _lookupTable = null; } public void Lookup(uint offset, out int line, out int column) { - int length = this._runtimeList.Length; + int length = _runtimeList.Length; int index = 0; - while (index < length && (offset < UnpackOffset(this._runtimeList[index]) || index != length - 1 && offset >= UnpackOffset(this._runtimeList[index + 1]))) + while (index < length && (offset < UnpackOffset(_runtimeList[index]) || index != length - 1 && offset >= UnpackOffset(_runtimeList[index + 1]))) ++index; if (index < length) { - line = UnpackLine(this._runtimeList[index]); - column = UnpackColumn(this._runtimeList[index]); + line = UnpackLine(_runtimeList[index]); + column = UnpackColumn(_runtimeList[index]); } else { @@ -60,7 +60,7 @@ namespace Microsoft.Iris.Markup } } - internal ulong[] PersistList => this._runtimeList; + internal ulong[] PersistList => _runtimeList; [Conditional("DEBUG")] public void DEBUG_DumpTable() diff --git a/UIX/Microsoft/Iris/Markup/MarkupListener.cs b/UIX/Microsoft/Iris/Markup/MarkupListener.cs index a8ecb8f..245cf7a 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupListener.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupListener.cs @@ -21,30 +21,30 @@ namespace Microsoft.Iris.Markup IMarkupTypeBase scriptHost, uint scriptId) { - this._watch = watch; - this._scriptHost = scriptHost; - this._scriptId = scriptId; - this._watch = NotifyService.CanonicalizeString(this._watch); + _watch = watch; + _scriptHost = scriptHost; + _scriptId = scriptId; + _watch = NotifyService.CanonicalizeString(_watch); notifier.AddListener(this); } public override void Dispose() { - this._scriptHost = null; - this._scriptId = uint.MaxValue; + _scriptHost = null; + _scriptId = uint.MaxValue; base.Dispose(); } - internal IMarkupTypeBase ScriptHost => this._scriptHost; + internal IMarkupTypeBase ScriptHost => _scriptHost; public override void OnNotify() { base.OnNotify(); - if (this._scriptId == uint.MaxValue) + if (_scriptId == uint.MaxValue) return; - this._scriptHost.ScheduleScriptRun(this._scriptId, false); + _scriptHost.ScheduleScriptRun(_scriptId, false); } - public override string ToString() => string.Format("{0}{4}: {1}->0x{2:X8} on '{3}'", this.GetType().Name, _watch, _scriptId, _scriptHost, ""); + public override string ToString() => string.Format("{0}{4}: {1}->0x{2:X8} on '{3}'", GetType().Name, _watch, _scriptId, _scriptHost, ""); } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupListeners.cs b/UIX/Microsoft/Iris/Markup/MarkupListeners.cs index cfa9c18..3fc0b32 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupListeners.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupListeners.cs @@ -22,7 +22,7 @@ namespace Microsoft.Iris.Markup uint refreshOffset) { MarkupListener markupListener = null; - if (this._listenerList[index] is MarkupListener) + if (_listenerList[index] is MarkupListener) { markupListener = (MarkupListener)_listenerList[index]; markupListener.Dispose(); @@ -39,7 +39,7 @@ namespace Microsoft.Iris.Markup markupListener = new DestructiveListener(); ((DestructiveListener)markupListener).Reset(notifier, watch, scriptHost, scriptOffset, refreshOffset); } - this._listenerList[index] = markupListener; + _listenerList[index] = markupListener; } } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupLoadResult.cs b/UIX/Microsoft/Iris/Markup/MarkupLoadResult.cs index bcaac38..e41afd5 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupLoadResult.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupLoadResult.cs @@ -26,53 +26,53 @@ namespace Microsoft.Iris.Markup public MarkupLoadResult(string uri) : base(uri) - => this._status = LoadResultStatus.Loading; + => _status = LoadResultStatus.Loading; private void OnLoaded() { - if (this._dataMappingsTable == null) + if (_dataMappingsTable == null) return; - foreach (MarkupDataMapping mapping in this._dataMappingsTable) + foreach (MarkupDataMapping mapping in _dataMappingsTable) MarkupDataProvider.AddDataMapping(mapping); } protected override void OnDispose() { base.OnDispose(); - if (this._dataMappingsTable != null) + if (_dataMappingsTable != null) { - foreach (MarkupDataMapping mapping in this._dataMappingsTable) + foreach (MarkupDataMapping mapping in _dataMappingsTable) MarkupDataProvider.RemoveDataMapping(mapping); } - if (this._reader != null) - this._reader.Dispose(this); - foreach (DisposableObject disposableObject in this._exportTable) + if (_reader != null) + _reader.Dispose(this); + foreach (DisposableObject disposableObject in _exportTable) disposableObject.Dispose(this); - this._exportTable = null; + _exportTable = null; } public override TypeSchema FindType(string name) { - TypeSchema typeSchema = this.FindTypeWorker(name); + TypeSchema typeSchema = FindTypeWorker(name); if (typeSchema == null) { - typeSchema = this.ResolveAlias(name); + typeSchema = ResolveAlias(name); if (typeSchema != null) - this._resolvedAliases[name] = typeSchema; + _resolvedAliases[name] = typeSchema; } return typeSchema; } private TypeSchema FindTypeWorker(string name) { - for (int index = 0; index < this._exportTable.Length; ++index) + for (int index = 0; index < _exportTable.Length; ++index) { - TypeSchema typeSchema = this._exportTable[index]; + TypeSchema typeSchema = _exportTable[index]; if (name == typeSchema.Name) return typeSchema; } TypeSchema typeSchema1; - return this._resolvedAliases != null && this._resolvedAliases.TryGetValue(name, out typeSchema1) ? typeSchema1 : null; + return _resolvedAliases != null && _resolvedAliases.TryGetValue(name, out typeSchema1) ? typeSchema1 : null; } private TypeSchema ResolveAlias(string name) @@ -107,74 +107,74 @@ namespace Microsoft.Iris.Markup break; } if (num <= 0) - ErrorManager.ReportError("Alias cycle detected: {0} {1}", this.ToString(), name); + ErrorManager.ReportError("Alias cycle detected: {0} {1}", ToString(), name); return null; } public abstract bool IsSource { get; } - public override LoadResult[] Dependencies => this._dependenciesTable; + public override LoadResult[] Dependencies => _dependenciesTable; public abstract MarkupImportTables ImportTables { get; } - public ByteCodeReader ObjectSection => this._reader; + public ByteCodeReader ObjectSection => _reader; - public override TypeSchema[] ExportTable => this._exportTable; + public override TypeSchema[] ExportTable => _exportTable; - public AliasMapping[] AliasTable => this._aliasTable; + public AliasMapping[] AliasTable => _aliasTable; - public MarkupDataMapping[] DataMappingsTable => this._dataMappingsTable; + public MarkupDataMapping[] DataMappingsTable => _dataMappingsTable; - public MarkupBinaryDataTable BinaryDataTable => this._binaryDataTable; + public MarkupBinaryDataTable BinaryDataTable => _binaryDataTable; public abstract MarkupConstantsTable ConstantsTable { get; } - public virtual MarkupLineNumberTable LineNumberTable => this._lineNumberTable; + public virtual MarkupLineNumberTable LineNumberTable => _lineNumberTable; public void SetDependenciesTable(LoadResult[] dependenciesTable, bool registerDependencies) { - this._dependenciesTable = dependenciesTable; + _dependenciesTable = dependenciesTable; if (!registerDependencies) return; - this.RegisterDependenciesUsage(); + RegisterDependenciesUsage(); } - public void SetDependenciesTable(LoadResult[] dependenciesTable) => this.SetDependenciesTable(dependenciesTable, true); + public void SetDependenciesTable(LoadResult[] dependenciesTable) => SetDependenciesTable(dependenciesTable, true); public void SetObjectSection(ByteCodeReader reader) { reader.DeclareOwner(this); - this._reader = reader; + _reader = reader; } - public void SetBinaryDataTable(MarkupBinaryDataTable binaryDataTable) => this._binaryDataTable = binaryDataTable; + public void SetBinaryDataTable(MarkupBinaryDataTable binaryDataTable) => _binaryDataTable = binaryDataTable; - public void SetLineNumberTable(MarkupLineNumberTable lineNumberTable) => this._lineNumberTable = lineNumberTable; + public void SetLineNumberTable(MarkupLineNumberTable lineNumberTable) => _lineNumberTable = lineNumberTable; - public void SetExportTable(TypeSchema[] exportTable) => this._exportTable = exportTable; + public void SetExportTable(TypeSchema[] exportTable) => _exportTable = exportTable; public void SetAliasTable(AliasMapping[] aliasTable) { - this._aliasTable = aliasTable; - if (this._aliasTable == null) + _aliasTable = aliasTable; + if (_aliasTable == null) return; - this._resolvedAliases = new Map(this._aliasTable.Length); + _resolvedAliases = new Map(_aliasTable.Length); } - public void SetDataMappingsTable(MarkupDataMapping[] dataMappingsTable) => this._dataMappingsTable = dataMappingsTable; + public void SetDataMappingsTable(MarkupDataMapping[] dataMappingsTable) => _dataMappingsTable = dataMappingsTable; - public override LoadResultStatus Status => this._status; + public override LoadResultStatus Status => _status; public void SetStatus(LoadResultStatus status) { - if (this._status == status) + if (_status == status) return; - this._status = status; - if (this._status != LoadResultStatus.Success) + _status = status; + if (_status != LoadResultStatus.Success) return; - this.OnLoaded(); + OnLoaded(); } - public virtual void MarkLoadFailed() => this._status = LoadResultStatus.Error; + public virtual void MarkLoadFailed() => _status = LoadResultStatus.Error; } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupMethodSchema.cs b/UIX/Microsoft/Iris/Markup/MarkupMethodSchema.cs index 12ee7cf..666e7b1 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupMethodSchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupMethodSchema.cs @@ -64,42 +64,42 @@ namespace Microsoft.Iris.Markup string[] parameterNames) : base(owner) { - this._name = name; - this._returnType = returnType; - this._parameterTypes = parameterTypes; - this._parameterNames = parameterNames; - for (int index = 0; index < this._parameterNames.Length; ++index) - this._parameterNames[index] = NotifyService.CanonicalizeString(this._parameterNames[index]); + _name = name; + _returnType = returnType; + _parameterTypes = parameterTypes; + _parameterNames = parameterNames; + for (int index = 0; index < _parameterNames.Length; ++index) + _parameterNames[index] = NotifyService.CanonicalizeString(_parameterNames[index]); } - public override string Name => this._name; + public override string Name => _name; - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; - public string[] ParameterNames => this._parameterNames; + public string[] ParameterNames => _parameterNames; - public override TypeSchema ReturnType => this._returnType; + public override TypeSchema ReturnType => _returnType; public override bool IsStatic => false; - public bool IsVirtual => this._virtualId >= 0; + public bool IsVirtual => _virtualId >= 0; - public int VirtualId => this._virtualId; + public int VirtualId => _virtualId; - public bool IsVirtualThunk => this._isVirtualThunk; + public bool IsVirtualThunk => _isVirtualThunk; - public uint CodeOffset => this._codeOffset; + public uint CodeOffset => _codeOffset; - public void SetCodeOffset(uint codeOffset) => this._codeOffset = codeOffset; + public void SetCodeOffset(uint codeOffset) => _codeOffset = codeOffset; - public void SetVirtualId(int virtualId) => this._virtualId = virtualId; + public void SetVirtualId(int virtualId) => _virtualId = virtualId; public override object Invoke(object instance, object[] parameters) { - IMarkupTypeBase markupTypeBase = this.GetMarkupTypeBase(instance); + IMarkupTypeBase markupTypeBase = GetMarkupTypeBase(instance); if (markupTypeBase == null) return null; - return this._isVirtualThunk ? this.CallVirt(markupTypeBase, parameters) : this.CallDirect(markupTypeBase, parameters); + return _isVirtualThunk ? CallVirt(markupTypeBase, parameters) : CallDirect(markupTypeBase, parameters); } private object CallVirt(IMarkupTypeBase markupInstance, object[] parameters) @@ -110,7 +110,7 @@ namespace Microsoft.Iris.Markup { foreach (MarkupMethodSchema virtualMethod in typeSchema.VirtualMethods) { - if (virtualMethod.VirtualId == this._virtualId) + if (virtualMethod.VirtualId == _virtualId) { markupMethodSchema = virtualMethod; break; @@ -124,7 +124,7 @@ namespace Microsoft.Iris.Markup return markupMethodSchema.CallDirect(markupInstance, parameters); } - private object CallDirect(IMarkupTypeBase markupInstance, object[] parameters) => markupInstance.RunScript(this._codeOffset, false, new ParameterContext(this._parameterNames, parameters)); + private object CallDirect(IMarkupTypeBase markupInstance, object[] parameters) => markupInstance.RunScript(_codeOffset, false, new ParameterContext(_parameterNames, parameters)); protected abstract IMarkupTypeBase GetMarkupTypeBase(object instance); } diff --git a/UIX/Microsoft/Iris/Markup/MarkupPropertySchema.cs b/UIX/Microsoft/Iris/Markup/MarkupPropertySchema.cs index b4c2974..4bcb166 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupPropertySchema.cs @@ -33,21 +33,21 @@ namespace Microsoft.Iris.Markup protected MarkupPropertySchema(MarkupTypeSchema owner, string name, TypeSchema propertyType) : base(owner) { - this._name = NotifyService.CanonicalizeString(name); - this._propertyType = propertyType; + _name = NotifyService.CanonicalizeString(name); + _propertyType = propertyType; } - public void SetOverrideCriteria(PropertyOverrideCriteria overrideCriteria) => this._overrideCriteria = overrideCriteria; + public void SetOverrideCriteria(PropertyOverrideCriteria overrideCriteria) => _overrideCriteria = overrideCriteria; - public void SetRequiredForCreation(bool requiredForCreation) => this._requiredForCreation = requiredForCreation; + public void SetRequiredForCreation(bool requiredForCreation) => _requiredForCreation = requiredForCreation; - public override string Name => this._name; + public override string Name => _name; - public override TypeSchema PropertyType => this._propertyType; + public override TypeSchema PropertyType => _propertyType; public override TypeSchema AlternateType => (TypeSchema)null; - public PropertyOverrideCriteria OverrideCriteria => this._overrideCriteria; + public PropertyOverrideCriteria OverrideCriteria => _overrideCriteria; public override bool CanRead => true; @@ -57,7 +57,7 @@ namespace Microsoft.Iris.Markup public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None; - public override bool RequiredForCreation => this._requiredForCreation; + public override bool RequiredForCreation => _requiredForCreation; public override RangeValidator RangeValidator => (RangeValidator)null; diff --git a/UIX/Microsoft/Iris/Markup/MarkupServices.cs b/UIX/Microsoft/Iris/Markup/MarkupServices.cs index 5d21c0b..2ed5c30 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupServices.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupServices.cs @@ -17,7 +17,7 @@ namespace Microsoft.Iris.Markup private bool _warningsOnly = true; private NotifyService _notifier = new NotifyService(); - private MarkupServices() => ErrorManager.OnErrors += new NotifyErrorBatch(this.OnErrorBatch); + private MarkupServices() => ErrorManager.OnErrors += new NotifyErrorBatch(OnErrorBatch); public static MarkupServices Instance { @@ -34,24 +34,24 @@ namespace Microsoft.Iris.Markup foreach (ErrorRecord error in errors) { if (!error.Warning) - this._warningsOnly = false; - this._errors.Add(new MarkupError(error)); + _warningsOnly = false; + _errors.Add(new MarkupError(error)); } - this.FireNotification(NotificationID.ErrorsDetected); + FireNotification(NotificationID.ErrorsDetected); } public IList Errors => _errors; - public bool WarningsOnly => this._warningsOnly; + public bool WarningsOnly => _warningsOnly; public void ClearErrors() { - this._errors.Clear(); - this._warningsOnly = true; + _errors.Clear(); + _warningsOnly = true; } - void INotifyObject.AddListener(Listener listener) => this._notifier.AddListener(listener); + void INotifyObject.AddListener(Listener listener) => _notifier.AddListener(listener); - private void FireNotification(string id) => this._notifier.Fire(id); + private void FireNotification(string id) => _notifier.Fire(id); } } diff --git a/UIX/Microsoft/Iris/Markup/MarkupTypeSchema.cs b/UIX/Microsoft/Iris/Markup/MarkupTypeSchema.cs index ad5b39f..dd582ce 100644 --- a/UIX/Microsoft/Iris/Markup/MarkupTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/MarkupTypeSchema.cs @@ -58,18 +58,18 @@ namespace Microsoft.Iris.Markup public MarkupTypeSchema(MarkupLoadResult owner, string name) : base(owner) { - this._owner = owner; - this._name = name; + _owner = owner; + _name = name; } public abstract MarkupType MarkupType { get; } - public void SetBaseType(MarkupTypeSchema baseType) => this._baseType = baseType; + public void SetBaseType(MarkupTypeSchema baseType) => _baseType = baseType; public object LoadData { - get => this._loadData; - set => this._loadData = value; + get => _loadData; + set => _loadData = value; } public virtual void BuildProperties() @@ -78,44 +78,44 @@ namespace Microsoft.Iris.Markup public void Seal() { - if (this._sealed) + if (_sealed) return; - this.SealWorker(); + SealWorker(); } protected virtual void SealWorker() { - this._sealed = true; - this._loadData = null; - if (this._baseType == null) + _sealed = true; + _loadData = null; + if (_baseType == null) { - this._typeDepth = 1U; + _typeDepth = 1U; } else { - this._baseType.Seal(); - this._typeDepth = this._baseType._typeDepth + 1U; + _baseType.Seal(); + _typeDepth = _baseType._typeDepth + 1U; } } - public bool Sealed => this._sealed; + public bool Sealed => _sealed; protected override void OnDispose() { base.OnDispose(); - foreach (DisposableObject property in this._properties) + foreach (DisposableObject property in _properties) property.Dispose(this); - foreach (DisposableObject method in this._methods) + foreach (DisposableObject method in _methods) method.Dispose(this); - foreach (DisposableObject virtualMethod in this._virtualMethods) + foreach (DisposableObject virtualMethod in _virtualMethods) virtualMethod.Dispose(this); } - public override string Name => this._name; + public override string Name => _name; public override string AlternateName => (string)null; - public override TypeSchema Base => this._baseType == null ? this.DefaultBase : _baseType; + public override TypeSchema Base => _baseType == null ? DefaultBase : _baseType; public override bool Contractual => false; @@ -123,7 +123,7 @@ namespace Microsoft.Iris.Markup public override bool IsNativeAssignableFrom(TypeSchema checkSchema) => false; - public MarkupTypeSchema MarkupTypeBase => this._baseType; + public MarkupTypeSchema MarkupTypeBase => _baseType; protected abstract TypeSchema DefaultBase { get; } @@ -165,43 +165,43 @@ namespace Microsoft.Iris.Markup return obj; } - protected object RunAtOffset(IMarkupTypeBase markupType, uint scriptOffset) => this.RunAtOffset(markupType, scriptOffset, new ParameterContext()); + protected object RunAtOffset(IMarkupTypeBase markupType, uint scriptOffset) => RunAtOffset(markupType, scriptOffset, new ParameterContext()); public override ConstructorSchema FindConstructor(TypeSchema[] parameters) => (ConstructorSchema)null; public override PropertySchema FindProperty(string name) { - for (int index = 0; index < this._properties.Length; ++index) + for (int index = 0; index < _properties.Length; ++index) { - PropertySchema property = this._properties[index]; + PropertySchema property = _properties[index]; if (name == property.Name) return property; } return null; } - public override PropertySchema[] Properties => this._properties; + public override PropertySchema[] Properties => _properties; - public override MethodSchema[] Methods => this._methods; + public override MethodSchema[] Methods => _methods; public override MethodSchema FindMethod(string name, TypeSchema[] parameters) { MethodSchema methodSchema = null; - if (this._methodLookupTable != null) - this._methodLookupTable.TryGetValue(new MethodSignatureKey(name, parameters), out methodSchema); + if (_methodLookupTable != null) + _methodLookupTable.TryGetValue(new MethodSignatureKey(name, parameters), out methodSchema); return methodSchema; } - public MethodSchema[] VirtualMethods => this._virtualMethods; + public MethodSchema[] VirtualMethods => _virtualMethods; public override bool HasInitializer => true; protected void InitializeInstance(IMarkupTypeBase classBase) { - if (!this.InitializePropertiesLocalsInputContent(classBase, true)) + if (!InitializePropertiesLocalsInputContent(classBase, true)) return; - this.RefreshAllListeners(classBase); - if (!this.RunInitialEvaluates(classBase)) + RefreshAllListeners(classBase); + if (!RunInitialEvaluates(classBase)) return; classBase.NotifyInitialized(); } @@ -213,19 +213,19 @@ namespace Microsoft.Iris.Markup ErrorManager.EnterContext(this); try { - if (!this.RunInitializeScript(classBase, this._initializePropertiesOffset)) + if (!RunInitializeScript(classBase, _initializePropertiesOffset)) return false; - if (this._baseType != null) + if (_baseType != null) { - bool shouldInitializeContent1 = shouldInitializeContent && this._initializeContentOffset == uint.MaxValue; - if (!this._baseType.InitializePropertiesLocalsInputContent(classBase, shouldInitializeContent1)) + bool shouldInitializeContent1 = shouldInitializeContent && _initializeContentOffset == uint.MaxValue; + if (!_baseType.InitializePropertiesLocalsInputContent(classBase, shouldInitializeContent1)) return false; } - if (!this.RunInitializeScript(classBase, this._initializeLocalsInputOffset)) + if (!RunInitializeScript(classBase, _initializeLocalsInputOffset)) return false; if (shouldInitializeContent) { - if (!this.RunInitializeScript(classBase, this._initializeContentOffset)) + if (!RunInitializeScript(classBase, _initializeContentOffset)) return false; } } @@ -238,16 +238,16 @@ namespace Microsoft.Iris.Markup private void RefreshAllListeners(IMarkupTypeBase scriptHost) { - if (this._baseType != null) - this._baseType.RefreshAllListeners(scriptHost); - this.RunOffsets(scriptHost, this._refreshGroupOffsets, true); + if (_baseType != null) + _baseType.RefreshAllListeners(scriptHost); + RunOffsets(scriptHost, _refreshGroupOffsets, true); } - protected virtual bool RunInitialEvaluates(IMarkupTypeBase scriptHost) => (this._baseType == null || this._baseType.RunInitialEvaluates(scriptHost)) && this.RunOffsets(scriptHost, this._initialEvaluateOffsets); + protected virtual bool RunInitialEvaluates(IMarkupTypeBase scriptHost) => (_baseType == null || _baseType.RunInitialEvaluates(scriptHost)) && RunOffsets(scriptHost, _initialEvaluateOffsets); - public bool RunFinalEvaluates(IMarkupTypeBase scriptHost) => (this._baseType == null || this._baseType.RunFinalEvaluates(scriptHost)) && this.RunOffsets(scriptHost, this._finalEvaluateOffsets); + public bool RunFinalEvaluates(IMarkupTypeBase scriptHost) => (_baseType == null || _baseType.RunFinalEvaluates(scriptHost)) && RunOffsets(scriptHost, _finalEvaluateOffsets); - private bool RunOffsets(IMarkupTypeBase scriptHost, uint[] scriptOffsets) => this.RunOffsets(scriptHost, scriptOffsets, false); + private bool RunOffsets(IMarkupTypeBase scriptHost, uint[] scriptOffsets) => RunOffsets(scriptHost, scriptOffsets, false); private bool RunOffsets(IMarkupTypeBase scriptHost, uint[] scriptOffsets, bool ignoreErrors) { @@ -257,7 +257,7 @@ namespace Microsoft.Iris.Markup ErrorManager.EnterContext(this, ignoreErrors); foreach (uint scriptOffset in scriptOffsets) { - if (!this.RunInitializeScript(scriptHost, scriptOffset)) + if (!RunInitializeScript(scriptHost, scriptOffset)) { flag = false; break; @@ -270,7 +270,7 @@ namespace Microsoft.Iris.Markup protected bool RunInitializeScript(IMarkupTypeBase scriptHost, uint scriptOffset) { - if (scriptOffset == uint.MaxValue || this.RunAtOffset(scriptHost, scriptOffset) != Interpreter.ScriptError || ErrorManager.IgnoringErrors) + if (scriptOffset == uint.MaxValue || RunAtOffset(scriptHost, scriptOffset) != Interpreter.ScriptError || ErrorManager.IgnoringErrors) return true; ErrorManager.ReportWarning("Script runtime failure: Scripting errors have prevented '{0}' from properly initializing and will affect its operation", _name); return false; @@ -309,81 +309,81 @@ namespace Microsoft.Iris.Markup public override int FindTypeHint => -1; - public SymbolReference[] SymbolReferenceTable => this._symbolReferenceTable; + public SymbolReference[] SymbolReferenceTable => _symbolReferenceTable; public SymbolRecord[] InheritableSymbolsTable { get { - if (this._inheritableSymbolsTable == null) + if (_inheritableSymbolsTable == null) { - if (this._addressOfInheritableSymbolsTable != IntPtr.Zero) - CompiledMarkupLoader.DecodeInheritableSymbolTable(this, null, this._addressOfInheritableSymbolsTable); + if (_addressOfInheritableSymbolsTable != IntPtr.Zero) + CompiledMarkupLoader.DecodeInheritableSymbolTable(this, null, _addressOfInheritableSymbolsTable); else - this._inheritableSymbolsTable = SymbolRecord.EmptyList; + _inheritableSymbolsTable = SymbolRecord.EmptyList; } - return this._inheritableSymbolsTable; + return _inheritableSymbolsTable; } } - public uint TypeDepth => this._typeDepth; + public uint TypeDepth => _typeDepth; - public int TotalPropertiesAndLocalsCount => this._totalPropertiesAndLocalsCount; + public int TotalPropertiesAndLocalsCount => _totalPropertiesAndLocalsCount; - public uint InitializePropertiesOffset => this._initializePropertiesOffset; + public uint InitializePropertiesOffset => _initializePropertiesOffset; - public uint InitializeLocalsInputOffset => this._initializeLocalsInputOffset; + public uint InitializeLocalsInputOffset => _initializeLocalsInputOffset; - public uint InitializeContentOffset => this._initializeContentOffset; + public uint InitializeContentOffset => _initializeContentOffset; - public uint[] RefreshGroupOffsets => this._refreshGroupOffsets; + public uint[] RefreshGroupOffsets => _refreshGroupOffsets; - public uint[] InitialEvaluateOffsets => this._initialEvaluateOffsets; + public uint[] InitialEvaluateOffsets => _initialEvaluateOffsets; - public uint[] FinalEvaluateOffsets => this._finalEvaluateOffsets; + public uint[] FinalEvaluateOffsets => _finalEvaluateOffsets; - public uint ListenerCount => this._listenerCount; + public uint ListenerCount => _listenerCount; - public uint TotalListenerCount => this._listenerCount + (this._baseType == null ? 0U : this._baseType.TotalListenerCount); + public uint TotalListenerCount => _listenerCount + (_baseType == null ? 0U : _baseType.TotalListenerCount); - public uint EncodeScriptOffsetAsId(uint scriptOffset) => scriptOffset | this._typeDepth << 27; + public uint EncodeScriptOffsetAsId(uint scriptOffset) => scriptOffset | _typeDepth << 27; - public string LocallyUniqueId => this._typeDepth.ToString(); + public string LocallyUniqueId => _typeDepth.ToString(); - public void SetTypeDepth(uint typeDepth) => this._typeDepth = typeDepth; + public void SetTypeDepth(uint typeDepth) => _typeDepth = typeDepth; - public void SetPropertyList(PropertySchema[] properties) => this._properties = properties; + public void SetPropertyList(PropertySchema[] properties) => _properties = properties; public void SetMethodList(MethodSchema[] methods) { - this._methods = methods; - this._methodLookupTable = new Map(methods.Length); - foreach (MethodSchema method in this._methods) - this._methodLookupTable[new MethodSignatureKey(method.Name, method.ParameterTypes)] = method; + _methods = methods; + _methodLookupTable = new Map(methods.Length); + foreach (MethodSchema method in _methods) + _methodLookupTable[new MethodSignatureKey(method.Name, method.ParameterTypes)] = method; } - public void SetVirtualMethodList(MethodSchema[] virtualMethods) => this._virtualMethods = virtualMethods; + public void SetVirtualMethodList(MethodSchema[] virtualMethods) => _virtualMethods = virtualMethods; - public void SetSymbolReferenceTable(SymbolReference[] symbolTable) => this._symbolReferenceTable = symbolTable; + public void SetSymbolReferenceTable(SymbolReference[] symbolTable) => _symbolReferenceTable = symbolTable; - public void SetInheritableSymbolsTable(SymbolRecord[] symbolTable) => this._inheritableSymbolsTable = symbolTable; + public void SetInheritableSymbolsTable(SymbolRecord[] symbolTable) => _inheritableSymbolsTable = symbolTable; - public void SetAddressOfInheritableSymbolTable(IntPtr address) => this._addressOfInheritableSymbolsTable = address; + public void SetAddressOfInheritableSymbolTable(IntPtr address) => _addressOfInheritableSymbolsTable = address; - public void SetRefreshListenerGroupOffsets(uint[] refreshGroupOffsets) => this._refreshGroupOffsets = refreshGroupOffsets; + public void SetRefreshListenerGroupOffsets(uint[] refreshGroupOffsets) => _refreshGroupOffsets = refreshGroupOffsets; - public void SetInitialEvaluateOffsets(uint[] initialEvaluateOffsets) => this._initialEvaluateOffsets = initialEvaluateOffsets; + public void SetInitialEvaluateOffsets(uint[] initialEvaluateOffsets) => _initialEvaluateOffsets = initialEvaluateOffsets; - public void SetFinalEvaluateOffsets(uint[] finalEvaluateOffsets) => this._finalEvaluateOffsets = finalEvaluateOffsets; + public void SetFinalEvaluateOffsets(uint[] finalEvaluateOffsets) => _finalEvaluateOffsets = finalEvaluateOffsets; - public void SetListenerCount(uint listenerCount) => this._listenerCount = listenerCount; + public void SetListenerCount(uint listenerCount) => _listenerCount = listenerCount; - public void SetTotalPropertiesAndLocalsCount(int totalPropertiesAndLocalsCount) => this._totalPropertiesAndLocalsCount = totalPropertiesAndLocalsCount; + public void SetTotalPropertiesAndLocalsCount(int totalPropertiesAndLocalsCount) => _totalPropertiesAndLocalsCount = totalPropertiesAndLocalsCount; - public void SetInitializePropertiesOffset(uint offset) => this._initializePropertiesOffset = offset; + public void SetInitializePropertiesOffset(uint offset) => _initializePropertiesOffset = offset; - public void SetInitializeLocalsInputOffset(uint offset) => this._initializeLocalsInputOffset = offset; + public void SetInitializeLocalsInputOffset(uint offset) => _initializeLocalsInputOffset = offset; - public void SetInitializeContentOffset(uint offset) => this._initializeContentOffset = offset; + public void SetInitializeContentOffset(uint offset) => _initializeContentOffset = offset; } } diff --git a/UIX/Microsoft/Iris/Markup/MethodSchema.cs b/UIX/Microsoft/Iris/Markup/MethodSchema.cs index d8f8ea2..32517db 100644 --- a/UIX/Microsoft/Iris/Markup/MethodSchema.cs +++ b/UIX/Microsoft/Iris/Markup/MethodSchema.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.Markup public MethodSchema(TypeSchema owner) { - this._owner = owner; - this.DeclareOwner(owner); + _owner = owner; + DeclareOwner(owner); } - public TypeSchema Owner => this._owner; + public TypeSchema Owner => _owner; public abstract string Name { get; } diff --git a/UIX/Microsoft/Iris/Markup/MethodSignatureKey.cs b/UIX/Microsoft/Iris/Markup/MethodSignatureKey.cs index 5e0f9d6..343ed63 100644 --- a/UIX/Microsoft/Iris/Markup/MethodSignatureKey.cs +++ b/UIX/Microsoft/Iris/Markup/MethodSignatureKey.cs @@ -18,18 +18,18 @@ namespace Microsoft.Iris.Markup public MethodSignatureKey(string name, TypeSchema[] parameters) { - this._name = name; - this._parameters = parameters; + _name = name; + _parameters = parameters; } public override bool Equals(object obj) { MethodSignatureKey methodSignatureKey = (MethodSignatureKey)obj; - if (this._name != methodSignatureKey._name || this._parameters.Length != methodSignatureKey._parameters.Length) + if (_name != methodSignatureKey._name || _parameters.Length != methodSignatureKey._parameters.Length) return false; - for (int index = 0; index < this._parameters.Length; ++index) + for (int index = 0; index < _parameters.Length; ++index) { - if (!this._parameters[index].IsAssignableFrom(methodSignatureKey._parameters[index])) + if (!_parameters[index].IsAssignableFrom(methodSignatureKey._parameters[index])) return false; } return true; @@ -38,9 +38,9 @@ namespace Microsoft.Iris.Markup public override int GetHashCode() { int num = 0; - if (this._name != null) - num ^= this._name.GetHashCode(); - return num ^ this._parameters.Length; + if (_name != null) + num ^= _name.GetHashCode(); + return num ^ _parameters.Length; } } } diff --git a/UIX/Microsoft/Iris/Markup/NamedContentRecord.cs b/UIX/Microsoft/Iris/Markup/NamedContentRecord.cs index d4b5efa..9c732c7 100644 --- a/UIX/Microsoft/Iris/Markup/NamedContentRecord.cs +++ b/UIX/Microsoft/Iris/Markup/NamedContentRecord.cs @@ -11,8 +11,8 @@ namespace Microsoft.Iris.Markup public string Name; public uint Offset = uint.MaxValue; - public NamedContentRecord(string name) => this.Name = name; + public NamedContentRecord(string name) => Name = name; - public void SetOffset(uint offset) => this.Offset = offset; + public void SetOffset(uint offset) => Offset = offset; } } diff --git a/UIX/Microsoft/Iris/Markup/NativeMarkupDataQuery.cs b/UIX/Microsoft/Iris/Markup/NativeMarkupDataQuery.cs index d1e9fc4..5eabf59 100644 --- a/UIX/Microsoft/Iris/Markup/NativeMarkupDataQuery.cs +++ b/UIX/Microsoft/Iris/Markup/NativeMarkupDataQuery.cs @@ -23,30 +23,30 @@ namespace Microsoft.Iris.Markup public NativeMarkupDataQuery(MarkupDataQuerySchema type, NativeDataProviderWrapper provider) : base(type) { - this._handleToMe = s_handleTable.RegisterProxy(this); - this._typeHandle = type.UniqueId; - this._resultTypeHandle = type.ResultType.UniqueId; - this._externalQuery = provider.ConstructQuery(type.ProviderName, this._typeHandle, this._resultTypeHandle, this._handleToMe); - this.ApplyDefaultValues(); + _handleToMe = s_handleTable.RegisterProxy(this); + _typeHandle = type.UniqueId; + _resultTypeHandle = type.ResultType.UniqueId; + _externalQuery = provider.ConstructQuery(type.ProviderName, _typeHandle, _resultTypeHandle, _handleToMe); + ApplyDefaultValues(); } public override void NotifyInitialized() { base.NotifyInitialized(); - int num = (int)NativeApi.SpDataQueryNotifyInitialized(this._externalQuery); + int num = (int)NativeApi.SpDataQueryNotifyInitialized(_externalQuery); } protected override void OnDispose() { base.OnDispose(); - s_handleTable.ReleaseProxy(this._handleToMe); - int num = (int)NativeApi.SpDataBaseObjectSetInternalHandle(this._externalQuery, 0UL); - NativeApi.SpReleaseExternalObject(this._externalQuery); + s_handleTable.ReleaseProxy(_handleToMe); + int num = (int)NativeApi.SpDataBaseObjectSetInternalHandle(_externalQuery, 0UL); + NativeApi.SpReleaseExternalObject(_externalQuery); } public override void Refresh() { - int num = (int)NativeApi.SpDataQueryRefresh(this._externalQuery); + int num = (int)NativeApi.SpDataQueryRefresh(_externalQuery); } public override unsafe object Result @@ -54,14 +54,14 @@ namespace Microsoft.Iris.Markup get { UIXVariant propertyValue; - int resultProperty = (int)NativeApi.SpDataQueryGetResultProperty(this._externalQuery, out propertyValue); - return UIXVariant.GetValue(propertyValue, this.TypeSchema.Owner); + int resultProperty = (int)NativeApi.SpDataQueryGetResultProperty(_externalQuery, out propertyValue); + return UIXVariant.GetValue(propertyValue, TypeSchema.Owner); } set { UIXVariant* uixVariantPtr = stackalloc UIXVariant[sizeof(UIXVariant)]; UIXVariant.MarshalObject(value, uixVariantPtr); - int num = (int)NativeApi.SpDataQuerySetResultProperty(this._externalQuery, uixVariantPtr); + int num = (int)NativeApi.SpDataQuerySetResultProperty(_externalQuery, uixVariantPtr); } } @@ -70,7 +70,7 @@ namespace Microsoft.Iris.Markup get { DataProviderQueryStatus propertyValue; - int statusProperty = (int)NativeApi.SpDataQueryGetStatusProperty(this._externalQuery, out propertyValue); + int statusProperty = (int)NativeApi.SpDataQueryGetStatusProperty(_externalQuery, out propertyValue); return propertyValue; } } @@ -80,21 +80,21 @@ namespace Microsoft.Iris.Markup get { bool propertyValue; - int enabledProperty = (int)NativeApi.SpDataQueryGetEnabledProperty(this._externalQuery, out propertyValue); + int enabledProperty = (int)NativeApi.SpDataQueryGetEnabledProperty(_externalQuery, out propertyValue); return propertyValue; } set { - int num = (int)NativeApi.SpDataQuerySetEnabledProperty(this._externalQuery, value); + int num = (int)NativeApi.SpDataQuerySetEnabledProperty(_externalQuery, value); } } protected override bool ExternalObjectGetProperty(string propertyName, out object value) { UIXVariant propertyValue; - int property = (int)NativeApi.SpDataBaseObjectGetProperty(this._externalQuery, propertyName, out propertyValue); - this.TypeSchema.FindPropertyDeep(propertyName); - value = UIXVariant.GetValue(propertyValue, this.TypeSchema.Owner); + int property = (int)NativeApi.SpDataBaseObjectGetProperty(_externalQuery, propertyName, out propertyValue); + TypeSchema.FindPropertyDeep(propertyName); + value = UIXVariant.GetValue(propertyValue, TypeSchema.Owner); return true; } @@ -103,15 +103,15 @@ namespace Microsoft.Iris.Markup // ISSUE: untyped stack allocation UIXVariant* uixVariantPtr = stackalloc UIXVariant[sizeof(UIXVariant)]; UIXVariant.MarshalObject(value, uixVariantPtr); - int num = (int)NativeApi.SpDataBaseObjectSetProperty(this._externalQuery, propertyName, uixVariantPtr); + int num = (int)NativeApi.SpDataBaseObjectSetProperty(_externalQuery, propertyName, uixVariantPtr); return true; } protected override IDataProviderBaseObject ExternalAssemblyObject => (IDataProviderBaseObject)null; - public override IntPtr ExternalNativeObject => this._externalQuery; + public override IntPtr ExternalNativeObject => _externalQuery; - public ulong Handle => this._handleToMe; + public ulong Handle => _handleToMe; public static MarkupDataQuery LookupByHandle(ulong handle) { diff --git a/UIX/Microsoft/Iris/Markup/NativeMarkupDataType.cs b/UIX/Microsoft/Iris/Markup/NativeMarkupDataType.cs index 2327b2b..28e3e6e 100644 --- a/UIX/Microsoft/Iris/Markup/NativeMarkupDataType.cs +++ b/UIX/Microsoft/Iris/Markup/NativeMarkupDataType.cs @@ -34,17 +34,17 @@ namespace Microsoft.Iris.Markup private NativeMarkupDataType(MarkupDataTypeSchema type, IntPtr externalObject) : base(type) { - this._externalObject = externalObject; - this._handleToMe = s_handleTable.RegisterProxy(this); - this._typeHandle = type.UniqueId; - NativeApi.SpAddRefExternalObject(this._externalObject); - int num = (int)NativeApi.SpDataBaseObjectSetInternalHandle(this._externalObject, this._handleToMe); - this.TypeSchema.Owner.RegisterProxyUsage(); + _externalObject = externalObject; + _handleToMe = s_handleTable.RegisterProxy(this); + _typeHandle = type.UniqueId; + NativeApi.SpAddRefExternalObject(_externalObject); + int num = (int)NativeApi.SpDataBaseObjectSetInternalHandle(_externalObject, _handleToMe); + TypeSchema.Owner.RegisterProxyUsage(); } protected override void OnDispose() { - ReleaseNativeObject(this._externalObject, this._handleToMe, this._typeHandle); + ReleaseNativeObject(_externalObject, _handleToMe, _typeHandle); GC.SuppressFinalize(this); base.OnDispose(); } @@ -55,7 +55,7 @@ namespace Microsoft.Iris.Markup { if (s_pendingReleases == null) s_pendingReleases = new Vector(); - s_pendingReleases.Add(new NativeMarkupDataType.AppThreadReleaseEntry(this._externalObject, this._handleToMe, this._typeHandle)); + s_pendingReleases.Add(new NativeMarkupDataType.AppThreadReleaseEntry(_externalObject, _handleToMe, _typeHandle)); if (s_pendingAppThreadRelease) return; s_pendingAppThreadRelease = true; @@ -66,9 +66,9 @@ namespace Microsoft.Iris.Markup protected override bool ExternalObjectGetProperty(string propertyName, out object value) { UIXVariant propertyValue; - int property = (int)NativeApi.SpDataBaseObjectGetProperty(this._externalObject, propertyName, out propertyValue); - this.TypeSchema.FindPropertyDeep(propertyName); - value = UIXVariant.GetValue(propertyValue, this.TypeSchema.Owner); + int property = (int)NativeApi.SpDataBaseObjectGetProperty(_externalObject, propertyName, out propertyValue); + TypeSchema.FindPropertyDeep(propertyName); + value = UIXVariant.GetValue(propertyValue, TypeSchema.Owner); return true; } @@ -77,13 +77,13 @@ namespace Microsoft.Iris.Markup // ISSUE: untyped stack allocation UIXVariant* uixVariantPtr = stackalloc UIXVariant[sizeof(UIXVariant)]; UIXVariant.MarshalObject(value, uixVariantPtr); - int num = (int)NativeApi.SpDataBaseObjectSetProperty(this._externalObject, propertyName, uixVariantPtr); + int num = (int)NativeApi.SpDataBaseObjectSetProperty(_externalObject, propertyName, uixVariantPtr); return true; } protected override IDataProviderBaseObject ExternalAssemblyObject => (IDataProviderBaseObject)null; - public override IntPtr ExternalNativeObject => this._externalObject; + public override IntPtr ExternalNativeObject => _externalObject; public static NativeMarkupDataType LookupByHandle(ulong handle) { @@ -155,9 +155,9 @@ namespace Microsoft.Iris.Markup public AppThreadReleaseEntry(IntPtr nativeObject, ulong handle, ulong typeHandle) { - this._nativeObject = nativeObject; - this._handle = handle; - this._typeHandle = typeHandle; + _nativeObject = nativeObject; + _handle = handle; + _typeHandle = typeHandle; } } } diff --git a/UIX/Microsoft/Iris/Markup/NotifyService.cs b/UIX/Microsoft/Iris/Markup/NotifyService.cs index 4a00fb1..bcfeaf0 100644 --- a/UIX/Microsoft/Iris/Markup/NotifyService.cs +++ b/UIX/Microsoft/Iris/Markup/NotifyService.cs @@ -16,9 +16,9 @@ namespace Microsoft.Iris.Markup public void Fire(string id) { - if (this._listenerRoot == null || this._listenerRoot.Next == null) + if (_listenerRoot == null || _listenerRoot.Next == null) return; - for (ListenerNodeBase next = this._listenerRoot.Next; next != this._listenerRoot; next = next.Next) + for (ListenerNodeBase next = _listenerRoot.Next; next != _listenerRoot; next = next.Next) { Listener listener = (Listener)next; if (ReferenceEquals(listener.Watch, id)) @@ -30,30 +30,30 @@ namespace Microsoft.Iris.Markup { id = CanonicalizeString(id); if (UIDispatcher.IsUIThread) - this.Fire(id); + Fire(id); else - DeferredCall.Post(DispatchPriority.AppEvent, new DeferredHandler(this.FireThreadSafeMarshalHandler), id); + DeferredCall.Post(DispatchPriority.AppEvent, new DeferredHandler(FireThreadSafeMarshalHandler), id); } - public void FireThreadSafeMarshalHandler(object arg) => this.Fire((string)arg); + public void FireThreadSafeMarshalHandler(object arg) => Fire((string)arg); - public bool HasListeners => this._listenerRoot != null && this._listenerRoot.Next != null; + public bool HasListeners => _listenerRoot != null && _listenerRoot.Next != null; public void AddListener(Listener listener) { - if (this._listenerRoot == null) - this._listenerRoot = new ListenerRootNode(); - this._listenerRoot.AddPrevious(listener); + if (_listenerRoot == null) + _listenerRoot = new ListenerRootNode(); + _listenerRoot.AddPrevious(listener); } public void ClearListeners() { - if (this._listenerRoot == null) + if (_listenerRoot == null) return; - while (this._listenerRoot.Next != null) - this._listenerRoot.Next.Unlink(); - this._listenerRoot.Dispose(); - this._listenerRoot = null; + while (_listenerRoot.Next != null) + _listenerRoot.Next.Unlink(); + _listenerRoot.Dispose(); + _listenerRoot = null; } public static string CanonicalizeString(string value) => GetCanonicalizedString(value, true); diff --git a/UIX/Microsoft/Iris/Markup/ParameterContext.cs b/UIX/Microsoft/Iris/Markup/ParameterContext.cs index 60c60b2..323267c 100644 --- a/UIX/Microsoft/Iris/Markup/ParameterContext.cs +++ b/UIX/Microsoft/Iris/Markup/ParameterContext.cs @@ -13,29 +13,29 @@ namespace Microsoft.Iris.Markup public ParameterContext(string[] parameterNames, object[] parameterValues) { - this._parameterNames = parameterNames; - this._parameterValues = parameterValues; + _parameterNames = parameterNames; + _parameterValues = parameterValues; } public object ReadParameter(string name) { - int length = this._parameterNames.Length; + int length = _parameterNames.Length; for (int index = 0; index < length; ++index) { - if (this._parameterNames[index] == name) - return this._parameterValues[index]; + if (_parameterNames[index] == name) + return _parameterValues[index]; } return null; } public void WriteParameter(string name, object value) { - int length = this._parameterNames.Length; + int length = _parameterNames.Length; for (int index = 0; index < length; ++index) { - if (this._parameterNames[index] == name) + if (_parameterNames[index] == name) { - this._parameterValues[index] = value; + _parameterValues[index] = value; break; } } diff --git a/UIX/Microsoft/Iris/Markup/Parser.cs b/UIX/Microsoft/Iris/Markup/Parser.cs index 7d16bde..06bdc8b 100644 --- a/UIX/Microsoft/Iris/Markup/Parser.cs +++ b/UIX/Microsoft/Iris/Markup/Parser.cs @@ -368,13 +368,13 @@ namespace Microsoft.Iris.Markup public ScriptBlock(int line, int column) { - this.Line = line; - this.Column = column; + Line = line; + Column = column; } public ScriptBlock(int line, int column, Parser.CodeType codeType) : this(line, column) - => this.CodeType = codeType; + => CodeType = codeType; } } } diff --git a/UIX/Microsoft/Iris/Markup/PropertyOverrideCriteriaTypeConstraint.cs b/UIX/Microsoft/Iris/Markup/PropertyOverrideCriteriaTypeConstraint.cs index 9003d6b..28a6332 100644 --- a/UIX/Microsoft/Iris/Markup/PropertyOverrideCriteriaTypeConstraint.cs +++ b/UIX/Microsoft/Iris/Markup/PropertyOverrideCriteriaTypeConstraint.cs @@ -15,20 +15,20 @@ namespace Microsoft.Iris.Markup public PropertyOverrideCriteriaTypeConstraint(TypeSchema use, TypeSchema constraint) { - this._use = use; - this._constraint = constraint; + _use = use; + _constraint = constraint; } public override Result Verify(PropertyOverrideCriteria baseCriteria) { PropertyOverrideCriteriaTypeConstraint criteriaTypeConstraint = (PropertyOverrideCriteriaTypeConstraint)baseCriteria; - if (!criteriaTypeConstraint.Constraint.IsAssignableFrom(this._use)) + if (!criteriaTypeConstraint.Constraint.IsAssignableFrom(_use)) return Result.Fail(string.Format("Type parameter property '{0}' is of type '{1}' which is not compatible with the base type constraint '{2}'", "Use", _use.Name, criteriaTypeConstraint.Constraint.Name)); - return !criteriaTypeConstraint.Constraint.IsAssignableFrom(this._constraint) ? Result.Fail(string.Format("Type parameter property '{0}' is of type '{1}' which is not compatible with the base type constraint '{2}'", "Constraint", _constraint.Name, criteriaTypeConstraint.Constraint.Name)) : Result.Success; + return !criteriaTypeConstraint.Constraint.IsAssignableFrom(_constraint) ? Result.Fail(string.Format("Type parameter property '{0}' is of type '{1}' which is not compatible with the base type constraint '{2}'", "Constraint", _constraint.Name, criteriaTypeConstraint.Constraint.Name)) : Result.Success; } - public TypeSchema Use => this._use; + public TypeSchema Use => _use; - public TypeSchema Constraint => this._constraint; + public TypeSchema Constraint => _constraint; } } diff --git a/UIX/Microsoft/Iris/Markup/PropertySchema.cs b/UIX/Microsoft/Iris/Markup/PropertySchema.cs index d1acdeb..2713943 100644 --- a/UIX/Microsoft/Iris/Markup/PropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/PropertySchema.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.Markup public PropertySchema(TypeSchema owner) { - this._owner = owner; - this.DeclareOwner(owner); + _owner = owner; + DeclareOwner(owner); } - public TypeSchema Owner => this._owner; + public TypeSchema Owner => _owner; public abstract string Name { get; } diff --git a/UIX/Microsoft/Iris/Markup/ProviderlessMarkupDataType.cs b/UIX/Microsoft/Iris/Markup/ProviderlessMarkupDataType.cs index 390dd81..15e8909 100644 --- a/UIX/Microsoft/Iris/Markup/ProviderlessMarkupDataType.cs +++ b/UIX/Microsoft/Iris/Markup/ProviderlessMarkupDataType.cs @@ -21,8 +21,8 @@ namespace Microsoft.Iris.Markup { get { - if (this._externalAssemblyObject == null) - this._externalAssemblyObject = new ProviderlessDataProviderObject(this, (MarkupDataTypeSchema)this.TypeSchema); + if (_externalAssemblyObject == null) + _externalAssemblyObject = new ProviderlessDataProviderObject(this, (MarkupDataTypeSchema)TypeSchema); return _externalAssemblyObject; } } @@ -31,25 +31,25 @@ namespace Microsoft.Iris.Markup public override object ReadSymbol(SymbolReference symbolRef) { - lock (this.SynchronizedPropertyStorage) + lock (SynchronizedPropertyStorage) return base.ReadSymbol(symbolRef); } public override void WriteSymbol(SymbolReference symbolRef, object value) { - lock (this.SynchronizedPropertyStorage) + lock (SynchronizedPropertyStorage) base.WriteSymbol(symbolRef, value); } public override object GetProperty(string name) { - lock (this.SynchronizedPropertyStorage) + lock (SynchronizedPropertyStorage) return base.GetProperty(name); } public override void SetProperty(string name, object value) { - lock (this.SynchronizedPropertyStorage) + lock (SynchronizedPropertyStorage) base.SetProperty(name, value); } diff --git a/UIX/Microsoft/Iris/Markup/SSLexUnicodeBufferConsumer.cs b/UIX/Microsoft/Iris/Markup/SSLexUnicodeBufferConsumer.cs index cfaa5b9..ab301c3 100644 --- a/UIX/Microsoft/Iris/Markup/SSLexUnicodeBufferConsumer.cs +++ b/UIX/Microsoft/Iris/Markup/SSLexUnicodeBufferConsumer.cs @@ -23,26 +23,26 @@ namespace Microsoft.Iris.Markup public unsafe SSLexUnicodeBufferConsumer(IntPtr buffer, uint length, string prefix) { - this._buffer = (char*)buffer.ToPointer(); - this._length = length; - this._prefix = prefix; + _buffer = (char*)buffer.ToPointer(); + _length = length; + _prefix = prefix; } - public override bool getNext() => this.GetCharAt(this.m_index, out this.m_current); + public override bool getNext() => GetCharAt(m_index, out m_current); - public override unsafe string getSubstring(int start, int length) => start + length <= this._prefix.Length ? this._prefix.Substring(start, length) : NativeApi.PtrToStringUni(new IntPtr(this._buffer + start - this._prefix.Length), length); + public override unsafe string getSubstring(int start, int length) => start + length <= _prefix.Length ? _prefix.Substring(start, length) : NativeApi.PtrToStringUni(new IntPtr(_buffer + start - _prefix.Length), length); public unsafe bool GetCharAt(int position, out char ch) { - if (position < this._prefix.Length) + if (position < _prefix.Length) { - ch = this._prefix[this.m_index]; + ch = _prefix[m_index]; return true; } - int index = position - this._prefix.Length; + int index = position - _prefix.Length; if (index < _length) { - ch = this._buffer[index]; + ch = _buffer[index]; return true; } ch = char.MinValue; diff --git a/UIX/Microsoft/Iris/Markup/ScriptRunScheduler.cs b/UIX/Microsoft/Iris/Markup/ScriptRunScheduler.cs index 8fced3a..16731b1 100644 --- a/UIX/Microsoft/Iris/Markup/ScriptRunScheduler.cs +++ b/UIX/Microsoft/Iris/Markup/ScriptRunScheduler.cs @@ -13,30 +13,30 @@ namespace Microsoft.Iris.Markup private Vector _pendingList; private static ScriptRunScheduler.RunListCache s_listCache = new ScriptRunScheduler.RunListCache(); - public bool Pending => this._pendingList != null; + public bool Pending => _pendingList != null; public void ScheduleRun(uint scriptId, bool ignoreErrors) { - if (this._pendingList == null) - this._pendingList = s_listCache.Acquire(); + if (_pendingList == null) + _pendingList = s_listCache.Acquire(); int index; - for (index = 0; index < this._pendingList.Count; ++index) + for (index = 0; index < _pendingList.Count; ++index) { - uint scriptId1 = this._pendingList[index].ScriptId; + uint scriptId1 = _pendingList[index].ScriptId; if ((int)scriptId == (int)scriptId1) return; if (scriptId < scriptId1) break; } - this._pendingList.Insert(index, new ScriptRunScheduler.PendingScript(scriptId, ignoreErrors)); + _pendingList.Insert(index, new ScriptRunScheduler.PendingScript(scriptId, ignoreErrors)); } public void Execute(IMarkupTypeBase markupTypeBase) { - if (this._pendingList == null) + if (_pendingList == null) return; - Vector pendingList = this._pendingList; - this._pendingList = null; + Vector pendingList = _pendingList; + _pendingList = null; for (int index = 0; index < pendingList.Count; ++index) { ScriptRunScheduler.PendingScript pendingScript = pendingList[index]; @@ -52,8 +52,8 @@ namespace Microsoft.Iris.Markup public PendingScript(uint scriptId, bool ignoreErrors) { - this.ScriptId = scriptId; - this.IgnoreErrors = ignoreErrors; + ScriptId = scriptId; + IgnoreErrors = ignoreErrors; } } @@ -63,14 +63,14 @@ namespace Microsoft.Iris.Markup private const int c_MaxListSize = 32; private Stack _lists = new Stack(128); - public Vector Acquire() => this._lists.Count <= 0 ? new Vector() : (Vector)this._lists.Pop(); + public Vector Acquire() => _lists.Count <= 0 ? new Vector() : (Vector)_lists.Pop(); public void Release(Vector list) { - if (this._lists.Count >= 128 || list.Capacity > 32) + if (_lists.Count >= 128 || list.Capacity > 32) return; list.Clear(); - this._lists.Push(list); + _lists.Push(list); } } } diff --git a/UIX/Microsoft/Iris/Markup/SourceMarkupImportTables.cs b/UIX/Microsoft/Iris/Markup/SourceMarkupImportTables.cs index 52debbc..898bbe6 100644 --- a/UIX/Microsoft/Iris/Markup/SourceMarkupImportTables.cs +++ b/UIX/Microsoft/Iris/Markup/SourceMarkupImportTables.cs @@ -18,39 +18,39 @@ namespace Microsoft.Iris.Markup public MarkupImportTables PrepareImportTables() { MarkupImportTables markupImportTables = new MarkupImportTables(); - if (this.ImportedTypes.Count > 0) + if (ImportedTypes.Count > 0) { - TypeSchema[] typeSchemaArray = new TypeSchema[this.ImportedTypes.Count]; - for (int index = 0; index < this.ImportedTypes.Count; ++index) - typeSchemaArray[index] = (TypeSchema)this.ImportedTypes[index]; + TypeSchema[] typeSchemaArray = new TypeSchema[ImportedTypes.Count]; + for (int index = 0; index < ImportedTypes.Count; ++index) + typeSchemaArray[index] = (TypeSchema)ImportedTypes[index]; markupImportTables.TypeImports = typeSchemaArray; } - if (this.ImportedConstructors.Count > 0) + if (ImportedConstructors.Count > 0) { - ConstructorSchema[] constructorSchemaArray = new ConstructorSchema[this.ImportedConstructors.Count]; - for (int index = 0; index < this.ImportedConstructors.Count; ++index) - constructorSchemaArray[index] = (ConstructorSchema)this.ImportedConstructors[index]; + ConstructorSchema[] constructorSchemaArray = new ConstructorSchema[ImportedConstructors.Count]; + for (int index = 0; index < ImportedConstructors.Count; ++index) + constructorSchemaArray[index] = (ConstructorSchema)ImportedConstructors[index]; markupImportTables.ConstructorImports = constructorSchemaArray; } - if (this.ImportedProperties.Count > 0) + if (ImportedProperties.Count > 0) { - PropertySchema[] propertySchemaArray = new PropertySchema[this.ImportedProperties.Count]; - for (int index = 0; index < this.ImportedProperties.Count; ++index) - propertySchemaArray[index] = (PropertySchema)this.ImportedProperties[index]; + PropertySchema[] propertySchemaArray = new PropertySchema[ImportedProperties.Count]; + for (int index = 0; index < ImportedProperties.Count; ++index) + propertySchemaArray[index] = (PropertySchema)ImportedProperties[index]; markupImportTables.PropertyImports = propertySchemaArray; } - if (this.ImportedMethods.Count > 0) + if (ImportedMethods.Count > 0) { - MethodSchema[] methodSchemaArray = new MethodSchema[this.ImportedMethods.Count]; - for (int index = 0; index < this.ImportedMethods.Count; ++index) - methodSchemaArray[index] = (MethodSchema)this.ImportedMethods[index]; + MethodSchema[] methodSchemaArray = new MethodSchema[ImportedMethods.Count]; + for (int index = 0; index < ImportedMethods.Count; ++index) + methodSchemaArray[index] = (MethodSchema)ImportedMethods[index]; markupImportTables.MethodImports = methodSchemaArray; } - if (this.ImportedEvents.Count > 0) + if (ImportedEvents.Count > 0) { - EventSchema[] eventSchemaArray = new EventSchema[this.ImportedEvents.Count]; - for (int index = 0; index < this.ImportedEvents.Count; ++index) - eventSchemaArray[index] = (EventSchema)this.ImportedEvents[index]; + EventSchema[] eventSchemaArray = new EventSchema[ImportedEvents.Count]; + for (int index = 0; index < ImportedEvents.Count; ++index) + eventSchemaArray[index] = (EventSchema)ImportedEvents[index]; markupImportTables.EventImports = eventSchemaArray; } return markupImportTables; diff --git a/UIX/Microsoft/Iris/Markup/SourceMarkupLoadResult.cs b/UIX/Microsoft/Iris/Markup/SourceMarkupLoadResult.cs index 5555f48..d7fb91a 100644 --- a/UIX/Microsoft/Iris/Markup/SourceMarkupLoadResult.cs +++ b/UIX/Microsoft/Iris/Markup/SourceMarkupLoadResult.cs @@ -21,10 +21,10 @@ namespace Microsoft.Iris.Markup public SourceMarkupLoadResult(Resource resource, string uri) : base(uri) { - this._resource = resource; + _resource = resource; if (uri != resource.Uri) - this._uriUnderlying = resource.Uri; - this._loader = SourceMarkupLoader.Load(this, resource); + _uriUnderlying = resource.Uri; + _loader = SourceMarkupLoader.Load(this, resource); } public SourceMarkupLoadResult(string uri) @@ -34,24 +34,24 @@ namespace Microsoft.Iris.Markup public override bool IsSource => true; - internal SourceMarkupLoader Loader => this._loader; + internal SourceMarkupLoader Loader => _loader; - public override MarkupConstantsTable ConstantsTable => this._constantsTable; + public override MarkupConstantsTable ConstantsTable => _constantsTable; - public override MarkupImportTables ImportTables => this._importTables; + public override MarkupImportTables ImportTables => _importTables; public override void Load(LoadPass currentPass) { - if (this._doneWithLoader) + if (_doneWithLoader) return; ErrorManager.EnterContext(ErrorContextUri); - this._loader.Validate(currentPass); + _loader.Validate(currentPass); ErrorManager.ExitContext(); if (currentPass != LoadPass.Done) return; if (!MarkupSystem.TrackAdditionalMetadata) - this._loader = null; - this._doneWithLoader = true; + _loader = null; + _doneWithLoader = true; } public void ValidateType(MarkupTypeSchema typeSchema, LoadPass currentPass) @@ -66,19 +66,19 @@ namespace Microsoft.Iris.Markup public void ValidationComplete() { - if (this._resource != null) + if (_resource != null) { - this._resource.Free(); - this._resource = null; + _resource.Free(); + _resource = null; } - if (this.Status == LoadResultStatus.Loading) - this.SetStatus(LoadResultStatus.Success); - foreach (MarkupTypeSchema markupTypeSchema in this.ExportTable) + if (Status == LoadResultStatus.Loading) + SetStatus(LoadResultStatus.Success); + foreach (MarkupTypeSchema markupTypeSchema in ExportTable) markupTypeSchema.Seal(); } - public void SetConstantsTable(MarkupConstantsTable constantsTable) => this._constantsTable = constantsTable; + public void SetConstantsTable(MarkupConstantsTable constantsTable) => _constantsTable = constantsTable; - public void SetImportTables(MarkupImportTables importTables) => this._importTables = importTables; + public void SetImportTables(MarkupImportTables importTables) => _importTables = importTables; } } diff --git a/UIX/Microsoft/Iris/Markup/SourceMarkupLoader.cs b/UIX/Microsoft/Iris/Markup/SourceMarkupLoader.cs index 7dbd833..57ec931 100644 --- a/UIX/Microsoft/Iris/Markup/SourceMarkupLoader.cs +++ b/UIX/Microsoft/Iris/Markup/SourceMarkupLoader.cs @@ -42,98 +42,98 @@ namespace Microsoft.Iris.Markup return owner; } - protected SourceMarkupLoader(SourceMarkupLoadResult loadResultTarget) => this._loadResultTarget = loadResultTarget; + protected SourceMarkupLoader(SourceMarkupLoadResult loadResultTarget) => _loadResultTarget = loadResultTarget; - public SourceMarkupLoadResult LoadResultTarget => this._loadResultTarget; + public SourceMarkupLoadResult LoadResultTarget => _loadResultTarget; - public void SetParseResult(ParseResult parseResult) => this._parseResult = parseResult; + public void SetParseResult(ParseResult parseResult) => _parseResult = parseResult; public LoadResult FindDependency(string prefix) { if (prefix == null) return MarkupSystem.UIXGlobal; object obj; - this._importedNamespaces.TryGetValue(prefix, out obj); + _importedNamespaces.TryGetValue(prefix, out obj); return (LoadResult)obj; } public void Validate(LoadPass currentPass) { - if (this._currentValidationPass >= currentPass) + if (_currentValidationPass >= currentPass) return; - this._currentValidationPass = currentPass; - if (this._currentValidationPass == LoadPass.DeclareTypes) + _currentValidationPass = currentPass; + if (_currentValidationPass == LoadPass.DeclareTypes) { - if (this._parseResult == null) + if (_parseResult == null) return; - if (this._parseResult.Root != "UIX") + if (_parseResult.Root != "UIX") { - this.ReportError("Unknown markup format. Expecting ... root markup tags", -1, -1); + ReportError("Unknown markup format. Expecting ... root markup tags", -1, -1); return; } - if (this._parseResult.Version != "http://schemas.microsoft.com/2007/uix") + if (_parseResult.Version != "http://schemas.microsoft.com/2007/uix") { - this.ReportError(string.Format("Unsupported version of markup: '{0}'", _parseResult.Version), -1, -1); + ReportError(string.Format("Unsupported version of markup: '{0}'", _parseResult.Version), -1, -1); return; } - if (this._loadResultTarget.BinaryDataTable != null) + if (_loadResultTarget.BinaryDataTable != null) { - this._importTables = this._loadResultTarget.BinaryDataTable.SourceMarkupImportTables; - this._usingSharedBinaryDataTable = true; + _importTables = _loadResultTarget.BinaryDataTable.SourceMarkupImportTables; + _usingSharedBinaryDataTable = true; } else - this._importTables = new SourceMarkupImportTables(); - for (ValidateNamespace validateNamespace = this._parseResult.XmlnsList; validateNamespace != null; validateNamespace = validateNamespace.Next) + _importTables = new SourceMarkupImportTables(); + for (ValidateNamespace validateNamespace = _parseResult.XmlnsList; validateNamespace != null; validateNamespace = validateNamespace.Next) { LoadResult loadResult = validateNamespace.Validate(); if (loadResult != null) { - this._importedNamespaces[validateNamespace.Prefix] = loadResult; - this.TrackImportedLoadResult(loadResult); + _importedNamespaces[validateNamespace.Prefix] = loadResult; + TrackImportedLoadResult(loadResult); } } } - foreach (LoadResult loadResult in this._importedNamespaces.Values) + foreach (LoadResult loadResult in _importedNamespaces.Values) { - if (loadResult != this._loadResultTarget && loadResult != MarkupSystem.UIXGlobal) + if (loadResult != _loadResultTarget && loadResult != MarkupSystem.UIXGlobal) { - loadResult.Load(this._currentValidationPass); + loadResult.Load(_currentValidationPass); if (loadResult.Status == LoadResultStatus.Error) - this.MarkHasErrors(); + MarkHasErrors(); } } - if (this._parseResult != null && currentPass != LoadPass.Done) + if (_parseResult != null && currentPass != LoadPass.Done) { - foreach (ValidateClass validateClass in this._parseResult.ClassList) - validateClass.Validate(this._currentValidationPass); - foreach (ValidateDataMapping dataMapping in this._parseResult.DataMappingList) - dataMapping.Validate(this._currentValidationPass); - foreach (ValidateAlias alias in this._parseResult.AliasList) - alias.Validate(this._currentValidationPass); - if (this._currentValidationPass == LoadPass.Full) + foreach (ValidateClass validateClass in _parseResult.ClassList) + validateClass.Validate(_currentValidationPass); + foreach (ValidateDataMapping dataMapping in _parseResult.DataMappingList) + dataMapping.Validate(_currentValidationPass); + foreach (ValidateAlias alias in _parseResult.AliasList) + alias.Validate(_currentValidationPass); + if (_currentValidationPass == LoadPass.Full) { - for (ValidateNamespace validateNamespace = this._parseResult.XmlnsList; validateNamespace != null; validateNamespace = validateNamespace.Next) + for (ValidateNamespace validateNamespace = _parseResult.XmlnsList; validateNamespace != null; validateNamespace = validateNamespace.Next) { - if (!this._referencedNamespaces.ContainsKey(validateNamespace.Prefix)) + if (!_referencedNamespaces.ContainsKey(validateNamespace.Prefix)) ErrorManager.ReportWarning(validateNamespace.Line, validateNamespace.Column, "Unreferenced namespace {0}", validateNamespace.Prefix); } } } - this.CompleteValidationPass(); + CompleteValidationPass(); } public void CompleteValidationPass() { - if (this._currentValidationPass == LoadPass.DeclareTypes) + if (_currentValidationPass == LoadPass.DeclareTypes) { - this._loadResultTarget.SetExportTable(this.PrepareExportTable()); - this._loadResultTarget.SetAliasTable(this.PrepareAliasTable()); + _loadResultTarget.SetExportTable(PrepareExportTable()); + _loadResultTarget.SetAliasTable(PrepareAliasTable()); } - else if (this._currentValidationPass == LoadPass.PopulatePublicModel) + else if (_currentValidationPass == LoadPass.PopulatePublicModel) { - if (this._parseResult == null) + if (_parseResult == null) return; - foreach (ValidateClass validateClass in this._parseResult.ClassList) + foreach (ValidateClass validateClass in _parseResult.ClassList) { if (validateClass.TypeExport != null) validateClass.TypeExport.BuildProperties(); @@ -141,67 +141,67 @@ namespace Microsoft.Iris.Markup } else { - if (this._currentValidationPass != LoadPass.Full) + if (_currentValidationPass != LoadPass.Full) return; - if (this.HasErrors) - this._loadResultTarget.MarkLoadFailed(); + if (HasErrors) + _loadResultTarget.MarkLoadFailed(); MarkupImportTables importTables = null; - if (this._importTables != null) + if (_importTables != null) { - importTables = this._importTables.PrepareImportTables(); - this._loadResultTarget.SetImportTables(importTables); + importTables = _importTables.PrepareImportTables(); + _loadResultTarget.SetImportTables(importTables); } MarkupLineNumberTable lineNumberTable = new MarkupLineNumberTable(); - MarkupConstantsTable constantsTable = this._loadResultTarget.BinaryDataTable == null ? new MarkupConstantsTable() : this._loadResultTarget.BinaryDataTable.ConstantsTable; - this._loadResultTarget.SetDataMappingsTable(this.PrepareDataMappingTable()); - this._loadResultTarget.ValidationComplete(); + MarkupConstantsTable constantsTable = _loadResultTarget.BinaryDataTable == null ? new MarkupConstantsTable() : _loadResultTarget.BinaryDataTable.ConstantsTable; + _loadResultTarget.SetDataMappingsTable(PrepareDataMappingTable()); + _loadResultTarget.ValidationComplete(); ByteCodeReader reader = null; - if (!this.HasErrors) - reader = new MarkupEncoder(importTables, constantsTable, lineNumberTable).EncodeOBJECTSection(this._parseResult, this._loadResultTarget.Uri, null); - if (!this._usingSharedBinaryDataTable) + if (!HasErrors) + reader = new MarkupEncoder(importTables, constantsTable, lineNumberTable).EncodeOBJECTSection(_parseResult, _loadResultTarget.Uri, null); + if (!_usingSharedBinaryDataTable) { constantsTable.PrepareForRuntimeUse(); - this._loadResultTarget.SetConstantsTable(constantsTable); + _loadResultTarget.SetConstantsTable(constantsTable); } lineNumberTable.PrepareForRuntimeUse(); - this._loadResultTarget.SetLineNumberTable(lineNumberTable); + _loadResultTarget.SetLineNumberTable(lineNumberTable); if (reader != null) - this._loadResultTarget.SetObjectSection(reader); - this._loadResultTarget.SetDependenciesTable(this.PrepareDependenciesTable()); + _loadResultTarget.SetObjectSection(reader); + _loadResultTarget.SetDependenciesTable(PrepareDependenciesTable()); if (!MarkupSystem.TrackAdditionalMetadata) - this._parseResult = null; - foreach (DisposableObject validateObject in this._validateObjects) + _parseResult = null; + foreach (DisposableObject validateObject in _validateObjects) validateObject.Dispose(this); } } public int RegisterExportedType(MarkupTypeSchema type) { - int count = this._foundExportedTypes.Count; - this._foundExportedTypes.Add(type); + int count = _foundExportedTypes.Count; + _foundExportedTypes.Add(type); return count; } public int RegisterAlias(string alias, LoadResult loadResult, string targetType) { - this.TrackImportedLoadResult(loadResult); - if (this._foundAliasMappings == null) - this._foundAliasMappings = new Vector(); - int count = this._foundAliasMappings.Count; - this._foundAliasMappings.Add(new AliasMapping(alias, loadResult, targetType)); + TrackImportedLoadResult(loadResult); + if (_foundAliasMappings == null) + _foundAliasMappings = new Vector(); + int count = _foundAliasMappings.Count; + _foundAliasMappings.Add(new AliasMapping(alias, loadResult, targetType)); return count; } public bool IsTypeNameTaken(string typeName) { - foreach (TypeSchema foundExportedType in this._foundExportedTypes) + foreach (TypeSchema foundExportedType in _foundExportedTypes) { if (foundExportedType.Name == typeName) return true; } - if (this._foundAliasMappings != null) + if (_foundAliasMappings != null) { - foreach (AliasMapping foundAliasMapping in this._foundAliasMappings) + foreach (AliasMapping foundAliasMapping in _foundAliasMappings) { if (foundAliasMapping.Alias == typeName) return true; @@ -212,7 +212,7 @@ namespace Microsoft.Iris.Markup public void TrackValidateObject(Microsoft.Iris.Markup.Validation.Validate validate) { - this._validateObjects.Add(validate); + _validateObjects.Add(validate); validate.DeclareOwner(this); } @@ -220,49 +220,49 @@ namespace Microsoft.Iris.Markup { if (loadResult == MarkupSystem.UIXGlobal) return; - for (int index = 0; index < this._importTables.ImportedLoadResults.Count; ++index) + for (int index = 0; index < _importTables.ImportedLoadResults.Count; ++index) { - if ((LoadResult)this._importTables.ImportedLoadResults[index] == loadResult) + if ((LoadResult)_importTables.ImportedLoadResults[index] == loadResult) return; } - this._importTables.ImportedLoadResults.Add(loadResult); + _importTables.ImportedLoadResults.Add(loadResult); } public int TrackImportedType(TypeSchema type) { - this.TrackImportedLoadResult(type.Owner); - return this.TrackImportedSchema(this._importTables.ImportedTypes, type); + TrackImportedLoadResult(type.Owner); + return TrackImportedSchema(_importTables.ImportedTypes, type); } public int TrackImportedConstructor(ConstructorSchema constructor) { - int num = this.TrackImportedSchema(this._importTables.ImportedConstructors, constructor); - this.TrackImportedType(constructor.Owner); + int num = TrackImportedSchema(_importTables.ImportedConstructors, constructor); + TrackImportedType(constructor.Owner); foreach (TypeSchema parameterType in constructor.ParameterTypes) - this.TrackImportedType(parameterType); + TrackImportedType(parameterType); return num; } public int TrackImportedProperty(PropertySchema property) { - int num = this.TrackImportedSchema(this._importTables.ImportedProperties, property); - this.TrackImportedType(property.Owner); + int num = TrackImportedSchema(_importTables.ImportedProperties, property); + TrackImportedType(property.Owner); return num; } public int TrackImportedMethod(MethodSchema method) { - int num = this.TrackImportedSchema(this._importTables.ImportedMethods, method); - this.TrackImportedType(method.Owner); + int num = TrackImportedSchema(_importTables.ImportedMethods, method); + TrackImportedType(method.Owner); foreach (TypeSchema parameterType in method.ParameterTypes) - this.TrackImportedType(parameterType); + TrackImportedType(parameterType); return num; } public int TrackImportedEvent(EventSchema evt) { - int num = this.TrackImportedSchema(this._importTables.ImportedEvents, evt); - this.TrackImportedType(evt.Owner); + int num = TrackImportedSchema(_importTables.ImportedEvents, evt); + TrackImportedType(evt.Owner); return num; } @@ -280,27 +280,27 @@ namespace Microsoft.Iris.Markup public void ReportError(string error, int line, int column) { - this.MarkHasErrors(); + MarkHasErrors(); ErrorManager.ReportError(line, column, error); } public void MarkHasErrors() { - if (this._hasErrors) + if (_hasErrors) return; - this._hasErrors = true; - this._loadResultTarget.MarkLoadFailed(); + _hasErrors = true; + _loadResultTarget.MarkLoadFailed(); } public LoadResult[] PrepareDependenciesTable() { LoadResult[] loadResultArray = LoadResult.EmptyList; int length = 0; - if (this._importTables != null) + if (_importTables != null) { - foreach (LoadResult importedLoadResult in this._importTables.ImportedLoadResults) + foreach (LoadResult importedLoadResult in _importTables.ImportedLoadResults) { - if (importedLoadResult != this._loadResultTarget) + if (importedLoadResult != _loadResultTarget) ++length; } } @@ -308,9 +308,9 @@ namespace Microsoft.Iris.Markup { loadResultArray = new LoadResult[length]; int index = 0; - foreach (LoadResult importedLoadResult in this._importTables.ImportedLoadResults) + foreach (LoadResult importedLoadResult in _importTables.ImportedLoadResults) { - if (importedLoadResult != this._loadResultTarget) + if (importedLoadResult != _loadResultTarget) { loadResultArray[index] = importedLoadResult; ++index; @@ -323,12 +323,12 @@ namespace Microsoft.Iris.Markup public TypeSchema[] PrepareExportTable() { TypeSchema[] typeSchemaArray = TypeSchema.EmptyList; - if (this._foundExportedTypes.Count > 0) + if (_foundExportedTypes.Count > 0) { - typeSchemaArray = new TypeSchema[this._foundExportedTypes.Count]; - for (int index = 0; index < this._foundExportedTypes.Count; ++index) + typeSchemaArray = new TypeSchema[_foundExportedTypes.Count]; + for (int index = 0; index < _foundExportedTypes.Count; ++index) { - MarkupTypeSchema foundExportedType = (MarkupTypeSchema)this._foundExportedTypes[index]; + MarkupTypeSchema foundExportedType = (MarkupTypeSchema)_foundExportedTypes[index]; typeSchemaArray[index] = foundExportedType; } } @@ -338,11 +338,11 @@ namespace Microsoft.Iris.Markup private AliasMapping[] PrepareAliasTable() { AliasMapping[] aliasMappingArray = null; - if (this._foundAliasMappings != null) + if (_foundAliasMappings != null) { - aliasMappingArray = new AliasMapping[this._foundAliasMappings.Count]; - for (int index = 0; index < this._foundAliasMappings.Count; ++index) - aliasMappingArray[index] = (AliasMapping)this._foundAliasMappings[index]; + aliasMappingArray = new AliasMapping[_foundAliasMappings.Count]; + for (int index = 0; index < _foundAliasMappings.Count; ++index) + aliasMappingArray[index] = (AliasMapping)_foundAliasMappings[index]; } return aliasMappingArray; } @@ -350,11 +350,11 @@ namespace Microsoft.Iris.Markup private MarkupDataMapping[] PrepareDataMappingTable() { MarkupDataMapping[] dataMappingTable = null; - int length = this.PrepareDataMappingTableHelper(null); + int length = PrepareDataMappingTableHelper(null); if (length > 0) { dataMappingTable = new MarkupDataMapping[length]; - this.PrepareDataMappingTableHelper(dataMappingTable); + PrepareDataMappingTableHelper(dataMappingTable); } return dataMappingTable; } @@ -362,15 +362,15 @@ namespace Microsoft.Iris.Markup private int PrepareDataMappingTableHelper(MarkupDataMapping[] dataMappingTable) { int dataMappingCount = 0; - if (this._parseResult != null) + if (_parseResult != null) { - foreach (ValidateClass validateClass in this._parseResult.ClassList) + foreach (ValidateClass validateClass in _parseResult.ClassList) { if (validateClass is ValidateDataType validateDataType) - this.AddDataMappingsHelper(validateDataType.FoundDataMappingSet, dataMappingTable, ref dataMappingCount); + AddDataMappingsHelper(validateDataType.FoundDataMappingSet, dataMappingTable, ref dataMappingCount); } - foreach (ValidateDataMapping dataMapping in this._parseResult.DataMappingList) - this.AddDataMappingsHelper(dataMapping.FoundDataMappingSet, dataMappingTable, ref dataMappingCount); + foreach (ValidateDataMapping dataMapping in _parseResult.DataMappingList) + AddDataMappingsHelper(dataMapping.FoundDataMappingSet, dataMappingTable, ref dataMappingCount); } return dataMappingCount; } @@ -394,7 +394,7 @@ namespace Microsoft.Iris.Markup { if (prefix == null) return; - this._referencedNamespaces[prefix] = null; + _referencedNamespaces[prefix] = null; } public ValidateObjectTag CreateObjectTagValidator( @@ -443,8 +443,8 @@ namespace Microsoft.Iris.Markup { } - public bool HasErrors => this._hasErrors; + public bool HasErrors => _hasErrors; - internal ParseResult ParseResult => this._parseResult; + internal ParseResult ParseResult => _parseResult; } } diff --git a/UIX/Microsoft/Iris/Markup/SymbolReference.cs b/UIX/Microsoft/Iris/Markup/SymbolReference.cs index 307ea5d..24aa832 100644 --- a/UIX/Microsoft/Iris/Markup/SymbolReference.cs +++ b/UIX/Microsoft/Iris/Markup/SymbolReference.cs @@ -13,12 +13,12 @@ namespace Microsoft.Iris.Markup public SymbolReference(string symbol, SymbolOrigin origin) { - this._origin = origin; - this._symbol = NotifyService.CanonicalizeString(symbol); + _origin = origin; + _symbol = NotifyService.CanonicalizeString(symbol); } - public string Symbol => this._symbol; + public string Symbol => _symbol; - public SymbolOrigin Origin => this._origin; + public SymbolOrigin Origin => _origin; } } diff --git a/UIX/Microsoft/Iris/Markup/TypeConstraint.cs b/UIX/Microsoft/Iris/Markup/TypeConstraint.cs index 67ae067..befc140 100644 --- a/UIX/Microsoft/Iris/Markup/TypeConstraint.cs +++ b/UIX/Microsoft/Iris/Markup/TypeConstraint.cs @@ -13,14 +13,14 @@ namespace Microsoft.Iris.Markup public TypeSchema Constraint { - get => this._constraint; - set => this._constraint = value; + get => _constraint; + set => _constraint = value; } public TypeSchema Type { - get => this._type; - set => this._type = value; + get => _type; + set => _type = value; } } } diff --git a/UIX/Microsoft/Iris/Markup/TypeSchema.cs b/UIX/Microsoft/Iris/Markup/TypeSchema.cs index 54d8161..b6ac17e 100644 --- a/UIX/Microsoft/Iris/Markup/TypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/TypeSchema.cs @@ -21,21 +21,21 @@ namespace Microsoft.Iris.Markup public TypeSchema(LoadResult owner) { - this._owner = owner; - this._id = ++s_uniqueId; - s_idToTypeSchema[this._id] = this; - this.DeclareOwner(owner); + _owner = owner; + _id = ++s_uniqueId; + s_idToTypeSchema[_id] = this; + DeclareOwner(owner); } protected override void OnDispose() { - s_idToTypeSchema.Remove(this._id); + s_idToTypeSchema.Remove(_id); base.OnDispose(); } - public LoadResult Owner => this._owner; + public LoadResult Owner => _owner; - public Vector Equivalents => this._equivalents; + public Vector Equivalents => _equivalents; public abstract string Name { get; } @@ -109,17 +109,17 @@ namespace Microsoft.Iris.Markup public bool IsAssignableFrom(object check) { if (check == null) - return this.IsNullAssignable; - return check is ISchemaInfo schemaInfo ? this.IsAssignableFrom(schemaInfo.TypeSchema) : this.IsNativeAssignableFrom(check); + return IsNullAssignable; + return check is ISchemaInfo schemaInfo ? IsAssignableFrom(schemaInfo.TypeSchema) : IsNativeAssignableFrom(check); } public bool IsAssignableFrom(TypeSchema checkSchema) { if (checkSchema == null) return false; - if (checkSchema == NullSchema.Type && this.IsNullAssignable) + if (checkSchema == NullSchema.Type && IsNullAssignable) return true; - if (!this.Contractual) + if (!Contractual) { for (TypeSchema typeSchema = checkSchema; typeSchema != null; typeSchema = typeSchema.Base) { @@ -135,7 +135,7 @@ namespace Microsoft.Iris.Markup } } } - return this.IsNativeAssignableFrom(checkSchema); + return IsNativeAssignableFrom(checkSchema); } public PropertySchema FindPropertyDeep(string name) @@ -152,15 +152,15 @@ namespace Microsoft.Iris.Markup public Vector FindRequiredPropertyNamesDeep() { Vector list = new Vector(); - this.FindRequiredPropertyNamesDeep(list); + FindRequiredPropertyNamesDeep(list); return list; } private void FindRequiredPropertyNamesDeep(Vector list) { - if (this.Base != null) - this.Base.FindRequiredPropertyNamesDeep(list); - foreach (PropertySchema property in this.Properties) + if (Base != null) + Base.FindRequiredPropertyNamesDeep(list); + foreach (PropertySchema property in Properties) { int index = list.IndexOf(property.Name); if (index != -1) @@ -230,13 +230,13 @@ namespace Microsoft.Iris.Markup RegisterOneWayEquivalence(typeB, typeA); } - public void ShareEquivalents(Vector equivalents) => this._equivalents = equivalents; + public void ShareEquivalents(Vector equivalents) => _equivalents = equivalents; - public virtual string ErrorContextDescription => string.Format("{0} (Owner='{1}')", Name, this.Owner.Uri ?? "Unavailable"); + public virtual string ErrorContextDescription => string.Format("{0} (Owner='{1}')", Name, Owner.Uri ?? "Unavailable"); public static string NameFromInstance(object instance) => !(instance is ISchemaInfo schemaInfo) ? instance.GetType().Name : schemaInfo.TypeSchema.Name; - public ulong UniqueId => this._id; + public ulong UniqueId => _id; public static TypeSchema LookupById(ulong id) { diff --git a/UIX/Microsoft/Iris/Markup/UIClassPropertySchema.cs b/UIX/Microsoft/Iris/Markup/UIClassPropertySchema.cs index aed3237..39abc85 100644 --- a/UIX/Microsoft/Iris/Markup/UIClassPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIClassPropertySchema.cs @@ -15,8 +15,8 @@ namespace Microsoft.Iris.Markup { } - public override object GetValue(object instance) => ((Host)instance).GetChildUIProperty(this.Name); + public override object GetValue(object instance) => ((Host)instance).GetChildUIProperty(Name); - public override void SetValue(ref object instance, object value) => ((Host)instance).SetChildUIProperty(this.Name, value); + public override void SetValue(ref object instance, object value) => ((Host)instance).SetChildUIProperty(Name, value); } } diff --git a/UIX/Microsoft/Iris/Markup/UIClassTypeSchema.cs b/UIX/Microsoft/Iris/Markup/UIClassTypeSchema.cs index c43a54e..2be8669 100644 --- a/UIX/Microsoft/Iris/Markup/UIClassTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIClassTypeSchema.cs @@ -46,9 +46,9 @@ namespace Microsoft.Iris.Markup try { uint scriptOffset = uint.MaxValue; - if (this._namedContentTable != null) + if (_namedContentTable != null) { - foreach (NamedContentRecord namedContentRecord in this._namedContentTable) + foreach (NamedContentRecord namedContentRecord in _namedContentTable) { if (namedContentRecord.Name == name) { @@ -59,13 +59,13 @@ namespace Microsoft.Iris.Markup } if (scriptOffset == uint.MaxValue) { - UIClassTypeSchema markupTypeBase = (UIClassTypeSchema)this.MarkupTypeBase; + UIClassTypeSchema markupTypeBase = (UIClassTypeSchema)MarkupTypeBase; if (markupTypeBase != null) return markupTypeBase.ConstructNamedContent(name, markupType, parameterContext); } if (scriptOffset != uint.MaxValue) { - object obj = this.RunAtOffset(markupType, scriptOffset, parameterContext); + object obj = RunAtOffset(markupType, scriptOffset, parameterContext); if (obj != Interpreter.ScriptError) return (ViewItem)obj; ErrorManager.ReportWarning("Script runtime failure: Scripting errors have prevented '{0}' named content from being constructed", name); @@ -83,14 +83,14 @@ namespace Microsoft.Iris.Markup Host ownerHost = instance as Host; UIClass childUi = ownerHost.ChildUI; childUi.DeclareHost(ownerHost); - this.InitializeInstance(ownerHost.ChildUI); + InitializeInstance(ownerHost.ChildUI); if (childUi.RootItem != null) ownerHost.Children.Add(childUi.RootItem); childUi.DeclareOwner(ownerHost); } - public NamedContentRecord[] NamedContentTable => this._namedContentTable; + public NamedContentRecord[] NamedContentTable => _namedContentTable; - public void SetNamedContentTable(NamedContentRecord[] namedContentTable) => this._namedContentTable = namedContentTable; + public void SetNamedContentTable(NamedContentRecord[] namedContentTable) => _namedContentTable = namedContentTable; } } diff --git a/UIX/Microsoft/Iris/Markup/UIX/ViewItemSchema.cs b/UIX/Microsoft/Iris/Markup/UIX/ViewItemSchema.cs index 3af2771..198df30 100644 --- a/UIX/Microsoft/Iris/Markup/UIX/ViewItemSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIX/ViewItemSchema.cs @@ -387,20 +387,20 @@ namespace Microsoft.Iris.Markup.UIX public int Add(object value) { - switch (this._mode) + switch (_mode) { case ListProxyMode.Children: - this._subject.Children.Add((Microsoft.Iris.Library.TreeNode)value); + _subject.Children.Add((Microsoft.Iris.Library.TreeNode)value); break; case ListProxyMode.Animation: if (value != null) { - this._subject.AttachAnimation((IAnimationProvider)value); + _subject.AttachAnimation((IAnimationProvider)value); break; } break; } - this._subject = null; + _subject = null; return 0; } @@ -438,8 +438,8 @@ namespace Microsoft.Iris.Markup.UIX private void SetSubject(ViewItem subject, ViewItemSchema.ListProxyMode mode) { - this._subject = subject; - this._mode = mode; + _subject = subject; + _mode = mode; } private ListProxy() diff --git a/UIX/Microsoft/Iris/Markup/UIXConstructorSchema.cs b/UIX/Microsoft/Iris/Markup/UIXConstructorSchema.cs index 602f05b..bef882f 100644 --- a/UIX/Microsoft/Iris/Markup/UIXConstructorSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIXConstructorSchema.cs @@ -17,12 +17,12 @@ namespace Microsoft.Iris.Markup ConstructHandler construct) : base(UIXTypes.MapIDToType(ownerTypeID)) { - this._parameterTypes = UIXTypes.MapIDsToTypes(parameterTypeIDs); - this._construct = construct; + _parameterTypes = UIXTypes.MapIDsToTypes(parameterTypeIDs); + _construct = construct; } - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; - public override object Construct(object[] parameters) => this._construct(parameters); + public override object Construct(object[] parameters) => _construct(parameters); } } diff --git a/UIX/Microsoft/Iris/Markup/UIXEnumSchema.cs b/UIX/Microsoft/Iris/Markup/UIXEnumSchema.cs index 842e2a6..42ad0a7 100644 --- a/UIX/Microsoft/Iris/Markup/UIXEnumSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIXEnumSchema.cs @@ -15,13 +15,13 @@ namespace Microsoft.Iris.Markup public UIXEnumSchema(short typeID, string name, Type runtimeType, bool isFlags) : base(MarkupSystem.UIXGlobal) { - this._typeID = typeID; - this.Initialize(name, runtimeType, isFlags, null, null); + _typeID = typeID; + Initialize(name, runtimeType, isFlags, null, null); UIXTypes.RegisterTypeForID(typeID, this); } - protected override void InitializeNameToValueMap() => this._nameToValueMap = UIXEnumData.GetDataForType(this._typeID); + protected override void InitializeNameToValueMap() => _nameToValueMap = UIXEnumData.GetDataForType(_typeID); - public override string ToString() => this.Name; + public override string ToString() => Name; } } diff --git a/UIX/Microsoft/Iris/Markup/UIXEventSchema.cs b/UIX/Microsoft/Iris/Markup/UIXEventSchema.cs index 7aa08cd..07b9d5f 100644 --- a/UIX/Microsoft/Iris/Markup/UIXEventSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIXEventSchema.cs @@ -12,8 +12,8 @@ namespace Microsoft.Iris.Markup public UIXEventSchema(short ownerTypeID, string name) : base(UIXTypes.MapIDToType(ownerTypeID)) - => this._name = name; + => _name = name; - public override string Name => this._name; + public override string Name => _name; } } diff --git a/UIX/Microsoft/Iris/Markup/UIXLoadResult.cs b/UIX/Microsoft/Iris/Markup/UIXLoadResult.cs index 6ff811f..47151b4 100644 --- a/UIX/Microsoft/Iris/Markup/UIXLoadResult.cs +++ b/UIX/Microsoft/Iris/Markup/UIXLoadResult.cs @@ -25,16 +25,16 @@ namespace Microsoft.Iris.Markup protected override void OnDispose() { base.OnDispose(); - foreach (DisposableObject disposableObject in this.ExportTable) + foreach (DisposableObject disposableObject in ExportTable) disposableObject.Dispose(this); - this.SetExportTable(null); + SetExportTable(null); } public override TypeSchema FindType(string name) { - for (int index = 0; index < this.ExportTable.Length; ++index) + for (int index = 0; index < ExportTable.Length; ++index) { - TypeSchema typeSchema = this.ExportTable[index]; + TypeSchema typeSchema = ExportTable[index]; if (typeSchema.Name == name || typeSchema.AlternateName == name) return typeSchema; } diff --git a/UIX/Microsoft/Iris/Markup/UIXMethodSchema.cs b/UIX/Microsoft/Iris/Markup/UIXMethodSchema.cs index d5efbba..d73f1fc 100644 --- a/UIX/Microsoft/Iris/Markup/UIXMethodSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIXMethodSchema.cs @@ -23,21 +23,21 @@ namespace Microsoft.Iris.Markup bool isStatic) : base(UIXTypes.MapIDToType(ownerTypeID)) { - this._name = name; - this._parameterTypes = UIXTypes.MapIDsToTypes(parameterTypeIDs); - this._returnType = UIXTypes.MapIDToType(returnTypeID); - this._invoke = invoke; - this._isStatic = isStatic; + _name = name; + _parameterTypes = UIXTypes.MapIDsToTypes(parameterTypeIDs); + _returnType = UIXTypes.MapIDToType(returnTypeID); + _invoke = invoke; + _isStatic = isStatic; } - public override string Name => this._name; + public override string Name => _name; - public override TypeSchema[] ParameterTypes => this._parameterTypes; + public override TypeSchema[] ParameterTypes => _parameterTypes; - public override TypeSchema ReturnType => this._returnType; + public override TypeSchema ReturnType => _returnType; - public override bool IsStatic => this._isStatic; + public override bool IsStatic => _isStatic; - public override object Invoke(object instance, object[] parameters) => this._invoke(instance, parameters); + public override object Invoke(object instance, object[] parameters) => _invoke(instance, parameters); } } diff --git a/UIX/Microsoft/Iris/Markup/UIXPropertySchema.cs b/UIX/Microsoft/Iris/Markup/UIXPropertySchema.cs index fd6fb3c..63855e8 100644 --- a/UIX/Microsoft/Iris/Markup/UIXPropertySchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIXPropertySchema.cs @@ -33,40 +33,40 @@ namespace Microsoft.Iris.Markup bool isStatic) : base(UIXTypes.MapIDToType(ownerTypeID)) { - this._name = name; - this._propertyType = UIXTypes.MapIDToType(typeID); - this._alternateType = UIXTypes.MapIDToType(alternateTypeID); - this._expressionRestriction = expressionRestriction; - this._requiredForCreation = requiredForCreation; - this._rangeValidator = rangeValidator; - this._notifiesOnChange = notifiesOnChange; - this._getValue = getValue; - this._setValue = setValue; - this._isStatic = isStatic; + _name = name; + _propertyType = UIXTypes.MapIDToType(typeID); + _alternateType = UIXTypes.MapIDToType(alternateTypeID); + _expressionRestriction = expressionRestriction; + _requiredForCreation = requiredForCreation; + _rangeValidator = rangeValidator; + _notifiesOnChange = notifiesOnChange; + _getValue = getValue; + _setValue = setValue; + _isStatic = isStatic; } - public override string Name => this._name; + public override string Name => _name; - public override TypeSchema PropertyType => this._propertyType; + public override TypeSchema PropertyType => _propertyType; - public override TypeSchema AlternateType => this._alternateType; + public override TypeSchema AlternateType => _alternateType; - public override bool CanRead => this._getValue != null; + public override bool CanRead => _getValue != null; - public override bool CanWrite => this._setValue != null; + public override bool CanWrite => _setValue != null; - public override bool IsStatic => this._isStatic; + public override bool IsStatic => _isStatic; - public override ExpressionRestriction ExpressionRestriction => this._expressionRestriction; + public override ExpressionRestriction ExpressionRestriction => _expressionRestriction; - public override bool RequiredForCreation => this._requiredForCreation; + public override bool RequiredForCreation => _requiredForCreation; - public override RangeValidator RangeValidator => this._rangeValidator; + public override RangeValidator RangeValidator => _rangeValidator; - public override bool NotifiesOnChange => this._notifiesOnChange; + public override bool NotifiesOnChange => _notifiesOnChange; - public override object GetValue(object instance) => this._getValue(instance); + public override object GetValue(object instance) => _getValue(instance); - public override void SetValue(ref object instance, object value) => this._setValue(ref instance, value); + public override void SetValue(ref object instance, object value) => _setValue(ref instance, value); } } diff --git a/UIX/Microsoft/Iris/Markup/UIXTypeSchema.cs b/UIX/Microsoft/Iris/Markup/UIXTypeSchema.cs index c5e01e2..efcff3a 100644 --- a/UIX/Microsoft/Iris/Markup/UIXTypeSchema.cs +++ b/UIX/Microsoft/Iris/Markup/UIXTypeSchema.cs @@ -41,12 +41,12 @@ namespace Microsoft.Iris.Markup UIXTypeFlags flags) : base(MarkupSystem.UIXGlobal) { - this._typeID = typeID; - this._baseTypeID = baseTypeID; - this._name = name; - this._alternateName = alternateName; - this._instanceType = instanceType; - this._flags = flags; + _typeID = typeID; + _baseTypeID = baseTypeID; + _name = name; + _alternateName = alternateName; + _instanceType = instanceType; + _flags = flags; UIXTypes.RegisterTypeForID(typeID, this); } @@ -72,62 +72,62 @@ namespace Microsoft.Iris.Markup methods = MethodSchema.EmptyList; if (events == null) events = EventSchema.EmptyList; - this._defaultConstructor = defaultConstructor; - this._constructors = constructors; - this._properties = properties; - this._methods = methods; - this._events = events; - this._findCanonicalInstance = findCanonicalInstance; - this._typeConverter = typeConverter; - this._supportsTypeConversion = supportsTypeConversion; - this._encodeBinary = encodeBinary; - this._decodeBinary = decodeBinary; - this._performOperation = performOperation; - this._supportsOperation = supportsOperation; + _defaultConstructor = defaultConstructor; + _constructors = constructors; + _properties = properties; + _methods = methods; + _events = events; + _findCanonicalInstance = findCanonicalInstance; + _typeConverter = typeConverter; + _supportsTypeConversion = supportsTypeConversion; + _encodeBinary = encodeBinary; + _decodeBinary = decodeBinary; + _performOperation = performOperation; + _supportsOperation = supportsOperation; } protected override void OnDispose() { base.OnDispose(); - foreach (DisposableObject constructor in this._constructors) + foreach (DisposableObject constructor in _constructors) constructor.Dispose(this); - foreach (DisposableObject property in this._properties) + foreach (DisposableObject property in _properties) property.Dispose(this); - foreach (DisposableObject method in this._methods) + foreach (DisposableObject method in _methods) method.Dispose(this); - foreach (DisposableObject disposableObject in this._events) + foreach (DisposableObject disposableObject in _events) disposableObject.Dispose(this); } - public override string Name => this._name; + public override string Name => _name; - public override string AlternateName => this._alternateName; + public override string AlternateName => _alternateName; public override TypeSchema Base { get { - if (this._baseTypeID != -1 && this._baseType == null) - this._baseType = UIXTypes.MapIDToType(this._baseTypeID); - return this._baseType; + if (_baseTypeID != -1 && _baseType == null) + _baseType = UIXTypes.MapIDToType(_baseTypeID); + return _baseType; } } public override bool Contractual => false; - public override Type RuntimeType => this._instanceType; + public override Type RuntimeType => _instanceType; - public override bool IsNativeAssignableFrom(object check) => this.RuntimeType.IsAssignableFrom(check.GetType()); + public override bool IsNativeAssignableFrom(object check) => RuntimeType.IsAssignableFrom(check.GetType()); public override bool IsNativeAssignableFrom(TypeSchema checkSchema) => false; - public override bool Disposable => (this._flags & UIXTypeFlags.Disposable) != UIXTypeFlags.None; + public override bool Disposable => (_flags & UIXTypeFlags.Disposable) != UIXTypeFlags.None; - public override bool IsStatic => (this._flags & UIXTypeFlags.Static) != UIXTypeFlags.None; + public override bool IsStatic => (_flags & UIXTypeFlags.Static) != UIXTypeFlags.None; - public override object ConstructDefault() => this._defaultConstructor(); + public override object ConstructDefault() => _defaultConstructor(); - public override bool HasDefaultConstructor => this._defaultConstructor != null; + public override bool HasDefaultConstructor => _defaultConstructor != null; public override bool HasInitializer => false; @@ -137,9 +137,9 @@ namespace Microsoft.Iris.Markup public override ConstructorSchema FindConstructor(TypeSchema[] parameters) { - for (int index1 = 0; index1 < this._constructors.Length; ++index1) + for (int index1 = 0; index1 < _constructors.Length; ++index1) { - ConstructorSchema constructor = this._constructors[index1]; + ConstructorSchema constructor = _constructors[index1]; TypeSchema[] parameterTypes = constructor.ParameterTypes; if (parameters.Length == parameterTypes.Length) { @@ -161,28 +161,28 @@ namespace Microsoft.Iris.Markup public override PropertySchema FindProperty(string name) { - for (int index = 0; index < this._properties.Length; ++index) + for (int index = 0; index < _properties.Length; ++index) { - PropertySchema property = this._properties[index]; + PropertySchema property = _properties[index]; if (name == property.Name) return property; } return null; } - public override ConstructorSchema[] Constructors => this._constructors; + public override ConstructorSchema[] Constructors => _constructors; - public override PropertySchema[] Properties => this._properties; + public override PropertySchema[] Properties => _properties; - public override MethodSchema[] Methods => this._methods; + public override MethodSchema[] Methods => _methods; - public override EventSchema[] Events => this._events; + public override EventSchema[] Events => _events; public override MethodSchema FindMethod(string name, TypeSchema[] parameters) { - for (int index1 = 0; index1 < this._methods.Length; ++index1) + for (int index1 = 0; index1 < _methods.Length; ++index1) { - MethodSchema method = this._methods[index1]; + MethodSchema method = _methods[index1]; if (name == method.Name) { TypeSchema[] parameterTypes = method.ParameterTypes; @@ -207,49 +207,49 @@ namespace Microsoft.Iris.Markup public override EventSchema FindEvent(string name) { - for (int index = 0; index < this._events.Length; ++index) + for (int index = 0; index < _events.Length; ++index) { - EventSchema eventSchema = this._events[index]; + EventSchema eventSchema = _events[index]; if (name == eventSchema.Name) return eventSchema; } return null; } - public override object FindCanonicalInstance(string name) => this._findCanonicalInstance != null ? this._findCanonicalInstance(name) : null; + public override object FindCanonicalInstance(string name) => _findCanonicalInstance != null ? _findCanonicalInstance(name) : null; public override Result TypeConverter( object from, TypeSchema fromType, out object instance) { - return this._typeConverter(from, fromType, out instance); + return _typeConverter(from, fromType, out instance); } - public override bool SupportsTypeConversion(TypeSchema fromType) => this._supportsTypeConversion != null && this._supportsTypeConversion(fromType); + public override bool SupportsTypeConversion(TypeSchema fromType) => _supportsTypeConversion != null && _supportsTypeConversion(fromType); - public override void EncodeBinary(ByteCodeWriter writer, object instance) => this._encodeBinary(writer, instance); + public override void EncodeBinary(ByteCodeWriter writer, object instance) => _encodeBinary(writer, instance); - public override object DecodeBinary(ByteCodeReader reader) => this._decodeBinary(reader); + public override object DecodeBinary(ByteCodeReader reader) => _decodeBinary(reader); - public override bool SupportsBinaryEncoding => this._encodeBinary != null; + public override bool SupportsBinaryEncoding => _encodeBinary != null; public override int FindTypeHint => _typeID; public override object PerformOperation(object left, object right, OperationType op) { object obj = null; - if (this._performOperation != null) - obj = this._performOperation(left, right, op); + if (_performOperation != null) + obj = _performOperation(left, right, op); return obj; } - public override bool SupportsOperation(OperationType op) => this._supportsOperation != null && this._supportsOperation(op); + public override bool SupportsOperation(OperationType op) => _supportsOperation != null && _supportsOperation(op); - public override bool IsNullAssignable => !this._instanceType.IsValueType; + public override bool IsNullAssignable => !_instanceType.IsValueType; - public override bool IsRuntimeImmutable => (this._flags & UIXTypeFlags.Immutable) != UIXTypeFlags.None; + public override bool IsRuntimeImmutable => (_flags & UIXTypeFlags.Immutable) != UIXTypeFlags.None; - public override string ErrorContextDescription => this.Name; + public override string ErrorContextDescription => Name; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/PropertyAttribute.cs b/UIX/Microsoft/Iris/Markup/Validation/PropertyAttribute.cs index dbdf5e2..bba6893 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/PropertyAttribute.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/PropertyAttribute.cs @@ -18,8 +18,8 @@ namespace Microsoft.Iris.Markup.Validation public PropertyAttribute(string name, string value) { - this.Name = name; - this.Value = value; + Name = name; + Value = value; } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/TypeRestriction.cs b/UIX/Microsoft/Iris/Markup/Validation/TypeRestriction.cs index a868d9d..da8353e 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/TypeRestriction.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/TypeRestriction.cs @@ -28,9 +28,9 @@ namespace Microsoft.Iris.Markup.Validation private TypeRestriction(TypeSchema primary, TypeSchema secondary, bool allow) { - this._primary = primary; - this._secondary = secondary; - this._allow = allow; + _primary = primary; + _secondary = secondary; + _allow = allow; } public static void InitializeStatics() @@ -39,21 +39,21 @@ namespace Microsoft.Iris.Markup.Validation NotVoid = new TypeRestriction(VoidSchema.Type, null, false); } - public TypeSchema Primary => this._primary; + public TypeSchema Primary => _primary; - public TypeSchema Secondary => this._secondary; + public TypeSchema Secondary => _secondary; - public bool Check(ValidateObject subject, TypeSchema checkType) => this.Check(subject, "'{0}' cannot be used in this context (expecting types compatible with '{1}')", checkType); + public bool Check(ValidateObject subject, TypeSchema checkType) => Check(subject, "'{0}' cannot be used in this context (expecting types compatible with '{1}')", checkType); public bool Check(ValidateObject subject, string errorMessage, TypeSchema checkType) { bool flag = false; - if (this._primary == null && this._secondary == null || this._primary.IsAssignableFrom(checkType) || this._secondary != null && this._secondary.IsAssignableFrom(checkType)) + if (_primary == null && _secondary == null || _primary.IsAssignableFrom(checkType) || _secondary != null && _secondary.IsAssignableFrom(checkType)) flag = true; - if (flag == this._allow) + if (flag == _allow) return true; string str1 = checkType.Name; - string str2 = this._primary.Name; + string str2 = _primary.Name; if (str1 == str2) { str1 = str1 + " (" + checkType.Owner + ")"; diff --git a/UIX/Microsoft/Iris/Markup/Validation/Validate.cs b/UIX/Microsoft/Iris/Markup/Validation/Validate.cs index c492d39..adddb0a 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/Validate.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/Validate.cs @@ -18,38 +18,38 @@ namespace Microsoft.Iris.Markup.Validation public Validate(SourceMarkupLoader owner, int line, int column) { - this._owner = owner; - this._line = line; - this._column = column; - this._owner.TrackValidateObject(this); + _owner = owner; + _line = line; + _column = column; + _owner.TrackValidateObject(this); } protected Validate() { } - public SourceMarkupLoader Owner => this._owner; + public SourceMarkupLoader Owner => _owner; - public int Line => this._line; + public int Line => _line; - public int Column => this._column; + public int Column => _column; public ValidateMetadata Metadata { get { - if (this._metadata == null) - this._metadata = new ValidateMetadata(); - return this._metadata; + if (_metadata == null) + _metadata = new ValidateMetadata(); + return _metadata; } } - public bool HasErrors => this._hasErrors; + public bool HasErrors => _hasErrors; public void MarkHasErrors() { - this._owner.MarkHasErrors(); - this._hasErrors = true; + _owner.MarkHasErrors(); + _hasErrors = true; } public void ReportError( @@ -59,25 +59,25 @@ namespace Microsoft.Iris.Markup.Validation string param2, string param3) { - this.ReportError(string.Format(error, param0, param1, param2, param3)); + ReportError(string.Format(error, param0, param1, param2, param3)); } - public void ReportError(string error, string param0, string param1, string param2) => this.ReportError(string.Format(error, param0, param1, param2)); + public void ReportError(string error, string param0, string param1, string param2) => ReportError(string.Format(error, param0, param1, param2)); - public void ReportError(string error, string param0, string param1) => this.ReportError(string.Format(error, param0, param1)); + public void ReportError(string error, string param0, string param1) => ReportError(string.Format(error, param0, param1)); - public void ReportError(string error, string param0) => this.ReportError(string.Format(error, param0)); + public void ReportError(string error, string param0) => ReportError(string.Format(error, param0)); public void ReportError(string error) { - this.MarkHasErrors(); - this._owner.ReportError(error, this._line, this._column); + MarkHasErrors(); + _owner.ReportError(error, _line, _column); } public void ReportErrorWithAdjustedPosition(string error, int lineOffset, int columnOffset) { - this.MarkHasErrors(); - this._owner.ReportError(error, this._line + lineOffset, this._column + columnOffset); + MarkHasErrors(); + _owner.ReportError(error, _line + lineOffset, _column + columnOffset); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateAlias.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateAlias.cs index 49d0e21..813bc58 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateAlias.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateAlias.cs @@ -23,44 +23,44 @@ namespace Microsoft.Iris.Markup.Validation public void Validate(LoadPass currentPass) { - if (this._currentValidationPass >= currentPass) + if (_currentValidationPass >= currentPass) return; - this._currentValidationPass = currentPass; - if (this._currentValidationPass == LoadPass.DeclareTypes) + _currentValidationPass = currentPass; + if (_currentValidationPass == LoadPass.DeclareTypes) { - ValidateContext context = new ValidateContext(null, null, this._currentValidationPass); - this.Validate(TypeRestriction.None, context); - this._aliasName = this.GetInlinePropertyValueNoValidate("Name"); - string propertyValueNoValidate = this.GetInlinePropertyValueNoValidate("Type"); + ValidateContext context = new ValidateContext(null, null, _currentValidationPass); + Validate(TypeRestriction.None, context); + _aliasName = GetInlinePropertyValueNoValidate("Name"); + string propertyValueNoValidate = GetInlinePropertyValueNoValidate("Type"); if (propertyValueNoValidate != null) { - this._typeIdentifier = new ValidateTypeIdentifier(this.Owner, propertyValueNoValidate, this.Line, this.Column); - this.Owner.NotifyTypeIdentifierFound(this._typeIdentifier.Prefix, this._typeIdentifier.TypeName); - string typeName = this._typeIdentifier.TypeName; - if (this._aliasName == null) - this._aliasName = typeName; - LoadResult dependency = this.Owner.FindDependency(this._typeIdentifier.Prefix); + _typeIdentifier = new ValidateTypeIdentifier(Owner, propertyValueNoValidate, Line, Column); + Owner.NotifyTypeIdentifierFound(_typeIdentifier.Prefix, _typeIdentifier.TypeName); + string typeName = _typeIdentifier.TypeName; + if (_aliasName == null) + _aliasName = typeName; + LoadResult dependency = Owner.FindDependency(_typeIdentifier.Prefix); if (dependency == null) - this.ReportError("Xmlns prefix '{0}' was not found", this._typeIdentifier.Prefix); - else if (!ValidateContext.IsValidSymbolName(this._aliasName)) + ReportError("Xmlns prefix '{0}' was not found", _typeIdentifier.Prefix); + else if (!ValidateContext.IsValidSymbolName(_aliasName)) { - this.ReportError("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", this._aliasName); + ReportError("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", _aliasName); } else { - if (this.Owner.IsTypeNameTaken(this._aliasName)) - this.ReportError("Type '{0}' was specified more than once", this._aliasName); - this.Owner.RegisterAlias(this._aliasName, dependency, typeName); + if (Owner.IsTypeNameTaken(_aliasName)) + ReportError("Type '{0}' was specified more than once", _aliasName); + Owner.RegisterAlias(_aliasName, dependency, typeName); } } else - this.ReportError("Alias Type property must be provided"); + ReportError("Alias Type property must be provided"); } else { - if (this._currentValidationPass != LoadPass.Full || this.Owner.LoadResultTarget.FindType(this._aliasName) != null) + if (_currentValidationPass != LoadPass.Full || Owner.LoadResultTarget.FindType(_aliasName) != null) return; - this.ReportError("Target type for alias '{0}' could not be found", this._aliasName); + ReportError("Target type for alias '{0}' could not be found", _aliasName); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateClass.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateClass.cs index 74924f3..e5069f7 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateClass.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateClass.cs @@ -42,75 +42,75 @@ namespace Microsoft.Iris.Markup.Validation public void NotifyFoundMethodList(ValidateMethodList methodList) { - if (this._foundMethods != null) - this.ReportError("Methods may only be specified once"); + if (_foundMethods != null) + ReportError("Methods may only be specified once"); else - this._foundMethods = methodList; + _foundMethods = methodList; } public override void NotifyParseComplete() { - this._previewName = this.GetInlinePropertyValueNoValidate("Name"); - string propertyValueNoValidate = this.GetInlinePropertyValueNoValidate("Base"); + _previewName = GetInlinePropertyValueNoValidate("Name"); + string propertyValueNoValidate = GetInlinePropertyValueNoValidate("Base"); if (propertyValueNoValidate != null && propertyValueNoValidate.IndexOf(':') != -1) - this._baseTypeIdentifier = new ValidateTypeIdentifier(this.Owner, propertyValueNoValidate, this.Line, this.Column); - this.Owner.NotifyClassParseComplete(this._previewName); + _baseTypeIdentifier = new ValidateTypeIdentifier(Owner, propertyValueNoValidate, Line, Column); + Owner.NotifyClassParseComplete(_previewName); } public void Validate(LoadPass currentPass) { - if (this._currentValidationPass >= currentPass) + if (_currentValidationPass >= currentPass) return; - this._currentValidationPass = currentPass; - if (this._foundBaseType != null && ((MarkupLoadResult)this._foundBaseType.Owner).IsSource) - ((SourceMarkupLoadResult)this._foundBaseType.Owner).ValidateType(this._foundBaseType, this._currentValidationPass); - ValidateContext context = new ValidateContext(this, this._foundBaseType, this._currentValidationPass); - this.Validate(TypeRestriction.None, context); - int num = this.HasErrors ? 1 : 0; - if (this._currentValidationPass == LoadPass.DeclareTypes) - this.DeclareTypes(context); - else if (this._currentValidationPass == LoadPass.PopulatePublicModel) + _currentValidationPass = currentPass; + if (_foundBaseType != null && ((MarkupLoadResult)_foundBaseType.Owner).IsSource) + ((SourceMarkupLoadResult)_foundBaseType.Owner).ValidateType(_foundBaseType, _currentValidationPass); + ValidateContext context = new ValidateContext(this, _foundBaseType, _currentValidationPass); + Validate(TypeRestriction.None, context); + int num = HasErrors ? 1 : 0; + if (_currentValidationPass == LoadPass.DeclareTypes) + DeclareTypes(context); + else if (_currentValidationPass == LoadPass.PopulatePublicModel) { - this.PopulatePublicModel(context); + PopulatePublicModel(context); } else { - this.FullValidation(context); - this.TransferToTypeExport(context); + FullValidation(context); + TransferToTypeExport(context); } } private void DeclareTypes(ValidateContext context) { - this.RearrangePropertiesForSymbols(); - this._foundScriptsProperty = this.FindProperty("Scripts", true); - if (this.PreviewName == null) - this.ReportError("'Name' property is required and must be provided"); - else if (!ValidateContext.IsValidSymbolName(this.PreviewName)) + RearrangePropertiesForSymbols(); + _foundScriptsProperty = FindProperty("Scripts", true); + if (PreviewName == null) + ReportError("'Name' property is required and must be provided"); + else if (!ValidateContext.IsValidSymbolName(PreviewName)) { - this.ReportError("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", this.PreviewName); + ReportError("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", PreviewName); } else { - if (this.Owner.IsTypeNameTaken(this.PreviewName)) - this.ReportError("Type '{0}' was specified more than once", this.PreviewName); - this._typeExport = MarkupTypeSchema.Build(this.ObjectType, Owner.LoadResultTarget, this.PreviewName); - this._typeExportIndex = this.Owner.RegisterExportedType(this._typeExport); - this._typeExport.LoadData = this; + if (Owner.IsTypeNameTaken(PreviewName)) + ReportError("Type '{0}' was specified more than once", PreviewName); + _typeExport = MarkupTypeSchema.Build(ObjectType, Owner.LoadResultTarget, PreviewName); + _typeExportIndex = Owner.RegisterExportedType(_typeExport); + _typeExport.LoadData = this; } } protected virtual void PopulatePublicModel(ValidateContext context) { - if (this._baseTypeIdentifier != null) + if (_baseTypeIdentifier != null) { - this._baseTypeIdentifier.Validate(); - if (this._baseTypeIdentifier.HasErrors) - this.MarkHasErrors(); - else if (!(this._baseTypeIdentifier.FoundType is MarkupTypeSchema foundType)) + _baseTypeIdentifier.Validate(); + if (_baseTypeIdentifier.HasErrors) + MarkHasErrors(); + else if (!(_baseTypeIdentifier.FoundType is MarkupTypeSchema foundType)) { - this._baseTypeIdentifier.ReportError("Base type must be a markup-defined type"); - this.MarkHasErrors(); + _baseTypeIdentifier.ReportError("Base type must be a markup-defined type"); + MarkHasErrors(); } else { @@ -118,85 +118,85 @@ namespace Microsoft.Iris.Markup.Validation { if (!(foundType is UIClassTypeSchema)) { - this._baseTypeIdentifier.ReportError("Base type must be a markup-defined UI type"); - this.MarkHasErrors(); + _baseTypeIdentifier.ReportError("Base type must be a markup-defined UI type"); + MarkHasErrors(); } } else if (!(foundType is ClassTypeSchema)) { - this._baseTypeIdentifier.ReportError("Base type must be a markup-defined Class type"); - this.MarkHasErrors(); + _baseTypeIdentifier.ReportError("Base type must be a markup-defined Class type"); + MarkHasErrors(); } - if (!this.HasErrors) + if (!HasErrors) { bool flag = false; for (TypeSchema typeSchema = foundType; typeSchema is MarkupTypeSchema; typeSchema = typeSchema.Base) { - if (typeSchema == this._typeExport) + if (typeSchema == _typeExport) { - this._baseTypeIdentifier.ReportError("Circular base class dependency involving '{0}' and '{1}'", this._typeExport.Name, foundType.Name); - this.MarkHasErrors(); + _baseTypeIdentifier.ReportError("Circular base class dependency involving '{0}' and '{1}'", _typeExport.Name, foundType.Name); + MarkHasErrors(); flag = true; break; } } if (!flag) { - this._foundBaseType = foundType; - this._foundBaseTypeIndex = this._baseTypeIdentifier.FoundTypeIndex; + _foundBaseType = foundType; + _foundBaseTypeIndex = _baseTypeIdentifier.FoundTypeIndex; } } } } - ValidateProperty property1 = this.FindProperty("Base", true); + ValidateProperty property1 = FindProperty("Base", true); if (property1 != null) { if (property1.IsFromStringValue) { - if (this._baseTypeIdentifier == null) + if (_baseTypeIdentifier == null) { property1.ReportError("Base must be a type identifier (prefix:Type)"); - this.MarkHasErrors(); + MarkHasErrors(); } } else { property1.ReportError("Property '{0}' does not support expanded value syntax", property1.PropertyName); - this.MarkHasErrors(); + MarkHasErrors(); } } - if (this._typeExport != null) - this._typeExport.SetBaseType(this._foundBaseType); + if (_typeExport != null) + _typeExport.SetBaseType(_foundBaseType); bool flag1 = false; - ValidateProperty property2 = this.FindProperty("Shared", true); + ValidateProperty property2 = FindProperty("Shared", true); if (property2 != null) { property2.Validate(this, context); if (property2.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); else if (property2.IsFromStringValue) { flag1 = (bool)((ValidateFromString)property2.Value).FromStringInstance; if (flag1 && this is ValidateUI) { flag1 = false; - this.ReportError("UI cannot be marked as shared"); + ReportError("UI cannot be marked as shared"); } } else { property2.ReportError("Property '{0}' does not support expanded value syntax", property2.PropertyName); - this.MarkHasErrors(); + MarkHasErrors(); } - if (flag1 && this._typeExport != null) - ((ClassTypeSchema)this._typeExport).MarkShareable(); + if (flag1 && _typeExport != null) + ((ClassTypeSchema)_typeExport).MarkShareable(); } - ValidateProperty property3 = this.FindProperty("Properties"); + ValidateProperty property3 = FindProperty("Properties"); if (property3 != null) { if (property3.Value == null || property3.IsObjectTagValue) { - this._foundPropertiesValidateProperty = property3; + _foundPropertiesValidateProperty = property3; int length1 = 0; for (ValidateObjectTag next = (ValidateObjectTag)property3.Value; next != null; next = next.Next) ++length1; @@ -213,17 +213,17 @@ namespace Microsoft.Iris.Markup.Validation if (!next.HasErrors) { next.ReportError("'Name' property is required and must be provided"); - this.MarkHasErrors(); + MarkHasErrors(); } } - else if (this._typeExport != null) + else if (_typeExport != null) { - MarkupPropertySchema propertyExport = MarkupPropertySchema.Build(this.ObjectType, this._typeExport, propertyValueNoValidate, next.ObjectType); + MarkupPropertySchema propertyExport = MarkupPropertySchema.Build(ObjectType, _typeExport, propertyValueNoValidate, next.ObjectType); properties[length2] = propertyExport; ++length2; next.PropertySchemaExport = propertyExport; propertyExport.SetRequiredForCreation(next.PropertyIsRequiredForCreation); - this.AnnotateProperty(next, context, propertyExport); + AnnotateProperty(next, context, propertyExport); } } } @@ -233,21 +233,21 @@ namespace Microsoft.Iris.Markup.Validation Array.Copy(properties, propertySchemaArray, length2); properties = propertySchemaArray; } - if (this._typeExport != null) - this._typeExport.SetPropertyList(properties); + if (_typeExport != null) + _typeExport.SetPropertyList(properties); } else { property3.ReportError("Property '{0}' values must be in expanded form", property3.PropertyName); - this.MarkHasErrors(); + MarkHasErrors(); } } - if (this._foundMethods == null) + if (_foundMethods == null) return; - this._foundMethods.Validate(this, context); - if (this._foundMethods.FoundMethods == null) + _foundMethods.Validate(this, context); + if (_foundMethods.FoundMethods == null) return; - this._typeExport.SetMethodList(this._foundMethods.FoundMethods); + _typeExport.SetMethodList(_foundMethods.FoundMethods); } protected virtual void AnnotateProperty( @@ -259,11 +259,11 @@ namespace Microsoft.Iris.Markup.Validation protected virtual void FullValidation(ValidateContext context) { - if (this._foundPropertiesValidateProperty != null) - this._foundPropertiesValidateProperty.ShouldSkipDictionaryAddIfContains = true; - if (this._foundBaseType is ClassTypeSchema foundBaseType && foundBaseType.IsShared) - this.ReportError("Base type cannot be a shared Class"); - ValidateProperty property = this.FindProperty("Locals"); + if (_foundPropertiesValidateProperty != null) + _foundPropertiesValidateProperty.ShouldSkipDictionaryAddIfContains = true; + if (_foundBaseType is ClassTypeSchema foundBaseType && foundBaseType.IsShared) + ReportError("Base type cannot be a shared Class"); + ValidateProperty property = FindProperty("Locals"); if (property != null) { if (property.Value == null || property.IsObjectTagValue) @@ -273,45 +273,45 @@ namespace Microsoft.Iris.Markup.Validation if (next.Name == null && !next.HasErrors) { next.ReportError("'Name' property is required and must be provided"); - this.MarkHasErrors(); + MarkHasErrors(); } } } else { property.ReportError("Property '{0}' values must be in expanded form", property.PropertyName); - this.MarkHasErrors(); + MarkHasErrors(); } } - if (this._foundMethods != null) - this._foundMethods.Validate(this, context); - if (this._foundScriptsProperty != null) + if (_foundMethods != null) + _foundMethods.Validate(this, context); + if (_foundScriptsProperty != null) { - this._scripts = new ValidateScripts(this._foundScriptsProperty); - this._scripts.Validate(context); - if (this._scripts.HasErrors) - this.MarkHasErrors(); + _scripts = new ValidateScripts(_foundScriptsProperty); + _scripts.Validate(context); + if (_scripts.HasErrors) + MarkHasErrors(); } - if (this._foundVirtualMethods == null) + if (_foundVirtualMethods == null) return; - MethodSchema[] virtualMethods = new MethodSchema[this._foundVirtualMethods.Count]; + MethodSchema[] virtualMethods = new MethodSchema[_foundVirtualMethods.Count]; for (int index = 0; index < virtualMethods.Length; ++index) - virtualMethods[index] = this._foundVirtualMethods[index]; - this._typeExport.SetVirtualMethodList(virtualMethods); + virtualMethods[index] = _foundVirtualMethods[index]; + _typeExport.SetVirtualMethodList(virtualMethods); } private void TransferToTypeExport(ValidateContext context) { - if (this._typeExport != null) + if (_typeExport != null) { - this._typeExport.SetSymbolReferenceTable(context.SymbolReferenceTable); - this._typeExport.SetInheritableSymbolsTable(context.InheritableSymbolsTable); - this._typeExport.SetListenerCount(context.NotifierCount); + _typeExport.SetSymbolReferenceTable(context.SymbolReferenceTable); + _typeExport.SetInheritableSymbolsTable(context.InheritableSymbolsTable); + _typeExport.SetListenerCount(context.NotifierCount); } - this._triggerList = context.TriggerList; - this._actionList = context.ActionList; + _triggerList = context.TriggerList; + _actionList = context.ActionList; Map map = new Map(); - for (MarkupTypeSchema typeExport = this.TypeExport; typeExport != null; typeExport = typeExport.Base as MarkupTypeSchema) + for (MarkupTypeSchema typeExport = TypeExport; typeExport != null; typeExport = typeExport.Base as MarkupTypeSchema) { if (typeExport.InheritableSymbolsTable != null) { @@ -322,13 +322,13 @@ namespace Microsoft.Iris.Markup.Validation } } } - this._typeExport.SetTotalPropertiesAndLocalsCount(map.Count); + _typeExport.SetTotalPropertiesAndLocalsCount(map.Count); } public virtual void RearrangePropertiesForSymbols() { - this.MovePropertyToFront("Locals"); - this.MovePropertyToFront("Properties"); + MovePropertyToFront("Locals"); + MovePropertyToFront("Properties"); } public override void Validate(TypeRestriction typeRestriction, ValidateContext context) @@ -354,39 +354,39 @@ namespace Microsoft.Iris.Markup.Validation MarkupMethodSchema methodSchema, MarkupMethodSchema baseVirtualMethodSchema) { - if (this._foundVirtualMethods == null) + if (_foundVirtualMethods == null) { - this._foundVirtualMethods = new Vector(); - this._foundVirtualBaseMethods = new Vector(); + _foundVirtualMethods = new Vector(); + _foundVirtualBaseMethods = new Vector(); } - this._foundVirtualMethods.Add(methodSchema); - this._foundVirtualBaseMethods.Add(baseVirtualMethodSchema); + _foundVirtualMethods.Add(methodSchema); + _foundVirtualBaseMethods.Add(baseVirtualMethodSchema); } protected override bool ForceAbstractAsConcrete => true; - public ValidateScripts Scripts => this._scripts; + public ValidateScripts Scripts => _scripts; - internal ValidateProperty FoundScripts => this._foundScriptsProperty; + internal ValidateProperty FoundScripts => _foundScriptsProperty; - public MarkupTypeSchema TypeExport => this._typeExport; + public MarkupTypeSchema TypeExport => _typeExport; - public int TypeExportIndex => this._typeExportIndex; + public int TypeExportIndex => _typeExportIndex; - public Vector TriggerList => this._triggerList; + public Vector TriggerList => _triggerList; - public Vector ActionList => this._actionList; + public Vector ActionList => _actionList; - public ArrayList MethodList => this._foundMethods == null ? null : this._foundMethods.Methods; + public ArrayList MethodList => _foundMethods == null ? null : _foundMethods.Methods; - public string PreviewName => this._previewName; + public string PreviewName => _previewName; - public MarkupTypeSchema FoundBaseType => this._foundBaseType; + public MarkupTypeSchema FoundBaseType => _foundBaseType; - public int FoundBaseTypeIndex => this._foundBaseTypeIndex; + public int FoundBaseTypeIndex => _foundBaseTypeIndex; - public ValidateProperty FoundPropertiesValidateProperty => this._foundPropertiesValidateProperty; + public ValidateProperty FoundPropertiesValidateProperty => _foundPropertiesValidateProperty; - public override string ToString() => this.Name != null ? string.Format("ClassTag : {0}", Name) : "Not validated :" + this._previewName; + public override string ToString() => Name != null ? string.Format("ClassTag : {0}", Name) : "Not validated :" + _previewName; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateCode.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateCode.cs index 364b9a4..b38d571 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateCode.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateCode.cs @@ -29,52 +29,52 @@ namespace Microsoft.Iris.Markup.Validation int offset) : base(owner, line, offset, ObjectSourceType.Code) { - this._statementCompound = statementCompound; - this._embedded = true; + _statementCompound = statementCompound; + _embedded = true; } - public ValidateStatementCompound StatementCompound => this._statementCompound; + public ValidateStatementCompound StatementCompound => _statementCompound; - public bool Embedded => this._embedded; + public bool Embedded => _embedded; - public override TypeSchema ObjectType => this._returnType; + public override TypeSchema ObjectType => _returnType; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this._allowTriggers) + if (_allowTriggers) context.StartDeclaredTriggerTracking(); - this._statementCompound.Validate(this, context); - if (this._allowTriggers) - this._declaredTriggerExpressions = context.StopDeclaredTriggerTracking(); - if (this._statementCompound.HasErrors) - this.MarkHasErrors(); - if (this._returnStatements.Count > 0) + _statementCompound.Validate(this, context); + if (_allowTriggers) + _declaredTriggerExpressions = context.StopDeclaredTriggerTracking(); + if (_statementCompound.HasErrors) + MarkHasErrors(); + if (_returnStatements.Count > 0) { - for (int index = 0; index < this._returnStatements.Count; ++index) + for (int index = 0; index < _returnStatements.Count; ++index) { - ValidateStatementReturn returnStatement = this._returnStatements[index]; + ValidateStatementReturn returnStatement = _returnStatements[index]; if (returnStatement.HasErrors) return; TypeSchema type = VoidSchema.Type; ValidateExpression expression = returnStatement.Expression; if (expression != null) type = expression.ObjectType; - this.ValidateReturnType(type); - if (this.HasErrors) + ValidateReturnType(type); + if (HasErrors) return; } } else - this._returnType = VoidSchema.Type; + _returnType = VoidSchema.Type; string errorMessage = "'{0}' cannot be used in this context (expecting types compatible with '{1}')"; if (typeRestriction.Primary == VoidSchema.Type && typeRestriction.Secondary == null) errorMessage = "Return values are not supported for this code block (currently returning '{0}')"; - else if (this._returnStatements.Count == 0) + else if (_returnStatements.Count == 0) errorMessage = "Code block must have at least one return statement of type '{0}'"; - if (!typeRestriction.Check(this, errorMessage, this._returnType)) + if (!typeRestriction.Check(this, errorMessage, _returnType)) return; ValidateStatementReturn validateStatementReturn = null; - ValidateStatement validateStatement = this._statementCompound.StatementList; + ValidateStatement validateStatement = _statementCompound.StatementList; if (validateStatement != null) { while (validateStatement.Next != null) @@ -85,69 +85,69 @@ namespace Microsoft.Iris.Markup.Validation validateStatementReturn.MarkAsTrailingReturn(); } } - if (this._returnType == VoidSchema.Type || validateStatementReturn != null) + if (_returnType == VoidSchema.Type || validateStatementReturn != null) return; - this.ReportError("Code block must end with a return of type '{0}'", this._returnType.Name); + ReportError("Code block must end with a return of type '{0}'", _returnType.Name); } private void ValidateReturnType(TypeSchema type) { - if (this._returnType == null) + if (_returnType == null) { - this._returnType = type; + _returnType = type; } else { - if (this._returnType == type) + if (_returnType == type) return; - if (type.IsAssignableFrom(this._returnType)) + if (type.IsAssignableFrom(_returnType)) { - this._returnType = type; + _returnType = type; } else { - if (this._returnType.IsAssignableFrom(type)) + if (_returnType.IsAssignableFrom(type)) return; - this.ReportError("Return type cannot be determined due to inconsistant return type statements (mismatched types are: '{0}' and '{1}')", this._returnType.Name, type.Name); + ReportError("Return type cannot be determined due to inconsistant return type statements (mismatched types are: '{0}' and '{1}')", _returnType.Name, type.Name); } } } - public void MarkAsNotEmbedded() => this._embedded = false; + public void MarkAsNotEmbedded() => _embedded = false; - public void DisallowTriggers() => this._allowTriggers = false; + public void DisallowTriggers() => _allowTriggers = false; - public uint EncodeStartOffset => this._encodeStartOffset; + public uint EncodeStartOffset => _encodeStartOffset; - public Vector ReturnStatements => this._returnStatements; + public Vector ReturnStatements => _returnStatements; - public Vector DeclaredTriggerExpressions => this._declaredTriggerExpressions; + public Vector DeclaredTriggerExpressions => _declaredTriggerExpressions; public bool InitialEvaluate { get { - if (this._hasInitialEvaluateStatement) - return this._initialEvaluate; - return !this._hasDeclaredTriggerStatements && !this._finalEvaluate && !this._embedded; + if (_hasInitialEvaluateStatement) + return _initialEvaluate; + return !_hasDeclaredTriggerStatements && !_finalEvaluate && !_embedded; } } - public bool FinalEvaluate => this._finalEvaluate; + public bool FinalEvaluate => _finalEvaluate; - public void TrackReturnStatement(ValidateStatementReturn returnStatement) => this._returnStatements.Add(returnStatement); + public void TrackReturnStatement(ValidateStatementReturn returnStatement) => _returnStatements.Add(returnStatement); - public void TrackEncodingOffset(uint startOffset) => this._encodeStartOffset = startOffset; + public void TrackEncodingOffset(uint startOffset) => _encodeStartOffset = startOffset; public void MarkInitialEvaluate(bool initialEvaluate) { - this._hasInitialEvaluateStatement = true; - this._initialEvaluate = initialEvaluate; + _hasInitialEvaluateStatement = true; + _initialEvaluate = initialEvaluate; } - public void MarkFinalEvaluate(bool finalEvaluate) => this._finalEvaluate = finalEvaluate; + public void MarkFinalEvaluate(bool finalEvaluate) => _finalEvaluate = finalEvaluate; - public void MarkDeclaredTriggerStatements() => this._hasDeclaredTriggerStatements = true; + public void MarkDeclaredTriggerStatements() => _hasDeclaredTriggerStatements = true; public ValidateCode Next { diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateContext.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateContext.cs index 96904d6..81aa61d 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateContext.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateContext.cs @@ -48,10 +48,10 @@ namespace Microsoft.Iris.Markup.Validation public ValidateContext(ValidateClass owner, MarkupTypeSchema baseType, LoadPass currentPass) { - this._owner = owner; - this._currentScope = SymbolOrigin.None; - this._baseType = baseType; - this._currentPass = currentPass; + _owner = owner; + _currentScope = SymbolOrigin.None; + _baseType = baseType; + _currentPass = currentPass; } public static void InitializeStatics() @@ -70,10 +70,10 @@ namespace Microsoft.Iris.Markup.Validation out SymbolOrigin origin, out ExpressionRestriction expressionRestriction) { - return this.ResolveSymbol(name, true, this._resolutionDirective, out origin, out expressionRestriction, out TypeSchema _); + return ResolveSymbol(name, true, _resolutionDirective, out origin, out expressionRestriction, out TypeSchema _); } - public TypeSchema ResolveSymbolNoBaseTypes(string name, out SymbolOrigin origin) => this.ResolveSymbol(name, false, this._resolutionDirective, out origin, out ExpressionRestriction _, out TypeSchema _); + public TypeSchema ResolveSymbolNoBaseTypes(string name, out SymbolOrigin origin) => ResolveSymbol(name, false, _resolutionDirective, out origin, out ExpressionRestriction _, out TypeSchema _); private TypeSchema IsSymbolAlreadyDefined( string name, @@ -81,7 +81,7 @@ namespace Microsoft.Iris.Markup.Validation out ExpressionRestriction expressionRestriction, out TypeSchema baseTypeOrigin) { - return this.ResolveSymbol(name, true, SymbolResolutionDirective.None, out origin, out expressionRestriction, out baseTypeOrigin); + return ResolveSymbol(name, true, SymbolResolutionDirective.None, out origin, out expressionRestriction, out baseTypeOrigin); } private TypeSchema ResolveSymbol( @@ -93,15 +93,15 @@ namespace Microsoft.Iris.Markup.Validation out TypeSchema baseTypeOrigin) { baseTypeOrigin = null; - TypeSchema type = this.ResolveSymbol(this._symbolTable, name, out origin, out expressionRestriction); + TypeSchema type = ResolveSymbol(_symbolTable, name, out origin, out expressionRestriction); if (type == null && searchBaseTypes) { if (resolutionDirective != SymbolResolutionDirective.PropertyResolution) { - for (MarkupTypeSchema markupTypeSchema = this._baseType; markupTypeSchema != null; markupTypeSchema = markupTypeSchema.MarkupTypeBase) + for (MarkupTypeSchema markupTypeSchema = _baseType; markupTypeSchema != null; markupTypeSchema = markupTypeSchema.MarkupTypeBase) { if (markupTypeSchema.InheritableSymbolsTable != null) - type = this.ResolveSymbol(markupTypeSchema.InheritableSymbolsTable, name, out origin, out expressionRestriction); + type = ResolveSymbol(markupTypeSchema.InheritableSymbolsTable, name, out origin, out expressionRestriction); if (type != null) { baseTypeOrigin = markupTypeSchema; @@ -109,7 +109,7 @@ namespace Microsoft.Iris.Markup.Validation } } } - else if (this._baseType != null && this._baseType.FindPropertyDeep(name) is MarkupPropertySchema propertyDeep && propertyDeep.RequiredForCreation) + else if (_baseType != null && _baseType.FindPropertyDeep(name) is MarkupPropertySchema propertyDeep && propertyDeep.RequiredForCreation) { type = propertyDeep.PropertyType; origin = SymbolOrigin.Properties; @@ -117,14 +117,14 @@ namespace Microsoft.Iris.Markup.Validation baseTypeOrigin = propertyDeep.Owner; } } - if (type == null && name == "this" && this._owner.ObjectType == ClassSchema.Type) + if (type == null && name == "this" && _owner.ObjectType == ClassSchema.Type) { type = _owner.TypeExport; origin = SymbolOrigin.Reserved; expressionRestriction = ExpressionRestriction.ReadOnly; } if (type != null) - this._owner.Owner.TrackImportedType(type); + _owner.Owner.TrackImportedType(type); return type; } @@ -146,11 +146,11 @@ namespace Microsoft.Iris.Markup.Validation } } TypeSchema type; - if (this._reservedSymbols != null && this._reservedSymbols.TryGetValue(name, out type)) + if (_reservedSymbols != null && _reservedSymbols.TryGetValue(name, out type)) { origin = SymbolOrigin.Reserved; expressionRestriction = ExpressionRestriction.ReadOnly; - this._owner.Owner.TrackImportedType(type); + _owner.Owner.TrackImportedType(type); return type; } origin = SymbolOrigin.None; @@ -176,11 +176,11 @@ namespace Microsoft.Iris.Markup.Validation } } TypeSchema type; - if (this._reservedSymbols != null && this._reservedSymbols.TryGetValue(name, out type)) + if (_reservedSymbols != null && _reservedSymbols.TryGetValue(name, out type)) { origin = SymbolOrigin.Reserved; expressionRestriction = ExpressionRestriction.ReadOnly; - this._owner.Owner.TrackImportedType(type); + _owner.Owner.TrackImportedType(type); return type; } origin = SymbolOrigin.None; @@ -190,27 +190,27 @@ namespace Microsoft.Iris.Markup.Validation public void DeclareReservedSymbols(Map reservedSymbols) { - if (this._reservedSymbols != null) + if (_reservedSymbols != null) return; - this._reservedSymbols = reservedSymbols; + _reservedSymbols = reservedSymbols; } public void NotifyObjectTagScopeEnter(ValidateObjectTag objectTag) { - if (this._owner == null) + if (_owner == null) return; - this._owner.NotifyDiscoveredObjectTag(objectTag); + _owner.NotifyDiscoveredObjectTag(objectTag); } public Result NotifyObjectTagScopeExit(ValidateObjectTag objectTag) { TypeSchema typeSchema1 = objectTag.ObjectType; - NameUsage activeNameUsage = this.GetActiveNameUsage(); + NameUsage activeNameUsage = GetActiveNameUsage(); string name1 = objectTag.Name; Result result = Result.Success; if (name1 != null && typeSchema1 != ClassSchema.Type && (typeSchema1 != UISchema.Type && typeSchema1 != EffectSchema.Type) && (typeSchema1 != DataTypeSchema.Type && typeSchema1 != DataQuerySchema.Type && (activeNameUsage != NameUsage.DictionaryKeys && activeNameUsage != NameUsage.NamedContent))) { - if (this._currentScope == SymbolOrigin.Techniques && EffectElementSchema.Type.IsAssignableFrom(typeSchema1)) + if (_currentScope == SymbolOrigin.Techniques && EffectElementSchema.Type.IsAssignableFrom(typeSchema1)) { string name2 = typeSchema1.Name; string name3 = name2 + "Instance"; @@ -218,31 +218,31 @@ namespace Microsoft.Iris.Markup.Validation if (typeSchema1 == null) result = Result.Fail(string.Format("Element '{0}' has no properties that can be changed dynamically and therefore cannot be named", name2)); else - this._owner.Owner.TrackImportedType(typeSchema1); + _owner.Owner.TrackImportedType(typeSchema1); } SymbolOrigin origin; TypeSchema baseTypeOrigin; - TypeSchema typeSchema2 = this.IsSymbolAlreadyDefined(name1, out origin, out ExpressionRestriction _, out baseTypeOrigin); + TypeSchema typeSchema2 = IsSymbolAlreadyDefined(name1, out origin, out ExpressionRestriction _, out baseTypeOrigin); if (!result.Failed && typeSchema2 != null) { if (baseTypeOrigin != null) { - if (this._currentScope == SymbolOrigin.Properties && origin == SymbolOrigin.Properties) + if (_currentScope == SymbolOrigin.Properties && origin == SymbolOrigin.Properties) { if (!typeSchema2.IsAssignableFrom(typeSchema1)) result = Result.Fail(string.Format("Property '{0}' exists in base class '{1}' with type '{2}' and type override '{3}' does not match", name1, baseTypeOrigin.Name, typeSchema2.Name, typeSchema1.Name)); else if (objectTag.PropertyOverrideCriteria != null) { - MarkupPropertySchema propertyDeep = (MarkupPropertySchema)this._baseType.FindPropertyDeep(objectTag.Name); + MarkupPropertySchema propertyDeep = (MarkupPropertySchema)_baseType.FindPropertyDeep(objectTag.Name); result = objectTag.PropertyOverrideCriteria.Verify(propertyDeep.OverrideCriteria); } } - else if (this._currentScope != SymbolOrigin.Content || origin != SymbolOrigin.Content) + else if (_currentScope != SymbolOrigin.Content || origin != SymbolOrigin.Content) { - if (this._currentScope == origin) + if (_currentScope == origin) result = Result.Fail("Name \"{0}\" (also defined in base class '{1}') cannot be overridden (tried to override {2}, but can only override Properties and Content)", name1, baseTypeOrigin.Name, origin.ToString()); else - result = Result.Fail(string.Format("Name \"{0}\" (located in {1}) cannot override the same name within base class '{2}' (located in {3}) since overrides cannot cross section types", name1, this._currentScope.ToString(), baseTypeOrigin.Name, origin.ToString())); + result = Result.Fail(string.Format("Name \"{0}\" (located in {1}) cannot override the same name within base class '{2}' (located in {3}) since overrides cannot cross section types", name1, _currentScope.ToString(), baseTypeOrigin.Name, origin.ToString())); } } else if (origin != SymbolOrigin.Reserved) @@ -250,17 +250,17 @@ namespace Microsoft.Iris.Markup.Validation } if (!result.Failed) { - if (this.IsNameReserved(name1)) + if (IsNameReserved(name1)) result = Result.Fail("Name \"{0}\" is reserved and cannot be used.", name1); else if (!IsValidSymbolName(name1)) result = Result.Fail("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", name1); } if (!result.Failed && typeSchema1 != null) - this._symbolTable.Add(new SymbolRecord() + _symbolTable.Add(new SymbolRecord() { Name = name1, Type = typeSchema1, - SymbolOrigin = this._currentScope + SymbolOrigin = _currentScope }); } return result; @@ -272,25 +272,25 @@ namespace Microsoft.Iris.Markup.Validation NameUsage nameUsage; if (foundProperty == ClassPropertiesProperty || foundProperty == UIPropertiesProperty) { - this._currentScope = SymbolOrigin.Properties; + _currentScope = SymbolOrigin.Properties; nameUsage = NameUsage.Symbols; - this._resolutionDirective = SymbolResolutionDirective.PropertyResolution; + _resolutionDirective = SymbolResolutionDirective.PropertyResolution; } else if (foundProperty == ClassLocalsProperty || foundProperty == UILocalsProperty) { - this._currentScope = SymbolOrigin.Locals; + _currentScope = SymbolOrigin.Locals; nameUsage = NameUsage.Symbols; } else if (foundProperty == UIInputProperty) { - this._currentScope = SymbolOrigin.Input; + _currentScope = SymbolOrigin.Input; nameUsage = NameUsage.Symbols; } else if (foundProperty == UIContentProperty) { if (property.PropertyAttributeList == null) { - this._currentScope = SymbolOrigin.Content; + _currentScope = SymbolOrigin.Content; nameUsage = NameUsage.Symbols; } else @@ -298,12 +298,12 @@ namespace Microsoft.Iris.Markup.Validation } else if (foundProperty == EffectTechniquesProperty) { - this._currentScope = SymbolOrigin.Techniques; + _currentScope = SymbolOrigin.Techniques; nameUsage = NameUsage.Symbols; } else nameUsage = !DictionarySchema.Type.IsAssignableFrom(foundProperty.PropertyType) ? NameUsage.Default : NameUsage.DictionaryKeys; - this._propertyScopeStack.Push(new ValidateContext.PropertyScopeRecord() + _propertyScopeStack.Push(new ValidateContext.PropertyScopeRecord() { nameUsage = nameUsage, property = foundProperty @@ -315,30 +315,30 @@ namespace Microsoft.Iris.Markup.Validation PropertySchema foundProperty = property.FoundProperty; if (foundProperty == ClassPropertiesProperty || foundProperty == UIPropertiesProperty) { - this._resolutionDirective = SymbolResolutionDirective.None; - this._currentScope = SymbolOrigin.None; + _resolutionDirective = SymbolResolutionDirective.None; + _currentScope = SymbolOrigin.None; } else if (foundProperty == ClassLocalsProperty || foundProperty == UILocalsProperty) - this._currentScope = SymbolOrigin.None; + _currentScope = SymbolOrigin.None; else if (foundProperty == UIInputProperty) - this._currentScope = SymbolOrigin.None; + _currentScope = SymbolOrigin.None; else if (foundProperty == UIContentProperty && property.PropertyAttributeList == null) - this._currentScope = SymbolOrigin.None; + _currentScope = SymbolOrigin.None; else if (foundProperty == EffectTechniquesProperty) - this._currentScope = SymbolOrigin.None; - this._propertyScopeStack.Pop(); + _currentScope = SymbolOrigin.None; + _propertyScopeStack.Pop(); } public void NotifyMethodScopeEnter(ValidateMethod method) { - this._currentMethod = method; - if (this._methodParameterRecords == null) - this._methodParameterRecords = new Vector(); + _currentMethod = method; + if (_methodParameterRecords == null) + _methodParameterRecords = new Vector(); MarkupMethodSchema methodExport = method.MethodExport; for (int index = 0; index < methodExport.ParameterNames.Length; ++index) { string parameterName = methodExport.ParameterNames[index]; - Result result = this.IsNameInUse(parameterName, false); + Result result = IsNameInUse(parameterName, false); if (result.Failed) { method.ReportError(result.ToString()); @@ -349,26 +349,26 @@ namespace Microsoft.Iris.Markup.Validation symbolRecord.Name = parameterName; symbolRecord.Type = methodExport.ParameterTypes[index]; symbolRecord.SymbolOrigin = SymbolOrigin.Parameter; - this._symbolTable.Add(symbolRecord); - this._methodParameterRecords.Add(symbolRecord); + _symbolTable.Add(symbolRecord); + _methodParameterRecords.Add(symbolRecord); } } } public void NotifyMethodScopeExit(ValidateMethod method) { - foreach (SymbolRecord methodParameterRecord in this._methodParameterRecords) - this._symbolTable.Remove(methodParameterRecord); - this._methodParameterRecords.Clear(); - this._currentMethod = null; + foreach (SymbolRecord methodParameterRecord in _methodParameterRecords) + _symbolTable.Remove(methodParameterRecord); + _methodParameterRecords.Clear(); + _currentMethod = null; } public Result NotifyMethodFound(string name) { - Result result = this.IsNameInUse(name, false); + Result result = IsNameInUse(name, false); if (result.Failed) return result; - this._symbolTable.Add(new SymbolRecord() + _symbolTable.Add(new SymbolRecord() { Name = name, Type = null, @@ -384,7 +384,7 @@ namespace Microsoft.Iris.Markup.Validation if (name == reservedName) return true; } - return this._reservedSymbols != null && this._reservedSymbols.ContainsKey(name); + return _reservedSymbols != null && _reservedSymbols.ContainsKey(name); } public static bool IsValidSymbolName(string name) @@ -407,12 +407,12 @@ namespace Microsoft.Iris.Markup.Validation public Result IsNameInUse(string name, bool bypassReservedNameCheck) { SymbolOrigin origin; - TypeSchema typeSchema = this.ResolveSymbol(name, out origin, out ExpressionRestriction _); + TypeSchema typeSchema = ResolveSymbol(name, out origin, out ExpressionRestriction _); if (typeSchema != null) return Result.Fail("Name \"{0}\" is already in use (type '{1}') located in '{2}'", name, typeSchema.Name, origin.ToString()); if (!bypassReservedNameCheck) { - if (this.IsNameReserved(name)) + if (IsNameReserved(name)) return Result.Fail("Name \"{0}\" is reserved and cannot be used.", name); if (!IsValidSymbolName(name)) return Result.Fail("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", name); @@ -422,16 +422,16 @@ namespace Microsoft.Iris.Markup.Validation public void NotifyScopedLocalFrameEnter(ValidateStatementLoop statementLoop) { - this._scopedLocalFrameStack.Add(null); + _scopedLocalFrameStack.Add(null); if (statementLoop == null) return; - this._loopFramesStack.Push(this._scopedLocalFrameStack.Count); - this._loopStatementStack.Push(statementLoop); + _loopFramesStack.Push(_scopedLocalFrameStack.Count); + _loopStatementStack.Push(statementLoop); } - public void NotifyScopedLocalFrameEnter() => this.NotifyScopedLocalFrameEnter(null); + public void NotifyScopedLocalFrameEnter() => NotifyScopedLocalFrameEnter(null); - public Result NotifyScopedLocal(string name, TypeSchema type) => this.NotifyScopedLocal(name, type, false, SymbolOrigin.ScopedLocal); + public Result NotifyScopedLocal(string name, TypeSchema type) => NotifyScopedLocal(name, type, false, SymbolOrigin.ScopedLocal); public Result NotifyScopedLocal( string name, @@ -439,20 +439,20 @@ namespace Microsoft.Iris.Markup.Validation bool bypassReservedNameCheck, SymbolOrigin symbolOrigin) { - Result result = this.IsNameInUse(name, bypassReservedNameCheck); + Result result = IsNameInUse(name, bypassReservedNameCheck); if (result.Failed) return result; SymbolRecord symbolRecord = new SymbolRecord(); symbolRecord.Name = name; symbolRecord.Type = type; symbolRecord.SymbolOrigin = symbolOrigin; - this._symbolTable.Add(symbolRecord); - Vector vector = this._scopedLocalFrameStack[this._scopedLocalFrameStack.Count - 1]; + _symbolTable.Add(symbolRecord); + Vector vector = _scopedLocalFrameStack[_scopedLocalFrameStack.Count - 1]; if (vector == null) { vector = new Vector(); - this._scopedLocalFrameStack.RemoveAt(this._scopedLocalFrameStack.Count - 1); - this._scopedLocalFrameStack.Add(vector); + _scopedLocalFrameStack.RemoveAt(_scopedLocalFrameStack.Count - 1); + _scopedLocalFrameStack.Add(vector); } vector.Add(symbolRecord); return Result.Success; @@ -460,21 +460,21 @@ namespace Microsoft.Iris.Markup.Validation public Vector NotifyScopedLocalFrameExit() { - if (this._loopFramesStack.Count > 0 && this._scopedLocalFrameStack.Count == this._loopFramesStack.Peek()) + if (_loopFramesStack.Count > 0 && _scopedLocalFrameStack.Count == _loopFramesStack.Peek()) { - this._loopFramesStack.Pop(); - this._loopStatementStack.Pop(); + _loopFramesStack.Pop(); + _loopStatementStack.Pop(); } - Vector scopedLocalFrame = this._scopedLocalFrameStack[this._scopedLocalFrameStack.Count - 1]; - this._scopedLocalFrameStack.RemoveAt(this._scopedLocalFrameStack.Count - 1); + Vector scopedLocalFrame = _scopedLocalFrameStack[_scopedLocalFrameStack.Count - 1]; + _scopedLocalFrameStack.RemoveAt(_scopedLocalFrameStack.Count - 1); Vector vector = null; if (scopedLocalFrame != null) { vector = new Vector(); foreach (SymbolRecord symbolRecord in scopedLocalFrame) { - this._symbolTable.Remove(symbolRecord); - int num = this.TrackSymbolUsage(symbolRecord.Name, symbolRecord.SymbolOrigin); + _symbolTable.Remove(symbolRecord); + int num = TrackSymbolUsage(symbolRecord.Name, symbolRecord.SymbolOrigin); if (symbolRecord.SymbolOrigin == SymbolOrigin.ScopedLocal) vector.Add(num); } @@ -485,17 +485,17 @@ namespace Microsoft.Iris.Markup.Validation private Vector GetImmediateFrameUnwindList(SourceMarkupLoader owner, bool stopAtLoop) { Vector vector = null; - int num1 = stopAtLoop ? this._loopFramesStack.Peek() : 0; - for (int index = this._scopedLocalFrameStack.Count - 1; index >= num1; --index) + int num1 = stopAtLoop ? _loopFramesStack.Peek() : 0; + for (int index = _scopedLocalFrameStack.Count - 1; index >= num1; --index) { - Vector scopedLocalFrame = this._scopedLocalFrameStack[index]; + Vector scopedLocalFrame = _scopedLocalFrameStack[index]; if (scopedLocalFrame != null) { if (vector == null) vector = new Vector(); foreach (SymbolRecord symbolRecord in scopedLocalFrame) { - int num2 = this.TrackSymbolUsage(symbolRecord.Name, symbolRecord.SymbolOrigin); + int num2 = TrackSymbolUsage(symbolRecord.Name, symbolRecord.SymbolOrigin); if (symbolRecord.SymbolOrigin == SymbolOrigin.ScopedLocal) vector.Add(num2); } @@ -504,31 +504,31 @@ namespace Microsoft.Iris.Markup.Validation return vector == null || vector.Count <= 0 ? null : vector; } - public Vector GetImmediateFrameUnwindList(SourceMarkupLoader owner) => this.GetImmediateFrameUnwindList(owner, false); + public Vector GetImmediateFrameUnwindList(SourceMarkupLoader owner) => GetImmediateFrameUnwindList(owner, false); - public Vector GetLoopUnwindList(SourceMarkupLoader owner) => this.GetImmediateFrameUnwindList(owner, true); + public Vector GetLoopUnwindList(SourceMarkupLoader owner) => GetImmediateFrameUnwindList(owner, true); - public ValidateStatementLoop EnclosingLoop => this._loopStatementStack.Count <= 0 ? null : this._loopStatementStack.Peek(); + public ValidateStatementLoop EnclosingLoop => _loopStatementStack.Count <= 0 ? null : _loopStatementStack.Peek(); public int TrackSymbolUsage(string symbol, SymbolOrigin origin) { - for (int index = 0; index < this._usedSymbols.Count; ++index) + for (int index = 0; index < _usedSymbols.Count; ++index) { - SymbolReference usedSymbol = this._usedSymbols[index]; + SymbolReference usedSymbol = _usedSymbols[index]; if (usedSymbol.Symbol == symbol && usedSymbol.Origin == origin) return index; } - this._usedSymbols.Add(new SymbolReference(symbol, origin)); - return this._usedSymbols.Count - 1; + _usedSymbols.Add(new SymbolReference(symbol, origin)); + return _usedSymbols.Count - 1; } public SymbolReference[] SymbolReferenceTable { get { - SymbolReference[] symbolReferenceArray = new SymbolReference[this._usedSymbols.Count]; - for (int index = 0; index < this._usedSymbols.Count; ++index) - symbolReferenceArray[index] = this._usedSymbols[index]; + SymbolReference[] symbolReferenceArray = new SymbolReference[_usedSymbols.Count]; + for (int index = 0; index < _usedSymbols.Count; ++index) + symbolReferenceArray[index] = _usedSymbols[index]; return symbolReferenceArray; } } @@ -537,70 +537,70 @@ namespace Microsoft.Iris.Markup.Validation { get { - SymbolRecord[] symbolRecordArray = new SymbolRecord[this._symbolTable.Count]; - for (int index = 0; index < this._symbolTable.Count; ++index) - symbolRecordArray[index] = this._symbolTable[index]; + SymbolRecord[] symbolRecordArray = new SymbolRecord[_symbolTable.Count]; + for (int index = 0; index < _symbolTable.Count; ++index) + symbolRecordArray[index] = _symbolTable[index]; return symbolRecordArray; } } - public void StartDeclaredTriggerTracking() => this._declaredTriggerTrackingList = new Vector(); + public void StartDeclaredTriggerTracking() => _declaredTriggerTrackingList = new Vector(); - public void TrackDeclaredTrigger(ValidateExpression expression) => this._declaredTriggerTrackingList.Add(expression); + public void TrackDeclaredTrigger(ValidateExpression expression) => _declaredTriggerTrackingList.Add(expression); - public bool IsTrackingDeclaredTriggers => this._declaredTriggerTrackingList != null; + public bool IsTrackingDeclaredTriggers => _declaredTriggerTrackingList != null; public Vector StopDeclaredTriggerTracking() { - Vector triggerTrackingList = this._declaredTriggerTrackingList; - this._declaredTriggerTrackingList = null; + Vector triggerTrackingList = _declaredTriggerTrackingList; + _declaredTriggerTrackingList = null; return triggerTrackingList; } - public void StartNotifierTracking(ValidateExpression root) => this._notifierTrackingRoot = root; + public void StartNotifierTracking(ValidateExpression root) => _notifierTrackingRoot = root; - public bool IsNotifierTracking => this._notifierTrackingRoot != null; + public bool IsNotifierTracking => _notifierTrackingRoot != null; - public int TrackDeclareNotifies(ValidateExpression expression) => this.IsNotifierTracking ? (int)this._notifierCount++ : -1; + public int TrackDeclareNotifies(ValidateExpression expression) => IsNotifierTracking ? (int)_notifierCount++ : -1; public bool StopNotifierTracking() { bool flag; - if (this._notifierTrackingRoot.NotifyIndex != -1) + if (_notifierTrackingRoot.NotifyIndex != -1) { - this._notifierTrackingRoot.MarkNotifierRoot(); + _notifierTrackingRoot.MarkNotifierRoot(); flag = true; } else flag = false; - this._notifierTrackingRoot = null; + _notifierTrackingRoot = null; return flag; } - public uint NotifierCount => this._notifierCount; + public uint NotifierCount => _notifierCount; - public void RegisterAction(ValidateCode actionCode) => this._actionList.Add(actionCode); + public void RegisterAction(ValidateCode actionCode) => _actionList.Add(actionCode); - public void RegisterTrigger(ValidateExpression sourceExpression, ValidateCode actionCode) => this._triggerList.Add(new TriggerRecord() + public void RegisterTrigger(ValidateExpression sourceExpression, ValidateCode actionCode) => _triggerList.Add(new TriggerRecord() { SourceExpression = sourceExpression, ActionCode = actionCode }); - public Vector TriggerList => this._triggerList; + public Vector TriggerList => _triggerList; - public PropertySchema GetActivePropertyScope() => this._propertyScopeStack.Count == 0 ? null : this._propertyScopeStack.Peek().property; + public PropertySchema GetActivePropertyScope() => _propertyScopeStack.Count == 0 ? null : _propertyScopeStack.Peek().property; public NameUsage GetActiveNameUsage() { NameUsage nameUsage = NameUsage.Default; - if (this._propertyScopeStack.Count == 0) + if (_propertyScopeStack.Count == 0) { nameUsage = NameUsage.Unknown; } else { - foreach (ValidateContext.PropertyScopeRecord propertyScope in this._propertyScopeStack) + foreach (ValidateContext.PropertyScopeRecord propertyScope in _propertyScopeStack) { nameUsage = propertyScope.nameUsage; if (nameUsage != NameUsage.Default) @@ -610,15 +610,15 @@ namespace Microsoft.Iris.Markup.Validation return nameUsage; } - public SymbolOrigin ActiveSymbolScope => this._currentScope; + public SymbolOrigin ActiveSymbolScope => _currentScope; - public Vector ActionList => this._actionList; + public Vector ActionList => _actionList; - public LoadPass CurrentPass => this._currentPass; + public LoadPass CurrentPass => _currentPass; - public ValidateClass Owner => this._owner; + public ValidateClass Owner => _owner; - public ValidateMethod CurrentMethod => this._currentMethod; + public ValidateMethod CurrentMethod => _currentMethod; internal struct PropertyScopeRecord { diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateDataMapping.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateDataMapping.cs index cbf71b3..66b625d 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateDataMapping.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateDataMapping.cs @@ -28,23 +28,23 @@ namespace Microsoft.Iris.Markup.Validation public void Validate(LoadPass currentPass) { - if (this._currentValidationPass >= currentPass) + if (_currentValidationPass >= currentPass) return; - this._currentValidationPass = currentPass; - ValidateContext context = new ValidateContext(null, null, this._currentValidationPass); - this.Validate(TypeRestriction.None, context); - if (this._currentValidationPass != LoadPass.Full) + _currentValidationPass = currentPass; + ValidateContext context = new ValidateContext(null, null, _currentValidationPass); + Validate(TypeRestriction.None, context); + if (_currentValidationPass != LoadPass.Full) return; var markupDataTypeSchema = (MarkupDataTypeSchema)null; - TypeSchema typeSchemaProperty = this.ExtractTypeSchemaProperty("TargetType", context, true); + TypeSchema typeSchemaProperty = ExtractTypeSchemaProperty("TargetType", context, true); switch (typeSchemaProperty) { case null: case MarkupDataTypeSchema _: markupDataTypeSchema = (MarkupDataTypeSchema)typeSchemaProperty; - string stringProperty1 = this.ExtractStringProperty("Provider", true); + string stringProperty1 = ExtractStringProperty("Provider", true); MarkupDataMappingEntry[] mappingEntries = null; - ValidateProperty property = this.FindProperty("Mappings"); + ValidateProperty property = FindProperty("Mappings"); if (property != null && property.IsObjectTagValue) { Map entries = new Map(); @@ -67,22 +67,22 @@ namespace Microsoft.Iris.Markup.Validation if (!entries.ContainsKey(stringProperty2)) entries[stringProperty2] = dataMappingEntry; else - this.ReportError("Mapping for property '{0}' was already specified", stringProperty2); + ReportError("Mapping for property '{0}' was already specified", stringProperty2); } else - this.ReportError("Could not find property '{0}' on type '{1}' for data mapping with provider '{2}'", stringProperty2, markupDataTypeSchema.Name, stringProperty1); + ReportError("Could not find property '{0}' on type '{1}' for data mapping with provider '{2}'", stringProperty2, markupDataTypeSchema.Name, stringProperty1); } } mappingEntries = MarkupDataProvider.FillInDefaultMappings(markupDataTypeSchema, entries); foreach (MarkupDataMappingEntry dataMappingEntry in mappingEntries) - this.Owner.TrackImportedProperty(dataMappingEntry.Property); + Owner.TrackImportedProperty(dataMappingEntry.Property); } if (stringProperty1 == null || markupDataTypeSchema == null) break; - AddDataMappingProviderList(ref this._foundDataMappingSet, Owner.LoadResultTarget, this.Name, markupDataTypeSchema, stringProperty1, mappingEntries); + AddDataMappingProviderList(ref _foundDataMappingSet, Owner.LoadResultTarget, Name, markupDataTypeSchema, stringProperty1, mappingEntries); break; default: - this.ReportError("TargetType for DataMapping must be a markup-defined DataType, {0} is not valid", typeSchemaProperty.Name); + ReportError("TargetType for DataMapping must be a markup-defined DataType, {0} is not valid", typeSchemaProperty.Name); goto case null; } } @@ -152,15 +152,15 @@ namespace Microsoft.Iris.Markup.Validation public override void NotifyParseComplete() { - this._previewName = this.GetInlinePropertyValueNoValidate("Name"); - string propertyValueNoValidate = this.GetInlinePropertyValueNoValidate("Base"); + _previewName = GetInlinePropertyValueNoValidate("Name"); + string propertyValueNoValidate = GetInlinePropertyValueNoValidate("Base"); if (propertyValueNoValidate != null && propertyValueNoValidate.IndexOf(':') != -1) - this._baseTypeIdentifier = new ValidateTypeIdentifier(this.Owner, propertyValueNoValidate, this.Line, this.Column); - this.Owner.NotifyClassParseComplete(this._previewName); + _baseTypeIdentifier = new ValidateTypeIdentifier(Owner, propertyValueNoValidate, Line, Column); + Owner.NotifyClassParseComplete(_previewName); } protected override bool ForceAbstractAsConcrete => true; - public Vector FoundDataMappingSet => this._foundDataMappingSet; + public Vector FoundDataMappingSet => _foundDataMappingSet; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateDataQuery.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateDataQuery.cs index 73aa291..d34ec83 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateDataQuery.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateDataQuery.cs @@ -22,10 +22,10 @@ namespace Microsoft.Iris.Markup.Validation protected override void PopulatePublicModel(ValidateContext context) { base.PopulatePublicModel(context); - if (this._typeExport == null) + if (_typeExport == null) return; - ((MarkupDataQuerySchema)this._typeExport).ProviderName = this.ExtractStringProperty("Provider", true); - ((MarkupDataQuerySchema)this._typeExport).ResultType = this.ExtractTypeSchemaProperty("ResultType", context, true); + ((MarkupDataQuerySchema)_typeExport).ProviderName = ExtractStringProperty("Provider", true); + ((MarkupDataQuerySchema)_typeExport).ResultType = ExtractTypeSchemaProperty("ResultType", context, true); } protected override void AnnotateProperty( @@ -47,7 +47,7 @@ namespace Microsoft.Iris.Markup.Validation } if (!objectTag.HasErrors) return; - this.MarkHasErrors(); + MarkHasErrors(); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateDataType.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateDataType.cs index 46eba69..e591e9e 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateDataType.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateDataType.cs @@ -26,7 +26,7 @@ namespace Microsoft.Iris.Markup.Validation protected override void PopulatePublicModel(ValidateContext context) { base.PopulatePublicModel(context); - this._provider = this.ExtractStringProperty("Provider", false); + _provider = ExtractStringProperty("Provider", false); } protected override void AnnotateProperty( @@ -45,9 +45,9 @@ namespace Microsoft.Iris.Markup.Validation string stringProperty3 = objectTag.ExtractStringProperty("Target", false); if (stringProperty1 != null || stringProperty2 != null || stringProperty3 != null) { - if (this._foundInlineMappings == null) - this._foundInlineMappings = new Map(); - this._foundInlineMappings[propertyExport.Name] = new MarkupDataMappingEntry() + if (_foundInlineMappings == null) + _foundInlineMappings = new Map(); + _foundInlineMappings[propertyExport.Name] = new MarkupDataMappingEntry() { DefaultValue = ValidateDataMapping.ConvertDefaultValue(this, propertyExport.PropertyType, stringProperty1), Source = stringProperty2, @@ -57,25 +57,25 @@ namespace Microsoft.Iris.Markup.Validation } if (!objectTag.HasErrors) return; - this.MarkHasErrors(); + MarkHasErrors(); } protected override void FullValidation(ValidateContext context) { base.FullValidation(context); - if (this._foundInlineMappings != null && this._provider == null) - this.ReportError("Inline mappings are allowed only on provider-specific types. Must specify 'Provider' attribute on '{0}'", this.Name); - if (this._provider == null) + if (_foundInlineMappings != null && _provider == null) + ReportError("Inline mappings are allowed only on provider-specific types. Must specify 'Provider' attribute on '{0}'", Name); + if (_provider == null) return; - if (this._foundInlineMappings == null) - this._foundInlineMappings = new Map(); - MarkupDataTypeSchema typeExport = (MarkupDataTypeSchema)this.TypeExport; - MarkupDataMappingEntry[] mappingEntries = MarkupDataProvider.FillInDefaultMappings(typeExport, this._foundInlineMappings); - ValidateDataMapping.AddDataMappingProviderList(ref this._foundDataMappingSet, Owner.LoadResultTarget, null, typeExport, this._provider, mappingEntries); + if (_foundInlineMappings == null) + _foundInlineMappings = new Map(); + MarkupDataTypeSchema typeExport = (MarkupDataTypeSchema)TypeExport; + MarkupDataMappingEntry[] mappingEntries = MarkupDataProvider.FillInDefaultMappings(typeExport, _foundInlineMappings); + ValidateDataMapping.AddDataMappingProviderList(ref _foundDataMappingSet, Owner.LoadResultTarget, null, typeExport, _provider, mappingEntries); foreach (MarkupDataMappingEntry dataMappingEntry in mappingEntries) - this.Owner.TrackImportedProperty(dataMappingEntry.Property); + Owner.TrackImportedProperty(dataMappingEntry.Property); } - public Vector FoundDataMappingSet => this._foundDataMappingSet; + public Vector FoundDataMappingSet => _foundDataMappingSet; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateEffect.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateEffect.cs index 78f2d33..5ecf8ce 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateEffect.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateEffect.cs @@ -29,53 +29,53 @@ namespace Microsoft.Iris.Markup.Validation public override void RearrangePropertiesForSymbols() { - this.MovePropertyToFront("Techniques"); + MovePropertyToFront("Techniques"); base.RearrangePropertiesForSymbols(); } protected override void FullValidation(ValidateContext context) { base.FullValidation(context); - this._foundTechniquesValidateProperty = this.FindProperty("Techniques"); - if (this._foundTechniquesValidateProperty != null && this.FoundBaseType != null) + _foundTechniquesValidateProperty = FindProperty("Techniques"); + if (_foundTechniquesValidateProperty != null && FoundBaseType != null) { - foreach (SymbolRecord symbolRecord in this.FoundBaseType.InheritableSymbolsTable) + foreach (SymbolRecord symbolRecord in FoundBaseType.InheritableSymbolsTable) { if (symbolRecord.SymbolOrigin == SymbolOrigin.Techniques) { - this._foundTechniquesValidateProperty.ReportError("Overriding Techniques property is not allowed; base class has already defined techniques"); - this.MarkHasErrors(); + _foundTechniquesValidateProperty.ReportError("Overriding Techniques property is not allowed; base class has already defined techniques"); + MarkHasErrors(); break; } } } - if (this._foundDynamicElementAssignments != null) + if (_foundDynamicElementAssignments != null) { - string[] dynamicElementAssignments = new string[this._foundDynamicElementAssignments.Count]; + string[] dynamicElementAssignments = new string[_foundDynamicElementAssignments.Count]; int num = 0; - foreach (string key in this._foundDynamicElementAssignments.Keys) + foreach (string key in _foundDynamicElementAssignments.Keys) dynamicElementAssignments[num++] = key; - ((EffectClassTypeSchema)this.TypeExport).SetDynamicElementAssignments(dynamicElementAssignments); + ((EffectClassTypeSchema)TypeExport).SetDynamicElementAssignments(dynamicElementAssignments); } string str = "DefaultImage"; SymbolOrigin origin; TypeSchema checkSchema = context.ResolveSymbol(str, out origin, out ExpressionRestriction _); if (checkSchema == null || !ImageElementInstanceSchema.Type.IsAssignableFrom(checkSchema) || origin != SymbolOrigin.Techniques) return; - ((EffectClassTypeSchema)this.TypeExport).SetDefaultElementSymbolIndex(context.TrackSymbolUsage(str, origin)); + ((EffectClassTypeSchema)TypeExport).SetDefaultElementSymbolIndex(context.TrackSymbolUsage(str, origin)); } public override void NotifyFoundPropertyAssignment(ValidateExpressionCall call) { - string effectElementName = this.GetEffectElementName(call); + string effectElementName = GetEffectElementName(call); if (effectElementName == null) return; - this.TrackDynamicElementAssignment(effectElementName, call.MemberName); + TrackDynamicElementAssignment(effectElementName, call.MemberName); } public override void NotifyFoundMethodCall(ValidateExpressionCall call) { - string effectElementName = this.GetEffectElementName(call); + string effectElementName = GetEffectElementName(call); if (effectElementName == null) return; if (s_methodNameMapping == null) @@ -110,7 +110,7 @@ namespace Microsoft.Iris.Markup.Validation int num; if (!s_methodNameMapping.TryGetValue(call.MemberName, out num)) return; - this.TrackDynamicElementAssignment(effectElementName, (EffectProperty)num); + TrackDynamicElementAssignment(effectElementName, (EffectProperty)num); } private string GetEffectElementName(ValidateExpressionCall call) @@ -119,15 +119,15 @@ namespace Microsoft.Iris.Markup.Validation return EffectElementInstanceSchema.Type.IsAssignableFrom(target.ObjectType) && target.ExpressionType == ExpressionType.Symbol ? ((ValidateExpressionSymbol)target).Symbol : null; } - private void TrackDynamicElementAssignment(string elementName, string propertyName) => this.TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, propertyName)); + private void TrackDynamicElementAssignment(string elementName, string propertyName) => TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, propertyName)); - private void TrackDynamicElementAssignment(string elementName, EffectProperty property) => this.TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, property)); + private void TrackDynamicElementAssignment(string elementName, EffectProperty property) => TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, property)); private void TrackDynamicElementAssignment(string dynamicPropertyName) { - if (this._foundDynamicElementAssignments == null) - this._foundDynamicElementAssignments = new Dictionary(); - this._foundDynamicElementAssignments[dynamicPropertyName] = null; + if (_foundDynamicElementAssignments == null) + _foundDynamicElementAssignments = new Dictionary(); + _foundDynamicElementAssignments[dynamicPropertyName] = null; } public void TrackInstanceProperty( @@ -135,43 +135,43 @@ namespace Microsoft.Iris.Markup.Validation string name, ValidateProperty property) { - if (this._foundInstancePropertyAssignments == null) + if (_foundInstancePropertyAssignments == null) { - this._foundInstancePropertyAssignments = new Map(); - this._foundElementSymbolIndex = new Map(); + _foundInstancePropertyAssignments = new Map(); + _foundElementSymbolIndex = new Map(); } ValidateProperty validateProperty; - this._foundInstancePropertyAssignments.TryGetValue(name, out validateProperty); + _foundInstancePropertyAssignments.TryGetValue(name, out validateProperty); property.AppendToEnd(validateProperty); - this._foundInstancePropertyAssignments[name] = property; + _foundInstancePropertyAssignments[name] = property; SymbolOrigin origin; TypeSchema typeSchema = context.ResolveSymbol(name, out origin, out ExpressionRestriction _); if (typeSchema == null) { property.ReportError("Element '{0}' property '{1}' is being assigned a value which requires it to be set dynamically, but the property cannot be changed dynamically", property.FoundProperty.Owner.ToString(), property.FoundProperty.Name); - this.MarkHasErrors(); + MarkHasErrors(); } else { - this._foundElementSymbolIndex[name] = context.TrackSymbolUsage(name, origin); + _foundElementSymbolIndex[name] = context.TrackSymbolUsage(name, origin); PropertySchema property1 = typeSchema.FindProperty(property.FoundProperty.Name); if (property1 == null) { property.ReportError("Element '{0}' property '{1}' is being assigned a value which requires it to be set dynamically, but the property cannot be changed dynamically", property.FoundProperty.Owner.ToString(), property.FoundProperty.Name); - this.MarkHasErrors(); + MarkHasErrors(); } else { property.UpdateFoundProperty(property1); - this.TrackDynamicElementAssignment(name, property.FoundProperty.Name); + TrackDynamicElementAssignment(name, property.FoundProperty.Name); } } } - public int GetElementSymbolIndex(string name) => this._foundElementSymbolIndex[name]; + public int GetElementSymbolIndex(string name) => _foundElementSymbolIndex[name]; - public ValidateProperty FoundTechniquesValidateProperty => this._foundTechniquesValidateProperty; + public ValidateProperty FoundTechniquesValidateProperty => _foundTechniquesValidateProperty; - public Map FoundInstancePropertyAssignments => this._foundInstancePropertyAssignments; + public Map FoundInstancePropertyAssignments => _foundInstancePropertyAssignments; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateEffectElement.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateEffectElement.cs index cea35d7..d444065 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateEffectElement.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateEffectElement.cs @@ -24,15 +24,15 @@ namespace Microsoft.Iris.Markup.Validation base.Validate(typeRestriction, context); if (context.CurrentPass != LoadPass.Full || !(context.Owner is ValidateEffect owner)) return; - ValidateProperty validateProperty1 = this.PropertyList; + ValidateProperty validateProperty1 = PropertyList; while (validateProperty1 != null) { ValidateProperty validateProperty2 = validateProperty1; validateProperty1 = validateProperty1.Next; if (!validateProperty2.HasErrors && !validateProperty2.IsFromStringValue && !EffectElementSchema.Type.IsAssignableFrom(validateProperty2.FoundProperty.PropertyType) && (!ListSchema.Type.IsAssignableFrom(validateProperty2.FoundProperty.PropertyType) || !EffectElementSchema.Type.IsAssignableFrom(validateProperty2.FoundProperty.AlternateType))) { - this.RemoveProperty(validateProperty2); - owner.TrackInstanceProperty(context, this.Name, validateProperty2); + RemoveProperty(validateProperty2); + owner.TrackInstanceProperty(context, Name, validateProperty2); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpression.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpression.cs index ec5cd81..c39ba81 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpression.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpression.cs @@ -22,37 +22,37 @@ namespace Microsoft.Iris.Markup.Validation ExpressionType expressionType) : base(owner, line, column, ObjectSourceType.Expression) { - this._expressionType = expressionType; - this._usage = ExpressionUsage.RValue; + _expressionType = expressionType; + _usage = ExpressionUsage.RValue; } - public override TypeSchema ObjectType => this._evaluationType; + public override TypeSchema ObjectType => _evaluationType; - public ExpressionType ExpressionType => this._expressionType; + public ExpressionType ExpressionType => _expressionType; - public void MakeLValueUsage() => this._usage = ExpressionUsage.LValue; + public void MakeLValueUsage() => _usage = ExpressionUsage.LValue; - public void MakeDeclareTriggerUsage() => this._usage = ExpressionUsage.DeclareTrigger; + public void MakeDeclareTriggerUsage() => _usage = ExpressionUsage.DeclareTrigger; - public uint EncodeStartOffset => this._encodeStartOffset; + public uint EncodeStartOffset => _encodeStartOffset; protected void DeclareEvaluationType(TypeSchema evaluationType, TypeRestriction typeRestriction) { if (!typeRestriction.Check(this, evaluationType)) return; - this._evaluationType = evaluationType; + _evaluationType = evaluationType; } - public ExpressionUsage Usage => this._usage; + public ExpressionUsage Usage => _usage; - protected void DeclareNotifies(ValidateContext context) => this._notifyIndex = context.TrackDeclareNotifies(this); + protected void DeclareNotifies(ValidateContext context) => _notifyIndex = context.TrackDeclareNotifies(this); - public int NotifyIndex => this._notifyIndex; + public int NotifyIndex => _notifyIndex; - public bool IsNotifierRoot => this._isNotifierRoot; + public bool IsNotifierRoot => _isNotifierRoot; - public void MarkNotifierRoot() => this._isNotifierRoot = true; + public void MarkNotifierRoot() => _isNotifierRoot = true; - public void TrackEncodingOffset(uint startOffset) => this._encodeStartOffset = startOffset; + public void TrackEncodingOffset(uint startOffset) => _encodeStartOffset = startOffset; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAs.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAs.cs index 35876aa..6da21d7 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAs.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAs.cs @@ -19,29 +19,29 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.As) { - this._expression = expression; - this._typeIdentifier = typeIdentifier; + _expression = expression; + _typeIdentifier = typeIdentifier; } - public ValidateExpression Expression => this._expression; + public ValidateExpression Expression => _expression; - public ValidateTypeIdentifier TypeIdentifier => this._typeIdentifier; + public ValidateTypeIdentifier TypeIdentifier => _typeIdentifier; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "As"); - this._expression.Validate(TypeRestriction.NotVoid, context); - if (this._expression.HasErrors) - this.MarkHasErrors(); - this._typeIdentifier.Validate(); - if (this._typeIdentifier.HasErrors) - this.MarkHasErrors(); - if (this._typeIdentifier.FoundType != null && !this._typeIdentifier.FoundType.IsNullAssignable) - this.ReportError("The {0} operator must be used with a reference type ('{1}' is not null assignable)", "as", this._typeIdentifier.FoundType.Name); - if (this._typeIdentifier.FoundType == null) + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "As"); + _expression.Validate(TypeRestriction.NotVoid, context); + if (_expression.HasErrors) + MarkHasErrors(); + _typeIdentifier.Validate(); + if (_typeIdentifier.HasErrors) + MarkHasErrors(); + if (_typeIdentifier.FoundType != null && !_typeIdentifier.FoundType.IsNullAssignable) + ReportError("The {0} operator must be used with a reference type ('{1}' is not null assignable)", "as", _typeIdentifier.FoundType.Name); + if (_typeIdentifier.FoundType == null) return; - this.DeclareEvaluationType(this._typeIdentifier.FoundType, typeRestriction); + DeclareEvaluationType(_typeIdentifier.FoundType, typeRestriction); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAssignment.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAssignment.cs index 1e78b09..e274f17 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAssignment.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionAssignment.cs @@ -20,36 +20,36 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Assignment) { - this._lvalue = lvalue; - this._rvalue = rvalue; + _lvalue = lvalue; + _rvalue = rvalue; } - public ValidateExpression LValue => this._lvalue; + public ValidateExpression LValue => _lvalue; - public ValidateExpression RValue => this._rvalue; + public ValidateExpression RValue => _rvalue; - public bool IsIndexAssignment => this._isIndexAssignment; + public bool IsIndexAssignment => _isIndexAssignment; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this._lvalue.ExpressionType == ExpressionType.Index) + if (_lvalue.ExpressionType == ExpressionType.Index) { - this._isIndexAssignment = true; - ((ValidateExpressionIndex)this._lvalue).SetAssignmentValue(this._rvalue); + _isIndexAssignment = true; + ((ValidateExpressionIndex)_lvalue).SetAssignmentValue(_rvalue); } - this._lvalue.MakeLValueUsage(); - this._lvalue.Validate(TypeRestriction.NotVoid, context); - if (this._lvalue.HasErrors) - this.MarkHasErrors(); - if (this._lvalue.ObjectType != null) - this.DeclareEvaluationType(this._lvalue.ObjectType, typeRestriction); - if (!this._rvalue.HasErrors && this._rvalue.ObjectType == null) - this._rvalue.Validate(TypeRestriction.NotVoid, context); - if (this._rvalue.HasErrors) - this.MarkHasErrors(); - if (this.HasErrors || this._lvalue.ObjectType.IsAssignableFrom(this._rvalue.ObjectType)) + _lvalue.MakeLValueUsage(); + _lvalue.Validate(TypeRestriction.NotVoid, context); + if (_lvalue.HasErrors) + MarkHasErrors(); + if (_lvalue.ObjectType != null) + DeclareEvaluationType(_lvalue.ObjectType, typeRestriction); + if (!_rvalue.HasErrors && _rvalue.ObjectType == null) + _rvalue.Validate(TypeRestriction.NotVoid, context); + if (_rvalue.HasErrors) + MarkHasErrors(); + if (HasErrors || _lvalue.ObjectType.IsAssignableFrom(_rvalue.ObjectType)) return; - this.ReportError("Invalid assignment: Type '{0}' cannot be assigned to type '{1}'", this._rvalue.ObjectType.Name, this._lvalue.ObjectType.Name); + ReportError("Invalid assignment: Type '{0}' cannot be assigned to type '{1}'", _rvalue.ObjectType.Name, _lvalue.ObjectType.Name); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionBaseClass.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionBaseClass.cs index 8399618..8d83901 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionBaseClass.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionBaseClass.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.Markup.Validation public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "this"); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "this"); if (context.CurrentMethod == null || !context.CurrentMethod.HasOverrideKeyword) - this.ReportError("'base' keyword can only be used in an override method"); - this.DeclareEvaluationType(context.Owner.TypeExport, TypeRestriction.None); + ReportError("'base' keyword can only be used in an override method"); + DeclareEvaluationType(context.Owner.TypeExport, TypeRestriction.None); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCall.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCall.cs index 3456d05..cf1e330 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCall.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCall.cs @@ -30,9 +30,9 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Call) { - this._target = target; - this._memberName = memberName; - this._parameterList = parameterList; + _target = target; + _memberName = memberName; + _parameterList = parameterList; } public ValidateExpressionCall( @@ -44,81 +44,81 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Call) { - this._typeIdentifier = typeIdentifier; - this._memberName = memberName; - this._parameterList = parameterList; + _typeIdentifier = typeIdentifier; + _memberName = memberName; + _parameterList = parameterList; } - public ValidateExpression Target => !this._foundTargetIsStatic ? this._target : null; + public ValidateExpression Target => !_foundTargetIsStatic ? _target : null; - public string MemberName => this._memberName; + public string MemberName => _memberName; - public ValidateParameter ParameterList => this._parameterList; + public ValidateParameter ParameterList => _parameterList; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { int foundTargetTypeIndex = -1; TypeSchema targetType; - if (this._target != null) + if (_target != null) { - if (this._target.ExpressionType == ExpressionType.Symbol) + if (_target.ExpressionType == ExpressionType.Symbol) { - ValidateExpressionSymbol target = (ValidateExpressionSymbol)this._target; + ValidateExpressionSymbol target = (ValidateExpressionSymbol)_target; target.Validate(TypeRestriction.NotVoid, context, true); foundTargetTypeIndex = target.FoundSymbolIndex; - this._foundTargetIsStatic = target.FoundSymbolIsType; + _foundTargetIsStatic = target.FoundSymbolIsType; } else - this._target.Validate(TypeRestriction.NotVoid, context); - if (this._target.HasErrors) + _target.Validate(TypeRestriction.NotVoid, context); + if (_target.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); return; } - targetType = this._target.ObjectType; + targetType = _target.ObjectType; } else { - this._typeIdentifier.Validate(); - if (this._typeIdentifier.HasErrors) + _typeIdentifier.Validate(); + if (_typeIdentifier.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); return; } - targetType = this._typeIdentifier.FoundType; - foundTargetTypeIndex = this._typeIdentifier.FoundTypeIndex; - this._foundTargetIsStatic = true; + targetType = _typeIdentifier.FoundType; + foundTargetTypeIndex = _typeIdentifier.FoundTypeIndex; + _foundTargetIsStatic = true; } ExpressionRestriction expressionRestriction = ExpressionRestriction.None; bool canRead = true; bool canWrite = false; - this._foundParameterTypes = this.BuildParameterTypeList(context); - if (this._foundParameterTypes == null) + _foundParameterTypes = BuildParameterTypeList(context); + if (_foundParameterTypes == null) return; - if (this._target != null && this._target.ExpressionType == ExpressionType.BaseClass) - this.ValidateBaseCall(typeRestriction, context); - else if (this._parameterList == null) + if (_target != null && _target.ExpressionType == ExpressionType.BaseClass) + ValidateBaseCall(typeRestriction, context); + else if (_parameterList == null) { - if (!this.ValidatePropertyOrEvent(targetType, typeRestriction, context, foundTargetTypeIndex, ref expressionRestriction, ref canRead, ref canWrite)) + if (!ValidatePropertyOrEvent(targetType, typeRestriction, context, foundTargetTypeIndex, ref expressionRestriction, ref canRead, ref canWrite)) return; } - else if (!this.ValidateMethodCall(targetType, typeRestriction, context, ref expressionRestriction)) + else if (!ValidateMethodCall(targetType, typeRestriction, context, ref expressionRestriction)) return; if (expressionRestriction == ExpressionRestriction.NoAccess) { - this.ReportError("Expression access to '{0}' is not available", this._memberName); + ReportError("Expression access to '{0}' is not available", _memberName); } else { - if (this.Usage == ExpressionUsage.LValue && (!canWrite || expressionRestriction == ExpressionRestriction.ReadOnly)) - this.ReportError("Expression access to '{0}' only supports read operations", this._memberName); - if (this.Usage == ExpressionUsage.RValue && !canRead) - this.ReportError("Expression access to '{0}' only supports write operations", this._memberName); - if (this.HasErrors) + if (Usage == ExpressionUsage.LValue && (!canWrite || expressionRestriction == ExpressionRestriction.ReadOnly)) + ReportError("Expression access to '{0}' only supports read operations", _memberName); + if (Usage == ExpressionUsage.RValue && !canRead) + ReportError("Expression access to '{0}' only supports write operations", _memberName); + if (HasErrors) return; - if (this._foundMemberType == SchemaType.Property && this.Usage == ExpressionUsage.LValue) + if (_foundMemberType == SchemaType.Property && Usage == ExpressionUsage.LValue) context.Owner.NotifyFoundPropertyAssignment(this); - if (this._foundMemberType != SchemaType.Method) + if (_foundMemberType != SchemaType.Method) return; context.Owner.NotifyFoundMethodCall(this); } @@ -133,45 +133,45 @@ namespace Microsoft.Iris.Markup.Validation ref bool canRead, ref bool canWrite) { - PropertySchema propertyDeep = targetType.FindPropertyDeep(this._memberName); - if (propertyDeep != null && (propertyDeep.IsStatic || !this._foundTargetIsStatic)) + PropertySchema propertyDeep = targetType.FindPropertyDeep(_memberName); + if (propertyDeep != null && (propertyDeep.IsStatic || !_foundTargetIsStatic)) { - this._foundMemberType = SchemaType.Property; - this._foundMemberIndex = this.Owner.TrackImportedProperty(propertyDeep); + _foundMemberType = SchemaType.Property; + _foundMemberIndex = Owner.TrackImportedProperty(propertyDeep); expressionRestriction = propertyDeep.ExpressionRestriction; canRead = propertyDeep.CanRead; canWrite = propertyDeep.CanWrite && !propertyDeep.Owner.IsRuntimeImmutable; - this.DeclareEvaluationType(propertyDeep.PropertyType, typeRestriction); - if (!this._foundTargetIsStatic && propertyDeep.NotifiesOnChange) - this.DeclareNotifies(context); + DeclareEvaluationType(propertyDeep.PropertyType, typeRestriction); + if (!_foundTargetIsStatic && propertyDeep.NotifiesOnChange) + DeclareNotifies(context); } - if (this._foundMemberType == SchemaType.None && !this._foundTargetIsStatic) + if (_foundMemberType == SchemaType.None && !_foundTargetIsStatic) { - EventSchema eventDeep = targetType.FindEventDeep(this._memberName); + EventSchema eventDeep = targetType.FindEventDeep(_memberName); if (eventDeep != null) { - this._foundMemberType = SchemaType.Event; - this._foundMemberIndex = this.Owner.TrackImportedEvent(eventDeep); + _foundMemberType = SchemaType.Event; + _foundMemberIndex = Owner.TrackImportedEvent(eventDeep); expressionRestriction = ExpressionRestriction.ReadOnly; - this.DeclareEvaluationType(VoidSchema.Type, typeRestriction); - this.DeclareNotifies(context); + DeclareEvaluationType(VoidSchema.Type, typeRestriction); + DeclareNotifies(context); } } - if (this._foundMemberType == SchemaType.None && this._foundTargetIsStatic) + if (_foundMemberType == SchemaType.None && _foundTargetIsStatic) { - object canonicalInstance = targetType.FindCanonicalInstance(this._memberName); + object canonicalInstance = targetType.FindCanonicalInstance(_memberName); if (canonicalInstance != null) { - this._foundMemberType = SchemaType.CanonicalInstance; - this._foundMemberIndex = foundTargetTypeIndex; - this._foundCanonicalInstance = canonicalInstance; + _foundMemberType = SchemaType.CanonicalInstance; + _foundMemberIndex = foundTargetTypeIndex; + _foundCanonicalInstance = canonicalInstance; expressionRestriction = ExpressionRestriction.ReadOnly; - this.DeclareEvaluationType(targetType, typeRestriction); + DeclareEvaluationType(targetType, typeRestriction); } } - if (this._foundMemberType != SchemaType.None) + if (_foundMemberType != SchemaType.None) return true; - this.ReportError("Unable to find a Property, Event, or Method called \"{0}\" on '{1}'", this._memberName, targetType.Name); + ReportError("Unable to find a Property, Event, or Method called \"{0}\" on '{1}'", _memberName, targetType.Name); return false; } @@ -182,19 +182,19 @@ namespace Microsoft.Iris.Markup.Validation ref ExpressionRestriction expressionRestriction) { expressionRestriction = ExpressionRestriction.ReadOnly; - TypeSchema[] foundParameterTypes = this._foundParameterTypes; - MethodSchema methodDeep = targetType.FindMethodDeep(this._memberName, foundParameterTypes); - if (methodDeep != null && (methodDeep.IsStatic || !this._foundTargetIsStatic)) + TypeSchema[] foundParameterTypes = _foundParameterTypes; + MethodSchema methodDeep = targetType.FindMethodDeep(_memberName, foundParameterTypes); + if (methodDeep != null && (methodDeep.IsStatic || !_foundTargetIsStatic)) { - this._foundMemberType = SchemaType.Method; - this._foundMemberIndex = this.Owner.TrackImportedMethod(methodDeep); - this.DeclareEvaluationType(methodDeep.ReturnType, typeRestriction); + _foundMemberType = SchemaType.Method; + _foundMemberIndex = Owner.TrackImportedMethod(methodDeep); + DeclareEvaluationType(methodDeep.ReturnType, typeRestriction); } - if (this._foundMemberType != SchemaType.None) + if (_foundMemberType != SchemaType.None) return true; if (foundParameterTypes.Length == 0) { - this.ReportError("Unable to find a Property, Event, or Method called \"{0}\" on '{1}'", this._memberName, targetType.Name); + ReportError("Unable to find a Property, Event, or Method called \"{0}\" on '{1}'", _memberName, targetType.Name); return false; } string empty = string.Empty; @@ -206,7 +206,7 @@ namespace Microsoft.Iris.Markup.Validation empty += typeSchema.Name; flag = false; } - this.ReportError("Unable to find a Method \"{0}\" that accepts parameters '{1}' on '{2}'", this._memberName, empty, targetType.Name); + ReportError("Unable to find a Method \"{0}\" that accepts parameters '{1}' on '{2}'", _memberName, empty, targetType.Name); return false; } @@ -215,39 +215,39 @@ namespace Microsoft.Iris.Markup.Validation MarkupMethodSchema markupMethodSchema = context.CurrentMethod != null ? context.CurrentMethod.FoundBaseMethod : null; if (markupMethodSchema != null) { - if (this._parameterList == null || this._memberName != markupMethodSchema.Name) - this.ReportError("'base' keyword can only be used to call the base virtual method inside an override"); - else if (new MethodSignatureKey(markupMethodSchema.Name, markupMethodSchema.ParameterTypes).Equals(new MethodSignatureKey(this._memberName, this._foundParameterTypes))) + if (_parameterList == null || _memberName != markupMethodSchema.Name) + ReportError("'base' keyword can only be used to call the base virtual method inside an override"); + else if (new MethodSignatureKey(markupMethodSchema.Name, markupMethodSchema.ParameterTypes).Equals(new MethodSignatureKey(_memberName, _foundParameterTypes))) { - this._foundMemberType = SchemaType.Method; - this._foundMemberIndex = this.Owner.TrackImportedMethod(markupMethodSchema); - this.DeclareEvaluationType(markupMethodSchema.ReturnType, typeRestriction); + _foundMemberType = SchemaType.Method; + _foundMemberIndex = Owner.TrackImportedMethod(markupMethodSchema); + DeclareEvaluationType(markupMethodSchema.ReturnType, typeRestriction); } else - this.ReportError("'base' keyword can only be used to call the base virtual method inside an override"); + ReportError("'base' keyword can only be used to call the base virtual method inside an override"); } else - this.MarkHasErrors(); + MarkHasErrors(); } private TypeSchema[] BuildParameterTypeList(ValidateContext context) { TypeSchema[] typeSchemaArray = TypeSchema.EmptyList; - if (this._parameterList != ValidateParameter.EmptyList) + if (_parameterList != ValidateParameter.EmptyList) { int length = 0; - for (ValidateParameter validateParameter = this._parameterList; validateParameter != null; validateParameter = validateParameter.Next) + for (ValidateParameter validateParameter = _parameterList; validateParameter != null; validateParameter = validateParameter.Next) { validateParameter.Validate(context); if (validateParameter.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); ++length; } - if (this.HasErrors) + if (HasErrors) return null; typeSchemaArray = new TypeSchema[length]; int index = 0; - for (ValidateParameter validateParameter = this._parameterList; validateParameter != null; validateParameter = validateParameter.Next) + for (ValidateParameter validateParameter = _parameterList; validateParameter != null; validateParameter = validateParameter.Next) { typeSchemaArray[index] = validateParameter.FoundParameterType; ++index; @@ -256,14 +256,14 @@ namespace Microsoft.Iris.Markup.Validation return typeSchemaArray; } - public void SetAsIndexAssignment() => this._isIndexAssignment = true; + public void SetAsIndexAssignment() => _isIndexAssignment = true; - public SchemaType FoundMemberType => this._foundMemberType; + public SchemaType FoundMemberType => _foundMemberType; - public int FoundMemberIndex => this._foundMemberIndex; + public int FoundMemberIndex => _foundMemberIndex; - public object FoundCanonicalInstance => this._foundCanonicalInstance; + public object FoundCanonicalInstance => _foundCanonicalInstance; - public bool IsIndexAssignment => this._isIndexAssignment; + public bool IsIndexAssignment => _isIndexAssignment; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCast.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCast.cs index 5e9853a..38af543 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCast.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionCast.cs @@ -24,8 +24,8 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Cast) { - this._typeCast = typeCast; - this._castee = castee; + _typeCast = typeCast; + _castee = castee; } public ValidateExpressionCast( @@ -38,83 +38,83 @@ namespace Microsoft.Iris.Markup.Validation { if (typeCastExpression.ExpressionType != ExpressionType.Symbol) { - this.ReportError("Type cast was expecting symbol, found '{0}'", typeCastExpression.ExpressionType.ToString()); + ReportError("Type cast was expecting symbol, found '{0}'", typeCastExpression.ExpressionType.ToString()); } else { ValidateExpressionSymbol expressionSymbol = (ValidateExpressionSymbol)typeCastExpression; - this._typeCast = new ValidateTypeIdentifier(owner, null, expressionSymbol.Symbol, expressionSymbol.Line, expressionSymbol.Column); + _typeCast = new ValidateTypeIdentifier(owner, null, expressionSymbol.Symbol, expressionSymbol.Line, expressionSymbol.Column); } - this._castee = castee; + _castee = castee; } - public ValidateTypeIdentifier TypeCast => this._typeCast; + public ValidateTypeIdentifier TypeCast => _typeCast; - public ValidateExpression Castee => this._castee; + public ValidateExpression Castee => _castee; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this._typeCast == null) + if (_typeCast == null) return; - this._typeCast.Validate(); - if (this._typeCast.HasErrors) + _typeCast.Validate(); + if (_typeCast.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); } else { - this._foundTypeCast = this._typeCast.FoundType; - this._foundTypeCastIndex = this._typeCast.FoundTypeIndex; - this.DeclareEvaluationType(this._foundTypeCast, typeRestriction); - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", this._foundTypeCast.Name); - this._castee.Validate(TypeRestriction.NotVoid, context); - if (this._castee.HasErrors) + _foundTypeCast = _typeCast.FoundType; + _foundTypeCastIndex = _typeCast.FoundTypeIndex; + DeclareEvaluationType(_foundTypeCast, typeRestriction); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", _foundTypeCast.Name); + _castee.Validate(TypeRestriction.NotVoid, context); + if (_castee.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); } else { - this._foundCasteeType = this._castee.ObjectType; - if (this._foundTypeCast.Contractual || this._foundCasteeType.Contractual) + _foundCasteeType = _castee.ObjectType; + if (_foundTypeCast.Contractual || _foundCasteeType.Contractual) { - this._foundCastMethod = CastMethod.Cast; + _foundCastMethod = CastMethod.Cast; } else { - if (this._foundCasteeType == this._foundTypeCast) + if (_foundCasteeType == _foundTypeCast) return; - bool flag1 = this._foundCasteeType.IsAssignableFrom(this._foundTypeCast); - bool flag2 = this._foundTypeCast.IsAssignableFrom(this._foundCasteeType); + bool flag1 = _foundCasteeType.IsAssignableFrom(_foundTypeCast); + bool flag2 = _foundTypeCast.IsAssignableFrom(_foundCasteeType); if (!flag1 && !flag2) { - if (this._foundTypeCast.SupportsTypeConversion(this._foundCasteeType)) + if (_foundTypeCast.SupportsTypeConversion(_foundCasteeType)) { - this._foundCastMethod = CastMethod.Conversion; - this._foundCasteeTypeIndex = this.Owner.TrackImportedType(this._foundCasteeType); + _foundCastMethod = CastMethod.Conversion; + _foundCasteeTypeIndex = Owner.TrackImportedType(_foundCasteeType); } else - this.ReportError("Cannot cast '{0}' to '{1}'", this._foundCasteeType.Name, this._foundTypeCast.Name); + ReportError("Cannot cast '{0}' to '{1}'", _foundCasteeType.Name, _foundTypeCast.Name); } else { if (!flag1) return; - this._foundCastMethod = CastMethod.Cast; + _foundCastMethod = CastMethod.Cast; } } } } } - public CastMethod FoundCastMethod => this._foundCastMethod; + public CastMethod FoundCastMethod => _foundCastMethod; - public TypeSchema FoundCasteeType => this._foundCasteeType; + public TypeSchema FoundCasteeType => _foundCasteeType; - public int FoundCasteeTypeIndex => this._foundCasteeTypeIndex; + public int FoundCasteeTypeIndex => _foundCasteeTypeIndex; - public TypeSchema FoundTypeCast => this._foundTypeCast; + public TypeSchema FoundTypeCast => _foundTypeCast; - public int FoundTypeCastIndex => this._foundTypeCastIndex; + public int FoundTypeCastIndex => _foundTypeCastIndex; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionConstant.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionConstant.cs index b32676d..6222fe4 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionConstant.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionConstant.cs @@ -25,8 +25,8 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Constant) { - this._constantInline = constantInline; - this._constantType = constantType; + _constantInline = constantInline; + _constantType = constantType; } public ValidateExpressionConstant( @@ -36,71 +36,71 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Constant) { - this._constantInline = null; - this._constantType = ConstantType.Boolean; - this._foundConstant = BooleanBoxes.Box(constantValue); + _constantInline = null; + _constantType = ConstantType.Boolean; + _foundConstant = BooleanBoxes.Box(constantValue); } - public ConstantType ConstantType => this._constantType; + public ConstantType ConstantType => _constantType; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", this._constantInline); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", _constantInline); TypeSchema evaluationType; - switch (this._constantType) + switch (_constantType) { case ConstantType.String: int errorIndex; string invalidSequence; - this._foundConstant = StringUtility.Unescape(this._constantInline, out errorIndex, out invalidSequence); - if (this._foundConstant == null) - this.ReportErrorWithAdjustedPosition(string.Format("Invalid escape sequence '{0}' in string literal", invalidSequence), 0, errorIndex + 1); + _foundConstant = StringUtility.Unescape(_constantInline, out errorIndex, out invalidSequence); + if (_foundConstant == null) + ReportErrorWithAdjustedPosition(string.Format("Invalid escape sequence '{0}' in string literal", invalidSequence), 0, errorIndex + 1); evaluationType = StringSchema.Type; break; case ConstantType.StringLiteral: - this._foundConstant = _constantInline; - this._constantType = ConstantType.String; + _foundConstant = _constantInline; + _constantType = ConstantType.String; evaluationType = StringSchema.Type; break; case ConstantType.Integer: - Result result1 = Int32Schema.Type.TypeConverter(_constantInline, StringSchema.Type, out this._foundConstant); + Result result1 = Int32Schema.Type.TypeConverter(_constantInline, StringSchema.Type, out _foundConstant); if (result1.Failed) - this.ReportError(result1.Error); + ReportError(result1.Error); evaluationType = Int32Schema.Type; break; case ConstantType.LongInteger: - Result result2 = Int64Schema.Type.TypeConverter(_constantInline, StringSchema.Type, out this._foundConstant); + Result result2 = Int64Schema.Type.TypeConverter(_constantInline, StringSchema.Type, out _foundConstant); if (result2.Failed) - this.ReportError(result2.Error); + ReportError(result2.Error); evaluationType = Int64Schema.Type; break; case ConstantType.Float: - Result result3 = SingleSchema.Type.TypeConverter(_constantInline, StringSchema.Type, out this._foundConstant); + Result result3 = SingleSchema.Type.TypeConverter(_constantInline, StringSchema.Type, out _foundConstant); if (result3.Failed) - this.ReportError(result3.Error); + ReportError(result3.Error); evaluationType = SingleSchema.Type; break; case ConstantType.Boolean: evaluationType = BooleanSchema.Type; break; case ConstantType.Null: - this._foundConstant = null; + _foundConstant = null; evaluationType = NullSchema.Type; break; default: evaluationType = null; break; } - this.DeclareEvaluationType(evaluationType, typeRestriction); - if (this.ObjectType == null) - this.MarkHasErrors(); + DeclareEvaluationType(evaluationType, typeRestriction); + if (ObjectType == null) + MarkHasErrors(); else - this._foundTypeIndex = this.Owner.TrackImportedType(this.ObjectType); + _foundTypeIndex = Owner.TrackImportedType(ObjectType); } - public object FoundConstant => this._foundConstant; + public object FoundConstant => _foundConstant; - public int FoundTypeIndex => this._foundTypeIndex; + public int FoundTypeIndex => _foundTypeIndex; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionDeclareTrigger.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionDeclareTrigger.cs index 7db4195..d55eedf 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionDeclareTrigger.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionDeclareTrigger.cs @@ -17,39 +17,39 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.DeclareTrigger) { - this._expression = expression; + _expression = expression; } - public ValidateExpression Expression => this._expression; + public ValidateExpression Expression => _expression; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Trigger Declaration"); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Trigger Declaration"); if (context.IsNotifierTracking) { - this.ReportError("Declared triggers may not exist within other declared triggers"); + ReportError("Declared triggers may not exist within other declared triggers"); } else { - StartNotifierTracking(context, this._expression); + StartNotifierTracking(context, _expression); try { - this._expression.Validate(TypeRestriction.None, context); + _expression.Validate(TypeRestriction.None, context); } finally { - StopNotifierTracking(this, context, this._expression); + StopNotifierTracking(this, context, _expression); } - if (this._expression.HasErrors) - this.MarkHasErrors(); - if (this.HasErrors) + if (_expression.HasErrors) + MarkHasErrors(); + if (HasErrors) return; - this.DeclareEvaluationType(this._expression.ObjectType, typeRestriction); + DeclareEvaluationType(_expression.ObjectType, typeRestriction); if (context.IsTrackingDeclaredTriggers) - context.TrackDeclaredTrigger(this._expression); + context.TrackDeclaredTrigger(_expression); else - this.ReportError("Expressions can only be used as triggers if they exist within Script blocks"); + ReportError("Expressions can only be used as triggers if they exist within Script blocks"); } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIndex.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIndex.cs index 4c59653..35e8c9f 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIndex.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIndex.cs @@ -23,36 +23,36 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Index) { - this._indexee = indexee; - this._index = index; + _indexee = indexee; + _index = index; } public ValidateExpression CallExpression => _call; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.RValue || this.Usage == ExpressionUsage.DeclareTrigger) + if (Usage == ExpressionUsage.RValue || Usage == ExpressionUsage.DeclareTrigger) { - this._call = new ValidateExpressionCall(this.Owner, this._indexee, "get_Item", this._index, this.Line, this.Column); - this._call.Validate(TypeRestriction.NotVoid, context); - if (this._call.HasErrors) - this.MarkHasErrors(); + _call = new ValidateExpressionCall(Owner, _indexee, "get_Item", _index, Line, Column); + _call.Validate(TypeRestriction.NotVoid, context); + if (_call.HasErrors) + MarkHasErrors(); else - this.DeclareEvaluationType(this._call.ObjectType, typeRestriction); + DeclareEvaluationType(_call.ObjectType, typeRestriction); } else { - this._index.AppendToEnd(new ValidateParameter(this.Owner, this._assignmentValue, this._assignmentValue.Line, this._assignmentValue.Column)); - this._call = new ValidateExpressionCall(this.Owner, this._indexee, "set_Item", this._index, this.Line, this.Column); - this._call.SetAsIndexAssignment(); - this._call.Validate(new TypeRestriction(VoidSchema.Type), context); - if (this._call.HasErrors) - this.MarkHasErrors(); + _index.AppendToEnd(new ValidateParameter(Owner, _assignmentValue, _assignmentValue.Line, _assignmentValue.Column)); + _call = new ValidateExpressionCall(Owner, _indexee, "set_Item", _index, Line, Column); + _call.SetAsIndexAssignment(); + _call.Validate(new TypeRestriction(VoidSchema.Type), context); + if (_call.HasErrors) + MarkHasErrors(); else - this.DeclareEvaluationType(this._assignmentValue.ObjectType, typeRestriction); + DeclareEvaluationType(_assignmentValue.ObjectType, typeRestriction); } } - public void SetAssignmentValue(ValidateExpression assignmentValue) => this._assignmentValue = assignmentValue; + public void SetAssignmentValue(ValidateExpression assignmentValue) => _assignmentValue = assignmentValue; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIsCheck.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIsCheck.cs index e54f3ff..8bb790d 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIsCheck.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionIsCheck.cs @@ -21,25 +21,25 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.IsCheck) { - this._expression = expression; - this._typeIdentifier = typeIdentifier; + _expression = expression; + _typeIdentifier = typeIdentifier; } - public ValidateExpression Expression => this._expression; + public ValidateExpression Expression => _expression; - public ValidateTypeIdentifier TypeIdentifier => this._typeIdentifier; + public ValidateTypeIdentifier TypeIdentifier => _typeIdentifier; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Is"); - this._expression.Validate(TypeRestriction.NotVoid, context); - if (this._expression.HasErrors) - this.MarkHasErrors(); - this._typeIdentifier.Validate(); - if (this._typeIdentifier.HasErrors) - this.MarkHasErrors(); - this.DeclareEvaluationType(BooleanSchema.Type, typeRestriction); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Is"); + _expression.Validate(TypeRestriction.NotVoid, context); + if (_expression.HasErrors) + MarkHasErrors(); + _typeIdentifier.Validate(); + if (_typeIdentifier.HasErrors) + MarkHasErrors(); + DeclareEvaluationType(BooleanSchema.Type, typeRestriction); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionList.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionList.cs index 005d8e7..9ecc4d5 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionList.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionList.cs @@ -16,22 +16,22 @@ namespace Microsoft.Iris.Markup.Validation public ValidateExpressionList(SourceMarkupLoader owner, int line, int column) : base(owner, line, column, ExpressionType.List) - => this._expressionList = new ArrayList(); + => _expressionList = new ArrayList(); - public void AppendToEnd(ValidateExpression expression) => this._expressionList.Add(expression); + public void AppendToEnd(ValidateExpression expression) => _expressionList.Add(expression); - public ArrayList Expressions => this._expressionList; + public ArrayList Expressions => _expressionList; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Expression List"); - if (this._expressionList.Count > 0) + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Expression List"); + if (_expressionList.Count > 0) { - for (int index = 0; index < this._expressionList.Count; ++index) + for (int index = 0; index < _expressionList.Count; ++index) { - ValidateExpression expression = (ValidateExpression)this._expressionList[index]; - if (index < this._expressionList.Count - 1) + ValidateExpression expression = (ValidateExpression)_expressionList[index]; + if (index < _expressionList.Count - 1) { expression.Validate(TypeRestriction.None, context); } @@ -39,18 +39,18 @@ namespace Microsoft.Iris.Markup.Validation { expression.Validate(typeRestriction, context); if (expression.ObjectType != null) - this.DeclareEvaluationType(expression.ObjectType, typeRestriction); + DeclareEvaluationType(expression.ObjectType, typeRestriction); } } } else - this.DeclareEvaluationType(VoidSchema.Type, typeRestriction); - if (this.ObjectType == null) - this.MarkHasErrors(); + DeclareEvaluationType(VoidSchema.Type, typeRestriction); + if (ObjectType == null) + MarkHasErrors(); else - this._foundTypeIndex = this.Owner.TrackImportedType(this.ObjectType); + _foundTypeIndex = Owner.TrackImportedType(ObjectType); } - public int FoundTypeIndex => this._foundTypeIndex; + public int FoundTypeIndex => _foundTypeIndex; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNew.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNew.cs index 9dff649..a0f3897 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNew.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNew.cs @@ -26,58 +26,58 @@ namespace Microsoft.Iris.Markup.Validation { if (parameterList == ValidateParameter.EmptyList) parameterList = null; - this._constructType = constructType; - this._parameterList = parameterList; + _constructType = constructType; + _parameterList = parameterList; } - public ValidateTypeIdentifier ConstructType => this._constructType; + public ValidateTypeIdentifier ConstructType => _constructType; - public ValidateParameter ParameterList => this._parameterList; + public ValidateParameter ParameterList => _parameterList; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - this._constructType.Validate(); - if (this._constructType.HasErrors) + _constructType.Validate(); + if (_constructType.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); } else { - this._foundConstructType = this._constructType.FoundType; - this._foundConstructTypeIndex = this._constructType.FoundTypeIndex; - this.DeclareEvaluationType(this._foundConstructType, typeRestriction); - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", this._foundConstructType.Name); + _foundConstructType = _constructType.FoundType; + _foundConstructTypeIndex = _constructType.FoundTypeIndex; + DeclareEvaluationType(_foundConstructType, typeRestriction); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", _foundConstructType.Name); int length = 0; - for (ValidateParameter validateParameter = this._parameterList; validateParameter != null; validateParameter = validateParameter.Next) + for (ValidateParameter validateParameter = _parameterList; validateParameter != null; validateParameter = validateParameter.Next) { validateParameter.Validate(context); if (validateParameter.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); ++length; } - if (this.HasErrors) + if (HasErrors) return; if (length == 0) { - if (this._foundConstructType.HasDefaultConstructor) + if (_foundConstructType.HasDefaultConstructor) return; - this.ReportError("A matching constructor could not be found on '{0}'", this._foundConstructType.Name); + ReportError("A matching constructor could not be found on '{0}'", _foundConstructType.Name); } else { TypeSchema[] parameters = new TypeSchema[length]; int index = 0; - for (ValidateParameter validateParameter = this._parameterList; validateParameter != null; validateParameter = validateParameter.Next) + for (ValidateParameter validateParameter = _parameterList; validateParameter != null; validateParameter = validateParameter.Next) { parameters[index] = validateParameter.FoundParameterType; ++index; } - this._foundParameterizedConstructor = this._foundConstructType.FindConstructor(parameters); - if (this._foundParameterizedConstructor != null) + _foundParameterizedConstructor = _foundConstructType.FindConstructor(parameters); + if (_foundParameterizedConstructor != null) { - this._isParameterizedConstruction = true; - this._foundParameterizedConstructorIndex = this.Owner.TrackImportedConstructor(this._foundParameterizedConstructor); + _isParameterizedConstruction = true; + _foundParameterizedConstructorIndex = Owner.TrackImportedConstructor(_foundParameterizedConstructor); } else { @@ -90,20 +90,20 @@ namespace Microsoft.Iris.Markup.Validation empty += typeSchema.Name; flag = false; } - this.ReportError("A matching constructor could not be found on '{0}' that accepts parameters '{1}'", this._foundConstructType.Name, empty); + ReportError("A matching constructor could not be found on '{0}' that accepts parameters '{1}'", _foundConstructType.Name, empty); } } } } - public bool IsParameterizedConstruction => this._isParameterizedConstruction; + public bool IsParameterizedConstruction => _isParameterizedConstruction; - public TypeSchema FoundConstructType => this._foundConstructType; + public TypeSchema FoundConstructType => _foundConstructType; - public int FoundConstructTypeIndex => this._foundConstructTypeIndex; + public int FoundConstructTypeIndex => _foundConstructTypeIndex; - public ConstructorSchema FoundParameterizedConstructor => this._foundParameterizedConstructor; + public ConstructorSchema FoundParameterizedConstructor => _foundParameterizedConstructor; - public int FoundParameterizedConstructorIndex => this._foundParameterizedConstructorIndex; + public int FoundParameterizedConstructorIndex => _foundParameterizedConstructorIndex; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNullCoalescing.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNullCoalescing.cs index 5012ccc..4be38cb 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNullCoalescing.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionNullCoalescing.cs @@ -21,39 +21,39 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.NullCoalescing) { - this._condition = condition; - this._nullClause = nullClause; + _condition = condition; + _nullClause = nullClause; } - public ValidateExpression Condition => this._condition; + public ValidateExpression Condition => _condition; - public ValidateExpression NullClause => this._nullClause; + public ValidateExpression NullClause => _nullClause; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Null coalescing"); - this._condition.Validate(typeRestriction, context); - if (this._condition.HasErrors) - this.MarkHasErrors(); - if (this._condition.ObjectType != null) - this.DeclareEvaluationType(this._condition.ObjectType, typeRestriction); - this._nullClause.Validate(typeRestriction, context); - if (this._condition.HasErrors) - this.MarkHasErrors(); - if (this._condition.ObjectType == null || this._nullClause.ObjectType == null) + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Null coalescing"); + _condition.Validate(typeRestriction, context); + if (_condition.HasErrors) + MarkHasErrors(); + if (_condition.ObjectType != null) + DeclareEvaluationType(_condition.ObjectType, typeRestriction); + _nullClause.Validate(typeRestriction, context); + if (_condition.HasErrors) + MarkHasErrors(); + if (_condition.ObjectType == null || _nullClause.ObjectType == null) return; - if (this._condition.ObjectType == NullSchema.Type) + if (_condition.ObjectType == NullSchema.Type) { - this.ReportError("Null constant may not be used as the condition for ?? operator"); + ReportError("Null constant may not be used as the condition for ?? operator"); } else { - if (!this._condition.ObjectType.IsNullAssignable) - this.ReportError("The {0} operator must be used with a reference type ('{1}' is not null assignable)", "??", this._condition.ObjectType.Name); - if (this._condition.ObjectType.IsAssignableFrom(this._nullClause.ObjectType)) + if (!_condition.ObjectType.IsNullAssignable) + ReportError("The {0} operator must be used with a reference type ('{1}' is not null assignable)", "??", _condition.ObjectType.Name); + if (_condition.ObjectType.IsAssignableFrom(_nullClause.ObjectType)) return; - this.ReportError("Both expressions for the {0} operator must match: '{1}' and '{2}' are not compatible", "??", this._condition.ObjectType.Name, this._nullClause.ObjectType.Name); + ReportError("Both expressions for the {0} operator must match: '{1}' and '{2}' are not compatible", "??", _condition.ObjectType.Name, _nullClause.ObjectType.Name); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionOperation.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionOperation.cs index dbdb0da..249f410 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionOperation.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionOperation.cs @@ -25,16 +25,16 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Operation) { - this._leftSide = leftSide; - this._rightSide = rightSide; - this._op = op; + _leftSide = leftSide; + _rightSide = rightSide; + _op = op; } - public ValidateExpression LeftSide => this._leftSide; + public ValidateExpression LeftSide => _leftSide; - public ValidateExpression RightSide => this._rightSide; + public ValidateExpression RightSide => _rightSide; - public OperationType Op => this._op; + public OperationType Op => _op; private static string GetOperationToken(OperationType op) { @@ -92,43 +92,43 @@ namespace Microsoft.Iris.Markup.Validation public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this._op == OperationType.PostIncrement || this._op == OperationType.PostDecrement) - this.ReportError("Post increment/decrement operators are not currently supported"); - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Operation"); - this._leftSide.Validate(TypeRestriction.NotVoid, context); - if (this._leftSide.HasErrors) - this.MarkHasErrors(); - if (this._rightSide != null) + if (_op == OperationType.PostIncrement || _op == OperationType.PostDecrement) + ReportError("Post increment/decrement operators are not currently supported"); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Operation"); + _leftSide.Validate(TypeRestriction.NotVoid, context); + if (_leftSide.HasErrors) + MarkHasErrors(); + if (_rightSide != null) { - this._rightSide.Validate(TypeRestriction.NotVoid, context); - if (this._rightSide.HasErrors) - this.MarkHasErrors(); + _rightSide.Validate(TypeRestriction.NotVoid, context); + if (_rightSide.HasErrors) + MarkHasErrors(); } - if (this.HasErrors) + if (HasErrors) return; - if (this._rightSide != null && !this._leftSide.ObjectType.IsAssignableFrom(this._rightSide.ObjectType)) + if (_rightSide != null && !_leftSide.ObjectType.IsAssignableFrom(_rightSide.ObjectType)) { - if (this._leftSide.ObjectType == NullSchema.Type && this._rightSide.ObjectType.IsNullAssignable || this._rightSide.ObjectType == NullSchema.Type && this._leftSide.ObjectType.IsNullAssignable) + if (_leftSide.ObjectType == NullSchema.Type && _rightSide.ObjectType.IsNullAssignable || _rightSide.ObjectType == NullSchema.Type && _leftSide.ObjectType.IsNullAssignable) { - this._foundOperationTargetType = NullSchema.Type; + _foundOperationTargetType = NullSchema.Type; } else { - this.ReportError("Operator '{0}' cannot be applied to operands of dissimilar types '{1}' and '{2}'", GetOperationToken(this._op), this._leftSide.ObjectType.Name, this._rightSide.ObjectType.Name); + ReportError("Operator '{0}' cannot be applied to operands of dissimilar types '{1}' and '{2}'", GetOperationToken(_op), _leftSide.ObjectType.Name, _rightSide.ObjectType.Name); return; } } else - this._foundOperationTargetType = this._leftSide.ObjectType; - if (!this._foundOperationTargetType.SupportsOperationDeep(this._op)) + _foundOperationTargetType = _leftSide.ObjectType; + if (!_foundOperationTargetType.SupportsOperationDeep(_op)) { - this.ReportError("Operator '{0}' cannot be applied to operand of type '{1}'", GetOperationToken(this._op), this._foundOperationTargetType.Name); + ReportError("Operator '{0}' cannot be applied to operand of type '{1}'", GetOperationToken(_op), _foundOperationTargetType.Name); } else { - this._foundOperationTargetTypeIndex = this.Owner.TrackImportedType(this._foundOperationTargetType); - switch (this._op) + _foundOperationTargetTypeIndex = Owner.TrackImportedType(_foundOperationTargetType); + switch (_op) { case OperationType.MathAdd: case OperationType.MathSubtract: @@ -138,7 +138,7 @@ namespace Microsoft.Iris.Markup.Validation case OperationType.MathNegate: case OperationType.PostIncrement: case OperationType.PostDecrement: - this.DeclareEvaluationType(this._foundOperationTargetType, typeRestriction); + DeclareEvaluationType(_foundOperationTargetType, typeRestriction); break; case OperationType.LogicalAnd: case OperationType.LogicalOr: @@ -150,14 +150,14 @@ namespace Microsoft.Iris.Markup.Validation case OperationType.RelationalGreaterThanEquals: case OperationType.RelationalIs: case OperationType.LogicalNot: - this.DeclareEvaluationType(BooleanSchema.Type, typeRestriction); + DeclareEvaluationType(BooleanSchema.Type, typeRestriction); break; } } } - public TypeSchema FoundOperationTargetType => this._foundOperationTargetType; + public TypeSchema FoundOperationTargetType => _foundOperationTargetType; - public int FoundOperationTargetTypeIndex => this._foundOperationTargetTypeIndex; + public int FoundOperationTargetTypeIndex => _foundOperationTargetTypeIndex; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionSymbol.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionSymbol.cs index 0817514..efe0063 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionSymbol.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionSymbol.cs @@ -15,11 +15,11 @@ namespace Microsoft.Iris.Markup.Validation public ValidateExpressionSymbol(SourceMarkupLoader owner, string symbol, int line, int column) : base(owner, line, column, ExpressionType.Symbol) - => this._symbol = symbol; + => _symbol = symbol; - public string Symbol => this._symbol; + public string Symbol => _symbol; - public override void Validate(TypeRestriction typeRestriction, ValidateContext context) => this.Validate(typeRestriction, context, false); + public override void Validate(TypeRestriction typeRestriction, ValidateContext context) => Validate(typeRestriction, context, false); public void Validate( TypeRestriction typeRestriction, @@ -27,49 +27,49 @@ namespace Microsoft.Iris.Markup.Validation bool allowTypeSymbols) { ExpressionRestriction expressionRestriction; - TypeSchema evaluationType = context.ResolveSymbol(this._symbol, out this._foundSymbolOrigin, out expressionRestriction); + TypeSchema evaluationType = context.ResolveSymbol(_symbol, out _foundSymbolOrigin, out expressionRestriction); if (evaluationType == null) { if (allowTypeSymbols) { - ValidateTypeIdentifier validateTypeIdentifier = new ValidateTypeIdentifier(this.Owner, null, this._symbol, this.Line, this.Column); + ValidateTypeIdentifier validateTypeIdentifier = new ValidateTypeIdentifier(Owner, null, _symbol, Line, Column); validateTypeIdentifier.Validate(); if (validateTypeIdentifier.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); return; } evaluationType = validateTypeIdentifier.FoundType; - this._foundSymbolIndex = validateTypeIdentifier.FoundTypeIndex; - this._foundSymbolIsType = true; + _foundSymbolIndex = validateTypeIdentifier.FoundTypeIndex; + _foundSymbolIsType = true; } else { - this.ReportError("Unable to locate symbol \"{0}\" within Properties, Locals, Input, or Content", this._symbol); + ReportError("Unable to locate symbol \"{0}\" within Properties, Locals, Input, or Content", _symbol); return; } } - if (this._foundSymbolOrigin != SymbolOrigin.None) - this._foundSymbolIndex = context.TrackSymbolUsage(this._symbol, this._foundSymbolOrigin); - this.DeclareEvaluationType(evaluationType, typeRestriction); + if (_foundSymbolOrigin != SymbolOrigin.None) + _foundSymbolIndex = context.TrackSymbolUsage(_symbol, _foundSymbolOrigin); + DeclareEvaluationType(evaluationType, typeRestriction); if (expressionRestriction == ExpressionRestriction.NoAccess) { - this.ReportError("Expression access to '{0}' is not available", this._symbol); + ReportError("Expression access to '{0}' is not available", _symbol); } else { - if (this.Usage == ExpressionUsage.LValue && expressionRestriction != ExpressionRestriction.None) - this.ReportError("Expression access to '{0}' only supports read operations", this._symbol); + if (Usage == ExpressionUsage.LValue && expressionRestriction != ExpressionRestriction.None) + ReportError("Expression access to '{0}' only supports read operations", _symbol); if (expressionRestriction != ExpressionRestriction.None) return; - this.DeclareNotifies(context); + DeclareNotifies(context); } } - public int FoundSymbolIndex => this._foundSymbolIndex; + public int FoundSymbolIndex => _foundSymbolIndex; - public SymbolOrigin FoundSymbolOrigin => this._foundSymbolOrigin; + public SymbolOrigin FoundSymbolOrigin => _foundSymbolOrigin; - public bool FoundSymbolIsType => this._foundSymbolIsType; + public bool FoundSymbolIsType => _foundSymbolIsType; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTernary.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTernary.cs index d1d9897..696a148 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTernary.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTernary.cs @@ -23,38 +23,38 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.Ternary) { - this._condition = condition; - this._trueClause = trueClause; - this._falseClause = falseClause; + _condition = condition; + _trueClause = trueClause; + _falseClause = falseClause; } - public ValidateExpression Condition => this._condition; + public ValidateExpression Condition => _condition; - public ValidateExpression TrueClause => this._trueClause; + public ValidateExpression TrueClause => _trueClause; - public ValidateExpression FalseClause => this._falseClause; + public ValidateExpression FalseClause => _falseClause; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Ternary"); - this._condition.Validate(new TypeRestriction(BooleanSchema.Type), context); - if (this._condition.HasErrors) - this.MarkHasErrors(); - this._trueClause.Validate(typeRestriction, context); - if (this._trueClause.HasErrors) - this.MarkHasErrors(); - this._falseClause.Validate(typeRestriction, context); - if (this._falseClause.HasErrors) - this.MarkHasErrors(); - if (this._trueClause.ObjectType == null || this._falseClause.ObjectType == null) + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Ternary"); + _condition.Validate(new TypeRestriction(BooleanSchema.Type), context); + if (_condition.HasErrors) + MarkHasErrors(); + _trueClause.Validate(typeRestriction, context); + if (_trueClause.HasErrors) + MarkHasErrors(); + _falseClause.Validate(typeRestriction, context); + if (_falseClause.HasErrors) + MarkHasErrors(); + if (_trueClause.ObjectType == null || _falseClause.ObjectType == null) return; - if (this._trueClause.ObjectType.IsAssignableFrom(this._falseClause.ObjectType)) - this.DeclareEvaluationType(this._trueClause.ObjectType, typeRestriction); - else if (this._falseClause.ObjectType.IsAssignableFrom(this._trueClause.ObjectType)) - this.DeclareEvaluationType(this._falseClause.ObjectType, typeRestriction); + if (_trueClause.ObjectType.IsAssignableFrom(_falseClause.ObjectType)) + DeclareEvaluationType(_trueClause.ObjectType, typeRestriction); + else if (_falseClause.ObjectType.IsAssignableFrom(_trueClause.ObjectType)) + DeclareEvaluationType(_falseClause.ObjectType, typeRestriction); else - this.ReportError("Both expressions for the {0} operator must match: '{1}' and '{2}' are not compatible", "?:", this._trueClause.ObjectType.Name, this._falseClause.ObjectType.Name); + ReportError("Both expressions for the {0} operator must match: '{1}' and '{2}' are not compatible", "?:", _trueClause.ObjectType.Name, _falseClause.ObjectType.Name); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionThis.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionThis.cs index 41884a4..2d32192 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionThis.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionThis.cs @@ -15,9 +15,9 @@ namespace Microsoft.Iris.Markup.Validation public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "this"); - this.DeclareEvaluationType(context.Owner.TypeExport, TypeRestriction.None); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "this"); + DeclareEvaluationType(context.Owner.TypeExport, TypeRestriction.None); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTypeOf.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTypeOf.cs index 367e3c5..fd2bff5 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTypeOf.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateExpressionTypeOf.cs @@ -19,19 +19,19 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ExpressionType.TypeOf) { - this._typeIdentifier = typeIdentifier; + _typeIdentifier = typeIdentifier; } - public ValidateTypeIdentifier TypeIdentifier => this._typeIdentifier; + public ValidateTypeIdentifier TypeIdentifier => _typeIdentifier; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (this.Usage == ExpressionUsage.LValue) - this.ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Operation"); - this._typeIdentifier.Validate(); - if (this._typeIdentifier.HasErrors) - this.MarkHasErrors(); - this.DeclareEvaluationType(TypeSchemaDefinition.Type, typeRestriction); + if (Usage == ExpressionUsage.LValue) + ReportError("Expression cannot be used as the target an assignment (related symbol: '{0}')", "Operation"); + _typeIdentifier.Validate(); + if (_typeIdentifier.HasErrors) + MarkHasErrors(); + DeclareEvaluationType(TypeSchemaDefinition.Type, typeRestriction); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateFromString.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateFromString.cs index ae257e3..96526fe 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateFromString.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateFromString.cs @@ -26,45 +26,45 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column, ObjectSourceType.FromString) { - this._fromString = fromString; - this._expandEscapes = expandEscapes; + _fromString = fromString; + _expandEscapes = expandEscapes; } - public string FromString => this._fromString; + public string FromString => _fromString; - public override TypeSchema ObjectType => this._typeHint; + public override TypeSchema ObjectType => _typeHint; public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - this._typeHint = typeRestriction.Primary; - if (!this._typeHint.SupportsTypeConversion(StringSchema.Type)) + _typeHint = typeRestriction.Primary; + if (!_typeHint.SupportsTypeConversion(StringSchema.Type)) { - this.ReportError("String conversion is not available for '{0}'", this._typeHint.Name); + ReportError("String conversion is not available for '{0}'", _typeHint.Name); } else { - if (this._expandEscapes) + if (_expandEscapes) { string invalidSequence; - this._fromString = StringUtility.Unescape(this._fromString, out int _, out invalidSequence); - if (this._fromString == null) + _fromString = StringUtility.Unescape(_fromString, out int _, out invalidSequence); + if (_fromString == null) { - this.ReportError("Invalid escape sequence '{0}' in string literal", invalidSequence); + ReportError("Invalid escape sequence '{0}' in string literal", invalidSequence); return; } } - Result result = this._typeHint.TypeConverter(_fromString, StringSchema.Type, out this._fromStringInstance); + Result result = _typeHint.TypeConverter(_fromString, StringSchema.Type, out _fromStringInstance); if (result.Failed) - this.ReportError(result.Error); + ReportError(result.Error); else - this._typeHintIndex = this.Owner.TrackImportedType(this._typeHint); + _typeHintIndex = Owner.TrackImportedType(_typeHint); } } - public object FromStringInstance => this._fromStringInstance; + public object FromStringInstance => _fromStringInstance; - public int TypeHintIndex => this._typeHintIndex; + public int TypeHintIndex => _typeHintIndex; - public override string ToString() => this._typeHint != null ? string.Format("FromString : '{0}' {1}", _fromString, _typeHint) : "Unavailable"; + public override string ToString() => _typeHint != null ? string.Format("FromString : '{0}' {1}", _fromString, _typeHint) : "Unavailable"; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateMethod.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateMethod.cs index 21518f8..cbb3213 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateMethod.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateMethod.cs @@ -29,59 +29,59 @@ namespace Microsoft.Iris.Markup.Validation ValidateCode body) : base(owner, line, column) { - this._methodName = methodName; - this._returnType = returnType; - this._specifiers = specifiers; - this._paramList = paramList; - this._body = body; - this._body.MarkAsNotEmbedded(); - this._body.DisallowTriggers(); + _methodName = methodName; + _returnType = returnType; + _specifiers = specifiers; + _paramList = paramList; + _body = body; + _body.MarkAsNotEmbedded(); + _body.DisallowTriggers(); } public void Validate(ValidateClass validateOwner, ValidateContext context) { - if (this.HasErrors) + if (HasErrors) return; if (context.CurrentPass == LoadPass.PopulatePublicModel) { - this._returnType.Validate(); - if (this._paramList != null) - this._paramList.Validate(context); - context.NotifyMethodFound(this._methodName); - if (this._paramList != null && this._paramList.HasErrors || (this._returnType.HasErrors || this.HasErrors)) + _returnType.Validate(); + if (_paramList != null) + _paramList.Validate(context); + context.NotifyMethodFound(_methodName); + if (_paramList != null && _paramList.HasErrors || (_returnType.HasErrors || HasErrors)) { - this.MarkHasErrors(); + MarkHasErrors(); } else { TypeSchema[] parameterTypes = TypeSchema.EmptyList; string[] parameterNames = MarkupMethodSchema.s_emptyStringArray; - if (this._paramList != null) + if (_paramList != null) { - int count = this._paramList.Parameters.Count; + int count = _paramList.Parameters.Count; parameterTypes = new TypeSchema[count]; parameterNames = new string[count]; for (int index = 0; index < count; ++index) { - ValidateParameterDefinition parameter = (ValidateParameterDefinition)this._paramList.Parameters[index]; + ValidateParameterDefinition parameter = (ValidateParameterDefinition)_paramList.Parameters[index]; parameterNames[index] = parameter.Name; parameterTypes[index] = parameter.FoundType; } } - this._methodExport = MarkupMethodSchema.Build(validateOwner.ObjectType, validateOwner.TypeExport, this._methodName, this._returnType.FoundType, parameterTypes, parameterNames); - for (int index1 = 0; index1 < this._specifiers.Count; ++index1) + _methodExport = MarkupMethodSchema.Build(validateOwner.ObjectType, validateOwner.TypeExport, _methodName, _returnType.FoundType, parameterTypes, parameterNames); + for (int index1 = 0; index1 < _specifiers.Count; ++index1) { - for (int index2 = index1 + 1; index2 < this._specifiers.Count; ++index2) + for (int index2 = index1 + 1; index2 < _specifiers.Count; ++index2) { - if (this._specifiers[index1] == this._specifiers[index2]) - this.ReportError("Duplicate modifier '{0}'", this._specifiers[index1].ToString()); + if (_specifiers[index1] == _specifiers[index2]) + ReportError("Duplicate modifier '{0}'", _specifiers[index1].ToString()); } } - this._hasVirtualKeyword = this._specifiers.Contains(MethodSpecifier.Virtual); - this._hasOverrideKeyword = this._specifiers.Contains(MethodSpecifier.Override); - if (!this._hasVirtualKeyword || !this._hasOverrideKeyword) + _hasVirtualKeyword = _specifiers.Contains(MethodSpecifier.Virtual); + _hasOverrideKeyword = _specifiers.Contains(MethodSpecifier.Override); + if (!_hasVirtualKeyword || !_hasOverrideKeyword) return; - this.ReportError("Only one of 'virtual' and 'override' is allowed"); + ReportError("Only one of 'virtual' and 'override' is allowed"); } } else @@ -92,41 +92,41 @@ namespace Microsoft.Iris.Markup.Validation MarkupTypeSchema typeSchema = validateOwner.TypeExport.Base as MarkupTypeSchema; if (typeSchema != null) { - MarkupMethodSchema methodExact = this.FindMethodExact(typeSchema, this._methodExport, true); + MarkupMethodSchema methodExact = FindMethodExact(typeSchema, _methodExport, true); if (methodExact != null) { - if (methodExact.IsVirtual && !this._hasOverrideKeyword) - this.ReportError("Method '{0}' is virtual in '{1}', must use 'override' to override", this._methodName, methodExact.Owner.Name); + if (methodExact.IsVirtual && !_hasOverrideKeyword) + ReportError("Method '{0}' is virtual in '{1}', must use 'override' to override", _methodName, methodExact.Owner.Name); if (!methodExact.IsVirtual) - this.ReportError("Method '{0}' was already defined in '{1}' with the same signature and was not declared virtual", this._methodName, methodExact.Owner.Name); - if ((this._hasVirtualKeyword || this._hasOverrideKeyword) && methodExact.ReturnType != this._methodExport.ReturnType) - this.ReportError("Method '{0}' overrides base method from '{1}', but return types do not match: '{2}' on override, '{3}' on base.", this._methodName, methodExact.Owner.Name, this._methodExport.ReturnType.Name, methodExact.ReturnType.Name); - if (methodExact.IsVirtual && this._hasOverrideKeyword) + ReportError("Method '{0}' was already defined in '{1}' with the same signature and was not declared virtual", _methodName, methodExact.Owner.Name); + if ((_hasVirtualKeyword || _hasOverrideKeyword) && methodExact.ReturnType != _methodExport.ReturnType) + ReportError("Method '{0}' overrides base method from '{1}', but return types do not match: '{2}' on override, '{3}' on base.", _methodName, methodExact.Owner.Name, _methodExport.ReturnType.Name, methodExact.ReturnType.Name); + if (methodExact.IsVirtual && _hasOverrideKeyword) { - for (MarkupTypeSchema markupTypeSchema = typeSchema; markupTypeSchema != null && this._foundBaseMethod == null; markupTypeSchema = markupTypeSchema.Base as MarkupTypeSchema) + for (MarkupTypeSchema markupTypeSchema = typeSchema; markupTypeSchema != null && _foundBaseMethod == null; markupTypeSchema = markupTypeSchema.Base as MarkupTypeSchema) { foreach (MarkupMethodSchema virtualMethod in markupTypeSchema.VirtualMethods) { if (virtualMethod.VirtualId == methodExact.VirtualId) { - this._foundBaseMethod = virtualMethod; + _foundBaseMethod = virtualMethod; break; } } } } - this._methodExport.SetVirtualId(methodExact.VirtualId); + _methodExport.SetVirtualId(methodExact.VirtualId); } - else if (this._hasOverrideKeyword) - this.ReportError("Method '{0}' declared override, but no base method found to override", this._methodName); + else if (_hasOverrideKeyword) + ReportError("Method '{0}' declared override, but no base method found to override", _methodName); } - else if (this._hasOverrideKeyword) - this.ReportError("Method '{0}' declared override, but no base method found to override", this._methodName); - if (this._hasVirtualKeyword || this._hasOverrideKeyword) - validateOwner.AddVirtualMethod(this._methodExport, this._foundBaseMethod); - if (this._paramList != null) - this._paramList.Validate(context); - this._body.Validate(new TypeRestriction(this._returnType.FoundType), context); + else if (_hasOverrideKeyword) + ReportError("Method '{0}' declared override, but no base method found to override", _methodName); + if (_hasVirtualKeyword || _hasOverrideKeyword) + validateOwner.AddVirtualMethod(_methodExport, _foundBaseMethod); + if (_paramList != null) + _paramList.Validate(context); + _body.Validate(new TypeRestriction(_returnType.FoundType), context); context.NotifyMethodScopeExit(this); } } @@ -166,22 +166,22 @@ namespace Microsoft.Iris.Markup.Validation return flag; } - public MarkupMethodSchema MethodExport => this._methodExport; + public MarkupMethodSchema MethodExport => _methodExport; - public MarkupMethodSchema FoundBaseMethod => this._foundBaseMethod; + public MarkupMethodSchema FoundBaseMethod => _foundBaseMethod; - public bool HasVirtualKeyword => this._hasVirtualKeyword; + public bool HasVirtualKeyword => _hasVirtualKeyword; - public bool HasOverrideKeyword => this._hasOverrideKeyword; + public bool HasOverrideKeyword => _hasOverrideKeyword; - public ValidateCode Body => this._body; + public ValidateCode Body => _body; public override string ToString() { string str = ""; - if (this._paramList != null) + if (_paramList != null) { - foreach (ValidateParameterDefinition parameter in this._paramList.Parameters) + foreach (ValidateParameterDefinition parameter in _paramList.Parameters) { if (str.Length > 0) str += ", "; diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateMethodList.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateMethodList.cs index 1ec3769..ac59631 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateMethodList.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateMethodList.cs @@ -16,31 +16,31 @@ namespace Microsoft.Iris.Markup.Validation public ValidateMethodList(SourceMarkupLoader owner, int line, int column) : base(owner, line, column) - => this._methodList = new ArrayList(); + => _methodList = new ArrayList(); - public void AppendToEnd(ValidateMethod expression) => this._methodList.Add(expression); + public void AppendToEnd(ValidateMethod expression) => _methodList.Add(expression); - public ArrayList Methods => this._methodList; + public ArrayList Methods => _methodList; public void Validate(ValidateClass validateOwner, ValidateContext context) { int length = 0; - for (int index1 = 0; index1 < this._methodList.Count; ++index1) + for (int index1 = 0; index1 < _methodList.Count; ++index1) { - ValidateMethod method = (ValidateMethod)this._methodList[index1]; + ValidateMethod method = (ValidateMethod)_methodList[index1]; method.Validate(validateOwner, context); if (method.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); if (method.MethodExport != null && !method.HasOverrideKeyword) ++length; if (context.CurrentPass == LoadPass.PopulatePublicModel) { for (int index2 = 0; index2 < index1; ++index2) { - if (ValidateMethod.IsExactMatch(method.MethodExport, ((ValidateMethod)this._methodList[index2]).MethodExport)) + if (ValidateMethod.IsExactMatch(method.MethodExport, ((ValidateMethod)_methodList[index2]).MethodExport)) { method.ReportError("Method '{0}' was already defined in this class with the same signature", method.MethodExport.Name); - this.MarkHasErrors(); + MarkHasErrors(); } } } @@ -55,7 +55,7 @@ namespace Microsoft.Iris.Markup.Validation num = Math.Max(num, method.VirtualId + 1); } int index = 0; - foreach (ValidateMethod method in this._methodList) + foreach (ValidateMethod method in _methodList) { if (method.MethodExport != null && !method.HasOverrideKeyword) { @@ -74,9 +74,9 @@ namespace Microsoft.Iris.Markup.Validation ++index; } } - this._foundMethods = methodSchemaArray; + _foundMethods = methodSchemaArray; } - public MethodSchema[] FoundMethods => this._foundMethods; + public MethodSchema[] FoundMethods => _foundMethods; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateNamespace.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateNamespace.cs index 04c109e..80ecb0f 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateNamespace.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateNamespace.cs @@ -20,16 +20,16 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column) { - this._prefix = prefix; - this._uri = uri; + _prefix = prefix; + _uri = uri; } - public string Prefix => this._prefix; + public string Prefix => _prefix; public ValidateNamespace Next { - get => this._next; - set => this._next = value; + get => _next; + set => _next = value; } public void AppendToEnd(ValidateNamespace item) @@ -42,15 +42,15 @@ namespace Microsoft.Iris.Markup.Validation public LoadResult Validate() { - if (this._uri == "Me") + if (_uri == "Me") return Owner.LoadResultTarget; - LoadResult loadResult = MarkupSystem.ResolveLoadResult(this._uri, this.Owner.LoadResultTarget.IslandReferences); + LoadResult loadResult = MarkupSystem.ResolveLoadResult(_uri, Owner.LoadResultTarget.IslandReferences); if (loadResult == null || loadResult is ErrorLoadResult) - this.ReportError("Unable to load '{0}' (xmlns prefix '{1}')", this._uri, this._prefix); + ReportError("Unable to load '{0}' (xmlns prefix '{1}')", _uri, _prefix); else if (loadResult.Status == LoadResultStatus.Error) - this.MarkHasErrors(); + MarkHasErrors(); if (MarkupSystem.CompileMode) - loadResult.SetCompilerReferenceName(this._uri); + loadResult.SetCompilerReferenceName(_uri); return loadResult; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateObject.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateObject.cs index 2b580f7..015ab79 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateObject.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateObject.cs @@ -18,19 +18,19 @@ namespace Microsoft.Iris.Markup.Validation ObjectSourceType objectSourceType) : base(owner, line, column) { - this._objectSourceType = objectSourceType; + _objectSourceType = objectSourceType; } public abstract void Validate(TypeRestriction typeRestriction, ValidateContext context); public abstract TypeSchema ObjectType { get; } - public ObjectSourceType ObjectSourceType => this._objectSourceType; + public ObjectSourceType ObjectSourceType => _objectSourceType; public ValidateObject Next { - get => this._next; - set => this._next = value; + get => _next; + set => _next = value; } public void AppendToEnd(ValidateObject item) diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateObjectTag.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateObjectTag.cs index 1254604..cbc75e7 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateObjectTag.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateObjectTag.cs @@ -29,12 +29,12 @@ namespace Microsoft.Iris.Markup.Validation int offset) : base(owner, line, offset, ObjectSourceType.ObjectTag) { - this._typeIdentifier = typeIdentifier; + _typeIdentifier = typeIdentifier; } - public ValidateTypeIdentifier TypeIdentifier => this._typeIdentifier; + public ValidateTypeIdentifier TypeIdentifier => _typeIdentifier; - public ValidateProperty PropertyList => this._propertyList; + public ValidateProperty PropertyList => _propertyList; public ValidateObjectTag Next { @@ -44,44 +44,44 @@ namespace Microsoft.Iris.Markup.Validation public void AddProperty(ValidateProperty property) { - if (this._propertyList == null) - this._propertyList = property; + if (_propertyList == null) + _propertyList = property; else - this._propertyList.AppendToEnd(property); + _propertyList.AppendToEnd(property); } - public override TypeSchema ObjectType => this._foundType; + public override TypeSchema ObjectType => _foundType; public string Name { - get => this._name; - set => this._name = value; + get => _name; + set => _name = value; } public ValidateObject DynamicConstructionType { - get => this._dynamicConstructionType; - set => this._dynamicConstructionType = value; + get => _dynamicConstructionType; + set => _dynamicConstructionType = value; } public ValidateObject IndirectedObject { - get => this._indirectedObject; - set => this._indirectedObject = value; + get => _indirectedObject; + set => _indirectedObject = value; } public bool PropertyIsRequiredForCreation { - get => this._isRequired; - set => this._isRequired = value; + get => _isRequired; + set => _isRequired = value; } public virtual PropertyOverrideCriteria PropertyOverrideCriteria => (PropertyOverrideCriteria)null; public MarkupPropertySchema PropertySchemaExport { - get => this._propertySchemaExport; - set => this._propertySchemaExport = value; + get => _propertySchemaExport; + set => _propertySchemaExport = value; } public virtual void NotifyParseComplete() @@ -90,93 +90,93 @@ namespace Microsoft.Iris.Markup.Validation protected bool ValidateObjectTagType() { - if (this._typeIdentifier.HasErrors || this._typeIdentifier.FoundType != null) - return !this._typeIdentifier.HasErrors; - this._typeIdentifier.Validate(); - if (this._typeIdentifier.HasErrors) + if (_typeIdentifier.HasErrors || _typeIdentifier.FoundType != null) + return !_typeIdentifier.HasErrors; + _typeIdentifier.Validate(); + if (_typeIdentifier.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); return false; } - this._foundType = this._typeIdentifier.FoundType; - this._foundTypeIndex = this._typeIdentifier.FoundTypeIndex; + _foundType = _typeIdentifier.FoundType; + _foundTypeIndex = _typeIdentifier.FoundTypeIndex; return true; } public override void Validate(TypeRestriction typeRestriction, ValidateContext context) { - if (!this.ValidateObjectTagType()) + if (!ValidateObjectTagType()) return; if (context.CurrentPass == LoadPass.PopulatePublicModel) { - if (this._foundType == null || !(this.GetInlinePropertyValueNoValidate(this._foundType.Name) == "$Required")) + if (_foundType == null || !(GetInlinePropertyValueNoValidate(_foundType.Name) == "$Required")) return; - this.PropertyIsRequiredForCreation = true; + PropertyIsRequiredForCreation = true; } else { - if (context.CurrentPass != LoadPass.Full || !typeRestriction.Check(this, this._foundType)) + if (context.CurrentPass != LoadPass.Full || !typeRestriction.Check(this, _foundType)) return; - if (!this._foundType.HasDefaultConstructor && !this.ForceAbstractAsConcrete && this.FindProperty(this._foundType.Name) == null) + if (!_foundType.HasDefaultConstructor && !ForceAbstractAsConcrete && FindProperty(_foundType.Name) == null) { - this.ReportError("Type '{0}' may only be created via indirection (i.e. <{0} {0}=\"...\"/>)", this._foundType.Name); + ReportError("Type '{0}' may only be created via indirection (i.e. <{0} {0}=\"...\"/>)", _foundType.Name); } else { context.NotifyObjectTagScopeEnter(this); try { - this.ValidateProperties(context); + ValidateProperties(context); } finally { Result result = context.NotifyObjectTagScopeExit(this); if (result.Failed) - this.ReportError(result.Error); + ReportError(result.Error); } - if (this._propertySchemaExport == null) + if (_propertySchemaExport == null) return; - this._propertySchemaExport.SetOverrideCriteria(this.PropertyOverrideCriteria); + _propertySchemaExport.SetOverrideCriteria(PropertyOverrideCriteria); } } } protected virtual void ValidateProperties(ValidateContext context) { - this._propertyCount = 0; - for (ValidateProperty property = this._propertyList; property != null; property = property.Next) + _propertyCount = 0; + for (ValidateProperty property = _propertyList; property != null; property = property.Next) { - this.ValidateDuplicateProperties(property); + ValidateDuplicateProperties(property); property.Validate(this, context); if (property.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); if (!property.IsPseudo) - ++this._propertyCount; + ++_propertyCount; } - if (this.PropertyIsRequiredForCreation) + if (PropertyIsRequiredForCreation) { PropertySchema activePropertyScope = context.GetActivePropertyScope(); if (activePropertyScope == ValidateContext.ClassPropertiesProperty || activePropertyScope == ValidateContext.UIPropertiesProperty) return; - this.ReportError("'$Required' can't be used in this context. It may only be used for declaring required properties on Classes and UIs"); + ReportError("'$Required' can't be used in this context. It may only be used for declaring required properties on Classes and UIs"); } - else if (this._indirectedObject != null) + else if (_indirectedObject != null) { - if (this._indirectedObject.HasErrors) + if (_indirectedObject.HasErrors) return; - if (!this._foundType.IsAssignableFrom(this._indirectedObject.ObjectType)) + if (!_foundType.IsAssignableFrom(_indirectedObject.ObjectType)) { - this.ReportError("'{0}' cannot be used in this context (expecting types compatible with '{1}')", this._indirectedObject.ObjectType.Name, this._foundType.Name); + ReportError("'{0}' cannot be used in this context (expecting types compatible with '{1}')", _indirectedObject.ObjectType.Name, _foundType.Name); } else { - for (ValidateProperty validateProperty = this._propertyList; validateProperty != null; validateProperty = validateProperty.Next) + for (ValidateProperty validateProperty = _propertyList; validateProperty != null; validateProperty = validateProperty.Next) { if (!validateProperty.IsPseudo) { if (validateProperty.PropertyName != "Name") { - this.ReportError("Property sets are not supported on type indirection tag. Property specified was '{0}'", validateProperty.PropertyName); + ReportError("Property sets are not supported on type indirection tag. Property specified was '{0}'", validateProperty.PropertyName); break; } validateProperty.MarkAsPseudo(); @@ -185,20 +185,20 @@ namespace Microsoft.Iris.Markup.Validation } } else - this.ValidateRequiredProperties(); + ValidateRequiredProperties(); } private void ValidateDuplicateProperties(ValidateProperty property) { bool flag = false; - for (ValidateProperty validateProperty = this._propertyList; validateProperty != null; validateProperty = validateProperty.Next) + for (ValidateProperty validateProperty = _propertyList; validateProperty != null; validateProperty = validateProperty.Next) { if (validateProperty.PropertyName == property.PropertyName) { if (flag) { property.ReportError("Property '{0}' was specified more than once", property.PropertyName); - this.MarkHasErrors(); + MarkHasErrors(); break; } flag = true; @@ -208,10 +208,10 @@ namespace Microsoft.Iris.Markup.Validation private void ValidateRequiredProperties() { - foreach (string str in this._foundType.FindRequiredPropertyNamesDeep()) + foreach (string str in _foundType.FindRequiredPropertyNamesDeep()) { bool flag = false; - for (ValidateProperty validateProperty = this._propertyList; validateProperty != null; validateProperty = validateProperty.Next) + for (ValidateProperty validateProperty = _propertyList; validateProperty != null; validateProperty = validateProperty.Next) { if (validateProperty.PropertyName == str) { @@ -221,19 +221,19 @@ namespace Microsoft.Iris.Markup.Validation } if (!flag) { - this.ReportError("Property '{0}' must be specified for '{1}' to function", str, this._foundType.Name); - this.MarkHasErrors(); + ReportError("Property '{0}' must be specified for '{1}' to function", str, _foundType.Name); + MarkHasErrors(); } } } protected virtual bool ForceAbstractAsConcrete => false; - public ValidateProperty FindProperty(string propertyName) => this.FindProperty(propertyName, false); + public ValidateProperty FindProperty(string propertyName) => FindProperty(propertyName, false); public ValidateProperty FindProperty(string propertyName, bool remove) { - ValidateProperty validateProperty1 = this._propertyList; + ValidateProperty validateProperty1 = _propertyList; ValidateProperty validateProperty2 = null; for (; validateProperty1 != null; validateProperty1 = validateProperty1.Next) { @@ -243,8 +243,8 @@ namespace Microsoft.Iris.Markup.Validation { if (validateProperty2 != null) validateProperty2.Next = validateProperty1.Next; - if (validateProperty1 == this._propertyList) - this._propertyList = validateProperty1.Next; + if (validateProperty1 == _propertyList) + _propertyList = validateProperty1.Next; validateProperty1.Next = null; } return validateProperty1; @@ -256,7 +256,7 @@ namespace Microsoft.Iris.Markup.Validation public void RemoveProperty(ValidateProperty propertyRemove) { - ValidateProperty validateProperty1 = this._propertyList; + ValidateProperty validateProperty1 = _propertyList; ValidateProperty validateProperty2 = null; for (; validateProperty1 != null; validateProperty1 = validateProperty1.Next) { @@ -264,8 +264,8 @@ namespace Microsoft.Iris.Markup.Validation { if (validateProperty2 != null) validateProperty2.Next = validateProperty1.Next; - if (validateProperty1 == this._propertyList) - this._propertyList = validateProperty1.Next; + if (validateProperty1 == _propertyList) + _propertyList = validateProperty1.Next; validateProperty1.Next = null; break; } @@ -275,27 +275,27 @@ namespace Microsoft.Iris.Markup.Validation public string GetInlinePropertyValueNoValidate(string propertyName) { - ValidateProperty property = this.FindProperty(propertyName); + ValidateProperty property = FindProperty(propertyName); return property != null && property.IsFromStringValue ? ((ValidateFromString)property.Value).FromString : null; } public void MovePropertyToFront(string propertyName) { - ValidateProperty property = this.FindProperty(propertyName, true); + ValidateProperty property = FindProperty(propertyName, true); if (property == null) return; - property.Next = this._propertyList; - this._propertyList = property; + property.Next = _propertyList; + _propertyList = property; } public void AddStringProperty(string propertyName, string value) { - ValidateFromString validateFromString = new ValidateFromString(this.Owner, value, false, this.Line, this.Column); - ValidateProperty validateProperty = new ValidateProperty(this.Owner, propertyName, validateFromString, this.Line, this.Column); - if (this._propertyList == null) - this._propertyList = validateProperty; + ValidateFromString validateFromString = new ValidateFromString(Owner, value, false, Line, Column); + ValidateProperty validateProperty = new ValidateProperty(Owner, propertyName, validateFromString, Line, Column); + if (_propertyList == null) + _propertyList = validateProperty; else - this._propertyList.AppendToEnd(validateProperty); + _propertyList.AppendToEnd(validateProperty); } public TypeSchema ExtractTypeSchemaProperty( @@ -303,7 +303,7 @@ namespace Microsoft.Iris.Markup.Validation ValidateContext context, bool required) { - ValidateProperty property = this.FindProperty(propertyName, true); + ValidateProperty property = FindProperty(propertyName, true); if (property != null) { ValidateTypeIdentifier.PromoteSimplifiedTypeSyntax(property); @@ -315,18 +315,18 @@ namespace Microsoft.Iris.Markup.Validation validateExpression.Validate(new TypeRestriction(TypeSchemaDefinition.Type), context); if (!validateExpression.HasErrors) return ((ValidateExpressionTypeOf)validateExpression).TypeIdentifier.FoundType; - this.MarkHasErrors(); + MarkHasErrors(); } else - this.ReportError("Invalid expression for '{0}', expecting plain type identifier", property.PropertyName); + ReportError("Invalid expression for '{0}', expecting plain type identifier", property.PropertyName); } else if (property.IsFromStringValue) - this.ReportError("Invalid value '{0}' for attribute '{1}'", ((ValidateFromString)property.Value).FromString, property.PropertyName); + ReportError("Invalid value '{0}' for attribute '{1}'", ((ValidateFromString)property.Value).FromString, property.PropertyName); else - this.ReportError("Property '{0}' does not support expanded value syntax", property.PropertyName); + ReportError("Property '{0}' does not support expanded value syntax", property.PropertyName); } else if (required) - this.ReportError("Property '{0}' must be specified", propertyName); + ReportError("Property '{0}' must be specified", propertyName); return null; } @@ -336,7 +336,7 @@ namespace Microsoft.Iris.Markup.Validation bool required, out bool value) { - ValidateProperty property = this.FindProperty(propertyName, true); + ValidateProperty property = FindProperty(propertyName, true); if (property != null) { if (property.IsFromStringValue) @@ -348,47 +348,47 @@ namespace Microsoft.Iris.Markup.Validation value = (bool)validateFromString.FromStringInstance; return true; } - this.MarkHasErrors(); + MarkHasErrors(); } else - this.ReportError("Property '{0}' does not support expanded value syntax", property.PropertyName); + ReportError("Property '{0}' does not support expanded value syntax", property.PropertyName); } else if (required) - this.ReportError("Property '{0}' must be specified", propertyName); + ReportError("Property '{0}' must be specified", propertyName); value = false; return false; } public string ExtractStringProperty(string propertyName, bool required) { - ValidateProperty property = this.FindProperty(propertyName, true); + ValidateProperty property = FindProperty(propertyName, true); if (property != null) { if (property.IsFromStringValue) return ((ValidateFromString)property.Value).FromString; - this.ReportError("Property '{0}' does not support expanded value syntax", propertyName); + ReportError("Property '{0}' does not support expanded value syntax", propertyName); } else if (required) - this.ReportError("Property '{0}' must be specified", propertyName); + ReportError("Property '{0}' must be specified", propertyName); return null; } - public TypeSchema FoundType => this._foundType; + public TypeSchema FoundType => _foundType; - public int FoundTypeIndex => this._foundTypeIndex; + public int FoundTypeIndex => _foundTypeIndex; - public int PropertyCount => this._propertyCount; + public int PropertyCount => _propertyCount; public override string ToString() { string str = ""; - if (this._name != null) + if (_name != null) str += string.Format("Name='{0}'", _name); - if (this._indirectedObject != null) + if (_indirectedObject != null) { - if (this._name != null) + if (_name != null) str += ", "; - str += string.Format("Indirected=[{0}]", this._indirectedObject.ToString()); + str += string.Format("Indirected=[{0}]", _indirectedObject.ToString()); } return string.Format("Tag : {0} {1}", _typeIdentifier, str); } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateParameter.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateParameter.cs index 982a8d8..4997f30 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateParameter.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateParameter.cs @@ -24,33 +24,33 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column) { - this._expression = expression; + _expression = expression; } protected ValidateParameter() { } - public ValidateExpression Expression => this._expression; + public ValidateExpression Expression => _expression; public ValidateParameter Next { - get => this._next; - set => this._next = value; + get => _next; + set => _next = value; } - public void Validate(ValidateContext context) => this.Validate(context, false); + public void Validate(ValidateContext context) => Validate(context, false); public void Validate(ValidateContext context, bool voidAcceptable) { - this._expression.Validate(!voidAcceptable ? new TypeRestriction(ObjectSchema.Type) : new TypeRestriction(ObjectSchema.Type, VoidSchema.Type), context); - if (this._expression.HasErrors) - this.MarkHasErrors(); + _expression.Validate(!voidAcceptable ? new TypeRestriction(ObjectSchema.Type) : new TypeRestriction(ObjectSchema.Type, VoidSchema.Type), context); + if (_expression.HasErrors) + MarkHasErrors(); else - this._foundParameterType = this._expression.ObjectType; + _foundParameterType = _expression.ObjectType; } - public TypeSchema FoundParameterType => this._foundParameterType; + public TypeSchema FoundParameterType => _foundParameterType; public void AppendToEnd(ValidateParameter item) { diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinition.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinition.cs index 0ed98f0..00b61c7 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinition.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinition.cs @@ -19,24 +19,24 @@ namespace Microsoft.Iris.Markup.Validation ValidateTypeIdentifier typeIdentifier) : base(owner, line, column) { - this._name = name; - this._typeIdentifier = typeIdentifier; + _name = name; + _typeIdentifier = typeIdentifier; } - public string Name => this._name; + public string Name => _name; - public ValidateTypeIdentifier TypeIdentifier => this._typeIdentifier; + public ValidateTypeIdentifier TypeIdentifier => _typeIdentifier; - public TypeSchema FoundType => this._typeIdentifier.FoundType; + public TypeSchema FoundType => _typeIdentifier.FoundType; public void Validate(ValidateCode container, ValidateContext context) { - if (context.CurrentPass < LoadPass.PopulatePublicModel || this._typeIdentifier.Validated) + if (context.CurrentPass < LoadPass.PopulatePublicModel || _typeIdentifier.Validated) return; - this._typeIdentifier.Validate(); - if (!this._typeIdentifier.HasErrors) + _typeIdentifier.Validate(); + if (!_typeIdentifier.HasErrors) return; - this.MarkHasErrors(); + MarkHasErrors(); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinitionList.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinitionList.cs index a2ac278..76f2b47 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinitionList.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateParameterDefinitionList.cs @@ -14,19 +14,19 @@ namespace Microsoft.Iris.Markup.Validation public ValidateParameterDefinitionList(SourceMarkupLoader owner, int line, int column) : base(owner, line, column) - => this._paramDefinitionList = new ArrayList(); + => _paramDefinitionList = new ArrayList(); - public void AppendToEnd(ValidateParameterDefinition expression) => this._paramDefinitionList.Add(expression); + public void AppendToEnd(ValidateParameterDefinition expression) => _paramDefinitionList.Add(expression); - public ArrayList Parameters => this._paramDefinitionList; + public ArrayList Parameters => _paramDefinitionList; public void Validate(ValidateContext context) { - foreach (ValidateParameterDefinition paramDefinition in this._paramDefinitionList) + foreach (ValidateParameterDefinition paramDefinition in _paramDefinitionList) { paramDefinition.Validate(null, context); if (paramDefinition.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); } } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateProperty.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateProperty.cs index f1845b4..1054b4e 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateProperty.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateProperty.cs @@ -40,26 +40,26 @@ namespace Microsoft.Iris.Markup.Validation int column) : base(owner, line, column) { - this._propertyName = propertyName; - this._value = value; + _propertyName = propertyName; + _value = value; } - public string PropertyName => this._propertyName; + public string PropertyName => _propertyName; public ValidateObject Value { - get => this._value; - set => this._value = value; + get => _value; + set => _value = value; } - public PropertyAttribute PropertyAttributeList => this._propertyAttributeList; + public PropertyAttribute PropertyAttributeList => _propertyAttributeList; - public void AllowPropertyAttributes() => this._allowPropertyAttributes = true; + public void AllowPropertyAttributes() => _allowPropertyAttributes = true; public ValidateProperty Next { - get => this._next; - set => this._next = value; + get => _next; + set => _next = value; } public void AppendToEnd(ValidateProperty item) @@ -72,109 +72,109 @@ namespace Microsoft.Iris.Markup.Validation public void AddValue(ValidateObject value) { - if (this._value == null) - this._value = value; - else if (this._value is ValidateObjectTag && value is ValidateObjectTag) - this._value.AppendToEnd(value); - else if (this._value is ValidateCode && value is ValidateCode) - this._value.AppendToEnd(value); + if (_value == null) + _value = value; + else if (_value is ValidateObjectTag && value is ValidateObjectTag) + _value.AppendToEnd(value); + else if (_value is ValidateCode && value is ValidateCode) + _value.AppendToEnd(value); else - this.ReportError("Property '{0}' cannot contain both object-tag and script block values", this._propertyName); + ReportError("Property '{0}' cannot contain both object-tag and script block values", _propertyName); } public void AddAttribute(PropertyAttribute attribute) { - attribute.Next = this._propertyAttributeList; - this._propertyAttributeList = attribute; + attribute.Next = _propertyAttributeList; + _propertyAttributeList = attribute; } public void Validate(ValidateObjectTag targetObject, ValidateContext context) { TypeSchema objectType = targetObject.ObjectType; - if (this._propertyName == "Override" && this.ValidateOverrideProperty(targetObject, context)) + if (_propertyName == "Override" && ValidateOverrideProperty(targetObject, context)) return; - string name = this._propertyName; - int length = this._propertyName.IndexOf('.'); - if (length >= 0 && this._propertyName.Length > length + 1 && this._propertyName.Substring(0, length) == targetObject.TypeIdentifier.TypeName) - name = this._propertyName.Substring(length + 1); - this._foundProperty = objectType.FindPropertyDeep(name); - if (this._foundProperty == null) + string name = _propertyName; + int length = _propertyName.IndexOf('.'); + if (length >= 0 && _propertyName.Length > length + 1 && _propertyName.Substring(0, length) == targetObject.TypeIdentifier.TypeName) + name = _propertyName.Substring(length + 1); + _foundProperty = objectType.FindPropertyDeep(name); + if (_foundProperty == null) { - if (this._propertyName == "Name") - this.ValidateNameProperty(true, targetObject, context); - else if (this._propertyName == targetObject.TypeIdentifier.TypeName) - this.ValidatePseudoConstructionProperty(targetObject, context); + if (_propertyName == "Name") + ValidateNameProperty(true, targetObject, context); + else if (_propertyName == targetObject.TypeIdentifier.TypeName) + ValidatePseudoConstructionProperty(targetObject, context); else - this.ReportError("Property '{0}' does not exist on '{1}'", this._propertyName, objectType.Name); + ReportError("Property '{0}' does not exist on '{1}'", _propertyName, objectType.Name); } else { - if (this._propertyName == "Name") - this.ValidateNameProperty(false, targetObject, context); - this.UpdateFoundProperty(this._foundProperty); - if (this._propertyAttributeList != null && !this._allowPropertyAttributes) - this.ReportError("Property attributes are not supported on property '{0}'", this._propertyName); - if (this.IsCodeValue && ((ValidateCode)this._value).Next != null) + if (_propertyName == "Name") + ValidateNameProperty(false, targetObject, context); + UpdateFoundProperty(_foundProperty); + if (_propertyAttributeList != null && !_allowPropertyAttributes) + ReportError("Property attributes are not supported on property '{0}'", _propertyName); + if (IsCodeValue && ((ValidateCode)_value).Next != null) { - this.ReportError("Property '{0}' does not support multi-value script blocks", this._propertyName); + ReportError("Property '{0}' does not support multi-value script blocks", _propertyName); } else { - bool flag1 = DictionarySchema.Type.IsAssignableFrom(this._foundProperty.PropertyType); - bool flag2 = ListSchema.Type.IsAssignableFrom(this._foundProperty.PropertyType); - this._multipleValueProperty = flag1 || flag2; - bool flag3 = this.IsObjectTagValue && ((ValidateObjectTag)this._value).Next != null; - if (!this._multipleValueProperty && flag3) + bool flag1 = DictionarySchema.Type.IsAssignableFrom(_foundProperty.PropertyType); + bool flag2 = ListSchema.Type.IsAssignableFrom(_foundProperty.PropertyType); + _multipleValueProperty = flag1 || flag2; + bool flag3 = IsObjectTagValue && ((ValidateObjectTag)_value).Next != null; + if (!_multipleValueProperty && flag3) { - this.ReportError("Property '{0}' does not support multiple values (property type is '{1}')", this._propertyName, this._foundProperty.PropertyType.Name); + ReportError("Property '{0}' does not support multiple values (property type is '{1}')", _propertyName, _foundProperty.PropertyType.Name); } else { context.NotifyPropertyScopeEnter(this); try { - if (!this._multipleValueProperty) + if (!_multipleValueProperty) { - if (this._value == null) + if (_value == null) { - this.ReportError("Property '{0}' requires a value to be provided", this._propertyName); + ReportError("Property '{0}' requires a value to be provided", _propertyName); return; } - this._valueCount = 1; - this._valueApplyMode = ValueApplyMode.SingleValueSet; - this._value.Validate(new TypeRestriction(this._foundProperty.PropertyType, this._foundProperty.AlternateType), context); - if (this._value.HasErrors) + _valueCount = 1; + _valueApplyMode = ValueApplyMode.SingleValueSet; + _value.Validate(new TypeRestriction(_foundProperty.PropertyType, _foundProperty.AlternateType), context); + if (_value.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); return; } - if (this._foundProperty.RangeValidator != null && this.IsFromStringValue) + if (_foundProperty.RangeValidator != null && IsFromStringValue) { - Result result = this._foundProperty.RangeValidator(((ValidateFromString)this._value).FromStringInstance); + Result result = _foundProperty.RangeValidator(((ValidateFromString)_value).FromStringInstance); if (result.Failed) - this.ReportError(result.Error); + ReportError(result.Error); } } else { - TypeSchema primary = this._foundProperty.AlternateType ?? ObjectSchema.Type; - this._valueApplyMode = !flag1 ? ValueApplyMode.MultiValueList : ValueApplyMode.MultiValueDictionary; - if (this._foundProperty.CanWrite && this._foundProperty.PropertyType.HasDefaultConstructor) - this._valueApplyMode |= ValueApplyMode.CollectionPopulateAndSet; + TypeSchema primary = _foundProperty.AlternateType ?? ObjectSchema.Type; + _valueApplyMode = !flag1 ? ValueApplyMode.MultiValueList : ValueApplyMode.MultiValueDictionary; + if (_foundProperty.CanWrite && _foundProperty.PropertyType.HasDefaultConstructor) + _valueApplyMode |= ValueApplyMode.CollectionPopulateAndSet; else - this._valueApplyMode |= ValueApplyMode.CollectionAdd; - for (ValidateObject validateObject = this._value; validateObject != null; validateObject = validateObject.ObjectSourceType != ObjectSourceType.ObjectTag ? null : (ValidateObject)((ValidateObjectTag)validateObject).Next) + _valueApplyMode |= ValueApplyMode.CollectionAdd; + for (ValidateObject validateObject = _value; validateObject != null; validateObject = validateObject.ObjectSourceType != ObjectSourceType.ObjectTag ? null : (ValidateObject)((ValidateObjectTag)validateObject).Next) { - ++this._valueCount; - TypeRestriction typeRestriction = !flag3 ? new TypeRestriction(primary, this._foundProperty.PropertyType) : new TypeRestriction(primary); + ++_valueCount; + TypeRestriction typeRestriction = !flag3 ? new TypeRestriction(primary, _foundProperty.PropertyType) : new TypeRestriction(primary); validateObject.Validate(typeRestriction, context); if (validateObject.HasErrors) { - this.MarkHasErrors(); + MarkHasErrors(); } else { - if (!flag3 && this._foundProperty.PropertyType.IsAssignableFrom(validateObject.ObjectType)) + if (!flag3 && _foundProperty.PropertyType.IsAssignableFrom(validateObject.ObjectType)) { bool flag4 = true; if (flag1) @@ -182,35 +182,35 @@ namespace Microsoft.Iris.Markup.Validation if (validateObject.ObjectSourceType == ObjectSourceType.ObjectTag && ((ValidateObjectTag)validateObject).Name != null) flag4 = false; } - else if (!this._foundProperty.CanWrite) + else if (!_foundProperty.CanWrite) flag4 = false; if (flag4) { - this._valueApplyMode = ValueApplyMode.SingleValueSet; + _valueApplyMode = ValueApplyMode.SingleValueSet; break; } } if (validateObject.ObjectSourceType != ObjectSourceType.ObjectTag) { - this.ReportError("Collection property '{0}' may only have multiple values specified in expanded form", this._propertyName); + ReportError("Collection property '{0}' may only have multiple values specified in expanded form", _propertyName); break; } - if ((this._valueApplyMode & ValueApplyMode.MultiValueDictionary) != ValueApplyMode.SingleValueSet && ((ValidateObjectTag)validateObject).Name == null) - this.ReportError("Dictionary property '{0}' requires all values be named", this._propertyName); + if ((_valueApplyMode & ValueApplyMode.MultiValueDictionary) != ValueApplyMode.SingleValueSet && ((ValidateObjectTag)validateObject).Name == null) + ReportError("Dictionary property '{0}' requires all values be named", _propertyName); } } } - if (this._valueApplyMode == ValueApplyMode.SingleValueSet) + if (_valueApplyMode == ValueApplyMode.SingleValueSet) { - if (this._foundProperty.CanWrite) + if (_foundProperty.CanWrite) return; - this.ReportError("Property '{0}' does not support setting", this._foundProperty.Name); + ReportError("Property '{0}' does not support setting", _foundProperty.Name); } else { - if (this._foundProperty.CanRead) + if (_foundProperty.CanRead) return; - this.ReportError("Property '{0}' must support reading to retrieve its collection for multiple value adds", this._foundProperty.Name); + ReportError("Property '{0}' must support reading to retrieve its collection for multiple value adds", _foundProperty.Name); } } finally @@ -228,17 +228,17 @@ namespace Microsoft.Iris.Markup.Validation ValidateContext context) { if (isPseudo) - this.MarkAsPseudo(); - if (!this.IsFromStringValue) + MarkAsPseudo(); + if (!IsFromStringValue) { - this.ReportError("Property '{0}' does not support expanded value syntax", this._propertyName); + ReportError("Property '{0}' does not support expanded value syntax", _propertyName); } else { - ValidateFromString validateFromString = (ValidateFromString)this._value; + ValidateFromString validateFromString = (ValidateFromString)_value; validateFromString.Validate(new TypeRestriction(StringSchema.Type), context); if (validateFromString.HasErrors) - this.MarkHasErrors(); + MarkHasErrors(); else targetObject.Name = validateFromString.FromString; } @@ -249,27 +249,27 @@ namespace Microsoft.Iris.Markup.Validation ValidateContext context) { bool flag = false; - this.MarkAsPseudo(); - if (this.IsObjectTagValue && ((ValidateObjectTag)this._value).Next != null) + MarkAsPseudo(); + if (IsObjectTagValue && ((ValidateObjectTag)_value).Next != null) { - this.ReportError("Property '{0}' does not support multiple values (property type is '{1}')", this._propertyName, targetObject.ObjectType.Name); + ReportError("Property '{0}' does not support multiple values (property type is '{1}')", _propertyName, targetObject.ObjectType.Name); } else { - if (this.IsFromStringValue && ((ValidateFromString)this._value).FromString == "$Required") + if (IsFromStringValue && ((ValidateFromString)_value).FromString == "$Required") { flag = true; targetObject.PropertyIsRequiredForCreation = flag; } if (flag) return; - this._value.Validate(new TypeRestriction(targetObject.ObjectType, TypeSchemaDefinition.Type), context); - if (this._value.HasErrors) - this.MarkHasErrors(); - else if (targetObject.ObjectType.IsAssignableFrom(this._value.ObjectType)) - targetObject.IndirectedObject = this._value; + _value.Validate(new TypeRestriction(targetObject.ObjectType, TypeSchemaDefinition.Type), context); + if (_value.HasErrors) + MarkHasErrors(); + else if (targetObject.ObjectType.IsAssignableFrom(_value.ObjectType)) + targetObject.IndirectedObject = _value; else - targetObject.DynamicConstructionType = this._value; + targetObject.DynamicConstructionType = _value; } } @@ -278,7 +278,7 @@ namespace Microsoft.Iris.Markup.Validation if (context.ActiveSymbolScope != SymbolOrigin.Properties) return false; bool result; - if (this.IsFromStringValue && bool.TryParse(((ValidateFromString)this._value).FromString, out result)) + if (IsFromStringValue && bool.TryParse(((ValidateFromString)_value).FromString, out result)) { if (targetObject.PropertySchemaExport != null && context.Owner.TypeExport != null) { @@ -286,73 +286,73 @@ namespace Microsoft.Iris.Markup.Validation if (context.Owner.TypeExport.MarkupTypeBase != null) propertySchema = context.Owner.TypeExport.MarkupTypeBase.FindPropertyDeep(targetObject.PropertySchemaExport.Name); if (result && propertySchema == null) - this.ReportError("Property '{0}' was specified as Override='true' but no property was found to override", targetObject.PropertySchemaExport.Name); + ReportError("Property '{0}' was specified as Override='true' but no property was found to override", targetObject.PropertySchemaExport.Name); else if (!result && propertySchema != null) - this.ReportError("Property '{0}' was specified as Override='false' but a base property was found", targetObject.PropertySchemaExport.Name); + ReportError("Property '{0}' was specified as Override='false' but a base property was found", targetObject.PropertySchemaExport.Name); } } else - this.ReportError("Property '{0}' must be Boolean 'true' or 'false'", "Override"); - this.MarkAsPseudo(); + ReportError("Property '{0}' must be Boolean 'true' or 'false'", "Override"); + MarkAsPseudo(); return true; } - public bool IsPseudo => this._isPseudo; + public bool IsPseudo => _isPseudo; - public void MarkAsPseudo() => this._isPseudo = true; + public void MarkAsPseudo() => _isPseudo = true; public void RepurposeProperty(string newName, PropertyAttribute newAttributes) { - this._propertyName = newName; - this._propertyAttributeList = newAttributes; + _propertyName = newName; + _propertyAttributeList = newAttributes; } - public bool IsObjectTagValue => this._value != null && this._value.ObjectSourceType == ObjectSourceType.ObjectTag; + public bool IsObjectTagValue => _value != null && _value.ObjectSourceType == ObjectSourceType.ObjectTag; - public bool IsFromStringValue => this._value != null && this._value.ObjectSourceType == ObjectSourceType.FromString; + public bool IsFromStringValue => _value != null && _value.ObjectSourceType == ObjectSourceType.FromString; - public bool IsCodeValue => this._value != null && this._value.ObjectSourceType == ObjectSourceType.Code; + public bool IsCodeValue => _value != null && _value.ObjectSourceType == ObjectSourceType.Code; - public bool IsExpressionValue => this._value != null && this._value.ObjectSourceType == ObjectSourceType.Expression; + public bool IsExpressionValue => _value != null && _value.ObjectSourceType == ObjectSourceType.Expression; public void UpdateFoundProperty(PropertySchema newFoundProperty) { - this._foundProperty = newFoundProperty; - this._foundPropertyIndex = this.Owner.TrackImportedProperty(this._foundProperty); - this._foundPropertyTypeIndex = this.Owner.TrackImportedType(this._foundProperty.PropertyType); + _foundProperty = newFoundProperty; + _foundPropertyIndex = Owner.TrackImportedProperty(_foundProperty); + _foundPropertyTypeIndex = Owner.TrackImportedType(_foundProperty.PropertyType); } - public PropertySchema FoundProperty => this._foundProperty; + public PropertySchema FoundProperty => _foundProperty; - public int FoundPropertyIndex => this._foundPropertyIndex; + public int FoundPropertyIndex => _foundPropertyIndex; - public int FoundPropertyTypeIndex => this._foundPropertyTypeIndex; + public int FoundPropertyTypeIndex => _foundPropertyTypeIndex; - public int ValueCount => this._valueCount; + public int ValueCount => _valueCount; public bool ShouldSkipDictionaryAddIfContains { - get => this._shouldSkipDictionaryAddIfContains; - set => this._shouldSkipDictionaryAddIfContains = value; + get => _shouldSkipDictionaryAddIfContains; + set => _shouldSkipDictionaryAddIfContains = value; } - public ValueApplyMode ValueApplyMode => this._valueApplyMode; + public ValueApplyMode ValueApplyMode => _valueApplyMode; public void ReversePropertyValues() { ValidateObjectTag next; - for (ValidateObjectTag validateObjectTag = (ValidateObjectTag)this._value; validateObjectTag != null; validateObjectTag = next) + for (ValidateObjectTag validateObjectTag = (ValidateObjectTag)_value; validateObjectTag != null; validateObjectTag = next) { next = validateObjectTag.Next; validateObjectTag.Next = null; - if (validateObjectTag != this._value) + if (validateObjectTag != _value) { - validateObjectTag.Next = (ValidateObjectTag)this._value; - this._value = validateObjectTag; + validateObjectTag.Next = (ValidateObjectTag)_value; + _value = validateObjectTag; } } } - public override string ToString() => this._value != null ? string.Format("{0} = {1}", _propertyName, this._value.ToString()) : "Unavailable"; + public override string ToString() => _value != null ? string.Format("{0} = {1}", _propertyName, _value.ToString()) : "Unavailable"; } } diff --git a/UIX/Microsoft/Iris/Markup/Validation/ValidateScripts.cs b/UIX/Microsoft/Iris/Markup/Validation/ValidateScripts.cs index 04e50f2..a5a3d1f 100644 --- a/UIX/Microsoft/Iris/Markup/Validation/ValidateScripts.cs +++ b/UIX/Microsoft/Iris/Markup/Validation/ValidateScripts.cs @@ -13,18 +13,18 @@ namespace Microsoft.Iris.Markup.Validation private ValidateProperty _scriptsProperty; private bool _hasErrors; - public ValidateScripts(ValidateProperty scriptsProperty) => this._scriptsProperty = scriptsProperty; + public ValidateScripts(ValidateProperty scriptsProperty) => _scriptsProperty = scriptsProperty; public void Validate(ValidateContext context) { - if (this._scriptsProperty.Value != null && !this._scriptsProperty.IsCodeValue) + if (_scriptsProperty.Value != null && !_scriptsProperty.IsCodeValue) { - this._scriptsProperty.ReportError("Expecting