当前位置: 首页>>代码示例>>C#>>正文


C# Stream.ReadInt64方法代码示例

本文整理汇总了C#中Stream.ReadInt64方法的典型用法代码示例。如果您正苦于以下问题:C# Stream.ReadInt64方法的具体用法?C# Stream.ReadInt64怎么用?C# Stream.ReadInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream.ReadInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

        public static W2Dzip Read(Stream stream)
        {
            // ReSharper disable UseObjectOrCollectionInitializer
            var result = new W2Dzip();
            // ReSharper restore UseObjectOrCollectionInitializer

            stream.Seek(0, SeekOrigin.Begin);
            result.header = stream.ReadUtf8String(4);
            result.version = stream.ReadInt32();
            result.fileCount = stream.ReadInt32();
            result.userId = stream.ReadInt32();
            result.metaOffset = stream.ReadInt64();
            result.unknown = stream.ReadInt64();

            stream.Seek(result.metaOffset, SeekOrigin.Begin);
            result.fileEntry = FileEntry.Read(stream, result.fileCount, out result.estimatedMaximumBufferSize);

            return result;
        }
开发者ID:13xforever,项目名称:Witcher-2-Save-Editor,代码行数:19,代码来源:W2Dzip.cs

示例2: FromStream

        public static Message FromStream(Stream stream)
        {
            char type = (char)stream.ReadByte();
            DateTime timestamp = DateTime.FromBinary(stream.ReadInt64());

            switch (type)
            {
                case 'g': return GuessMessage.FromStream(timestamp, stream);
                case 'p': return PlayerMessage.FromStream(timestamp, stream);
                case 'd': return RoundDoneMessage.FromStream(timestamp, stream);
                case 's': return RoundStartMessage.FromStream(timestamp, stream);
                case 'e': return SetupMessage.FromStream(timestamp, stream);
                case 't': return StateMessage.FromStream(timestamp, stream);

                default:
                    throw new InvalidOperationException($"Unknown message identifier: {type}.");
            }
        }
开发者ID:SickTeam,项目名称:GitGameServer,代码行数:18,代码来源:Message.cs

示例3: HandleStepDone

 private void HandleStepDone(Stream stream) {
     // stepping done
     long threadId = stream.ReadInt64();
     var stepComp = StepComplete;
     if (stepComp != null) {
         stepComp(this, new ThreadEventArgs(_threads[threadId]));
     }
 }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:8,代码来源:PythonProcess.cs

示例4: HandleProcessLoad

        private void HandleProcessLoad(Stream stream) {
            Debug.WriteLine("Process loaded " + _processGuid);

            // process is loaded, no user code has run
            long threadId = stream.ReadInt64();
            var thread = _threads[threadId];

            var loaded = ProcessLoaded;
            if (loaded != null) {
                loaded(this, new ThreadEventArgs(thread));
            }
        }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:12,代码来源:PythonProcess.cs

示例5: HandleThreadFrameList

        private void HandleThreadFrameList(Stream stream) {
            // list of thread frames
            var frames = new List<PythonStackFrame>();
            long tid = stream.ReadInt64();
            PythonThread thread;
            _threads.TryGetValue(tid, out thread);
            var threadName = stream.ReadString();

            int frameCount = stream.ReadInt32();
            for (int i = 0; i < frameCount; i++) {
                int startLine = stream.ReadInt32();
                int endLine = stream.ReadInt32();
                int lineNo = stream.ReadInt32();
                string frameName = stream.ReadString();
                string filename = stream.ReadString();
                int argCount = stream.ReadInt32();
                var frameKind = (FrameKind)stream.ReadInt32();
                PythonStackFrame frame = null; 
                if (thread != null) {
                    switch (frameKind) {
                        case FrameKind.Django:
                            string sourceFile = stream.ReadString();
                            var sourceLine = stream.ReadInt32();
                            frame = new DjangoStackFrame(thread, frameName, filename, startLine, endLine, lineNo, argCount, i, sourceFile, sourceLine);
                            break;
                        default:
                            frame = new PythonStackFrame(thread, frameName, filename, startLine, endLine, lineNo, argCount, i, frameKind);
                            break;
                    }
                    
                }

                int varCount = stream.ReadInt32();
                PythonEvaluationResult[] variables = new PythonEvaluationResult[varCount];
                for (int j = 0; j < variables.Length; j++) {
                    string name = stream.ReadString();
                    if (frame != null) {
                        variables[j] = ReadPythonObject(stream, name, name, frame);
                    }
                }
                if (frame != null) {
                    frame.SetVariables(variables);
                    frames.Add(frame);
                }
            }

            Debug.WriteLine("Received frames for thread {0}", tid);
            if (thread != null) {
                thread.Frames = frames;
                if (threadName != null) {
                    thread.Name = threadName;
                }
            }
        }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:54,代码来源:PythonProcess.cs

