internal static EquipFrame Parse(WZProperty frame)
        {
            EquipFrame item = new EquipFrame();

            item.Effects = frame.Children.Where(c => c.Type == PropertyType.Canvas || c.Type == PropertyType.UOL)
                           .ToDictionary(c => c.NameWithoutExtension, c => Frame.Parse(c));

            return(item);
        }
Exemple #2
0
        public static EquipFrameBook Parse(WZProperty container)
        {
            EquipFrameBook effect = new EquipFrameBook();

            // If we are a UOL, resolve, otherwise it'll return itself
            container = container.Resolve();

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

            bool isSingle = container.Children.Any(c => c.Type == PropertyType.Canvas);

            if (!isSingle)
            {
                effect.frames = container.Children
                                .Where(c =>
                {
                    int frameNumber = -1;
                    return(int.TryParse(c.NameWithoutExtension, out frameNumber));
                })
                                .OrderBy(c =>
                {
                    int frameNumber = -1;
                    if (int.TryParse(c.NameWithoutExtension, out frameNumber))
                    {
                        return(frameNumber);
                    }
                    return(1);
                })
                                .Select(frame =>
                {
                    try {
                        return(EquipFrame.Parse(frame));
                    } catch (Exception ex) {
                        ErrorCallback($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
                        return(null);
                    }
                });
            }
            else
            {
                effect.frames = new EquipFrame[] { EquipFrame.Parse(container) };
            }

            return(effect);
        }