Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ALL the code!

  • Loading branch information...
commit f401a5557cff8a915ba66b402e8ab205261e2863 1 parent b44fe71
@developerdizzle authored
View
51 .gitignore
@@ -0,0 +1,51 @@
+
+<!-- saved from url=(0065)https://raw.github.com/doctordizzle/TimeTracker/master/.gitignore -->
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/document_iterator.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/find_proxy.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/get_html_text.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/global_constants.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/name_injection_builder.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/number_injection_builder.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/string_finder.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/change_sink.js"></script><meta name="document_iterator.js"><meta name="find_proxy.js"><meta name="get_html_text.js"><meta name="global_constants.js"><meta name="name_injection_builder.js"><meta name="number_injection_builder.js"><meta name="string_finder.js"><meta name="change_sink.js"><style type="text/css"></style></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#OS junk files
+[Tt]humbs.db
+*.DS_Store
+
+#Visual Studio files
+*.[Oo]bj
+*.user
+*.aps
+*.pch
+*.vspscc
+*.vssscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.tlb
+*.tlh
+*.bak
+*.[Cc]ache
+*.ilk
+*.log
+*.lib
+*.sbr
+*.sdf
+*.opensdf
+*.unsuccessfulbuild
+ipch/
+obj/
+[Bb]in
+[Dd]ebug*/
+[Rr]elease*/
+Ankh.NoLoad
+
+#Tooling
+_ReSharper*/
+*.resharper
+[Tt]est[Rr]esult*
+
+#Project files
+[Bb]uild/
+
+#Subversion files
+.svn
+
+# Office Temp Files
+~$*
+
+#NuGet
+packages/</pre></body><span id="skype_highlighting_settings" display="none" autoextractnumbers="1"></span><object id="skype_plugin_object" location.href="https://raw.github.com/doctordizzle/TimeTracker/master/.gitignore" location.hostname="raw.github.com" style="position: absolute; visibility: hidden; left: -100px; top: -100px; " width="0" height="0" type="application/x-vnd.skype.click2call.chrome.5.7.0"></object></html>
View
12 SockPuppet.Demo/IClientObject.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace SockPuppet.Demo
+{
+ public interface IClientWindow
+ {
+ void alert(string message);
+ }
+}
View
85 SockPuppet.Demo/Program.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Fleck;
+
+namespace SockPuppet.Demo
+{
+ class Program
+ {
+ private static List<IWebSocketConnection> allSockets = new List<IWebSocketConnection>();
+
+ private static Dictionary<Guid, IClientWindow> clientWindows = new Dictionary<Guid, IClientWindow>();
+ private static Dictionary<Guid, dynamic> clientDynamicWindows = new Dictionary<Guid, dynamic>();
+
+ private static WebSocketServer server;
+
+ static void Main(string[] args)
+ {
+ string url = args.Length > 0 ? args[0] : "ws://localhost:8181";
+
+ server = new WebSocketServer(url);
+
+ server.Start(socket =>
+ {
+ socket.OnOpen = () => Open(socket);
+ socket.OnClose = () => Close(socket);
+ socket.OnMessage = message => Receive(socket, message);
+ });
+
+ Console.WriteLine("Type a message to send to the client (type 'exit' to close):");
+
+ var input = Console.ReadLine();
+ while (input != "exit")
+ {
+ foreach (IWebSocketConnection socket in allSockets)
+ {
+ //standard socket raw send method
+ socket.Send(input);
+
+ //find our dynamic sockpuppet for this socket, and call a dynamic method
+ clientDynamicWindows[socket.ConnectionInfo.Id].document.write("called from a dynamic object method: " + input);
+
+ //find our strongly typed interface sockpuppet for this socket, and call a typed method (that matches a method for our chosen context on the client)\
+ clientWindows[socket.ConnectionInfo.Id].alert("called from an interface method: " + input);
+ }
+
+ input = Console.ReadLine();
+ }
+ }
+
+ private static void Open(IWebSocketConnection socket)
+ {
+ //add our socket to a persistent collection so we can reference later
+ allSockets.Add(socket);
+
+ //create a strongly typed sockpuppet
+ IClientWindow puppet = SockPuppet.Puppet.New<IClientWindow>(r => socket.Send(r));
+ //add it to a dictionary so we can reference by socket id later
+ clientWindows.Add(socket.ConnectionInfo.Id, puppet);
+
+ //create a dynamic sockpuppet
+ dynamic dynamicPuppet = SockPuppet.Puppet.New(r => socket.Send(r));
+ //add it to a dictionary so we can reference by socket id later
+ clientDynamicWindows.Add(socket.ConnectionInfo.Id, dynamicPuppet);
+
+ Console.WriteLine("> Socket opened to " + socket.ConnectionInfo.ClientIpAddress);
+ }
+
+ private static void Close(IWebSocketConnection socket)
+ {
+ allSockets.Remove(socket);
+ clientWindows.Remove(socket.ConnectionInfo.Id);
+ clientDynamicWindows.Remove(socket.ConnectionInfo.Id);
+
+ Console.WriteLine("> Socket to " + socket.ConnectionInfo.ClientIpAddress + " closed");
+ }
+
+ private static void Receive(IWebSocketConnection socket, string message)
+ {
+ Console.WriteLine("> Message received from " + socket.ConnectionInfo.ClientIpAddress);
+ Console.WriteLine(message);
+ }
+ }
+}
View
36 SockPuppet.Demo/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("SockPuppet.Demo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SockPuppet.Demo")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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("5d66694e-6b83-46ad-b085-7c2aa895d887")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// 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")]
View
78 SockPuppet.Demo/SockPuppet.Demo.csproj
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A3A823C5-60BD-412E-88DE-AA13E1459915}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SockPuppet.Demo</RootNamespace>
+ <AssemblyName>SockPuppet.Demo</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <StartupObject>SockPuppet.Demo.Program</StartupObject>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Fleck">
+ <HintPath>..\packages\Fleck.0.9.6.12\lib\net40\Fleck.dll</HintPath>
+ </Reference>
+ <Reference Include="ImpromptuInterface">
+ <HintPath>..\SockPuppet\bin\Debug\ImpromptuInterface.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="IClientObject.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\SockPuppet\SockPuppet.csproj">
+ <Project>{FFAC15F2-504E-445B-9E6B-EA69443DB1DC}</Project>
+ <Name>SockPuppet</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.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
3  SockPuppet.Demo/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
View
4 SockPuppet.Demo/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Fleck" version="0.9.6.12" />
+</packages>
View
30 SockPuppet.Web/demo.htm
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title></title>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+ <script type="text/javascript" src="sockpuppet.client.js"></script>
+</head>
+<body>
+ <script type="text/javascript">
+ //create a new WebSocket object as usual
+ var server = new WebSocket("ws://localhost:8181");
+
+ //set out context to the window object - all sockpuppet method calls will be performed on this object
+ server.puppetContext(window);
+
+ //non sockpuppet calls are passed through to the standard onmessage function
+ server.onmessage = function (event) {
+ console.log('received data through standard server.onmessage: ' + event.data);
+ };
+
+ server.onopen = function () {
+ console.log('socket server opened');
+ };
+
+ server.onclose = function () {
+ console.log('socket server closed');
+ }
+ </script>
+</body>
+</html>
View
43 SockPuppet.Web/sockpuppet.client.js
@@ -0,0 +1,43 @@
+var oldWebSocket = window.WebSocket;
+function WrappedWebSocket(loc) {
+ this.prototype = new oldWebSocket(loc);
+ this.__proto__ = this.prototype;
+ var wrapper = this;
+ this.onmessage = function (message) {
+ try {
+ var parsedData = JSON.parse(message.data);
+
+ if (parsedData.SockPuppetCall) {
+ var subContext = context;
+ var namespaces = parsedData.SockPuppetCall.Name.split('.');
+
+ var methodName = namespaces[namespaces.length - 1];
+
+ if (namespaces.length > 1) {
+ namespaces.splice(namespaces.length - 1, 1);
+
+ for (i in namespaces) {
+ subContext = subContext[namespaces[i]];
+ }
+ }
+
+ var arguments = parsedData.SockPuppetCall.Arguments;
+
+ subContext[methodName].apply(subContext, arguments);
+
+ return;
+ }
+ } catch (e) { }
+ wrapper.baseonmessage(message);
+ }
+ this.__defineSetter__('onmessage', function (val) {
+ wrapper.baseonmessage = val;
+ });
+
+ var context = window;
+ this.puppetContext = function (newContext) {
+ context = newContext;
+ }
+}
+window.WebSocket = WrappedWebSocket;
+
View
73 SockPuppet.sln
@@ -0,0 +1,73 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SockPuppet", "SockPuppet\SockPuppet.csproj", "{FFAC15F2-504E-445B-9E6B-EA69443DB1DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SockPuppet.Demo", "SockPuppet.Demo\SockPuppet.Demo.csproj", "{A3A823C5-60BD-412E-88DE-AA13E1459915}"
+EndProject
+Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "SockPuppet.Web", "..\..\..\..\..\..\inetpub\wwwroot\Tripod\Websites\SockPuppet.Web\", "{EF9E78B4-E165-471A-A82A-0ABFDE1490FC}"
+ ProjectSection(WebsiteProperties) = preProject
+ TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
+ Debug.AspNetCompiler.VirtualPath = "/SockPuppet.Web"
+ Debug.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\inetpub\wwwroot\Tripod\Websites\SockPuppet.Web\"
+ Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\SockPuppet.Web\"
+ Debug.AspNetCompiler.Updateable = "true"
+ Debug.AspNetCompiler.ForceOverwrite = "true"
+ Debug.AspNetCompiler.FixedNames = "false"
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.VirtualPath = "/SockPuppet.Web"
+ Release.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\inetpub\wwwroot\Tripod\Websites\SockPuppet.Web\"
+ Release.AspNetCompiler.TargetPath = "PrecompiledWeb\SockPuppet.Web\"
+ Release.AspNetCompiler.Updateable = "true"
+ Release.AspNetCompiler.ForceOverwrite = "true"
+ Release.AspNetCompiler.FixedNames = "false"
+ Release.AspNetCompiler.Debug = "False"
+ VWDPort = "18887"
+ DefaultWebSiteLanguage = "Visual C#"
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {FFAC15F2-504E-445B-9E6B-EA69443DB1DC}.Release|x86.ActiveCfg = Release|Any CPU
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Debug|x86.ActiveCfg = Debug|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Debug|x86.Build.0 = Debug|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Release|Any CPU.ActiveCfg = Release|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Release|Mixed Platforms.Build.0 = Release|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Release|x86.ActiveCfg = Release|x86
+ {A3A823C5-60BD-412E-88DE-AA13E1459915}.Release|x86.Build.0 = Release|x86
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Release|Any CPU.Build.0 = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Release|Mixed Platforms.Build.0 = Debug|Any CPU
+ {EF9E78B4-E165-471A-A82A-0ABFDE1490FC}.Release|x86.ActiveCfg = Debug|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
36 SockPuppet/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 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("SockPuppet")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SockPuppet")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 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("4c86986f-4a2f-471b-8ab5-06e8b8c22d48")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// 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")]
View
79 SockPuppet/Puppet.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Dynamic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+using System.Reflection;
+using ImpromptuInterface;
+using ImpromptuInterface.Dynamic;
+using System.Web.Script.Serialization;
+
+namespace SockPuppet
+{
+ public class Puppet : ImpromptuObject
+ {
+ private Action<string> Send;
+
+ public Puppet(Action<string> send)
+ {
+ this.Send = send;
+ }
+
+ private string subContext = String.Empty;
+
+ public override bool TryGetMember(GetMemberBinder binder, out object result)
+ {
+ this.subContext += "." + binder.Name;
+
+ result = this;
+ return true;
+ }
+
+ public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
+ {
+ string fullMethodName = (this.subContext + "." + binder.Name).TrimStart('.');
+
+ string payload = CreateJsonMethodCall(fullMethodName, args);
+
+ this.Send(payload);
+
+ this.subContext = String.Empty;
+
+ result = null;
+ return true;
+ }
+
+ private static string CreateJsonMethodCall(string name, IEnumerable<object> arguments)
+ {
+ var methodCall = new
+ {
+ SockPuppetCall = new
+ {
+ Name = name,
+ Arguments = arguments
+ }
+ };
+
+ JavaScriptSerializer serializer = new JavaScriptSerializer();
+
+ return serializer.Serialize(methodCall);
+ }
+
+ public static dynamic New(Action<string> send)
+ {
+ dynamic puppet = new Puppet(send);
+
+ return puppet;
+ }
+
+ public static T New<T>(Action<string> send) where T : class
+ {
+ dynamic puppet = new Puppet(send);
+
+ return ImpromptuInterface.Impromptu.ActLike<T>(puppet);
+ }
+ }
+}
View
60 SockPuppet/SockPuppet.csproj
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{FFAC15F2-504E-445B-9E6B-EA69443DB1DC}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SockPuppet</RootNamespace>
+ <AssemblyName>SockPuppet</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="ImpromptuInterface">
+ <HintPath>..\..\..\..\..\Downloads\ImpromptuInterface.5.6.2-MVVM.3.6.2-FS1.0.2\ImpromptuInterface.5.6.2-MVVM.3.6.2-FS1.0.2\net40\ImpromptuInterface.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Puppet.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </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.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
BIN  packages/Fleck.0.9.6.12/Fleck.0.9.6.12.nupkg
Binary file not shown
View
BIN  packages/Fleck.0.9.6.12/lib/net40/Fleck.dll
Binary file not shown
View
5 packages/repositories.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<repositories>
+ <repository path="..\SockPuppet\packages.config" />
+ <repository path="..\SockPuppet.Demo\packages.config" />
+</repositories>
Please sign in to comment.
Something went wrong with that request. Please try again.