private void _Unbind() { Transponder.Query <IEmotion>().Supply -= _SetEmotion; Transponder.Query <IEmotion>().Unsupply -= _ClearEmotion; Transponder.Query <IMoveController>().Supply -= _SetMoveController; Transponder.Query <IMoveController>().Unsupply -= _ClearMoveController; Transponder.Query <IVisible>().Supply -= _SetIndividual; Transponder.Query <IVisible>().Unsupply -= _ClearIndividual; Transponder.Query <INormalSkill>().Supply -= _SetNormalSkill; Transponder.Query <INormalSkill>().Unsupply -= _ClearNormalSkill; Transponder.Query <ICastSkill>().Supply -= _SetCastSkill; Transponder.Query <ICastSkill>().Unsupply -= _ClearCastSkill; Transponder.Query <IBattleSkill>().Supply -= _SetBattleSkill; Transponder.Query <IBattleSkill>().Unsupply -= _ClearBattleSkill; Transponder.Query <IMakeSkill>().Supply -= _SetMake; Transponder.Query <IMakeSkill>().Unsupply -= _ClearMake; Transponder.Query <IBagNotifier>().Supply -= _SetBag; Transponder.Query <IBagNotifier>().Unsupply -= _ClearBag; Transponder.Query <IEquipmentNotifier>().Supply -= _SetEquipment; Transponder.Query <IEquipmentNotifier>().Unsupply -= _ClearEquipment; Transponder.Query <IInventoryController>().Supply -= _SetInventoryController; Transponder.Query <IInventoryController>().Unsupply -= _ClearInventoryController; }
private void LoadTslData(SQLiteCommand cmd, int tableNr, string joinTable, string joinFields, Action <Transponder, SQLiteDataReader, int> enhanceTransponderInfo) { if (!this.tableNames.Contains(joinTable.Replace("#", tableNr.ToString()))) { return; } cmd.CommandText = $"select tsl_#.tsl_rec_id, `t_desc.on_id`, `t_desc.ts_id`, `t_ref.satl_rec_id`, `t_desc.e_bcst_medium` {joinFields} " + $" from tsl_# inner join {joinTable} on {joinTable}.tsl_rec_id=tsl_#.tsl_rec_id"; cmd.CommandText = cmd.CommandText.Replace("#", tableNr.ToString()); using (var r = cmd.ExecuteReader()) { while (r.Read()) { int id = (tableNr << 16) | r.GetInt32(0); var trans = new Transponder(id); trans.OriginalNetworkId = r.GetInt32(1); trans.TransportStreamId = r.GetInt32(2); trans.Satellite = this.DataRoot.Satellites.TryGet(r.GetInt32(3)); enhanceTransponderInfo(trans, r, 5); this.DataRoot.AddTransponder(trans.Satellite, trans); } } }
public SatChannel(int order, int slot, DataMapping data, DataRoot dataRoot) : base(data) { this.InUse = data.GetWord(_SatConfigIndex) != 0xFFFF; if (!InUse) { return; } this.InitCommonData(slot, SignalSource.DvbS, data); this.InitDvbData(data); int transponderIndex = data.GetWord(_TransponderIndex); Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex); Satellite sat = transponder.Satellite; this.Transponder = transponder; this.Satellite = sat.Name; this.SatPosition = sat.OrbitalPosition; this.RecordOrder = order; this.TransportStreamId = transponder.TransportStreamId; this.OriginalNetworkId = transponder.OriginalNetworkId; this.SymbolRate = transponder.SymbolRate; this.Polarity = transponder.Polarity; this.FreqInMhz = transponder.FrequencyInMhz; }
public TransponderStatus LatestForTransponder(Transponder transponder) { TransponderStatus latest; _statuses.TryGetValue(transponder.ID, out latest); return(latest); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Bitmap tempImg = null; string styleName = string.Empty; DA.GetData(0, ref tempImg); DA.GetData(1, ref styleName); Bitmap img = new Bitmap(tempImg); Bitmap result; try { StyleGanInput input = new StyleGanInput(styleName, img); string computed = Transponder.Post(RoutesController.StyleTransferRoute, input); StyleGanOutput output = JsonConvert.DeserializeObject <StyleGanOutput>(computed); result = output.ToBitmap(); } catch { result = default(Bitmap); } DA.SetData(0, result); }
public static List <Transponder> GetTransponderData(string FileName) { List <Transponder> returnValue = new List <Transponder>(); var engine = new FileHelperEngine <TransponderData>(); string method = System.Reflection.MethodBase.GetCurrentMethod().Name; var result = engine.ReadFile(FileName); foreach (TransponderData td in result) { string PlateNumber = string.Empty; TransponderTypes TransponderType = TransponderTypes.Sticker; if (td.TransponderType.ToLower() == "ezp") { TransponderType = TransponderTypes.EZPass; } else { PlateNumber = td.PlateNumber; } Transponder t = new Transponder { TransponderNumber = td.TransponderNumber, TransponderType = TransponderType, PlateNumber = PlateNumber }; returnValue.Add(t); } return(returnValue); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Bitmap tempBitmap = null; DA.GetData(0, ref tempBitmap); Bitmap img = new Bitmap(tempBitmap); Bitmap result; try { DepthMapInput input = new DepthMapInput(img); string computed = Transponder.Post(RoutesController.DepthMapRoute, input); DepthMapOutput output = JsonConvert.DeserializeObject <DepthMapOutput>(computed); result = output.ToBitmap(); } catch (Exception exc) { result = default(Bitmap); } DA.SetData(0, result); }
public SatChannel(int slot, SignalSource presetList, DataMapping data, DataRoot dataRoot, FavoritesIndexMode sortedFavorites, IDictionary <int, string> providerNames) : base(data, sortedFavorites) { this.InitCommonData(slot, SignalSource.DVBS | presetList, data); if (!this.InUse) { this.IsDeleted = true; return; } this.InitDvbData(data, providerNames); int transponderIndex = data.GetWord(_TransponderIndex); Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex); if (transponder == null) { var list = dataRoot.GetChannelList(this.SignalSource | SignalSource.TV); dataRoot.Warnings.AppendFormat("{0} channel record #{1} (Pr# {2} \"{3}\") contains invalid transponder index {4}\r\n", list.ShortCaption, slot, this.OldProgramNr, this.Name, transponderIndex); return; } Satellite sat = transponder.Satellite; this.Satellite = sat.Name; this.SatPosition = sat.OrbitalPosition; this.Polarity = transponder.Polarity; this.SymbolRate = transponder.SymbolRate; this.FreqInMhz = transponder.FrequencyInMhz; this.ChannelOrTransponder = ""; }
public async Task ListenTunnel() { try { Log("BEGIN LISTEN"); using (var tunnel = _client.EventTunnel()) { this._tunnel = tunnel; var responseTask = Task.Run(async() => { while (await tunnel.ResponseStream.MoveNext(CancellationToken.None)) { var response = tunnel.ResponseStream.Current; if (response.EventType != "PONG") { Log($"GOT MESSAGE {response.EventType} {response.Body}"); } if (response.EventType == "LOGIN") { QQLoginInfo qqinfo = JsonConvert.DeserializeObject <QQLoginInfo>(response.Body); var user = new QQUser(qqinfo.QQNumber, qqinfo.Password); var socketServer = new GRPCSocketServiceImpl(user, this); var transponder = new Transponder(); var sendService = new GRPCSendMessageServiceImpl(socketServer, user); var manage = new MessageManage(socketServer, user, transponder); var robot = new GRPCRobot(sendService, transponder, user, this); manage.Init(); } } }); EventRequest req = new EventRequest { EventType = "REGISTER", Body = "HELLO", ClientId = this.clientId, ClientType = this.clientType }; await tunnel.RequestStream.WriteAsync(req); foreach (EventRequest ping in SendPing(10)) { await tunnel.RequestStream.WriteAsync(ping); } await tunnel.RequestStream.CompleteAsync(); await responseTask; Log("Tunnel ended"); } } catch (RpcException e) { Log("RPC failed", e); } }
public void TransponderConstructorTest() { string stationName = "TestStation"; // TODO: Initialize to an appropriate value int distance = 1; // TODO: Initialize to an appropriate value Transponder target = new Transponder(stationName, distance); Assert.AreEqual(stationName, target.StationName); Assert.AreEqual(distance, target.DistanceToStation); }
public void StationNameTest() { string stationName = "NameTest"; // TODO: Initialize to an appropriate value int distance = 0; // TODO: Initialize to an appropriate value Transponder target = new Transponder(stationName, distance); // TODO: Initialize to an appropriate value string actual; actual = target.StationName; Assert.AreEqual(stationName, actual); }
public void DistanceToStationTest() { string stationName = ""; // TODO: Initialize to an appropriate value int distance = 2; // TODO: Initialize to an appropriate value Transponder target = new Transponder(stationName, distance); // TODO: Initialize to an appropriate value int actual; actual = target.DistanceToStation; Assert.AreEqual(distance, actual); }
private Transponder CreateTransponder(XmlNode mux, ref int transponderId, decimal freqDivider) { var t = new Transponder(++transponderId); t.Polarity = mux.Attributes["pol"].InnerText == "1" ? 'H' : 'V'; t.SymbolRate = Int32.Parse(mux.Attributes["sym"].InnerText); t.FrequencyInMhz = Int32.Parse(mux.Attributes["frq"].InnerText) / freqDivider; t.OriginalNetworkId = Int32.Parse(mux.Attributes["onid"].InnerText); t.TransportStreamId = Int32.Parse(mux.Attributes["tsid"].InnerText); return(t); }
public void TransponderTest() { TrackBlock target = new TrackBlock(); // TODO: Initialize to an appropriate value Transponder expected = new Transponder("Test", 1); // TODO: Initialize to an appropriate value target.Transponder = expected; Transponder actual; target.Transponder = expected; actual = target.Transponder; Assert.AreEqual(expected, actual); }
public TwoWayMessage LatestForTransponder(Transponder transponder) { TwoWayMessage latest; if (_latestTwoWayMessages.TryGetValue(transponder.ID, out latest)) { return(latest); } else { return(null); } }
public PassingTrigger LatestForTransponder(Transponder transponder) { PassingTrigger latest; if (_latestPassingTriggers.TryGetValue(transponder.ID, out latest)) { return(latest); } else { return(null); } }
public DriverInfo LatestForTransponder(Transponder transponder) { DriverInfo latest; if (_latestDriverInfos.TryGetValue(transponder.ID, out latest)) { return(latest); } else { return(null); } }
private void LoadDvbsTransponders(string path) { if (!File.Exists(path)) { return; } var data = File.ReadAllBytes(path); if (data.Length < 4) { return; } var checksum = BitConverter.ToUInt32(data, data.Length - 4); var crc = ~Crc32.Reversed.CalcCrc32(data, 0, data.Length - 4); if (checksum != crc) { return; } int recordSize = BitConverter.ToInt32(data, 4); int recordCount = BitConverter.ToInt32(data, 8); // 12 byte header, table of (next, prev) transponder, records, crc32 if (data.Length != 12 + recordCount * 4 + recordCount * recordSize + 4) { return; } var baseOffset = 12 + recordCount * 4; for (int i = 0; i < recordCount; i++, baseOffset += recordSize) { var symRate = BitConverter.ToUInt16(data, baseOffset + 0); if (symRate == 0xFFFF) { continue; } var tsid = BitConverter.ToUInt16(data, baseOffset + 16); var onid = BitConverter.ToUInt16(data, baseOffset + 18); var t = new Transponder(i); t.SymbolRate = symRate; t.FrequencyInMhz = BitConverter.ToUInt16(data, baseOffset + 2); var satIndex = data[baseOffset + 6] >> 4; // guesswork t.Satellite = DataRoot.Satellites.TryGet(satIndex); t.TransportStreamId = tsid; t.OriginalNetworkId = onid; this.DataRoot.AddTransponder(t.Satellite, t); } }
private static void Main(string[] args) { var user = new QQUser(0, ""); var socketServer = new SocketServiceImpl(user); var transponder = new Transponder(); var sendService = new SendMessageServiceImpl(socketServer, user); var manage = new MessageManage(socketServer, user, transponder); var robot = new TestRoBot(sendService, transponder, user); manage.Init(); Console.ReadKey(); }
public Transponder SetupTransponder() { if (_transponder == null) { _transponder = GetComponentInChildren <Transponder>(); if (_transponder == null) { _transponder = _body.gameObject.AddComponent <Transponder>(); } } _transponder.Init(this); return(_transponder); }
public bool initializeDevice(string portName) { Transponder device = new Transponder(portName, getAdressForPort(portName)); if (device != null) { deviceHandler = device; return(deviceHandler.Initialize()); } else { return(false); } }
public byte getAdressForPort(string portName) { if (portName == "com256" || portName == "com257" || portName == "com258") { //device simulate byte address = 0; return(address); } else { byte address = Transponder.GetAddress(portName); return(address); } // what the address was returned when the device was not connected? maybe zero }
private Channel CreateChannel(XmlNode service, SignalSource src, Transponder transponder, ref int chanId) { var c = new Channel(src, chanId, chanId, service); c.Transponder = transponder; c.Polarity = transponder.Polarity; c.FreqInMhz = transponder.FrequencyInMhz; c.SymbolRate = transponder.SymbolRate; c.OriginalNetworkId = transponder.OriginalNetworkId; c.TransportStreamId = transponder.TransportStreamId; ReadCommonChannelData(c, service); c.Hidden = service.Attributes["vis"].InnerText == "0"; c.ServiceId = Int32.Parse(service.Attributes["sid"].InnerText); c.Encrypted = service.Attributes["ca"].InnerText == "1"; c.IsDeleted = service.Attributes["del"].InnerText == "1"; return(c); }
private void LoadTransponders(JToken transponderList, Satellite sat) { foreach (var node in transponderList) { var id = (sat.Id << 16) + (int)node["channelIdx"]; var tp = new Transponder(id); tp.Satellite = sat; sat.Transponder.Add(id, tp); tp.FrequencyInMhz = (int)node["frequency"]; tp.Number = (int)node["channelIdx"]; var pol = ((string)node["polarization"]).ToLower(); tp.Polarity = pol.StartsWith("h") ? 'H' : pol.StartsWith("V") ? 'V' : '\0'; tp.TransportStreamId = (int)node["TSID"]; tp.OriginalNetworkId = (int)node["ONID"]; tp.SymbolRate = (int)node["symbolRate"]; } }
private static void Main(string[] args) { if (args.Length != 2) { throw new Exception("参数数量错误:账号 密码。"); } var user = new QQUser(long.Parse(args[0]), args[1]); // 虽然已经太迟了,但是还是把密码去掉了... 起码总比在这里好啊!(塞口球 var socketServer = new SocketServiceImpl(user); var transponder = new Transponder(); var sendService = new SendMessageServiceImpl(socketServer, user); var manage = new MessageManage(socketServer, user, transponder); var robot = new TestRobot(sendService, transponder, user); manage.Init(); Console.ReadKey(); }
/// <summary> /// Gets the transaction data. /// </summary> /// <param name="FileName">Name of the file.</param> /// <returns></returns> public static List <Transaction> GetTransactionData(string FileName) { List <Transaction> returnValue = new List <Transaction>(); var engine = new FileHelperEngine <TransactionData>(); string method = System.Reflection.MethodBase.GetCurrentMethod().Name; var result = engine.ReadFile(FileName); foreach (TransactionData td in result) { PopulateTransponders(); PopulateVehicleClasses(); Transponder Transponder = null; if (td.PlateNumber != null) { Transponder = TransponderList.FirstOrDefault(x => x.PlateNumber == td.PlateNumber); } else { TransponderList.FirstOrDefault(x => x.Transponder_Id == td.TransponderNumber); } Transaction t = new Transaction { TransactionNumber = td.TransactionNumber, Plaza = td.Plaza, TransactionStatus = td.TransactionStatus, TransactionType = td.TransactionType, TransactionDate = td.TransactionDate, RelatedJournal_Id = td.RelatedJournal_Id, PostedDate = td.PostedDate, Journal_Id = td.Journal_Id, Amount = td.Amount, PlateNumber = td.PlateNumber, Lane = td.Lane, Transponder = Transponder, TransponderNumber = td.TransponderNumber, TransactionDescription = td.TransactionDescription }; returnValue.Add(t); } return(returnValue); }
private void ReadTransponders(SQLiteCommand cmd) { cmd.CommandText = "select satId, tpFreq, tpPol, tpSr, tpId from SAT_TP"; using (var r = cmd.ExecuteReader()) { while (r.Read()) { // 171027 - ohuseyinoglu: tpId is the primary key of this table, we should be able to use it as "id/dict. index" // It will also be our lookup value for the CHNL table int id = r.GetInt32(4); Transponder tp = new Transponder(id); tp.FrequencyInMhz = (decimal)r.GetInt32(1) / 1000; tp.Number = id; tp.Polarity = r.GetInt32(2) == 0 ? 'H' : 'V'; tp.Satellite = this.DataRoot.Satellites.TryGet(r.GetInt32(0)); tp.SymbolRate = r.GetInt32(3); this.DataRoot.AddTransponder(tp.Satellite, tp); } } }
private static void Main(string[] args) { #if NETCOREAPP2_0 || NETCOREAPP2_1 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); #endif var user = new QQUser(MyQQ, MyPassWord); var socketServer = new SocketServiceImpl(user); var transponder = new Transponder(); var sendService = new SendMessageServiceImpl(socketServer, user); var manage = new MessageManage(socketServer, user, transponder); #if NETCOREAPP2_0 || NETCOREAPP2_1 #else var robot = new TestRoBot(sendService, transponder, user); #endif manage.Init(); Console.ReadKey(); }
private void ReadTransponder(string zip, string fileName) { byte[] data = ReadFileContent(zip, fileName); if (data == null) { return; } int count = (data.Length - 4) / c.dvbsTransponderLength; var mapping = this.transponderMappings.GetMapping(c.dvbsTransponderLength); for (int i = 0; i < count; i++) { mapping.SetDataPtr(data, 4 + i * c.dvbsTransponderLength); if (mapping.GetByte("offMagicByte") == 0) { continue; } int transponderNr = (int)mapping.GetDword("offTransponderIndex"); if (transponderNr == 0) { continue; } int satelliteNr = (int)mapping.GetDword("offSatelliteIndex"); var sat = this.DataRoot.Satellites.TryGet(satelliteNr); if (sat == null) { DataRoot.Warnings.Append(string.Format("Transponder #{0} references invalid satellite #{1}", transponderNr, satelliteNr)); continue; } Transponder transponder = new Transponder(transponderNr); transponder.FrequencyInMhz = (uint)(mapping.GetDword("offFrequency") / 1000); transponder.SymbolRate = (int)(mapping.GetDword("offSymbolRate") / 1000); transponder.Polarity = mapping.GetByte("offPolarity") == 0 ? 'H' : 'V'; this.DataRoot.AddTransponder(sat, transponder); } }
private void ReadTransponders(SQLiteCommand cmd) { cmd.CommandText = "select m_id, m_satellite_id, m_frequency, m_polarisation, m_symbol_rate from SatTxTable"; using var r = cmd.ExecuteReader(); while (r.Read()) { int id = r.GetInt32(0); int satId = r.GetInt32(1); int freq = r.GetInt32(2); if (this.DataRoot.Transponder.TryGet(id) != null) { continue; } Transponder tp = new Transponder(id); tp.FrequencyInMhz = (decimal)freq; tp.Polarity = r.GetInt32(3) == 0 ? 'H' : 'V'; tp.Satellite = this.DataRoot.Satellites.TryGet(satId); tp.SymbolRate = r.GetInt32(4); this.DataRoot.AddTransponder(tp.Satellite, tp); } }
public void AddTransponder(Transponder transponder) { throw new NotImplementedException(); }
/// <summary> /// Grabs the epg. /// </summary> public void GrabEpg() { _tvController.OnTvServerEvent += _eventHandler; TvBusinessLayer layer = new TvBusinessLayer(); Setting s = layer.GetSetting("timeoutEPG", "10"); if (Int32.TryParse(s.Value, out _epgTimeOut) == false) { _epgTimeOut = 10; } _currentTransponder = TransponderList.Instance.CurrentTransponder; Channel channel = _currentTransponder.CurrentChannel; Log.Epg("EpgCard: grab epg on card: #{0} transponder: #{1} ch:{2} ", _card.IdCard, TransponderList.Instance.CurrentIndex, channel.DisplayName); _state = EpgState.Idle; _isRunning = true; _user = new User("epg", false, -1); if (GrabEpgForChannel(channel, _currentTransponder.Tuning, _card)) { Log.Epg("EpgCard: card: {0} starting to grab {1}", _user.CardId, _currentTransponder.Tuning.ToString()); _currentTransponder.InUse = true; //succeeded, then wait for epg to be received _state = EpgState.Grabbing; _grabStartTime = DateTime.Now; _epgTimer.Enabled = true; return; } Log.Epg("EpgCard: unable to grab epg transponder: {0} ch: {1} started on {2}", TransponderList.Instance.CurrentIndex, channel.DisplayName, _user.CardId); Log.Epg("{0}", _currentTransponder.Tuning.ToString()); }