Example #1
0
        /// <summary>
        /// Loads data given the path of a file or directory
        /// </summary>
        public static WzFile LoadFile(this Wz wz, string filePath, WzMapleVersion encryption, bool force = true)
        {
            WzFile file = null;

            if (!force)
            {
                if ((file = GetFile(wz)) != null)
                {
                    return(file);
                }
            }

            if (File.Exists(filePath) || File.Exists(filePath + Resources.FileExtensionWZ))
            {
                file = new WzFile(filePath + Resources.FileExtensionWZ, encryption);
                file.ParseWzFile();
            }
            else if (Directory.Exists(filePath))
            {
                file = new WzFile(filePath, encryption);
                WzDirectory dir = new WzDirectory(filePath, file);
                file.WzDirectory = dir;
                LoadFilesImg(dir, filePath, encryption);
            }

            return(WzCache[(int)wz] = file);
        }
Example #2
0
        /// <summary>
        /// Disposes then nulls the cached WZ file
        /// </summary>
        public static void Dispose(this Wz wz)
        {
            var file = WzCache[(int)wz];

            file?.Dispose();
            WzCache[(int)wz] = null;
        }
Example #3
0
        /// <summary>
        /// Disposes then nulls the cached WZ file
        /// </summary>
        public static void Dispose(this Wz wz)
        {
            var file = WzCache[(int)wz];

            file?.Dispose();
            WzCache[(int)wz] = null;

            if (wz == Wz.String)
            {
                StringWz.Dispose();
            }
        }
Example #4
0
 /// <summary>
 /// Gets the cached WZ file
 /// </summary>
 public static WzFile GetFile(this Wz wz)
 {
     return(WzCache[(int)wz]);
 }
Example #5
0
 public string SizeString()
 {
     return(Wx.ToString("0.0") + "," + Wy.ToString("0.0") +
            "," + Wz.ToString("0.0"));
 }