0:   // ReflectionUtility.cs
1:   // Copyright (C) 2001 Mike Krueger
2:   // Copyright (C) 2001 Andrea Paatz
3:   //
4:   // This program is free software; you can redistribute it and/or modify
5:   // it under the terms of the GNU General Public License as published by
6:   // the Free Software Foundation; either version 2 of the License, or
7:   // (at your option) any later version.
8:   //
9:   // This program is distributed in the hope that it will be useful,
10:   // but WITHOUT ANY WARRANTY; without even the implied warranty of
11:   // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12:   // GNU General Public License for more details.
13:   //
14:   // You should have received a copy of the GNU General Public License
15:   // along with this program; if not, write to the Free Software
16:   // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17:  
18:   using System;
19:   using System.IO;
20:   using System.Runtime.InteropServices;
21:   using System.Collections;
22:   using System.Drawing;
23:   using System.Reflection;
24:   using System.Resources;
25:   using System.Diagnostics;
26:   using System.Windows.Forms;
27:  
28:   using SharpDevelop.Internal.Modules;
29:   using SharpDevelop.Tool.Data;
30:  
31:   namespace SharpDevelop.Tool.Function {
32:       
33:       public class ReflectionUtility
34:       {
35:           /// <summary>
36:           /// This method does load an assembly into memory. If you
37:           /// use Assembly.Load or Assembly.LoadFrom the assembly file
38:           /// locks. This method doesn't lock the assembly file.
39:           /// </summary>
40:           public static Assembly LoadAssembly(string filename)
41:           {
42:               if (!File.Exists(filename))
43:                   throw new ApplicationException("can't find assembly " filename);
44:               
45:               FileStream fs File.Open(filenameFileMode.Open);
46:               byte[] buffer new byte[fs.Length];
47:               fs.Read(buffer0, (int)fs.Length);
48:               fs.Close();
49:               
50:               return Assembly.Load(buffer);
51:           }
52:       }
53:   }

This page was automatically generated by SharpDevelop.