private void openFileDialog_FileOk(object sender, CancelEventArgs e) { byte[] fileBytes = File.ReadAllBytes(openFileDialog.FileName); AnimationList.Clear(); int count = (fileBytes.Length / LED_CUBE_Effect.Size()); if (count > 0) { for (int i = 0; i < count; i++) { byte[] bytes = new byte[31]; Array.Copy(fileBytes, (LED_CUBE_Effect.Size() * i), bytes, 0, LED_CUBE_Effect.Size()); LED_CUBE_Effect effect = new LED_CUBE_Effect(bytes); AnimationList.Add(effect); } textBoxNewAnimationName.Text = Path.GetFileName(openFileDialog.FileName.ToString().Replace(animationFileExtension, "")); } else { MessageBox.Show("Animation is empty", "Error"); } }
public LED_CUBE_Effect Clone() { LED_CUBE_Effect obj = new LED_CUBE_Effect(); obj.columns = this.columns; obj.rows = this.rows; obj.delay = this.delay; obj.name = this.name; return obj; }
private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { byte[] fileBytes = File.ReadAllBytes(openFileDialog1.FileName); int count = (fileBytes.Length / LED_CUBE_Effect.Size()); if (count > 0) { for (int i = 0; i < count; i++) { byte[] bytes = new byte[31]; Array.Copy(fileBytes, (LED_CUBE_Effect.Size() * i), bytes, 0, LED_CUBE_Effect.Size()); LED_CUBE_Effect effect = new LED_CUBE_Effect(bytes); AnimationList.Add(effect); } } else { MessageBox.Show("Animation is empty", "Error"); } }