private void LoadDirectory() { if (_currentPath != "") { Application.UseWaitCursor = true; toolStripStatusLabel1.Text = "Loading"; _characters.Clear(); try { Bitmap tmpBitmap; DirectoryInfo dir = new DirectoryInfo(_currentPath); foreach (FileInfo file in dir.GetFiles("*.png")) { string[] filenameparts = file.Name.Split(new char[] { '.' }); string[] elements = filenameparts[0].Split(new char[] { '_' }); if (elements.Length == 4) { Character character = _characters.FindByName(elements[0]); if (character == null) { character = new Character(elements[0]); _characters.Add(character); } Group group = character.Groups.FindByName(elements[1]); if (group == null) { group = new Group(elements[1]); character.Groups.Add(group); } Animation animation = group.Animations.FindByID(elements[2]); if (animation == null) { animation = new Animation(elements[2]); group.Animations.Add(animation); group.Animations.Sort(); } Frame frame = animation.Frames.FindByID(int.Parse(elements[3])); if (frame == null) { frame = new Frame(UInt16.Parse(elements[3])); frame.Path = file.FullName; animation.Frames.Add(frame); animation.Frames.Sort(); tmpBitmap = new Bitmap(_currentPath + "\\" + file.Name); frame.Width = (ushort)tmpBitmap.Width; frame.Height = (ushort)tmpBitmap.Height; } } else { // MessageBox.Show("Invalid Filename: " + file.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } LoadData(); Display(); SaveConfig(); } catch { MessageBox.Show("Error loading directory " + _currentPath, "Flipbook", MessageBoxButtons.OK, MessageBoxIcon.Error); } //finally //{ // //} Application.UseWaitCursor = false; toolStripStatusLabel1.Text = "Ready"; } }
public int IndexOf(Group value) { return (base.IndexOf(value)); }
private void DisplayGroup(Group grp) { ddbGroup.Text = grp.Name; ddbID.DropDownItems.Clear(); ddbID.Text = ""; foreach (Animation ani in grp.Animations) { ToolStripMenuItem itm = new ToolStripMenuItem(); itm.DisplayStyle = ToolStripItemDisplayStyle.Text; itm.Text = ani.ID.ToString(); itm.Tag = ani; ddbID.DropDownItems.Add(itm); } if (grp.Animations.Count > 0) DisplayAnimation(grp.Animations[0]); else { _currentAnimation = null; ddbID.Text = "(none)"; } _currentGroup = grp; }
public int Add(Group objItemToAdd) { return (base.Add(objItemToAdd)); }