hlStreamOpen() public static méthode

public static hlStreamOpen ( IntPtr pStream, uint uiMode ) : bool
pStream IntPtr
uiMode uint
Résultat bool
Exemple #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);
        }
Exemple #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());
        }