feat: rebuilding as .NET Core 2.1 library

This commit is contained in:
Dylan R. E. Moonfire 2018-07-17 13:13:08 -05:00
parent f01a18a15a
commit d83703f309
19 changed files with 361 additions and 413 deletions

View file

@ -1,16 +1,27 @@
# EditorConfig is awesome: http://EditorConfig.org
#
# https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328
# Or install via Extensions inside Visual Studio.
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
charset = utf-8-bom
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
[*.{js,ts}]
quote_type = double
[*.json]
indent_size = 2
tab_width = 2
indent_style = space
[*.yaml]
indent_style = space

63
.gitattributes vendored
View file

@ -1,63 +0,0 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

264
.gitignore vendored
View file

@ -1,261 +1,15 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
launchSettings.json
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
*.user
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
NaNoGenMo.*
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
obj/
[Bb]in/
.vs/
.vscode/
.idea/
*.sln.iml
_ReSharper.Caches/
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
.author-intrusion

View file

@ -1,25 +1,57 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Locking", "MfGames.Locking\MfGames.Locking.csproj", "{51E00BEF-AAF1-4D45-BF82-5DCD7D5EA7FC}"
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EE3B4148-AC01-4E30-93AB-AA6EC2201555}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MfGames.Locking", "src\MfGames.Locking\MfGames.Locking.csproj", "{016D2590-46B8-4776-A7F9-1B0586920932}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.Locking.Tests", "src\MfGames.Locking.Tests\MfGames.Locking.Tests.csproj", "{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{51E00BEF-AAF1-4D45-BF82-5DCD7D5EA7FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51E00BEF-AAF1-4D45-BF82-5DCD7D5EA7FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51E00BEF-AAF1-4D45-BF82-5DCD7D5EA7FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51E00BEF-AAF1-4D45-BF82-5DCD7D5EA7FC}.Release|Any CPU.Build.0 = Release|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Debug|Any CPU.Build.0 = Debug|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Debug|x64.ActiveCfg = Debug|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Debug|x64.Build.0 = Debug|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Debug|x86.ActiveCfg = Debug|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Debug|x86.Build.0 = Debug|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Release|Any CPU.ActiveCfg = Release|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Release|Any CPU.Build.0 = Release|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Release|x64.ActiveCfg = Release|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Release|x64.Build.0 = Release|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Release|x86.ActiveCfg = Release|Any CPU
{016D2590-46B8-4776-A7F9-1B0586920932}.Release|x86.Build.0 = Release|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Debug|x64.ActiveCfg = Debug|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Debug|x64.Build.0 = Debug|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Debug|x86.ActiveCfg = Debug|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Debug|x86.Build.0 = Debug|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Release|Any CPU.Build.0 = Release|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Release|x64.ActiveCfg = Release|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Release|x64.Build.0 = Release|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Release|x86.ActiveCfg = Release|Any CPU
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{016D2590-46B8-4776-A7F9-1B0586920932} = {EE3B4148-AC01-4E30-93AB-AA6EC2201555}
{50475AFD-8D3A-4AB2-9B16-A2FC3D6AE05C} = {EE3B4148-AC01-4E30-93AB-AA6EC2201555}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FED5BE58-8CEB-48E6-82E0-0B80035F4AEA}
SolutionGuid = {78D75C86-DAB1-43D2-AD2D-B0D57EDF2ED3}
EndGlobalSection
EndGlobal

View file

