private void changeLowerLeftConer(string filePath, string newX, string newY) { FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite); int bsCount = 0; for (int i = 0; i < stream.Length; i++) { if (stream.ReadByte() == 13 && stream.ReadByte() == 10) { bsCount++; if (bsCount == 2 || bsCount == 3) { Byte[] bytes; if (bsCount == 2) { bytes = System.Text.Encoding.Default.GetBytes("xllcorner "+newX); } else { bytes = System.Text.Encoding.Default.GetBytes("yllcorner "+newY); } stream.Write(bytes, 0, bytes.Length); for (int n = 0; n < stream.Length - stream.Position; n++) { int a = stream.ReadByte(); if (a != 13 && a != 32) { stream.Seek(-1, SeekOrigin.Current); stream.Write(new byte[] { 32 }, 0, 1); } else { stream.Seek(-1, SeekOrigin.Current); break; } } if (bsCount == 3) { break; } } } } stream.Close(); }