Moved programs into the Programs folder
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1958 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
80
Programs/VoiceTest/VoiceTest.build
Normal file
80
Programs/VoiceTest/VoiceTest.build
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="libsecondlife" default="build">
|
||||
|
||||
<!-- global framework settings -->
|
||||
<property name="target.framework" value="${framework::get-target-framework()}" />
|
||||
<property name="assembly.dir" value="${framework::get-assembly-directory(target.framework)}" />
|
||||
|
||||
<!-- global project settings -->
|
||||
<xmlpeek
|
||||
file="../libsecondlife.build"
|
||||
xpath="/project/property[@name = 'project.version']/@value"
|
||||
property="project.version" />
|
||||
<property name="build.number"
|
||||
value="${math::abs(math::floor(timespan::get-total-days(datetime::now()
|
||||
- datetime::parse('01/01/2002'))))}" />
|
||||
<property name="assembly" value="SLProxy"/>
|
||||
<property name="bin_dir" value="../bin" />
|
||||
|
||||
<!-- default configuration -->
|
||||
<property name="project.config" value="debug" /> <!-- debug|release -->
|
||||
|
||||
<!-- named configurations -->
|
||||
<target name="init" description="Initializes build properties">
|
||||
<call target="${project.config}" />
|
||||
</target>
|
||||
|
||||
<target name="debug" description="configures a debug build">
|
||||
<property name="build.debug" value="true" />
|
||||
<property name="package.name"
|
||||
value="${project::get-name()}-${project.version}-${project.config}" />
|
||||
<property name="assembly.configuration"
|
||||
value="${framework::get-target-framework()}.${platform::get-name()} [${project.config}]" />
|
||||
</target>
|
||||
|
||||
<target name="release" description="configures a release build">
|
||||
<property name="project.config" value="release" />
|
||||
<property name="build.debug" value="false" />
|
||||
<property name="package.name"
|
||||
value="${project::get-name()}-${project.version}" />
|
||||
<property name="assembly.configuration"
|
||||
value="${framework::get-target-framework()}.${platform::get-name()}" />
|
||||
</target>
|
||||
|
||||
<!-- build tasks -->
|
||||
<target name="build"
|
||||
depends="init"
|
||||
description="build VoiceTest">
|
||||
<echo message="Build Directory is ${bin_dir}/" />
|
||||
<mkdir dir="${bin_dir}" failonerror="false" />
|
||||
<csc
|
||||
target="exe"
|
||||
debug="${build.debug}"
|
||||
output="${bin_dir}/VoiceTest.exe">
|
||||
<sources failonempty="true">
|
||||
<include name="VoiceTest.cs" />
|
||||
</sources>
|
||||
<references basedir="${bin_dir}/">
|
||||
<include name="libsecondlife.dll"/>
|
||||
</references>
|
||||
</csc>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="init"
|
||||
description="Deletes the current configuration">
|
||||
<delete failonerror="false">
|
||||
<fileset basedir="${bin_dir}/">
|
||||
<include name="VoiceTest.exe" />
|
||||
<include name="VoiceTest.exe.mdb" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="*"
|
||||
description="Handles unknown targets">
|
||||
<echo message="skipping unknown target" />
|
||||
</target>
|
||||
</project>
|
||||
|
||||
202
Programs/VoiceTest/VoiceTest.cs
Normal file
202
Programs/VoiceTest/VoiceTest.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2008, openmetaverse.org
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.org nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Utilities;
|
||||
|
||||
namespace VoiceTest
|
||||
{
|
||||
public class VoiceException: Exception
|
||||
{
|
||||
public bool LoggedIn = false;
|
||||
|
||||
public VoiceException(string msg): base(msg)
|
||||
{
|
||||
}
|
||||
|
||||
public VoiceException(string msg, bool loggedIn): base(msg)
|
||||
{
|
||||
LoggedIn = loggedIn;
|
||||
}
|
||||
}
|
||||
|
||||
class VoiceTest
|
||||
{
|
||||
static AutoResetEvent EventQueueRunningEvent = new AutoResetEvent(false);
|
||||
static AutoResetEvent ProvisionEvent = new AutoResetEvent(false);
|
||||
static AutoResetEvent ParcelVoiceInfoEvent = new AutoResetEvent(false);
|
||||
static string VoiceAccount = String.Empty;
|
||||
static string VoicePassword = String.Empty;
|
||||
static string VoiceRegionName = String.Empty;
|
||||
static int VoiceLocalID = 0;
|
||||
static string VoiceChannelURI = String.Empty;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
{
|
||||
Console.WriteLine("Usage: VoiceTest.exe [firstname] [lastname] [password]");
|
||||
return;
|
||||
}
|
||||
|
||||
string firstName = args[0];
|
||||
string lastName = args[1];
|
||||
string password = args[2];
|
||||
|
||||
|
||||
GridClient client = new GridClient();
|
||||
client.Settings.MULTIPLE_SIMS = false;
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.None;
|
||||
client.Settings.LOG_RESENDS = false;
|
||||
client.Settings.STORE_LAND_PATCHES = true;
|
||||
client.Settings.ALWAYS_DECODE_OBJECTS = true;
|
||||
client.Settings.ALWAYS_REQUEST_OBJECTS = true;
|
||||
client.Settings.SEND_AGENT_UPDATES = true;
|
||||
|
||||
string loginURI = client.Settings.LOGIN_SERVER;
|
||||
if (4 == args.Length) {
|
||||
loginURI = args[3];
|
||||
}
|
||||
|
||||
VoiceManager voice = new VoiceManager(client);
|
||||
voice.OnProvisionAccount += voice_OnProvisionAccount;
|
||||
voice.OnParcelVoiceInfo += voice_OnParcelVoiceInfo;
|
||||
|
||||
client.Network.OnEventQueueRunning += client_OnEventQueueRunning;
|
||||
|
||||
try {
|
||||
if (!voice.ConnectToDaemon()) throw new VoiceException("Failed to connect to the voice daemon");
|
||||
|
||||
List<string> captureDevices = voice.CaptureDevices();
|
||||
|
||||
Console.WriteLine("Capture Devices:");
|
||||
for (int i = 0; i < captureDevices.Count; i++)
|
||||
Console.WriteLine(String.Format("{0}. \"{1}\"", i, captureDevices[i]));
|
||||
Console.WriteLine();
|
||||
|
||||
List<string> renderDevices = voice.RenderDevices();
|
||||
|
||||
Console.WriteLine("Render Devices:");
|
||||
for (int i = 0; i < renderDevices.Count; i++)
|
||||
Console.WriteLine(String.Format("{0}. \"{1}\"", i, renderDevices[i]));
|
||||
Console.WriteLine();
|
||||
|
||||
|
||||
// Login
|
||||
Console.WriteLine("Logging into the grid as " + firstName + " " + lastName + "...");
|
||||
LoginParams loginParams =
|
||||
client.Network.DefaultLoginParams(firstName, lastName, password, "Voice Test", "1.0.0");
|
||||
loginParams.URI = loginURI;
|
||||
if (!client.Network.Login(loginParams))
|
||||
throw new VoiceException("Login to SL failed: " + client.Network.LoginMessage);
|
||||
Console.WriteLine("Logged in: " + client.Network.LoginMessage);
|
||||
|
||||
|
||||
Console.WriteLine("Creating voice connector...");
|
||||
int status;
|
||||
string connectorHandle = voice.CreateConnector(out status);
|
||||
if (String.IsNullOrEmpty(connectorHandle))
|
||||
throw new VoiceException("Failed to create a voice connector, error code: " + status, true);
|
||||
Console.WriteLine("Voice connector handle: " + connectorHandle);
|
||||
|
||||
|
||||
Console.WriteLine("Waiting for OnEventQueueRunning");
|
||||
if (!EventQueueRunningEvent.WaitOne(45 * 1000, false))
|
||||
throw new VoiceException("EventQueueRunning event did not occur", true);
|
||||
Console.WriteLine("EventQueue running");
|
||||
|
||||
|
||||
Console.WriteLine("Asking the current simulator to create a provisional account...");
|
||||
if (!voice.RequestProvisionAccount())
|
||||
throw new VoiceException("Failed to request a provisional account", true);
|
||||
if (!ProvisionEvent.WaitOne(120 * 1000, false))
|
||||
throw new VoiceException("Failed to create a provisional account", true);
|
||||
Console.WriteLine("Provisional account created. Username: " + VoiceAccount +
|
||||
", Password: " + VoicePassword);
|
||||
|
||||
|
||||
Console.WriteLine("Logging in to voice server " + voice.VoiceServer);
|
||||
string accountHandle = voice.Login(VoiceAccount, VoicePassword, connectorHandle, out status);
|
||||
if (String.IsNullOrEmpty(accountHandle))
|
||||
throw new VoiceException("Login failed, error code: " + status, true);
|
||||
Console.WriteLine("Login succeeded, account handle: " + accountHandle);
|
||||
|
||||
|
||||
if (!voice.RequestParcelVoiceInfo())
|
||||
throw new Exception("Failed to request parcel voice info");
|
||||
if (!ParcelVoiceInfoEvent.WaitOne(45 * 1000, false))
|
||||
throw new VoiceException("Failed to obtain parcel info voice", true);
|
||||
|
||||
|
||||
Console.WriteLine("Parcel Voice Info obtained. Region name {0}, local parcel ID {1}, channel URI {2}",
|
||||
VoiceRegionName, VoiceLocalID, VoiceChannelURI);
|
||||
|
||||
client.Network.Logout();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
if (e is VoiceException && (e as VoiceException).LoggedIn)
|
||||
{
|
||||
client.Network.Logout();
|
||||
}
|
||||
|
||||
}
|
||||
Console.WriteLine("Press any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
static void client_OnEventQueueRunning(Simulator sim) {
|
||||
EventQueueRunningEvent.Set();
|
||||
}
|
||||
|
||||
static void client_OnLogMessage(string message, Helpers.LogLevel level)
|
||||
{
|
||||
if (level == Helpers.LogLevel.Warning || level == Helpers.LogLevel.Error)
|
||||
Console.WriteLine(level.ToString() + ": " + message);
|
||||
}
|
||||
|
||||
static void voice_OnProvisionAccount(string username, string password)
|
||||
{
|
||||
VoiceAccount = username;
|
||||
VoicePassword = password;
|
||||
|
||||
ProvisionEvent.Set();
|
||||
}
|
||||
|
||||
static void voice_OnParcelVoiceInfo(string regionName, int localID, string channelURI)
|
||||
{
|
||||
VoiceRegionName = regionName;
|
||||
VoiceLocalID = localID;
|
||||
VoiceChannelURI = channelURI;
|
||||
|
||||
ParcelVoiceInfoEvent.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Programs/VoiceTest/VoiceTest.csproj
Normal file
70
Programs/VoiceTest/VoiceTest.csproj
Normal file
@@ -0,0 +1,70 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{B69597A7-5DC5-4564-9089-727D0348EB4E}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VoiceTest</RootNamespace>
|
||||
<AssemblyName>VoiceTest</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</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\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-docs|AnyCPU' ">
|
||||
<OutputPath>bin\Release-docs\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleAssemblies>C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="VoiceTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libsecondlife\OpenMetaverse.csproj">
|
||||
<Project>{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}</Project>
|
||||
<Name>OpenMetaverse</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\libsecondlife\libsecondlife.Utilities\OpenMetaverse.Utilities.csproj">
|
||||
<Project>{CE5E06C2-2428-416B-ADC1-F1FE16A0FB27}</Project>
|
||||
<Name>OpenMetaverse.Utilities</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</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>
|
||||
Reference in New Issue
Block a user