Exemplo n.º 1
0
        private static List <IpcMessage> ReadMessagesPriv()
        {
            List <IpcMessage> l = new List <IpcMessage>();

            if (!File.Exists(m_strMsgFilePath))
            {
                return(l);
            }

            byte[] pbEnc = File.ReadAllBytes(m_strMsgFilePath);
            byte[] pb    = ProtectedData.Unprotect(pbEnc, IpcOptEnt,
                                                   DataProtectionScope.CurrentUser);

            MemoryStream ms   = new MemoryStream(pb, false);
            BinaryReader br   = new BinaryReader(ms);
            ulong        uSig = br.ReadUInt64();

            if (uSig != IpcFileSig)
            {
                Debug.Assert(false); return(l);
            }
            uint uMessages = br.ReadUInt32();

            for (uint u = 0; u < uMessages; ++u)
            {
                l.Add(IpcMessage.Deserialize(br));
            }

            br.Close();
            ms.Close();
            return(l);
        }