[Help] Cleanup

This commit is contained in:
Matt Nadareski
2019-02-08 13:51:10 -08:00
parent b8cd0a10bb
commit e108c02eaa

View File

@@ -36,33 +36,20 @@ namespace SabreTools.Library.Help
get get
{ {
if (_features == null) if (_features == null)
{
_features = new Dictionary<string, Feature>(); _features = new Dictionary<string, Feature>();
}
if (!_features.ContainsKey(name)) if (!_features.ContainsKey(name))
{
return null; return null;
}
return _features[name]; return _features[name];
} }
set set
{ {
if (_features == null) if (_features == null)
{
_features = new Dictionary<string, Feature>(); _features = new Dictionary<string, Feature>();
}
if (_features.ContainsKey(name))
{
_features[name] = value; _features[name] = value;
} }
else
{
_features.Add(name, value);
}
}
} }
public Feature this[Feature subfeature] public Feature this[Feature subfeature]
@@ -70,33 +57,20 @@ namespace SabreTools.Library.Help
get get
{ {
if (_features == null) if (_features == null)
{
_features = new Dictionary<string, Feature>(); _features = new Dictionary<string, Feature>();
}
if (!_features.ContainsKey(subfeature.Name)) if (!_features.ContainsKey(subfeature.Name))
{
return null; return null;
}
return _features[subfeature.Name]; return _features[subfeature.Name];
} }
set set
{ {
if (_features == null) if (_features == null)
{
_features = new Dictionary<string, Feature>(); _features = new Dictionary<string, Feature>();
}
if (_features.ContainsKey(subfeature.Name))
{
_features[subfeature.Name] = value; _features[subfeature.Name] = value;
} }
else
{
_features.Add(subfeature.Name, value);
}
}
} }
/// <summary> /// <summary>
@@ -106,9 +80,7 @@ namespace SabreTools.Library.Help
public void Add(Feature feature) public void Add(Feature feature)
{ {
if (_features == null) if (_features == null)
{
_features = new Dictionary<string, Feature>(); _features = new Dictionary<string, Feature>();
}
lock (_features) lock (_features)
{ {
@@ -301,9 +273,8 @@ namespace SabreTools.Library.Help
foreach (KeyValuePair<string, Feature> tempfeat in temp) foreach (KeyValuePair<string, Feature> tempfeat in temp)
{ {
if (!enabled.ContainsKey(tempfeat.Key)) if (!enabled.ContainsKey(tempfeat.Key))
{
enabled.Add(tempfeat.Key, null); enabled.Add(tempfeat.Key, null);
}
enabled[tempfeat.Key] = tempfeat.Value; enabled[tempfeat.Key] = tempfeat.Value;
} }
} }