Ejemplo n.º 1
0
 private void ParseChilds(IWzObject SourceObject)
 {
     if (SourceObject == null) throw new NullReferenceException("Cannot create a null WzNode");
     Tag = SourceObject;
     SourceObject.HRTag = this;
     if (SourceObject is WzFile) SourceObject = ((WzFile)SourceObject).WzDirectory;
     if (SourceObject is WzDirectory)
     {
         foreach (WzDirectory dir in ((WzDirectory)SourceObject).WzDirectories)
             Nodes.Add(new WzNode(dir));
         foreach (WzImage img in ((WzDirectory)SourceObject).WzImages)
             Nodes.Add(new WzNode(img));
     }
     else if (SourceObject is WzImage)
     {
         if (((WzImage)SourceObject).Parsed)
             foreach (IWzImageProperty prop in ((WzImage)SourceObject).WzProperties)
                 Nodes.Add(new WzNode(prop));
     }
     else if (SourceObject is IPropertyContainer)
     {
         foreach (IWzImageProperty prop in ((IPropertyContainer)SourceObject).WzProperties)
             Nodes.Add(new WzNode(prop));
     }
 }
Ejemplo n.º 2
0
		internal static IWzImageProperty[] ParsePropertyList(uint offset, WzBinaryReader reader, IWzObject parent, WzImage parentImg)
		{
			List<IWzImageProperty> properties = new List<IWzImageProperty>();
			int entryCount = reader.ReadCompressedInt();
			for (int i = 0; i < entryCount; i++)
			{
				string name = reader.ReadStringBlock(offset);
                byte ptype = reader.ReadByte();
                switch (ptype)
				{
					case 0:
						properties.Add(new WzNullProperty(name, i) { Parent = parent, ParentImage = parentImg });
						break;
					case 0x0B:
					case 2:
						properties.Add(new WzUnsignedShortProperty(name, reader.ReadUInt16()) { Parent = parent, ParentImage = parentImg });
						break;
					case 3:
						properties.Add(new WzCompressedIntProperty(name, reader.ReadCompressedInt()) { Parent = parent, ParentImage = parentImg });
						break;
					case 4:
						byte type = reader.ReadByte();
						if (type == 0x80)
							properties.Add(new WzByteFloatProperty(name, reader.ReadSingle()) { Parent = parent, ParentImage = parentImg });
						else if (type == 0)
							properties.Add(new WzByteFloatProperty(name, 0f) { Parent = parent, ParentImage = parentImg });
						break;
					case 5:
						properties.Add(new WzDoubleProperty(name, reader.ReadDouble()) { Parent = parent, ParentImage = parentImg });
						break;
					case 8:
						properties.Add(new WzStringProperty(name, reader.ReadStringBlock(offset)) { Parent = parent });
						break;
					case 9:
						int eob = (int)(reader.ReadUInt32() + reader.BaseStream.Position);
						WzExtendedProperty exProp = new WzExtendedProperty(offset, eob, name);
						exProp.Parent = parent;
						exProp.ParentImage = parentImg;
						exProp.ParseExtendedProperty(reader);
						properties.Add(exProp);
						if (reader.BaseStream.Position != eob) reader.BaseStream.Position = eob;
						break;
                    default:
                        {
                            Console.WriteLine("Unknown type: {0} | {1}", ptype, name); 
                            break;
                        }
				}
			}
			return properties.ToArray();
		}
Ejemplo n.º 3
0
 private void addObjInternal(IWzObject obj)
 {
     IWzObject TaggedObject = (IWzObject)Tag;
     if (TaggedObject is WzFile) TaggedObject = ((WzFile)TaggedObject).WzDirectory;
     if (TaggedObject is WzDirectory)
     {
         if (obj is WzDirectory)
             ((WzDirectory)TaggedObject).AddDirectory((WzDirectory)obj);
         else if (obj is WzImage)
             ((WzDirectory)TaggedObject).AddImage((WzImage)obj);
         else return;
     }
     else if (TaggedObject is WzImage)
     {
         if (!((WzImage)TaggedObject).Parsed) ((WzImage)TaggedObject).ParseImage();
         if (obj is IWzImageProperty)
             ((WzImage)TaggedObject).AddProperty((IWzImageProperty)obj);
         else return;
     }
     else if (TaggedObject is IPropertyContainer)
     {
         if (obj is IWzImageProperty)
             ((IPropertyContainer)TaggedObject).AddProperty((IWzImageProperty)obj);
         else return;
     }
     else return;
 }
