Datei: NDOEnhancer/ILCode/ILCustomElement.cs

Last Commit (83b2245)
1 //
2 // Copyright (c) 2002-2016 Mirko Matytschak
3 // (www.netdataobjects.de)
4 //
5 // Author: Mirko Matytschak
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8 // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
10 // Software, and to permit persons to whom the Software is furnished to do so, subject to the following
11 // conditions:
12
13 // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 // of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
21
22
23 using System;
24 using System.Globalization;
25 using System.Diagnostics;
26 using System.Reflection;
 
27
28 // using com.poet.util;
29
30 namespace ILCode
31 {
32 ····/// <summary>
33 ····/// Summary description for ILCustomElement.
34 ····/// </summary>
35 ····internal class ILCustomElement : ILElement
36 ····{
37 ········public ILCustomElement()
38 ············: base( false )
39 ········{
40 ········}
41
42 ········public ILCustomElement( string firstLine, ILElement owner )
43 ············: base( firstLine, owner )
44 ········{
45 ········}
46 /*
47 ········public ILCustomElement(string typeName, object[] parameters)
48 ············: base ( false )
49 ········{
50 ············string param = makeParameters(parameters);
51 ············//this.addLine
52 ········}
53 */
54 ········internal class ILCustomElementType : ILElementType
55 ········{
56 ············public ILCustomElementType()
57 ················: base( ".custom", typeof (ILCustomElement) )
58 ············{
59 ············}
60 ········}
61
62 ········internal class Iterator : ILElementIterator
63 ········{
64 ············public Iterator( ILElement element )
65 ················: base( element, typeof (ILCustomElement) )
66 ············{
67 ············}
68
69 ············public new ILCustomElement
70 ················getNext()
71 ············{
72 ················return base.getNext() as ILCustomElement;
73 ············}
74 ········}
75
76 ········private static ILElementType········m_elementType = new ILCustomElementType();
77 ········
78 ········public static void
79 ············initialize()
80 ········{
81 ········}
82
83 ········public static ILCustomElement.Iterator
84 ············getIterator( ILElement element )
85 ········{
86 ············return new Iterator( element );
87 ········}
88
89 ········public bool
90 ············isAttribute( Type type )
91 ········{
92 ············if ( null == type )
93 ················return false;
94
95 ············string firstLine = getLine( 0 );
96
97 ············return (-1 < firstLine.IndexOf( type.FullName ));
98 ········}
99
100 /*
101 ········private string
102 ············makeParameters(object[] parameters)
103 ········{
104 ············return null;
105 ········}
106 */
107 ········private object
108 ············readParam( byte[] bytes, Type type, ref int pos )
109 ········{
110 ············if ( type.FullName == "System.String" || type.FullName == "System.Type")
111 ············{
112 ················string para;
113 ················int len = PackedLength.Read(bytes, ref pos);
114 ················if (len == -1)
115 ····················para = null;
116 ················else
117 ····················para = new System.Text.UTF8Encoding().GetString(bytes, pos + 1, len);
118 ················//string para = new string( chars, pos + 1, bytes[pos]);
119 ················pos += 1 + bytes[pos];
120 ················if (para != null && para != string.Empty)
121 ················{
122 ····················if (para[para.Length - 1] == '\0')
123 ························para = para.Substring(0, para.Length - 1);
124 ················}
125 ················return para;
126 ············}
127 ············else if ( type == typeof(System.Boolean) )
128 ············{
129 ················bool para = Convert.ToBoolean( bytes[pos] );
130 ················pos += 1;
131 ················return para;
132 ············}
133 ············else if ( type == typeof(System.Char) )
134 ············{
135 ················char para = Convert.ToChar( bytes[pos+1] * 256 + bytes[pos] );
136 ················pos += 2;
137 ················return para;
138 ············}
139 ············else if ( type == typeof(System.Int16) )
140 ············{
141 ················short para = Convert.ToInt16( bytes[pos+1] * 256 + bytes[pos] );
142 ················pos += 2;
143 ················return para;
144 ············}
145 ············else if ( type == typeof(System.Int32) )
146 ············{
147 ················int para = ((bytes[pos+3] * 256 + bytes[pos+2]) * 256 + bytes[pos+1]) * 256 + bytes[pos];
148 ················pos += 4;
149 ················return para;
150 ············}
151 ············else if ( type.FullName == "NDO.RelationInfo" )
152 ············{
153 ················short para = Convert.ToInt16( bytes[pos+1] * 256 + bytes[pos] );
154 ················pos += 2;
155 ················return (NDO.RelationInfo) para;
156 ············}
157 ············else if (typeof(System.Enum).IsAssignableFrom( type ) )
158 ············{
159 ················int para = ((bytes[pos+3] * 256 + bytes[pos+2]) * 256 + bytes[pos+1]) * 256 + bytes[pos];
160 ················pos += 4;
161 ················return Enum.ToObject( type, para );
162 ············}
163
164 ············MessageAdapter ma = new MessageAdapter();
165 ma. ShowError( $"Relation Attribute: Unknown type in attribute parameter list: { type. FullName} , owner type: { ( this. Owner as ILClassElement ) ?. Name ?? "-"} " ) ;
166
167 ············return null;
168 ········}
169
170
171 ········internal class AttributeInfo
172 ········{
173 ············public string Name;
174 ············public string AssemblyName;
175 ············public string[] ParamTypeNames = new string[]{};
176 ············public object[] ParamValues = new object[]{};
177 ········}
178
179
180 ········public AttributeInfo
181 ············getAttributeInfo()
182 ········{
183 ············string text = "";
184
185 ············for ( int i=0; i<getLineCount(); i++ )
186 ············{
187 ················string line = getLine( i );
188 ················
189 ················int cmt = line.IndexOf( "//" );
190 ················if ( -1 < cmt )
191 ····················line = line.Substring( 0, cmt ).Trim();
192 ················
193 ················text += " " + line;
194 ············}
195
196 ············int start, end;
197
198 ············// assembly name
199
200 ············start = text.IndexOf( "[" ) + 1;
201 ············end·· = text.IndexOf( "]", start );
202 ············string assName = stripComment( text.Substring( start, end - start ) );
203
204 ············// type name
205
206 ············start = text.IndexOf( "]" ) + 1;
207 ············end······= text.IndexOf( "::", start );
208 ············string typeName = stripComment( text.Substring( start, end - start ) );
209
210 ············// constructor signature
211
212 ············start = text.IndexOf( "(" ) + 1;
213 ············end······= text.IndexOf( ")", start );
214 ············string signature = stripComment( text.Substring( start, end - start ) );
215
216 ············// parameter bytes
217
218 ············start = text.IndexOf( "= (" ) + 3;
219 ············end······= text.IndexOf( ")", start );
220 ············string byteText····= text.Substring( start, end - start ).Trim();
221
222 ············char[]·· spc········ = { ' ' };
223 ············string[] byteStrings = byteText.Split( spc );
224 ············byte[]·· bytes········ = new byte[byteStrings.Length];
225 ············//············char[]···· chars········ = new char[byteStrings.Length];
226
227 ············for ( int i=0; i<byteStrings.Length; i++ )
228 ············{
229 ················bytes[i] = Byte.Parse( byteStrings[i], NumberStyles.HexNumber );
230 ················//················chars[i] = Convert.ToChar( bytes[i] );
231 ············}
232
233 //············char[] chars = new System.Text.UTF8Encoding().GetChars(bytes);
234 ············
235 ············//············Type attributeType = Type.GetType( typeName + ", " + assName );
236 ············//············if ( null == attributeType )
237 ············//················return null;
238
239 ············char·· comma =··',';
240 ············string[] paramTypeNames = new string[]{};
241 ············object[] paramValues = new object[]{};
242 ············Type[] paramTypes = new Type[]{};
243 ············//CustomAttrib starts with a Prolog – an unsigned int16, with value 0x0001
244 ············int pos = 2;
245 ············if (signature != "")
246 ············{
247 ················paramTypeNames = signature.Split( comma );
248 ················paramTypes······ = new Type[paramTypeNames.Length];
249 ················paramValues······ = new Object[paramTypeNames.Length];
250
251 ················for ( int i=0; i<paramTypeNames.Length; i++ )
252 ················{
253 ····················string paramTypeName = paramTypeNames[i].Trim();
254 ····················if ( paramTypeName == "string" || paramTypeName.IndexOf("System.String") > -1)
255 ····················{
256 ························paramTypeNames[i] = "System.String";
257 ························paramTypes[i] = typeof(string);
258 ····················}
259 ····················else if ( paramTypeName == "bool" )
260 ····················{
261 ························paramTypes[i] = typeof(bool);
262 ························paramTypeNames[i] = "System.Boolean";
263 ····················}
264 ····················else if ( paramTypeName == "char" )
265 ····················{
266 ························paramTypes[i] = typeof(char);
267 ························paramTypeNames[i] = "System.Char";
268 ····················}
269 ····················else if ( paramTypeName == "short" || paramTypeName == "int16" )
270 ····················{
271 ························paramTypeNames[i] = "System.Int16";
272 ························paramTypes[i] = typeof(System.Int16);
273 ····················}
274 ····················else if ( paramTypeName == "int" || paramTypeName == "int32")
275 ····················{
276 ························paramTypeNames[i] = "System.Int32";
277 ························paramTypes[i] = typeof(System.Int32);
278 ····················}
279 ························// Achtung: System.Type wird als string abgespeichert!!!
280 ····················else if ( paramTypeName.IndexOf("[mscorlib") > -1 && paramTypeName.IndexOf("System.Type") > -1 )
281 ····················{
282 ························paramTypes[i] = typeof(System.String);
283 ························paramTypeNames[i] = "System.Type";························
284 ····················}
285 ····················else if ( paramTypeName == "valuetype [NDO]NDO.RelationInfo" )
286 ····················{
287 ························paramTypes[i] = typeof(NDO.RelationInfo);
288 ························paramTypeNames[i] = "NDO.RelationInfo, NDO";························
289 ····················}
290 ····················else
291 ····················{
292 ························var paramTypeString = paramTypeName.Substring(paramTypeName.IndexOf(']') + 1);
293 ························var t = Type.GetType( paramTypeString );
294 ························if (t != null)
295 ························{
296 ····························paramTypes[i] = t;
297 ····························paramTypeNames[i] = "paramTypeString";
298 ························}
299 ························else
300 throw new Exception( $"Relation Attribute: Unknown type in attribute parameter list: { paramTypeName} , type: { ( this. Owner as ILClassElement ) ?. Name ?? ""} " ) ;
301 ····················}
302
303 ····················//paramTypes[i]··= Type.GetType( paramTypeNames[i] );
304 ····················paramValues[i] = readParam( bytes, paramTypes[i], ref pos );
305 ················}
306 ············}
307 ············//············ConstructorInfo ci···· = attributeType.GetConstructor( paramTypes );
308 ············AttributeInfo····attr = new AttributeInfo();
309 ············attr.Name = typeName;
310 ············attr.AssemblyName = assName;
311 ············attr.ParamTypeNames = paramTypeNames;
312 ············attr.ParamValues = paramValues;
313
314 ············//TODO: sollten jemals benannte Parameter dazukommen
315 ············//TODO: müssten wir hier einigen Code hinzufügen
316
317 ············//············short count = (short) readParam( bytes, chars, Type.GetType( "System.Int16" ), ref pos );
318 ············//
319 ············//············for ( short i=0; i<count; i++ )
320 ············//············{
321 ············//················pos += 2;
322 ············//
323 ············//················string propName = readParam( bytes, chars, Type.GetType( "System.String" ), ref pos ) as string;
324 ············//
325 ············//················PropertyInfo pi = attributeType.GetProperty( propName );
326 ············//
327 ············//················object propVal = readParam( bytes, chars, pi.PropertyType, ref pos );
328 ············//
329 ············//················pi.SetValue( attr, propVal, null );
330 ············//············}
331
332 ············return attr;
333 ········}
334
335 ········public void
336 ············replaceLines( string firstLine )
337 ········{
338 ············clearLines();
339
340 ············addLine( firstLine );
341 ········}
342
343 ····
344 ····}
345 }
346
New Commit (f892a37)
1 //
2 // Copyright (c) 2002-2016 Mirko Matytschak
3 // (www.netdataobjects.de)
4 //
5 // Author: Mirko Matytschak
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8 // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
10 // Software, and to permit persons to whom the Software is furnished to do so, subject to the following
11 // conditions:
12
13 // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 // of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
21
22
23 using System;
24 using System.Globalization;
25 using System.Diagnostics;
26 using System.Reflection;
27 using NDOEnhancer;
28
29 // using com.poet.util;
30
31 namespace ILCode
32 {
33 ····/// <summary>
34 ····/// Summary description for ILCustomElement.
35 ····/// </summary>
36 ····internal class ILCustomElement : ILElement
37 ····{
38 ········public ILCustomElement()
39 ············: base( false )
40 ········{
41 ········}
42
43 ········public ILCustomElement( string firstLine, ILElement owner )
44 ············: base( firstLine, owner )
45 ········{
46 ········}
47 /*
48 ········public ILCustomElement(string typeName, object[] parameters)
49 ············: base ( false )
50 ········{
51 ············string param = makeParameters(parameters);
52 ············//this.addLine
53 ········}
54 */
55 ········internal class ILCustomElementType : ILElementType
56 ········{
57 ············public ILCustomElementType()
58 ················: base( ".custom", typeof (ILCustomElement) )
59 ············{
60 ············}
61 ········}
62
63 ········internal class Iterator : ILElementIterator
64 ········{
65 ············public Iterator( ILElement element )
66 ················: base( element, typeof (ILCustomElement) )
67 ············{
68 ············}
69
70 ············public new ILCustomElement
71 ················getNext()
72 ············{
73 ················return base.getNext() as ILCustomElement;
74 ············}
75 ········}
76
77 ········private static ILElementType········m_elementType = new ILCustomElementType();
78 ········
79 ········public static void
80 ············initialize()
81 ········{
82 ········}
83
84 ········public static ILCustomElement.Iterator
85 ············getIterator( ILElement element )
86 ········{
87 ············return new Iterator( element );
88 ········}
89
90 ········public bool
91 ············isAttribute( Type type )
92 ········{
93 ············if ( null == type )
94 ················return false;
95
96 ············string firstLine = getLine( 0 );
97
98 ············return (-1 < firstLine.IndexOf( type.FullName ));
99 ········}
100
101 /*
102 ········private string
103 ············makeParameters(object[] parameters)
104 ········{
105 ············return null;
106 ········}
107 */
108 ········private object
109 ············readParam( byte[] bytes, Type type, ref int pos )
110 ········{
111 ············if ( type.FullName == "System.String" || type.FullName == "System.Type")
112 ············{
113 ················string para;
114 ················int len = PackedLength.Read(bytes, ref pos);
115 ················if (len == -1)
116 ····················para = null;
117 ················else
118 ····················para = new System.Text.UTF8Encoding().GetString(bytes, pos + 1, len);
119 ················//string para = new string( chars, pos + 1, bytes[pos]);
120 ················pos += 1 + bytes[pos];
121 ················if (para != null && para != string.Empty)
122 ················{
123 ····················if (para[para.Length - 1] == '\0')
124 ························para = para.Substring(0, para.Length - 1);
125 ················}
126 ················return para;
127 ············}
128 ············else if ( type == typeof(System.Boolean) )
129 ············{
130 ················bool para = Convert.ToBoolean( bytes[pos] );
131 ················pos += 1;
132 ················return para;
133 ············}
134 ············else if ( type == typeof(System.Char) )
135 ············{
136 ················char para = Convert.ToChar( bytes[pos+1] * 256 + bytes[pos] );
137 ················pos += 2;
138 ················return para;
139 ············}
140 ············else if ( type == typeof(System.Int16) )
141 ············{
142 ················short para = Convert.ToInt16( bytes[pos+1] * 256 + bytes[pos] );
143 ················pos += 2;
144 ················return para;
145 ············}
146 ············else if ( type == typeof(System.Int32) )
147 ············{
148 ················int para = ((bytes[pos+3] * 256 + bytes[pos+2]) * 256 + bytes[pos+1]) * 256 + bytes[pos];
149 ················pos += 4;
150 ················return para;
151 ············}
152 ············else if ( type.FullName == "NDO.RelationInfo" )
153 ············{
154 ················short para = Convert.ToInt16( bytes[pos+1] * 256 + bytes[pos] );
155 ················pos += 2;
156 ················return (NDO.RelationInfo) para;
157 ············}
158 ············else if (typeof(System.Enum).IsAssignableFrom( type ) )
159 ············{
160 ················int para = ((bytes[pos+3] * 256 + bytes[pos+2]) * 256 + bytes[pos+1]) * 256 + bytes[pos];
161 ················pos += 4;
162 ················return Enum.ToObject( type, para );
163 ············}
164
165 ············MessageAdapter ma = new MessageAdapter();
166 ma. ShowError( $"Relation Attribute: Unknown type in attribute parameter list: { type. FullName} , owner type: { ( this. getOwner( ) as ILClassElement ) ?. getName( ) ?? "-"} " ) ;
167
168 ············return null;
169 ········}
170
171
172 ········internal class AttributeInfo
173 ········{
174 ············public string Name;
175 ············public string AssemblyName;
176 ············public string[] ParamTypeNames = new string[]{};
177 ············public object[] ParamValues = new object[]{};
178 ········}
179
180
181 ········public AttributeInfo
182 ············getAttributeInfo()
183 ········{
184 ············string text = "";
185
186 ············for ( int i=0; i<getLineCount(); i++ )
187 ············{
188 ················string line = getLine( i );
189 ················
190 ················int cmt = line.IndexOf( "//" );
191 ················if ( -1 < cmt )
192 ····················line = line.Substring( 0, cmt ).Trim();
193 ················
194 ················text += " " + line;
195 ············}
196
197 ············int start, end;
198
199 ············// assembly name
200
201 ············start = text.IndexOf( "[" ) + 1;
202 ············end·· = text.IndexOf( "]", start );
203 ············string assName = stripComment( text.Substring( start, end - start ) );
204
205 ············// type name
206
207 ············start = text.IndexOf( "]" ) + 1;
208 ············end······= text.IndexOf( "::", start );
209 ············string typeName = stripComment( text.Substring( start, end - start ) );
210
211 ············// constructor signature
212
213 ············start = text.IndexOf( "(" ) + 1;
214 ············end······= text.IndexOf( ")", start );
215 ············string signature = stripComment( text.Substring( start, end - start ) );
216
217 ············// parameter bytes
218
219 ············start = text.IndexOf( "= (" ) + 3;
220 ············end······= text.IndexOf( ")", start );
221 ············string byteText····= text.Substring( start, end - start ).Trim();
222
223 ············char[]·· spc········ = { ' ' };
224 ············string[] byteStrings = byteText.Split( spc );
225 ············byte[]·· bytes········ = new byte[byteStrings.Length];
226 ············//············char[]···· chars········ = new char[byteStrings.Length];
227
228 ············for ( int i=0; i<byteStrings.Length; i++ )
229 ············{
230 ················bytes[i] = Byte.Parse( byteStrings[i], NumberStyles.HexNumber );
231 ················//················chars[i] = Convert.ToChar( bytes[i] );
232 ············}
233
234 //············char[] chars = new System.Text.UTF8Encoding().GetChars(bytes);
235 ············
236 ············//············Type attributeType = Type.GetType( typeName + ", " + assName );
237 ············//············if ( null == attributeType )
238 ············//················return null;
239
240 ············char·· comma =··',';
241 ············string[] paramTypeNames = new string[]{};
242 ············object[] paramValues = new object[]{};
243 ············Type[] paramTypes = new Type[]{};
244 ············//CustomAttrib starts with a Prolog – an unsigned int16, with value 0x0001
245 ············int pos = 2;
246 ············if (signature != "")
247 ············{
248 ················paramTypeNames = signature.Split( comma );
249 ················paramTypes······ = new Type[paramTypeNames.Length];
250 ················paramValues······ = new Object[paramTypeNames.Length];
251
252 ················for ( int i=0; i<paramTypeNames.Length; i++ )
253 ················{
254 ····················string paramTypeName = paramTypeNames[i].Trim();
255 ····················if ( paramTypeName == "string" || paramTypeName.IndexOf("System.String") > -1)
256 ····················{
257 ························paramTypeNames[i] = "System.String";
258 ························paramTypes[i] = typeof(string);
259 ····················}
260 ····················else if ( paramTypeName == "bool" )
261 ····················{
262 ························paramTypes[i] = typeof(bool);
263 ························paramTypeNames[i] = "System.Boolean";
264 ····················}
265 ····················else if ( paramTypeName == "char" )
266 ····················{
267 ························paramTypes[i] = typeof(char);
268 ························paramTypeNames[i] = "System.Char";
269 ····················}
270 ····················else if ( paramTypeName == "short" || paramTypeName == "int16" )
271 ····················{
272 ························paramTypeNames[i] = "System.Int16";
273 ························paramTypes[i] = typeof(System.Int16);
274 ····················}
275 ····················else if ( paramTypeName == "int" || paramTypeName == "int32")
276 ····················{
277 ························paramTypeNames[i] = "System.Int32";
278 ························paramTypes[i] = typeof(System.Int32);
279 ····················}
280 ························// Achtung: System.Type wird als string abgespeichert!!!
281 ····················else if ( paramTypeName.IndexOf("[mscorlib") > -1 && paramTypeName.IndexOf("System.Type") > -1 )
282 ····················{
283 ························paramTypes[i] = typeof(System.String);
284 ························paramTypeNames[i] = "System.Type";························
285 ····················}
286 ····················else if ( paramTypeName == "valuetype [NDO]NDO.RelationInfo" )
287 ····················{
288 ························paramTypes[i] = typeof(NDO.RelationInfo);
289 ························paramTypeNames[i] = "NDO.RelationInfo, NDO";························
290 ····················}
291 ····················else
292 ····················{
293 ························var paramTypeString = paramTypeName.Substring(paramTypeName.IndexOf(']') + 1);
294 ························var t = Type.GetType( paramTypeString );
295 ························if (t != null)
296 ························{
297 ····························paramTypes[i] = t;
298 ····························paramTypeNames[i] = "paramTypeString";
299 ························}
300 ························else
301 throw new Exception( $"Relation Attribute: Unknown type in attribute parameter list: { paramTypeName} , type: { ( this. getOwner( ) as ILClassElement ) ?. getName( ) ?? ""} " ) ;
302 ····················}
303
304 ····················//paramTypes[i]··= Type.GetType( paramTypeNames[i] );
305 ····················paramValues[i] = readParam( bytes, paramTypes[i], ref pos );
306 ················}
307 ············}
308 ············//············ConstructorInfo ci···· = attributeType.GetConstructor( paramTypes );
309 ············AttributeInfo····attr = new AttributeInfo();
310 ············attr.Name = typeName;
311 ············attr.AssemblyName = assName;
312 ············attr.ParamTypeNames = paramTypeNames;
313 ············attr.ParamValues = paramValues;
314
315 ············//TODO: sollten jemals benannte Parameter dazukommen
316 ············//TODO: müssten wir hier einigen Code hinzufügen
317
318 ············//············short count = (short) readParam( bytes, chars, Type.GetType( "System.Int16" ), ref pos );
319 ············//
320 ············//············for ( short i=0; i<count; i++ )
321 ············//············{
322 ············//················pos += 2;
323 ············//
324 ············//················string propName = readParam( bytes, chars, Type.GetType( "System.String" ), ref pos ) as string;
325 ············//
326 ············//················PropertyInfo pi = attributeType.GetProperty( propName );
327 ············//
328 ············//················object propVal = readParam( bytes, chars, pi.PropertyType, ref pos );
329 ············//
330 ············//················pi.SetValue( attr, propVal, null );
331 ············//············}
332
333 ············return attr;
334 ········}
335
336 ········public void
337 ············replaceLines( string firstLine )
338 ········{
339 ············clearLines();
340
341 ············addLine( firstLine );
342 ········}
343
344 ····
345 ····}
346 }
347