private Surface(ref UInt16 address)
            {
                Address = address;

                // read the
                if (!ROM.TryRead(address++, out VertexOffsetTable))
                {
                    return; // failed
                }
                if (VertexOffsetTable < 0x2000 || VertexOffsetTable > 0x8000)
                {
                    return; // failed
                }
                if (VertexOffsetTable != 0x8000)
                {
                    // read the surface control flags
                    if (!ROM.TryRead(address++, out var flags))
                    {
                        return; // failed
                    }
                    Flags = new FLAGS(flags);
                }

                IsValid = true;
            }
        private BlockGroupDescriptor(byte[] bytes, bool x64)
        {
            if (x64)
            {
                BlockBitmap             = BitConverter.ToUInt32(bytes, 0x20) << 32 | BitConverter.ToUInt32(bytes, 0x00);
                InodeBitmap             = BitConverter.ToUInt32(bytes, 0x24) << 32 | BitConverter.ToUInt32(bytes, 0x04);
                InodeTable              = BitConverter.ToUInt32(bytes, 0x28) << 32 | BitConverter.ToUInt32(bytes, 0x08);
                FreeBlockCount          = (uint)BitConverter.ToUInt16(bytes, 0x2C) << 16 | BitConverter.ToUInt16(bytes, 0x0C);
                FreeInodeCount          = (uint)BitConverter.ToUInt16(bytes, 0x2E) << 16 | BitConverter.ToUInt16(bytes, 0x0E);
                DirectoryCount          = (uint)BitConverter.ToUInt16(bytes, 0x30) << 16 | BitConverter.ToUInt16(bytes, 0x10);
                SnapshotExclusionBitmap = BitConverter.ToUInt32(bytes, 0x34) << 32 | BitConverter.ToUInt32(bytes, 0x14);
                BlockBitmapChecksum     = (uint)BitConverter.ToUInt16(bytes, 0x38) << 16 | BitConverter.ToUInt16(bytes, 0x18);
                InodeBitmapChecksum     = (uint)BitConverter.ToUInt16(bytes, 0x3A) << 16 | BitConverter.ToUInt16(bytes, 0x1C);
                UnusedInodeCount        = (uint)BitConverter.ToUInt16(bytes, 0x32) << 16 | BitConverter.ToUInt16(bytes, 0x1E);
            }
            else
            {
                BlockBitmap             = BitConverter.ToUInt32(bytes, 0x00);
                InodeBitmap             = BitConverter.ToUInt32(bytes, 0x04);
                InodeTable              = BitConverter.ToUInt32(bytes, 0x08);
                FreeBlockCount          = BitConverter.ToUInt16(bytes, 0x0C);
                FreeInodeCount          = BitConverter.ToUInt16(bytes, 0x0E);
                DirectoryCount          = BitConverter.ToUInt16(bytes, 0x10);
                SnapshotExclusionBitmap = BitConverter.ToUInt32(bytes, 0x14);
                BlockBitmapChecksum     = BitConverter.ToUInt16(bytes, 0x18);
                InodeBitmapChecksum     = BitConverter.ToUInt16(bytes, 0x1C);
                UnusedInodeCount        = BitConverter.ToUInt16(bytes, 0x1E);
            }

            Flags    = (FLAGS)BitConverter.ToUInt16(bytes, 0x12);
            Checksum = BitConverter.ToUInt16(bytes, 0x1E);
        }