@ -37,11 +37,12 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022Xaml_002EBindingWithoutContextReferenceNotResolvedHighlighting_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CStaticSeverity_0020Severity_003D_00222_0022_0020Title_003D_0022Structural_0020Search_0020Hints_0022_0020GroupId_003D_0022StructuralSearch_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseStringInterpolation/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Full_0020WEI_0020Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Full WEI Cleanup"&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_BOTH&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;IMPLICIT_WHEN_INITIALIZER_HAS_TYPE&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;Namespaces&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSArrangeQualifiers&gt;True&lt;/CSArrangeQualifiers&gt;&lt;CSEnforceVarKeywordUsageSettings&gt;True&lt;/CSEnforceVarKeywordUsageSettings&gt;&lt;CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="False" AddMissingParentheses="True" ArrangeBraces="False" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" /&gt;&lt;CSMakeAutoPropertyGetOnly&gt;True&lt;/CSMakeAutoPropertyGetOnly&gt;&lt;FormatAttributeQuoteDescriptor&gt;True&lt;/FormatAttributeQuoteDescriptor&gt;&lt;CSFixBuiltinTypeReferences&gt;True&lt;/CSFixBuiltinTypeReferences&gt;&lt;CSUpdateFileHeader&gt;True&lt;/CSUpdateFileHeader&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;JsFormatDocComments&gt;True&lt;/JsFormatDocComments&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Project/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Project"&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_BOTH&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;IMPLICIT_WHEN_INITIALIZER_HAS_TYPE&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;Namespaces&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSArrangeQualifiers&gt;True&lt;/CSArrangeQualifiers&gt;&lt;CSEnforceVarKeywordUsageSettings&gt;True&lt;/CSEnforceVarKeywordUsageSettings&gt;&lt;CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="False" AddMissingParentheses="True" ArrangeBraces="False" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" /&gt;&lt;CSMakeAutoPropertyGetOnly&gt;True&lt;/CSMakeAutoPropertyGetOnly&gt;&lt;FormatAttributeQuoteDescriptor&gt;True&lt;/FormatAttributeQuoteDescriptor&gt;&lt;CSFixBuiltinTypeReferences&gt;True&lt;/CSFixBuiltinTypeReferences&gt;&lt;CSUpdateFileHeader&gt;True&lt;/CSUpdateFileHeader&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;JsFormatDocComments&gt;True&lt;/JsFormatDocComments&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Remove_0020Redundant_0020Qualifiers/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Remove Redundant Qualifiers"&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;False&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;False&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;DISABLED&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;IMPLICIT_WHEN_INITIALIZER_HAS_TYPE&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSUpdateFileHeader&gt;False&lt;/CSUpdateFileHeader&gt;&lt;VBOptimizeImports&gt;False&lt;/VBOptimizeImports&gt;&lt;VBShortenReferences&gt;False&lt;/VBShortenReferences&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName /&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;VBReformatCode&gt;False&lt;/VBReformatCode&gt;&lt;CSReformatCode&gt;False&lt;/CSReformatCode&gt;&lt;CSReorderTypeMembers&gt;False&lt;/CSReorderTypeMembers&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Full Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Full WEI Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Project</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CommonFormatter/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">OPTIMAL_FILL</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CommonFormatter/END_OF_LINE/@EntryValue">LF</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CommonFormatter/ENFORCE_LINE_ENDING_STYLE/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CommonFormatter/USE_INDENTS_FROM_MAIN_LANGUAGE_IN_FILE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/APPLY_ON_COMPLETION/@EntryValue">True</s:Boolean>
@ -67,7 +68,7 @@
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_PROPERTY/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BEFORE_SINGLE_LINE_COMMENT/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BETWEEN_USING_GROUPS/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CASE_BLOCK_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">SEPARATE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
@ -522,13 +523,13 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
<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/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">&lt;copyright file="$FILENAME$" company="Moonfire Games"&gt;&#xD;
Copyright (c) Moonfire Games.&#xD;
This code is licensed under the MIT license.&#xD;
See LICENSE.md in the source or https://opensource.org/licenses/MIT&#xD;
Copyright (c) Moonfire Games. MIT License.&#xD;
&lt;/copyright&gt;&#xD;
</s:String>
<s:Boolean x:Key="/Default/CodeStyle/LiveTemplatesUseVar/UseVar/@EntryValue">False</s:Boolean>
@ -640,6 +641,7 @@ See LICENSE.md in the source or https://opensource.org/licenses/MIT&#xD;
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=NAMESPACE_005FALIAS/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/PsiConfigurationSettingsKey/CustomLocation/@EntryValue">C:\Users\rc04727\AppData\Local\JetBrains\Transient\ReSharperPlatformVs15\v11_ede7cb44\SolutionCaches</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=AutoRecoverer/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=Format/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=Roslyn_002Dswea/@EntryIndexedValue">DO_NOTHING</s:String>
@ -671,6 +673,8 @@ See LICENSE.md in the source or https://opensource.org/licenses/MIT&#xD;
<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">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters&gt;&lt;Filter ModuleMask="MfGames.Locking.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;/ExcludeFilters&gt;&lt;/data&gt;</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>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/QuickList/=32F5B2BD4CFE0E42ADE73B7FB68EBDD0/Entry/=4EE6D125A668F541B499E002F8C91EA6/EntryName/@EntryValue">( )</s:String>

View file

@ -1,39 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net452;net461;netstandard1.6;netstandard2.0;netcoreapp2.0</TargetFrameworks>
<PackageId>MfGames.Locking</PackageId>
<PackageVersion>5.0.0</PackageVersion>
<Authors>Dylan R. E. Moonfire</Authors>
<Description>Various locking patterns for multi-threaded code.</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Copyright>Copyright (c) Moonfire Games. MIT license.</Copyright>
<PackageTags>lock; locking</PackageTags>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.0\MfGames.Locking.xml</DocumentationFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile />
</PropertyGroup>
<ItemGroup>
<None Remove="stylecop.json" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="stylecop.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

View file

@ -1,11 +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) {companyName}.\nThis code is licensed under the MIT license.\nSee LICENSE.md in the source or https://opensource.org/licenses/MIT"
}
}
}

View file

