public void Thread_getLMS(object obj) { Abort = false; sw.Reset(); sw.Start(); string FileName = obj as string; FileStream FS_getLMS = new FileStream(FileName, FileMode.Open, FileAccess.Read); byte[] buffer = new byte[] { 0x4D, 0x53, 0x47, 0x31, 0x00, 0x00, 0x00, 0x00 }; FS_getLMS_length = FS_getLMS.Length; while (FS_getLMS.Position != FS_getLMS.Length) { if (Abort) { sw.Stop(); FS_getLMS.Close(); progressbar = 1001; return; } FS_getLMS_pos = FS_getLMS.Position; if (FS_getLMS.CheckEntrance(buffer)) { MSG1Position.Add(FS_getLMS.Position - 16); } } sw.Stop(); FS_getLMS.Close(); FS_getLMS_length = 0; progressbar = 1001; progressbar_text = ""; }