示例6: ReadPythonObject

        private PythonEvaluationResult ReadPythonObject(Stream stream, string expr, string childName, PythonStackFrame frame) {
            string objRepr = stream.ReadString();
            string hexRepr = stream.ReadString();
            string typeName = stream.ReadString();
            long length = stream.ReadInt64();
            var flags = (PythonEvaluationResultFlags)stream.ReadInt32();

            if (!flags.HasFlag(PythonEvaluationResultFlags.Raw) && ((typeName == "unicode" && LanguageVersion.Is2x()) || (typeName == "str" && LanguageVersion.Is3x()))) {
                objRepr = objRepr.FixupEscapedUnicodeChars();
            }

            if (typeName == "bool") {
                hexRepr = null;
            }

            return new PythonEvaluationResult(this, objRepr, hexRepr, typeName, length, expr, childName, frame, flags);
        }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:17,代码来源:PythonProcess.cs

示例7: HandleAsyncBreak

 private void HandleAsyncBreak(Stream stream) {
     long tid = stream.ReadInt64();
     var thread = _threads[tid];
     var asyncBreak = AsyncBreakComplete;
     Debug.WriteLine("Received async break command from thread {0}", tid);
     if (asyncBreak != null) {
         asyncBreak(this, new ThreadEventArgs(thread));
     }
 }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:9,代码来源:PythonProcess.cs

示例8: HandleRichException

 private void HandleRichException(Stream stream) {
     var exc = new PythonException();
     long tid = stream.ReadInt64();
     int count = stream.ReadInt32();
     while (--count >= 0) {
         string key = stream.ReadString();
         string value = stream.ReadString();
         exc.SetValue(this, key, value);
     }
     if (tid != 0) {
         Debug.WriteLine("Exception: " + exc.FormattedDescription ?? exc.ExceptionMessage ?? exc.TypeName);
         ExceptionRaised?.Invoke(this, new ExceptionRaisedEventArgs(_threads[tid], exc));
         _stoppedForException = true;
     }
 }
开发者ID:zooba,项目名称:PTVS,代码行数:15,代码来源:PythonProcess.cs

示例9: HandleBreakPointHit

 private void HandleBreakPointHit(Stream stream) {
     int breakId = stream.ReadInt32();
     long threadId = stream.ReadInt64();
     var brkEvent = BreakpointHit;
     PythonBreakpoint unboundBreakpoint;
     if (brkEvent != null) {
         if (_breakpoints.TryGetValue(breakId, out unboundBreakpoint)) {
             brkEvent(this, new BreakpointHitEventArgs(unboundBreakpoint, _threads[threadId]));
         } else {
             SendResumeThread(threadId);
         }
     }
 }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:13,代码来源:PythonProcess.cs

