public MeasuringSimpleTask(string path) { Path = (string)path.Clone(); path += "method"; FileStream fs = DataBase.OpenFile(ref path, FileMode.Open, FileAccess.Read); try { BinaryReader br = new BinaryReader(fs); string type = br.ReadString(); if (type.Equals("mt1") == false) { throw new Exception("Wrong file type"); } int ver = br.ReadInt32(); if (ver != 1 && ver != 2) { throw new Exception("Unsupported version of file"); } Data = new MethodSimple(br); Data.SetupPath(path); if (ver > 1) { SrcMethodPath = br.ReadString(); } else { SrcMethodPath = ""; } ver = br.ReadInt32(); if (ver != 234324) { throw new Exception("Wrong end of file."); } } finally { fs.Close(); } }