You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implemented DNSCryptQueryMonitor and Improved DNSConfigManager Reader
Introduces DNSCryptQueryMonitor for real-time monitoring of blocked DNS queries. Adds registry-based detection of DNSCrypt installation directory in ServiceManager. Updates Enums and TraceLogger for improved logging and log management.
TODO: Need to add the results of the block history to a listbox instead of the TraceLogger.
@@ -43,7 +43,8 @@ public void ChangeSetting(string settingName, string value)
43
43
44
44
if(!File.Exists(_configFilePath))
45
45
{
46
-
TraceLogger.Log("Configuration file not found!",Enums.StatusSeverityType.Error);
46
+
TraceLogger.Log($"Configuration file not found {_configFilePath}",Enums.StatusSeverityType.Error);
47
+
MessageBox.Show("A SinkDNS module error has occurred. Configuration file not found!\n"+_configFilePath,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
TraceLogger.Log("Configuration file not found!",Enums.StatusSeverityType.Error);
63
+
TraceLogger.Log($"Configuration file not found {_configFilePath}",Enums.StatusSeverityType.Error);
64
+
MessageBox.Show("A SinkDNS module error has occurred. Configuration file not found!\n"+_configFilePath,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
thrownewFileNotFoundException("Configuration file not found",_configFilePath);
132
-
134
+
{
135
+
TraceLogger.Log($"Configuration file not found {_configFilePath}",Enums.StatusSeverityType.Error);
136
+
MessageBox.Show("A SinkDNS module error has occurred. Configuration file not found!\n"+_configFilePath,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
137
+
returnnull;
138
+
}
133
139
if(!_configLoaded)
134
140
{
135
141
LoadConfiguration();
136
142
}
137
-
138
143
intstartLine=-1;
139
144
intendLine=-1;
140
-
141
145
// Find section if specified
142
146
if(!string.IsNullOrEmpty(section))
143
147
{
148
+
TraceLogger.Log($"Searching for section '{section}' in configuration.");
144
149
for(inti=0;i<_configLines.Count;i++)
145
150
{
146
151
if(_configLines[i].Trim()==section)
147
152
{
153
+
TraceLogger.Log($"Section '{section}' found at line {i+1}.");
TraceLogger.Log($"Value for setting '{settingName}' is quoted. Removing quotes.");
183
202
returnvalue[1..^1];
184
203
}
204
+
205
+
// Remove any trailing comments
206
+
intcommentIndex=value.IndexOf('#');
207
+
if(commentIndex>=0)
208
+
{
209
+
value=value.Substring(0,commentIndex).Trim();
210
+
}
211
+
value=value.Replace("'","");
212
+
TraceLogger.Log($"Value for setting '{settingName}' extracted: {value}");
185
213
returnvalue;
186
214
}
187
215
}
216
+
TraceLogger.Log($"Setting '{settingName}' not found in the specified section.");
188
217
returnnull;
189
218
}
219
+
190
220
publicvoidWriteToConfigFile()
191
221
{
192
222
if(!_configLoaded||!_hasChanges)
193
223
return;
194
224
195
225
if(!File.Exists(_configFilePath))
196
226
{
197
-
TraceLogger.Log("Configuration file not found!",Enums.StatusSeverityType.Error);
227
+
TraceLogger.Log($"Configuration file not found {_configFilePath}",Enums.StatusSeverityType.Error);
228
+
MessageBox.Show("A SinkDNS module error has occurred. Configuration file not found!\n"+_configFilePath,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
0 commit comments