當前位置: 首頁>>代碼示例>>C#>>正文


C# Flags.HasFlag方法代碼示例

本文整理匯總了C#中System.Flags.HasFlag方法的典型用法代碼示例。如果您正苦於以下問題:C# Flags.HasFlag方法的具體用法?C# Flags.HasFlag怎麽用?C# Flags.HasFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Flags的用法示例。


在下文中一共展示了Flags.HasFlag方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Move

        /// <summary>
        /// Constructor for pawn promotions moves
        /// </summary>
        public Move(int from_cell, int to_cell, Flags flags, Exports.Pieces promote_to)
        {
            Debug.Assert(flags.HasFlag(Flags.Promotion));
            Debug.Assert(!(flags.HasFlag(Flags.EnPassantCapture)
                || flags.HasFlag(Flags.ShortCastle) || flags.HasFlag(Flags.LongCastle)));
            Debug.Assert(promote_to == Exports.Pieces.Knight
                || promote_to == Exports.Pieces.Bishop
                || promote_to == Exports.Pieces.Rook
                || promote_to == Exports.Pieces.Queen);

            m_data = new Bitmask32();
            Init((int)Exports.Pieces.Pawn, from_cell, to_cell, (int)flags,
                (int)promote_to);
        }
開發者ID:maksimbulva,項目名稱:chesshive,代碼行數:17,代碼來源:Move.cs

示例2: Save

        public static void Save(BinaryWriter bw, DDS dds)
        {
            Flags flags = (Flags.Caps | Flags.Height | Flags.Width | Flags.PixelFormat | Flags.MipMapCount);
            flags |= (dds.format == D3DFormat.A8R8G8B8 ? Flags.Pitch : Flags.LinearSize);

            bw.Write(new byte[] { 0x44, 0x44, 0x53, 0x20 });    // 'DDS '
            bw.Write(124);
            bw.Write((int)flags);
            bw.Write(dds.Height);
            bw.Write(dds.Width);
            bw.Write((flags.HasFlag(Flags.Pitch) ? dds.width * 4 : dds.MipMaps[0].Data.Length));
            bw.Write(dds.Depth);
            bw.Write(dds.MipMaps.Count);

            for (int i = 0; i < 11; i++) { bw.Write(0); }

            // PixelFormat
            bw.Write(32);

            switch (dds.Format)
            {
                case D3DFormat.DXT1:
                case D3DFormat.DXT3:
                case D3DFormat.DXT5:
                    bw.Write(4);        // fourCC length
                    bw.Write(dds.Format.ToString().ToCharArray());
                    bw.Write(0);
                    bw.Write(0);
                    bw.Write(0);
                    bw.Write(0);
                    bw.Write(0);
                    break;

                default:
                    bw.Write(0);    // fourCC length
                    bw.Write(0);
                    bw.Write(32);   //  RGB bit count
                    bw.Write(255 << 16);    // R mask
                    bw.Write(255 << 8);     // G mask
                    bw.Write(255 << 0);     // B mask
                    bw.Write(255 << 24);    // A mask
                    break;
            }

            bw.Write((int)DDSCaps.DDSCAPS_TEXTURE);
            bw.Write(0);    // Caps 2
            bw.Write(0);    // Caps 3
            bw.Write(0);    // Caps 4
            bw.Write(0);    // Reserved

            for (int i = 0; i < dds.mipMaps.Count; i++)
            {
                bw.Write(dds.mipMaps[i].Data);
            }
        }
開發者ID:DevilboxGames,項目名稱:ToxicRagers,代碼行數:55,代碼來源:cDDS.cs

示例3: Execute


//.........這裏部分代碼省略.........

                // HALT
                case 0x76:
                    cycles = 1;
                    halted = true;
                    break;

                // STOP
                case 0x10:
                    cycles = 1;
                    if (mmu.ReadByte(pc) == 0x00)
                    {
                        pc++; halted = true;
                        // Dunno what to do from here.
                    }
                    break;

                // Disable Interrupt
                case 0xF3:
                    cycles = 1;
                    diTimer = 1;
                    break;

                // Enable Interrupt
                case 0xFB:
                    cycles = 1;
                    eiTimer = 1;
                    break;

                // Rotate Left
                case 0x07: cycles = 1; a = rotateLeft(a); break;

                // Rotate Left through Carry
                case 0x17: cycles = 1; a = rotateLeft(a); if (f.HasFlag(Flags.Carry)) a++; break;

                // Rotate Right
                case 0x0F: cycles = 1; a = rotateRight(a); break;

                // Rotate Right through Carry
                case 0x1F: cycles = 1; a = rotateRight(a); if (f.HasFlag(Flags.Carry)) a += 0x80; break;

                // Restart
                case 0xC7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x00; break;
                case 0xCF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x08; break;
                case 0xD7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x10; break;
                case 0xDF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x18; break;
                case 0xE7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x20; break;
                case 0xEF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x28; break;
                case 0xF7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x30; break;
                case 0xFF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x38; break;

            #endregion

            #region Jumps
                // Jump
                case 0xC3:
                    cycles = 3;
                    pc = (ushort)(mmu.ReadByte(pc++) | ((mmu.ReadByte(pc++)) << 8));
                    break;

                case 0xE9:
                    cycles = 1;
                    pc = mmu.ReadByte(hl); break;
                case 0x18:
                    cycles = 2;
                    pc = (ushort)((short)pc + (short)(unchecked((sbyte)mmu.ReadByte(pc++))));
開發者ID:Goatmancer,項目名稱:GameBoySharp,代碼行數:67,代碼來源:CPU.cs


注:本文中的System.Flags.HasFlag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。