Skip to content

Commit c06b012

Browse files
committed
Cleaning code
1 parent 83eef58 commit c06b012

File tree

402 files changed

+4278
-3867
lines changed

Some content is hidden

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

402 files changed

+4278
-3867
lines changed

.nuget/NuGet.Config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<add key="disableSourceControlIntegration" value="true" />
5+
</solution>
6+
</configuration>

.nuget/NuGet.targets

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands -->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
</PropertyGroup>
32+
33+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
34+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
35+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<!-- NuGet command -->
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
51+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
52+
53+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
55+
56+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
57+
58+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
60+
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
63+
64+
<!-- Commands -->
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
67+
68+
<!-- We need to ensure packages are restored prior to assembly resolve -->
69+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
70+
RestorePackages;
71+
$(BuildDependsOn);
72+
</BuildDependsOn>
73+
74+
<!-- Make the build depend on restore packages -->
75+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
76+
$(BuildDependsOn);
77+
BuildPackage;
78+
</BuildDependsOn>
79+
</PropertyGroup>
80+
81+
<Target Name="CheckPrerequisites">
82+
<!-- Raise an error if we're unable to locate nuget.exe -->
83+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
84+
<!--
85+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
86+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
87+
parallel builds will have to wait for it to complete.
88+
-->
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
90+
</Target>
91+
92+
<Target Name="_DownloadNuGet">
93+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
94+
</Target>
95+
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
97+
<Exec Command="$(RestoreCommand)"
98+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
99+
100+
<Exec Command="$(RestoreCommand)"
101+
LogStandardErrorAsError="true"
102+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
103+
</Target>
104+
105+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
106+
<Exec Command="$(BuildCommand)"
107+
Condition=" '$(OS)' != 'Windows_NT' " />
108+
109+
<Exec Command="$(BuildCommand)"
110+
LogStandardErrorAsError="true"
111+
Condition=" '$(OS)' == 'Windows_NT' " />
112+
</Target>
113+
114+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
115+
<ParameterGroup>
116+
<OutputFilename ParameterType="System.String" Required="true" />
117+
</ParameterGroup>
118+
<Task>
119+
<Reference Include="System.Core" />
120+
<Using Namespace="System" />
121+
<Using Namespace="System.IO" />
122+
<Using Namespace="System.Net" />
123+
<Using Namespace="Microsoft.Build.Framework" />
124+
<Using Namespace="Microsoft.Build.Utilities" />
125+
<Code Type="Fragment" Language="cs">
126+
<![CDATA[
127+
try {
128+
OutputFilename = Path.GetFullPath(OutputFilename);
129+
130+
Log.LogMessage("Downloading latest version of NuGet.exe...");
131+
WebClient webClient = new WebClient();
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
133+
134+
return true;
135+
}
136+
catch (Exception ex) {
137+
Log.LogErrorFromException(ex);
138+
return false;
139+
}
140+
]]>
141+
</Code>
142+
</Task>
143+
</UsingTask>
144+
</Project>

DataCommander.Foundation/Collections/CircuralBuffer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace DataCommander.Foundation.Collections
22
{
33
using System;
4+
using System.Collections;
45
using System.Collections.Generic;
56
using System.Diagnostics.Contracts;
67

@@ -284,7 +285,7 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
284285
break;
285286
}
286287

287-
current = (current + 1) % array.Length;
288+
current = (current + 1) %this.array.Length;
288289
}
289290
}
290291
}
@@ -293,7 +294,7 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
293294

294295
#region IEnumerable Members
295296

