hlStreamOpen() public static method

public static hlStreamOpen ( IntPtr pStream, uint uiMode ) : bool
pStream IntPtr
uiMode uint
return bool
Beispiel #1
0
        public PackageFileStream(IntPtr filePtr)
        {
            _filePtr = filePtr;
            if (!HLLib.hlFileCreateStream(filePtr, out _streamPtr))
            {
                throw new Exception("Unable to create stream.");
            }

            if (!HLLib.hlStreamOpen(_streamPtr, (uint)HLLib.HLFileMode.HL_MODE_READ))
            {
                throw new Exception("Unable to open stream.");
            }
            _size = (long)HLLib.hlStreamGetStreamSizeEx(_streamPtr);
        }
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());
        }