Ejemplo n.º 1
0
        public override Bitmap GetBitmap()
        {
            if (this["_inlink"] is WzStringProperty inlink)
            {
                WzObject currentWzObj = this; // first object to work with
                while ((currentWzObj = currentWzObj.Parent) != null)
                {
                    if (!(currentWzObj is WzImage))  // keep looping if its not a WzImage
                    {
                        continue;
                    }

                    WzImage         wzImageParent = (WzImage)currentWzObj;
                    WzImageProperty foundProperty = wzImageParent.GetFromPath(inlink.Value);
                    if (foundProperty != null && foundProperty is WzImageProperty)
                    {
                        return(foundProperty.GetBitmap());
                    }
                }
            }
            else if (this["_outlink"] is WzStringProperty outlink)
            {
                WzObject foundProperty = WzFileParent.GetObjectFromPath(outlink.Value);
                if (foundProperty is WzImageProperty)
                {
                    return(foundProperty.GetBitmap());
                }
            }
            return(imageProp.GetPNG(false));
        }
Ejemplo n.º 2
0
        public override Bitmap GetBitmap()
        {
            if (InLink != null)
            {
                WzObject currentWzObj = this; // first object to work with
                while ((currentWzObj = currentWzObj.Parent) != null)
                {
                    if (!(currentWzObj is WzImage)) // keep looping if its not a WzImage
                    {
                        continue;
                    }

                    WzImage         wzImageParent = (WzImage)currentWzObj;
                    WzImageProperty foundProperty = wzImageParent.GetFromPath(InLink.Value);
                    if (foundProperty != null && foundProperty is WzImageProperty)
                    {
                        return(foundProperty.GetBitmap());
                    }
                }
            }
            else if (OutLink != null)
            {
                WzObject foundProperty = WzFileParent.GetObjectFromPath(OutLink.Value);
                if (foundProperty?.OutLink != null)
                {
                    if (foundProperty.WzFileParent.GetObjectFromPath(foundProperty.OutLink.Value) == this)
                    {
                        Console.WriteLine("RECURSION FOUND");
                        // recursive linking, who the f**k did this??
                        return(null);
                    }
                }

                if (foundProperty is WzImageProperty)
                {
                    return(foundProperty.GetBitmap());
                }
            }

            return(imageProp.GetPNG(false));
        }