|
//===============================================================================
// XGenPlus Tool
// ==============================================================================
// Please visit http://www.codeplex.com/xgenplus for latest updates.
//
// This source is subject to the GNU General Public License v2.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Reflection;
namespace XGenPlus.SerializerLib
{
class Util
{
public byte[] GetAssemblyAsBytes(String path)
{
if (!File.Exists(path))
{
return null;
}
try
{
FileInfo file = new FileInfo(path);
byte[] bytes = new byte[file.Length];
FileStream stream = new FileStream(path, FileMode.Open);
stream.Read(bytes, 0, bytes.Length);
stream.Close();
return bytes;
}
catch (Exception ex)
{
return null;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.