Exemple #1
0
        public static MiniDestination miniDestinationFromBlob(string containerName, string blobName)
        {
            StreamReader    input    = new StreamReader(BlobLibrary.getBlobReadStream(containerName, blobName));
            MiniDestination toreturn = miniDestinationFromStream(input);

            input.Close();

            return(toreturn);
        }
        public static bool[] SFromBlob(string containerName, string blobName)
        {
            StreamReader input = new StreamReader(BlobLibrary.getBlobReadStream(containerName, blobName));

            string[] pieces   = input.ReadLine().Split(space, StringSplitOptions.RemoveEmptyEntries);
            bool[]   toreturn = new bool[pieces.Length];
            for (int i = 0; i < pieces.Length; i++)
            {
                toreturn[i] = bool.Parse(pieces[i]);
            }
            input.Close();
            return(toreturn);
        }
Exemple #3
0
        public static Message messageFromBlob(string containerName, string blobName)
        {
            StreamReader input = new StreamReader(BlobLibrary.getBlobReadStream(containerName, blobName));

            string[] UBeforePieces = input.ReadLine().Split(space, StringSplitOptions.RemoveEmptyEntries);
            string[] UAfterPieces  = input.ReadLine().Split(space, StringSplitOptions.RemoveEmptyEntries);
            Message  toreturn      = new Message();

            toreturn.UBefore = new Int64[UBeforePieces.Length];
            toreturn.UAfter  = new Int64[UAfterPieces.Length];
            for (int i = 0; i < toreturn.UBefore.Length; i++)
            {
                toreturn.UBefore[i] = Int32.Parse(UBeforePieces[i]);
            }
            for (int i = 0; i < toreturn.UAfter.Length; i++)
            {
                toreturn.UAfter[i] = Int32.Parse(UAfterPieces[i]);
            }


            input.Close();
            return(toreturn);
        }
Exemple #4
0
        public static GlobalState GlobalStateFromBlob(string containerName, string blobName)
        {
            GlobalState  globalState      = new GlobalState();
            const int    S                = 0;
            const int    W                = 1;
            const int    nonStubs         = 2;
            int          currentlyReading = -1;
            StreamReader input            = new StreamReader(BlobLibrary.getBlobReadStream(containerName, blobName));

            while (!input.EndOfStream)
            {
                string   line   = input.ReadLine().ToLower();
                string[] pieces = line.Split(space, StringSplitOptions.RemoveEmptyEntries);
                if (line[0] == '#')
                {
                    if (line.IndexOf("nonstubs") >= 0)
                    {
                        globalState.nonStubs = new List <UInt32>();
                        currentlyReading     = nonStubs;
                    }
                    else if (line.IndexOf("s") >= 0)
                    {
                        Int32 len = Int32.Parse(pieces[1]);
                        globalState.S    = new bool[len];
                        currentlyReading = S;
                    }
                    else if (line.IndexOf("w") >= 0)
                    {
                        Int32 len = Int32.Parse(pieces[1]);
                        globalState.W    = new UInt16[len];
                        currentlyReading = W;
                    }
                }
                else
                {
                    switch (currentlyReading)
                    {
                    case S:
                        for (int i = 0; i < pieces.Length; i++)
                        {
                            globalState.S[i] = bool.Parse(pieces[i]);
                        }
                        break;

                    case W:
                        for (int i = 0; i < pieces.Length; i++)
                        {
                            globalState.W[i] = UInt16.Parse(pieces[i]);
                        }
                        break;

                    case nonStubs:
                        for (int i = 0; i < pieces.Length; i++)
                        {
                            globalState.nonStubs.Add(UInt32.Parse(pieces[i]));
                        }
                        break;
                    }
                }
            }

            input.Close();


            return(globalState);
        }