chore: cleaning up code and reformatting
This commit is contained in:
parent
d83703f309
commit
8ef93d81a9
14 changed files with 395 additions and 153 deletions
123
.editorconfig
123
.editorconfig
|
@ -1,27 +1,122 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line = lf
|
||||
indent_brace_style = K&R
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline=true
|
||||
max_line_length = 120
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
curly_bracket_next_line = true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
|
||||
[*.{js,ts}]
|
||||
quote_type = double
|
||||
# Microsoft .NET properties
|
||||
csharp_new_line_before_members_in_object_initializers=false
|
||||
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
||||
csharp_space_after_cast=false
|
||||
csharp_style_var_elsewhere=false:hint
|
||||
csharp_style_var_for_built_in_types=false:hint
|
||||
csharp_style_var_when_type_is_apparent=true:hint
|
||||
csharp_preserve_single_line_statements=false
|
||||
csharp_preserve_single_line_blocks=true
|
||||
dotnet_style_predefined_type_for_locals_parameters_members=true:hint
|
||||
dotnet_style_predefined_type_for_member_access=true:hint
|
||||
dotnet_style_qualification_for_event=true:hint
|
||||
dotnet_style_qualification_for_field=true:hint
|
||||
dotnet_style_qualification_for_method=true:hint
|
||||
dotnet_style_qualification_for_property=true:hint
|
||||
dotnet_style_require_accessibility_modifiers=for_non_interface_members:hint
|
||||
|
||||
[*.json]
|
||||
# ReSharper properties
|
||||
resharper_alignment_tab_fill_style=optimal_fill
|
||||
resharper_apply_on_completion=true
|
||||
resharper_blank_lines_after_control_transfer_statements=1
|
||||
resharper_blank_lines_around_single_line_auto_property=1
|
||||
resharper_blank_lines_around_single_line_property=1
|
||||
resharper_blank_lines_before_single_line_comment=1
|
||||
resharper_blank_lines_between_using_groups=1
|
||||
resharper_braces_for_for=required
|
||||
resharper_braces_for_foreach=required
|
||||
resharper_braces_for_ifelse=required
|
||||
resharper_braces_for_while=required
|
||||
resharper_can_use_global_alias=false
|
||||
resharper_csharp_blank_lines_around_single_line_field=1
|
||||
resharper_csharp_blank_lines_around_single_line_invocable=1
|
||||
resharper_csharp_indent_style=tab
|
||||
resharper_csharp_insert_final_newline=true
|
||||
resharper_csharp_keep_blank_lines_in_code=1
|
||||
resharper_csharp_keep_blank_lines_in_declarations=1
|
||||
resharper_csharp_new_line_before_while=true
|
||||
resharper_csharp_use_indent_from_vs=false
|
||||
resharper_csharp_wrap_arguments_style=chop_if_long
|
||||
resharper_csharp_wrap_extends_list_style=chop_if_long
|
||||
resharper_csharp_wrap_parameters_style=chop_if_long
|
||||
resharper_css_insert_final_newline=false
|
||||
resharper_enforce_line_ending_style=true
|
||||
resharper_html_insert_final_newline=false
|
||||
resharper_indent_nested_fixed_stmt=true
|
||||
resharper_js_indent_style=tab
|
||||
resharper_js_insert_final_newline=true
|
||||
resharper_js_keep_blank_lines_in_code=1
|
||||
resharper_js_stick_comment=false
|
||||
resharper_js_use_indent_from_vs=false
|
||||
resharper_js_wrap_before_binary_opsign=true
|
||||
resharper_js_wrap_chained_method_calls=chop_if_long
|
||||
resharper_keep_blank_lines_between_declarations=1
|
||||
resharper_min_blank_lines_after_imports=1
|
||||
resharper_place_attribute_on_same_line=False
|
||||
resharper_place_constructor_initializer_on_same_line=false
|
||||
resharper_place_type_constraints_on_same_line=false
|
||||
resharper_protobuf_insert_final_newline=false
|
||||
resharper_qualified_using_at_nested_scope=true
|
||||
resharper_resx_insert_final_newline=false
|
||||
resharper_space_within_single_line_array_initializer_braces=true
|
||||
resharper_use_indents_from_main_language_in_file=false
|
||||
resharper_vb_insert_final_newline=false
|
||||
resharper_wrap_after_declaration_lpar=true
|
||||
resharper_wrap_after_invocation_lpar=true
|
||||
resharper_wrap_before_extends_colon=true
|
||||
resharper_wrap_before_first_type_parameter_constraint=true
|
||||
resharper_wrap_before_type_parameter_langle=true
|
||||
resharper_xmldoc_indent_child_elements=ZeroIndent
|
||||
resharper_xmldoc_indent_text=ZeroIndent
|
||||
resharper_xmldoc_insert_final_newline=false
|
||||
resharper_xml_insert_final_newline=false
|
||||
|
||||
# ReSharper inspection severities
|
||||
resharper_check_namespace_highlighting=none
|
||||
resharper_convert_to_auto_property_highlighting=none
|
||||
resharper_localizable_element_highlighting=none
|
||||
resharper_redundant_comma_in_attribute_list_highlighting=none
|
||||
resharper_redundant_comma_in_enum_declaration_highlighting=none
|
||||
resharper_redundant_comma_in_initializer_highlighting=none
|
||||
resharper_string_compare_to_is_culture_specific_highlighting=none
|
||||
resharper_string_index_of_is_culture_specific_1_highlighting=none
|
||||
resharper_use_null_propagation_highlighting=none
|
||||
resharper_use_object_or_collection_initializer_highlighting=hint
|
||||
resharper_use_string_interpolation_highlighting=hint
|
||||
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[{package.json,.travis.yml}]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
tab_width=2
|
||||
indent_style = space
|
||||
|
||||
[*.yaml]
|
||||
[*.{cs,js,json,jsx,proto,resjson,ts,tsx}]
|
||||
indent_style=space
|
||||
indent_size=space
|
||||
tab_width=4
|
||||
|
||||
[*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}]
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
tab_width=4
|
||||
|
||||
[*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
tab_width=2
|
||||
|
||||
[*.proto]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
tab_width=2
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeEditing/GenerateMemberBody/DocumentationGenerationKind/@EntryValue">Inherit</s:String>
|
||||
|
||||
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CheckNamespace/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
|
@ -53,10 +54,11 @@
|
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">15</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">OPTIMAL_FILL</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXPRESSION/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_FOR_STMT/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">False</s:Boolean>
|
||||
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTIPLE_DECLARATION/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_LIST/@EntryValue">False</s:Boolean>
|
||||
|
@ -82,7 +84,9 @@
|
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_EXISTING_DECLARATION_PARENS_ARRANGEMENT/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/NESTED_TERNARY_STYLE/@EntryValue">EXPANDED</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
|
@ -96,15 +100,21 @@
|
|||
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/STICK_COMMENT/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/USE_INDENT_FROM_VS/@EntryValue">False</s:Boolean>
|
||||
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_DECLARATION_LPAR/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARRAY_INITIALIZER_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_EXTENDS_COLON/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_TYPE_PARAMETER_LANGLE/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_BINARY_EXPRESSIONS/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_METHOD_CALLS/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_EXTENDS_LIST_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">80</s:Int64>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_PARAMETERS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CssFormatter/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">OPTIMAL_FILL</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/HtmlFormatter/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">OPTIMAL_FILL</s:String>
|
||||
|
@ -128,6 +138,7 @@
|
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">OPTIMAL_FILL</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/IndentSubtags/@EntryValue">ZeroIndent</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/IndentTagContent/@EntryValue">ZeroIndent</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/WRAP_LIMIT/@EntryValue">80</s:Int64>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">OPTIMAL_FILL</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue"><?xml version="1.0" encoding="utf-16"?>
|
||||
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
|
||||
|
@ -521,17 +532,14 @@ II.2.12 <HandlesEvent />
|
|||
</Patterns>
|
||||
</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpMemberOrderPattern/LayoutType/@EntryValue">CustomLayout</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/CanUseGlobalAlias/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseVarWhenEvident</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseVarWhenEvident</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/EditorConfig/EnableStyleCopSupport/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue"><copyright file="$FILENAME$" company="Moonfire Games">
|
||||
Copyright (c) Moonfire Games. MIT License.
|
||||
</copyright>
|
||||
</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue"></s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/LiveTemplatesUseVar/UseVar/@EntryValue">False</s:Boolean>
|
||||
|
||||
|
||||
|
@ -660,6 +668,7 @@ Copyright (c) Moonfire Games. MIT License.
|
|||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
|
@ -669,11 +678,11 @@ Copyright (c) Moonfire Games. MIT License.
|
|||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsCodeFormatterSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsParsFormattingSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsWrapperSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EVB_002ECodeStyle_002ESettingsUpgrade_002EVBSpaceAfterUnaryMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/UnitTesting/DisabledProviders/=MSTest/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/NUnitProvider/UseNUnit3/@EntryValue">Always</s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/UnitTesting/ShadowCopy/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue"><data><IncludeFilters /><ExcludeFilters><Filter ModuleMask="MfGames.Locking.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /></ExcludeFilters></data></s:String>
|
||||
<s:String x:Key="/Default/Housekeeping/Layout/SolBuilderDuoView/ShowBuildResultsMode/@EntryValue">ForWarningsOrErrors</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/QuickList/=32F5B2BD4CFE0E42ADE73B7FB68EBDD0/Entry/=4C84A7D189E28A43AA2631BBE4694112/EntryName/@EntryValue">tag</s:String>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/QuickList/=32F5B2BD4CFE0E42ADE73B7FB68EBDD0/Entry/=4C84A7D189E28A43AA2631BBE4694112/Position/@EntryValue">10</s:Int64>
|
||||
|
@ -969,6 +978,24 @@ $END$
|
|||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4EE6D125A668F541B499E002F8C91EA6/Scope/=E6E678D4B937A84D8C4585DDD2F27DB0/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4EE6D125A668F541B499E002F8C91EA6/Scope/=E6E678D4B937A84D8C4585DDD2F27DB0/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4EE6D125A668F541B499E002F8C91EA6/Scope/=E6E678D4B937A84D8C4585DDD2F27DB0/Type/@EntryValue">InCSharpExpression</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Description/@EntryValue">Inserts a strongly-type identifier property.</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Field/=Type/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Field/=Type/Order/@EntryValue">0</s:Int64>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Field/=When/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Field/=When/Expression/@EntryValue">getCurrentTime("yyyy_MM_dd_HHmmss")</s:String>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Field/=When/InitialRange/@EntryValue">-1</s:Int64>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Field/=When/Order/@EntryValue">1</s:Int64>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Reformat/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Scope/=C3001E7C0DA78E4487072B7E050D86C5/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Scope/=C3001E7C0DA78E4487072B7E050D86C5/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Scope/=C3001E7C0DA78E4487072B7E050D86C5/Type/@EntryValue">InCSharpFile</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Shortcut/@EntryValue">InsertIdProperty</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/ShortenQualifiedReferences/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4F3AD8F5DF3C364484232DF4AF67AA51/Text/@EntryValue"> /// <inheritdoc />
|
||||
public override $Type$Id $Type$Id => new $Type$Id($When$);
|
||||
</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=545048523B7C7941957D94940296431C/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=545048523B7C7941957D94940296431C/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=545048523B7C7941957D94940296431C/Categories/=Imported_00201_002F13_002F2012/@EntryIndexedValue">Imported 1/13/2012</s:String>
|
||||
|
@ -1001,6 +1028,26 @@ $END$</s:String>
|
|||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=545048523B7C7941957D94940296431C/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=545048523B7C7941957D94940296431C/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=545048523B7C7941957D94940296431C/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Description/@EntryValue">Inserts a strongly-typed identifier.</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=Type/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=Type/Order/@EntryValue">0</s:Int64>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=v/@KeyIndexDefined">False</s:Boolean>
|
||||
|
||||
|
||||
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=When/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=When/Expression/@EntryValue">getCurrentTime("yyyy_MM_dd_HHmmss")</s:String>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=When/InitialRange/@EntryValue">-1</s:Int64>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Field/=When/Order/@EntryValue">1</s:Int64>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Reformat/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Scope/=C3001E7C0DA78E4487072B7E050D86C5/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Scope/=C3001E7C0DA78E4487072B7E050D86C5/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Scope/=C3001E7C0DA78E4487072B7E050D86C5/Type/@EntryValue">InCSharpFile</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Shortcut/@EntryValue">InsertId</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/ShortenQualifiedReferences/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=67C8134CFAF35D4C808C6D875D9C5664/Text/@EntryValue">new $Type$Id($When$)</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=77A68208F358434497E992158D06197B/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=77A68208F358434497E992158D06197B/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=77A68208F358434497E992158D06197B/Description/@EntryValue">Calls the session server to validate a user</s:String>
|
||||
|
@ -1180,23 +1227,36 @@ if ($CollectionType$Collection.Count > 0)
|
|||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=B32FEF31AA09414AB47F1EEA3625907F/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=B32FEF31AA09414AB47F1EEA3625907F/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=B32FEF31AA09414AB47F1EEA3625907F/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Applicability/=Surround/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Categories/=Imported_00201_002F13_002F2012/@EntryIndexedValue">Imported 1/13/2012</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Categories/=WEI_0020Standard/@EntryIndexedValue">WEI Standard</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Description/@EntryValue">#region (WEI)</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Reformat/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Shortcut/@EntryValue">#region(WEI)</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/ShortenQualifiedReferences/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Text/@EntryValue">#region $RegionName$$END$
|
||||
$SELECTION$
|
||||
#endregion $RegionName$
|
||||
</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Field/=RegionName/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Field/=RegionName/Order/@EntryValue">0</s:Int64>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Scope/=C3001E7C0DA78E4487072B7E050D86C5/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Scope/=C3001E7C0DA78E4487072B7E050D86C5/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/Scope/=C3001E7C0DA78E4487072B7E050D86C5/Type/@EntryValue">InCSharpFile</s:String>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CAB80A3A33B30B40952EEB95DF15BC47/@KeyIndexDefined">False</s:Boolean>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=CB679803BBC2764A9BE443499424A817/@KeyIndexDefined">False</s:Boolean>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=D4AA4DA08F1F4444BC18D5C7993DF382/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=D4AA4DA08F1F4444BC18D5C7993DF382/Applicability/=Live/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=D4AA4DA08F1F4444BC18D5C7993DF382/Categories/=Imported_00201_002F13_002F2012/@EntryIndexedValue">Imported 1/13/2012</s:String>
|
||||
|
@ -1304,4 +1364,5 @@ using(DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(ConnectionStri
|
|||
<s:Int64 x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Field/=EntityType/Order/@EntryValue">0</s:Int64>
|
||||
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String></wpf:ResourceDictionary>
|
||||
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String>
|
||||
</wpf:ResourceDictionary>
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
// <copyright file="LockTests.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
|
||||
namespace MfGames.Locking.Tests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace MfGames.Locking.Tests
|
||||
{
|
||||
public class LockTests
|
||||
{
|
||||
public static readonly TimeSpan ProcessTime = TimeSpan.FromMilliseconds(50);
|
||||
public static readonly TimeSpan ProcessTime =
|
||||
TimeSpan.FromMilliseconds(50);
|
||||
|
||||
private readonly List<int> events;
|
||||
|
||||
|
@ -44,8 +42,16 @@ namespace MfGames.Locking.Tests
|
|||
public void ReadBlocksWrite()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 0, ProcessTime * 3, 1)),
|
||||
Task.Run(() => this.ReportInWriteLock(ProcessTime * 1, ProcessTime * 1, 2)));
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 0,
|
||||
ProcessTime * 3,
|
||||
1)),
|
||||
Task.Run(
|
||||
() => this.ReportInWriteLock(
|
||||
ProcessTime * 1,
|
||||
ProcessTime * 1,
|
||||
2)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -54,9 +60,21 @@ namespace MfGames.Locking.Tests
|
|||
public void ReadsDoNotBlockReads()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime, ProcessTime * 5, 3)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime, 1)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime * 2, 2)));
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime,
|
||||
ProcessTime * 5,
|
||||
3)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime,
|
||||
1)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime * 2,
|
||||
2)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -65,7 +83,8 @@ namespace MfGames.Locking.Tests
|
|||
public void ThreadedDataGatheringWorks()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime, ProcessTime, 1)));
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(ProcessTime, ProcessTime, 1)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -74,9 +93,21 @@ namespace MfGames.Locking.Tests
|
|||
public void UpgradableBlocksUpgradable()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInUpgradableLock(ProcessTime, ProcessTime * 5, 1)),
|
||||
Task.Run(() => this.ReportInUpgradableLock(ProcessTime * 3, ProcessTime, 2)),
|
||||
Task.Run(() => this.ReportInUpgradableLock(ProcessTime * 2, ProcessTime * 2, 3)));
|
||||
Task.Run(
|
||||
() => this.ReportInUpgradableLock(
|
||||
ProcessTime,
|
||||
ProcessTime * 5,
|
||||
1)),
|
||||
Task.Run(
|
||||
() => this.ReportInUpgradableLock(
|
||||
ProcessTime * 3,
|
||||
ProcessTime,
|
||||
2)),
|
||||
Task.Run(
|
||||
() => this.ReportInUpgradableLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime * 2,
|
||||
3)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -85,9 +116,21 @@ namespace MfGames.Locking.Tests
|
|||
public void UpgradableDoesNotBlockReads()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInUpgradableLock(ProcessTime, ProcessTime * 5, 3)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime, 1)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime * 2, 2)));
|
||||
Task.Run(
|
||||
() => this.ReportInUpgradableLock(
|
||||
ProcessTime,
|
||||
ProcessTime * 5,
|
||||
3)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime,
|
||||
1)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime * 2,
|
||||
2)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -96,8 +139,16 @@ namespace MfGames.Locking.Tests
|
|||
public void WriteBlockRead()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInWriteLock(ProcessTime, ProcessTime * 3, 1)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime, 2)));
|
||||
Task.Run(
|
||||
() => this.ReportInWriteLock(
|
||||
ProcessTime,
|
||||
ProcessTime * 3,
|
||||
1)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime,
|
||||
2)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -106,9 +157,21 @@ namespace MfGames.Locking.Tests
|
|||
public void WriteBlockReads()
|
||||
{
|
||||
Task.WaitAll(
|
||||
Task.Run(() => this.ReportInWriteLock(ProcessTime, ProcessTime * 5, 1)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime, 2)),
|
||||
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime * 2, 3)));
|
||||
Task.Run(
|
||||
() => this.ReportInWriteLock(
|
||||
ProcessTime,
|
||||
ProcessTime * 5,
|
||||
1)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime,
|
||||
2)),
|
||||
Task.Run(
|
||||
() => this.ReportInReadLock(
|
||||
ProcessTime * 2,
|
||||
ProcessTime * 2,
|
||||
3)));
|
||||
|
||||
this.Verify();
|
||||
}
|
||||
|
@ -118,7 +181,8 @@ namespace MfGames.Locking.Tests
|
|||
// This is a monitor lock on the slim, just to give us a second lock.
|
||||
lock (this.locker)
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => adding sequence");
|
||||
this.output.WriteLine(
|
||||
this.Elapsed + ": " + sequence + " => adding sequence");
|
||||
this.events.Add(sequence);
|
||||
}
|
||||
}
|
||||
|
@ -130,9 +194,11 @@ namespace MfGames.Locking.Tests
|
|||
TimeSpan processTime,
|
||||
int sequence)
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => starting process");
|
||||
this.output.WriteLine(
|
||||
this.Elapsed + ": " + sequence + " => starting process");
|
||||
Thread.Sleep(processTime);
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => finished process");
|
||||
this.output.WriteLine(
|
||||
this.Elapsed + ": " + sequence + " => finished process");
|
||||
this.AddEvent(sequence);
|
||||
}
|
||||
|
||||
|
@ -141,15 +207,30 @@ namespace MfGames.Locking.Tests
|
|||
TimeSpan processTime,
|
||||
int sequence)
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => entering read lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => entering read lock: "
|
||||
+ sequence);
|
||||
|
||||
Thread.Sleep(settleTime);
|
||||
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => locking read lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => locking read lock: "
|
||||
+ sequence);
|
||||
|
||||
using (new ReadLock(this.locker))
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => starting read lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => starting read lock: "
|
||||
+ sequence);
|
||||
|
||||
this.Report(processTime, sequence);
|
||||
}
|
||||
|
@ -160,15 +241,30 @@ namespace MfGames.Locking.Tests
|
|||
TimeSpan processTime,
|
||||
int sequence)
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => entering upgradable lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => entering upgradable lock: "
|
||||
+ sequence);
|
||||
|
||||
Thread.Sleep(settleTime);
|
||||
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => locking upgradable lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => locking upgradable lock: "
|
||||
+ sequence);
|
||||
|
||||
using (new UpgradableLock(this.locker))
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => starting upgradable lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => starting upgradable lock: "
|
||||
+ sequence);
|
||||
|
||||
this.Report(processTime, sequence);
|
||||
}
|
||||
|
@ -179,15 +275,30 @@ namespace MfGames.Locking.Tests
|
|||
TimeSpan processTime,
|
||||
int sequence)
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => entering write lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => entering write lock: "
|
||||
+ sequence);
|
||||
|
||||
Thread.Sleep(settleTime);
|
||||
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => locking write lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => locking write lock: "
|
||||
+ sequence);
|
||||
|
||||
using (new WriteLock(this.locker))
|
||||
{
|
||||
this.output.WriteLine(this.Elapsed + ": " + sequence + " => starting write lock: " + sequence);
|
||||
this.output.WriteLine(
|
||||
this.Elapsed
|
||||
+ ": "
|
||||
+ sequence
|
||||
+ " => starting write lock: "
|
||||
+ sequence);
|
||||
|
||||
this.Report(processTime, sequence);
|
||||
}
|
||||
|
@ -198,7 +309,8 @@ namespace MfGames.Locking.Tests
|
|||
/// </summary>
|
||||
private void Verify()
|
||||
{
|
||||
this.output.WriteLine("Final Sequence: " + string.Join(", ", this.events));
|
||||
this.output.WriteLine(
|
||||
"Final Sequence: " + string.Join(", ", this.events));
|
||||
|
||||
for (int i = 1; i <= this.events.Count; i++)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
|
||||
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<RepositoryType>Git</RepositoryType>
|
||||
<PackageTags>locking</PackageTags>
|
||||
<PackageProjectUrl>https://gitlab.com/dmoonfire/mfgames-locking-cil</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://gitlab.com/dmoonfire/mfgames-locking-cil/blob/master/LICENSE.txt</PackageLicenseUrl>
|
||||
<PackageLicense>MIT</PackageLicense>
|
||||
<Description>An IDisposable pattern for using ReaderWriterLockSlim.</Description>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
@ -28,10 +28,14 @@
|
|||
<None Remove="Serialization\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="../stylecop.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" PrivateAssets="All" />
|
||||
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="NestableReadLock.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a ReaderWriterLockSlim read-only lock.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="NestableUpgradableReadLock.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a ReaderWriterLockSlim upgradable read lock.
|
||||
/// </summary>
|
||||
|
@ -17,10 +13,12 @@ namespace MfGames.Locking
|
|||
private readonly ReaderWriterLockSlim readerWriterLockSlim;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NestableUpgradableReadLock" /> class.
|
||||
/// Initializes a new instance of the <see cref="NestableUpgradableReadLock" />
|
||||
/// class.
|
||||
/// </summary>
|
||||
/// <param name="readerWriterLockSlim">The reader writer lock slim.</param>
|
||||
public NestableUpgradableReadLock(ReaderWriterLockSlim readerWriterLockSlim)
|
||||
public NestableUpgradableReadLock(
|
||||
ReaderWriterLockSlim readerWriterLockSlim)
|
||||
{
|
||||
// Keep track of the lock since we'll need it to release the lock.
|
||||
this.readerWriterLockSlim = readerWriterLockSlim;
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="NestableWriteLock.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a ReaderWriterLockSlim write lock.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="ReadLock.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Defines a ReaderWriterLockSlim read-only lock.
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="TryGetCreate.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
/// <summary>
|
||||
/// Implements the basic pattern for getting an item from a cache using
|
||||
/// the ReaderWriterLockSlim class. This attempts to get it using a read-only
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
// <copyright file="TryGetHandler.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
|
||||
namespace MfGames.Locking
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the common try/get handler to retrieve an item of a given type.
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="UpgradableLock.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a ReaderWriterLockSlim read-only lock.
|
||||
/// </summary>
|
||||
|
@ -25,7 +21,8 @@ namespace MfGames.Locking
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or
|
||||
/// resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
// <copyright file="WriteLock.cs" company="Moonfire Games">
|
||||
// Copyright (c) Moonfire Games. MIT License.
|
||||
// </copyright>
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace MfGames.Locking
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a ReaderWriterLockSlim read-only lock.
|
||||
/// </summary>
|
||||
|
@ -25,7 +21,8 @@ namespace MfGames.Locking
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or
|
||||
/// resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"$schema":
|
||||
"https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
"documentationRules": {
|
||||
"companyName": "Moonfire Games",
|
||||
"copyrightText": "Copyright (c) Moonfire Games. MIT License."
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue