-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPreferences.cs
More file actions
42 lines (39 loc) · 1.38 KB
/
Preferences.cs
File metadata and controls
42 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright Bastian Eicher
// Licensed under the MIT License
using System.IO;
using System.Linq;
using System.Text;
using NanoByte.Common.Collections;
using NanoByte.Common.Storage;
namespace NanoByte.LightTag
{
public static class Preferences
{
public static NamedCollection<Tag> KnownTags
{
get
{
string configPath = Locations.GetLoadConfigPaths("LightTag", true, "tags.xml").FirstOrDefault();
return (configPath == null) ? new NamedCollection<Tag>() : XmlStorage.LoadXml<NamedCollection<Tag>>(configPath);
}
set
{
string configPath = Locations.GetSaveConfigPath("LightTag", true, "tags.xml");
value.SaveXml(configPath);
}
}
public static string LastSearchDirectory
{
get
{
string configPath = Locations.GetLoadConfigPaths("LightTag", true, "search-directory.txt").FirstOrDefault();
return (configPath == null) ? null : File.ReadAllText(configPath, Encoding.UTF8);
}
set
{
string configPath = Locations.GetSaveConfigPath("LightTag", true, "search-directory.txt");
File.WriteAllText(configPath, value, Encoding.UTF8);
}
}
}
}