//http://tinyerp.codeplex.com/
//GNU Library General Public License (LGPL)
//-----------------------------------------------------------------------
//
// Copyright (c) Pyramid Consulting. All rights reserved.
//
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace Bamboo.Core.Common
{
public class SysUtil
{
///
/// read all the content from a file as string in default encoding
///
/// source file path
/// dest string in default encoding
public static String ReadFile(String strFilePath)
{
System.Text.Encoding encDefault = System.Text.Encoding.GetEncoding(0);
System.IO.FileStream fs = new System.IO.FileStream(strFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
String strResult = null;
try
{
byte[] bData = new byte[fs.Length];
br.Read(bData, 0, bData.Length);
strResult = encDefault.GetString(bData);
}
finally
{
br.Close();
fs.Close();
}
return strResult;
}
}
}