Ejemplo n.º 4
0
 public WzNode(IWzObject SourceObject)
     : base(SourceObject.Name)
 {
     ParseChilds(SourceObject);
 }
Ejemplo n.º 5
0
 private void ShowObjectValue(IWzObject 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 = (Bitmap)obj;
         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 WzCompressedIntProperty || obj is WzDoubleProperty || obj is WzByteFloatProperty || obj is WzUnsignedShortProperty || obj is WzUOLProperty)
     {
         nameBox.Visible = true;
         canvasPropBox.Visible = false;
         pictureBoxPanel.Visible = false;
         textPropBox.Visible = true;
         mp3Player.Visible = false;
         textPropBox.Text = (string)obj;
         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
     {
     }
 }
Ejemplo n.º 6
0
 public BackgroundInfo(Bitmap image, System.Drawing.Point origin, string bS, bool ani, string no, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
     _bS = bS;
     _ani = ani;
     _no = no;
 }
Ejemplo n.º 7
0
 public PortalInfo(PortalType type, Bitmap image, System.Drawing.Point origin, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
     this.type = type;
 }
Ejemplo n.º 8
0
 public MapleDrawableInfo(Bitmap image, System.Drawing.Point origin, IWzObject parentObject)
 {
     this.image = image;
     this.origin = origin;
     this.parentObject = parentObject;
 }
Ejemplo n.º 9
0
        internal static IWzImageProperty[] ParsePropertyList(uint offset, WzBinaryReader reader, IWzObject parent, WzImage parentImg)
        {
            List <IWzImageProperty> properties = new List <IWzImageProperty>();
            int entryCount = reader.ReadCompressedInt();

            for (int i = 0; i < entryCount; i++)
            {
                string name  = reader.ReadStringBlock(offset);
                byte   ptype = reader.ReadByte();
                switch (ptype)
                {
                case 0:
                    properties.Add(new WzNullProperty(name, i)
                    {
                        Parent = parent, ParentImage = parentImg
                    });
                    break;

                case 0x0B:
                case 2:
                    properties.Add(new WzUnsignedShortProperty(name, reader.ReadUInt16())
                    {
                        Parent = parent, ParentImage = parentImg
                    });
                    break;

                case 3:
                    properties.Add(new WzCompressedIntProperty(name, reader.ReadCompressedInt())
                    {
                        Parent = parent, ParentImage = parentImg
                    });
                    break;

                case 4:
                    byte type = reader.ReadByte();
                    if (type == 0x80)
                    {
                        properties.Add(new WzByteFloatProperty(name, reader.ReadSingle())
                        {
                            Parent = parent, ParentImage = parentImg
                        });
                    }
                    else if (type == 0)
                    {
                        properties.Add(new WzByteFloatProperty(name, 0f)
                        {
                            Parent = parent, ParentImage = parentImg
                        });
                    }
                    break;

                case 5:
                    properties.Add(new WzDoubleProperty(name, reader.ReadDouble())
                    {
                        Parent = parent, ParentImage = parentImg
                    });
                    break;

                case 8:
                    properties.Add(new WzStringProperty(name, reader.ReadStringBlock(offset))
                    {
                        Parent = parent
                    });
                    break;

                case 9:
                    int eob = (int)(reader.ReadUInt32() + reader.BaseStream.Position);
                    WzExtendedProperty exProp = new WzExtendedProperty(offset, eob, name);
                    exProp.Parent      = parent;
                    exProp.ParentImage = parentImg;
                    exProp.ParseExtendedProperty(reader);
                    properties.Add(exProp);
                    if (reader.BaseStream.Position != eob)
                    {
                        reader.BaseStream.Position = eob;
                    }
                    break;

                default:
                {
                    Console.WriteLine("Unknown type: {0} | {1}", ptype, name);
                    break;
                }
                }
            }
            return(properties.ToArray());
        }
