Working to get the collision stuff working with mesh groups
Put in the RomotingLite project to start on TigerSong
This commit is contained in:
parent
2783f79818
commit
2d3d26a68d
37 changed files with 3647 additions and 19 deletions
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CommonTypes;
|
||||
using RemotingLite;
|
||||
using System.Net;
|
||||
|
||||
namespace RemotingLiteExampleClient
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is an example of how to subclass ClientBase in order to provide more
|
||||
/// control over the calls.
|
||||
/// Notice that any class inheriting from ClientBase has a Proxy-property, which
|
||||
/// is a proxy of the interface specified. This proxy is generated with RemotingLite.ProxyFactory
|
||||
/// and provides the contact to the host.
|
||||
///
|
||||
/// Note the constructor!
|
||||
/// </summary>
|
||||
public class ClientProxyImpl : ClientBase<IService>, IService
|
||||
{
|
||||
/// <summary>
|
||||
/// The class inheriting from ClientBase must define a constructor which takes
|
||||
/// an end point to the host. You have to call the base constructor.
|
||||
/// </summary>
|
||||
/// <param name="endpoint"></param>
|
||||
public ClientProxyImpl(IPEndPoint endpoint)
|
||||
: base(endpoint)
|
||||
{
|
||||
}
|
||||
|
||||
#region IService Members
|
||||
|
||||
public int Sum(int a, int b)
|
||||
{
|
||||
return Proxy.Sum(a, b);
|
||||
}
|
||||
|
||||
public int Sum(params int[] values)
|
||||
{
|
||||
return Proxy.Sum(values);
|
||||
}
|
||||
|
||||
public string ToUpper(string str)
|
||||
{
|
||||
return Proxy.ToUpper(str);
|
||||
}
|
||||
|
||||
public void MakeStringUpperCase(ref string str)
|
||||
{
|
||||
Proxy.MakeStringUpperCase(ref str);
|
||||
}
|
||||
|
||||
public void MakeStringLowerCase(string str, out string lowerCaseString)
|
||||
{
|
||||
Proxy.MakeStringLowerCase(str, out lowerCaseString);
|
||||
}
|
||||
|
||||
public void CalculateArea(ref Rectangle rectangle)
|
||||
{
|
||||
Proxy.CalculateArea(ref rectangle);
|
||||
}
|
||||
|
||||
public void Square(long a, out long b)
|
||||
{
|
||||
Proxy.Square(a, out b);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using CommonTypes;
|
||||
|
||||
namespace RemotingLiteExampleClient
|
||||
{
|
||||
/// <summary>
|
||||
/// This class shows an example of how to use our own client proxy implementation
|
||||
/// that inherits from ClientBase.
|
||||
/// </summary>
|
||||
public class ExampleUsingClientProxyImpl
|
||||
{
|
||||
public void Start(int port)
|
||||
{
|
||||
// This is an example that connects to the local host. See MSDN documentation.
|
||||
// This will work if you run both client and host on the same machine.
|
||||
#if true
|
||||
IPAddress[] addressList = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
|
||||
IPAddress address = null;
|
||||
foreach (var a in addressList)
|
||||
if (a.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
address = a;
|
||||
break;
|
||||
}
|
||||
IPEndPoint endpoint = new IPEndPoint(address, port);
|
||||
#else
|
||||
IPEndPoint endpoint = new IPEndPoint(Dns.GetHostEntry(Dns.GetHostName()).AddressList[0], 8000);
|
||||
#endif
|
||||
|
||||
// When using our own implementation we can use the "using" construct since ClientBase (and
|
||||
// thus our implementation) implements IDisposable.
|
||||
using (ClientProxyImpl client = new ClientProxyImpl(endpoint))
|
||||
{
|
||||
|
||||
//make a few calls to the host
|
||||
Console.WriteLine(client.Sum(2, 3));
|
||||
Console.WriteLine(client.Sum(2, 3, 4, 5, 6, 7, 8, 9));
|
||||
Console.WriteLine(client.ToUpper("this string used to be lower case"));
|
||||
string str = "this was a lower case string";
|
||||
client.MakeStringUpperCase(ref str);
|
||||
Console.WriteLine(str);
|
||||
string lowerCaseString;
|
||||
client.MakeStringLowerCase("THIS WAS AN UPPER CASE STRING", out lowerCaseString);
|
||||
Console.WriteLine(lowerCaseString);
|
||||
Rectangle rect = new Rectangle(30, 40);
|
||||
Console.WriteLine(String.Format("Area before call : {0}", rect.Area));
|
||||
client.CalculateArea(ref rect);
|
||||
Console.WriteLine(String.Format("Area after call : {0}", rect.Area));
|
||||
|
||||
long b;
|
||||
client.Square(123, out b);
|
||||
Console.WriteLine(string.Format("123 squared is {0}", b));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CommonTypes;
|
||||
using RemotingLite;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
|
||||
namespace RemotingLiteExampleClient
|
||||
{
|
||||
/// <summary>
|
||||
/// This is an example of how to use ProxyFactory directly.
|
||||
/// </summary>
|
||||
public class ExampleUsingProxyFactory
|
||||
{
|
||||
public void Start(int port)
|
||||
{
|
||||
// This is an example that connects to the local host. See MSDN documentation.
|
||||
// This will work if you run both client and host on the same machine.
|
||||
#if true
|
||||
IPAddress[] addressList = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
|
||||
IPAddress address = null;
|
||||
foreach (var a in addressList)
|
||||
if (a.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
address = a;
|
||||
break;
|
||||
}
|
||||
IPEndPoint endpoint = new IPEndPoint(address, port);
|
||||
#else
|
||||
IPEndPoint endpoint = new IPEndPoint(Dns.GetHostEntry(Dns.GetHostName()).AddressList[0], 8000);
|
||||
#endif
|
||||
|
||||
// When using the proxy factory we do not need to write any client side code for the
|
||||
// proxy. This might be usefull if you:
|
||||
// 1) Want more control of when the connection is closed. This is done when the object is
|
||||
// disposed.
|
||||
// 2) Are lazy :-)
|
||||
|
||||
//create the proxy
|
||||
IService client = ProxyFactory.CreateProxy<IService>(endpoint);
|
||||
|
||||
//make a few calls to the host
|
||||
Console.WriteLine(client.Sum(2, 3));
|
||||
Console.WriteLine(client.Sum(2, 3, 4, 5, 6, 7, 8, 9));
|
||||
Console.WriteLine(client.ToUpper("this string used to be lower case"));
|
||||
string str = "this was a lower case string";
|
||||
client.MakeStringUpperCase(ref str);
|
||||
Console.WriteLine(str);
|
||||
string lowerCaseString;
|
||||
client.MakeStringLowerCase("THIS WAS AN UPPER CASE STRING", out lowerCaseString);
|
||||
Console.WriteLine(lowerCaseString);
|
||||
Rectangle rect = new Rectangle(30, 40);
|
||||
Console.WriteLine(String.Format("Area before call : {0}", rect.Area));
|
||||
client.CalculateArea(ref rect);
|
||||
Console.WriteLine(String.Format("Area after call : {0}", rect.Area));
|
||||
|
||||
long b;
|
||||
client.Square(123, out b);
|
||||
Console.WriteLine(string.Format("123 squared is {0}", b));
|
||||
|
||||
// You can either dispose (and thus close the connection) the object yourself, or wait
|
||||
// for the garbage collector to do it for you when going out of scope of this method.
|
||||
// Here we dispose it explicitly,
|
||||
((IDisposable)client).Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RemotingLiteExampleClient
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Using our own implementation that inherits from ClientBase<>\n");
|
||||
ExampleUsingClientProxyImpl example1 = new ExampleUsingClientProxyImpl();
|
||||
example1.Start(8000);
|
||||
|
||||
Console.WriteLine("\nUsing ProxyFactory to create a proxy directly.\n");
|
||||
ExampleUsingProxyFactory example2 = new ExampleUsingProxyFactory();
|
||||
example2.Start(8000);
|
||||
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
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("RemotingLiteExampleClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RemotingLiteExampleClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[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("400c12e2-5f51-4aec-b3f3-6a636d9d66c3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{275568A0-7E5E-4151-8960-E54665FF5DF7}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RemotingLiteExampleClient</RootNamespace>
|
||||
<AssemblyName>RemotingLiteExampleClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</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="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ClientProxyImpl.cs" />
|
||||
<Compile Include="ExampleUsingClientProxyImpl.cs" />
|
||||
<Compile Include="ExampleUsingProxyFactory.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\RemotingLite.csproj">
|
||||
<Project>{0AFFA4EB-EDEA-43CC-8045-C7D1FE557803}</Project>
|
||||
<Name>RemotingLite</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CommonTypes\CommonTypes.csproj">
|
||||
<Project>{04B850F0-5A39-4157-A227-A574064110D2}</Project>
|
||||
<Name>CommonTypes</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\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>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Loading…
Add table
Add a link
Reference in a new issue