Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Add() [2/5]

void System.Net.CookieContainer.Add ( Cookie cookie,
bool throwOnError )
inlinepackage

Definition at line 168 of file CookieContainer.cs.

169 {
170 if (cookie.Value.Length > m_maxCookieSize)
171 {
172 if (throwOnError)
173 {
174 throw new CookieException(System.SR.Format(System.SR.net_cookie_size, cookie, m_maxCookieSize));
175 }
176 return;
177 }
178 try
179 {
180 PathList pathList;
182 {
183 pathList = (PathList)m_domainTable[cookie.DomainKey];
184 if (pathList == null)
185 {
186 pathList = (PathList)(m_domainTable[cookie.DomainKey] = new PathList());
187 }
188 }
189 int cookiesCount = pathList.GetCookiesCount();
190 CookieCollection cookieCollection;
192 {
193 cookieCollection = (CookieCollection)pathList[cookie.Path];
194 if (cookieCollection == null)
195 {
196 cookieCollection = new CookieCollection();
198 }
199 }
200 if (cookie.Expired)
201 {
203 {
204 int num = cookieCollection.IndexOf(cookie);
205 if (num != -1)
206 {
207 cookieCollection.RemoveAt(num);
208 m_count--;
209 }
210 }
211 }
212 else
213 {
214 if ((cookiesCount >= m_maxCookiesPerDomain && !AgeCookies(cookie.DomainKey)) || (m_count >= m_maxCookies && !AgeCookies(null)))
215 {
216 return;
217 }
219 {
220 m_count += cookieCollection.InternalAdd(cookie, isStrict: true);
221 }
222 }
224 {
226 }
227 }
228 catch (OutOfMemoryException)
229 {
230 throw;
231 }
232 catch (Exception inner)
233 {
234 if (throwOnError)
235 {
236 throw new CookieException(System.SR.net_container_add_cookie, inner);
237 }
238 }
239 }
readonly Hashtable m_domainTable
bool AgeCookies(string domain)
static string net_cookie_size
Definition SR.cs:32
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_container_add_cookie
Definition SR.cs:30
Definition SR.cs:7

References System.Net.CookieContainer.AgeCookies(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Collections.Hashtable.Count, System.Net.CookieContainer.DomainTableCleanup(), System.SR.Format(), System.Net.CookieContainer.m_count, System.Net.CookieContainer.m_domainTable, System.Net.CookieContainer.m_maxCookies, System.Net.CookieContainer.m_maxCookieSize, System.Net.CookieContainer.m_maxCookiesPerDomain, System.SR.net_container_add_cookie, System.SR.net_cookie_size, System.Collections.Generic.Dictionary< TKey, TValue >.SyncRoot, and System.Collections.Hashtable.SyncRoot.