-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathResourcePublicSuffixListProvider.cs
More file actions
35 lines (20 loc) · 1017 Bytes
/
ResourcePublicSuffixListProvider.cs
File metadata and controls
35 lines (20 loc) · 1017 Bytes
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
using System;
using System.Collections.Generic;
using System.Text;
namespace Gsemac.Net {
// Ideally, the public suffix list (https://publicsuffix.org/list/public_suffix_list.dat) should not be cached for an extended period of time.
// To load the list from the file system instead (where it can be updated), use FileSystemPublicSuffixListProvider instead.
internal sealed class ResourcePublicSuffixListProvider :
PublicSuffixListProviderBase {
// Public members
public override IPublicSuffixList GetList() {
return cache.Value;
}
// Private members
// The same cache will be used for instances because it never changes.
private static readonly Lazy<IPublicSuffixList> cache = new Lazy<IPublicSuffixList>(GetListInternal);
private static IPublicSuffixList GetListInternal() {
return new PublicSuffixList(ParseList(Encoding.UTF8.GetString(Properties.Resources.public_suffix_list)));
}
}
}