Example #1
0
        public static Bitmap ExtractPng2(this Wz_Node Node)
        {
            if (Node.HasNode("_outlink"))
            {
                var      LinkData = Node.GetNode("_outlink").Value.ToString();
                string[] Split    = LinkData.Split('/');
                string   DestPath = "";
                switch (Split[0])
                {
                case "Mob":
                    DestPath = Regex.Replace(LinkData, "Mob/", "");
                    if (Arc.MobWz != null && Arc.MobWz.HasNode(Split[1]))
                    {
                        return((Arc.MobWz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else if (Arc.Mob001Wz != null && Arc.Mob001Wz.HasNode(Split[1]))
                    {
                        return((Arc.Mob001Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else
                    {
                        return((Arc.Mob2Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    break;

                case "Map":
                    if (Split[1] == "Map")
                    {
                        DestPath = LinkData.Remove(0, 4);
                    }
                    else
                    {
                        DestPath = Regex.Replace(LinkData, "Map/", "");
                    }

                    if (Arc.MapWz != null && Arc.MapWz.HasNode(Split[1] + "/" + Split[2]))
                    {
                        return((Arc.MapWz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else if (Arc.Map001Wz != null && Arc.Map001Wz.HasNode(Split[1] + "/" + Split[2]))
                    {
                        return((Arc.Map001Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else if (Arc.Map002Wz != null && Arc.Map002Wz.HasNode(Split[1] + '/' + Split[2]))
                    {
                        return((Arc.Map002Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else
                    {
                        return((Arc.Map2Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    break;

                case "Skill":
                    DestPath = Regex.Replace(LinkData, "Skill/", "");
                    if (Arc.SkillWz != null && Arc.SkillWz.HasNode(Split[1]))
                    {
                        return((Arc.SkillWz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else if (Arc.Skill001Wz != null && Arc.Skill001Wz.HasNode(Split[1]))
                    {
                        return((Arc.Skill001Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    else
                    {
                        return((Arc.Skill002Wz.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                    }
                    break;

                default:
                    DestPath = Regex.Replace(LinkData, Node.GetNodeWzFile().Type.ToString() + "/", "");
                    return((Node.GetNodeWzFile().WzStructure.GetNode(DestPath).Value as Wz_Png).ExtractPng());

                    break;
                }
                ;
            }
            else if (Node.HasNode("_inlink"))
            {
                var LinkData = Node.GetNode("_inlink").Value.ToString();
                return((Node.GetNodeWzImage().Node.GetNode(LinkData).Value as Wz_Png).ExtractPng());
            }
            else if (Node.HasNode("source"))
            {
                var LinkData = Node.GetNode("source").Value.ToString();
                var DestPath = Regex.Replace(LinkData, Node.GetNodeWzFile().Type.ToString() + "/", "");
                if (Node.GetNodeWzFile().WzStructure.GetNode(DestPath) != null)
                {
                    return((Node.GetNodeWzFile().WzStructure.GetNode(DestPath).Value as Wz_Png).ExtractPng());
                }
            }
            else
            {
                if (Node.Value is Wz_Uol)
                {
                    return((Node.ResolveUol().Value as Wz_Png).ExtractPng());
                }
                else
                {
                    return((Node.Value as Wz_Png).ExtractPng());
                }
            }

            return(null);
        }