public bool addDevice(BaseDevice newDevice) { lock (deviceList) { deviceList.Add(newDevice); } return true; }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 11 && benchmarkedPluginVersion.Minor < 4 && ids.First() == AlgorithmType.RandomXmonero) { return(true); } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (ids.Contains(AlgorithmType.KAWPOW) && benchmarkedPluginVersion.Major == 10 && benchmarkedPluginVersion.Minor < 1) { return(true); } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public static BaseAliasModel Create(BaseDevice device, String identifier, BaseTexture texture, Type modelType, Type descType, aliashdr_t aliasHeader) { if (ModelPool.ContainsKey(identifier)) { return(( BaseAliasModel )ModelPool[identifier]); } var desc = ( BaseAliasModelDesc )Activator.CreateInstance(descType); desc.Name = identifier; desc.Texture = texture; desc.AliasHeader = aliasHeader; var model = ( BaseAliasModel )Activator.CreateInstance(modelType, device, desc); model.Initialise(); return(model); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() != 0) { if (ids.Contains(AlgorithmType.KAWPOW) && benchmarkedPluginVersion.Major == 11 && benchmarkedPluginVersion.Minor < 2) { return(true); } } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } //no improvements for algorithm speeds in the new version - just stability improvements return(false); }
public BaseTextureAtlas(BaseDevice device, Int32 maxTextures, Int32 width, Int32 height) { Device = device; MaxTextures = maxTextures; Width = width; Height = height; Textures = new BaseTexture[MaxTextures]; Allocated = new Int32[MaxTextures][]; //[MAX_SCRAPS][BLOCK_WIDTH]; for (var i = 0; i < Allocated.GetLength(0); i++) { Allocated[i] = new Int32[Width]; } Texels = new Byte[MaxTextures][]; // [MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT*4]; for (var i = 0; i < Texels.GetLength(0); i++) { Texels[i] = new Byte[Width * Height * 4]; } }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major < 3 && ids.FirstOrDefault() == AlgorithmType.GrinCuckarood29) { return(true); } return(false); } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
/// <summary> /// 针对具体的某型号的某一台设备测试连接 /// </summary> /// <returns></returns> public JsonResult TestConnection() { string DeviceType = Request["DeviceType"]; int DeviceID = int.Parse(Request["DeviceID"]); string CommKey = Request["CommKey"]; int Port = int.Parse(Request["Port"]); string IP = Request["IP"]; //针对基类进行操作 BaseDevice device = SimpleDeviceFactory.createDevice(DeviceType, DeviceID, CommKey, Port, IP); if (device.TestConnection() == true) { return(packageJson(1, " 设备连接成功", null)); } else { return(packageJson(0, "设备连接失败!", null)); } }
private void onlineAllListView_MouseDoubleClick(object sender, MouseEventArgs e) { ListViewHitTestInfo info = onlineAllListView.HitTest(e.X, e.Y); if (info.Item != null) { int index = info.Item.Index; BaseDevice device = deviceManager.getDevice(index); switch (device.CurrentDeviceType) { default: DemoDeviceForm form2 = new DemoDeviceForm(); form2.FatherForm = this; form2.DemoDevice = (DemoVirtualDevice)device; form2.Show(); break; } } }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { var algo = ids.FirstOrDefault(); if (benchmarkedPluginVersion.Major < 3 && algo == AlgorithmType.GrinCuckarood29) { return(true); } if (benchmarkedPluginVersion.Major == 3 && benchmarkedPluginVersion.Minor < 1 && algo == AlgorithmType.GrinCuckarood29) { return(true); } } catch (Exception e) { Logger.Error("NanoMinerPlugin.ShouldReBenchmarkAlgorithmOnDevice", e.Message); } return(false); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 14 && benchmarkedPluginVersion.Minor == 0 && ids.FirstOrDefault() == AlgorithmType.KAWPOW) { return(true); } if (benchmarkedPluginVersion.Major == 14 && benchmarkedPluginVersion.Minor < 5 && ids.FirstOrDefault() == AlgorithmType.DaggerHashimoto) { return(true); } } catch {} return(false); }
public BaseTextureAtlas(BaseDevice device, int maxTextures, int width, int height) { this.Device = device; this.MaxTextures = maxTextures; this.Width = width; this.Height = height; this.Textures = new BaseTexture[this.MaxTextures]; this.Allocated = new int[this.MaxTextures][]; //[MAX_SCRAPS][BLOCK_WIDTH]; for (var i = 0; i < this.Allocated.GetLength(0); i++) { this.Allocated[i] = new int[this.Width]; } this.Texels = new byte[this.MaxTextures][]; // [MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT*4]; for (var i = 0; i < this.Texels.GetLength(0); i++) { this.Texels[i] = new byte[this.Width * this.Height * 4]; } }
public static BaseTexture FromBuffer(BaseDevice device, string identifier, uint[] buffer, int width, int height, bool hasMipMap, bool hasAlpha, string filter = "GL_LINEAR_MIPMAP_NEAREST", string blendMode = "", bool isLightMap = false) { if (BaseTexture.ExistsInPool(identifier)) { return(BaseTexture.TexturePool[identifier]); } var desc = ( BaseTextureDesc )Activator.CreateInstance(device.TextureDescType); desc.Name = identifier; desc.HasAlpha = hasAlpha; desc.Width = width; desc.Height = height; desc.HasMipMap = hasMipMap; desc.Filter = filter; desc.BlendMode = blendMode; desc.IsLightMap = isLightMap; return(BaseTexture.FromBuffer(device, desc, buffer)); }
public void Dispose() { if (_isDisposed) { return; } BaseDevice?.Dispose(); _busService?.Dispose(); if (_busTxChar != null) { _busTxChar.ValueChanged -= _txChar_ValueChanged; } _busTxChar = null; _busRxChar = null; _isDisposed = true; }
/// <summary> /// Sự kiện phát sinh khi kết thúc nhận dữ liệu /// </summary> /// <param name="client"></param> public override void OnEndReciveData(TcpClient client) { Log.Trace("End recive data from {0}", client.Client.RemoteEndPoint.ToString()); try { BaseDevice baseDevice = GetDevice(client); if (baseDevice != null) { baseDevice.RaiseEventEndReceiveData(client); } else { Log.Debug("Device is null"); } } catch (Exception ex) { Log.Error("Error while raise 'OnEndReciveData' {0}", ex.ToString()); } }
public static BaseTexture FromBuffer(BaseDevice device, String identifier, UInt32[] buffer, Int32 width, Int32 height, System.Boolean hasMipMap, System.Boolean hasAlpha, String filter = "GL_LINEAR_MIPMAP_NEAREST", String blendMode = "", Boolean isLightMap = false) { if (ExistsInPool(identifier)) { return(TexturePool[identifier]); } var desc = ( BaseTextureDesc )Activator.CreateInstance(device.TextureDescType); desc.Name = identifier; desc.HasAlpha = hasAlpha; desc.Width = width; desc.Height = height; desc.HasMipMap = hasMipMap; desc.Filter = filter; desc.BlendMode = blendMode; desc.IsLightMap = isLightMap; return(FromBuffer(device, desc, buffer)); }
private void runButton_Click(object sender, EventArgs e) { BaseDevice device = checkInfoAndCreate(); if (device != null) { device.VirtualDeviceManager = virtualDeviceManager; virtualDeviceManager.addDevice(device); device.init(); if (IsSocket) { ((BaseVirtualDevice)device).send_basic_info(); } else { ((BaseTwincatDevice)device).send_basic_info(); } this.Close(); FatherForm.refresh_Devices(); } }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 2 && benchmarkedPluginVersion.Minor < 8) { // improved performance for ZHash for nvidia cards if (device.DeviceType == DeviceType.NVIDIA && ids.FirstOrDefault() == AlgorithmType.GrinCuckarood29) { return(true); } } if (benchmarkedPluginVersion.Major == 2 && benchmarkedPluginVersion.Minor < 7) { // improved performance for ZHash for nvidia cards if (device.DeviceType == DeviceType.NVIDIA && ids.FirstOrDefault() == AlgorithmType.ZHash) { return(true); } } if (benchmarkedPluginVersion.Major == 2 && benchmarkedPluginVersion.Minor < 6) { // improved performance for BEAM2 for nvidia cards if (device.DeviceType == DeviceType.NVIDIA && ids.FirstOrDefault() == AlgorithmType.BeamV2) { return(true); } } return(false); } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
private void UpdateMode(int newMode) { if (prevMode == newMode) { return; } dev = DreamData.GetDeviceData(); dev.Mode = newMode; devMode = newMode; Console.WriteLine($@"DreamScreen: Updating mode to {newMode} from {prevMode}."); // If we are not in ambient mode and ambient scene is running, stop it switch (newMode) { case 0: StopShowBuilder(); StopStream(); break; case 1: case 2: StopShowBuilder(); Console.WriteLine($@"DreamScreen: Subscribing to sector data for mode: {newMode}"); if (!streamStarted) { StartStream(); } Subscribe(true); break; case 3: if (!streamStarted) { StartStream(); } UpdateAmbientMode(ambientMode); break; } prevMode = newMode; }
public DreamScreenMessage(byte[] bytesIn, string from) { var byteString = BitConverter.ToString(bytesIn); var bytesString = byteString.Split("-"); var magic = bytesString[0]; if (!MsgUtils.CheckCrc(bytesIn) || magic != "FC" || bytesString.Length < 7) { //throw new ArgumentException($"Invalid message format: {magic}"); IsValid = false; return; } int len = bytesIn[1]; Group = bytesIn[2]; Flags = bytesString[3]; var cmd = bytesString[4] + bytesString[5]; if (MsgUtils.Commands.ContainsKey(cmd)) { Command = MsgUtils.Commands[cmd]; } else { Console.WriteLine($@"DSMessage: No matching key in dict for bytes: {cmd}."); } BaseDevice dreamDev = null; if (len > 5) { payload = ExtractPayload(bytesIn); PayloadString = payload.Length != 0 ? BitConverter.ToString(payload).Replace("-", string.Empty, StringComparison.CurrentCulture) : ""; } if (Command == "DEVICE_DISCOVERY" && Flags == "60" && len > 46) { int devType = payload[^ 1];
public bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 1 && benchmarkedPluginVersion.Minor < 8) { if (device.Name.Contains("1060 3GB") && ids.FirstOrDefault() == AlgorithmType.MTP) { return(true); } } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public static BasePicture FromFile(BaseDevice device, string path, string filter = "GL_LINEAR_MIPMAP_NEAREST", bool ignoreAtlas = false) { if (BasePicture.PicturePool.ContainsKey(path)) { return(BasePicture.PicturePool[path]); } var data = FileSystem.LoadFile(path); if (data == null) { Utilities.Error($"BaseTexture_FromFile: failed to load {path}"); } var ext = Path.GetExtension(path).ToLower( ).Substring(1); switch (ext) { case "lmp": var header = Utilities.BytesToStructure <WadPicHeader>(data, 0); EndianHelper.SwapPic(header); var headerSize = Marshal.SizeOf(typeof(WadPicHeader)); return(BasePicture.FromBuffer(device, new(data, headerSize), ( int )header.width, ( int )header.height, path, filter, ignoreAtlas)); case "jpg": case "bmp": case "png": break; case "tga": break; } return(null); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() != 0) { if (ids.First() == AlgorithmType.GrinCuckatoo32 && benchmarkedPluginVersion.Major < 13) { return(true); } if (ids.First() == AlgorithmType.CuckaRooz29 && benchmarkedPluginVersion.Major <= 14 && benchmarkedPluginVersion.Minor < 1) { return(true); } if (ids.First() == AlgorithmType.BeamV3 && benchmarkedPluginVersion.Major <= 14 && benchmarkedPluginVersion.Minor < 6) { return(true); } if (ids.First() == AlgorithmType.KAWPOW && benchmarkedPluginVersion.Major <= 14 && benchmarkedPluginVersion.Minor < 7) { return(true); } if (benchmarkedPluginVersion.Major <= 14 && benchmarkedPluginVersion.Minor < 8 && device.Name.Contains("RTX 3")) { return(true); } if (benchmarkedPluginVersion.Major == 14 && benchmarkedPluginVersion.Minor < 10 && device.Name.Contains("RTX 3") && ids.First() == AlgorithmType.KAWPOW) { return(true); } } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 2 && benchmarkedPluginVersion.Minor < 2) { // v2.1 https://bitcointalk.org/index.php?topic=3378390.0 if (ids.FirstOrDefault() == AlgorithmType.X16R) { return(true); } } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 3 && benchmarkedPluginVersion.Minor < 1) { // v2.3 Performance improvement: +2-3% x16rv2 algo https://github.com/z-enemy/z-enemy/releases/tag/ver-2.3 if (ids.FirstOrDefault() == AlgorithmType.X16Rv2) { return(true); } } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
protected Device(VirtualDevice virtualDevice = null) { OnlineDetection = new OnlineDetectionClass(this); if (virtualDevice != null) { _bd = BaseDevices.Find(x => x.VirtualDevice == virtualDevice) ?? new BaseDevice(); virtualDevice.Device = _bd; VirtualDevice = virtualDevice; } else { if (_realDevice == null) { _realDevice = new BaseDevice(); } _bd = _realDevice; } OnReceivesHttpRequest = _bd.OnReceivesHttpRequest; if (!BaseDevices.Contains(_bd)) { BaseDevices.Add(_bd); } }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 2 && benchmarkedPluginVersion.Minor < 2) { // v24.2 https://github.com/NebuTech/NBMiner/releases/tag/v24.2 // Slightliy improve RTX2060 Grin29 performance under win10 var isRTX2060 = device.Name.Contains("RTX") && device.Name.Contains("2060"); var isGrin29 = ids.FirstOrDefault() == AlgorithmType.GrinCuckarood29; return(isRTX2060 && isGrin29); } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 15 && benchmarkedPluginVersion.Minor < 3 && device.DeviceType == DeviceType.NVIDIA && ids.Contains(AlgorithmType.DaggerHashimoto)) { return(true); } if (benchmarkedPluginVersion.Major == 15 && benchmarkedPluginVersion.Minor < 5 && device.DeviceType == DeviceType.NVIDIA && ids.Contains(AlgorithmType.Octopus)) { return(true); } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { try { if (ids.Count() == 0) { return(false); } if (benchmarkedPluginVersion.Major == 2 && benchmarkedPluginVersion.Minor < 3) { // v1.53 https://github.com/develsoftware/GMinerRelease/releases/tag/1.53 // improved performance for Equihash 144,5 and Equihash 192,7 on RTX cards if (device.Name.Contains("RTX") && ids.FirstOrDefault() == AlgorithmType.ZHash) { return(true); } } } catch (Exception e) { Logger.Error(PluginUUID, $"ShouldReBenchmarkAlgorithmOnDevice {e.Message}"); } return(false); }
public static BasePicture FromBuffer(BaseDevice device, ByteArraySegment buffer, int width, int height, string identifier = null, string filter = "GL_LINEAR_MIPMAP_NEAREST", bool ignoreAtlas = false) { if (BasePicture.PicturePool.ContainsKey(identifier)) { return(BasePicture.PicturePool[identifier]); } var picture = new BasePicture( ); picture.Width = width; picture.Height = height; picture.Identifier = identifier; if (!ignoreAtlas && picture.Width < 64 && picture.Height < 64) { picture.Texture = device.TextureAtlas.Add(buffer, picture); } else { picture.Texture = BaseTexture.FromBuffer(device, picture, buffer, filter); } return(picture); }
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) { if (ids.Count() == 0) { return(false); } if (ids.FirstOrDefault() == AlgorithmType.Cuckaroom) { return(benchmarkedPluginVersion.Major <= 8 || (benchmarkedPluginVersion.Major == 8 && benchmarkedPluginVersion.Minor <= 1)); } if (benchmarkedPluginVersion.Major <= 7 && ids.FirstOrDefault() == AlgorithmType.GrinCuckatoo32) { if (benchmarkedPluginVersion.Major == 7 && benchmarkedPluginVersion.Minor == 2) { return(false); } if (device.DeviceType == DeviceType.AMD && device.Name.ToLower().Contains("navi")) { return(true); } } return(false); }
public void sendMsg(BaseDevice device, String s) { DeviceMessage msg = new DeviceMessage(); msg.Device = device; msg.Msg = s; msg.Type = DeviceMessage.DeviceMessageType.OUT; msg.Time = DateTime.Now.ToShortTimeString(); lock (allMessages) { allMessages.Add(msg); } }
public override void Update(BaseDevice item) { if (!(item is RemovableDiskDeviceItem)) return; RemovableDiskDeviceItem updatedItem = (RemovableDiskDeviceItem) item; Update(updatedItem); }
public List<DeviceMessage> getDeviceMessage(BaseDevice device) { List<DeviceMessage> result = new List<DeviceMessage>(); foreach (DeviceMessage msg in allMessages) { if (msg.Device == device) { result.Add(msg); } } return result; }