Annotate more nullable variables

pull/397/head
NextTurn 2020-02-02 00:00:00 +08:00
parent b36aff024e
commit da71f5dd83
No known key found for this signature in database
GPG Key ID: 17A0D50ADDE1A0C4
11 changed files with 77 additions and 105 deletions

View File

@ -224,7 +224,7 @@ namespace winsw
string? startarguments = _descriptor.Startarguments; string? startarguments = _descriptor.Startarguments;
if (startarguments == null) if (startarguments is null)
{ {
startarguments = _descriptor.Arguments; startarguments = _descriptor.Arguments;
} }
@ -286,7 +286,7 @@ namespace winsw
Log.Info("Stopping " + _descriptor.Id); Log.Info("Stopping " + _descriptor.Id);
_orderlyShutdown = true; _orderlyShutdown = true;
if (stoparguments == null) if (stoparguments is null)
{ {
try try
{ {
@ -308,10 +308,7 @@ namespace winsw
Process stopProcess = new Process(); Process stopProcess = new Process();
string? executable = _descriptor.StopExecutable; string? executable = _descriptor.StopExecutable;
if (executable == null) executable ??= _descriptor.Executable;
{
executable = _descriptor.Executable;
}
// TODO: Redirect logging to Log4Net once https://github.com/kohsuke/winsw/pull/213 is integrated // TODO: Redirect logging to Log4Net once https://github.com/kohsuke/winsw/pull/213 is integrated
StartProcess(stopProcess, stoparguments, executable, null, false); StartProcess(stopProcess, stoparguments, executable, null, false);
@ -518,7 +515,7 @@ namespace winsw
// Get service info for the future use // Get service info for the future use
Win32Services svc = new WmiRoot().GetCollection<Win32Services>(); Win32Services svc = new WmiRoot().GetCollection<Win32Services>();
Win32Service s = svc.Select(descriptor.Id); Win32Service? s = svc.Select(descriptor.Id);
var args = new List<string>(Array.AsReadOnly(_args)); var args = new List<string>(Array.AsReadOnly(_args));
if (args[0] == "/redirect") if (args[0] == "/redirect")
@ -643,7 +640,7 @@ namespace winsw
if (args[0] == "uninstall") if (args[0] == "uninstall")
{ {
Log.Info("Uninstalling the service with id '" + descriptor.Id + "'"); Log.Info("Uninstalling the service with id '" + descriptor.Id + "'");
if (s == null) if (s is null)
{ {
Log.Warn("The service with id '" + descriptor.Id + "' does not exist. Nothing to uninstall"); Log.Warn("The service with id '" + descriptor.Id + "' does not exist. Nothing to uninstall");
return; // there's no such service, so consider it already uninstalled return; // there's no such service, so consider it already uninstalled
@ -684,7 +681,7 @@ namespace winsw
if (args[0] == "start") if (args[0] == "start")
{ {
Log.Info("Starting the service with id '" + descriptor.Id + "'"); Log.Info("Starting the service with id '" + descriptor.Id + "'");
if (s == null) if (s is null)
ThrowNoSuchService(); ThrowNoSuchService();
s.StartService(); s.StartService();
@ -694,7 +691,7 @@ namespace winsw
if (args[0] == "stop") if (args[0] == "stop")
{ {
Log.Info("Stopping the service with id '" + descriptor.Id + "'"); Log.Info("Stopping the service with id '" + descriptor.Id + "'");
if (s == null) if (s is null)
ThrowNoSuchService(); ThrowNoSuchService();
s.StopService(); s.StopService();
@ -704,7 +701,7 @@ namespace winsw
if (args[0] == "restart") if (args[0] == "restart")
{ {
Log.Info("Restarting the service with id '" + descriptor.Id + "'"); Log.Info("Restarting the service with id '" + descriptor.Id + "'");
if (s == null) if (s is null)
ThrowNoSuchService(); ThrowNoSuchService();
if (s.Started) if (s.Started)
@ -713,7 +710,7 @@ namespace winsw
while (s.Started) while (s.Started)
{ {
Thread.Sleep(1000); Thread.Sleep(1000);
s = svc.Select(descriptor.Id); s = svc.Select(descriptor.Id)!;
} }
s.StartService(); s.StartService();
@ -739,7 +736,7 @@ namespace winsw
if (args[0] == "status") if (args[0] == "status")
{ {
Log.Debug("User requested the status of the process with id '" + descriptor.Id + "'"); Log.Debug("User requested the status of the process with id '" + descriptor.Id + "'");
if (s == null) if (s is null)
Console.WriteLine("NonExistent"); Console.WriteLine("NonExistent");
else if (s.Started) else if (s.Started)
Console.WriteLine("Started"); Console.WriteLine("Started");

View File

@ -106,12 +106,12 @@ namespace winsw
} }
// Also fail if there is no user/password // Also fail if there is no user/password
if (Username == null) if (Username is null)
{ {
throw new InvalidDataException("Basic Auth is enabled, but username is not specified " + ShortId); throw new InvalidDataException("Basic Auth is enabled, but username is not specified " + ShortId);
} }
if (Password == null) if (Password is null)
{ {
throw new InvalidDataException("Basic Auth is enabled, but password is not specified " + ShortId); throw new InvalidDataException("Basic Auth is enabled, but password is not specified " + ShortId);
} }

View File

@ -128,8 +128,8 @@ namespace winsw.Extensions
} }
XmlNode? extensionsConfig = ServiceDescriptor.ExtensionsConfiguration; XmlNode? extensionsConfig = ServiceDescriptor.ExtensionsConfiguration;
XmlElement? configNode = (extensionsConfig != null) ? extensionsConfig.SelectSingleNode("extension[@id='" + id + "'][1]") as XmlElement : null; XmlElement? configNode = extensionsConfig is null ? null : extensionsConfig.SelectSingleNode("extension[@id='" + id + "'][1]") as XmlElement;
if (configNode == null) if (configNode is null)
{ {
throw new ExtensionException(id, "Cannot get the configuration entry"); throw new ExtensionException(id, "Cannot get the configuration entry");
} }
@ -165,7 +165,7 @@ namespace winsw.Extensions
try try
{ {
Type? t = Type.GetType(className); Type? t = Type.GetType(className);
if (t == null) if (t is null)
{ {
throw new ExtensionException(id, "Class " + className + " does not exist"); throw new ExtensionException(id, "Class " + className + " does not exist");
} }

View File

@ -427,7 +427,7 @@ namespace winsw
private void ZipFiles(string directory, string fileExtension, string zipFileBaseName) private void ZipFiles(string directory, string fileExtension, string zipFileBaseName)
{ {
if (ZipOlderThanNumDays == null || !(ZipOlderThanNumDays > 0)) if (ZipOlderThanNumDays is null || ZipOlderThanNumDays <= 0)
return; return;
try try

View File

@ -152,7 +152,7 @@ namespace winsw.Native
{ {
var machinename = Environment.MachineName; var machinename = Environment.MachineName;
string? domain = GetDomain(username); string? domain = GetDomain(username);
if (domain == null || domain.ToLower() == machinename.ToLower() || domain == ".") if (domain is null || domain.ToLower() == machinename.ToLower() || domain == ".")
{ {
return GetLogin(username); return GetLogin(username);
} }

View File

@ -55,7 +55,7 @@ namespace winsw
DateTime next = periodicRollingCalendar.nextTriggeringTime(epoch, 1); DateTime next = periodicRollingCalendar.nextTriggeringTime(epoch, 1);
string r1 = next.ToString(_format); string r1 = next.ToString(_format);
if (r0 != null && r1 != null && !r0.Equals(r1)) if (r0 != r1)
{ {
return i; return i;
} }

View File

@ -54,7 +54,7 @@ namespace winsw
if (File.Exists(Path.Combine(d.FullName, baseName + ".xml"))) if (File.Exists(Path.Combine(d.FullName, baseName + ".xml")))
break; break;
if (d.Parent == null) if (d.Parent is null)
throw new FileNotFoundException("Unable to locate " + baseName + ".xml file within executable directory or any parents"); throw new FileNotFoundException("Unable to locate " + baseName + ".xml file within executable directory or any parents");
d = d.Parent; d = d.Parent;
@ -110,38 +110,31 @@ namespace winsw
private string? SingleElement(string tagName, bool optional) private string? SingleElement(string tagName, bool optional)
{ {
var n = dom.SelectSingleNode("//" + tagName); XmlNode? n = dom.SelectSingleNode("//" + tagName);
if (n == null && !optional) if (n is null && !optional)
throw new InvalidDataException("<" + tagName + "> is missing in configuration XML"); throw new InvalidDataException("<" + tagName + "> is missing in configuration XML");
return n == null ? null : Environment.ExpandEnvironmentVariables(n.InnerText); return n is null ? null : Environment.ExpandEnvironmentVariables(n.InnerText);
} }
private bool SingleBoolElement(string tagName, bool defaultValue) private bool SingleBoolElement(string tagName, bool defaultValue)
{ {
var e = dom.SelectSingleNode("//" + tagName); XmlNode? e = dom.SelectSingleNode("//" + tagName);
return e == null ? defaultValue : bool.Parse(e.InnerText); return e is null ? defaultValue : bool.Parse(e.InnerText);
} }
private int SingleIntElement(XmlNode parent, string tagName, int defaultValue) private int SingleIntElement(XmlNode parent, string tagName, int defaultValue)
{ {
var e = parent.SelectSingleNode(tagName); XmlNode? e = parent.SelectSingleNode(tagName);
if (e == null) return e is null ? defaultValue : int.Parse(e.InnerText);
{
return defaultValue;
}
else
{
return int.Parse(e.InnerText);
}
} }
private TimeSpan SingleTimeSpanElement(XmlNode parent, string tagName, TimeSpan defaultValue) private TimeSpan SingleTimeSpanElement(XmlNode parent, string tagName, TimeSpan defaultValue)
{ {
var value = SingleElement(tagName, true); string? value = SingleElement(tagName, true);
return (value != null) ? ParseTimeSpan(value) : defaultValue; return value is null ? defaultValue : ParseTimeSpan(value);
} }
private TimeSpan ParseTimeSpan(string v) private TimeSpan ParseTimeSpan(string v)
@ -194,11 +187,11 @@ namespace winsw
{ {
string? arguments = AppendTags("argument", null); string? arguments = AppendTags("argument", null);
if (arguments == null) if (arguments is null)
{ {
var argumentsNode = dom.SelectSingleNode("//arguments"); XmlNode? argumentsNode = dom.SelectSingleNode("//arguments");
if (argumentsNode == null) if (argumentsNode is null)
{ {
return Defaults.Arguments; return Defaults.Arguments;
} }
@ -237,7 +230,7 @@ namespace winsw
{ {
XmlNode? argumentNode = ExtensionsConfiguration; XmlNode? argumentNode = ExtensionsConfiguration;
XmlNodeList? extensions = argumentNode?.SelectNodes("extension"); XmlNodeList? extensions = argumentNode?.SelectNodes("extension");
if (extensions == null) if (extensions is null)
{ {
return new List<string>(0); return new List<string>(0);
} }
@ -261,7 +254,7 @@ namespace winsw
private string? AppendTags(string tagName, string? defaultValue = null) private string? AppendTags(string tagName, string? defaultValue = null)
{ {
XmlNode? argumentNode = dom.SelectSingleNode("//" + tagName); XmlNode? argumentNode = dom.SelectSingleNode("//" + tagName);
if (argumentNode == null) if (argumentNode is null)
{ {
return defaultValue; return defaultValue;
} }
@ -303,16 +296,11 @@ namespace winsw
{ {
get get
{ {
XmlNode loggingNode = dom.SelectSingleNode("//logpath"); XmlNode? loggingNode = dom.SelectSingleNode("//logpath");
if (loggingNode != null) return loggingNode is null
{ ? Defaults.LogDirectory
return Environment.ExpandEnvironmentVariables(loggingNode.InnerText); : Environment.ExpandEnvironmentVariables(loggingNode.InnerText);
}
else
{
return Defaults.LogDirectory;
}
} }
} }
@ -323,7 +311,7 @@ namespace winsw
string? mode = null; string? mode = null;
// first, backward compatibility with older configuration // first, backward compatibility with older configuration
XmlElement e = (XmlElement)dom.SelectSingleNode("//logmode"); XmlElement? e = (XmlElement?)dom.SelectSingleNode("//logmode");
if (e != null) if (e != null)
{ {
mode = e.InnerText; mode = e.InnerText;
@ -331,17 +319,12 @@ namespace winsw
else else
{ {
// this is more modern way, to support nested elements as configuration // this is more modern way, to support nested elements as configuration
e = (XmlElement)dom.SelectSingleNode("//log"); e = (XmlElement?)dom.SelectSingleNode("//log");
if (e != null) if (e != null)
mode = e.GetAttribute("mode"); mode = e.GetAttribute("mode");
} }
if (mode == null) return mode ?? Defaults.LogMode;
{
mode = Defaults.LogMode;
}
return mode;
} }
} }
@ -349,9 +332,9 @@ namespace winsw
{ {
get get
{ {
XmlNode loggingName = dom.SelectSingleNode("//logname"); XmlNode? loggingName = dom.SelectSingleNode("//logname");
return loggingName != null ? Environment.ExpandEnvironmentVariables(loggingName.InnerText) : BaseName; return loggingName is null ? BaseName : Environment.ExpandEnvironmentVariables(loggingName.InnerText);
} }
} }
@ -363,9 +346,9 @@ namespace winsw
{ {
get get
{ {
XmlNode loggingName = dom.SelectSingleNode("//outfilepattern"); XmlNode? loggingName = dom.SelectSingleNode("//outfilepattern");
return loggingName != null ? Environment.ExpandEnvironmentVariables(loggingName.InnerText) : Defaults.OutFilePattern; return loggingName is null ? Defaults.OutFilePattern : Environment.ExpandEnvironmentVariables(loggingName.InnerText);
} }
} }
@ -373,9 +356,9 @@ namespace winsw
{ {
get get
{ {
XmlNode loggingName = dom.SelectSingleNode("//errfilepattern"); XmlNode? loggingName = dom.SelectSingleNode("//errfilepattern");
return loggingName != null ? Environment.ExpandEnvironmentVariables(loggingName.InnerText) : Defaults.ErrFilePattern; return loggingName is null ? Defaults.ErrFilePattern : Environment.ExpandEnvironmentVariables(loggingName.InnerText);
} }
} }
@ -383,12 +366,10 @@ namespace winsw
{ {
get get
{ {
XmlElement e = (XmlElement)dom.SelectSingleNode("//logmode"); XmlElement? e = (XmlElement?)dom.SelectSingleNode("//logmode");
if (e == null)
{ // this is more modern way, to support nested elements as configuration
// this is more modern way, to support nested elements as configuration e ??= (XmlElement?)dom.SelectSingleNode("//log")!; // WARNING: NRE
e = (XmlElement)dom.SelectSingleNode("//log");
}
int sizeThreshold; int sizeThreshold;
switch (LogMode) switch (LogMode)
@ -406,8 +387,8 @@ namespace winsw
return new RollingLogAppender(LogDirectory, LogName, OutFileDisabled, ErrFileDisabled, OutFilePattern, ErrFilePattern); return new RollingLogAppender(LogDirectory, LogName, OutFileDisabled, ErrFileDisabled, OutFilePattern, ErrFilePattern);
case "roll-by-time": case "roll-by-time":
XmlNode patternNode = e.SelectSingleNode("pattern"); XmlNode? patternNode = e.SelectSingleNode("pattern");
if (patternNode == null) if (patternNode is null)
{ {
throw new InvalidDataException("Time Based rolling policy is specified but no pattern can be found in configuration XML."); throw new InvalidDataException("Time Based rolling policy is specified but no pattern can be found in configuration XML.");
} }
@ -426,42 +407,36 @@ namespace winsw
case "roll-by-size-time": case "roll-by-size-time":
sizeThreshold = SingleIntElement(e, "sizeThreshold", 10 * 1024) * RollingSizeTimeLogAppender.BYTES_PER_KB; sizeThreshold = SingleIntElement(e, "sizeThreshold", 10 * 1024) * RollingSizeTimeLogAppender.BYTES_PER_KB;
XmlNode filePatternNode = e.SelectSingleNode("pattern"); XmlNode? filePatternNode = e.SelectSingleNode("pattern");
if (filePatternNode == null) if (filePatternNode is null)
{ {
throw new InvalidDataException("Roll-Size-Time Based rolling policy is specified but no pattern can be found in configuration XML."); throw new InvalidDataException("Roll-Size-Time Based rolling policy is specified but no pattern can be found in configuration XML.");
} }
XmlNode autoRollAtTimeNode = e.SelectSingleNode("autoRollAtTime"); XmlNode? autoRollAtTimeNode = e.SelectSingleNode("autoRollAtTime");
TimeSpan? autoRollAtTime = null; TimeSpan? autoRollAtTime = null;
if (autoRollAtTimeNode != null) if (autoRollAtTimeNode != null)
{ {
// validate it // validate it
if (!TimeSpan.TryParse(autoRollAtTimeNode.InnerText, out TimeSpan autoRollAtTimeValue)) if (!TimeSpan.TryParse(autoRollAtTimeNode.InnerText, out TimeSpan autoRollAtTimeValue))
throw new InvalidDataException("Roll-Size-Time Based rolling policy is specified but autoRollAtTime does not match the TimeSpan format HH:mm:ss found in configuration XML."); throw new InvalidDataException("Roll-Size-Time Based rolling policy is specified but autoRollAtTime does not match the TimeSpan format HH:mm:ss found in configuration XML.");
autoRollAtTime = autoRollAtTimeValue; autoRollAtTime = autoRollAtTimeValue;
} }
XmlNode zipolderthannumdaysNode = e.SelectSingleNode("zipOlderThanNumDays"); XmlNode? zipolderthannumdaysNode = e.SelectSingleNode("zipOlderThanNumDays");
int? zipolderthannumdays = null; int? zipolderthannumdays = null;
if (zipolderthannumdaysNode != null) if (zipolderthannumdaysNode != null)
{ {
// validate it // validate it
if (!int.TryParse(zipolderthannumdaysNode.InnerText, out int zipolderthannumdaysValue)) if (!int.TryParse(zipolderthannumdaysNode.InnerText, out int zipolderthannumdaysValue))
throw new InvalidDataException("Roll-Size-Time Based rolling policy is specified but zipOlderThanNumDays does not match the int format found in configuration XML."); throw new InvalidDataException("Roll-Size-Time Based rolling policy is specified but zipOlderThanNumDays does not match the int format found in configuration XML.");
zipolderthannumdays = zipolderthannumdaysValue; zipolderthannumdays = zipolderthannumdaysValue;
} }
XmlNode zipdateformatNode = e.SelectSingleNode("zipDateFormat"); XmlNode? zipdateformatNode = e.SelectSingleNode("zipDateFormat");
string zipdateformat; string zipdateformat = zipdateformatNode is null ? "yyyyMM" : zipdateformatNode.InnerText;
if (zipdateformatNode == null)
{
zipdateformat = "yyyyMM";
}
else
{
zipdateformat = zipdateformatNode.InnerText;
}
return new RollingSizeTimeLogAppender(LogDirectory, LogName, OutFileDisabled, ErrFileDisabled, OutFilePattern, ErrFilePattern, sizeThreshold, filePatternNode.InnerText, autoRollAtTime, zipolderthannumdays, zipdateformat); return new RollingSizeTimeLogAppender(LogDirectory, LogName, OutFileDisabled, ErrFileDisabled, OutFilePattern, ErrFilePattern, sizeThreshold, filePatternNode.InnerText, autoRollAtTime, zipolderthannumdays, zipdateformat);
@ -479,7 +454,7 @@ namespace winsw
get get
{ {
XmlNodeList? nodeList = dom.SelectNodes("//depend"); XmlNodeList? nodeList = dom.SelectNodes("//depend");
if (nodeList == null) if (nodeList is null)
{ {
return Defaults.ServiceDependencies; return Defaults.ServiceDependencies;
} }
@ -507,8 +482,8 @@ namespace winsw
{ {
get get
{ {
var p = SingleElement("startmode", true); string? p = SingleElement("startmode", true);
if (p == null) if (p is null)
return Defaults.StartMode; return Defaults.StartMode;
try try
@ -591,7 +566,7 @@ namespace winsw
get get
{ {
XmlNodeList? nodeList = dom.SelectNodes("//download"); XmlNodeList? nodeList = dom.SelectNodes("//download");
if (nodeList == null) if (nodeList is null)
{ {
return Defaults.Downloads; return Defaults.Downloads;
} }
@ -614,7 +589,7 @@ namespace winsw
get get
{ {
XmlNodeList? childNodes = dom.SelectNodes("//onfailure"); XmlNodeList? childNodes = dom.SelectNodes("//onfailure");
if (childNodes == null) if (childNodes is null)
{ {
return new List<SC_ACTION>(0); return new List<SC_ACTION>(0);
} }
@ -643,11 +618,11 @@ namespace winsw
protected string? GetServiceAccountPart(string subNodeName) protected string? GetServiceAccountPart(string subNodeName)
{ {
var node = dom.SelectSingleNode("//serviceaccount"); XmlNode? node = dom.SelectSingleNode("//serviceaccount");
if (node != null) if (node != null)
{ {
var subNode = node.SelectSingleNode(subNodeName); XmlNode? subNode = node.SelectSingleNode(subNodeName);
if (subNode != null) if (subNode != null)
{ {
return subNode.InnerText; return subNode.InnerText;
@ -716,8 +691,8 @@ namespace winsw
{ {
get get
{ {
var p = SingleElement("priority", true); string? p = SingleElement("priority", true);
if (p == null) if (p is null)
return Defaults.Priority; return Defaults.Priority;
return (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), p, true); return (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), p, true);

View File

@ -17,11 +17,11 @@ namespace winsw.Util
/// <exception cref="InvalidDataException">The required element is missing</exception> /// <exception cref="InvalidDataException">The required element is missing</exception>
public static string? SingleElement(XmlNode node, string tagName, bool optional) public static string? SingleElement(XmlNode node, string tagName, bool optional)
{ {
var n = node.SelectSingleNode(tagName); XmlNode? n = node.SelectSingleNode(tagName);
if (n == null && !optional) if (n is null && !optional)
throw new InvalidDataException("<" + tagName + "> is missing in configuration XML"); throw new InvalidDataException("<" + tagName + "> is missing in configuration XML");
return n == null ? null : Environment.ExpandEnvironmentVariables(n.InnerText); return n is null ? null : Environment.ExpandEnvironmentVariables(n.InnerText);
} }
/// <summary> /// <summary>
@ -34,8 +34,8 @@ namespace winsw.Util
/// <exception cref="InvalidDataException">The required element is missing</exception> /// <exception cref="InvalidDataException">The required element is missing</exception>
public static XmlNode? SingleNode(XmlNode node, string tagName, bool optional) public static XmlNode? SingleNode(XmlNode node, string tagName, bool optional)
{ {
var n = node.SelectSingleNode(tagName); XmlNode? n = node.SelectSingleNode(tagName);
if (n == null && !optional) if (n is null && !optional)
throw new InvalidDataException("<" + tagName + "> is missing in configuration XML"); throw new InvalidDataException("<" + tagName + "> is missing in configuration XML");
return n; return n;

View File

@ -52,7 +52,7 @@ namespace WMI
void Create(string name, string displayName, string pathName, ServiceType serviceType, ErrorControl errorControl, StartMode startMode, bool desktopInteract, string[] serviceDependencies); void Create(string name, string displayName, string pathName, ServiceType serviceType, ErrorControl errorControl, StartMode startMode, bool desktopInteract, string[] serviceDependencies);
Win32Service Select(string name); Win32Service? Select(string name);
} }
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa394418(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/windows/desktop/aa394418(v=vs.85).aspx

View File

@ -189,7 +189,7 @@ namespace winsw.Plugins.RunawayProcessKiller
ServiceId = descriptor.Id; ServiceId = descriptor.Id;
// TODO: Consider making it documented // TODO: Consider making it documented
var checkWinSWEnvironmentVariable = XmlHelper.SingleElement(node, "checkWinSWEnvironmentVariable", true); var checkWinSWEnvironmentVariable = XmlHelper.SingleElement(node, "checkWinSWEnvironmentVariable", true);
CheckWinSWEnvironmentVariable = checkWinSWEnvironmentVariable != null ? bool.Parse(checkWinSWEnvironmentVariable) : true; CheckWinSWEnvironmentVariable = checkWinSWEnvironmentVariable is null ? true : bool.Parse(checkWinSWEnvironmentVariable);
} }
/// <summary> /// <summary>

View File

@ -27,7 +27,7 @@ namespace winsw.Plugins.SharedDirectoryMapper
public override void Configure(ServiceDescriptor descriptor, XmlNode node) public override void Configure(ServiceDescriptor descriptor, XmlNode node)
{ {
var mapNodes = XmlHelper.SingleNode(node, "mapping", false)!.SelectNodes("map"); XmlNodeList? mapNodes = XmlHelper.SingleNode(node, "mapping", false)!.SelectNodes("map");
if (mapNodes != null) if (mapNodes != null)
{ {
for (int i = 0; i < mapNodes.Count; i++) for (int i = 0; i < mapNodes.Count; i++)