- autoexec files

- don't throw if the file fails to save
This commit is contained in:
Elijah R 2023-12-04 11:59:32 -05:00
parent 0b491b3ac7
commit 625533a2d3

View file

@ -55,10 +55,20 @@ namespace CollabVMAgent
return; return;
} }
} }
File.WriteAllBytes(UploadsFolder + @"\" + msg.Filename, msg.FileData); try
{
File.WriteAllBytes(UploadsFolder + @"\" + msg.Filename, msg.FileData);
} catch (Exception e)
{
#if DEBUG
Console.WriteLine($"Failed to save {msg.Filename}: {e.Message}");
#endif
return;
}
#if DEBUG #if DEBUG
Console.WriteLine($"Successfully wrote {msg.Filename} ({msg.FileData.Length} bytes)"); Console.WriteLine($"Successfully wrote {msg.Filename} ({msg.FileData.Length} bytes)");
#endif #endif
Process.Start(UploadsFolder + @"\" + msg.Filename, msg.FileData);
break; break;
} }
} }