Gibbo
Gibbo
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
im using WinSCP for ftp management now
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
thanks all, turns out uploading wasnt the issue the code was writing the file to another location using a byte array ive done this as a alternative now ,which has given me another issue when it comes to compressing the files but il put that in my next thread lol
using (FileStream sourceStream = new FileStream(fileLocation, FileMode.Open, FileAccess.Read))
using (FileStream destinationStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write))
{
byte[] buffer = new byte[4096]; // 4KB buffer size (can be adjusted)

int bytesRead;

if (fileName != patcherFilename && patcherEnableCompression)
{
fileName += ".gz";
}

while ((bytesRead = sourceStream.Read(buffer, 0, buffer.Length)) > 0)
{
//buffer = (!patcherEnableCompression || fileName == patcherFilename) ? buffer : Compress(buffer);
//info.Compressed = buffer.Length;
destinationStream.Write(buffer, 0, bytesRead);
}
}
using (FileStream sourceStream = new FileStream(fileLocation, FileMode.Open, FileAccess.Read))
using (FileStream destinationStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write))
{
byte[] buffer = new byte[4096]; // 4KB buffer size (can be adjusted)

int bytesRead;

if (fileName != patcherFilename && patcherEnableCompression)
{
fileName += ".gz";
}

while ((bytesRead = sourceStream.Read(buffer, 0, buffer.Length)) > 0)
{
//buffer = (!patcherEnableCompression || fileName == patcherFilename) ? buffer : Compress(buffer);
//info.Compressed = buffer.Length;
destinationStream.Write(buffer, 0, bytesRead);
}
}
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
thank you both
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
i shall go away and look at both examples and see if i can work out how to progress
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
il take a proper gander at this and see what i can do, thank you for helping
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
ive got tls setup, will eventually switch out to SFTP
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
so a bit more reserching suggest i should be using byte buffers.?
26 replies
CC#
Created by Gibbo on 9/5/2023 in #help
❔ FTP Uploading Files bigger than 2GB
il be honest im not sure how to do that and my brains fried from getting this far lol
26 replies
CC#
Created by Gibbo on 8/18/2023 in #help
❔ updating a DGV from another form on another thread
thanks @pobiega
10 replies
CC#
Created by Gibbo on 8/18/2023 in #help
❔ updating a DGV from another form on another thread
ok i think i possibly undertand, where i have my form loading like so
newUSB.ShowDialog();
newUSB.ShowDialog();
i should of
Invoke(new Action(() => { newUSB.ShowDialog(); }));
Invoke(new Action(() => { newUSB.ShowDialog(); }));
this in turn pushes the form back to the primary thread please correct me if im wrong
10 replies
CC#
Created by Gibbo on 8/18/2023 in #help
❔ updating a DGV from another form on another thread
ok thank you, il play about some more
10 replies
CC#
Created by Gibbo on 8/18/2023 in #help
❔ updating a DGV from another form on another thread
any examples?
10 replies
CC#
Created by KRONOS on 7/24/2023 in #help
❔ Windwos Form MD5 Login system ?
this is verifying the hashed from the database against the entered password to verify they are a match
if (BCrypt.Net.BCrypt.Verify(enteredPassword, databasePassword) == true)
{
your code goes here
}
if (BCrypt.Net.BCrypt.Verify(enteredPassword, databasePassword) == true)
{
your code goes here
}
18 replies
CC#
Created by KRONOS on 7/24/2023 in #help
❔ Windwos Form MD5 Login system ?
this generating the hashed password with salt added
//password
string password = txtPassword.Text;

//Generate Salts for Username & Password
string passwordSalt = BCrypt.Net.BCrypt.GenerateSalt((10));

//Generate Hashed Username & Password from Password entrys adding the Salt for addition security
string passwordToStoreInDatabase = BCrypt.Net.BCrypt.HashPassword(password, passwordSalt);
//password
string password = txtPassword.Text;

//Generate Salts for Username & Password
string passwordSalt = BCrypt.Net.BCrypt.GenerateSalt((10));

//Generate Hashed Username & Password from Password entrys adding the Salt for addition security
string passwordToStoreInDatabase = BCrypt.Net.BCrypt.HashPassword(password, passwordSalt);
18 replies
CC#
Created by KRONOS on 7/24/2023 in #help
❔ Windwos Form MD5 Login system ?
with passwords you want to salt and hash them, ive done this recently with one of my applications using bcrypt
18 replies
CC#
Created by Gibbo on 7/22/2023 in #help
✅ Can you lock or freeze a thread while using another form in a new thread??
private void DeviceInsertedEvent(object sender, EventArrivedEventArgs e)
{
// Update Interface to recognise USB inserted and get serial number from the device
//lblUSBDetection.Text = "-- USB Inserted";
string serialNumber = "";
string[] fullDeviceID;
string[] shortDeviceID;

List<string> list = new List<string>();
ManagementBaseObject instance = (ManagementBaseObject)e.NewEvent["TargetInstance"];


if (list.Count != 1)
{
foreach (var s in instance.Properties)
{
if (s.Name == "PNPDeviceID")
{
list.Add(s.Value.ToString());
break;
}
}
}

fullDeviceID = list.ToArray();
shortDeviceID = fullDeviceID[0].Split('\\');
serialNumber = shortDeviceID[2];

if (serialNumber != null)
{
list.Clear();
Debug.WriteLine("Full Device ID: " + fullDeviceID[0] + "\nShort Device ID: " + serialNumber);
Form USBPopup = new USBPopup(serialNumber);
USBPopup.ShowDialog();
}
}
private void DeviceInsertedEvent(object sender, EventArrivedEventArgs e)
{
// Update Interface to recognise USB inserted and get serial number from the device
//lblUSBDetection.Text = "-- USB Inserted";
string serialNumber = "";
string[] fullDeviceID;
string[] shortDeviceID;

List<string> list = new List<string>();
ManagementBaseObject instance = (ManagementBaseObject)e.NewEvent["TargetInstance"];


if (list.Count != 1)
{
foreach (var s in instance.Properties)
{
if (s.Name == "PNPDeviceID")
{
list.Add(s.Value.ToString());
break;
}
}
}

fullDeviceID = list.ToArray();
shortDeviceID = fullDeviceID[0].Split('\\');
serialNumber = shortDeviceID[2];

if (serialNumber != null)
{
list.Clear();
Debug.WriteLine("Full Device ID: " + fullDeviceID[0] + "\nShort Device ID: " + serialNumber);
Form USBPopup = new USBPopup(serialNumber);
USBPopup.ShowDialog();
}
}
40 replies
CC#
Created by Gibbo on 7/22/2023 in #help
✅ Can you lock or freeze a thread while using another form in a new thread??
but it doesn't, i get one prompt which im expecting and is successful, then when i remove the usb a 2nd prompt pop s up for the 2nd pnp device
40 replies
CC#
Created by Gibbo on 7/22/2023 in #help
✅ Can you lock or freeze a thread while using another form in a new thread??
what I'm seeing is correct, as i suspect this this is 2 usbs rolled into one. how ever my code should break out of the loop when it finds the first PNPDeviceID,
40 replies
CC#
Created by Gibbo on 7/22/2023 in #help
✅ Can you lock or freeze a thread while using another form in a new thread??
Availability =
Caption = USB Mass Storage Device
ClassCode =
ConfigManagerErrorCode = 0
ConfigManagerUserConfig = False
CreationClassName = Win32_USBHub
CurrentAlternateSettings =
CurrentConfigValue =
Description = USB Mass Storage Device
DeviceID = USB\VID_16D0&PID_0D71&MI_01\8&1D5C76F4&2&0001
ErrorCleared =
ErrorDescription =
GangSwitched =
InstallDate =
LastErrorCode =
Name = USB Mass Storage Device
NumberOfConfigs =
NumberOfPorts =
PNPDeviceID = USB\VID_16D0&PID_0D71&MI_01\8&1D5C76F4&2&0001
PowerManagementCapabilities =
PowerManagementSupported =
ProtocolCode =
Status = OK
StatusInfo =
SubclassCode =
SystemCreationClassName = Win32_ComputerSystem
SystemName = UK-CH-OR-TS9-L
USBVersion =
Availability =
Caption = USB Composite Device
ClassCode =
ConfigManagerErrorCode = 0
ConfigManagerUserConfig = False
CreationClassName = Win32_USBHub
CurrentAlternateSettings =
CurrentConfigValue =
Description = USB Composite Device
DeviceID = USB\VID_16D0&PID_0D71\00012547
ErrorCleared =
ErrorDescription =
GangSwitched =
InstallDate =
LastErrorCode =
Name = USB Composite Device
NumberOfConfigs =
NumberOfPorts =
PNPDeviceID = USB\VID_16D0&PID_0D71\00012547
PowerManagementCapabilities =
PowerManagementSupported =
ProtocolCode =
Status = OK
StatusInfo =
SubclassCode =
SystemCreationClassName = Win32_ComputerSystem
SystemName = UK-CH-OR-TS9-L
USBVersion =
Availability =
Caption = USB Mass Storage Device
ClassCode =
ConfigManagerErrorCode = 0
ConfigManagerUserConfig = False
CreationClassName = Win32_USBHub
CurrentAlternateSettings =
CurrentConfigValue =
Description = USB Mass Storage Device
DeviceID = USB\VID_16D0&PID_0D71&MI_01\8&1D5C76F4&2&0001
ErrorCleared =
ErrorDescription =
GangSwitched =
InstallDate =
LastErrorCode =
Name = USB Mass Storage Device
NumberOfConfigs =
NumberOfPorts =
PNPDeviceID = USB\VID_16D0&PID_0D71&MI_01\8&1D5C76F4&2&0001
PowerManagementCapabilities =
PowerManagementSupported =
ProtocolCode =
Status = OK
StatusInfo =
SubclassCode =
SystemCreationClassName = Win32_ComputerSystem
SystemName = UK-CH-OR-TS9-L
USBVersion =
Availability =
Caption = USB Composite Device
ClassCode =
ConfigManagerErrorCode = 0
ConfigManagerUserConfig = False
CreationClassName = Win32_USBHub
CurrentAlternateSettings =
CurrentConfigValue =
Description = USB Composite Device
DeviceID = USB\VID_16D0&PID_0D71\00012547
ErrorCleared =
ErrorDescription =
GangSwitched =
InstallDate =
LastErrorCode =
Name = USB Composite Device
NumberOfConfigs =
NumberOfPorts =
PNPDeviceID = USB\VID_16D0&PID_0D71\00012547
PowerManagementCapabilities =
PowerManagementSupported =
ProtocolCode =
Status = OK
StatusInfo =
SubclassCode =
SystemCreationClassName = Win32_ComputerSystem
SystemName = UK-CH-OR-TS9-L
USBVersion =
`
40 replies
CC#
Created by Gibbo on 7/22/2023 in #help
✅ Can you lock or freeze a thread while using another form in a new thread??
so one usb stick has 2 PNPDeviceID's
40 replies