public void InsertTape(string filename) { ejectButton_Click(this, null); ziggyWin.zx.tapeIsPlaying = false; PZXFile.LoadPZX(filename); ReadTape(filename); tapeIsInserted = true; ziggyWin.zx.tape_readToPlay = true; ziggyWin.zx.tapeFilename = filename; ziggyWin.zx.blockCounter = 0; }
private void ReadTape(String filename) { PZXFile.ReadTapeInfo(filename); dataGridView1.DataSource = PZXFile.tapeBlockInfo; dataGridView1.AutoGenerateColumns = true; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.Columns[0].FillWeight = 0.25f; dataGridView1.Columns[1].FillWeight = 0.75f; statusStrip1.Items[0].Text = "Ready to play"; for (int i = 0; i < PZXFile.blocks.Count; i++) { if (PZXFile.blocks[i] is PZXFile.PZXT_Header) { PZXFile.PZXT_Header info = (PZXFile.PZXT_Header)PZXFile.blocks[i]; string tapeText = String.Format("Publisher\t: {0}\r\nAuthor(s)\t: ", info.Publisher); if (info.Title != null) { this.Text = info.Title; } else { //Extract the filename from the path to display as tape name string[] filePath = filename.Split('\\'); this.Text = filePath[filePath.Length - 1]; this.Text = this.Text.Substring(0, this.Text.Length - 4); //drop extension } for (int f = 0; f < info.Authors.Count; f++) { tapeText += String.Format("{0}, ", info.Authors[f]); } tapeText += String.Format("\r\nYear\t: {0}\r\nLanguage: {1}\r\nType\t: {2}\r\nPrice\t: {3}\r\nProtection: {4}\r\nOrigin\t: {5}\r\nComments: ", info.YearOfPublication, info.Language, info.Type, info.Price, info.ProtectionScheme, info.Origin); for (int f = 0; f < info.Comments.Count; f++) { tapeText += String.Format("{0}\r\n\t", info.Comments[f]); } tapeInfo.SetText(tapeText); //tapeInfo.Invalidate(); } } }