увеличиваю каждое второе челое число.
//#define TEST
using System;
using System.Data;
using System.Drawing;
//using System.Windows.Forms;
using System.IO;
using System.Collections.Specialized;
using System.Threading;
using System.Globalization;
using System.Runtime.InteropServices;
[spoiler] class application
{
[STAThread]
static void Main(string[] args)
{
byte[] buf4c = new byte[4];
byte[] buf4n = new byte[4];
int red = 0;
int redn = 0;
long pos = 0;
int coin = 0;
int number = 0;
string me_ = "Main";
using (FileStream rws = new FileStream
("data.bin", FileMode.Open))
{ while ( ((red = rws.Read(buf4c, 0, 4)) ==4 ) && ((redn = rws.Read(buf4n, 0, 4)) ==4 )) {
// if (BitConverter.IsLittleEndian) {Array.Reverse(buf4c); Array.Reverse(buf4n); }
coin = BitConverter.ToInt32(buf4c, 0);
number = BitConverter.ToInt32(buf4n, 0);
pos = rws.Position;
Console.Error.WriteLine("next pair {0}:{1}/ {2}", coin, number, pos);
rws.Seek (-4, SeekOrigin.Current);
buf4n =BitConverter.GetBytes(++number);
rws.Write(buf4n, 0, 4);
}
if (red !=0 || redn !=0){
Console.Error.WriteLine("wrong length of file: {0}/{1}", red, redn);
}
}
}
}
// gVars.log.wrLn("{0} is finished. rc: {1}; sid: {2}; newV/oldV/diff: {3}/{4}/{5} \n",
// me_, rc, gVars.sid, newV, oldV, val);
[/spoiler]