-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_helper.cs
46 lines (37 loc) · 1.04 KB
/
file_helper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* snapWONDERS OpenAPI Specification
* API version: 1.0
*
* Copyright (c) snapWONDERS.com, All rights reserved 2023
*
* Author: Kenneth Springer (https://kennethbspringer.au)
*
* All the snapWONDERS API services is available over the Clearnet / **Web** and Dark Web **Tor** and **I2P**
* Read details: https://snapwonders.com/snapwonders-openapi-specification
*
*/
namespace snapwonders_csharp_client
{
public class FileHelper
{
// Determine total file upload size
public static long DetermineFileSize(string fileName)
{
long fileTotalSize = -1;
try
{
FileInfo fileStat = new(fileName);
fileTotalSize = fileStat.Length;
if (fileTotalSize <= 0)
{
LogHelper.LogAndExit(string.Format("ERROR: Illegal file size:[{0}]", fileTotalSize));
}
}
catch(Exception ex)
{
LogHelper.LogAndExit(string.Format("ERROR: Failed to stat file:[{0}]", ex.Message));
}
return fileTotalSize;
}
}
}