Exemple #3
0
        public readonly uint ProjectId; //Project ID.

        #endregion Properties

        #region Constructors

        private Inode(byte[] bytes)
        {
            FileMode          = (FILE_MODE)BitConverter.ToUInt16(bytes, 0x00);
            UserId            = BitConverter.ToUInt16(bytes, 0x02);
            i_size_lo         = BitConverter.ToUInt32(bytes, 0x04);
            AccessTime        = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x08));
            ChangeTime        = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x0C));
            ModifiedTime      = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x10));
            DeletionTime      = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x14));
            GroupId           = BitConverter.ToUInt16(bytes, 0x18);
            i_links_count     = BitConverter.ToUInt16(bytes, 0x1A);
            i_blocks_lo       = BitConverter.ToUInt16(bytes, 0x1C);
            Flags             = (FLAGS)BitConverter.ToUInt32(bytes, 0x20);
            osd1              = BitConverter.ToUInt32(bytes, 0x24);
            i_block           = Helper.GetSubArray(bytes, 0x28, 0x3C);
            FileVersion       = BitConverter.ToUInt32(bytes, 0x64);
            i_file_acl_lo     = BitConverter.ToUInt32(bytes, 0x68);
            i_size_high       = BitConverter.ToUInt32(bytes, 0x6C);
            i_obso_faddr      = BitConverter.ToUInt32(bytes, 0x70);
            osd2              = Helper.GetSubArray(bytes, 0x74, 0x0C);
            i_extra_isize     = BitConverter.ToUInt16(bytes, 0x80);
            i_checksum_hi     = BitConverter.ToUInt16(bytes, 0x82);
            ChangeTimeExtra   = BitConverter.ToUInt32(bytes, 0x84);
            ModifiedTimeExtra = BitConverter.ToUInt32(bytes, 0x88);
            AccessTimeExtra   = BitConverter.ToUInt32(bytes, 0x8C);
            CreationTime      = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x90));
            CreationTimeExtra = BitConverter.ToUInt32(bytes, 0x94);
            i_version_hi      = BitConverter.ToUInt32(bytes, 0x98);
            ProjectId         = BitConverter.ToUInt32(bytes, 0x9C);
        }
Exemple #4
0
 protected override bool EqualsRDATA(RR rr)
 {
     return(ORDER.Equals(((NAPTR)rr).ORDER) &&
            PREFERENCE.Equals(((NAPTR)rr).PREFERENCE) &&
            FLAGS.Equals(((NAPTR)rr).FLAGS) &&
            SERVICES.Equals(((NAPTR)rr).SERVICES) &&
            REGEXP.Equals(((NAPTR)rr).REGEXP) &&
            REPLACEMENT.Equals(((NAPTR)rr).REPLACEMENT));
 }
 public static extern ReturnCodes CredUICmdLinePromptForCredentials(
     string targetName,
     IntPtr reserved1,
     int iError,
     StringBuilder userName,
     int maxUserName,
     StringBuilder password,
     int maxPassword,
     ref int iSave,
     FLAGS flags
     );
Exemple #6
0
 private void updateProperty(string property, FLAGS flag)
 {
     if (isHidden(flag))
     {
         HideShowProperty(property, false);
     }
     else
     {
         HideShowProperty(property, true);
     }
 }
Exemple #7
0
 private void updateProperty(PropertyManipulator property, FLAGS flag)
 {
     if (isHidden(flag))
     {
         Manipulator.HideShowProperty(property, false);
     }
     else
     {
         Manipulator.HideShowProperty(property, true);
     }
 }
Exemple #8
0
 public void SetFlag(FLAGS f, bool v)
 {
     if (v)
     {
         status |= (byte)f;
     }
     else
     {
         status &= (byte)~(byte)f;
     }
 }
 public static extern ReturnCodes CredUICmdLinePromptForCredentials(
     string targetName,
     IntPtr reserved1,
     int iError,
     StringBuilder userName,
     int maxUserName,
     StringBuilder password,
     int maxPassword,
     ref int iSave,
     FLAGS flags
     );
        private void CreateFlagForTeam(Bitmap allFlags, int x, int y, string name)
        {
            Bitmap flag = new Bitmap(24, 16);

            using (Graphics gr = Graphics.FromImage(flag))
            {
                gr.Clear(Color.White);
                gr.DrawImage(allFlags, new Rectangle(0, 0, 24, 16), x, y, 24, 16, GraphicsUnit.Pixel);
            }

            FLAGS.Add(name, flag);
        }
Exemple #11
0
        void SetFlag(FLAGS flag, bool v)
        {
            byte f = (byte)flag;

            if (v)
            {
                status |= f;
            }
            else
            {
                status &= (byte)~f; //TODO: need to check this
            }
        }
