本文整理汇总了C#中Channel.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Channel.ToString方法的具体用法?C# Channel.ToString怎么用?C# Channel.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_return_the_correct_site_based_on_the_originating_site_header
public void Should_return_the_correct_site_based_on_the_originating_site_header()
{
var router = new OriginatingSiteHeaderRouter();
var message = new TransportMessage();
var defaultChannel = new Channel
{
Type = "http",
Address = "http://x.y"
};
message.Headers.Add(Headers.OriginatingSite, defaultChannel.ToString());
Assert.AreEqual(defaultChannel, router.GetDestinationSitesFor(message).First().Channel);
}
示例2: DownloadLatestVersion
/// <summary>
/// Downloads the latest build for the given channel into the "/Update" folder.
/// </summary>
public static bool DownloadLatestVersion( Channel channel )
{
try
{
Directory.CreateDirectory( @"LANdrop\Update" );
string fileName = Path.Combine( @"LANdrop\Update", String.Format( "LANdrop_{0}{1}.exe", ChannelFunctions.ToUrlPart( LastVersionInfo[channel].Channel ), LastVersionInfo[channel].BuildNumber ) );
string tempFileName = fileName + ".part";
// Download the file.
new WebClient( ).DownloadFile( ServerAddress + "/files/" + channel.ToString( ).ToLower( ) + "/" + LastVersionInfo[channel].BuildNumber + "/LANdrop.exe", tempFileName );
// Success! Remove other updates and the .part suffix.
foreach ( var file in new DirectoryInfo( @"LANdrop\Update" ).GetFiles( "LANdrop_" + ChannelFunctions.ToUrlPart( channel ) + "*.exe" ) )
File.Delete( file.FullName );
File.Move( tempFileName, fileName );
LastDownloadedBuild[channel] = LastVersionInfo[channel];
return true;
}
catch ( WebException ) { return false; }
}
示例3: Emit
/// <summary>
/// Emit a message to all listeners
/// </summary>
/// <param name="channel">The channel to emit on</param>
/// <param name="data">The data to send</param>
/// <param name="global">Should the data be sent to other processes</param>
private static void Emit(Channel channel, string data, bool global = false)
{
if (global)
{
var transport = new JObject {{"channel", channel.ToString()}, {"data", data}};
if (channel != Channel.Log)
Log.Entry(LogName, transport.ToString());
SendMessage(transport.ToString());
// If this bus instance is a client, wait for the event to be bounced-back before processing
if (_client != null)
return;
}
if (channel != Channel.Log)
Log.Entry(LogName, "Emmiting message on channel: " + channel);
if (!Registrar.ContainsKey(channel)) return;
try
{
var json = JObject.Parse(data);
foreach (var action in Registrar[channel])
action.Invoke(json);
}
catch (Exception ex)
{
Log.Error(LogName, "Unable to parse data");
Log.Error(LogName, ex);
}
}
示例4: GetMute
public bool GetMute(Channel channel)
{
return UPnP.InvokeAction<bool>(_service, "GetMute", InstanceId, channel.ToString());
}
示例5: SetVolumeDB
public void SetVolumeDB(Channel channel, short desiredVolume)
{
UPnP.InvokeAction(_service, "SetVolumeDB", InstanceId, channel.ToString(), desiredVolume);
}
示例6: SetRelativeVolume
public ushort SetRelativeVolume(Channel channel, int adjustment)
{
return UPnP.InvokeAction<ushort>(_service, "SetRelativeVolume", InstanceId, channel.ToString(), adjustment);
}
示例7: SetMute
public void SetMute(Channel channel, bool desiredMute)
{
UPnP.InvokeAction(_service, "SetMute", InstanceId, channel.ToString(), desiredMute);
}
示例8: SetLoudness
public void SetLoudness(Channel channel, bool desiredLoudness)
{
UPnP.InvokeAction(_service, "SetLoudness", InstanceId, channel.ToString(), desiredLoudness);
}
示例9: RestoreVolumePriorToRamp
public void RestoreVolumePriorToRamp(Channel channel)
{
UPnP.InvokeAction(_service, "RestoreVolumePriorToRamp", InstanceId, channel.ToString());
}
示例10: RampToVolume
public uint RampToVolume(Channel channel, RampType rampType, short desiredVolume)
{
return UPnP.InvokeAction<uint>(_service, "RampToVolume", InstanceId, channel.ToString(), rampType.ToString(), desiredVolume);
}
示例11: GetVolumeDBRange
public void GetVolumeDBRange(Channel channel)
{
// TODO: return MinValue/MaxValue
object[] results = UPnP.InvokeAction(_service, "GetVolumeDBRange", InstanceId, channel.ToString());
}
示例12: GetVolumeDB
public short GetVolumeDB(Channel channel)
{
return UPnP.InvokeAction<short>(_service, "GetVolumeDB", InstanceId, channel.ToString());
}
示例13: ToUrlPart
public static string ToUrlPart( Channel channel )
{
return channel.ToString( ).ToLower( );
}
示例14: ChannelToIndex
private int ChannelToIndex(Channel channel)
{
string s = channel.ToString();
s = s.Replace("Channel", "");
int index = Convert.ToInt32(s) - 1;
if (index >= 11) // we skip channel 10 so subtract one to get the track number
index--;
return index;
}
示例15: AddChannel
TSQueue<float> AddChannel(Channel channel)
{
lock(dictionary)
{
//Check if channel is already in use
if(dictionary.ContainsKey(channel))
throw new Exception(String.Format("Session already uses {0}", channel.ToString()[0])); //!!Possible bug
TTLChannel ttlChannel = GetChannel(encoder, channel);
TSQueue<float> queue = new TSQueue<float>();
dictionary.Add(channel, new ChannelQueue(ttlChannel, queue));
return queue;
}
}