public static void Write(UnsignedWriter writer, byte dirorfile, uint hash, ulong sector, uint which)
 {
     writer.Advance(8U + (which * 13U));
     writer.Write8(dirorfile);
     writer.Write32(hash);
     writer.Write64(sector);
 }
        /// <summary>
        /// Formats a partition with Praxis
        /// </summary>
        /// <param name="part">Partition to format with Praxis</param>
        public Praxis(Partition part, bool format)
        {
            partition = part;
            byte[] c0 = part.readCluster(0);
            fixed(byte *ptr = c0)
            {
                if (format)
                {
                    UnsignedWriter writer = new UnsignedWriter(ptr);
                    writer.Advance(0x0020);             //Label, ASCII not implemented, so will advance until then
                    writer.Write16(0xF00F);             //if 0xF00F then drive is formatted
                    writer.Write64(0x0000);             //Used clusters
                    writer.Write32(0x0000);             //Used entries
                    writer.Write16(0x0001);             //Major version
                    writer.Write16(0x0000);             //Minor version
                    writer.Write32(0x0000);             //Bug fixes
                    writer.Write64(0x646E454878617250); //UTF8 for PraxHEnd
                }
                UnsignedReader reader = new UnsignedReader(ptr);

                reader.Advance(42);
                totalEntries = reader.Read32();
            }

            partition.writeCluster(0, c0);
        }
Example #3
0
 public static void setNextSector(byte[] listing, ulong sector)
 {
     fixed (byte* ptr = listing) {
         UnsignedWriter w = new UnsignedWriter(ptr);
         w.Write64(sector);
     }
 }
Example #4
0
 public static void Write(UnsignedWriter writer, byte dirorfile, uint hash, ulong sector, uint which)
 {
     writer.Advance(8U + (which * 13U));
     writer.Write8(dirorfile);
     writer.Write32(hash);
     writer.Write64(sector);
 }
        public static void setNextSector(byte[] listing, ulong sector)
        {
            fixed(byte *ptr = listing)
            {
                UnsignedWriter w = new UnsignedWriter(ptr);

                w.Write64(sector);
            }
        }
        //Each listing has the ulong next cluster in front, followed by the Entries(byte isdirectory(0xF0 file, 0x0F directory), uint hash, ulong sector)
        public static void writeEntry(byte[] listing, uint i, EntryStruct entry)
        {
            fixed(byte *ptr = listing)
            {
                UnsignedWriter w = new UnsignedWriter(ptr);

                w.Advance(8 + (i * 13));
                w.Write8(entry.isDirectory);
                w.Write32(entry.hash);
                w.Write64(entry.sector);
            }
        }
        public void incAvailable()
        {
            nextAvailableSector++;
            byte[] c0 = partition.readCluster(0);
            fixed(byte *ptr = c0)
            {
                UnsignedWriter writer = new UnsignedWriter(ptr);

                writer.Write64AtOffset(nextAvailableSector, 34);
            }

            partition.writeCluster(0UL, c0);
        }
        public void incTotalEntries()
        {
            totalEntries++;
            byte[] c0 = partition.readCluster(0);
            fixed(byte *ptr = c0)
            {
                UnsignedWriter reader = new UnsignedWriter(ptr);

                reader.Write32AtOffset(totalEntries, 42);
            }

            partition.writeCluster(0UL, c0);
        }
        public void writeEntry(byte dirorfile, uint hash, ulong sector)
        {
            byte[] c1 = partition.readCluster(1UL);
            fixed(byte *ptr = c1)
            {
                UnsignedWriter c1W = new UnsignedWriter(ptr);

                c1W.Advance(1U);
                Entry.Write(c1W, dirorfile, hash, sector, totalEntries);
                incTotalEntries();
            }

            partition.writeCluster(1UL, c1);
        }
Example #10
0
 //Each listing has the ulong next cluster in front, followed by the Entries(byte isdirectory(0xF0 file, 0x0F directory), uint hash, ulong sector)
 public static void writeEntry(byte[] listing, uint i, EntryStruct entry)
 {
     fixed (byte* ptr = listing) {
         UnsignedWriter w = new UnsignedWriter(ptr);
         w.Advance(8 + (i * 13));
         w.Write8(entry.isDirectory);
         w.Write32(entry.hash);
         w.Write64(entry.sector);
     }
 }
Example #11
0
 public void writeEntry(byte dirorfile, uint hash, ulong sector)
 {
     byte[] c1 = partition.readCluster(1UL);
     fixed (byte* ptr = c1) {
         UnsignedWriter c1W = new UnsignedWriter(ptr);
         c1W.Advance(1U);
         Entry.Write(c1W, dirorfile, hash, sector, totalEntries);
         incTotalEntries();
     }
     partition.writeCluster(1UL, c1);
 }
Example #12
0
 public void incTotalEntries()
 {
     totalEntries++;
     byte[] c0 = partition.readCluster(0);
     fixed (byte* ptr = c0)
     {
         UnsignedWriter reader = new UnsignedWriter(ptr);
         reader.Write32AtOffset(totalEntries, 42);
     }
     partition.writeCluster(0UL, c0);
 }
Example #13
0
 public void incAvailable()
 {
     nextAvailableSector++;
     byte[] c0 = partition.readCluster(0);
     fixed (byte* ptr = c0)
     {
         UnsignedWriter writer = new UnsignedWriter(ptr);
         writer.Write64AtOffset(nextAvailableSector, 34);
     }
     partition.writeCluster(0UL, c0);
 }
Example #14
0
 /// <summary>
 /// Formats a partition with Praxis
 /// </summary>
 /// <param name="part">Partition to format with Praxis</param>
 public Praxis(Partition part, bool format)
 {
     partition = part;
     byte[] c0 = part.readCluster(0);
     fixed (byte* ptr = c0) {
         if (format) {
             UnsignedWriter writer = new UnsignedWriter(ptr);
             writer.Advance(0x0020); //Label, ASCII not implemented, so will advance until then
             writer.Write16(0xF00F); //if 0xF00F then drive is formatted
             writer.Write64(0x0000); //Used clusters
             writer.Write32(0x0000); //Used entries
             writer.Write16(0x0001); //Major version
             writer.Write16(0x0000); //Minor version
             writer.Write32(0x0000); //Bug fixes
             writer.Write64(0x646E454878617250); //UTF8 for PraxHEnd
         }
         UnsignedReader reader = new UnsignedReader(ptr);
         reader.Advance(42);
         totalEntries = reader.Read32();
     }
     partition.writeCluster(0, c0);
 }