Esempio n. 1
0
        /// <summary> 將這個<see cref="WzUOL"/>指向特定的<see cref="WzVariant"/>。若該<see cref="WzVariant"/>物件不在同一個映像檔中,則會連結失敗 </summary>
        /// <param name="variant"> 要指向的<see cref="WzVariant"/>物件 </param>
        public void LinkVariant(WzVariant variant)
        {
            string      path     = "";
            WzSerialize myparent = this.Parent;

            while (myparent != null)
            {
                string      path2   = path;
                WzSerialize vparent = variant.Parent;
                while (vparent != null)
                {
                    if (myparent == vparent)
                    {
                        this.Path = path2 + variant.Name;
                        return;
                    }

                    path2   = vparent.Name + "/" + path2;
                    vparent = vparent.Parent;
                }
                path     = "../" + path;
                myparent = myparent.Parent;
            }
            this.Path = "";
            //throw new Exception("Can't find variant '" + v.Name + "' in image file");
        }
Esempio n. 2
0
 /// <summary> 從指定的資料流中讀取<see cref="WzImage"/>的資料 </summary>
 /// <param name="stream"> 來源資料流 </param>
 public void Read(WzFileStream stream)
 {
     stream.Seek(0, true);
     stream.StringPool.Clear();
     this.Data           = WzSerialize.FromClassName(stream.StringPool.Read());
     this.Data.ImageFile = this;
     this.Data.Read(stream);
 }
Esempio n. 3
0
 /// <summary> 建立<see cref="WzImage"/>實體 </summary>
 public WzImage(WzSerialize data = null)
 {
     if (data != null)
     {
         data.ImageFile = this;
     }
     this.Data = data;
 }
Esempio n. 4
0
        /// <summary> 釋放<see cref="WzImage"/>所使用的資源 </summary>
        public void Dispose()
        {
            this.Data.Dispose();
            this.Data = null;

            GC.SuppressFinalize(this);

            GC.Collect();
            GC.WaitForFullGCComplete();
        }
Esempio n. 5
0
        internal override bool Read(WzFileStream stream)
        {
            int nSize = stream.Read4(true);

            for (int i = 0; i < nSize; ++i)
            {
                WzVector2D vec = WzSerialize.FromClassName(stream.StringPool.Read()) as WzVector2D;
                vec.Read(stream);
                this.Vertices.Add(vec);
            }
            return(true);
        }
Esempio n. 6
0
        /// <summary> 取得這個<see cref="WzSerialize"/>的所在位置 </summary>
        public string GetImagePath()
        {
            WzSerialize obj        = this.Parent;
            string      pathstring = "";

            if (obj != null)
            {
                pathstring += this.Name;
                while (obj.Parent != null)
                {
                    pathstring = obj.Name + "/" + pathstring;
                    obj        = obj.Parent;
                }
            }
            return(pathstring);
        }
Esempio n. 7
0
        /// <summary> </summary>
        internal override void Read(WzFileStream fs)
        {
            int  blockSize = fs.Read4();
            long off       = fs.Tell();

            string      classname = fs.StringPool.Read();
            WzSerialize obj       = WzSerialize.FromClassName(classname, this.Name);

            obj.ImageFile = this.Parent.ImageFile;
            obj.Read(fs);

            if (fs.Tell() != (off + blockSize))
            {
                fs.Seek(off + blockSize);
#if DEBUG
                System.Console.WriteLine("沒有解析完全 : {0}", this.GetImagePath());
#endif
            }

            this.Value = obj;
        }
Esempio n. 8
0
 /// <summary> </summary>
 public WzDispatch(string name, WzSerialize value = null) :
     base(WzVariantType.Dispatch, name)
 {
     this.Value = value;
 }