mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Update Help (WIP)
This commit is contained in:
@@ -10,8 +10,10 @@ namespace SabreTools.Library.Help
|
||||
{
|
||||
#region Private instance variables
|
||||
|
||||
private string _name;
|
||||
private List<string> _flags;
|
||||
private string _description;
|
||||
private string _longDescription; // TODO: Use this to generate README.1ST?
|
||||
private FeatureType _featureType;
|
||||
private Dictionary<string, Feature> _features;
|
||||
private List<string> _additionalNotes;
|
||||
@@ -28,10 +30,22 @@ namespace SabreTools.Library.Help
|
||||
|
||||
#region Publicly facing variables
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
}
|
||||
public List<string> Flags
|
||||
{
|
||||
get { return _flags; }
|
||||
}
|
||||
public string Description
|
||||
{
|
||||
get { return _description; }
|
||||
}
|
||||
public string LongDescription
|
||||
{
|
||||
get { return _longDescription; }
|
||||
}
|
||||
public Dictionary<string, Feature> Features
|
||||
{
|
||||
get { return _features; }
|
||||
@@ -43,28 +57,34 @@ namespace SabreTools.Library.Help
|
||||
|
||||
public Feature()
|
||||
{
|
||||
_name = null;
|
||||
_flags = new List<string>();
|
||||
_description = null;
|
||||
_longDescription = null;
|
||||
_featureType = FeatureType.Flag;
|
||||
_features = new Dictionary<string, Feature>();
|
||||
_additionalNotes = new List<string>();
|
||||
}
|
||||
|
||||
public Feature(string flag, string description, FeatureType featureType, List<string> additionalNotes)
|
||||
public Feature(string name, string flag, string description, FeatureType featureType, string longDescription = null, List<string> additionalNotes = null)
|
||||
{
|
||||
_name = name;
|
||||
List<string> flags = new List<string>();
|
||||
flags.Add(flag);
|
||||
_flags = flags;
|
||||
_description = description;
|
||||
_longDescription = longDescription;
|
||||
_featureType = featureType;
|
||||
_features = new Dictionary<string, Feature>();
|
||||
_additionalNotes = additionalNotes;
|
||||
}
|
||||
|
||||
public Feature(List<string> flags, string description, FeatureType featureType, List<string> additionalNotes)
|
||||
public Feature(string name, List<string> flags, string description, FeatureType featureType, string longDescription = null, List<string> additionalNotes = null)
|
||||
{
|
||||
_name = name;
|
||||
_flags = flags;
|
||||
_description = description;
|
||||
_longDescription = longDescription;
|
||||
_featureType = featureType;
|
||||
_features = new Dictionary<string, Feature>();
|
||||
_additionalNotes = additionalNotes;
|
||||
@@ -83,12 +103,20 @@ namespace SabreTools.Library.Help
|
||||
set { _features[name] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Directly address a given subfeature
|
||||
/// </summary>
|
||||
public Feature this[Feature subfeature]
|
||||
{
|
||||
get { return _features[subfeature.Name]; }
|
||||
set { _features[subfeature.Name] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new feature for this feature
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the feature to add</param>
|
||||
/// <param name="feature"></param>
|
||||
public void AddFeature(string name, Feature feature)
|
||||
public void AddFeature(Feature feature)
|
||||
{
|
||||
if (_features == null)
|
||||
{
|
||||
@@ -97,13 +125,13 @@ namespace SabreTools.Library.Help
|
||||
|
||||
lock(_features)
|
||||
{
|
||||
if (!_features.ContainsKey(name))
|
||||
if (!_features.ContainsKey(feature.Name))
|
||||
{
|
||||
_features.Add(name, feature);
|
||||
_features.Add(feature.Name, feature);
|
||||
}
|
||||
else
|
||||
{
|
||||
_features[name] = feature;
|
||||
_features[feature.Name] = feature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,12 +65,45 @@ namespace SabreTools.Library.Help
|
||||
}
|
||||
}
|
||||
|
||||
public Feature this[Feature subfeature]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_features == null)
|
||||
{
|
||||
_features = new Dictionary<string, Feature>();
|
||||
}
|
||||
|
||||
if (!_features.ContainsKey(subfeature.Name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _features[subfeature.Name];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_features == null)
|
||||
{
|
||||
_features = new Dictionary<string, Feature>();
|
||||
}
|
||||
|
||||
if (_features.ContainsKey(subfeature.Name))
|
||||
{
|
||||
_features[subfeature.Name] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_features.Add(subfeature.Name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new feature to the help
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the feature to add</param>
|
||||
/// <param name="feature">Feature object to map to</param>
|
||||
public void Add(string name, Feature feature)
|
||||
public void Add(Feature feature)
|
||||
{
|
||||
if (_features == null)
|
||||
{
|
||||
@@ -79,7 +112,7 @@ namespace SabreTools.Library.Help
|
||||
|
||||
lock (_features)
|
||||
{
|
||||
_features.Add(name, feature);
|
||||
_features.Add(feature.Name, feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user