Ejemplo n.º 1
0
        public static DirectedGraph Deserialize(Stream stream, DirectedGraphProfile profile)
        {
            long position1 = stream.Position;
            long num1      = 1;
            int  num2      = stream.ReadByte();

            if (num2 != 1)
            {
                throw new Exception(string.Format("Cannot deserialize directed graph: Invalid version #: {0}.", (object)num2));
            }
            byte[] buffer = new byte[8];
            stream.Read(buffer, 0, 8);
            long num3    = num1 + 8L;
            long int64_1 = BitConverter.ToInt64(buffer, 0);

            stream.Read(buffer, 0, 8);
            long num4    = num3 + 8L;
            long int64_2 = BitConverter.ToInt64(buffer, 0);

            stream.Read(buffer, 0, 4);
            long num5    = num4 + 4L;
            int  int32_1 = BitConverter.ToInt32(buffer, 0);

            stream.Read(buffer, 0, 4);
            long             num6    = num5 + 4L;
            int              int32_2 = BitConverter.ToInt32(buffer, 0);
            ArrayBase <uint> vertices;
            ArrayBase <uint> edges;
            long             num7;

            if (profile == null)
            {
                vertices = (ArrayBase <uint>) new MemoryArray <uint>(int64_1 * (long)int32_1);
                vertices.CopyFrom(stream);
                long num8 = num6 + int64_1 * (long)int32_1 * 4L;
                edges = (ArrayBase <uint>) new MemoryArray <uint>(int64_2 * (long)int32_2);
                edges.CopyFrom(stream);
                num7 = num8 + int64_2 * (long)int32_2 * 4L;
            }
            else
            {
                long position2 = stream.Position;
                vertices = (ArrayBase <uint>) new Array <uint>(((MemoryMap) new MemoryMapStream((Stream) new CappedStream(stream, position2, int64_1 * (long)int32_1 * 4L))).CreateUInt32(int64_1 * (long)int32_1), profile.VertexProfile);
                long num8 = num6 + int64_1 * (long)int32_1 * 4L;
                edges = (ArrayBase <uint>) new Array <uint>(((MemoryMap) new MemoryMapStream((Stream) new CappedStream(stream, position2 + int64_1 * (long)int32_1 * 4L, int64_2 * (long)int32_2 * 4L))).CreateUInt32(int64_2 * (long)int32_2), profile.EdgeProfile);
                num7  = num8 + int64_2 * (long)int32_2 * 4L;
            }
            stream.Seek(position1 + num7, SeekOrigin.Begin);
            return(new DirectedGraph(int32_2 - 1, int64_2, vertices, edges));
        }
Ejemplo n.º 2
0
        static DirectedGraphProfile()
        {
            DirectedGraphProfile directedGraphProfile = new DirectedGraphProfile();

            directedGraphProfile.VertexProfile = (ArrayProfile)ArrayProfile.Aggressive8;
            ArrayProfile arrayProfile = new ArrayProfile();
            int          num1         = 1024;

            arrayProfile.BufferSize = num1;
            int num2 = 16;

            arrayProfile.CacheSize            = num2;
            directedGraphProfile.EdgeProfile  = arrayProfile;
            DirectedGraphProfile.Aggressive24 = directedGraphProfile;
        }