Datei: NDOEnhancer/ILCode/ILCustomElement.cs

Last Commit (a901c7e)
1 //
2 // Copyright ( c) 2002-2022 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
26 namespace NDOEnhancer. ILCode
27 {
28 ····/// <summary>
29 ····/// Summary description for ILCustomElement.
30 ····/// </summary>
31 ····internal class ILCustomElement : ILElement
32 ····{
33 /*
34 . custom instance void [NDO]NDO. Linq. ServerFunctionAttribute::. ctor( string) = ( 01 00 15 4D 49 4E 5F 41 43 54 49 56 45 5F 52 4F // . . . MIN_ACTIVE_RO
35 57 56 45 52 53 49 4F 4E 00 00 ) // WVERSION. .
36 */
37
38 ········public ILCustomElement( string firstLine, ILElement owner )
39 ············: base( firstLine, owner )
40 ········{
41 ········}
42
 
 
 
 
 
 
 
43 ········internal class ILCustomElementType : ILElementType
44 ········{
45 ············public ILCustomElementType()
46 : base( ". custom", typeof( ILCustomElement ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
47 ············{
 
48 ············}
49 ········}
50
51 private static ILElementType m_elementType = new ILCustomElementType( ) ;
52 ········private AttributeInfo attributeInfo = null;
53
 
 
 
 
54
55 private void Resolve( )
 
56 ········{
57 if ( this. attributeInfo == null)
58 ················this.attributeInfo = GetAttributeInfo();
59 ········}
60
61 ········public bool
62 IsAttribute( Type type )
63 ········{
64 Resolve( ) ;
65 return this. attributeInfo. TypeName == type. FullName;
 
 
 
 
66 ········}
67
68
 
 
 
 
 
 
69 ········private object
70 ReadParam( byte[] bytes, Type type, ref int pos )
71 ········{
72 if ( type. FullName == "System. String" || type. FullName == "System. Type")
73 ············{
74 ················string para;
75 ················int len = PackedLength.Read(bytes, ref pos);
76 ················if (len == -1)
77 ····················para = null;
78 ················else
79 para = new System. Text. UTF8Encoding( ) . GetString( bytes, pos + 1, len ) ;
80 ················//string para = new string( chars, pos + 1, bytes[pos]);
81 ················pos += 1 + bytes[pos];
82 ················if (para != null && para != string.Empty)
83 ················{
84 ····················if (para[para.Length - 1] == '\0')
85 para = para. Substring( 0, para. Length - 1 ) ;
86 ················}
87 ················return para;
88 ············}
89 else if ( type == typeof( System. Boolean ) )
90 ············{
91 ················bool para = Convert.ToBoolean( bytes[pos] );
92 ················pos += 1;
93 ················return para;
94 ············}
95 else if ( type == typeof( System. Char ) )
96 ············{
97 ················char para = Convert.ToChar( bytes[pos+1] * 256 + bytes[pos] );
98 ················pos += 2;
99 ················return para;
100 ············}
101 else if ( type == typeof( System. Int16 ) )
102 ············{
103 ················short para = Convert.ToInt16( bytes[pos+1] * 256 + bytes[pos] );
104 ················pos += 2;
105 ················return para;
106 ············}
107 else if ( type == typeof( System. Int32 ) )
108 ············{
109 ················int para = ((bytes[pos+3] * 256 + bytes[pos+2]) * 256 + bytes[pos+1]) * 256 + bytes[pos];
110 ················pos += 4;
111 ················return para;
112 ············}
113 else if ( type. FullName == "NDO. RelationInfo")
114 ············{
115 ················short para = Convert.ToInt16( bytes[pos+1] * 256 + bytes[pos] );
116 ················pos += 2;
117 ················return (NDO.RelationInfo) para;
118 ············}
119 ············else if (typeof(System.Enum).IsAssignableFrom( type ) )
120 ············{
121 ················int para = ((bytes[pos+3] * 256 + bytes[pos+2]) * 256 + bytes[pos+1]) * 256 + bytes[pos];
122 ················pos += 4;
123 ················return Enum.ToObject( type, para );
124 ············}
125
126 ············MessageAdapter ma = new MessageAdapter();
127 ············ma.ShowError( $"Relation Attribute: Unknown type in attribute parameter list: {type.FullName}, owner type: {( this.Owner as ILClassElement )?.Name ?? "-"}" );
128
129 ············return null;
130 ········}
131
132
133 ········internal class AttributeInfo
134 ········{
135 public string TypeName;
136 ············public string AssemblyName;
137 ············public string[] ParamTypeNames = new string[]{};
138 ············public object[] ParamValues = new object[]{};
139 ········}
140
141
142 ········public AttributeInfo
143 GetAttributeInfo( )
144 ········{
145 ············string text = "";
146
147 for ( int i = 0; i < LineCount; i++)
148 ············{
149 string line = GetLine( i ) ;
150
151 ················int cmt = line.IndexOf( "//" );
152 if ( -1 < cmt)
153 ····················line = line.Substring( 0, cmt ).Trim();
154
155 ················text += " " + line;
156 ············}
157
158 ············int start, end;
159
160 ············// assembly name
161
162 ············start = text.IndexOf( "[" ) + 1;
163 end = text. IndexOf( "]", start ) ;
164 string assName = StripComment( text. Substring( start, end - start ) ) ;
165
166 ············// type name
167
168 ············start = text.IndexOf( "]" ) + 1;
169 end = text. IndexOf( "::", start ) ;
170 string typeName = StripComment( text. Substring( start, end - start ) ) ;
171
172 ············// constructor signature
173
174 ············start = text.IndexOf( "(" ) + 1;
175 end = text. IndexOf( ") ", start ) ;
176 string signature = StripComment( text. Substring( start, end - start ) ) ;
177
178 ············// parameter bytes
179
180 ············start = text.IndexOf( "= (" ) + 3;
181 end = text. IndexOf( ") ", start ) ;
182 string byteText = text. Substring( start, end - start ) . Trim( ) ;
183
184 char[] spc = { ' ' } ;
185 ············string[] byteStrings = byteText.Split( spc );
186 byte[] bytes = new byte[byteStrings. Length];
187 ············//············char[]···· chars········ = new char[byteStrings.Length];
188
189 for ( int i = 0; i < byteStrings. Length; i++)
190 ············{
191 ················bytes[i] = Byte.Parse( byteStrings[i], NumberStyles.HexNumber );
192 ················//················chars[i] = Convert.ToChar( bytes[i] );
193 ············}
194
195 ············//············char[] chars = new System.Text.UTF8Encoding().GetChars(bytes);
196
197 ············//············Type attributeType = Type.GetType( typeName + ", " + assName );
198 ············//············if ( null == attributeType )
199 ············//················return null;
200
201 ············char·· comma =··',';
202 ············string[] paramTypeNames = new string[]{};
203 ············object[] paramValues = new object[]{};
204 ············Type[] paramTypes = new Type[]{};
205 ············//CustomAttrib starts with a Prolog – an unsigned int16, with value 0x0001
206 ············int pos = 2;
207 ············if (signature != "")
208 ············{
209 ················paramTypeNames = signature.Split( comma );
210 paramTypes = new Type[paramTypeNames. Length];
211 paramValues = new Object[paramTypeNames. Length];
212
213 for ( int i = 0; i < paramTypeNames. Length; i++)
214 ················{
215 ····················string paramTypeName = paramTypeNames[i].Trim();
216 if ( paramTypeName == "string" || paramTypeName. IndexOf( "System. String" ) > -1)
217 ····················{
218 ························paramTypeNames[i] = "System.String";
219 paramTypes[i] = typeof( string ) ;
220 ····················}
221 else if ( paramTypeName == "bool")
222 ····················{
223 paramTypes[i] = typeof( bool ) ;
224 ························paramTypeNames[i] = "System.Boolean";
225 ····················}
226 else if ( paramTypeName == "char")
227 ····················{
228 paramTypes[i] = typeof( char ) ;
229 ························paramTypeNames[i] = "System.Char";
230 ····················}
231 else if ( paramTypeName == "short" || paramTypeName == "int16")
232 ····················{
233 ························paramTypeNames[i] = "System.Int16";
234 paramTypes[i] = typeof( System. Int16 ) ;
235 ····················}
236 else if ( paramTypeName == "int" || paramTypeName == "int32")
237 ····················{
238 ························paramTypeNames[i] = "System.Int32";
239 paramTypes[i] = typeof( System. Int32 ) ;
240 ····················}
241 ····················// Achtung: System.Type wird als string abgespeichert!!!
242 else if ( paramTypeName. IndexOf( "[mscorlib" ) > -1 && paramTypeName. IndexOf( "System. Type" ) > -1)
243 ····················{
244 paramTypes[i] = typeof( System. String ) ;
245 ························paramTypeNames[i] = "System.Type";
246 ····················}
247 else if ( paramTypeName == "valuetype [NDO]NDO. RelationInfo")
248 ····················{
249 paramTypes[i] = typeof( NDO. RelationInfo ) ;
250 ························paramTypeNames[i] = "NDO.RelationInfo, NDO";
251 ····················}
252 ····················else
253 ····················{
254 ························var paramTypeString = paramTypeName.Substring(paramTypeName.IndexOf(']') + 1);
255 ························var t = Type.GetType( paramTypeString );
256 ························if (t != null)
257 ························{
258 ····························paramTypes[i] = t;
259 ····························paramTypeNames[i] = "paramTypeString";
260 ························}
261 ························else
262 ····························throw new Exception( $"Relation Attribute: Unknown type in attribute parameter list: {paramTypeName}, type: {( this.Owner as ILClassElement )?.Name ?? ""}" );
263 ····················}
264
265 ····················//paramTypes[i]··= Type.GetType( paramTypeNames[i] );
266 paramValues[i] = ReadParam( bytes, paramTypes[i], ref pos ) ;
267 ················}
268 ············}
269 ············//············ConstructorInfo ci···· = attributeType.GetConstructor( paramTypes );
270 AttributeInfo attr = new AttributeInfo( ) ;
271 attr. TypeName = typeName;
272 ············attr.AssemblyName = assName;
273 ············attr.ParamTypeNames = paramTypeNames;
274 ············attr.ParamValues = paramValues;
275
276 //TODO: Should we ever need to analyze named parameters
277 // we'll have to add lots of code here.
278 ············// We'd be better off, if we analyzed the IL code using the ECMA spec.
279
280 ············//············short count = (short) readParam( bytes, chars, Type.GetType( "System.Int16" ), ref pos );
281 ············//
282 ············//············for ( short i=0; i<count; i++ )
283 ············//············{
284 ············//················pos += 2;
285 ············//
286 ············//················string propName = readParam( bytes, chars, Type.GetType( "System.String" ), ref pos ) as string;
287 ············//
288 ············//················PropertyInfo pi = attributeType.GetProperty( propName );
289 ············//
290 ············//················object propVal = readParam( bytes, chars, pi.PropertyType, ref pos );
291 ············//
292 ············//················pi.SetValue( attr, propVal, null );
293 ············//············}
294
295 ············this.attributeInfo = attr;
296 ············return attr;
297 ········}
298
299 ········public void
300 ············replaceLines( string firstLine )
301 ········{
302 ClearLines( ) ;
303
304 AddLine( firstLine ) ;
305 ········}
306
307
308 ····}
309 }
310
New 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