Ejemplo n.º 10
0
        public IWzObject GetObjectFromPath(string path)
        {
            string[] seperatedPath = path.Split("/".ToCharArray());
            if (seperatedPath[0].ToLower() != wzDir.name.ToLower() && seperatedPath[0].ToLower() != wzDir.name.Substring(0, wzDir.name.Length - 3).ToLower())
            {
                return(null);
            }
            if (seperatedPath.Length == 1)
            {
                return(WzDirectory);
            }
            IWzObject curObj = WzDirectory;

            for (int i = 1; i < seperatedPath.Length; i++)
            {
                if (curObj == null)
                {
                    return(null);
                }
                switch (curObj.ObjectType)
                {
                case WzObjectType.Directory:
                    curObj = ((WzDirectory)curObj)[seperatedPath[i]];
                    continue;

                case WzObjectType.Image:
                    curObj = ((WzImage)curObj)[seperatedPath[i]];
                    continue;

                case WzObjectType.Property:
                    switch (((IWzImageProperty)curObj).PropertyType)
                    {
                    case WzPropertyType.Canvas:
                        curObj = ((WzCanvasProperty)curObj)[seperatedPath[i]];
                        continue;

                    case WzPropertyType.Convex:
                        curObj = ((WzConvexProperty)curObj)[seperatedPath[i]];
                        continue;

                    case WzPropertyType.SubProperty:
                        curObj = ((WzSubProperty)curObj)[seperatedPath[i]];
                        continue;

                    case WzPropertyType.Vector:
                        if (seperatedPath[i] == "X")
                        {
                            return(((WzVectorProperty)curObj).X);
                        }
                        else if (seperatedPath[i] == "Y")
                        {
                            return(((WzVectorProperty)curObj).Y);
                        }
                        else
                        {
                            return(null);
                        }

                    default:                                     // Wut?
                        return(null);
                    }
                }
            }
            if (curObj == null)
            {
                return(null);
            }
            return(curObj);
        }
 internal static List<IWzImageProperty> ParsePropertyList(uint offset, WzBinaryReader reader, IWzObject parent, WzImage parentImg)
 {
     int entryCount = reader.ReadCompressedInt();
     List<IWzImageProperty> properties = new List<IWzImageProperty>(entryCount);
     for (int i = 0; i < entryCount; i++)
     {
         string name = reader.ReadStringBlock(offset);
         switch (reader.ReadByte())
         {
             case 0:
                 properties.Add(new WzNullProperty(name) { Parent = parent/*, ParentImage = parentImg*/ });
                 break;
             case 0x0B:
             case 2:
                 properties.Add(new WzUnsignedShortProperty(name, reader.ReadUInt16()) { Parent = parent/*, ParentImage = parentImg*/ });
                 break;
             case 3:
                 properties.Add(new WzCompressedIntProperty(name, reader.ReadCompressedInt()) { Parent = parent/*, ParentImage = parentImg*/ });
                 break;
             case 4:
                 byte type = reader.ReadByte();
                 if (type == 0x80)
                     properties.Add(new WzByteFloatProperty(name, reader.ReadSingle()) { Parent = parent/*, ParentImage = parentImg*/ });
                 else if (type == 0)
                     properties.Add(new WzByteFloatProperty(name, 0f) { Parent = parent/*, ParentImage = parentImg*/ });
                 break;
             case 5:
                 properties.Add(new WzDoubleProperty(name, reader.ReadDouble()) { Parent = parent/*, ParentImage = parentImg*/ });
                 break;
             case 8:
                 properties.Add(new WzStringProperty(name, reader.ReadStringBlock(offset)) { Parent = parent });
                 break;
             case 9:
                 int eob = (int)(reader.ReadUInt32() + reader.BaseStream.Position);
                 IWzImageProperty exProp = ParseExtendedProp(reader, offset, eob, name, parent, parentImg);
                 properties.Add(exProp);
                 if (reader.BaseStream.Position != eob) reader.BaseStream.Position = eob;
                 break;
             default:
                 throw new Exception("Unknown property type at ParsePropertyList");
         }
     }
     return properties;
 }
 internal static IExtended ParseExtendedProp(WzBinaryReader reader, uint offset, int endOfBlock, string name, IWzObject parent, WzImage imgParent)
 {
     switch (reader.ReadByte())
     {
         case 0x1B:
             return ExtractMore(reader, offset, endOfBlock, name, reader.ReadStringAtOffset(offset + reader.ReadInt32()), parent, imgParent);
         case 0x73:
             return ExtractMore(reader, offset, endOfBlock, name, "", parent, imgParent);
         default:
             throw new System.Exception("Invlid byte read at ParseExtendedProp");
     }
 }
 internal static IExtended ExtractMore(WzBinaryReader reader, uint offset, int eob, string name, string iname, IWzObject parent, WzImage imgParent)
 {
     if (iname == "")
         iname = reader.ReadString();
     switch (iname)
     {
         case "Property":
             WzSubProperty subProp = new WzSubProperty(name) { Parent = parent };
             reader.BaseStream.Position += 2;
             subProp.AddProperties(IWzImageProperty.ParsePropertyList(offset, reader, subProp, imgParent));
             return subProp;
         case "Canvas":
             WzCanvasProperty canvasProp = new WzCanvasProperty(name) { Parent = parent };
             reader.BaseStream.Position++;
             if (reader.ReadByte() == 1)
             {
                 reader.BaseStream.Position += 2;
                 canvasProp.AddProperties(IWzImageProperty.ParsePropertyList(offset, reader, canvasProp, imgParent));
             }
             canvasProp.PngProperty = new WzPngProperty(reader, imgParent.parseEverything) { Parent = canvasProp };
             return canvasProp;
         case "Shape2D#Vector2D":
             WzVectorProperty vecProp = new WzVectorProperty(name) { Parent = parent };
             vecProp.X = new WzCompressedIntProperty("X", reader.ReadCompressedInt()) { Parent = vecProp };
             vecProp.Y = new WzCompressedIntProperty("Y", reader.ReadCompressedInt()) { Parent = vecProp };
             return vecProp;
         case "Shape2D#Convex2D":
             WzConvexProperty convexProp = new WzConvexProperty(name) { Parent = parent };
             int convexEntryCount = reader.ReadCompressedInt();
             convexProp.WzProperties.Capacity = convexEntryCount; //performance thing
             for (int i = 0; i < convexEntryCount; i++)
             {
                 convexProp.AddProperty(ParseExtendedProp(reader, offset, 0, name, convexProp, imgParent));
             }
             return convexProp;
         case "Sound_DX8":
             WzSoundProperty soundProp = new WzSoundProperty(name, reader, imgParent.parseEverything) { Parent = parent };
             return soundProp;
         case "UOL":
             reader.BaseStream.Position++;
             switch (reader.ReadByte())
             {
                 case 0:
                     return new WzUOLProperty(name, reader.ReadString()) { Parent = parent };
                 case 1:
                     return new WzUOLProperty(name, reader.ReadStringAtOffset(offset + reader.ReadInt32())) { Parent = parent };
             }
             throw new Exception("Unsupported UOL type");
         default:
             throw new Exception("Unknown iname: " + iname);
     }
 }
