Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DataViewSettingCollection.cs
Go to the documentation of this file.
4
5namespace System.Data;
6
7[Editor("Microsoft.VSDesigner.Data.Design.DataViewSettingsCollectionEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
9{
11 {
13
14 private readonly IEnumerator _tableEnumerator;
15
17
19 {
20 DataSet dataSet = dvm.DataSet;
21 if (dataSet != null)
22 {
25 }
26 else
27 {
28 _dataViewSettings = null;
30 }
31 }
32
33 public bool MoveNext()
34 {
36 }
37
38 public void Reset()
39 {
41 }
42 }
43
45
46 private readonly Hashtable _list = new Hashtable();
47
48 public virtual DataViewSetting this[DataTable table]
49 {
50 get
51 {
52 if (table == null)
53 {
54 throw ExceptionBuilder.ArgumentNull("table");
55 }
56 DataViewSetting dataViewSetting = (DataViewSetting)_list[table];
57 if (dataViewSetting == null)
58 {
59 dataViewSetting = (this[table] = new DataViewSetting());
60 }
61 return dataViewSetting;
62 }
63 set
64 {
65 if (table == null)
66 {
67 throw ExceptionBuilder.ArgumentNull("table");
68 }
69 value.SetDataViewManager(_dataViewManager);
70 value.SetDataTable(table);
71 _list[table] = value;
72 }
73 }
74
75 public virtual DataViewSetting? this[string tableName]
76 {
77 get
78 {
79 DataTable table = GetTable(tableName);
80 if (table != null)
81 {
82 return this[table];
83 }
84 return null;
85 }
86 }
87
88 public virtual DataViewSetting? this[int index]
89 {
90 get
91 {
92 DataTable table = GetTable(index);
93 if (table != null)
94 {
95 return this[table];
96 }
97 return null;
98 }
99 [param: DisallowNull]
100 set
101 {
102 DataTable table = GetTable(index);
103 if (table != null)
104 {
105 this[table] = value;
106 }
107 }
108 }
109
110 [Browsable(false)]
111 public virtual int Count => _dataViewManager.DataSet?.Tables.Count ?? 0;
112
113 [Browsable(false)]
114 public bool IsReadOnly => true;
115
116 [Browsable(false)]
117 public bool IsSynchronized => false;
118
119 [Browsable(false)]
120 public object SyncRoot => this;
121
123 {
124 if (dataViewManager == null)
125 {
126 throw ExceptionBuilder.ArgumentNull("dataViewManager");
127 }
128 _dataViewManager = dataViewManager;
129 }
130
131 private DataTable GetTable(string tableName)
132 {
133 DataTable result = null;
135 if (dataSet != null)
136 {
137 result = dataSet.Tables[tableName];
138 }
139 return result;
140 }
141
143 {
144 DataTable result = null;
146 if (dataSet != null)
147 {
148 result = dataSet.Tables[index];
149 }
150 return result;
151 }
152
153 public void CopyTo(Array ar, int index)
154 {
155 IEnumerator enumerator = GetEnumerator();
156 while (enumerator.MoveNext())
157 {
158 ar.SetValue(enumerator.Current, index++);
159 }
160 }
161
162 public void CopyTo(DataViewSetting[] ar, int index)
163 {
164 IEnumerator enumerator = GetEnumerator();
165 while (enumerator.MoveNext())
166 {
167 ar.SetValue(enumerator.Current, index++);
168 }
169 }
170
175
176 internal void Remove(DataTable table)
177 {
178 _list.Remove(table);
179 }
180}
unsafe void SetValue(object? value, int index)
Definition Array.cs:1022
virtual void Remove(object key)
DataTableCollection Tables
Definition DataSet.cs:396
DataViewSettingCollection DataViewSettings
DataViewSettingCollection(DataViewManager dataViewManager)
void CopyTo(DataViewSetting[] ar, int index)
static Exception ArgumentNull(string paramName)