296-
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
297+
IEnumerator IEnumerable.GetEnumerator()
297298
{
298299
var enumerable = (IEnumerable<T>)this;
299300
return enumerable.GetEnumerator();

DataCommander.Foundation/Collections/DisposableCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class DisposableCollection<T> : Collection<T>, IDisposable where T : IDis
1616
/// </summary>
1717
public void Dispose()
1818
{
19-
foreach (IDisposable item in this)
19+
foreach (T item in this)
2020
{
2121
if (item != null)
2222
{

DataCommander.Foundation/Collections/DynamicArray.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class DynamicArray<T> : IList<T>
2323
/// </summary>
2424
/// <param name="initialSize"></param>
2525
/// <param name="maxSize"></param>
26-
public DynamicArray( int initialSize, int maxSize )
26+
public DynamicArray(int initialSize, int maxSize)
2727
{
2828
this.array = new T[initialSize];
2929
this.maxSize = maxSize;
@@ -36,22 +36,22 @@ public DynamicArray( int initialSize, int maxSize )
3636
/// </summary>
3737
/// <param name="item"></param>
3838
/// <returns></returns>
39-
public int IndexOf( T item )
39+
public int IndexOf(T item)
4040
{
41-
return this.array.IndexOf( item );
41+
return this.array.IndexOf(item);
4242
}
4343

4444
/// <summary>
4545
///
4646
/// </summary>
4747
/// <param name="index"></param>
4848
/// <param name="item"></param>
49-
void IList<T>.Insert( int index, T item )
49+
void IList<T>.Insert(int index, T item)
5050
{
5151
throw new NotSupportedException();
5252
}
5353

54-
void IList<T>.RemoveAt( int index )
54+
void IList<T>.RemoveAt(int index)
5555
{
5656
throw new NotSupportedException();
5757
}
@@ -61,16 +61,16 @@ void IList<T>.RemoveAt( int index )
6161
/// </summary>
6262
/// <param name="index"></param>
6363
/// <returns></returns>
64-
public T this[ int index ]
64+
public T this[int index]
6565
{
6666
get
6767
{
68-
return this.array[ index ];
68+
return this.array[index];
6969
}
7070

7171
set
7272
{
73-
this.array[ index ] = value;
73+
this.array[index] = value;
7474
}
7575
}
7676

@@ -82,9 +82,9 @@ public T this[ int index ]
8282
///
8383
/// </summary>
8484
/// <param name="item"></param>
85-
public void Add( T item )
85+
public void Add(T item)
8686
{
87-
Contract.Assert( this.count < this.maxSize );
87+
Contract.Assert(this.count < this.maxSize);
8888

8989
if (this.count == this.array.Length)
9090
{
@@ -95,15 +95,15 @@ public void Add( T item )
9595
newSize = this.maxSize;
9696
}
9797

98-
if (newSize > count)
98+
if (newSize > this.count)
9999
{
100100
var newArray = new T[newSize];
101-
Array.Copy( this.array, newArray, this.array.Length );
101+
Array.Copy(this.array, newArray, this.array.Length);
102102
this.array = newArray;
103103
}
104104
}
105105

106-
this.array[ count ] = item;
106+
this.array[this.count] = item;
107107
this.count++;
108108
}
109109

@@ -114,7 +114,7 @@ public void Clear()
114114
{
115115
if (this.count > 0)
116116
{
117-
Array.Clear( this.array, 0, this.count );
117+
Array.Clear(this.array, 0, this.count);
118118
}
119119

120120
this.count = 0;
@@ -125,12 +125,12 @@ public void Clear()
125125
/// </summary>
126126
/// <param name="item"></param>
127127
/// <returns></returns>
128-
public bool Contains( T item )
128+
public bool Contains(T item)
129129
{
130-
return this.array.Contains( item );
130+
return this.array.Contains(item);
131131
}
132132

133-
void ICollection<T>.CopyTo( T[] array, int arrayIndex )
133+
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
134134
{
135135
throw new NotImplementedException();
136136
}
@@ -157,7 +157,7 @@ public bool IsReadOnly
157157
}
158158
}
159159

160-
bool ICollection<T>.Remove( T item )
160+
bool ICollection<T>.Remove(T item)
161161
{
162162
throw new NotSupportedException();
163163
}
@@ -174,7 +174,7 @@ public IEnumerator<T> GetEnumerator()
174174
{
175175
for (int i = 0; i < this.count; i++)
176176
{
177-
yield return this.array[ i ];
177+
yield return this.array[i];
178178
}
179179
}
180180

DataCommander.Foundation/Collections/IndexableCollection/EnumerableIndex.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Diagnostics.Contracts;
4-
using System.Linq;
5-
using System.Text;
6-
7-
namespace DataCommander.Foundation.Collections.IndexableCollection
1+
namespace DataCommander.Foundation.Collections.IndexableCollection
82
{
3+
using System;
4+
using System.Collections;
5+
using System.Collections.Generic;
6+
using System.Diagnostics.Contracts;
7+
98
/// <summary>
109
///
1110
/// </summary>
1211
/// <typeparam name="T"></typeparam>
1312
public sealed class EnumerableIndex<T> : ICollectionIndex<T>
1413
{
15-
private string name;
14+
private readonly string name;
1615
private IEnumerable<T> enumerable;
1716

1817
/// <summary>
@@ -76,7 +75,7 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
7675
throw new NotImplementedException();
7776
}
7877

79-
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
78+
IEnumerator IEnumerable.GetEnumerator()
8079
{
8180
throw new NotImplementedException();
8281
}

DataCommander.Foundation/Collections/IndexableCollection/GetKeyResponse.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
namespace DataCommander.Foundation.Collections
22
{
3-
using System;
4-
53
/// <summary>
64
///
75
/// </summary>

DataCommander.Foundation/Collections/IndexableCollection/ICollectionIndex.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace DataCommander.Foundation.Collections
22
{
3-
using System;
43
using System.Collections.Generic;
54

65
/// <summary>

DataCommander.Foundation/Collections/IndexableCollection/IndexCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace DataCommander.Foundation.Collections
22
{
3-
using System;
3+
using System.Collections;
44
using System.Collections.Generic;
55
using System.Diagnostics.Contracts;
66

@@ -142,7 +142,7 @@ public IEnumerator<ICollectionIndex<T>> GetEnumerator()
142142

143143
#region IEnumerable Members
144144

145-
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
145+
IEnumerator IEnumerable.GetEnumerator()
146146
{
147147
return this.dictionary.Values.GetEnumerator();
148148
}

DataCommander.Foundation/Collections/IndexableCollection/IndexableCollection-2.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace DataCommander.Foundation.Collections
22
{
3-
using System;
43
using System.Collections;
54
using System.Collections.Generic;
65
using System.Diagnostics.Contracts;

0 commit comments

Comments
 (0)