Ejemplo n.º 14
0
 private bool ValidAnimation(IWzObject prop)
 {
     if (!(prop is WzSubProperty)) return false;
     WzSubProperty castedProp = (WzSubProperty)prop;
     List<WzCanvasProperty> props = new List<WzCanvasProperty>(castedProp.WzProperties.Count);
     int foo;
     foreach (IWzImageProperty subprop in castedProp.WzProperties)
     {
         if (!(subprop is WzCanvasProperty)) continue;
         if (!int.TryParse(subprop.Name, out foo)) return false;
         props.Add((WzCanvasProperty)subprop);
     }
     if (props.Count < 2) return false;
     props.Sort(new Comparison<WzCanvasProperty>(AnimationBuilder.PropertySorter));
     for (int i = 0; i < props.Count; i++) if (i.ToString() != props[i].Name) return false;
     return true;
 }
Ejemplo n.º 15
0
 public ObjectInfo(Bitmap image, System.Drawing.Point origin, string oS, string l0, string l1, string l2, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
     this._oS = oS;
     this._l0 = l0;
     this._l1 = l1;
     this._l2 = l2;
 }
Ejemplo n.º 16
0
        internal static List <IWzImageProperty> ParsePropertyList(uint offset, WzBinaryReader reader, IWzObject parent, WzImage parentImg)
        {
            int entryCount = reader.ReadCompressedInt();
            List <IWzImageProperty> properties = new List <IWzImageProperty>(entryCount);

            for (int i = 0; i < entryCount; i++)
            {
                string name = reader.ReadStringBlock(offset);
                switch (reader.ReadByte())
                {
                case 0:
                    properties.Add(new WzNullProperty(name)
                    {
                        Parent = parent                                                                  /*, ParentImage = parentImg*/
                    });
                    break;

                case 0x0B:
                case 2:
                    properties.Add(new WzUnsignedShortProperty(name, reader.ReadUInt16())
                    {
                        Parent = parent                                                                                                /*, ParentImage = parentImg*/
                    });
                    break;

                case 3:
                    properties.Add(new WzCompressedIntProperty(name, reader.ReadCompressedInt())
                    {
                        Parent = parent                                                                                                       /*, ParentImage = parentImg*/
                    });
                    break;

                case 4:
                    byte type = reader.ReadByte();
                    if (type == 0x80)
                    {
                        properties.Add(new WzByteFloatProperty(name, reader.ReadSingle())
                        {
                            Parent = parent                                                                                                /*, ParentImage = parentImg*/
                        });
                    }
                    else if (type == 0)
                    {
                        properties.Add(new WzByteFloatProperty(name, 0f)
                        {
                            Parent = parent                                                                               /*, ParentImage = parentImg*/
                        });
                    }
                    break;

                case 5:
                    properties.Add(new WzDoubleProperty(name, reader.ReadDouble())
                    {
                        Parent = parent                                                                                         /*, ParentImage = parentImg*/
                    });
                    break;

                case 8:
                    properties.Add(new WzStringProperty(name, reader.ReadStringBlock(offset))
                    {
                        Parent = parent
                    });
                    break;

                case 9:
                    int eob = (int)(reader.ReadUInt32() + reader.BaseStream.Position);
                    IWzImageProperty exProp = ParseExtendedProp(reader, offset, eob, name, parent, parentImg);
                    properties.Add(exProp);
                    if (reader.BaseStream.Position != eob)
                    {
                        reader.BaseStream.Position = eob;
                    }
                    break;

                default:
                    throw new Exception("Unknown property type at ParsePropertyList");
                }
            }
            return(properties);
        }
