Unstable 0.17.4.0
This commit is contained in:
@@ -155,8 +155,13 @@ namespace Barotrauma.Networking
|
||||
Dispose(true);
|
||||
}
|
||||
}
|
||||
|
||||
const int MaxFileSize = 50000000; //50 MB
|
||||
|
||||
private static int GetMaxFileSizeInBytes(FileTransferType fileTransferType) =>
|
||||
fileTransferType switch
|
||||
{
|
||||
FileTransferType.Mod => 500 * 1024 * 1024, //500 MiB should be good enough, right?
|
||||
_ => 50 * 1024 * 1024 //50 MiB for everything other than mods
|
||||
};
|
||||
|
||||
public delegate void TransferInDelegate(FileTransferIn fileStreamReceiver);
|
||||
public TransferInDelegate OnFinished;
|
||||
@@ -410,18 +415,18 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
errorMessage = "";
|
||||
|
||||
if (fileSize > MaxFileSize)
|
||||
{
|
||||
errorMessage = "File too large (" + MathUtils.GetBytesReadable(fileSize) + ")";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Enum.IsDefined(typeof(FileTransferType), (int)type))
|
||||
{
|
||||
errorMessage = "Unknown file type";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fileSize > GetMaxFileSizeInBytes((FileTransferType)type))
|
||||
{
|
||||
errorMessage = $"File too large ({MathUtils.GetBytesReadable(fileSize)} > {MathUtils.GetBytesReadable(GetMaxFileSizeInBytes((FileTransferType)type))})";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(fileName) ||
|
||||
fileName.IndexOfAny(Path.GetInvalidFileNameChars().ToArray()) > -1)
|
||||
{
|
||||
|
||||
@@ -163,16 +163,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static void ChangeCaptureDevice(string deviceName)
|
||||
{
|
||||
var config = GameSettings.CurrentConfig;
|
||||
config.Audio.VoiceCaptureDevice = deviceName;
|
||||
GameSettings.SetCurrentConfig(config);
|
||||
if (Instance == null) { return; }
|
||||
|
||||
if (Instance != null)
|
||||
{
|
||||
UInt16 storedBufferID = Instance.LatestBufferID;
|
||||
Instance.Dispose();
|
||||
Create(GameSettings.CurrentConfig.Audio.VoiceCaptureDevice, storedBufferID);
|
||||
}
|
||||
UInt16 storedBufferID = Instance.LatestBufferID;
|
||||
Instance.Dispose();
|
||||
Create(GameSettings.CurrentConfig.Audio.VoiceCaptureDevice, storedBufferID);
|
||||
}
|
||||
|
||||
IntPtr nativeBuffer;
|
||||
|
||||
@@ -54,7 +54,17 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VoipCapture.Instance == null) { VoipCapture.Create(GameSettings.CurrentConfig.Audio.VoiceCaptureDevice, storedBufferID); }
|
||||
try
|
||||
{
|
||||
if (VoipCapture.Instance == null) { VoipCapture.Create(GameSettings.CurrentConfig.Audio.VoiceCaptureDevice, storedBufferID); }
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError($"VoipCature.Create failed: {e.Message} {e.StackTrace.CleanupStackTrace()}");
|
||||
var config = GameSettings.CurrentConfig;
|
||||
config.Audio.VoiceSetting = VoiceMode.Disabled;
|
||||
GameSettings.SetCurrentConfig(config);
|
||||
}
|
||||
if (VoipCapture.Instance == null || VoipCapture.Instance.EnqueuedTotalLength <= 0) { return; }
|
||||
}
|
||||
|
||||
@@ -146,7 +156,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
var soundIconStyle = GUIStyle.GetComponentStyle("GUISoundIcon");
|
||||
Rectangle sourceRect = soundIconStyle.Sprites.First().Value.First().Sprite.SourceRect;
|
||||
var indexPieces = soundIconStyle.Element.Attribute("sheetindices").Value.Split(';');
|
||||
var indexPieces = soundIconStyle.Element.GetAttribute("sheetindices").Value.Split(';');
|
||||
voiceIconSheetRects = new Rectangle[indexPieces.Length];
|
||||
for (int i = 0; i < indexPieces.Length; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user