private void Form1_DragDrop(object sender, DragEventArgs e) { inPath = null; string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); for (int i = 0; i < s.Length; i++) { if (s[i].Trim() != "") { byte[] bytes = File.ReadAllBytes(s[i]); isYaz0 = Yaz0.IsYaz0(bytes); if (isYaz0) { m_PrOD = new PrOD(Yaz0.decode(bytes)); } else { m_PrOD = new PrOD(bytes); } ShowPrOD(); this.Text = "PrODEditor" + "(" + s[i] + ")"; this.inPath = s[i]; break; } } }
private void SaveClick(object sender, EventArgs e) { PrOD prOD = treeViewToPrOD(); byte[] bytes = prOD.getBytes(); if (inPath != null) { if (isYaz0) { File.WriteAllBytes(inPath, Yaz0.encode(bytes)); } else { File.WriteAllBytes(inPath, bytes); } } MessageBox.Show("Save finished"); }
public PrOD(string filePath) { m_bytes = Yaz0.decode(File.ReadAllBytes(filePath)); Init(); }