.dark4
.dark4
CC#
Created by 𝕴𝖓𝖋𝖊𝖗𝖓𝖚𝖘 on 12/16/2022 in #help
❔ Which is the best book to learn C- sharp from?
I like c# players guide
5 replies
CC#
Created by .dark4 on 12/17/2022 in #help
❔ Memory leak leading to overflow crash if server doesn't gracefully close socket with my client app
12 replies
CC#
Created by .dark4 on 12/17/2022 in #help
❔ Memory leak leading to overflow crash if server doesn't gracefully close socket with my client app
12 replies
CC#
Created by .dark4 on 12/17/2022 in #help
❔ Memory leak leading to overflow crash if server doesn't gracefully close socket with my client app
12 replies
CC#
Created by .dark4 on 12/17/2022 in #help
❔ Memory leak leading to overflow crash if server doesn't gracefully close socket with my client app
12 replies
CC#
Created by .dark4 on 12/17/2022 in #help
❔ Memory leak leading to overflow crash if server doesn't gracefully close socket with my client app
These are my socket connect and disconnect methods https://pastebin.com/p5QK2fx1
12 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
!close
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
device = (Device)devicesBlock.Select((Device, index) => index = deviceIndex); didn't work
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
just need to figure out how to select from an index to connect
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
this works int deviceIndex = devicesBlock.FindIndex(d => d.ConnectionType == ConnectionType.USB); Program.Log("Device index: " + deviceIndex);
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
this didn't work
int deviceIndex = 0;
for (int i = 0; i < devicesBlock.Count; i++)
{
if (devicesBlock[i].ConnectionType == ConnectionType.USB)
{
Program.Log($"Connecting to USB");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Ethernet)
{
Program.Log($"Connecting to Ethernet");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Bluetooth)
{
Program.Log($"Connecting to Bluetooth");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.WifiDirect || devicesBlock[i].ConnectionType == ConnectionType.Wifi)
{
Program.Log($"Connecting to Wifi");
deviceIndex = i;
break;
}
}

device = (Device)devicesBlock.Select((Device, index) => index = deviceIndex);
int deviceIndex = 0;
for (int i = 0; i < devicesBlock.Count; i++)
{
if (devicesBlock[i].ConnectionType == ConnectionType.USB)
{
Program.Log($"Connecting to USB");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Ethernet)
{
Program.Log($"Connecting to Ethernet");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Bluetooth)
{
Program.Log($"Connecting to Bluetooth");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.WifiDirect || devicesBlock[i].ConnectionType == ConnectionType.Wifi)
{
Program.Log($"Connecting to Wifi");
deviceIndex = i;
break;
}
}

device = (Device)devicesBlock.Select((Device, index) => index = deviceIndex);
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
trying this
int deviceIndex;
for (int i = 0; i < devicesBlock.Count; i++)
{
if (devicesBlock[i].ConnectionType == ConnectionType.USB)
{
Program.Log($"Connecting to USB");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Ethernet)
{
Program.Log($"Connecting to Ethernet");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Bluetooth)
{
Program.Log($"Connecting to Bluetooth");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.WifiDirect || obj.ConnectionType == ConnectionType.Wifi)
{
Program.Log($"Connecting to Wifi");
deviceIndex = i;
break;
}
}
int deviceIndex;
for (int i = 0; i < devicesBlock.Count; i++)
{
if (devicesBlock[i].ConnectionType == ConnectionType.USB)
{
Program.Log($"Connecting to USB");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Ethernet)
{
Program.Log($"Connecting to Ethernet");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.Bluetooth)
{
Program.Log($"Connecting to Bluetooth");
deviceIndex = i;
break;
}
else if (devicesBlock[i].ConnectionType == ConnectionType.WifiDirect || obj.ConnectionType == ConnectionType.Wifi)
{
Program.Log($"Connecting to Wifi");
deviceIndex = i;
break;
}
}
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
maybe I can get the index of the list and use that?
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
because right now when I connect via usb and wifi is on, wifi is at the top of the list and devicesBlock.First(); always picks wifi with weaker connection than usb
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
what I want to do is search the device list List<Device> devicesBlock = _api.GetDevicesBlock(); and connect by priority of connection type, USB first, the ethernet, then Bluetooth, then wifi or wifidirect
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
right now i'm just doing Device device = devicesBlock.First();
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
ultimately i need to connect to the device ConnectDevice(device);
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
how would i refer to that device object out of the list to connect to it
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
i think i can do
if(devicesBlock.Any(attribute=>attribute.getName()=="ConnectionType.USB"))
{
do stuff
}
if(devicesBlock.Any(attribute=>attribute.getName()=="ConnectionType.USB"))
{
do stuff
}
16 replies
CC#
Created by .dark4 on 12/16/2022 in #help
✅ How to pick from a field in a list in with priority
I tried this:
foreach (Device obj in devicesBlock)
{
if (obj.ConnectionType == ConnectionType.USB)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
else if (obj.ConnectionType == ConnectionType.Ethernet)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
else if (obj.ConnectionType == ConnectionType.Bluetooth)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
else if (obj.ConnectionType == ConnectionType.WifiDirect || obj.ConnectionType == ConnectionType.Wifi)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
}
foreach (Device obj in devicesBlock)
{
if (obj.ConnectionType == ConnectionType.USB)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
else if (obj.ConnectionType == ConnectionType.Ethernet)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
else if (obj.ConnectionType == ConnectionType.Bluetooth)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
else if (obj.ConnectionType == ConnectionType.WifiDirect || obj.ConnectionType == ConnectionType.Wifi)
{
Program.Log($"Connecting to {GetConnectionType(obj.ConnectionType)}");
device = obj;
break;
}
}
this doesn't work since it just starts at the top of the list, I need to search the entire list with similar logic
16 replies