-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDoomEternalSavePathCollection.cs
74 lines (54 loc) · 2.24 KB
/
DoomEternalSavePathCollection.cs
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace DOOMSaveManager
{
public class DoomEternalSavePathCollection : IList<DoomEternalSavePath>
{
private List<DoomEternalSavePath> Paths = new List<DoomEternalSavePath>();
public int Count => Paths.Count;
public bool IsReadOnly => false;
public DoomEternalSavePathCollection() { }
public DoomEternalSavePathCollection(IEnumerable<DoomEternalSavePath> paths) => Paths.AddRange(paths);
public DoomEternalSavePath this[int index] {
get {
return Paths[index];
}
set {
Paths[index] = value;
}
}
public int IndexOf(DoomEternalSavePath path) => Paths.IndexOf(path);
public void Insert(int index, DoomEternalSavePath path) => Paths.Insert(index, path);
public void RemoveAt(int index) => Paths.RemoveAt(index);
public void Add(DoomEternalSavePath path) => Paths.Add(path);
public void Clear() => Paths.Clear();
public bool Contains(DoomEternalSavePath path) => Paths.Contains(path);
public void CopyTo(DoomEternalSavePath[] array, int index) => Paths.CopyTo(array, index);
public bool Remove(DoomEternalSavePath path) => Paths.Remove(path);
public IEnumerator<DoomEternalSavePath> GetEnumerator() => Paths.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public DoomEternalSavePath Get(int index) => Paths[index];
public bool SaveExists(string id, out DoomEternalSavePath save) {
foreach(var single in Paths) {
if (single.Identifier == id) {
save = single;
return true;
}
}
save = null;
return false;
}
public DoomEternalSavePath GetSave(string id) {
DoomEternalSavePath save;
SaveExists(id, out save);
return save;
}
public string[] GetIdentifiers() => Paths.Select(single => single.Identifier).ToArray();
}
}