75 lines
1.6 KiB
C#
75 lines
1.6 KiB
C#
using JD.PropertyService;
|
|
using TeaBox;
|
|
using TeaBox.ObjectModel;
|
|
|
|
namespace MaterialEditor
|
|
{
|
|
public class MaterialEditorPreferences
|
|
{
|
|
private const string textEditorKey = "TextEditorPath";
|
|
private const string promptForDeleteKey = "PromptForDelete";
|
|
|
|
#region Constructor
|
|
|
|
public MaterialEditorPreferences()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Public Properties
|
|
|
|
public string TextEditorPath
|
|
{
|
|
get
|
|
{
|
|
return internalGetKey(textEditorKey);
|
|
}
|
|
set
|
|
{
|
|
internalSetKey(textEditorKey, value);
|
|
}
|
|
}
|
|
|
|
public bool PromptForDelete
|
|
{
|
|
get
|
|
{
|
|
return "true".Equals(internalGetKey(promptForDeleteKey, "true"));
|
|
}
|
|
set
|
|
{
|
|
internalSetKey(promptForDeleteKey, value ? "true" : "false");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Private Methods
|
|
|
|
private string internalGetKey(string key, string defaultValue)
|
|
{
|
|
object value;
|
|
|
|
if (PropertyService.Properties.TryGetValue(key, out value))
|
|
{
|
|
return value as string;
|
|
}
|
|
return defaultValue;
|
|
}
|
|
|
|
private string internalGetKey(string key)
|
|
{
|
|
return internalGetKey(key, string.Empty);
|
|
}
|
|
|
|
private void internalSetKey(string key, string value)
|
|
{
|
|
PropertyService.Properties[key] = value;
|
|
PropertyService.Properties.Save();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
}
|