Ejemplo n.º 17
0
 public TileInfo(Bitmap image, System.Drawing.Point origin, string tS, string u, string no, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
     this._tS = tS;
     this._u = u;
     this._no = no;
 }
Ejemplo n.º 18
0
        internal static IExtended ParseExtendedProp(WzBinaryReader reader, uint offset, int endOfBlock, string name, IWzObject parent, WzImage imgParent)
        {
            switch (reader.ReadByte())
            {
            case 0x1B:
                return(ExtractMore(reader, offset, endOfBlock, name, reader.ReadStringAtOffset(offset + reader.ReadInt32()), parent, imgParent));

            case 0x73:
                return(ExtractMore(reader, offset, endOfBlock, name, "", parent, imgParent));

            default:
                throw new System.Exception("Invlid byte read at ParseExtendedProp");
            }
        }
Ejemplo n.º 19
0
 public NpcInfo(Bitmap image, System.Drawing.Point origin, string id, string name, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
     this.id = id;
     this.name = name;
 }
Ejemplo n.º 20
0
        internal static IExtended ExtractMore(WzBinaryReader reader, uint offset, int eob, string name, string iname, IWzObject parent, WzImage imgParent)
        {
            if (iname == "")
            {
                iname = reader.ReadString();
            }
            switch (iname)
            {
            case "Property":
                WzSubProperty subProp = new WzSubProperty(name)
                {
                    Parent = parent
                };
                reader.BaseStream.Position += 2;
                subProp.AddProperties(IWzImageProperty.ParsePropertyList(offset, reader, subProp, imgParent));
                return(subProp);

            case "Canvas":
                WzCanvasProperty canvasProp = new WzCanvasProperty(name)
                {
                    Parent = parent
                };
                reader.BaseStream.Position++;
                if (reader.ReadByte() == 1)
                {
                    reader.BaseStream.Position += 2;
                    canvasProp.AddProperties(IWzImageProperty.ParsePropertyList(offset, reader, canvasProp, imgParent));
                }
                canvasProp.PngProperty = new WzPngProperty(reader, imgParent.parseEverything)
                {
                    Parent = canvasProp
                };
                return(canvasProp);

            case "Shape2D#Vector2D":
                WzVectorProperty vecProp = new WzVectorProperty(name)
                {
                    Parent = parent
                };
                vecProp.X = new WzCompressedIntProperty("X", reader.ReadCompressedInt())
                {
                    Parent = vecProp
                };
                vecProp.Y = new WzCompressedIntProperty("Y", reader.ReadCompressedInt())
                {
                    Parent = vecProp
                };
                return(vecProp);

            case "Shape2D#Convex2D":
                WzConvexProperty convexProp = new WzConvexProperty(name)
                {
                    Parent = parent
                };
                int convexEntryCount = reader.ReadCompressedInt();
                convexProp.WzProperties.Capacity = convexEntryCount;     //performance thing
                for (int i = 0; i < convexEntryCount; i++)
                {
                    convexProp.AddProperty(ParseExtendedProp(reader, offset, 0, name, convexProp, imgParent));
                }
                return(convexProp);

            case "Sound_DX8":
                WzSoundProperty soundProp = new WzSoundProperty(name, reader, imgParent.parseEverything)
                {
                    Parent = parent
                };
                return(soundProp);

            case "UOL":
                reader.BaseStream.Position++;
                switch (reader.ReadByte())
                {
                case 0:
                    return(new WzUOLProperty(name, reader.ReadString())
                    {
                        Parent = parent
                    });

                case 1:
                    return(new WzUOLProperty(name, reader.ReadStringAtOffset(offset + reader.ReadInt32()))
                    {
                        Parent = parent
                    });
                }
                throw new Exception("Unsupported UOL type");

            default:
                throw new Exception("Unknown iname: " + iname);
            }
        }
