Example #1
0
        /// <summary>
        /// Prints this instance.
        /// </summary>
        private void Print()
        {
            Console.WriteLine();
            Console.WriteLine("MBDB");
            Console.WriteLine("  Domain          : " + this.Domain);
            Console.WriteLine("  Path            : " + this.Path);
            Console.WriteLine("  Link Target     : " + this.LinkTarget == "");
            Console.WriteLine("  Data Hash       : " + this.DataHash);
            Console.WriteLine("  Unknown I       : " + this.Unknown_I);
            Console.WriteLine("  File Mode       : " + this.RecordMode);
            Console.WriteLine("  Unknown II      : " + this.Unknown_II);
            Console.WriteLine("  User ID         : " + this.UserId.ToString());
            Console.WriteLine("  Group ID        : " + this.GroupId.ToString());
            Console.WriteLine("  Time I          : " + InternalUtilities.EpochTimeToString((int)this.LastModifiedTime));
            Console.WriteLine("  Time II         : " + InternalUtilities.EpochTimeToString((int)this.LastAccessTime));
            Console.WriteLine("  Time III        : " + InternalUtilities.EpochTimeToString((int)this.CreationTime));
            Console.WriteLine("  File Length     : " + this.FileLength.ToString());
            Console.WriteLine("  Flag            : " + this.ProtectionClass.ToString());
            Console.WriteLine("  Property Ct     : " + this.PropertyCount.ToString());
            Console.WriteLine("  Filename (Hash) : " + this.FilenameAsHash + " (" + this.FilenameAsHashExists() + ")");

            foreach (string propKey in this.Properties.Keys)
            {
                Console.WriteLine("    " + propKey + " ==> " + this.Properties[propKey]);
            }

            Console.WriteLine();
        }
Example #2
0
        internal static Int32 ReadInt32Value(Stream stream)
        {
            byte[] bBuffer = new byte[4];
            InternalUtilities.CopyStreamToBuffer(stream, ref bBuffer);

            return(BitConverter.ToInt32(bBuffer, 0));
        }
Example #3
0
        internal static UInt64 ReadUInt64Value(Stream stream)
        {
            byte[] bBuffer = new byte[8];
            InternalUtilities.CopyStreamToBuffer(stream, ref bBuffer);

            return(BitConverter.ToUInt64(bBuffer, 0));
        }
Example #4
0
        /// <summary>
        /// Reads the file, and closes the stream related to it.
        /// </summary>
        public void ReadFile()
        {
            while (_fsMbdb.Position < _fsMbdb.Length)
            {
                MbdbRecord mbdbRec = new MbdbRecord();
                mbdbRec.Domain           = InternalUtilities.ReadStringValue(_fsMbdb);
                mbdbRec.Path             = InternalUtilities.ReadStringValue(_fsMbdb);
                mbdbRec.LinkTarget       = InternalUtilities.ReadStringValue(_fsMbdb);
                mbdbRec.DataHash         = InternalUtilities.ReadStringValue(_fsMbdb);
                mbdbRec.Unknown_I        = InternalUtilities.ReadStringValue(_fsMbdb);
                mbdbRec.Mode             = InternalUtilities.ReadUInt16Value(_fsMbdb);
                mbdbRec.iNodeLookup      = InternalUtilities.ReadUInt64Value(_fsMbdb);
                mbdbRec.UserId           = InternalUtilities.ReadUInt32Value(_fsMbdb);
                mbdbRec.GroupId          = InternalUtilities.ReadUInt32Value(_fsMbdb);
                mbdbRec.LastModifiedTime = InternalUtilities.ReadUInt32Value(_fsMbdb);
                mbdbRec.LastAccessTime   = InternalUtilities.ReadUInt32Value(_fsMbdb);
                mbdbRec.CreationTime     = InternalUtilities.ReadUInt32Value(_fsMbdb);
                mbdbRec.FileLength       = InternalUtilities.ReadUInt64Value(_fsMbdb);
                mbdbRec.ProtectionClass  = (byte)_fsMbdb.ReadByte();
                mbdbRec.PropertyCount    = (byte)_fsMbdb.ReadByte();

                mbdbRec.Properties = new Dictionary <string, string>();

                for (int i = 0; i < mbdbRec.PropertyCount; i++)
                {
                    string propName = InternalUtilities.ReadStringValue(_fsMbdb);
                    string propVal  = InternalUtilities.ReadPropertyValue(_fsMbdb);
                    mbdbRec.Properties.Add(propName, propVal);
                }

                this.MbdbRecords.Add(mbdbRec);
            }

            _fsMbdb.Close();
        }