/// <summary> /// 导入数据 /// </summary> /// <param name="json"></param> public static bool Load(string json) { try { DataModel data = JsonConvert.DeserializeObject <DataModel>(json); if (data.devName != null) { foreach (var mac in data.devName.Keys) { DeviceName.SetDeviceName(mac, data.devName[mac]); } } if (data.devType != null) { foreach (var mac in data.devType.Keys) { DeviceType.SetDeviceType(mac, (Model.DeviceType)data.devType[mac]); } } if (data.whiteList != null) { SetSetting("DeviceWhiteList", JsonConvert.SerializeObject(data.whiteList)); } return(true); } catch (Exception) { return(false); } }
string deviceProtocol = "com.app.myprotocol"; // MRI device-specific protocol private bool ConnectToDevice(string accessoryId) { _streamDelegate = StreamDelegate.SharedController(); _accessoryList = EAAccessoryManager.SharedAccessoryManager.ConnectedAccessories; foreach (EAAccessory accessory in _accessoryList) { var accId = accessory.ValueForKey((NSString)"connectionID"); var accessoryName = accessory.ValueForKey((NSString)"name"); var accString = accId.ToString(); if (DeviceName.Contains(accessoryName.ToString())) { _selectedAccessory = accessory; _streamDelegate.SetupController(accessory, deviceProtocol); _streamDelegate.OpenSession(); Console.WriteLine("Already connected via bluetooth"); return(true); } } return(false); }
public List <DeviceName> GetAll() { List <DeviceName> returnMe = new List <DeviceName>(); using (SqlConnection connection = new SqlConnection(this._connString)) { using (SqlCommand sqlCommand = new SqlCommand { Connection = connection, CommandType = CommandType.Text, CommandText = "SELECT * FROM DeviceNames;" }) { sqlCommand.Connection.Open(); SqlDataReader dbDataReader = sqlCommand.ExecuteReader(); if (dbDataReader.HasRows) { while (dbDataReader.Read()) { DeviceName obj = dataReaderToObject(dbDataReader); if (obj != null) { returnMe.Add(obj); } } } sqlCommand.Connection.Close(); } } return(returnMe); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (DeviceName.Length != 0) { hash ^= DeviceName.GetHashCode(); } if (InterfaceName.Length != 0) { hash ^= InterfaceName.GetHashCode(); } if (Address.Length != 0) { hash ^= Address.GetHashCode(); } if (DeviceDetails.Length != 0) { hash ^= DeviceDetails.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Ons the get async. /// </summary> /// <returns>The get async.</returns> public async Task <IActionResult> OnPostAsync() { _logger.LogDebug("DeviceNames/Create/OnPostAsync"); if (!ModelState.IsValid) { return(Page()); } var emptyDeviceName = new DeviceName(); if (await TryUpdateModelAsync <DeviceName>( emptyDeviceName, "devicename", // Prefix for form value d => d.Name, d => d.LastUpdate ).ConfigureAwait(false)) { _context.DeviceName.Add(emptyDeviceName); await _context.SaveChangesAsync().ConfigureAwait(false); return(RedirectToPage("./Index")); } return(null); }
public override void FromString(params string[] ParaList) { if (ParaList.Length != 3) { throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring"); } GuiStringList.Clear(); foreach (var it in ParaList) { GuiStringList.Add(it); } var L1 = GuiStringList[0].Split('_'); //Name Enum.TryParse(L1[0], out EnumDeviceName Dn); DeviceName = Dn; //LocalIndex LocalIndex = int.Parse(L1[1]); Function = 0x23; //GlobalIndex GlobalIndex = int.Parse(GuiStringList[2]); }
public override int GetHashCode() { int hash = 1; if (Control != 0) { hash ^= Control.GetHashCode(); } if (Status != 0) { hash ^= Status.GetHashCode(); } if (DeviceName.Length != 0) { hash ^= DeviceName.GetHashCode(); } if (DeviceId.Length != 0) { hash ^= DeviceId.GetHashCode(); } if (Operator.Length != 0) { hash ^= Operator.GetHashCode(); } return(hash); }
//=========================== unity Send // public void initialPluginnnn(){ // //Debug.Log("inital OnUnity"); // _InitGSensor(); // } // public void onUnityStartScan (){ // //Debug.Log("OnUnityStartScan"); // _onUnityStartScan(); // } public static void OnUnityStartScan() { Debug.Log("OnUnityStartScan"); _onUnityStartScan(); DeviceName.Clear(); }
public DeviceLicense(DeviceName name, DeviceType type, DirectionType direction, byte value) { _name = name; _type = type; _direction = direction; SetValue(value); }
/// <summary> /// strDevName device subnet id and device id /// </summary> /// <param name="strDevName"></param> public override void DownLoadInformationFrmDevice(string strDevName, int intDeviceType, int intActivePage, int num1, int num2)// 0 mean all, else that tab only { Boolean BlnIsSuccess = false; if (strDevName == null) { return; } string strMainRemark = strDevName.Split('\\')[1].Trim(); DeviceName = strDevName.Split('\\')[0].Trim(); byte bytSubID = byte.Parse(DeviceName.Split('-')[0].ToString()); byte bytDevID = byte.Parse(DeviceName.Split('-')[1].ToString()); byte[] ArayTmp = null; base.DownLoadInformationFrmDevice(strDevName, intDeviceType, intActivePage, 0, 0); // 读取回路信息 Chans = new BasicCurtain(); Chans.ReadCurtainSetupInformation(bytSubID, bytDevID, 1, intDeviceType); MyRead2UpFlags[0] = true; if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy) { CsConst.calculationWorker.ReportProgress(100, null); } BlnIsSuccess = true; return; }
public override void FromString(params string[] ParaList) { if (ParaList.Length != 11) { throw new Exception($"Wrong para number when parse {DeviceName.ToString()} formstring"); } GuiStringList.Clear(); foreach (var it in ParaList) { GuiStringList.Add(it); } Name = GuiStringList[0]; Function = GuiStringList[1]; Plug_Sequence = GuiStringList[2]; Enum.TryParse(StrEnumResolution.Where(a => a.Value.Equals(GuiStringList[3])).First().Key.ToString(), out EnumHL5002Resolution resolution); Enum.TryParse(StrEnumRevolution.Where(a => a.Value.Equals(GuiStringList[4])).First().Key.ToString(), out EnumHL5002Revolution revolution); Resolution = resolution; Revolution = revolution; PresetValue = GuiStringList[5]; ResPara1 = GuiStringList[6]; ResPara2 = GuiStringList[7]; ResPara3 = GuiStringList[8]; ResPara4 = GuiStringList[9]; ResPara5 = GuiStringList[10]; }
public override int GetHashCode() { unchecked { var hashCode = AlertID; hashCode = (hashCode * 397) ^ Code; hashCode = (hashCode * 397) ^ (Source != null ? Source.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Severity != null ? Severity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Created.GetHashCode(); hashCode = (hashCode * 397) ^ SnoozedEndDate.GetHashCode(); hashCode = (hashCode * 397) ^ (ThresholdValue1 != null ? ThresholdValue1.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue2 != null ? ThresholdValue2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue3 != null ? ThresholdValue3.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue4 != null ? ThresholdValue4.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue5 != null ? ThresholdValue5.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DeviceGuid != null ? DeviceGuid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AdditionalInfo != null ? AdditionalInfo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AlertCategoryID != null ? AlertCategoryID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Archived.GetHashCode(); hashCode = (hashCode * 397) ^ ArchivedDate.GetHashCode(); hashCode = (hashCode * 397) ^ TicketID.GetHashCode(); hashCode = (hashCode * 397) ^ (AlertMessage != null ? AlertMessage.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DeviceName != null ? DeviceName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerID; hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MessageTemplate != null ? MessageTemplate.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FolderID.GetHashCode(); hashCode = (hashCode * 397) ^ PollingCyclesCount.GetHashCode(); return(hashCode); } }
public DeviceLicense(DeviceName name, DeviceType type, DirectionType direction, byte levelID, byte functionControl) { _name = name; _type = type; _levelID = levelID; _direction = direction; _functionControl = functionControl; }
public override int GetHashCode() { int hashFullName = FullName == null ? 0 : FullName.GetHashCode(); int hashDeviceName = DeviceName == null ? 0 : DeviceName.GetHashCode(); int hashCOMPort = COMPort == null ? 0 : COMPort.GetHashCode(); return(hashFullName ^ hashDeviceName ^ hashCOMPort); }
public IConfiguration AddDeviceEmulation(DeviceName deviceName, ScreenOrientation screenOrientation = ScreenOrientation.Portrait, string baselineEnvName = null) { ChromeEmulationInfo emulationInfo = new ChromeEmulationInfo(deviceName, screenOrientation); return(AddBrowser(emulationInfo)); }
/// <summary> /// 导出数据 /// </summary> /// <returns></returns> public static string Export() { var res = new DataModel(); res.devName = DeviceName.GetDeviceName(); res.devType = DeviceType.GetDeviceType(); return(JsonConvert.SerializeObject(res)); }
/// <summary> /// Computes the hash code for the current metadata object. /// </summary> /// <returns> /// The hash code for the current metadata object, extracted from a combination /// of hashes for the device name and various version numbers. /// </returns> public override int GetHashCode() { return(17 * DeviceName.GetHashCode() + 8971 * FirmwareVersion.GetHashCode() + 2803 * ProtocolVersion.GetHashCode() + 691 * HardwareVersion.GetHashCode() + 1409 * AssemblyNumber.GetHashCode() + 2333 * PrereleaseVersion.GetHashCode()); }
private void Start() { string initialRecordingDeviceName = settings.RecordingDeviceName.IsNullOrEmpty() || !Microphone.devices.Contains(settings.RecordingDeviceName) ? Microphone.devices.FirstOrDefault() : settings.RecordingDeviceName; SetRecordingDevice(initialRecordingDeviceName, settings.SampleRate); DeviceName.Subscribe(newValue => settings.RecordingDeviceName = newValue); }
public override int GetHashCode() { int result = DeviceName.GetHashCode(); result = 31 * result + Interval; result = 31 * result + Timeout; result = 31 * result + EqualityComparer <byte[]> .Default.GetHashCode(ScanResponse);; return(result); }
public static void ReadFile() { string DeviceName; string TableConfig; using (System.IO.StreamReader file = new System.IO.StreamReader(@"D:\jinchen\projects\webapi2\source1.txt", true)) { try { int counter = 0; string line; while ((line = file.ReadLine()) != null) { // System.Console.WriteLine(line); string[] sA = line.Split('\t'); int ln = sA.Length; if (ln > 0) { DeviceName = sA[0] as string; DeviceName = DeviceName.Trim(); if (DeviceName == "") { continue; } if (ln > 1) { for (int i = 1; i < ln; i++) { TableConfig = sA[i] as string; TableConfig = TableConfig.Trim(); if (TableConfig == "") { continue; } Console.Write(DeviceName + " "); GenerateSQLFile(DeviceName, TableConfig); Console.Write(TableConfig + " "); Console.WriteLine(" "); counter++; } } } } Console.WriteLine(counter); } catch (System.NullReferenceException e) { file.Close(); } } }
public uint AbrirDispositoPeloID(DeviceName id) { uint Retorno = m_NBioAPI.OpenDevice((short)id); if (Retorno == NBioAPI.Error.NONE) { throw new Exception("Não foi possível abrir o dispositivo informado."); } return(Retorno); }
public override bool CanDoDelete() { bool canDelete = true; if (IsEdit() && DeviceName.EndsWith("SAMP0")) { canDelete = false; } return(canDelete); }
public static void onChoseToConnectDevice(string key) { if (DeviceName.Contains(key)) { int temp = DeviceName.IndexOf(key); // if(temp==-1) // return; Debug.Log("!!!!!!!! onChoseToConnectDevice in unity" + temp + " " + key); _onChoseToConnectDevice(temp); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } if (Photos != null) { hashCode = hashCode * 59 + Photos.GetHashCode(); } if (Gear != null) { hashCode = hashCode * 59 + Gear.GetHashCode(); } if (Calories != null) { hashCode = hashCode * 59 + Calories.GetHashCode(); } if (SegmentEfforts != null) { hashCode = hashCode * 59 + SegmentEfforts.GetHashCode(); } if (DeviceName != null) { hashCode = hashCode * 59 + DeviceName.GetHashCode(); } if (EmbedToken != null) { hashCode = hashCode * 59 + EmbedToken.GetHashCode(); } if (SplitsMetric != null) { hashCode = hashCode * 59 + SplitsMetric.GetHashCode(); } if (SplitsStandard != null) { hashCode = hashCode * 59 + SplitsStandard.GetHashCode(); } if (Laps != null) { hashCode = hashCode * 59 + Laps.GetHashCode(); } if (BestEfforts != null) { hashCode = hashCode * 59 + BestEfforts.GetHashCode(); } return(hashCode); } }
public bool Equals(Device other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(DeviceName.ToLower() == other.DeviceName.ToLower()); }
public DeviceLicense(DeviceName name, DeviceType type, DirectionType direction, UInt16 value, bool singleton) { _name = name; _type = type; _direction = direction; _singleton = singleton; byte high = (byte)(value >> 8); byte low = (byte)(value & 0x00FF); SetValue(new byte[] { high, low }); }
public override List <string> ToStringList() { GuiStringList.Clear(); //Name_LocalIndex GuiStringList.Add($"{DeviceName.ToString()}_{LocalIndex}"); //Function GuiStringList.Add("DO8xDC24V 2.0A"); //GlobalIndex GuiStringList.Add($"{GlobalIndex}"); return(GuiStringList); }
public ThermometerValuesUpdated(DeviceId deviceId, EventId eventId, DeviceName deviceName, Temperature temperature, UnitOfMeasurement unitOfMeasurement, CommunicationDate communicationDate, AccountInfo who, When when) : base(deviceId, who, when) { this.EventId = eventId; this.DeviceId = deviceId; this.DeviceName = deviceName; this.Temperature = temperature; this.UnitOfMeasurement = unitOfMeasurement; this.CommunicationDate = communicationDate; }
public LocalAudioSource GetLocalAudioDevice(DeviceName deviceName) { var devices = _audioSources; if (devices != null) { return(devices.FirstOrDefault(s => s.Name == deviceName.Name && s.Id == deviceName.DeviceId) ?? devices.FirstOrDefault(s => s.Name == deviceName.Name) ?? devices.FirstOrDefault(s => s.Id == deviceName.DeviceId)); } return(null); }
private static async Task <DeviceName> LoadJsonDeviceNameAsync(string path) { DeviceName parameters = new DeviceName(); using (StreamReader r = new StreamReader(path)) { string json = await r.ReadToEndAsync(); parameters = JsonConvert.DeserializeObject <DeviceName>(json); } return(parameters); }
public static DeviceName[] List(DOMAIN domain) { IntPtr NamesHandle; // first, get the data, using an opaque token for the string array int status = FLIList(domain, out NamesHandle); if (0 != status) throw new Win32Exception(-status); // now marshal the string array into the return type we actually want List<DeviceName> NameList = new List<DeviceName>(); IntPtr p = NamesHandle; string s; while (IntPtr.Zero != p) { // manually bring the string into managed memory s = ((StringWrapper)Marshal.PtrToStructure(p, typeof(StringWrapper))).s; if (null == s) break; // parse it according to FLI SDK spec int DelimPos = s.IndexOf(';'); DeviceName dn = new DeviceName(); dn.FileName = (-1 == DelimPos ? s : s.Substring(0, DelimPos)); dn.ModelName = (-1 == DelimPos ? null : s.Substring(DelimPos + 1, s.Length - (DelimPos + 1))); // and accumulate into our list NameList.Add(dn); // move to the next pointer p += sizeof(int); } // don't bother the caller with memory management now that we've made our own copy FLIFreeList(NamesHandle); // render the result to the caller! return NameList.ToArray(); }