Ejemplo n.º 21
0
 public ReactorInfo(Bitmap image, System.Drawing.Point origin, string id, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
     this.id = id;
 }
Ejemplo n.º 22
0
 public bool AddObject(IWzObject obj, UndoRedoManager undoRedoMan)
 {
     if (CanNodeBeInserted(this, obj.Name))
     {
         TryParseImage();
         addObjInternal(obj);
         WzNode node = new WzNode(obj);
         Nodes.Add(node);
         if (node.Tag is IWzImageProperty) ((IWzImageProperty)node.Tag).ParentImage.Changed = true;
         undoRedoMan.AddUndoBatch(new System.Collections.Generic.List<UndoRedoAction> { UndoRedoManager.ObjectAdded(this, node) });
         node.EnsureVisible();
         return true;
     }
     else
     {
         MessageBox.Show("Cannot insert object \"" + obj.Name + "\" because an object with the same name already exists. Skipping.", "Skipping Object", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
 }
Ejemplo n.º 23
0
 public MapleExtractableInfo(Bitmap image, System.Drawing.Point origin, IWzObject parentObject)
     : base(image, origin, parentObject)
 {
 }
Ejemplo n.º 24
0
        public   ContextMenuStrip CreateMenu(IWzObject Tag)
        {
            ContextMenuStrip menu = null;
            if (Tag is WzImage || Tag is IPropertyContainer)
            {
                if (Tag is WzSubProperty)
                {
                                menu = new ContextMenuStrip();
            menu.Items.AddRange(new ToolStripItem[] { AddPropsSubMenu, /*export, import,*/Remove });

                }
                else
                {
                    menu = new ContextMenuStrip();
                    menu.Items.AddRange(new ToolStripItem[] { AddPropsSubMenu, /*export, import,*/Remove });
                }
            }
            else if (Tag is IWzImageProperty)
            {
                menu = new ContextMenuStrip();
                menu.Items.AddRange(new ToolStripItem[] { /*export, import,*/Remove });
            }
            else if (Tag is WzDirectory)
            {
                menu = new ContextMenuStrip();
                menu.Items.AddRange(new ToolStripItem[] { AddDirsSubMenu, /*export, import,*/Remove });
            }
            else if (Tag is WzFile)
            {
                menu = new ContextMenuStrip();
                menu.Items.AddRange(new ToolStripItem[] { AddDirsSubMenu, SaveFile, Unload, Reload });
            }
            else if (Tag is WzListFile)
            {
                menu = new ContextMenuStrip();
                menu.Items.AddRange(new ToolStripItem[] { AddListSubMenu, SaveFile, Unload, Reload });
            }
            return menu;

            
        }