示例10: TryConnect

        /// <summary>
        /// Performs the initial handshake with the remote debugging server, verifying signature and version number and setting up SSL,
        /// and returns the opened socket and the SSL stream for that socket.
        /// </summary>
        /// <param name="hostName">Name of the host to connect to.</param>
        /// <param name="portNumber">Port number to connect to.</param>
        /// <param name="secret">Secret to authenticate with.</param>
        /// <param name="useSsl">Whether to use SSL for this connection.</param>
        /// <param name="sslErrorHandling">If using SSL, specifies how SSL certificate errors should be handled.</param>
        /// <param name="socket">Opened socket to the remote debugging server. The returned socket is owned by <paramref name="stream"/>.</param>
        /// <param name="stream">Opened SSL network stream to the remote debugging server. This stream owns the <paramref name="socket"/>, and will automatically close it.</param>
        /// <returns>Error code.</returns>
        /// <remarks><paramref name="socket"/> should not be used to send or receive data, since it is wrapped in a stream, and is owned by that stream.
        /// It is exposed solely to enable querying it for endpoint information and connectivity status.</remarks>
        public static ConnErrorMessages TryConnect(string hostName, ushort portNumber, string secret, bool useSsl, SslErrorHandling sslErrorHandling, out Socket socket, out Stream stream)
        {
            stream = null;
            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            bool connected = false;
            try {
                socket.Connect(hostName, portNumber);
                var rawStream = new NetworkStream(socket, ownsSocket: true);
                if (useSsl) {
                    var sslStream = new SslStream(rawStream, false, (sender, cert, chain, errs) => {
                        if (errs == SslPolicyErrors.None || sslErrorHandling == SslErrorHandling.Ignore) {
                            return true;
                        } else if (sslErrorHandling == SslErrorHandling.Fail) {
                            return false;
                        }

                        string errText = string.Format("Could not establish secure connection to {0}:{1} because of the following SSL issues:\n\n", hostName, portNumber);
                        if ((errs & SslPolicyErrors.RemoteCertificateNotAvailable) != 0) {
                            errText += "- no remote certificate provided\n";
                        }
                        if ((errs & SslPolicyErrors.RemoteCertificateNameMismatch) != 0) {
                            errText += "- remote certificate name does not match hostname\n";
                        }
                        if ((errs & SslPolicyErrors.RemoteCertificateChainErrors) != 0) {
                            errText += "- remote certificate is not trusted\n";
                        }

                        errText += "\nConnect anyway?";

                        var dlgRes = MessageBox.Show(errText, null, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        return dlgRes == DialogResult.Yes;
                    });
                    try {
                        sslStream.AuthenticateAsClient(hostName);
                    } catch (AuthenticationException) {
                        return ConnErrorMessages.RemoteSslError;
                    }
                    stream = sslStream;
                } else {
                    stream = rawStream;
                }

                var buf = new byte[8];
                int bufLen = stream.Read(buf, 0, DebuggerSignature.Length);
                string sig = Encoding.ASCII.GetString(buf, 0, bufLen);
                if (sig != DebuggerSignature) {
                    return ConnErrorMessages.RemoteUnsupportedServer;
                }

                long ver = stream.ReadInt64();
                if (ver != DebuggerProtocolVersion) {
                    return ConnErrorMessages.RemoteUnsupportedServer;
                }

                stream.Write(DebuggerSignatureBytes);
                stream.WriteInt64(DebuggerProtocolVersion);

                stream.WriteString(secret);
                bufLen = stream.Read(buf, 0, Accepted.Length);
                string secretResp = Encoding.ASCII.GetString(buf, 0, bufLen);
                if (secretResp != Accepted) {
                    return ConnErrorMessages.RemoteSecretMismatch;
                }

                connected = true;
            } catch (IOException) {
                return ConnErrorMessages.RemoteNetworkError;
            } catch (SocketException) {
                return ConnErrorMessages.RemoteNetworkError;
            } finally {
                if (!connected) {
                    if (stream != null) {
                        stream.Close();
                    }
                    socket.Close();
                    socket = null;
                    stream = null;
                }
            }

            return ConnErrorMessages.None;
        }
开发者ID:borota,项目名称:JTVS,代码行数:96,代码来源:JRemoteProcess.cs

示例11: ObjectHeader

 /// <summary>
 /// インスタンスを初期化します。
 /// </summary>
 /// <param name="src">ヘッダの開始位置を指しているデータ ストリーム。</param>
 public ObjectHeader( Stream src )
 {
     this.Guid = src.ReadGuid();
     this.Size = src.ReadInt64();
 }
开发者ID:akabekobeko,项目名称:Owl,代码行数:9,代码来源:ObjectHeader.cs

示例12: Read

 public static object Read(Stream stream)
 {
     return stream.ReadInt64();
 }
开发者ID:FPCollab,项目名称:General,代码行数:4,代码来源:FastPacker.cs

示例13: HandleSetLineResult

 private void HandleSetLineResult(Stream stream)
 {
     int res = stream.ReadInt32();
     long tid = stream.ReadInt64();
     int newLine = stream.ReadInt32();
     _setLineResult = res != 0;
     if (_setLineResult) {
         _threads[tid].Frames[0].LineNo = newLine;
     }
     _lineEvent.Set();
 }
开发者ID:borota,项目名称:JTVS,代码行数:11,代码来源:JProcess.cs

示例14: HandleThreadExit

        private void HandleThreadExit(Stream stream) {
            // thread exit
            long threadId = stream.ReadInt64();
            PythonThread thread;
            if (_threads.TryGetValue(threadId, out thread)) {
                var exited = ThreadExited;
                if (exited != null) {
                    exited(this, new ThreadEventArgs(thread));
                }

                _threads.Remove(threadId);
                Debug.WriteLine("Thread exited, {0} active threads", _threads.Count);
            }

        }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:15,代码来源:PythonProcess.cs

示例15: HandleDebuggerOutput

        private void HandleDebuggerOutput(Stream stream) {
            long tid = stream.ReadInt64();
            string output = stream.ReadString();

            PythonThread thread;
            if (_threads.TryGetValue(tid, out thread)) {
                var outputEvent = DebuggerOutput;
                if (outputEvent != null) {
                    outputEvent(this, new OutputEventArgs(thread, output));
                }
            }
        }
开发者ID:KevinH-MS,项目名称:PTVS,代码行数:12,代码来源:PythonProcess.cs


注:本文中的Stream.ReadInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。