System.IO.Stream.ReadUInt64()

Here are the examples of the csharp api System.IO.Stream.ReadUInt64() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 Source : KeyValue.cs
with MIT License
from Astropilot

private static bool TryReadAsBinaryCore(Stream input, KeyValue current, KeyValue parent)
        {
            current.Children = new List<KeyValue>();

            while (true)
            {
                var type = (Type)input.ReadByte();

                if (type == Type.End)
                {
                    break;
                }

                current.Name = input.ReadNullTermString(Encoding.UTF8);

                switch (type)
                {
                    case Type.None:
                        {
                            var child = new KeyValue();
                            var didReadChild = TryReadAsBinaryCore(input, child, current);
                            if (!didReadChild)
                            {
                                return false;
                            }
                            break;
                        }

                    case Type.String:
                        {
                            current.Value = input.ReadNullTermString(Encoding.UTF8);
                            break;
                        }

                    case Type.WideString:
                        {
                            System.Diagnostics.Debug.WriteLine("KeyValue", "Encountered WideString type when parsing binary KeyValue, which is unsupported. Returning false.");
                            return false;
                        }

                    case Type.Int32:
                    case Type.Color:
                    case Type.Pointer:
                        {
                            current.Value = Convert.ToString(input.ReadInt32());
                            break;
                        }

                    case Type.UInt64:
                        {
                            current.Value = Convert.ToString(input.ReadUInt64());
                            break;
                        }

                    case Type.Float32:
                        {
                            current.Value = Convert.ToString(input.ReadFloat());
                            break;
                        }

                    default:
                        {
                            return false;
                        }
                }

                if (parent != null)
                {
                    parent.Children.Add(current);
                }
                current = new KeyValue();
            }

            return true;
        }

19 Source : StreamExt.cs
with GNU General Public License v3.0
from Fe7n

public unsafe static double ReadDouble(this Stream s)
		{
			ulong num = s.ReadUInt64();
			return *(double*)(&num);
		}

19 Source : StreamExtensions.cs
with Apache License 2.0
from Xeeynamo

public static ulong PeekUInt64(this Stream stream) => stream.Peek(x => x.ReadUInt64());