@ -0,0 +1,209 @@
// <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;
public class LockTests
{
public static readonly TimeSpan ProcessTime = TimeSpan.FromMilliseconds(50);
private readonly List<int> events;
private readonly ReaderWriterLockSlim locker;
private readonly ITestOutputHelper output;
private readonly DateTime start;
public LockTests(ITestOutputHelper output)
{
this.output = output;
this.start = DateTime.UtcNow;
this.locker = new ReaderWriterLockSlim();
this.events = new List<int>();
}
private TimeSpan Elapsed => DateTime.UtcNow - this.start;
[Fact]
public void BasicDataGatheringWorks()
{
this.Report(ProcessTime, 1);
this.Verify();
}
[Fact]
public void ReadBlocksWrite()
{
Task.WaitAll(
Task.Run(() => this.ReportInReadLock(ProcessTime * 0, ProcessTime * 3, 1)),
Task.Run(() => this.ReportInWriteLock(ProcessTime * 1, ProcessTime * 1, 2)));
this.Verify();
}
[Fact]
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)));
this.Verify();
}
[Fact]
public void ThreadedDataGatheringWorks()
{
Task.WaitAll(
Task.Run(() => this.ReportInReadLock(ProcessTime, ProcessTime, 1)));
this.Verify();
}
[Fact]
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)));
this.Verify();
}
[Fact]
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)));
this.Verify();
}
[Fact]
public void WriteBlockRead()
{
Task.WaitAll(
Task.Run(() => this.ReportInWriteLock(ProcessTime, ProcessTime * 3, 1)),
Task.Run(() => this.ReportInReadLock(ProcessTime * 2, ProcessTime, 2)));
this.Verify();
}
[Fact]
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)));
this.Verify();
}
private void AddEvent(int sequence)
{
// 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.events.Add(sequence);
}
}
/// <summary>
/// Waits a short period of time and then injects the sequence into the event list.
/// </summary>
private void Report(
TimeSpan processTime,
int sequence)
{
this.output.WriteLine(this.Elapsed + ": " + sequence + " => starting process");
Thread.Sleep(processTime);
this.output.WriteLine(this.Elapsed + ": " + sequence + " => finished process");
this.AddEvent(sequence);
}
private void ReportInReadLock(
TimeSpan settleTime,
TimeSpan processTime,
int sequence)
{
this.output.WriteLine(this.Elapsed + ": " + sequence + " => entering read lock: " + sequence);
Thread.Sleep(settleTime);
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.Report(processTime, sequence);
}
}
private void ReportInUpgradableLock(
TimeSpan settleTime,
TimeSpan processTime,
int sequence)
{
this.output.WriteLine(this.Elapsed + ": " + sequence + " => entering upgradable lock: " + sequence);
Thread.Sleep(settleTime);
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.Report(processTime, sequence);
}
}
private void ReportInWriteLock(
TimeSpan settleTime,
TimeSpan processTime,
int sequence)
{
this.output.WriteLine(this.Elapsed + ": " + sequence + " => entering write lock: " + sequence);
Thread.Sleep(settleTime);
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.Report(processTime, sequence);
}
}
/// <summary>
/// Verifies the sequence of events.
/// </summary>
private void Verify()
{
this.output.WriteLine("Final Sequence: " + string.Join(", ", this.events));
for (int i = 1; i <= this.events.Count; i++)
{
Assert.Equal(i, this.events[i - 1]);
}
}
}
}

View file

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MfGames.Locking\MfGames.Locking.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Authors>Dylan Moonfire</Authors>
<Company>Moonfire Games</Company>
<RepositoryUrl>https://gitlab.com/dmoonfire/mfgames-locking-cil</RepositoryUrl>
<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>
<Description>An IDisposable pattern for using ReaderWriterLockSlim.</Description>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\bin</OutputPath>
<DocumentationFile>..\..\bin\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\bin</OutputPath>
<DocumentationFile>..\..\bin\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Serialization\**" />
<EmbeddedResource Remove="Serialization\**" />
<None Remove="Serialization\**" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="../stylecop.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" PrivateAssets="All" />
</ItemGroup>
</Project>

View file

@ -1,7 +1,5 @@
// <copyright file="NestableReadLock.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="NestableUpgradableReadLock.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="NestableWriteLock.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="ReadLock.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="TryGetCreate.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="TryGetHandler.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="UpgradableLock.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

View file

@ -1,7 +1,5 @@
// <copyright file="WriteLock.cs" company="Moonfire Games">
// Copyright (c) Moonfire Games.
// This code is licensed under the MIT license.
// See LICENSE.md in the source or https://opensource.org/licenses/MIT
// Copyright (c) Moonfire Games. MIT License.
// </copyright>
namespace MfGames.Locking

10
src/stylecop.json Normal file
View file

@ -0,0 +1,10 @@
{
"$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."
}
}
}