using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;namespace _oneline
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = @"D:\\MS_HD_08_H576i25_to_H264_960x1080p25_4.sh";            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
            StreamReader sr = new StreamReader(fs);
            StreamWriter sr_ = new StreamWriter(fs);
 //           using (StreamReader sr = new StreamReader("D:\\MS_HD_08_H576i25_to_H264_960x1080p25_4.sh"))
            {
                String line;
                string wh1 = "";
                string ht1 = "";
                string instance = "";
                List<string> hts = new List<string>();
                List<string> whs = new List<string>();
                List<int> inst = new List<int>();                int z = 0;                
                // Read and display lines from the file until the end of 
                // the file is reached.
                while((line = sr.ReadLine()) != null)
                {                    if (line.Contains(@"./xcode.configVpp.pl"))
                    {
                        string str = line;
                        string[] ss = str.Split(' ');
                        for (int i = 0; i < ss.Length; i++)
                        {
                            if (ss[i] == "-height")
                            {
                                ht1 = ss[i + 1];
                                hts.Add(ht1);                            }
                        }
                        for (int j = ss.Length - 1; j >= 0; j--)
                        {
                            if (ss[j] == "-width")
                            {
                                wh1 = ss[j + 1];
                                whs.Add(wh1);                            }
                        }
                        for (int t = 0; t < ss.Length - 1; t++)
                        {
                            if (ss[t] == "-instance")
                            {
                                instance = ss[t + 1];
                                inst.Add(int.Parse(instance));                            }
                        }                    }
                }                for (z = 0; z < inst.Count; z++)
                {
                    if ((inst[z] == 0)||(inst[z] == 4||inst[z] == 8||inst[z] == 12))
                    {
                          if ((int.Parse(hts[z]) < 192 )||( int.Parse(hts[z]) > 576))
                          {                              hts[z] = hts[z].Replace(hts[z],"576");                              
                          }
                          sr_.Write(hts[z]);
   
                          Console.WriteLine(hts[z]);
                          if ((int.Parse(whs[z]) < 352) ||( int.Parse(whs[z]) > 1024))
                          {
                              
                              
                              whs[z] = whs[z].Replace(whs[z],"1024");                              
                          }
                          sr_.Write(whs[z]);                          Console.WriteLine(whs[z]);                                              }                }
                Console.ReadLine();
            } 
        }
    }
}C#