/// <summary> /// Gets the '_inlink' WzCanvasProperty of this. /// /// '_inlink' is not implemented as part of WzCanvasProperty as I dont want to override existing Wz structure. /// It will be handled via HaRepackerMainPanel instead. /// </summary> /// <returns></returns> public WzImageProperty GetLinkedWzCanvasProperty() { if (!HaveInlinkProperty() && !HaveOutlinkProperty()) { return(null); } string _inlink = ((WzStringProperty)this[InlinkPropertyName])?.Value; // could get nexon'd here. In case they place an _inlink that's not WzStringProperty string _outlink = ((WzStringProperty)this[OutlinkPropertyName])?.Value; // could get nexon'd here. In case they place an _outlink that's not WzStringProperty 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); if (foundProperty != null && foundProperty is WzImageProperty) { return((WzImageProperty)foundProperty); } } } else if (_outlink != null) { WzObject currentWzObj = this; // first object to work with while ((currentWzObj = currentWzObj.Parent) != null) { System.Diagnostics.Debug.WriteLine(currentWzObj.ToString()); if (!(currentWzObj is WzDirectory)) // keep looping if its not a WzImage { continue; } WzFile wzFileParent = ((WzDirectory)currentWzObj).wzFile; WzObject foundProperty = wzFileParent.GetObjectFromPath(_outlink); if (foundProperty != null && foundProperty is WzImageProperty) { return((WzImageProperty)foundProperty); } } } return(null); }
private void ShowObjectValue(WzObject obj) { mp3Player.SoundProperty = null; nameBox.Text = obj is WzFile ? ((WzFile)obj).Header.Copyright : obj.Name; nameBox.ButtonEnabled = false; if (obj is WzFile || obj is WzDirectory || obj is WzImage || obj is WzNullProperty || obj is WzSubProperty || obj is WzConvexProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = false; mp3Player.Visible = false; vectorPanel.Visible = false; applyChangesButton.Visible = false; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else if (obj is WzCanvasProperty) { nameBox.Visible = true; canvasPropBox.Visible = true; pictureBoxPanel.Visible = true; textPropBox.Visible = false; mp3Player.Visible = false; canvasPropBox.Image = obj.GetBitmap(); vectorPanel.Visible = false; applyChangesButton.Visible = false; changeImageButton.Visible = true; saveImageButton.Visible = true; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else if (obj is WzSoundProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = false; mp3Player.Visible = true; mp3Player.SoundProperty = (WzSoundProperty)obj; vectorPanel.Visible = false; applyChangesButton.Visible = false; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = true; saveSoundButton.Visible = true; } else if (obj is WzStringProperty || obj is WzIntProperty || obj is WzDoubleProperty || obj is WzFloatProperty || obj is WzShortProperty || obj is WzUOLProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = true; mp3Player.Visible = false; textPropBox.Text = obj.ToString(); vectorPanel.Visible = false; applyChangesButton.Visible = true; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else if (obj is WzVectorProperty) { nameBox.Visible = true; canvasPropBox.Visible = false; pictureBoxPanel.Visible = false; textPropBox.Visible = false; mp3Player.Visible = false; vectorPanel.Visible = true; vectorPanel.X = ((WzVectorProperty)obj).X.Value; vectorPanel.Y = ((WzVectorProperty)obj).Y.Value; applyChangesButton.Visible = true; changeImageButton.Visible = false; saveImageButton.Visible = false; changeSoundButton.Visible = false; saveSoundButton.Visible = false; } else { } }
public WzObject CloneWzObject(WzObject obj) { if (obj is WzDirectory) { Warning.Error(Properties.Resources.MainCopyDirError); return(null); } else if (obj is WzImage) { return(((WzImage)obj).DeepClone()); } else if (obj is WzImageProperty) { return(((WzImageProperty)obj).DeepClone()); } else { MapleLib.Helpers.ErrorLogger.Log(MapleLib.Helpers.ErrorLevel.MissingFeature, "The current WZ object type cannot be cloned " + obj.ToString() + " " + obj.FullPath); return(null); } }
public void UpdateText() { void SetString(object x, out string y) { if (x is string g) { y = g; } else { y = null; } } ToolTipText = ""; if (WzObject is PcomObject pcomObject) { pcomObject.TreeNode = this; var oldName = Name; this.Name = pcomObject.Name; //if (pcomObject.Parent != null && oldName != null) // pcomObject.Parent.Rename(oldName, Name); Text = Name; if (pcomObject is WzProperty prop) { ToolTipText = "Property"; string mapName = null, streetName = null, name = null, id = null, type = null; SetString(prop["name"], out name); SetString(prop["streetName"], out streetName); SetString(prop["mapName"], out mapName); SetString(prop["id"], out id); SetString(prop["type"], out type); if (mapName != null && name == null) { name = mapName; if (streetName != null) { name += " - " + streetName; } } if (name != null) { Text += ": " + name; } if (id != null) { Text += " (id: " + id + ")"; } if (type != null) { Text += " (type: " + type + ")"; } if (pcomObject is WzImage image) { ToolTipText = "Image" + Environment.NewLine; ToolTipText += "MagLevel: " + image.MagLevel + Environment.NewLine; ToolTipText += "PixFormat: " + image.PixFormat + Environment.NewLine; ToolTipText += "Resolution: " + image.Width + " x " + image.Height + Environment.NewLine; ToolTipText += "Tile: " + image.TileWidth + " x " + image.TileHeight + Environment.NewLine; } } else if (pcomObject is WzVector2D vector) { ToolTipText = "Vector2D"; } else if (pcomObject is WzList list) { ToolTipText = pcomObject.ToString(); } else if (pcomObject is WzUOL uol) { object curObject = uol; bool firstIter = true; ToolTipText = ""; Text += " (UOL: "; bool invalid = false; while (curObject is WzUOL uolObj) { var actualObject = uolObj.ActualObject(); ToolTipText += "UOL: " + uolObj.Path + Environment.NewLine; ToolTipText += "Actual Path: " + uolObj.ActualPath() + Environment.NewLine; ToolTipText += "Actual Object: " + actualObject + Environment.NewLine; if (actualObject == null) { ToolTipText += "!!! OBJECT DOESNT EXIST !!!" + Environment.NewLine; invalid = true; } if (!firstIter) { Text += " -> "; } firstIter = false; Text += uol.Path; curObject = actualObject; } Text += ")"; if (invalid) { Text += " ERROR"; } } var infoLinkNode = Nodes["info"]?.Nodes["link"] as WZTreeNode; if (infoLinkNode != null) { SetAdditionalInfo("link", infoLinkNode.WzObject.ToString(), true, false); } else { RemoveAdditionalInfo("link", false); } } else if (WzObject != null) { ToolTipText = WzObject.ToString(); } else if (IsNotLoaded()) { SetNotLoadedTooltip(); } else { ToolTipText = "null"; } if (AdditionalInfo != null) { foreach (var o in AdditionalInfo) { if (o.Value.ShowInText) { Text += " (" + o.Key + ": " + o.Value.Text + ")"; } ToolTipText += Environment.NewLine; ToolTipText += o.Key + ": " + o.Value.Text; } } var tttt = Text; if (tttt.Length > 100) { tttt = tttt.Substring(0, 100); } ToolTipText = tttt + Environment.NewLine + ToolTipText; }