Rev 1454 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using EndianHandling;
namespace BauzoidNET
.file
{
public class FileUtil
{
public FileUtil
()
{
}
public static string readToString
(string filename
)
{
StreamReader streamReader
= new StreamReader
(filename
);
string text
= streamReader
.ReadToEnd();
streamReader
.Close();
return text
;
}
public static string readString
(BinaryReader b
)
{
int length
= b
.ReadInt32();
byte[] strBytes
= b
.ReadBytes(length
);
return System.Text.Encoding.Default.GetString(strBytes
);
}
public static string readString
(EndianBinaryReader b
)
{
//int length = b.ReadInt32();
int length
= 0;
b
.ReadInt32(out length
);
byte[] strBytes
= new byte[length
];
b
.ReadBytes(length,
out strBytes
);
return System.Text.Encoding.Default.GetString(strBytes
);
}
}
}