63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
namespace CloudGaming.Core.Files;
|
|
|
|
public class FileOptions
|
|
{
|
|
public string ServerUrl { get; set; }
|
|
|
|
public string DirectoryUrl { get; set; }
|
|
|
|
public string MaxRequestBodySize { get; set; }
|
|
|
|
public string MaxFileSizeLimit { get; set; }
|
|
|
|
public string AllowExtensions { get; set; }
|
|
|
|
private long maxRequestBodySize = -1;
|
|
|
|
private long maxFileSizeLimit = -1;
|
|
|
|
/// <summary>
|
|
/// 获取最大请求内容体长度
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public long GetMaxRequestBodySize()
|
|
{
|
|
if (maxRequestBodySize == -1)
|
|
{
|
|
try
|
|
{
|
|
var value = MaxRequestBodySize.ToStorageByteLength();
|
|
maxRequestBodySize = value;
|
|
}
|
|
catch (System.Exception)
|
|
{
|
|
throw new Exception("MaxRequestBodySize 格式错误");
|
|
}
|
|
}
|
|
|
|
return maxRequestBodySize;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取最大文件长度
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public long GetMaxFileSizeLimit()
|
|
{
|
|
if (maxFileSizeLimit == -1)
|
|
{
|
|
try
|
|
{
|
|
var value = MaxFileSizeLimit.ToStorageByteLength();
|
|
maxFileSizeLimit = value;
|
|
}
|
|
catch (System.Exception)
|
|
{
|
|
throw new Exception("MaxFileSizeLimit 格式错误");
|
|
}
|
|
}
|
|
|
|
return maxFileSizeLimit;
|
|
}
|
|
}
|