-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGlobal.cs
130 lines (91 loc) · 5.55 KB
/
Global.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//
// Copyright (c) Roland Pihlakas 2019 - 2023
//
// Roland Pihlakas licenses this file to you under the GNU Lesser General Public License, ver 2.1.
// See the LICENSE file for more information.
//
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Nito.AsyncEx;
using NReco.Text;
namespace FolderSync
{
#pragma warning disable S2223 //Warning S2223 Change the visibility of 'xxx' or make it 'const' or 'readonly'.
internal static class Global
{
public static IConfigurationRoot Configuration;
public static readonly CancellationTokenSource CancellationToken = new CancellationTokenSource();
public static bool UseIdlePriority = false;
public static bool UseBackgroundMode = false;
public static List<long> Affinity = new List<long>();
public static int DirlistReadDelayMs = 0;
public static int FileWriteDelayMs = 0;
public static int ReadBufferKB = 1024;
public static int WriteBufferKB = 1024;
public static int BufferReadDelayMs = 0;
public static int BufferWriteDelayMs = 0;
public static bool ShowErrorAlerts = true;
public static bool LogInitialScan = false;
public static bool LogToFile = false;
public static bool AddTimestampToNormalLogEntries = true;
public static bool UsePolling = false;
public static int PollingDelay = 60;
public static int RetryCountOnEmptyDirlist = 0;
public static int RetryCountOnSrcFileOpenError = 5;
public static int FSOperationTimeout = 3600; //60 * 15;
public static int DirListOperationTimeout = 3600; //60 * 15;
public static int FileBufferWriteTimeout = 3600; //60 * 15;
public static int FileBufferReadTimeout = 3600; //60 * 15;
public static string SrcPath = "";
public static bool AllowVSS = false; //true; //TODO!!!
public static bool EnableMirror = true;
public static bool BidirectionalMirror = false;
public static bool MirrorIgnoreSrcDeletions = false;
public static bool MirrorIgnoreDestDeletions = false;
public static long MaxFileSizeMB = 2048;
public static bool DoNotCompareFileContent = false;
public static bool DoNotCompareFileDate = false;
public static bool DoNotCompareFileSize = false;
public static bool CacheDestAndHistoryFolders = false; //default is false since it consumes memory
public static bool PersistentCacheDestAndHistoryFolders = false;
public static string CachePath = "";
public static bool? CaseSensitiveFilenames = null; //null: default behaviour depending on OS
public static HashSet<string> MirrorWatchedExtension = new HashSet<string>() { "*" };
public static HashSet<string> MirrorWatchedFileNames = new HashSet<string>() { };
public static HashSet<string> MirrorExcludedExtensions = new HashSet<string>() { "*~", "tmp" };
public static List<string> MirrorIgnorePathsStartingWithList = new List<string>();
public static List<string> MirrorIgnorePathsContainingList = new List<string>();
public static List<string> MirrorIgnorePathsEndingWithList = new List<string>();
public static bool MirrorIgnorePathsContainingACHasAny = false;
public static AhoCorasickDoubleArrayTrie<bool> MirrorIgnorePathsContainingAC = new AhoCorasickDoubleArrayTrie<bool>();
public static string MirrorDestPath = "";
public static bool EnableHistory = false;
public static HashSet<string> HistoryWatchedExtension = new HashSet<string>() { "*" };
public static HashSet<string> HistoryWatchedFileNames = new HashSet<string>() { };
public static HashSet<string> HistoryExcludedExtensions = new HashSet<string>() { "*~", "bak", "tmp" };
public static List<string> HistoryIgnorePathsStartingWithList = new List<string>();
public static List<string> HistoryIgnorePathsContainingList = new List<string>();
public static List<string> HistoryIgnorePathsEndingWithList = new List<string>();
public static bool HistoryIgnorePathsContainingACHasAny = false;
public static AhoCorasickDoubleArrayTrie<bool> HistoryIgnorePathsContainingAC = new AhoCorasickDoubleArrayTrie<bool>();
public static string HistoryDestPath = "";
public static string HistoryVersionFormat = "TIMESTAMP_BEFORE_EXT";
public static string HistoryVersionSeparator = ".";
public static long SrcPathMinFreeSpace = 0;
public static long MirrorDestPathMinFreeSpace = 0;
public static long HistoryDestPathMinFreeSpace = 0;
internal static readonly AsyncLockQueueDictionary<string> FileOperationLocks = new AsyncLockQueueDictionary<string>();
internal static readonly AsyncSemaphore FileOperationSemaphore = new AsyncSemaphore(2); //allow 2 concurrent file synchronisations: while one is finishing the write, the next one can start the read
internal static readonly ConcurrentDictionary<string, bool> CreatedFoldersCache = new ConcurrentDictionary<string, bool>();
internal static readonly ConcurrentDictionary<string, CachedFileInfo> DestAndHistoryFileInfoCache = new ConcurrentDictionary<string, CachedFileInfo>();
internal static readonly AsyncLockQueueDictionary<string> PersistentCacheLocks = new AsyncLockQueueDictionary<string>();
}
#pragma warning restore S2223
}