Exemple #12
0
        public static FLAGS FlagFromName(string name)
        {
            FLAGS flag = FLAGS.FLAG_INVALID;

            if (!String.IsNullOrEmpty(name))
            {
                int id = FlagIDFromName(name);
                if (Enum.IsDefined(typeof(FLAGS), id))
                {
                    flag = (FLAGS)FlagIDFromName(name);
                }
            }
            return(flag);
        }
Exemple #13
0
        public void HideFieldsTemporarly(FLAGS showFlags)
        {
            tempHideFlags = (~showFlags & ~(FLAGS)Flags) & FLAGS.ALLFLAGS;
            //Console.WriteLine(Convert.ToString((int)Flags, 2).PadLeft(32, '0'));
            //Console.WriteLine(Convert.ToString((int)tempHideFlags, 2).PadLeft(32, '0'));

            isTempHidden = true;
            if (!isBehaviorReadOnly)
            {
                isBehaviorReadOnly_tempTrigger = true;
                isBehaviorReadOnly             = true;
            }
            if (!isModelIDReadOnly)
            {
                isModelIDReadOnly_tempTrigger = true;
                isModelIDReadOnly             = true;
            }
            HideProperty(tempHideFlags);
            UpdateProperties();
        }
Exemple #14
0
 public void RevealTemporaryHiddenFields()
 {
     if (isTempHidden)
     {
         if (isBehaviorReadOnly_tempTrigger)
         {
             isBehaviorReadOnly_tempTrigger = false;
             isBehaviorReadOnly             = false;
         }
         if (isModelIDReadOnly_tempTrigger)
         {
             isModelIDReadOnly_tempTrigger = false;
             isModelIDReadOnly             = false;
         }
         UnhideProperty(tempHideFlags);
         UpdateProperties();
         isTempHidden  = false;
         tempHideFlags = 0;
     }
 }
Exemple #15
0
        public byte GetFlag(FLAGS flag)
        {
            byte f = (byte)flag;

            return(((status & f) > 0) ? (byte)1 : (byte)0);
        }
Exemple #16
0
 public bool CheckFlag(FLAGS flag)
 {
     return((flags & flag) != 0);
 }
 public void UnSetFlag(FLAGS flag)
 {
     flags &= ~flag;
 }
 public void SetFlag(FLAGS flag)
 {
     flags |= flag;
 }
 public bool CheckFlag(FLAGS flag)
 {
     return (flags & flag) != 0;
 }
Exemple #20
0
 public bool isPropertyShown(FLAGS flag)
 {
     return(!isHidden(flag));
 }
Exemple #21
0
 public void HideProperty(FLAGS flag)
 {
     Flags |= (ulong)flag;
 }
Exemple #22
0
 private void updateProperty(string property, FLAGS flag)
 {
     updateProperty(Manipulator[property], flag);
 }
Exemple #23
0
 public void UnSetFlag(FLAGS flag)
 {
     flags &= ~flag;
 }
Exemple #24
0
 // Methods
 public bool HasFlag(FLAGS flag)
 {
     return((Flags & (uint)flag) == (uint)flag);
 }
Exemple #25
0
 public byte GetFlag(FLAGS f)
 {
     return((byte)(((byte)(status & (byte)f) > 0) ? 1 : 0));
 }
Exemple #26
0
 public void UnhideProperty(FLAGS flag)
 {
     Flags &= ~(ulong)flag;
 }
Exemple #27
0
 protected bool hasFlag(FLAGS flag, byte b)
 {
     return hasFlag((byte)flag, b);
 }
Exemple #28
0
 public void SetFlag(FLAGS flag)
 {
     flags |= flag;
 }
Exemple #29
0
        public static string FlagDisplayName(FLAGS flag)
        {
            int idx = (int)flag;

            return(FLAG_NAMES[idx]);
        }
Exemple #30
0
 protected void setFlag(FLAGS flag, bool unset, ref byte b)
 {
     setFlag((byte)flag, unset, ref b);
 }
