private void AppendIndex(long offset, long size) { IndexRec item = new IndexRec { Offset = offset, Size = size }; this.IndexList.Add(item); StreamWriter writer = new StreamWriter(this.mIndexFile, true); string str = string.Format("{0},{1}", offset, size); writer.WriteLine(str); writer.Close(); }
private void CreateIndexList() { this.IndexList = new List<IndexRec>(); if (File.Exists(this.mIndexFile)) { string str; StreamReader reader = new StreamReader(this.mIndexFile); while ((str = reader.ReadLine()) != null) { string[] strArray = str.Split(new char[] { ',' }); if (strArray.Length > 1) { try { IndexRec item = new IndexRec { Offset = long.Parse(strArray[0].Trim()), Size = long.Parse(strArray[1].Trim()) }; this.IndexList.Add(item); continue; } catch { continue; } } } reader.Close(); } }