本文整理汇总了C#中IChannel.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IChannel.GetType方法的具体用法?C# IChannel.GetType怎么用?C# IChannel.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IChannel
的用法示例。
在下文中一共展示了IChannel.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeforeTune
private bool BeforeTune(IChannel channel, ref int subChannelId)
{
DVBTChannel dvbtChannel = channel as DVBTChannel;
if (dvbtChannel == null)
{
Log.Log.WriteFile("dvbt:Channel is not a DVBT channel!!! {0}", channel.GetType().ToString());
return false;
}
if (_graphState == GraphState.Idle)
{
BuildGraph();
if (_mapSubChannels.ContainsKey(subChannelId) == false)
{
subChannelId = GetNewSubChannel(channel);
}
}
if (useInternalNetworkProvider)
{
return true;
}
if (_previousChannel == null || _previousChannel.IsDifferentTransponder(dvbtChannel))
{
//_pmtPid = -1;
ILocator locator;
_tuningSpace.get_DefaultLocator(out locator);
IDVBTLocator dvbtLocator = (IDVBTLocator)locator;
dvbtLocator.put_Bandwidth(dvbtChannel.BandWidth);
IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest;
tuneRequest.put_ONID(dvbtChannel.NetworkId);
tuneRequest.put_SID(dvbtChannel.ServiceId);
tuneRequest.put_TSID(dvbtChannel.TransportId);
locator.put_CarrierFrequency((int)dvbtChannel.Frequency);
_tuneRequest.put_Locator(locator);
}
return true;
}
示例2: RegisterChannel
public static void RegisterChannel (IChannel chnl, bool ensureSecurity)
{
if (chnl == null)
throw new ArgumentNullException ("chnl");
if (ensureSecurity) {
ISecurableChannel securable = chnl as ISecurableChannel;
if (securable == null)
throw new RemotingException (String.Format ("Channel {0} is not securable while ensureSecurity is specified as true", chnl.ChannelName));
securable.IsSecured = true;
}
// Put the channel in the correct place according to its priority.
// Since there are not many channels, a linear search is ok.
lock (registeredChannels.SyncRoot)
{
int pos = -1;
for (int n = 0; n < registeredChannels.Count; n++)
{
IChannel regc = (IChannel) registeredChannels[n];
if (regc.ChannelName == chnl.ChannelName && chnl.ChannelName != "")
throw new RemotingException ("Channel " + regc.ChannelName + " already registered");
if (regc.ChannelPriority < chnl.ChannelPriority && pos==-1)
pos = n;
}
if (pos != -1) registeredChannels.Insert (pos, chnl);
else registeredChannels.Add (chnl);
IChannelReceiver receiver = chnl as IChannelReceiver;
if (receiver != null && oldStartModeTypes.Contains (chnl.GetType().ToString ()))
receiver.StartListening (null);
}
}
示例3: BeforeTune
private bool BeforeTune(IChannel channel, ref int subChannelId)
{
DVBCChannel dvbcChannel = channel as DVBCChannel;
if (dvbcChannel == null)
{
Log.Log.WriteFile("dvbc:Channel is not a DVBC channel!!! {0}", channel.GetType().ToString());
return false;
}
/*if (CurrentChannel != null)
{
//@FIX this fails for back-2-back recordings
//if (oldChannel.Equals(channel)) return _mapSubChannels[0];
}*/
if (_graphState == GraphState.Idle)
{
BuildGraph();
if (_mapSubChannels.ContainsKey(subChannelId) == false)
{
subChannelId = GetNewSubChannel(channel);
}
}
if (useInternalNetworkProvider)
{
return true;
}
if (_previousChannel == null || _previousChannel.IsDifferentTransponder(dvbcChannel))
{
//_pmtPid = -1;
ILocator locator;
_tuningSpace.get_DefaultLocator(out locator);
IDVBCLocator dvbcLocator = (IDVBCLocator)locator;
dvbcLocator.put_InnerFEC(FECMethod.MethodNotSet);
dvbcLocator.put_InnerFECRate(BinaryConvolutionCodeRate.RateNotSet);
dvbcLocator.put_OuterFEC(FECMethod.MethodNotSet);
dvbcLocator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet);
dvbcLocator.put_Modulation(dvbcChannel.ModulationType);
dvbcLocator.put_SymbolRate(dvbcChannel.SymbolRate);
IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest;
tuneRequest.put_ONID(dvbcChannel.NetworkId);
tuneRequest.put_SID(dvbcChannel.ServiceId);
tuneRequest.put_TSID(dvbcChannel.TransportId);
locator.put_CarrierFrequency((int)dvbcChannel.Frequency);
_tuneRequest.put_Locator(locator);
_tuneRequest = tuneRequest;
}
return true;
}
示例4: BeforeTune
private bool BeforeTune(ref int subChannelId, IChannel channel)
{
DVBSChannel dvbsChannel = channel as DVBSChannel;
if (dvbsChannel == null)
{
Log.Log.WriteFile("Channel is not a DVBS channel!!! {0}", channel.GetType().ToString());
return false;
}
/*if (CurrentChannel != null)
{
//@FIX this fails for back-2-back recordings
//if (oldChannel.Equals(channel)) return _mapSubChannels[0];
}*/
if (dvbsChannel.SwitchingFrequency < 10)
{
dvbsChannel.SwitchingFrequency = 11700000;
}
Log.Log.WriteFile("dvbs: Tune:{0}", channel);
if (_graphState == GraphState.Idle)
{
BuildGraph();
}
if (_mapSubChannels.ContainsKey(subChannelId) == false)
{
subChannelId = GetNewSubChannel(channel);
}
if (useInternalNetworkProvider)
{
//set the DisEqC parameters
if (_conditionalAccess != null)
{
//int hr2 = ((IMediaControl)_graphBuilder).Pause();
_diseqCsucceded = _conditionalAccess.SendDiseqcCommand(_parameters, dvbsChannel);
//hr2 = ((IMediaControl)_graphBuilder).Run();
//move diseqc motor to correct satellite
if (dvbsChannel != null && dvbsChannel.SatelliteIndex > 0 && _conditionalAccess.DiSEqCMotor != null)
{
_conditionalAccess.DiSEqCMotor.GotoPosition((byte)dvbsChannel.SatelliteIndex);
}
}
return true;
}
if (_previousChannel == null || _previousChannel.IsDifferentTransponder(dvbsChannel))
{
//_pmtPid = -1;
ILocator locator;
int lowOsc;
int hiOsc;
int lnbSwitch;
BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lowOsc, out hiOsc, out lnbSwitch);
Log.Log.Info("LNB low:{0} hi:{1} switch:{2}", lowOsc, hiOsc, lnbSwitch);
if (lnbSwitch == 0)
lnbSwitch = 18000;
IDVBSTuningSpace tuningSpace = (IDVBSTuningSpace)_tuningSpace;
tuningSpace.put_LNBSwitch(lnbSwitch * 1000);
tuningSpace.put_LowOscillator(lowOsc * 1000);
tuningSpace.put_HighOscillator(hiOsc * 1000);
ITuneRequest request;
_tuningSpace.CreateTuneRequest(out request);
_tuneRequest = (IDVBTuneRequest)request;
_tuningSpace.get_DefaultLocator(out locator);
IDVBSLocator dvbsLocator = (IDVBSLocator)locator;
IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest;
tuneRequest.put_ONID(dvbsChannel.NetworkId);
tuneRequest.put_SID(dvbsChannel.ServiceId);
tuneRequest.put_TSID(dvbsChannel.TransportId);
locator.put_CarrierFrequency((int)dvbsChannel.Frequency);
dvbsLocator.put_SymbolRate(dvbsChannel.SymbolRate);
dvbsLocator.put_SignalPolarisation(dvbsChannel.Polarisation);
// Set DVB-S2 and manufacturer specific tuning parameters here.
//-------------------------------------------------------------------
// Important: the original dvbsChannel object *must not* be modified
// otherwise IsDifferentTransponder() will sometimes returns true
// when it shouldn't. See mantis 0002979.
//-------------------------------------------------------------------
DVBSChannel tuneChannel = new DVBSChannel(dvbsChannel);
if (_conditionalAccess != null)
{
tuneChannel = _conditionalAccess.SetDVBS2Modulation(_parameters, tuneChannel);
}
dvbsLocator.put_Modulation(tuneChannel.ModulationType);
Log.Log.WriteFile("dvbs:channel modulation is set to {0}", tuneChannel.ModulationType);
dvbsLocator.put_InnerFECRate(tuneChannel.InnerFecRate);
Log.Log.WriteFile("dvbs:channel FECRate is set to {0}", tuneChannel.InnerFecRate);
_tuneRequest.put_Locator(locator);
//set the DisEqC parameters
if (_conditionalAccess != null)
{
//int hr2 = ((IMediaControl)_graphBuilder).Pause();
_diseqCsucceded = _conditionalAccess.SendDiseqcCommand(_parameters, dvbsChannel);
//hr2 = ((IMediaControl)_graphBuilder).Run();
//move diseqc motor to correct satellite
if (dvbsChannel != null && dvbsChannel.SatelliteIndex > 0 && _conditionalAccess.DiSEqCMotor != null)
{
_conditionalAccess.DiSEqCMotor.GotoPosition((byte)dvbsChannel.SatelliteIndex);
//.........这里部分代码省略.........
示例5: FillChannelInfo
void FillChannelInfo(IChannel channel, IWmiInstance instance)
{
Fx.Assert(null != instance, "");
Fx.Assert(null != channel, "");
instance.SetProperty(AdministrationStrings.Type, channel.GetType().ToString());
ServiceChannel serviceChannel = ServiceChannelFactory.GetServiceChannel(channel);
if (null != serviceChannel)
{
string uri = serviceChannel.RemoteAddress == null ? String.Empty : serviceChannel.RemoteAddress.ToString();
instance.SetProperty(AdministrationStrings.RemoteAddress, uri);
string contractName = null != serviceChannel.ClientRuntime ? serviceChannel.ClientRuntime.ContractName : String.Empty;
string remoteEndpoint = EndpointInstanceProvider.EndpointReference(uri, contractName, false);
instance.SetProperty(AdministrationStrings.RemoteEndpoint, remoteEndpoint);
instance.SetProperty(AdministrationStrings.LocalAddress, serviceChannel.LocalAddress == null ? String.Empty : serviceChannel.LocalAddress.ToString());
instance.SetProperty(AdministrationStrings.SessionId, ((IContextChannel)serviceChannel).SessionId);
}
}
示例6: DoTune
/// <summary>
/// Tune to channel
/// </summary>
/// <param name="subChannelId"></param>
/// <param name="channel"></param>
/// <returns></returns>
private ITvSubChannel DoTune(int subChannelId, IChannel channel, bool ignorePMT)
{
Log.Log.WriteFile("dvbip: Tune:{0}", channel);
ITvSubChannel ch = null;
try
{
DVBIPChannel dvbipChannel = channel as DVBIPChannel;
if (dvbipChannel == null)
{
Log.Log.WriteFile("Channel is not a IP TV channel!!! {0}", channel.GetType().ToString());
return null;
}
Log.Log.Info("dvbip: tune: Assigning oldChannel");
DVBIPChannel oldChannel = CurrentChannel as DVBIPChannel;
if (CurrentChannel != null)
{
//@FIX this fails for back-2-back recordings
//if (oldChannel.Equals(channel)) return _mapSubChannels[0];
Log.Log.Info("dvbip: tune: Current Channel != null {0}", CurrentChannel.ToString());
}
else
{
Log.Log.Info("dvbip: tune: Current channel is null");
}
if (_graphState == GraphState.Idle)
{
Log.Log.Info("dvbip: tune: Building graph");
BuildGraph();
if (_mapSubChannels.ContainsKey(subChannelId) == false)
{
subChannelId = GetNewSubChannel(channel);
}
}
else
{
Log.Log.Info("dvbip: tune: Graph is running");
}
//_pmtPid = -1;
Log.Log.Info("dvb:Submiting tunerequest Channel:{0} subChannel:{1} ", channel.Name, subChannelId);
if (_mapSubChannels.ContainsKey(subChannelId) == false)
{
Log.Log.Info("dvb:Getting new subchannel");
subChannelId = GetNewSubChannel(channel);
}
else {}
Log.Log.Info("dvb:Submit tunerequest size:{0} new:{1}", _mapSubChannels.Count, subChannelId);
_mapSubChannels[subChannelId].CurrentChannel = channel;
_mapSubChannels[subChannelId].OnBeforeTune();
if (_interfaceEpgGrabber != null)
{
_interfaceEpgGrabber.Reset();
}
Log.Log.WriteFile("dvb:Submit tunerequest calling put_TuneRequest");
_lastSignalUpdate = DateTime.MinValue;
_mapSubChannels[subChannelId].OnAfterTune();
ch = _mapSubChannels[subChannelId];
Log.Log.Info("dvbip: tune: Running graph for channel {0}", ch.ToString());
Log.Log.Info("dvbip: tune: SubChannel {0}", ch.SubChannelId);
try
{
RunGraph(ch.SubChannelId, dvbipChannel.Url);
}
catch (TvExceptionNoPMT)
{
if (!ignorePMT)
{
throw;
}
}
Log.Log.Info("dvbip: tune: Graph running. Returning {0}", ch.ToString());
return ch;
}
catch (Exception ex)
{
if (ch != null)
{
FreeSubChannel(ch.SubChannelId);
}
Log.Log.Write(ex);
throw;
}
//unreachable return null;
}
示例7: BeforeTune
private bool BeforeTune(IChannel channel, ref int subChannelId, out int pmtPid)
{
int frequency = 0;
int symbolRate = 0;
int modulation = (int)eModulationTAG.QAM_64;
int bandWidth = 0;
LNBSelectionType lnbSelection = LNBSelectionType.Lnb0;
const int lnbKhzTone = 22;
const int fec = (int)FecType.Fec_Auto;
int polarity = 0;
SS2DisEqcType disType = SS2DisEqcType.None;
int switchFreq = 0;
pmtPid = 0;
int satelliteIndex = 0;
Log.Log.WriteFile("ss2:Tune({0})", channel);
if (_epgGrabbing)
{
_epgGrabbing = false;
if (_epgGrabberCallback != null && _epgGrabbing)
{
_epgGrabberCallback.OnEpgCancelled();
}
}
switch (_cardType)
{
case CardType.DvbS:
DVBSChannel dvbsChannel = channel as DVBSChannel;
if (dvbsChannel == null)
{
Log.Log.Error("Channel is not a DVBS channel!!! {0}", channel.GetType().ToString());
return false;
}
if (CurrentChannel != null)
{
DVBSChannel oldChannels = (DVBSChannel)CurrentChannel;
if (oldChannels.Equals(channel))
{
//@FIX this fails for back-2-back recordings
//Log.Log.WriteFile("ss2:already tuned on this channel");
//return _mapSubChannels[0];
}
}
frequency = (int)dvbsChannel.Frequency;
symbolRate = dvbsChannel.SymbolRate;
satelliteIndex = dvbsChannel.SatelliteIndex;
bool hiBand = BandTypeConverter.IsHiBand(dvbsChannel, Parameters);
int lof1, lof2, sw;
BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lof1, out lof2, out sw);
int lnbFrequency;
if (BandTypeConverter.IsHiBand(dvbsChannel, Parameters))
lnbFrequency = lof2 * 1000;
else
lnbFrequency = lof1 * 1000;
//0=horizontal or left, 1=vertical or right
polarity = 0;
if (dvbsChannel.Polarisation == Polarisation.LinearV)
polarity = 1;
if (dvbsChannel.Polarisation == Polarisation.CircularR)
polarity = 1;
Log.Log.WriteFile("ss2: Polarity:{0} {1}", dvbsChannel.Polarisation, polarity);
lnbSelection = LNBSelectionType.Lnb0;
if (dvbsChannel.BandType == BandType.Universal)
{
//only set the LNB (22,33,44) Khz tone when we use ku-band and are in hi-band
switch (lnbKhzTone)
{
case 22:
lnbSelection = LNBSelectionType.Lnb22kHz;
break;
}
if (hiBand == false)
{
lnbSelection = LNBSelectionType.Lnb0;
}
}
switch (dvbsChannel.DisEqc)
{
case DisEqcType.None: // none
disType = SS2DisEqcType.None;
break;
case DisEqcType.SimpleA: // Simple A
disType = SS2DisEqcType.Simple_A;
break;
case DisEqcType.SimpleB: // Simple B
disType = SS2DisEqcType.Simple_B;
break;
case DisEqcType.Level1AA: // Level 1 A/A
disType = SS2DisEqcType.Level_1_A_A;
break;
case DisEqcType.Level1BA: // Level 1 B/A
disType = SS2DisEqcType.Level_1_B_A;
break;
case DisEqcType.Level1AB: // Level 1 A/B
disType = SS2DisEqcType.Level_1_A_B;
break;
case DisEqcType.Level1BB: // Level 1 B/B
disType = SS2DisEqcType.Level_1_B_B;
break;
}
switchFreq = lnbFrequency / 1000; //in MHz
//.........这里部分代码省略.........
示例8: FillChannelInfo
private void FillChannelInfo(IChannel channel, IWmiInstance instance)
{
instance.SetProperty("Type", channel.GetType().ToString());
ServiceChannel serviceChannel = ServiceChannelFactory.GetServiceChannel(channel);
if (serviceChannel != null)
{
string str = (serviceChannel.RemoteAddress == null) ? string.Empty : serviceChannel.RemoteAddress.ToString();
instance.SetProperty("RemoteAddress", str);
string contractName = (serviceChannel.ClientRuntime != null) ? serviceChannel.ClientRuntime.ContractName : string.Empty;
string str3 = EndpointInstanceProvider.EndpointReference(str, contractName, false);
instance.SetProperty("RemoteEndpoint", str3);
instance.SetProperty("LocalAddress", (serviceChannel.LocalAddress == null) ? string.Empty : serviceChannel.LocalAddress.ToString());
instance.SetProperty("SessionId", ((IContextChannel) serviceChannel).SessionId);
}
}
示例9: ChannelListViewItem
public ChannelListViewItem(IChannel channel, ChannelListView listView)
: base(channel.Name, "dynamic channel", listView.Groups["dynamic"])
{
this.name = channel.Name;
this.dynamicChannel = true;
endpoint = null;
if (channel is UDPChannel) {
UDPChannel udpChannel = (UDPChannel)channel;
endpoint = new IPEndPoint(udpChannel.IP, udpChannel.Port);
listener = new ChannelListener(endpoint, ChannelType.UDPChannel);
}
this.SubItems.Add(endpoint == null ? channel.GetType().Name : endpoint.ToString());
this.SubItems.Add("");
this.SubItems.Add("");
}
示例10: GetToken
private string GetToken(IChannel channel)
{
if ((DateTime.Now - this.tokenLastUpdate) < this.tokenUpdateInterval)
{
return this.token;
}
this.token = (string)channel.GetType().InvokeMember(this.tokenOperation, publicInstanceMethod, null, channel, null);
this.tokenLastUpdate = DateTime.Now;
return this.token;
}
示例11: BeforeTune
private bool BeforeTune(IChannel channel)
{
ATSCChannel atscChannel = channel as ATSCChannel;
if (atscChannel == null)
{
Log.Log.WriteFile("atsc:Channel is not a ATSC channel!!! {0}", channel.GetType().ToString());
return false;
}
if (_graphState == GraphState.Idle)
{
BuildGraph();
}
if (useInternalNetworkProvider)
{
return true;
}
if (_previousChannel == null || _previousChannel.IsDifferentTransponder(atscChannel))
{
Log.Log.WriteFile("atsc:using new channel tuning settings");
ITuneRequest request;
int hr = _tuningSpace.CreateTuneRequest(out request);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - CreateTuneRequest");
_tuneRequest = request;
IATSCChannelTuneRequest tuneRequest = (IATSCChannelTuneRequest)_tuneRequest;
ILocator locator;
hr = _tuningSpace.get_DefaultLocator(out locator);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - get_DefaultLocator");
IATSCLocator atscLocator = (IATSCLocator)locator;
hr = atscLocator.put_SymbolRate(-1);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_SymbolRate");
hr = atscLocator.put_TSID(-1);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_TSID");
hr = atscLocator.put_CarrierFrequency((int)atscChannel.Frequency);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_CarrierFrequency");
hr = atscLocator.put_Modulation(atscChannel.ModulationType);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_Modulation");
hr = tuneRequest.put_Channel(atscChannel.MajorChannel);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_Channel");
hr = tuneRequest.put_MinorChannel(atscChannel.MinorChannel);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_MinorChannel");
hr = atscLocator.put_PhysicalChannel(atscChannel.PhysicalChannel);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_PhysicalChannel");
hr = _tuneRequest.put_Locator(locator);
if (hr != 0)
Log.Log.WriteFile("atsc: Failed - put_Locator");
//set QAM paramters if necessary...
_conditionalAccess.CheckATSCQAM(atscChannel);
}
else
{
Log.Log.WriteFile("atsc:using previous channel tuning settings");
}
return true;
}