forked from hunterzonewu/unity-decompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerializedStringTable.cs
More file actions
93 lines (82 loc) · 2.04 KB
/
SerializedStringTable.cs
File metadata and controls
93 lines (82 loc) · 2.04 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Decompiled with JetBrains decompiler
// Type: SerializedStringTable
// Assembly: UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 01B28312-B6F5-4E06-90F6-BE297B711E41
// Assembly location: C:\Users\Blake\sandbox\unity\test-project\Library\UnityAssemblies\UnityEditor.dll
using System;
using System.Collections;
using UnityEngine;
[Serializable]
internal class SerializedStringTable
{
[SerializeField]
private string[] keys;
[SerializeField]
private int[] values;
private Hashtable table;
public Hashtable hashtable
{
get
{
this.SanityCheck();
return this.table;
}
}
public int Length
{
get
{
this.SanityCheck();
return this.keys.Length;
}
}
private void SanityCheck()
{
if (this.keys == null)
{
this.keys = new string[0];
this.values = new int[0];
}
if (this.table != null)
return;
this.table = new Hashtable();
for (int index = 0; index < this.keys.Length; ++index)
this.table[(object) this.keys[index]] = (object) this.values[index];
}
private void SynchArrays()
{
this.keys = new string[this.table.Count];
this.values = new int[this.table.Count];
this.table.Keys.CopyTo((Array) this.keys, 0);
this.table.Values.CopyTo((Array) this.values, 0);
}
public void Set(string key, int value)
{
this.SanityCheck();
this.table[(object) key] = (object) value;
this.SynchArrays();
}
public void Set(string key)
{
this.Set(key, 0);
}
public bool Contains(string key)
{
this.SanityCheck();
return this.table.Contains((object) key);
}
public int Get(string key)
{
this.SanityCheck();
if (!this.table.Contains((object) key))
return -1;
return (int) this.table[(object) key];
}
public void Remove(string key)
{
this.SanityCheck();
if (this.table.Contains((object) key))
this.table.Remove((object) key);
this.SynchArrays();
}
}