From 047522069c65ac64de557b1cbf63fe7efc392b15 Mon Sep 17 00:00:00 2001 From: laqieer Date: Mon, 12 Sep 2022 16:30:05 +0800 Subject: [PATCH] Remove Contracts because it is not supported in recent Visual Studio anymore --- Event Assembler/Core/Core.csproj | 6 ++++-- .../Core/Properties/Resources.Designer.cs | 2 +- Event Assembler/Core/app.config | 2 +- .../Collections/Lists/LinkedArrayList.cs | 19 +++++++++++-------- Nintenlord/Nintenlord.csproj | 9 +++++++-- Nintenlord/Utility/SharedDirtyBuffer.cs | 4 ++-- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Event Assembler/Core/Core.csproj b/Event Assembler/Core/Core.csproj index f1a3e6b..419f2ce 100644 --- a/Event Assembler/Core/Core.csproj +++ b/Event Assembler/Core/Core.csproj @@ -1,5 +1,5 @@  - + Debug @@ -7,7 +7,7 @@ {224C71E2-5E52-4910-910A-6FA9C2F937BE} Exe Core - v4.0 + v4.8 512 Nintenlord.Event_Assembler.Core @@ -37,6 +37,7 @@ 4 true false + false AnyCPU @@ -46,6 +47,7 @@ TRACE prompt 4 + false diff --git a/Event Assembler/Core/Properties/Resources.Designer.cs b/Event Assembler/Core/Properties/Resources.Designer.cs index c4b3f39..4460d24 100644 --- a/Event Assembler/Core/Properties/Resources.Designer.cs +++ b/Event Assembler/Core/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Nintenlord.Event_Assembler.Core.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Event Assembler/Core/app.config b/Event Assembler/Core/app.config index fcd0c93..3e0e37c 100644 --- a/Event Assembler/Core/app.config +++ b/Event Assembler/Core/app.config @@ -1,3 +1,3 @@ - + diff --git a/Nintenlord/Collections/Lists/LinkedArrayList.cs b/Nintenlord/Collections/Lists/LinkedArrayList.cs index 7d7a869..d14053c 100644 --- a/Nintenlord/Collections/Lists/LinkedArrayList.cs +++ b/Nintenlord/Collections/Lists/LinkedArrayList.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using Nintenlord.Utility.Primitives; -using System.Diagnostics.Contracts; namespace Nintenlord.Collections.Lists { @@ -22,8 +21,8 @@ public T First { get { - Contract.Requires - (count > 0, "Can't take the first of empty collection."); + if (count <= 0) + throw new Exception("Can't take the first of empty collection."); return items[firstReservedIndex]; } @@ -32,8 +31,9 @@ public T Last { get { - Contract.Requires - (count > 0, "Can't take the last of empty collection."); + + if (count <= 0) + throw new Exception("Can't take the last of empty collection."); return firstFreeIndex > 0 ? items[firstFreeIndex - 1] : items[items.Length - 1]; } @@ -191,7 +191,8 @@ private int Find(T item) private void InsertAtInternalIndex(int internalIndex, T item) { - Contract.Requires(count < items.Length); + if (count >= items.Length) + throw new Exception("No enough room to insert."); //There is always room on the array at this point if (firstReservedIndex < firstFreeIndex) @@ -447,7 +448,8 @@ public int IndexOf(T item) public void Insert(int index, T item) { - Contract.Requires(index >= 0 && index <= count); + if (index < 0 || index > count) + throw new IndexOutOfRangeException(); if (index == count) { @@ -465,7 +467,8 @@ public void Insert(int index, T item) public void RemoveAt(int index) { - Contract.Requires(index >= 0 && index < count); + if (index < 0 || index >= count) + throw new IndexOutOfRangeException(); RemoveAtInternal(ToInternalIndex(index)); } diff --git a/Nintenlord/Nintenlord.csproj b/Nintenlord/Nintenlord.csproj index 1e1903c..3efce13 100644 --- a/Nintenlord/Nintenlord.csproj +++ b/Nintenlord/Nintenlord.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,8 +10,9 @@ Properties Nintenlord Nintenlord - v4.0 + v4.8 512 + true @@ -21,6 +22,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +31,7 @@ TRACE prompt 4 + false true @@ -39,6 +42,7 @@ prompt false false + false bin\x86\Release\ @@ -50,6 +54,7 @@ false false false + false diff --git a/Nintenlord/Utility/SharedDirtyBuffer.cs b/Nintenlord/Utility/SharedDirtyBuffer.cs index fa86c41..0d43ae7 100644 --- a/Nintenlord/Utility/SharedDirtyBuffer.cs +++ b/Nintenlord/Utility/SharedDirtyBuffer.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Diagnostics.Contracts; namespace Nintenlord.Utility { @@ -41,7 +40,8 @@ public int Length public DirtyBufferUser(SharedDirtyBuffer listToUse) { - Contract.Requires(!listToUse.InUse, "Argument listToUse is already in use."); + if (listToUse.InUse) + throw new ArgumentException("Argument listToUse is already in use."); this.listToUse = listToUse; this.listToUse.InUse = true;