using System.Collections.Generic;
using System.Linq;
namespace RuriLib.Models
{
///
/// Settings for customizeable data types used in the library.
///
public class EnvironmentSettings
{
/// List of custom Wordlist Types.
public List WordlistTypes { get; set; } = new List();
/// List of custom KeyChain Types.
public List CustomKeychains { get; set; } = new List();
/// List of custom Export Formats.
public List ExportFormats { get; set; } = new List();
///
/// Gets the names of all Wordlist Types.
///
/// The list of all the names of custom Wordlist Types
public List GetWordlistTypeNames()
{
return WordlistTypes.Select(w => w.Name).ToList();
}
///
/// Gets the names of all Custom KeyChains.
///
/// The list of all the names of custom KeyChain types
public List GetCustomKeychainNames()
{
return CustomKeychains.Select(c => c.Name).ToList();
}
///
/// Gets a Custom KeyChain given its name.
///
/// The name of the Custom KeyChain
/// The CustomKeychain object if found, a default one if not
public CustomKeychain GetCustomKeychain(string name)
{
try { return CustomKeychains.First(w => w.Name == name); }
catch { return new CustomKeychain(); }
}
///
/// Gets a Wordlist Type given its name.
///
/// The name of the Wordlist Type
/// The WordlistType object if found, a default one if not
public WordlistType GetWordlistType(string name)
{
try { return WordlistTypes.FirstOrDefault(w => w.Name == name); }
catch { return new WordlistType(); }
}
}
}