Skip to content
Browse files

Code formatting

Running resharper code formatting
Adding 5.0 settings to solution
  • Loading branch information...
1 parent 28ae4fe commit 7b4408a7418e5b8258078efc8e9598a54a56c917 @loudej committed Mar 11, 2011
View
71 Gate.5.0.ReSharper
@@ -0,0 +1,71 @@
+<Configuration>
+ <CodeStyleSettings>
+ <ExternalPath IsNull="False">
+ </ExternalPath>
+ <Sharing>SOLUTION</Sharing>
+ <CSharp>
+ <FormatSettings>
+ <EXPLICIT_PRIVATE_MODIFIER>False</EXPLICIT_PRIVATE_MODIFIER>
+ <MODIFIERS_ORDER IsNull="False">
+ <Item>public</Item>
+ <Item>protected</Item>
+ <Item>internal</Item>
+ <Item>private</Item>
+ <Item>new</Item>
+ <Item>abstract</Item>
+ <Item>virtual</Item>
+ <Item>override</Item>
+ <Item>sealed</Item>
+ <Item>static</Item>
+ <Item>readonly</Item>
+ <Item>extern</Item>
+ <Item>unsafe</Item>
+ <Item>volatile</Item>
+ </MODIFIERS_ORDER>
+ </FormatSettings>
+ <UsingsSettings />
+ <Naming2>
+ <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
+ <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
+ </Naming2>
+ </CSharp>
+ <VB>
+ <FormatSettings />
+ <ImportsSettings />
+ <Naming2>
+ <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
+ <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
+ </Naming2>
+ </VB>
+ <Web>
+ <Naming2 />
+ </Web>
+ <Xaml>
+ <Naming2 />
+ </Xaml>
+ <XML>
+ <FormatSettings />
+ </XML>
+ <GenerateMemberBody />
+ <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>
+ </CodeStyleSettings>
+</Configuration>
View
6 Gate.Helpers.Tests/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.Helpers.Tests")]
[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("5eaec6c6-f0c2-41d0-b723-a1c9a83274c1")]
// 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
72 Gate.Helpers.Tests/RequestTests.cs
@@ -3,38 +3,39 @@
using System.Net;
using NUnit.Framework;
-namespace Gate.Helpers.Tests {
+namespace Gate.Helpers.Tests
+{
using BodyDelegate = Func<
// on next
- Func<
- ArraySegment<byte>, // data
- Action, // continuation
- bool // continuation was or will be invoked
+ Func<
+ ArraySegment<byte>, // data
+ Action, // continuation
+ bool // continuation was or will be invoked
>,
-
- // on error
- Action<Exception>,
-
- // on complete
- Action,
-
- // cancel
- Action
+ // on error
+ Action<Exception>,
+ // on complete
+ Action,
+ // cancel
+ Action
>;
// ReSharper disable InconsistentNaming
[TestFixture]
- public class RequestTests {
+ public class RequestTests
+ {
[Test]
- public void Version_property_provide_access_to_environment() {
- var env = new Dictionary<string, object> { { "owin.Version", "1.0" } };
+ public void Version_property_provide_access_to_environment()
+ {
+ var env = new Dictionary<string, object> {{"owin.Version", "1.0"}};
var request = new Request(env);
Assert.That(request.Version, Is.EqualTo("1.0"));
}
[Test]
- public void Envoronment_access_is_not_buffered_or_cached() {
- var env = new Dictionary<string, object> { { "owin.Version", "1.0" } };
+ public void Envoronment_access_is_not_buffered_or_cached()
+ {
+ var env = new Dictionary<string, object> {{"owin.Version", "1.0"}};
var request = new Request(env);
Assert.That(request.Version, Is.EqualTo("1.0"));
@@ -49,7 +50,8 @@ public class RequestTests {
}
[Test]
- public void All_environment_variables_from_spec_are_available_as_typed_properties() {
+ public void All_environment_variables_from_spec_are_available_as_typed_properties()
+ {
//"owin.RequestMethod" A string containing the HTTP request method of the request (e.g., "GET", "POST").
//"owin.RequestUri" A string containing the HTTP request URI of the request. The value must include the query string of the HTTP request URI (e.g., "/path/and?query=string"). The URI must be relative to the application delegate; see Paths.
//"owin.RequestHeaders" An instance of IDictionary<string, string> which represents the HTTP headers present in the request (the request header dictionary); see Headers.
@@ -62,18 +64,22 @@ public class RequestTests {
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" },
- };
+ 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"},
+ };
var request = new Request(env);
Assert.That(request.Method, Is.EqualTo("GET"));
@@ -88,4 +94,4 @@ public class RequestTests {
Assert.That(request.Version, Is.EqualTo("1.0"));
}
}
-}
+}
View
1 Gate.Helpers.Tests/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
+
<packages>
<package id="NUnit" version="2.5.9.10348" />
</packages>
View
6 Gate.Helpers/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.Helpers")]
[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("2e0f13d2-acc5-48c8-a686-161a87f8ba5c")]
// 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
102 Gate.Helpers/Request.cs
@@ -1,94 +1,116 @@
using System;
using System.Collections.Generic;
-namespace Gate.Helpers {
+namespace Gate.Helpers
+{
using BodyDelegate = Func<
- // on next
- Func<
- ArraySegment<byte>, // data
- Action, // continuation
- bool // continuation was or will be invoked
+ // on next
+ Func<
+ ArraySegment<byte>, // data
+ Action, // continuation
+ bool // continuation was or will be invoked
>,
-
- // on error
- Action<Exception>,
-
- // on complete
- Action,
-
- // cancel
- Action
+ // on error
+ Action<Exception>,
+ // on complete
+ Action,
+ // cancel
+ Action
>;
- public class Request {
- private readonly IDictionary<string, object> _env;
+ public class Request
+ {
+ readonly IDictionary<string, object> _env;
- public Request(IDictionary<string, object> env) {
+ public Request(IDictionary<string, object> env)
+ {
_env = env;
}
- private T Get<T>(string name) {
+ T Get<T>(string name)
+ {
object value;
- return _env.TryGetValue(name, out value) ? (T)value : default(T);
+ return _env.TryGetValue(name, out value) ? (T) value : default(T);
}
/// <summary>
/// "owin.Version" The string "1.0" indicating OWIN version 1.0.
/// </summary>
- public string Version { get { return Get<string>("owin.Version"); } }
+ public string Version
+ {
+ get { return Get<string>("owin.Version"); }
+ }
/// <summary>
/// "owin.RequestMethod" A string containing the HTTP request method of the request (e.g., "GET", "POST").
/// </summary>
- public string Method { get { return Get<string>("owin.RequestMethod"); } }
+ public string Method
+ {
+ get { return Get<string>("owin.RequestMethod"); }
+ }
/// <summary>
/// "owin.RequestHeaders" An instance of IDictionary&lt;string, string&gt; which represents the HTTP headers present in the request (the request header dictionary); see Headers.
/// </summary>
- public IDictionary<string, string> Headers { get { return Get<IDictionary<string, string>>("owin.RequestHeaders"); } }
+ public IDictionary<string, string> Headers
+ {
+ get { return Get<IDictionary<string, string>>("owin.RequestHeaders"); }
+ }
/// <summary>
/// "owin.BaseUri" A string containing the portion of the request URI's path corresponding to the "root" of the application object. See Paths.
/// </summary>
- public string BaseUri { get { return Get<string>("owin.BaseUri"); } }
+ public string BaseUri
+ {
+ get { return Get<string>("owin.BaseUri"); }
+ }
/// <summary>
/// "owin.RequestUri" A string containing the HTTP request URI of the request. The value must include the query string of the HTTP request URI (e.g., "/path/and?query=string"). The URI must be relative to the application delegate; see Paths.
/// </summary>
- public string RequestUri { get { return Get<string>("owin.RequestUri"); } }
+ public string RequestUri
+ {
+ get { return Get<string>("owin.RequestUri"); }
+ }
/// <summary>
/// "owin.UriScheme" A string representing the URI scheme (e.g. "http", "https")
/// </summary>
- public string UriScheme { get { return Get<string>("owin.UriScheme"); } }
+ public string UriScheme
+ {
+ get { return Get<string>("owin.UriScheme"); }
+ }
/// <summary>
/// "owin.RequestBody" An instance of the body delegate representing the body of the request. May be null.
/// </summary>
- public BodyDelegate Body { get { return Get<BodyDelegate>("owin.RequestBody"); } }
+ public BodyDelegate Body
+ {
+ get { return Get<BodyDelegate>("owin.RequestBody"); }
+ }
/// <summary>
/// "owin.ServerName" Hosts should provide values which can be used to reconstruct the full URI of the request in absence of the HTTP Host header of the request.
/// </summary>
- public string ServerName { get { return Get<string>("owin.ServerName"); } }
+ public string ServerName
+ {
+ get { return Get<string>("owin.ServerName"); }
+ }
/// <summary>
/// "owin.ServerPort" Hosts should provide values which can be used to reconstruct the full URI of the request in absence of the HTTP Host header of the request.
/// </summary>
- public string ServerPort { get { return Get<string>("owin.ServerPort"); } }
+ public string ServerPort
+ {
+ get { return Get<string>("owin.ServerPort"); }
+ }
/// <summary>
/// "owin.RemoteEndPoint" A System.Net.IPEndPoint representing the connected client.
/// </summary>
- public System.Net.IPEndPoint RemoteEndPoint { get { return Get<System.Net.IPEndPoint>("owin.RemoteEndPoint"); } }
-
-
-
-
-
-
-
-
-
+ public System.Net.IPEndPoint RemoteEndPoint
+ {
+ get { return Get<System.Net.IPEndPoint>("owin.RemoteEndPoint"); }
+ }
}
-}
+}
View
59 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,13 +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);
@@ -122,4 +123,4 @@ public void PaCsException()
Assert.AreEqual("asdfjkl;lol", result);
}
}
-}
+}
View
30 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]
@@ -145,4 +145,4 @@ public void PsCa()
Assert.AreEqual("asdfjkl;lol", sb.ToString());
}
}
-}
+}
View
6 Gate.Tests/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.Tests")]
[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("ddf34083-f96d-491a-bc3d-075f54766496")]
// 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
1 Gate.Tests/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
+
<packages>
<package id="NUnit" version="2.5.9.10348" />
</packages>
View
52 Gate/AsyncResult.cs
@@ -11,21 +11,21 @@ internal class AsyncResult : IAsyncResult
{
// Fields set at construction which never change while
// operation is pending
- private readonly AsyncCallback m_AsyncCallback;
- private readonly Object m_AsyncState;
+ readonly AsyncCallback m_AsyncCallback;
+ readonly Object m_AsyncState;
// Fields set at construction which do change after
// operation completes
- private const Int32 c_StatePending = 0;
- private const Int32 c_StateCompletedSynchronously = 1;
- private const Int32 c_StateCompletedAsynchronously = 2;
- private Int32 m_CompletedState = c_StatePending;
+ const Int32 c_StatePending = 0;
+ const Int32 c_StateCompletedSynchronously = 1;
+ const Int32 c_StateCompletedAsynchronously = 2;
+ Int32 m_CompletedState = c_StatePending;
// Field that may or may not get set depending on usage
- private ManualResetEvent m_AsyncWaitHandle;
+ ManualResetEvent m_AsyncWaitHandle;
// Fields set when operation completes
- private Exception m_exception;
+ Exception m_exception;
public AsyncResult(AsyncCallback asyncCallback, Object state)
{
@@ -34,16 +34,17 @@ public AsyncResult(AsyncCallback asyncCallback, Object state)
}
public void SetAsCompleted(
- Exception exception, Boolean completedSynchronously)
+ Exception exception, Boolean completedSynchronously)
{
// Passing null for exception means no error occurred.
// This is the common case
m_exception = exception;
// 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");
@@ -64,22 +65,26 @@ public void EndInvoke()
// If the operation isn't done, wait for it
AsyncWaitHandle.WaitOne();
AsyncWaitHandle.Close();
- m_AsyncWaitHandle = null; // Allow early GC
+ m_AsyncWaitHandle = null; // Allow early GC
}
// Operation is done: if an exception occured, throw it
if (m_exception != null) throw m_exception;
}
#region Implementation of IAsyncResult
- public Object AsyncState { get { return m_AsyncState; } }
+
+ public Object AsyncState
+ {
+ get { return m_AsyncState; }
+ }
public Boolean CompletedSynchronously
{
get
{
return Thread.VolatileRead(ref m_CompletedState) ==
- c_StateCompletedSynchronously;
+ c_StateCompletedSynchronously;
}
}
@@ -92,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
@@ -117,22 +122,25 @@ public Boolean IsCompleted
get
{
return Thread.VolatileRead(ref m_CompletedState) !=
- c_StatePending;
+ c_StatePending;
}
}
+
#endregion
}
internal class AsyncResult<TResult> : AsyncResult
{
// Field set when operation completes
- private TResult m_result = default(TResult);
+ TResult m_result = default(TResult);
public AsyncResult(AsyncCallback asyncCallback, Object state) :
- base(asyncCallback, state) { }
+ base(asyncCallback, state)
+ {
+ }
public void SetAsCompleted(TResult result,
- Boolean completedSynchronously)
+ Boolean completedSynchronously)
{
// Save the asynchronous operation's result
m_result = result;
@@ -142,10 +150,10 @@ internal class AsyncResult<TResult> : AsyncResult
base.SetAsCompleted(null, completedSynchronously);
}
- new public TResult EndInvoke()
+ public new TResult EndInvoke()
{
base.EndInvoke(); // Wait until operation has completed
- return m_result; // Return the result (if above didn't throw)
+ return m_result; // Return the result (if above didn't throw)
}
}
-}
+}
View
11 Gate/Extensions.cs
@@ -46,12 +46,17 @@ public static string GetRequestHeader(this IDictionary<string, object> env, stri
public static Func<Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action>
GetRequestBody(this IDictionary<string, object> env)
{
- return env["gate.RequestBody"] as Func<Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action>;
+ return
+ env["gate.RequestBody"] as
+ 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)
+ public static void SetRequestBody(this IDictionary<string, object> env,
+ Func
+ <Func<ArraySegment<byte>, Action, bool>, Action<Exception>, Action, Action
+ > value)
{
env["gate.RequestBody"] = value;
}
}
-}
+}
View
42 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);
}
@@ -32,7 +32,8 @@ bool OnNext(ArraySegment<byte> data, Action ct)
return false;
}
- public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
+ public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback,
+ object state)
{
return null;
}
@@ -49,11 +50,30 @@ public override int Read(byte[] buffer, int offset, int count)
#region Stream boilerplate
- public override bool CanRead { get { return true; } }
- public override bool CanSeek { get { return false; } }
- public override bool CanWrite { get { return false; } }
- public override void Flush() { }
- public override long Length { get { throw new NotSupportedException(); } }
+ public override bool CanRead
+ {
+ get { return true; }
+ }
+
+ public override bool CanSeek
+ {
+ get { return false; }
+ }
+
+ public override bool CanWrite
+ {
+ get { return false; }
+ }
+
+ public override void Flush()
+ {
+ }
+
+ public override long Length
+ {
+ get { throw new NotSupportedException(); }
+ }
+
public override long Position
{
get { throw new NotSupportedException(); }
@@ -77,4 +97,4 @@ public override void Write(byte[] buffer, int offset, int count)
#endregion
}
-}
+}
View
34 Gate/OutputStream.cs
@@ -25,10 +25,11 @@ public override void Write(byte[] buffer, int offset, int count)
{
EnsureNotCompleted();
- next(new ArraySegment<byte>(buffer, offset, count), (Action)null);
+ next(new ArraySegment<byte>(buffer, offset, count), (Action) null);
}
- public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
+ public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback,
+ object state)
{
EnsureNotCompleted();
@@ -55,7 +56,9 @@ public override void Close()
complete();
}
- public override void Flush() { }
+ public override void Flush()
+ {
+ }
void EnsureNotCompleted()
{
@@ -64,11 +67,26 @@ void EnsureNotCompleted()
#region Stream boilerplate
- public override bool CanRead { get { return false; } }
- public override bool CanSeek { get { return false; } }
- public override bool CanWrite { get { return true; } }
+ public override bool CanRead
+ {
+ get { return false; }
+ }
+
+ public override bool CanSeek
+ {
+ get { return false; }
+ }
+
+ public override bool CanWrite
+ {
+ get { return true; }
+ }
+
+ public override long Length
+ {
+ get { throw new NotSupportedException(); }
+ }
- public override long Length { get { throw new NotSupportedException(); } }
public override long Position
{
get { throw new NotImplementedException(); }
@@ -92,4 +110,4 @@ public override void SetLength(long value)
#endregion
}
-}
+}
View
6 Gate/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")]
[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("9b6b6a5b-7307-4d2c-8413-081e072eee44")]
// 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
4 Gate/packages.config
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<packages>
-</packages>
+
+<packages></packages>

0 comments on commit 7b4408a

Please sign in to comment.
Something went wrong with that request. Please try again.