Exemple #31
0
        public readonly uint Checksum; //Superblock checksum.

        #endregion Properties

        #region Constructors

        private Superblock(byte[] bytes)
        {
            InodeCount = BitConverter.ToUInt32(bytes, 0x00);
            BlockCount = (uint)1024 << BitConverter.ToInt32(bytes, 0x04);
            //BitConverter.ToUInt32(bytes, 0x150) << 32 | BitConverter.ToUInt32(bytes, 0x04);
            RootBlockCount     = BitConverter.ToUInt32(bytes, 0x154) << 32 | BitConverter.ToUInt32(bytes, 0x08);
            FreeBlockCount     = BitConverter.ToUInt32(bytes, 0x158) << 32 | BitConverter.ToUInt32(bytes, 0x0C);
            FreeInodeCount     = BitConverter.ToUInt32(bytes, 0x10);
            FirstDataBlock     = BitConverter.ToUInt32(bytes, 0x14);
            BlockSize          = (uint)Math.Pow(2, (10 + BitConverter.ToUInt32(bytes, 0x18)));
            ClusterSize        = (uint)Math.Pow(2, BitConverter.ToUInt32(bytes, 0x1C));
            BlocksPerGroup     = BitConverter.ToUInt32(bytes, 0x20);
            ClustersPerGroup   = BitConverter.ToUInt32(bytes, 0x24);
            InodesPerGroup     = BitConverter.ToUInt32(bytes, 0x28);
            MountTime          = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x2C));
            WriteTime          = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x30));
            MountCount         = BitConverter.ToUInt16(bytes, 0x34);
            MaxMountCount      = BitConverter.ToUInt16(bytes, 0x36);
            Magic              = BitConverter.ToUInt16(bytes, 0x38);
            State              = (STATE)BitConverter.ToUInt16(bytes, 0x3A);
            Errors             = (ERRORS)BitConverter.ToUInt16(bytes, 0x3C);
            MinorRevisionLevel = BitConverter.ToUInt16(bytes, 0x3E);
            LastCheck          = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x40));
            CheckInterval      = BitConverter.ToUInt32(bytes, 0x44);
            CreatorOs          = (CREATOR_OS)BitConverter.ToUInt32(bytes, 0x48);
            RevisionLevel      = (REVISION_LEVEL)BitConverter.ToUInt32(bytes, 0x4C);
            DefaultUserId      = BitConverter.ToUInt16(bytes, 0x50);
            DefaultGroupId     = BitConverter.ToUInt16(bytes, 0x52);
            FirstInode         = BitConverter.ToUInt32(bytes, 0x54);
            InodeSize          = BitConverter.ToUInt16(bytes, 0x58);
            BlockGroupNumber   = BitConverter.ToUInt16(bytes, 0x5A);
            FeatureCompat      = (FEATURE_COMPAT)BitConverter.ToUInt32(bytes, 0x5C);
            FeatureIncompat    = (FEATURE_INCOMPAT)BitConverter.ToUInt32(bytes, 0x60);
            FeatureRoCompat    = (FEATURE_RO_COMPAT)BitConverter.ToUInt32(bytes, 0x64);
            Uuid                        = new Guid(Helper.GetSubArray(bytes, 0x68, 0x10));
            VolumeName                  = Encoding.ASCII.GetString(bytes, 0x78, 0x10).TrimEnd('\0');
            LastMountedDirectory        = Encoding.ASCII.GetString(bytes, 0x88, 0x40).TrimEnd('\0');
            AlgorithmUsageBitmap        = BitConverter.ToUInt32(bytes, 0xC8);
            PreallocatedBlocks          = bytes[0xCC];
            PreallocatedDirectoryBlocks = bytes[0xCD];
            ReservedGdtBlocks           = BitConverter.ToUInt16(bytes, 0xCE);
            JournalUuid                 = new Guid(Helper.GetSubArray(bytes, 0xD0, 0x10));
            JournalInode                = BitConverter.ToUInt32(bytes, 0xE0);
            JournalDevice               = BitConverter.ToUInt32(bytes, 0xE4);
            LastOrphanedList            = BitConverter.ToUInt32(bytes, 0xE8);
            HashSeed                    = BitConverter.ToUInt32(bytes, 0xEC);
            DefaultHashVersion          = (DEFAULT_HASH_VERSION)bytes[0xFC];
            JournalBackupType           = bytes[0xFD];
            GroupDescriptorSize         = BitConverter.ToUInt16(bytes, 0xFE);
            DefaultMountOptions         = (DEFAULT_MOUNT_OPTIONS)BitConverter.ToUInt32(bytes, 0x100);
            FirstMetablockBlockGroup    = BitConverter.ToUInt32(bytes, 0x104);
            MkfsTime                    = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x108));
            JournalBlocks               = BitConverter.ToUInt32(bytes, 0x10C);
            MinimumExtraInodeSize       = BitConverter.ToUInt16(bytes, 0x15C);
            DesiredInodeSize            = BitConverter.ToUInt16(bytes, 0x15E);
            Flags                       = (FLAGS)BitConverter.ToUInt32(bytes, 0x160);
            RaidStride                  = BitConverter.ToUInt16(bytes, 0x164);
            MmpInterval                 = BitConverter.ToUInt16(bytes, 0x166);
            MmpBlock                    = BitConverter.ToUInt64(bytes, 0x168);
            RaidStipeWidth              = BitConverter.ToUInt32(bytes, 0x170);
            FlexibleBlockGroupSize      = (uint)Math.Pow(2, bytes[0x174]);
            ChecksumType                = (CHECKSUM_TYPE)bytes[0x175];
            KBytesWritten               = BitConverter.ToUInt64(bytes, 0x178);
            SnapshotInode               = BitConverter.ToUInt32(bytes, 0x180);
            SnapshotId                  = BitConverter.ToUInt32(bytes, 0x184);
            ReservedSnapshotBlockCount  = BitConverter.ToUInt64(bytes, 0x188);
            SnapshotListInode           = BitConverter.ToUInt32(bytes, 0x190);
            ErrorCount                  = BitConverter.ToUInt32(bytes, 0x194);
            FirstErrorTime              = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x198));
            FirstErrorInode             = BitConverter.ToUInt32(bytes, 0x19C);
            FirstErrorBlock             = BitConverter.ToUInt64(bytes, 0x1A0);
            FirstErrorFunction          = Encoding.ASCII.GetString(bytes, 0x1A8, 0x20).TrimEnd('\0');
            FirstErrorLine              = BitConverter.ToUInt32(bytes, 0x1C8);
            LastErrorTime               = Helper.FromUnixTime(BitConverter.ToUInt32(bytes, 0x1CC));
            LastErrorInode              = BitConverter.ToUInt32(bytes, 0x1D0);
            LastErrorLine               = BitConverter.ToUInt32(bytes, 0x1D4);
            LastErrorBlock              = BitConverter.ToUInt64(bytes, 0x1D8);
            LastErrorFunction           = Encoding.ASCII.GetString(bytes, 0x1E0, 0x20).TrimEnd('\0');
            MountOptions                = Encoding.ASCII.GetString(bytes, 0x200, 0x40).TrimEnd('\0');
            UserQuotaInode              = BitConverter.ToUInt32(bytes, 0x240);
            GroupQuotaInode             = BitConverter.ToUInt32(bytes, 0x244);
            OverheadBlocks              = BitConverter.ToUInt32(bytes, 0x248);
            SuperblockBackupBlockGroup  = BitConverter.ToUInt32(bytes, 0x24C);
            EncryptionAlgorithms        = (ENCRYPTION_ALGORITHMS)BitConverter.ToUInt32(bytes, 0x254);
            EncryptPasswordSalt         = bytes[0x258];
            LostAndFoundInode           = BitConverter.ToUInt32(bytes, 0x268);
            ProjectQuotaInode           = BitConverter.ToUInt32(bytes, 0x26C);
            ChecksumSeed                = BitConverter.ToUInt32(bytes, 0x270);
            Checksum                    = BitConverter.ToUInt32(bytes, 0x3FC);
        }
Exemple #32
0
 private bool isHidden(FLAGS flag)
 {
     return((Flags & (ulong)flag) == (ulong)flag);
 }