Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int[,] GetIntArray(string file)
- {
- uint heigth = 2048;
- uint width = 2048;
- var result = new int[heigth, width];
- using (BinaryReader reader = new BinaryReader(File.Open(file, FileMode.Open)))
- {
- for (int i = 0; i < heigth; i++)
- {
- for (int j = 0; j < width; j++)
- {
- result[j, i] = reader.ReadUInt16();
- }
- }
- }
- return result;
- }
- public int[,] GetIntArray2(string file)
- {
- uint heigth = 2048;
- uint width = 2048;
- var result = new int[heigth, width];
- using (BinaryReader reader = new BinaryReader(File.Open(file, FileMode.Open)))
- {
- for (int i = 0; i < heigth; i++)
- {
- for (int j = -1; j < width-1;)
- {
- UInt64 r = reader.ReadUInt64();
- result[++j, i] = (UInt16)(r >> 48);
- result[++j, i] = (UInt16)(r >> 32);
- result[++j, i] = (UInt16)(r >> 16);
- result[++j, i] = (UInt16)(r);
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement