Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CookieCollection.cs
Go to the documentation of this file.
5
6namespace System.Net;
7
9[TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
11{
12 internal enum Stamp
13 {
14 Check,
15 Set,
18 }
19
20 private readonly ArrayList m_list = new ArrayList();
21
22 private int m_version;
23
25
27
28 public Cookie this[int index]
29 {
30 get
31 {
33 {
34 throw new ArgumentOutOfRangeException("index");
35 }
36 return m_list[index] as Cookie;
37 }
38 }
39
40 public Cookie? this[string name]
41 {
42 get
43 {
44 foreach (Cookie item in m_list)
45 {
46 if (string.Equals(item.Name, name, StringComparison.OrdinalIgnoreCase))
47 {
48 return item;
49 }
50 }
51 return null;
52 }
53 }
54
55 public bool IsReadOnly => false;
56
57 public int Count => m_list.Count;
58
59 public bool IsSynchronized => false;
60
61 public object SyncRoot => this;
62
64
66 private void OnSerializing(StreamingContext context)
67 {
69 }
70
71 public void Add(Cookie cookie)
72 {
73 if (cookie == null)
74 {
75 throw new ArgumentNullException("cookie");
76 }
77 int num = IndexOf(cookie);
78 if (num == -1)
79 {
81 }
82 else
83 {
84 m_list[num] = cookie;
85 }
86 }
87
89 {
90 if (cookies == null)
91 {
92 throw new ArgumentNullException("cookies");
93 }
94 foreach (Cookie item in cookies.m_list)
95 {
96 Add(item);
97 }
98 }
99
100 public void Clear()
101 {
102 m_list.Clear();
103 }
104
105 public bool Contains(Cookie cookie)
106 {
107 return IndexOf(cookie) >= 0;
108 }
109
110 public bool Remove(Cookie cookie)
111 {
112 int num = IndexOf(cookie);
113 if (num == -1)
114 {
115 return false;
116 }
117 m_list.RemoveAt(num);
118 return true;
119 }
120
121 public void CopyTo(Array array, int index)
122 {
124 }
125
126 public void CopyTo(Cookie[] array, int index)
127 {
129 }
130
132 {
133 switch (how)
134 {
135 case Stamp.Set:
137 break;
138 case Stamp.SetToMaxUsed:
140 break;
141 case Stamp.SetToUnused:
143 break;
144 }
145 return m_TimeStamp;
146 }
147
148 internal int InternalAdd(Cookie cookie, bool isStrict)
149 {
150 int result = 1;
151 if (isStrict)
152 {
153 int num = 0;
154 int count = m_list.Count;
155 for (int i = 0; i < count; i++)
156 {
159 {
160 result = 0;
161 if (cookie2.Variant <= cookie.Variant)
162 {
163 m_list[num] = cookie;
164 }
165 break;
166 }
167 num++;
168 }
169 if (num == m_list.Count)
170 {
172 }
173 }
174 else
175 {
177 }
178 if (cookie.Version != 1)
179 {
181 }
182 return result;
183 }
184
185 internal int IndexOf(Cookie cookie)
186 {
187 int num = 0;
188 foreach (Cookie item in m_list)
189 {
191 {
192 return num;
193 }
194 num++;
195 }
196 return -1;
197 }
198
199 internal void RemoveAt(int idx)
200 {
202 }
203
205 {
206 foreach (Cookie item in m_list)
207 {
208 yield return item;
209 }
210 }
211
213 {
214 return m_list.GetEnumerator();
215 }
216}
virtual IEnumerator GetEnumerator()
virtual int Add(object? value)
virtual void RemoveAt(int index)
virtual void CopyTo(Array array)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
void CopyTo(Array array, int index)
void CopyTo(Cookie[] array, int index)
DateTime TimeStamp(Stamp how)
int InternalAdd(Cookie cookie, bool isStrict)
void OnSerializing(StreamingContext context)
void Add(CookieCollection cookies)
static int Compare(Cookie left, Cookie right)
static readonly DateTime MaxValue
Definition DateTime.cs:37
static readonly DateTime MinValue
Definition DateTime.cs:35
static DateTime Now
Definition DateTime.cs:103