Skip to content

Commit 7e6adf5

Browse files
committed
2017-04-10
- Upgrading to Visual Studio 2017 - Disabling code contracts with #if - Using var - Upgrading to .NET Framework v4.6.2
1 parent 3474f14 commit 7e6adf5

File tree

428 files changed

+3668
-3291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

428 files changed

+3668
-3291
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# git ignore file
22

33
#Visual Studio files
4+
.vs/slnx.sqlite
45
*.bak
56
*.cache
67
*.CodeAnalysisLog.xml
@@ -31,4 +32,4 @@ bin
3132
build.force
3233
obj
3334
packages
34-
.orig
35+
*.orig

DataCommander.Foundation/ArgumentEqualsSelection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace DataCommander.Foundation
22
{
33
using System;
4-
using System.Diagnostics.Contracts;
54

65
/// <summary>
76
///
@@ -29,7 +28,9 @@ public ArgumentEqualsSelection(TArgument argument)
2928
/// <returns></returns>
3029
public ArgumentEqualsSelection<TArgument> IfArgumentEquals(TArgument other, Action action)
3130
{
31+
#if CONTRACTS_FULL
3232
Contract.Requires<ArgumentNullException>(action != null);
33+
#endif
3334

3435
if (!this.selected)
3536
{
@@ -49,7 +50,9 @@ public ArgumentEqualsSelection<TArgument> IfArgumentEquals(TArgument other, Acti
4950
/// <param name="action"></param>
5051
public void Else(Action action)
5152
{
53+
#if CONTRACTS_FULL
5254
Contract.Requires<ArgumentNullException>(action != null);
55+
#endif
5356

5457
if (!this.selected)
5558
{

DataCommander.Foundation/ArgumentIsSelection.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace DataCommander.Foundation
22
{
33
using System;
4-
using System.Diagnostics.Contracts;
54

65
/// <summary>
76
///
@@ -29,7 +28,9 @@ public ArgumentIsSelection(TArgument argument)
2928
/// <returns></returns>
3029
public ArgumentIsSelection<TArgument> IfArgumentIs<TArgumentAs>(Action<TArgumentAs> action) where TArgumentAs : class
3130
{
31+
#if CONTRACTS_FULL
3232
Contract.Requires<ArgumentNullException>(action != null);
33+
#endif
3334

3435
if (!this.selected)
3536
{
@@ -51,7 +52,9 @@ public ArgumentIsSelection<TArgument> IfArgumentIs<TArgumentAs>(Action<TArgument
5152
/// <returns></returns>
5253
public ArgumentIsSelection<TArgument> IfArgumentIsNull(Action action)
5354
{
55+
#if CONTRACTS_FULL
5456
Contract.Requires<ArgumentNullException>(action != null);
57+
#endif
5558

5659
if (!this.selected)
5760
{
@@ -73,7 +76,9 @@ public ArgumentIsSelection<TArgument> IfArgumentIsNull(Action action)
7376
/// <returns></returns>
7477
public ArgumentIsSelection<TArgument> If(Func<bool> condition, Action action)
7578
{
79+
#if CONTRACTS_FULL
7680
Contract.Requires<ArgumentNullException>(action != null);
81+
#endif
7782

7883
if (!this.selected)
7984
{
@@ -93,7 +98,9 @@ public ArgumentIsSelection<TArgument> If(Func<bool> condition, Action action)
9398
/// <param name="action"></param>
9499
public void Else(Action action)
95100
{
101+
#if CONTRACTS_FULL
96102
Contract.Requires<ArgumentNullException>(action != null);
103+
#endif
97104

98105
if (!this.selected)
99106
{

DataCommander.Foundation/Collections/BinarySearch.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace DataCommander.Foundation.Collections
44
{
55
using System;
6-
using System.Diagnostics.Contracts;
76

87
/// <summary>
98
///
@@ -22,9 +21,11 @@ public static int IndexOf(
2221
int maxIndex,
2322
Func<int, int> compareTo)
2423
{
24+
#if CONTRACTS_FULL
2525
Contract.Requires<ArgumentOutOfRangeException>(minIndex >= 0);
2626
Contract.Requires<ArgumentOutOfRangeException>(minIndex <= maxIndex);
2727
Contract.Requires<ArgumentNullException>(compareTo != null);
28+
#endif
2829

2930
var result = -1;
3031

DataCommander.Foundation/Collections/BitVector64.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct BitVector64
1313
/// </summary>
1414
/// <param name="data"></param>
1515
[CLSCompliant(false)]
16-
public BitVector64(UInt64 data)
16+
public BitVector64(ulong data)
1717
{
1818
this.Value = data;
1919
}
@@ -22,7 +22,7 @@ public BitVector64(UInt64 data)
2222
///
2323
/// </summary>
2424
[CLSCompliant(false)]
25-
public UInt64 Value { get; private set; }
25+
public ulong Value { get; private set; }
2626

2727
/// <summary>
2828
///

DataCommander.Foundation/Collections/CircuralBuffer.cs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System;
44
using System.Collections;
55
using System.Collections.Generic;
6-
using System.Diagnostics.Contracts;
76

87
/// <summary>
98
/// https://en.wikipedia.org/wiki/Circular_buffer
@@ -40,7 +39,9 @@ public CircularBuffer(int capacity)
4039
/// <returns></returns>
4140
public void AddHead(T item)
4241
{
42+
#if CONTRACTS_FULL
4343
Contract.Requires<ArgumentException>(this.Count < this.Capacity);
44+
#endif
4445

4546
if (this.head == -1)
4647
{
@@ -63,7 +64,9 @@ public void AddHead(T item)
6364
/// <returns></returns>
6465
public void AddTail(T item)
6566
{
67+
#if CONTRACTS_FULL
6668
Contract.Assert(this.Count < this.array.Length);
69+
#endif
6770

6871
if (this.head == -1)
6972
{
@@ -85,7 +88,9 @@ public void AddTail(T item)
8588
/// <param name="items"></param>
8689
public void AddTail(IEnumerable<T> items)
8790
{
91+
#if CONTRACTS_FULL
8892
Contract.Requires<ArgumentNullException>(items != null);
93+
#endif
8994

9095
foreach (var item in items)
9196
{
@@ -99,7 +104,9 @@ public void AddTail(IEnumerable<T> items)
99104
/// <returns></returns>
100105
public T PeekHead()
101106
{
107+
#if CONTRACTS_FULL
102108
Contract.Requires<InvalidOperationException>(this.Count > 0);
109+
#endif
103110
return this.array[this.head];
104111
}
105112

@@ -109,7 +116,9 @@ public T PeekHead()
109116
/// <returns></returns>
110117
public T RemoveHead()
111118
{
119+
#if CONTRACTS_FULL
112120
Contract.Requires<InvalidOperationException>(this.Count > 0);
121+
#endif
113122

114123
var item = this.array[this.head];
115124
this.array[this.head] = default(T);
@@ -125,7 +134,9 @@ public T RemoveHead()
125134
/// <returns></returns>
126135
public T PeekTail()
127136
{
137+
#if CONTRACTS_FULL
128138
Contract.Requires<InvalidOperationException>(this.Count > 0);
139+
#endif
129140

130141
return this.array[this.tail];
131142
}
@@ -136,7 +147,9 @@ public T PeekTail()
136147
/// <returns></returns>
137148
public T RemoveTail()
138149
{
150+
#if CONTRACTS_FULL
139151
Contract.Requires<InvalidOperationException>(this.Count > 0);
152+
#endif
140153

141154
var item = this.array[this.tail];
142155
this.array[this.tail] = default(T);
@@ -151,7 +164,9 @@ public T RemoveTail()
151164
/// <param name="capacity"></param>
152165
public void SetCapacity(int capacity)
153166
{
167+
#if CONTRACTS_FULL
154168
Contract.Requires<InvalidOperationException>(capacity >= this.Count);
169+
#endif
155170

156171
var target = new T[capacity];
157172
if (this.Count > 0)
@@ -179,7 +194,7 @@ public void SetCapacity(int capacity)
179194
this.array = target;
180195
}
181196

182-
#region IList<T> Members
197+
#region IList<T> Members
183198

184199
int IList<T>.IndexOf(T item)
185200
{
@@ -216,9 +231,9 @@ public T this[int index]
216231
}
217232
}
218233

219-
#endregion
234+
#endregion
220235

221-
#region ICollection<T> Members
236+
#region ICollection<T> Members
222237

223238
void ICollection<T>.Add(T item)
224239
{
@@ -252,9 +267,9 @@ bool ICollection<T>.Remove(T item)
252267
throw new NotImplementedException();
253268
}
254269

255-
#endregion
270+
#endregion
256271

257-
#region IEnumerable<T> Members
272+
#region IEnumerable<T> Members
258273

259274
IEnumerator<T> IEnumerable<T>.GetEnumerator()
260275
{
@@ -275,16 +290,16 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
275290
}
276291
}
277292

278-
#endregion
293+
#endregion
279294

280-
#region IEnumerable Members
295+
#region IEnumerable Members
281296

282297
IEnumerator IEnumerable.GetEnumerator()
283298
{
284299
var enumerable = (IEnumerable<T>)this;
285300
return enumerable.GetEnumerator();
286301
}
287302

288-
#endregion
303+
#endregion
289304
}
290305
}

DataCommander.Foundation/Collections/DynamicArray.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System;
44
using System.Collections;
55
using System.Collections.Generic;
6-
using System.Diagnostics.Contracts;
76
using DataCommander.Foundation.Linq;
87

98
/// <summary>
@@ -82,7 +81,9 @@ public T this[int index]
8281
/// <param name="item"></param>
8382
public void Add(T item)
8483
{
84+
#if CONTRACTS_FULL
8585
Contract.Assert(this.Count < this.maxSize);
86+
#endif
8687

8788
if (this.Count == this.array.Length)
8889
{
@@ -148,9 +149,9 @@ bool ICollection<T>.Remove(T item)
148149
throw new NotSupportedException();
149150
}
150151

151-
#endregion
152+
#endregion
152153

153-
#region IEnumerable<T> Members
154+
#region IEnumerable<T> Members
154155

155156
/// <summary>
156157
///
@@ -164,15 +165,15 @@ public IEnumerator<T> GetEnumerator()
164165
}
165166
}
166167

167-
#endregion
168+
#endregion
168169

169-
#region IEnumerable Members
170+
#region IEnumerable Members
170171

171172
IEnumerator IEnumerable.GetEnumerator()
172173
{
173174
return this.GetEnumerator();
174175
}
175176

176-
#endregion
177+
#endregion
177178
}
178179
}

DataCommander.Foundation/Collections/IndexableCollection/IndexCollection.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System.Collections;
44
using System.Collections.Generic;
5-
using System.Diagnostics.Contracts;
65

76
/// <summary>
87
///
@@ -18,7 +17,9 @@ public class IndexCollection<T> : ICollection<ICollectionIndex<T>>
1817
/// <param name="item"></param>
1918
public void Add(ICollectionIndex<T> item)
2019
{
21-
Contract.Assert(item != null);
20+
#if CONTRACTS_FULL
21+
Contract.Assert(item != null);
22+
#endif
2223

2324
this.dictionary.Add(item.Name, item);
2425
}
@@ -35,8 +36,7 @@ public void Add(ICollectionIndex<T> item)
3536
/// </summary>
3637
public void Clear()
3738
{
38-
#if FOUNDATION_3_5
39-
#else
39+
#if CONTRACTS_FULL
4040
Contract.Ensures(this.Count == 0);
4141
#endif
4242
this.dictionary.Clear();
@@ -49,8 +49,7 @@ public void Clear()
4949
/// <returns></returns>
5050
public bool Contains(ICollectionIndex<T> item)
5151
{
52-
#if FOUNDATION_3_5
53-
#else
52+
#if CONTRACTS_FULL
5453
Contract.Ensures(!Contract.Result<bool>() || this.Count > 0);
5554
#endif
5655
return this.dictionary.ContainsValue(item);
@@ -109,7 +108,7 @@ public bool TryGetValue(string name, out ICollectionIndex<T> item)
109108
return this.dictionary.TryGetValue(name, out item);
110109
}
111110

112-
#region IEnumerable<ICollectionIndex<T>> Members
111+
#region IEnumerable<ICollectionIndex<T>> Members
113112

114113
/// <summary>
115114
///
@@ -120,15 +119,15 @@ public IEnumerator<ICollectionIndex<T>> GetEnumerator()
120119
return this.dictionary.Values.GetEnumerator();
121120
}
122121

123-
#endregion
122+
#endregion
124123

125-
#region IEnumerable Members
124+
#region IEnumerable Members
126125

127126
IEnumerator IEnumerable.GetEnumerator()
128127
{
129128
return this.dictionary.Values.GetEnumerator();
130129
}
131130

132-
#endregion
131+
#endregion
133132
}
134133
}

0 commit comments

Comments
 (0)