Beispiel #1
0
        public static void LoadFromVPK(string vpkPath)
        {
            if (!Directory.Exists("cache"))
            {
                Directory.CreateDirectory("cache");
            }

            string path = Properties.Settings.Default.DotaDir + Path.DirectorySeparatorChar + VPKPath;

            HLLib.hlInitialize();

            // Get the package type from the filename extension.
            HLLib.HLPackageType PackageType = HLLib.hlGetPackageTypeFromName(path);

            HLLib.HLFileMode OpenMode = HLLib.HLFileMode.HL_MODE_READ |
                                        //HLLib.HLFileMode.HL_MODE_QUICK_FILEMAPPING |
                                        HLLib.HLFileMode.HL_MODE_VOLATILE;

            uint PackageID;

            ErrorCheck(HLLib.hlCreatePackage(PackageType, out PackageID));

            ErrorCheck(HLLib.hlBindPackage(PackageID));

            ErrorCheck(HLLib.hlPackageOpenFile(path, (uint)OpenMode));
        }
Beispiel #2
0
        private static string ReadTextFromHLLibStream(IntPtr Stream)
        {
            HLLib.HLFileMode mode = HLLib.HLFileMode.HL_MODE_READ;

            ErrorCheck(HLLib.hlStreamOpen(Stream, (uint)mode));

            StringBuilder str = new StringBuilder();

            char ch;

            while (HLLib.hlStreamReadChar(Stream, out ch))
            {
                str.Append(ch);
            }

            HLLib.hlStreamClose(Stream);

            return(str.ToString());
        }
Beispiel #3
0
        public static void OpenVPK()
        {
            string path = GlobalSettings.DotaDirectory + Path.DirectorySeparatorChar + VPKPath;

            HLLib.hlInitialize();

            // Get the package type from the filename extension.
            HLLib.HLPackageType PackageType = HLLib.hlGetPackageTypeFromName(path);

            HLLib.HLFileMode OpenMode = HLLib.HLFileMode.HL_MODE_READ |
                                        //HLLib.HLFileMode.HL_MODE_QUICK_FILEMAPPING |
                                        HLLib.HLFileMode.HL_MODE_VOLATILE;

            uint PackageID;

            ErrorCheck(HLLib.hlCreatePackage(PackageType, out PackageID));

            ErrorCheck(HLLib.hlBindPackage(PackageID));

            ErrorCheck(HLLib.hlPackageOpenFile(path, (uint)OpenMode));
        }