Browse files

trying to stop resharper code formatting from indenting everything to…

…o far
  • Loading branch information...
1 parent d5a4bf2 commit 397458b8b316aee757541a498f5b2a807f954549 @loudej loudej committed Mar 12, 2011
View
32 Gate.5.1.ReSharper
@@ -5,7 +5,22 @@
<Sharing>SOLUTION</Sharing>
<CSharp>
<FormatSettings>
+ <ALIGN_LINQ_QUERY>False</ALIGN_LINQ_QUERY>
+ <ALIGN_MULTILINE_ARGUMENT>False</ALIGN_MULTILINE_ARGUMENT>
+ <ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER>False</ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER>
+ <ALIGN_MULTILINE_EXPRESSION>False</ALIGN_MULTILINE_EXPRESSION>
+ <ALIGN_MULTILINE_EXTENDS_LIST>False</ALIGN_MULTILINE_EXTENDS_LIST>
+ <ALIGN_MULTILINE_FOR_STMT>False</ALIGN_MULTILINE_FOR_STMT>
+ <ALIGN_MULTILINE_PARAMETER>False</ALIGN_MULTILINE_PARAMETER>
+ <ALIGN_MULTIPLE_DECLARATION>False</ALIGN_MULTIPLE_DECLARATION>
+ <ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS>False</ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS>
+ <ALIGN_MULTLINE_TYPE_PARAMETER_LIST>False</ALIGN_MULTLINE_TYPE_PARAMETER_LIST>
+ <ANONYMOUS_METHOD_DECLARATION_BRACES>NEXT_LINE</ANONYMOUS_METHOD_DECLARATION_BRACES>
+ <CASE_BLOCK_BRACES>NEXT_LINE</CASE_BLOCK_BRACES>
<EXPLICIT_PRIVATE_MODIFIER>False</EXPLICIT_PRIVATE_MODIFIER>
+ <INDENT_ANONYMOUS_METHOD_BLOCK>False</INDENT_ANONYMOUS_METHOD_BLOCK>
+ <INDENT_EMBRACED_INITIALIZER_BLOCK>False</INDENT_EMBRACED_INITIALIZER_BLOCK>
+ <INITIALIZER_BRACES>NEXT_LINE</INITIALIZER_BRACES>
<MODIFIERS_ORDER IsNull="False">
<Item>public</Item>
<Item>protected</Item>
@@ -22,11 +37,28 @@
<Item>unsafe</Item>
<Item>volatile</Item>
</MODIFIERS_ORDER>
+ <WRAP_LINES>False</WRAP_LINES>
</FormatSettings>
<UsingsSettings />
<Naming2>
<EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
<EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
</Naming2>
</CSharp>
<VB>
View
6 src/Gate.AspNet/Gate.AspNet.csproj
@@ -44,6 +44,12 @@
<Compile Include="GateModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Gate\Gate.csproj">
+ <Project>{BE3CCA19-0795-4477-A4D4-ABF45474ACBF}</Project>
+ <Name>Gate</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
View
15 src/Gate.AspNet/GateModule.cs
@@ -1,17 +1,26 @@
using System;
+using System.Threading.Tasks;
using System.Web;
namespace Gate.AspNet
{
public class GateModule : IHttpModule
{
- public void Init(HttpApplication context)
+ public void Init(HttpApplication httpApplication)
{
- context.AddOnBeginRequestAsync((sender, args, callback, state) => default(IAsyncResult), ar => { });
+ httpApplication.AddOnBeginRequestAsync((sender, args, callback, state) =>
+ {
+ var taskCompletionSource = new TaskCompletionSource<object>(state, TaskCreationOptions.PreferFairness);
+ if (callback != null)
+ taskCompletionSource.Task.ContinueWith(task => callback(task), TaskContinuationOptions.ExecuteSynchronously);
+
+ taskCompletionSource.SetResult(null);
+ return taskCompletionSource.Task;
+ }, ar => ((Task) ar).Wait());
}
public void Dispose()
{
}
}
-}
+}
View
6 src/Gate.AspNet/Properties/AssemblyInfo.cs
@@ -5,6 +5,7 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
+
[assembly: AssemblyTitle("Gate.AspNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -17,9 +18,11 @@
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
+
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
+
[assembly: Guid("4d116607-7cf0-46c0-a717-4e0b662be0d2")]
// Version information for an assembly consists of the following four values:
@@ -32,5 +35,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
+
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
27 src/Gate.Helpers.Tests/RequestTests.cs
@@ -65,21 +65,18 @@ public void All_environment_variables_from_spec_are_available_as_typed_propertie
var headers = new Dictionary<string, string>();
BodyDelegate body = (next, error, complete) => () => { };
var env = new Dictionary<string, object>
- {
- {"owin.RequestMethod", "GET"},
- {"owin.RequestUri", "/foo"},
- {"owin.RequestHeaders", headers},
- {"owin.RequestBody", body},
- {"owin.BaseUri", "/my-app"},
- {"owin.ServerName", "localhost"},
- {"owin.ServerPort", "8080"},
- {"owin.UriScheme", "https"},
- {
- "owin.RemoteEndPoint",
- new IPEndPoint(IPAddress.Parse("127.0.0.1") ?? IPAddress.None, 80)
- },
- {"owin.Version", "1.0"},
- };
+ {
+ {"owin.RequestMethod", "GET"},
+ {"owin.RequestUri", "/foo"},
+ {"owin.RequestHeaders", headers},
+ {"owin.RequestBody", body},
+ {"owin.BaseUri", "/my-app"},
+ {"owin.ServerName", "localhost"},
+ {"owin.ServerPort", "8080"},
+ {"owin.UriScheme", "https"},
+ {"owin.RemoteEndPoint", new IPEndPoint(IPAddress.Parse("127.0.0.1") ?? IPAddress.None, 80)},
+ {"owin.Version", "1.0"},
+ };
var request = new Request(env);
Assert.That(request.Method, Is.EqualTo("GET"));
View
58 src/Gate.Tests/InputStreamTests.cs
@@ -52,13 +52,13 @@ void CreateStream(Func<Func<ArraySegment<byte>, Action, bool>, Action<Exception>
public void PsCs()
{
CreateStream((next, fault, complete) =>
- {
- next(ArrSeg("asdf"), (Action) null);
- next(ArrSeg("jkl;"), (Action) null);
- next(ArrSeg("lol"), (Action) null);
- complete();
- return () => { };
- });
+ {
+ next(ArrSeg("asdf"), (Action) null);
+ next(ArrSeg("jkl;"), (Action) null);
+ next(ArrSeg("lol"), (Action) null);
+ complete();
+ return () => { };
+ });
Exception e = null;
var result = SynchronousReadToEndOrException(ref e);
@@ -70,13 +70,13 @@ public void PsCs()
public void PsCsException()
{
CreateStream((next, fault, complete) =>
- {
- next(ArrSeg("asdf"), (Action) null);
- next(ArrSeg("jkl;"), (Action) null);
- next(ArrSeg("lol"), (Action) null);
- fault(new Exception("ack!"));
- return () => { };
- });
+ {
+ next(ArrSeg("asdf"), (Action) null);
+ next(ArrSeg("jkl;"), (Action) null);
+ next(ArrSeg("lol"), (Action) null);
+ fault(new Exception("ack!"));
+ return () => { };
+ });
Exception e = null;
var result = SynchronousReadToEndOrException(ref e);
@@ -89,13 +89,13 @@ public void PsCsException()
public void PaCs()
{
CreateStream((next, fault, complete) =>
- {
- next(ArrSeg("asdf"), () =>
- next(ArrSeg("jkl;"), () =>
- next(ArrSeg("lol"), () =>
- complete())));
- return () => { };
- });
+ {
+ next(ArrSeg("asdf"), () =>
+ next(ArrSeg("jkl;"), () =>
+ next(ArrSeg("lol"), () =>
+ complete())));
+ return () => { };
+ });
Exception e = null;
var result = SynchronousReadToEndOrException(ref e);
@@ -107,14 +107,14 @@ public void PaCs()
public void PaCsException()
{
CreateStream((next, fault, complete) =>
- {
- next(ArrSeg("asdf"), () =>
- next(ArrSeg("jkl;"), () =>
- next(ArrSeg("lol"), () =>
- fault(
- new Exception("ack!")))));
- return () => { };
- });
+ {
+ next(ArrSeg("asdf"), () =>
+ next(ArrSeg("jkl;"), () =>
+ next(ArrSeg("lol"), () =>
+ fault(
+ new Exception("ack!")))));
+ return () => { };
+ });
Exception e = null;
var result = SynchronousReadToEndOrException(ref e);
View
28 src/Gate.Tests/OutputStreamTests.cs
@@ -31,10 +31,10 @@ public void SetUp()
void SynchronousConsumer()
{
next = (d, c) =>
- {
- sb.Append(Encoding.ASCII.GetString(d.Array, d.Offset, d.Count));
- return false;
- };
+ {
+ sb.Append(Encoding.ASCII.GetString(d.Array, d.Offset, d.Count));
+ return false;
+ };
}
void WriteString(string str)
@@ -82,16 +82,16 @@ public void PaCs()
void AsynchronousConsumer()
{
next = (d, c) =>
- {
- sb.Append(Encoding.ASCII.GetString(d.Array, d.Offset, d.Count));
-
- if (c != null)
- {
- ct = c;
- return true;
- }
- else return false;
- };
+ {
+ sb.Append(Encoding.ASCII.GetString(d.Array, d.Offset, d.Count));
+
+ if (c != null)
+ {
+ ct = c;
+ return true;
+ }
+ else return false;
+ };
}
[Test]
View
14 src/Gate/AsyncResult.cs
@@ -42,9 +42,9 @@ public AsyncResult(AsyncCallback asyncCallback, Object state)
// The m_CompletedState field MUST be set prior calling the callback
Int32 prevState = Interlocked.Exchange(ref m_CompletedState,
- completedSynchronously
- ? c_StateCompletedSynchronously
- : c_StateCompletedAsynchronously);
+ completedSynchronously
+ ? c_StateCompletedSynchronously
+ : c_StateCompletedAsynchronously);
if (prevState != c_StatePending)
throw new InvalidOperationException(
"You can set a result only once");
@@ -84,7 +84,7 @@ public Boolean CompletedSynchronously
get
{
return Thread.VolatileRead(ref m_CompletedState) ==
- c_StateCompletedSynchronously;
+ c_StateCompletedSynchronously;
}
}
@@ -97,7 +97,7 @@ public WaitHandle AsyncWaitHandle
Boolean done = IsCompleted;
ManualResetEvent mre = new ManualResetEvent(done);
if (Interlocked.CompareExchange(ref m_AsyncWaitHandle,
- mre, null) != null)
+ mre, null) != null)
{
// Another thread created this object's event; dispose
// the event we just created
@@ -122,7 +122,7 @@ public Boolean IsCompleted
get
{
return Thread.VolatileRead(ref m_CompletedState) !=
- c_StatePending;
+ c_StatePending;
}
}
@@ -140,7 +140,7 @@ internal class AsyncResult<TResult> : AsyncResult
}
public void SetAsCompleted(TResult result,
- Boolean completedSynchronously)
+ Boolean completedSynchronously)
{
// Save the asynchronous operation's result
m_result = result;
View
8 src/Gate/Extensions.cs
@@ -48,13 +48,13 @@ public static string GetRequestHeader(this IDictionary<string, object> env, stri
{
return
env["gate.RequestBody"] as
- Func<Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action>;
+ Func<Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action>;
}
public static void SetRequestBody(this IDictionary<string, object> env,
- Func
- <Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action
- > value)
+ Func
+ <Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action
+ > value)
{
env["gate.RequestBody"] = value;
}
View
10 src/Gate/InputStream.cs
@@ -11,10 +11,10 @@ public class InputStream : Stream
Action cancel;
public InputStream(Func<
- Func<ArraySegment<byte>, Action, bool>,
- Action<Exception>,
- Action,
- Action> input)
+ Func<ArraySegment<byte>, Action, bool>,
+ Action<Exception>,
+ Action,
+ Action> input)
{
cancel = input(OnNext, OnError, OnCompleted);
}
@@ -33,7 +33,7 @@ bool OnNext(ArraySegment<byte> data, Action ct)
}
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback,
- object state)
+ object state)
{
return null;
}
View
2 src/Gate/OutputStream.cs
@@ -29,7 +29,7 @@ public override void Write(byte[] buffer, int offset, int count)
}
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback,
- object state)
+ object state)
{
EnsureNotCompleted();

0 comments on commit 397458b

Please sign in to comment.