public static void ExportFrames(GSPat.Animation toList, Pat.AnimationSegment fromList,
                                        ImageListExporter images)
        {
            toList.Frames = new List <GSPat.Frame>();
            var attackType  = fromList.Damage == null ? Pat.AttackType.None : fromList.Damage.AttackType;
            var damage      = fromList.Damage == null ? 0 : fromList.Damage.BaseDamage;
            var hitG        = fromList.Damage == null ? 0 : fromList.Damage.Knockback.Gravity;
            var se          = fromList.Damage == null ? 0 : fromList.Damage.SoundEffect;
            var hso         = fromList.Damage == null ? 0 : fromList.Damage.HitStop.Opponent;
            var hss         = fromList.Damage == null ? 0 : fromList.Damage.HitStop.Self;
            var hitX        = fromList.Damage == null ? 0 : fromList.Damage.Knockback.SpeedX;
            var hitY        = fromList.Damage == null ? 0 : fromList.Damage.Knockback.SpeedY;
            var cancelJump  = fromList.JumpCancellable == null ? Int32.MaxValue : fromList.JumpCancellable.StartFrom;
            var cancelSkill = fromList.SkillCancellable == null ? Int32.MaxValue : fromList.SkillCancellable.StartFrom;

            var frameTime = 0;

            foreach (var frame in fromList.Frames)
            {
                var img = images.GetImage(frame.ImageID);

                var eFrame = new GSPat.Frame()
                {
                    AttackBoxes     = ExportBoxs(frame.AttackBoxes),
                    AttackFlag      = 0,
                    AttackType      = (short)attackType,
                    Bind            = 0,
                    Damage          = (short)damage,
                    DisplayTime     = (short)frame.Duration,
                    HitBoxes        = ExportBoxs(frame.HitBoxes),
                    HitG            = (short)hitG,
                    HitSoundEffect  = (short)se,
                    HitstopOpponent = (short)hso,
                    HitstopSelf     = (short)hss,
                    HitVX           = (short)hitX,
                    HitVY           = (short)hitY,

                    //TODO
                    ImageManipulation = ExportIM(frame, img),

                    OriginX     = (short)frame.OriginX,
                    OriginY     = (short)frame.OriginY,
                    PhysicsBox  = ExportPhysical(frame.PhysicalBox),
                    Point0      = ExportPoint(frame.Points, 0),
                    Point1      = ExportPoint(frame.Points, 1),
                    Point2      = ExportPoint(frame.Points, 2),
                    SpriteID    = images.GetImageIntID(frame.ImageID),
                    StateFlag   = (frameTime >= cancelSkill ? 0x20 : 0) + (frameTime >= cancelJump ? 0x200000 : 0),
                    ViewHeight  = (short)img.H,
                    ViewOffsetX = (short)img.X,
                    ViewOffsetY = (short)img.Y,
                    ViewWidth   = (short)img.W,
                };
                toList.Frames.Add(eFrame);

                frameTime += frame.Duration;
            }
        }
        //TODO implement this in ImageList
        private Pat.FrameImage MakeNewImageFromFile(string str)
        {
            if (str == null || str.Length == 0 || !File.Exists(str))
            {
                return(null);
            }

            var filenameWithoutPath = Path.GetFileName(str);

            Images.AbstractImage img;
            if (Path.GetExtension(str) == ".cv2")
            {
                img = new Images.CV2Image(str);
            }
            else if (Path.GetExtension(str) == ".dds")
            {
                img = new Images.DDSImage(str);
            }
            else
            {
                //error
                return(null);
            }

            if (img == null)
            {
                return(null);
            }

            var frame = new GSPat.Frame()
            {
                ViewOffsetX = 0,
                ViewOffsetY = 0,
                ViewWidth   = (short)img.Width,
                ViewHeight  = (short)img.Height,
            };

            img.Dispose();
            var image = ProjectGenerater.AddImageToProject(_Project, filenameWithoutPath, frame);

            if (!_IsBatch)
            {
                var item = CreateItem(image);
                listView1.Items.Add(item);
                listView1.SelectedItems.Clear();
                item.Selected = true;
                item.EnsureVisible();
            }
            return(image);
        }