class AnsiConverter
{
	FileInfo Source;
	string Destination;

	public AnsiConverter(FileInfo source, string destination)
	{
		this.Source = source;
		this.Destination = destination;
	}
	public void Convert()
	{
		//Creating the New File
		StreamWriter SW = new StreamWriter(Destination, false, Encoding.GetEncoding(1250));
		//open to read the existing one
		StreamReader SR = new StreamReader(Source.OpenRead());
		try
		{
			//run to the end
			while (!SR.EndOfStream)
			{
				string LineToDecode = SR.ReadLine();
				SW.WriteLine(LineToDecode);
			}
		}
		catch (Exception E)
		{
			Console.WriteLine(E.Message);
		}
		finally
		{
			SR.Close();
			SW.Close();
		}
	}
}

Last edited Apr 11, 2011 at 8:38 AM by jerems6, version 8

Comments

No comments yet.