private void LoadData(string FileName) { FileStream fs = File.OpenRead(FileName); byte[] bajt = new byte[6]; fs.Read(bajt, 0, 6); z.PrjGhostSize = new System.Drawing.Size((int)bajt[3], (int)bajt[4]); z.KolorTla = bajt[5]; fs.Read(z.Duch0, 0, Convert.ToInt32(z.Duch0.Length)); fs.Read(z.Duch1, 0, Convert.ToInt32(z.Duch1.Length)); fs.Read(z.Duch2, 0, Convert.ToInt32(z.Duch2.Length)); fs.Read(z.Duch3, 0, Convert.ToInt32(z.Duch3.Length)); fs.Read(z.Duch0Color, 0, Convert.ToInt32(z.Duch0Color.Length)); fs.Read(z.Duch1Color, 0, Convert.ToInt32(z.Duch1Color.Length)); fs.Read(z.Duch2Color, 0, Convert.ToInt32(z.Duch2Color.Length)); fs.Read(z.Duch3Color, 0, Convert.ToInt32(z.Duch3Color.Length)); z.Frames.Clear(); byte[] IleFrames = new byte[1]; fs.Read(IleFrames, 0, 1); for (int i = 0; i < IleFrames[0]; i++) { z.Frame f = new z.Frame(); fs.Read(f.Duch0, 0, Convert.ToInt32(f.Duch0.Length)); fs.Read(f.Duch1, 0, Convert.ToInt32(f.Duch1.Length)); fs.Read(f.Duch2, 0, Convert.ToInt32(f.Duch2.Length)); fs.Read(f.Duch3, 0, Convert.ToInt32(f.Duch3.Length)); fs.Read(f.Duch0Color, 0, Convert.ToInt32(f.Duch0Color.Length)); fs.Read(f.Duch1Color, 0, Convert.ToInt32(f.Duch1Color.Length)); fs.Read(f.Duch2Color, 0, Convert.ToInt32(f.Duch2Color.Length)); fs.Read(f.Duch3Color, 0, Convert.ToInt32(f.Duch3Color.Length)); z.Frames.Add(f); } fs.Close(); // spr czy wszystko zaladowal if (z.Frames.Count == 0) { z.PrjGhostSize = new System.Drawing.Size(8, 18); button_AddFrame_Click(null, null); } SetHeight(); FramesPrzeliczScroll(); SprMoveButtonOnOff(); }
private byte[] ExportGhostData(int AtFrame, int GhostIndeks) { byte[] bity = new byte[z.PrjGhostSize.Height]; int bit = 0; for (int i = 0; i < z.PrjGhostSize.Height; i++) { bit = 0; for (int ix = 0; ix < 8; ix++) { bit = bit << 1; z.Frame f = new z.Frame(); f = z.Frames[AtFrame]; if (GhostIndeks == 0) bit += f.Duch0[i * 8 + ix]; if (GhostIndeks == 1) bit += f.Duch1[i * 8 + ix]; if (GhostIndeks == 2) bit += f.Duch2[i * 8 + ix]; if (GhostIndeks == 3) bit += f.Duch3[i * 8 + ix]; } bity[i] = (byte)bit; } return bity; }
private byte[] ExportGhostDataColor(int atFrame, int GhostIndeks, bool OnlyFirsLine) { int dlugosc = OnlyFirsLine ? 1 : z.PrjGhostSize.Height; byte[] bity = new byte[dlugosc]; for (int i = 0; i < dlugosc; i++) { z.Frame f = new z.Frame(); f = z.Frames[atFrame]; if (GhostIndeks == 0) bity[i] = f.Duch0Color[i]; if (GhostIndeks == 1) bity[i] = f.Duch1Color[i]; if (GhostIndeks == 2) bity[i] = f.Duch2Color[i]; if (GhostIndeks == 3) bity[i] = f.Duch3Color[i]; } return bity; }
private void button_AddFrame_Click(object sender, EventArgs e) { if (z.Frames.Count < 255) { z.Frame f = new z.Frame(); z.Duch0.CopyTo(f.Duch0, 0); z.Duch1.CopyTo(f.Duch1, 0); z.Duch2.CopyTo(f.Duch2, 0); z.Duch3.CopyTo(f.Duch3, 0); z.Duch0Color.CopyTo(f.Duch0Color, 0); z.Duch1Color.CopyTo(f.Duch1Color, 0); z.Duch2Color.CopyTo(f.Duch2Color, 0); z.Duch3Color.CopyTo(f.Duch3Color, 0); //z.Frames.Add(f); z.Frames.Insert(z.WybranaFrame+z.ZaczynajOdFrame, f); z.WybranaFrame++; if(z.WybranaFrame>5) { z.WybranaFrame = 5; z.ZaczynajOdFrame++; } ShowFrames(); } FramesPrzeliczScroll(); SprMoveButtonOnOff(); }