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; /// /// 获取最大请求内容体长度 /// /// public long GetMaxRequestBodySize() { if (maxRequestBodySize == -1) { try { var value = MaxRequestBodySize.ToStorageByteLength(); maxRequestBodySize = value; } catch (System.Exception) { throw new Exception("MaxRequestBodySize 格式错误"); } } return maxRequestBodySize; } /// /// 获取最大文件长度 /// /// public long GetMaxFileSizeLimit() { if (maxFileSizeLimit == -1) { try { var value = MaxFileSizeLimit.ToStorageByteLength(); maxFileSizeLimit = value; } catch (System.Exception) { throw new Exception("MaxFileSizeLimit 格式错误"); } } return maxFileSizeLimit; } }