public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] BType bType)
        {
            if (id != bType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BTypeExists(bType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bType));
        }
示例#2
0
        public FormDbSearch(BType type, uint val)
        {
            _type = type;
            _val  = val;
            InitializeComponent();

            Init();
        }
示例#3
0
        public FormDbSearch(BType type, uint val)
        {
            _type = type;
            _val  = val;
            InitializeComponent();

            Init();
        }
示例#4
0
 public AbstBook(String t, String a, BType ty, int prd)
 {
     title      = t;
     author     = a;
     type       = ty;
     returnDate = DateTime.Today;
     pricePerDayOverduedInCents = prd;
     this.id = new Random().Next();
 }
示例#5
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            BType bType = await db.BTypes.FindAsync(id);

            db.BTypes.Remove(bType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#6
0
        public Bonus(String ID, BType _BonusType)
        {
            BSprite = new Sprite();

            BSprite.depth = 0.9f;

            this.ID = ID;

            this.BonusType = _BonusType;
        }
示例#7
0
        /// <summary>
        /// Creates a button to search for values in a collection
        /// </summary>
        /// <param name="combobox">Element around which to create a button</param>
        /// <param name="btype">Button type</param>
        public ButtonHandler(ComboBox combobox, BType btype, ComboBox combobox2, int combobox2Val)
        {
            _combobox           = combobox;
            _comboboxAdditional = combobox2;
            _additionalValue    = combobox2Val;
            _combobox.Size      = ComboboxSize;
            _bType              = btype;

            CreateButton("Search");
        }
示例#8
0
        /// <summary>
        /// Создает кнопку для поиска значения в какой-то коллекции
        /// </summary>
        /// <param name="combobox">Елемент возле которого необходимо создать кнопку</param>
        /// <param name="btype">Тип кнопки</param>
        public ButtonHandler(ComboBox combobox, BType btype, ComboBox combobox2 = null, int combobox2Val = 0)
        {
            _combobox           = combobox;
            _comboboxAdditional = combobox2;
            _additionalValue    = combobox2Val;
            _combobox.Size      = ComboboxSize;
            _bType = btype;

            CreateButton("Поиск");
        }
示例#9
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] BType bType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(bType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(bType));
        }
示例#10
0
        public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] BType bType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bType));
        }
示例#11
0
文件: CBFile.cs 项目: techienickb/hap
 public CBFile(DirectoryInfo dir, UNCPath unc, User user)
 {
     Extension    = dir.Extension;
     Type         = "File Folder";
     Name         = dir.Name;
     Icon         = "images/icons/" + MyComputerItem.ParseForImage(dir);
     BType        = ComputerBrowser.BType.Folder;
     CreatedTime  = dir.CreationTime;
     ModifiedTime = dir.LastWriteTime;
     Path         = Converter.UNCtoDrive(dir.FullName, unc, user);
 }
示例#12
0
 public ComputerBrowserAPIItem(string name, string icon, string size, string type, BType btype, string path, AccessControlActions access, [Optional, DefaultParameterValue("")] string download)
 {
     Name          = name;
     Icon          = icon;
     Type          = type;
     Size          = size;
     BType         = btype;
     Path          = path;
     AccessControl = access;
     Download      = download;
 }
示例#13
0
        /// <summary>
        /// Создает кнопку для вызова формы подсчета флагов
        /// </summary>
        /// <typeparam name="T">Тип флага</typeparam>
        /// <param name="combobox">Елемент возле которого необходимо создать кнопку</param>
        public ButtonHandler(ComboBox combobox, Type type, ComboBox combobox2 = null, int combobox2Val = 0)
        {
            _type               = type;
            _combobox           = combobox;
            _comboboxAdditional = combobox2;
            _additionalValue    = combobox2Val;
            _combobox.Size      = ComboboxSize;
            _bType              = BType.FLAG;

            CreateButton("Флаг");
        }
示例#14
0
 public ComputerBrowserAPIItem(string name, string icon, string size, string type, BType btype, string path, string access, [Optional, DefaultParameterValue("")] string download)
 {
     Name          = name;
     Icon          = icon;
     Type          = type;
     Size          = size;
     BType         = btype;
     Path          = path;
     Download      = download;
     AccessControl = (AccessControlActions)Enum.Parse(typeof(AccessControlActions), access, true);
 }
示例#15
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] BType bType)
        {
            if (ModelState.IsValid)
            {
                db.BTypes.Add(bType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(bType));
        }
示例#16
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BType bType = await db.BTypes.FindAsync(id);

            if (bType == null)
            {
                return(HttpNotFound());
            }
            return(View(bType));
        }
示例#17
0
 /// <summary>
 /// ボタンを押した際の処理
 /// </summary>
 /// <param name="type"></param>
 private void ButtonPush(BType type)
 {
     if (type == BType.close)
     {
         Close();
     }
     else if (type == BType.save)
     {
         Save();
     }
     else
     {
         DebugCommand.DebugLog("挙動が設定されてません");
     }
 }
示例#18
0
文件: CBFile.cs 项目: techienickb/hap
        public CBFile(FileInfo file, UNCPath unc, User user)
        {
            Extension = file.Extension;
            Type      = "File";
            Name      = file.Name + (file.Name.Contains(file.Extension) ? "" : file.Extension);

            FileIcon fi;

            if (FileIcon.TryGet(Extension, out fi))
            {
                Type = fi.Type;
                Name = Name.Remove(Name.LastIndexOf(file.Extension));
            }
            if (Type == "File")
            {
                try
                {
                    RegistryKey rkRoot = Registry.ClassesRoot;
                    string      keyref = rkRoot.OpenSubKey(file.Extension).GetValue("").ToString();
                    Type = rkRoot.OpenSubKey(keyref).GetValue("").ToString();
                    Name = Name.Remove(Name.LastIndexOf(file.Extension));
                }
                catch { Type = "File"; }
            }
            if (Type != "File")
            {
                Icon = "images/icons/" + ParseForImage(file);
                if (Icon.EndsWith(".ico"))
                {
                    Icon = "api/mycomputer/" + ParseForImage(file);
                }
            }
            else
            {
                Icon = "images/icons/file.png";
            }
            if (file.Extension.ToLower().Equals(".png") || file.Extension.ToLower().Equals(".jpg") || file.Extension.ToLower().Equals(".jpeg") || file.Extension.ToLower().Equals(".gif") || file.Extension.ToLower().Equals(".bmp") || file.Extension.ToLower().Equals(".wmf"))
            {
                Icon = "api/mycomputer/thumb/" + Converter.UNCtoDrive2(file.FullName, unc, user).Replace('&', '^');
            }
            BType        = ComputerBrowser.BType.File;
            CreatedTime  = file.CreationTime;
            ModifiedTime = file.LastWriteTime;
            Size         = parseLength(file.Length);
            Path         = Converter.UNCtoDrive(file.FullName, unc, user);
        }
示例#19
0
    public int Revitalize(int resources)
    {
        // revitalize/grow a leaf branch
        // return the amount of resources consumed
        if (type != BType.Old)
        {
            return(0);
        }
        var consumed = Math.Min(maxProgress - progress, resources);

        progress += consumed;
        if (progress == maxProgress)
        {
            type     = BType.Growing;
            progress = 0;
        }
        return(consumed);
    }
示例#20
0
    public FoxSystemButton()
    {
        borderColor = FoxSettings.BorderColor;
        textColor   = FoxSettings.TextColor;
        fillColor   = FoxSettings.FillheaderColor;
        downColor   = FoxSettings.DownColor;
        upColor     = FoxSettings.UpColor;

        stringformat = new StringFormat {
            Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center
        };
        textFont = FoxSettings.TextFont;

        //Set defaults
        Font       = FoxSettings.TextFont;
        ForeColor  = textColor.Color;
        ButtonType = BType.Close;
        Size       = new Size(14, 14);
    }
    public IEnumerable <ParsedValue> GetParsedValues()
    {
        foreach (var parsedValue in AType.GetParsedValues())
        {
            yield return(parsedValue);
        }
        foreach (var parsedValue in BType.GetParsedValues())
        {
            yield return(parsedValue);
        }

        foreach (var cType in CTypes)
        {
            foreach (var parsedValue in cType.GetParsedValues())
            {
                yield return(parsedValue);
            }
        }
    }
示例#22
0
    /// <summary>
    /// ボタンを押した際の処理
    /// </summary>
    /// <param name="type"></param>
    private void ButtonPush(BType type)
    {
        GameObject soundObj = Instantiate(sound);

        soundObj.GetComponent <SE>().SetClip(se[1]);

        if (type == BType.start)
        {
            StartPush();
            player.PlayerState = TitlePlayer.State.DASH;
        }
        else if (type == BType.option)
        {
            OptionPush();
        }
        else
        {
            DebugCommand.DebugLog("挙動が設定されてません");
        }
    }
示例#23
0
文件: BH.cs 项目: x2x/EventAICreator
        public BH(ComboBox combobox, BType btype, Pos pos)
        {
            _combobox = combobox;
            _button   = new Button();

            switch (pos)
            {
            case Pos.POSA1: _button.Location = new Point(X, 58); break;

            case Pos.POSA2: _button.Location = new Point(X, 102); break;

            case Pos.POSA3: _button.Location = new Point(X, 148); break;

            case Pos.POST1: _button.Location = new Point(X, 67); break;

            case Pos.POST2: _button.Location = new Point(X, 114); break;

            case Pos.POST3: _button.Location = new Point(X, 159); break;

            case Pos.POST4: _button.Location = new Point(X, 209); break;
            }
            switch (btype)
            {
            case BType.SPELL: _button.Click += new EventHandler(ShowSpellForm); break;

            case BType.CREATURE: _button.Click += new EventHandler(ShowCreatureForm); break;

            case BType.ITEM: _button.Click += new EventHandler(ShowItemForm); break;

            case BType.QUEST: _button.Click += new EventHandler(ShowQuestForm); break;

            case BType.EVENT: _button.Click += new EventHandler(ShowEventForm); break;
            }

            _button.ImeMode = ImeMode.NoControl;
            _button.Size    = SIZE;
            _button.Text    = "Поиск";
            _button.UseVisualStyleBackColor = true;
            ((GroupBox)combobox.Parent).Controls.Add(_button);
        }
示例#24
0
        public static Bitmap MakeBarCode(BType type, string lpszText, int nNarrow, int nWide, int nHeight, int nRotate, int nReadable)
        {
            //  可在错误返回值,一般设置成0即可。如果需要函数弹出错误信息提示,可将此值设置为 3
            int err = 0;

            //  调用DLL,造成条码位图
            IntPtr hBitmap = DLL_MakeBarCode((int)type, lpszText, nNarrow, nWide, nHeight, nRotate, nReadable, ref err);

            //  需要判断返回句柄是否为空,如果为空,则表示生成位图失败
            if (hBitmap == IntPtr.Zero)
            {
                return(null);
            }

            //  创建返回的Bitmap
            Bitmap bm = Bitmap.FromHbitmap(hBitmap);

            //  删除 HBITMAP句柄 (很重要,必需删除)
            DLL_DeleteHBitmap(hBitmap);

            return(bm);
        }
示例#25
0
        /// <summary>
        /// Creates a button to call the form of counting flags 
        /// </summary>
        /// <typeparam name="T">Type flag</typeparam>
        /// <param name="combobox">Yelement around which to create a button</param>
        public ButtonHandler(ComboBox combobox, Type type, ComboBox combobox2, int combobox2Val)
        {
            _type               = type;
            _combobox           = combobox;
            _comboboxAdditional = combobox2;
            _additionalValue    = combobox2Val;
            _combobox.Size      = ComboboxSize;
            _bType              = BType.FLAG;

            CreateButton("Flag");
        }
示例#26
0
        public H264Mb(CommonMbH264 eltMb)
            : base(eltMb)
        {
            m_Mode         = eltMb.getMode();
            m_SliceType    = eltMb.getSliceType();
            m_MbType       = eltMb.getMbType();
            m_QP           = eltMb.getQP();
            m_QPC          = eltMb.getQPC();
            m_CBP          = eltMb.getCBP();
            m_IsIntra16x16 = eltMb.isIntra16x16();
            m_IsInter8x8   = eltMb.isInter8x8();
            m_IsIntra      = eltMb.isIntra();
            m_NumMbPart    = 1;
            m_MbPartSize   = new Size(16, 16);

            if (m_Mode == MbMode.INTRA_4X4)
            {
                m_Intra4x4PredModes = new Intra4x4PredMode[16];
                eltMb.getIntra4x4PredMode(m_Intra4x4PredModes);
            }
            else if (m_IsIntra16x16)
            {
                m_I16x16Type = (m_SliceType == SliceType.P_SLICE) ? (I16x16Type)(m_MbType - 5) : (I16x16Type)m_MbType;
            }
            else if (m_SliceType == SliceType.P_SLICE)
            {
                if (m_MbType < 5 || m_Mode == MbMode.MODE_SKIP)
                {
                    if (m_Mode == MbMode.MODE_SKIP)
                    {
                        m_NumMbPart  = 1;
                        m_MbPartSize = new Size(16, 16);
                    }
                    else
                    {
                        m_PType = (PType)m_MbType;
                        if (m_MbType < PartNumP.Length)
                        {
                            m_NumMbPart = PartNumP[m_MbType];
                        }
                        if (m_MbType < PartSizeP.Length)
                        {
                            m_MbPartSize = new Size((int)PartSizeP[m_MbType][0], (int)PartSizeP[m_MbType][1]);
                        }
                    }
                }
                else if (m_MbType == 5)
                {
                    // I_4x4
                    Debug.Assert(false);
                    m_IsIntra = true;
                }
                else
                {
                    // I_16x16
                    m_I16x16Type   = (I16x16Type)(m_MbType - 5);
                    m_IsIntra      = true;
                    m_IsIntra16x16 = true;
                }
            }
            else if (m_SliceType == SliceType.B_SLICE)
            {
                m_BType = (BType)m_MbType;
                if (m_MbType < PartNumB.Length)
                {
                    m_NumMbPart = PartNumB[m_MbType];
                }
                if (m_MbType < PartSizeP.Length)
                {
                    m_MbPartSize = new Size((int)PartSizeB[m_MbType][0], (int)PartSizeB[m_MbType][1]);
                }
            }

            if (m_IsInter8x8)
            {
                m_BlkModes = new BlkMode[4];
                eltMb.getBlkModes(m_BlkModes);
            }

            if (m_IsIntra)
            {
                m_IntraChromaPredMode = eltMb.getIntraChromaPredMode();
            }
            else
            {
                m_ref_idx_L0 = new Int32[4];
                m_POC0       = new Int32[4];
                m_mvd_l0     = eltMb.getMvdL0();
                m_mvL0       = eltMb.getMvL0();
                eltMb.getRefIdxL0(m_ref_idx_L0);
                eltMb.getPOC0(m_POC0);
                if (SliceType == SliceType.B_SLICE)
                {
                    m_ref_idx_L1 = new Int32[4];
                    m_POC1       = new Int32[4];
                    m_mvd_l1     = eltMb.getMvdL1();
                    m_mvL1       = eltMb.getMvL1();
                    eltMb.getRefIdxL1(m_ref_idx_L1);
                    eltMb.getPOC1(m_POC1);
                }
            }

            /*** SVC ***/
            m_IsInCropWindow           = eltMb.isInCropWindow();
            m_IsResidualPredictionFlag = eltMb.isResidualPredictionFlag();
            m_IsBLSkippedFlag          = eltMb.isBLSkippedFlag();
        }
示例#27
0
 public void Mature()
 {
     type = BType.Old;
 }
示例#28
0
 protected BValue(BType type)
 {
     this.type = type;
 }
示例#29
0
 Cscode(int Rotate, int Height, BType type)
 {
     this.Rotate = Rotate;
     this.Height = Height;
     this.type   = type;
 }
示例#30
0
 public BaseType(BType type)
 {
     this.type = type;
 }
示例#31
0
    public void ExecuteInstruction(int instr)
    {
        //MonoBehaviour.print(pc);
        //MonoBehaviour.print(System.Convert.ToString(instr, 16));
        //MonoBehaviour.print(System.Convert.ToString(instr, 2));
        int opcode = instr & 0x7f;

        if (opcode == 0x37) // LUI
        {
            UType args = new UType(instr);
            WriteReg(args.rd, (args.imm << 12) | (ReadReg(args.rd) & 0xfff));
        }
        else if (opcode == 0x17)   // AUIPC
        {
            UType args = new UType(instr);
            WriteReg(args.rd, (args.imm << 12) + pc);
        }
        else if (opcode == 0x6f)   // JAL
        {
            JType args = new JType(instr);
            WriteReg(args.rd, pc + 4);
            pc += SignExtend(args.imm, 20) / 4 - 1;
        }
        else if (opcode == 0x67)   // JALR
        {
            IType args = new IType(instr);
            WriteReg(args.rd, pc + 4);
            pc = ((ReadReg(args.rs1) + pc) >> 1) << 1;
        }
        else if (opcode == 0x63)   // branch
        {
            BType args = new BType(instr);

            /*MonoBehaviour.print("branch");
             * MonoBehaviour.print(args.imm);
             * MonoBehaviour.print(SignExtend(args.imm, 12));*/
            bool jump;
            if (args.funct3 == 0x0) // BEQ
            {
                jump = (ReadReg(args.rs1) == ReadReg(args.rs2));
            }
            else if (args.funct3 == 0x1)   // BNE
            {
                jump = (ReadReg(args.rs1) != ReadReg(args.rs2));
            }
            else if (args.funct3 == 0x4)   // BLT
            {
                jump = (ReadReg(args.rs1) < ReadReg(args.rs2));
            }
            else if (args.funct3 == 0x5)   // BGE
            {
                jump = (ReadReg(args.rs1) >= ReadReg(args.rs2));
            }
            else if (args.funct3 == 0x6)   // BLTU
            {
                jump = (((uint)ReadReg(args.rs1)) < ((uint)ReadReg(args.rs2)));
            }
            else if (args.funct3 == 0x7)   // BGEU
            {
                jump = (((uint)ReadReg(args.rs1)) >= ((uint)ReadReg(args.rs2)));
            }
            else   // unrecognized
            {
                jump = false;
            }
            if (jump)
            {
                pc += SignExtend(args.imm, 12) / 4 - 1;
            }
        }
        else if (opcode == 0x03)   // load
        {
            IType args = new IType(instr);
            if (args.funct3 == 0x0) // LB
            {
                // unimplemented
            }
            else if (args.funct3 == 0x1) // LH
            {
                // unimplemented
            }
            else if (args.funct3 == 0x2) // LW
            {
                WriteReg(args.rd, LoadMemory(SignExtend(args.imm, 12) + ReadReg(args.rs1)));
            }
            else if (args.funct3 == 0x4) // LBU
            {
                // unimplemented
            }
            else if (args.funct3 == 0x5) // LHU
            {
                // unimplemented
            }
            else
            {
                // unrecognized
            }
        }
        else if (opcode == 0x23)   // store
        {
            SType args = new SType(instr);
            if (args.funct3 == 0x0) // SB
            {
                // unimplemented
            }
            else if (args.funct3 == 0x1) // SH
            {
                // unimplemented
            }
            else if (args.funct3 == 0x2) // SW
            {
                StoreMemory(SignExtend(args.imm, 12) + ReadReg(args.rs1), ReadReg(args.rs2));
            }
            else
            {
                // unrecognized
            }
        }
        else if (opcode == 0x13)   // immediate
        {
            IType args = new IType(instr);
            args.imm = SignExtend(args.imm, 11);
            int value;
            if (args.funct3 == 0x0) // ADDI
            {
                value = ReadReg(args.rs1) + args.imm;
            }
            else if (args.funct3 == 0x2)   // SLTI
            {
                value = (ReadReg(args.rs1) < args.imm) ? 1 : 0;
            }
            else if (args.funct3 == 0x3)   // SLTIU
            {
                value = (((uint)ReadReg(args.rs1)) < ((uint)args.imm)) ? 1 : 0;
            }
            else if (args.funct3 == 0x4)   // XORI
            {
                value = ReadReg(args.rs1) ^ args.imm;
            }
            else if (args.funct3 == 0x6)   // ORI
            {
                value = ReadReg(args.rs1) | args.imm;
            }
            else if (args.funct3 == 0x7)   // ANDI
            {
                value = ReadReg(args.rs1) & args.imm;
            }
            else   // unrecognized
            {
                value = 0;
            }
            WriteReg(args.rd, value);
        }
        else if (opcode == 0x33)   // arithmetic
        {
            RType args = new RType(instr);
            int   value;
            int   rs1 = ReadReg(args.rs1);
            int   rs2 = ReadReg(args.rs2);
            if (args.funct3 == 0x0)
            {
                if (args.funct7 == 0x00) // ADD
                {
                    value = rs1 + rs2;
                }
                else if (args.funct7 == 0x20)   // SUB
                {
                    value = rs1 - rs2;
                }
                else   // unrecognized
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x1)
            {
                if (args.funct7 == 0x00) // SLL
                {
                    value = rs1 << rs2;
                }
                else
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x2)
            {
                if (args.funct7 == 0x00) // SLT
                {
                    value = (rs1 < rs2) ? 1 : 0;
                }
                else
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x3)
            {
                if (args.funct7 == 0x00) // SLTU
                {
                    value = (((uint)rs1) < ((uint)rs2)) ? 1 : 0;
                }
                else
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x4)
            {
                if (args.funct7 == 0x00) // XOR
                {
                    value = rs1 ^ rs2;
                }
                else
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x5)
            {
                if (args.funct7 == 0x00) // SRL
                {
                    value = (int)(((uint)rs1) >> rs2);
                }
                else if (args.funct7 == 0x20)   // SRA
                {
                    value = rs1 >> rs2;
                }
                else
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x6)
            {
                if (args.funct7 == 0x00) // OR
                {
                    value = rs1 | rs2;
                }
                else
                {
                    value = 0;
                }
            }
            else if (args.funct3 == 0x7)
            {
                if (args.funct7 == 0x00) // AND
                {
                    value = rs1 & rs2;
                }
                else
                {
                    value = 0;
                }
            }
            else
            {
                value = 0;
            }
            WriteReg(args.rd, value);
        }
        else if (opcode == 0x0f)   // fence
        {
            // unimplemented
        }
        else if (opcode == 0x73)   // environment
        {
            IType args = new IType(instr);
            if (args.funct3 == 0x0)   // system
            {
                if (args.imm == 0x000)
                {
                    if (instr == 0x00000073) // ECALL
                    {
                        // unimplemented
                    }
                    else
                    {
                        // unrecognized
                    }
                }
                else if (args.imm == 0x001)
                {
                    if (instr == 0x00100073) // EBREAK
                    {
                        isRunning = false;
                    }
                    else
                    {
                        // unrecognized
                    }
                }
                else
                {
                    // unrecognized
                }
            }
            else if (args.funct3 == 0x1) // CSRRW
            {
                WriteReg(args.imm, controller.ReadCSR(args.rd));
                controller.WriteCSR(args.imm, ReadReg(args.rs1));
            }
            else if (args.funct3 == 0x2) // CSRRS
            {
                int csr = controller.ReadCSR(args.rd);
                WriteReg(args.imm, csr);
                int mask = ReadReg(args.rs1);
                controller.WriteCSR(args.imm, mask | csr);
            }
            else if (args.funct3 == 0x3) // CSRRC
            {
                int csr = controller.ReadCSR(args.rd);
                WriteReg(args.imm, csr);
                int mask = ~ReadReg(args.rs1);
                controller.WriteCSR(args.imm, mask & csr);
            }
            else if (args.funct3 == 0x5) // CSRRWI
            {
                WriteReg(args.imm, controller.ReadCSR(args.rd));
                controller.WriteCSR(args.imm, args.rs1);
            }
            else if (args.funct3 == 0x6) // CSRRSI
            {
                int csr = controller.ReadCSR(args.rd);
                WriteReg(args.imm, csr);
                int mask = args.rs1;
                controller.WriteCSR(args.imm, mask | csr);
            }
            else if (args.funct3 == 0x7) // CSRRCI
            {
                int csr = controller.ReadCSR(args.rd);
                WriteReg(args.imm, csr);
                int mask = ~args.rs1;
                controller.WriteCSR(args.imm, mask & csr);
            }
            else
            {
                // unrecognized
            }
        }
        else                // unrecognized
        {
            if (instr != 0) // nop
            {
                MonoBehaviour.print("Unrecognized instruction:");
                MonoBehaviour.print(System.Convert.ToString(instr, 16));
            }
        }
        pc++;
    }
示例#32
0
        /* Updates the listview to show the files in the current directory */
        private void updateFiles(string proj = null)
        {
            Random rnd = new Random();

            if (String.IsNullOrEmpty(proj) || proj == "Please Select")
            {
                proj = projectSelect.SelectedItem as string;
                if (String.IsNullOrEmpty(proj) || proj == "Please Select")
                {
                    listView33.ItemsSource = null;
                    return;
                }
            }
            ObservableCollection <ProjectFiles> lopf = new ObservableCollection <ProjectFiles>();
            var fileNames = Directory.GetFiles(proj, "*.rvt");

            foreach (string fn in fileNames)
            {
                FileInfo fi      = new FileInfo(fn);
                var      sysicon = System.Drawing.Icon.ExtractAssociatedIcon(fi.FullName);
                var      bmpSrc  = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
                    sysicon.Handle,
                    Int32Rect.Empty,
                    BitmapSizeOptions.FromEmptyOptions());
                sysicon.Dispose();
                ShellFile sf = ShellFile.FromFilePath(fi.FullName);
                //sf.Thumbnail.FormatOption = ShellThumbnailFormatOption.ThumbnailOnly;
                var renderedImg = sf.Thumbnail.ExtraLargeBitmapSource;
                var bc          = 0;

                try
                {
                    Console.WriteLine("Trying to load XML for {0}......", fi.Name);
                    XDocument objDoc = XDocument.Load(fi.FullName.Replace(".rvt", ".xml"));
                    if (objDoc.Descendants("BeaconFamily").Any())
                    {
                        foreach (var fam in objDoc.Descendants("BeaconFamily"))
                        {
                            string famName = fam.Value;
                            foreach (var BType in fam.Descendants("BeaconType"))
                            {
                                string typeName = BType.Value;
                                if (BType.Descendants("Instance").Any())
                                {
                                    foreach (var BInstance in BType.Descendants("Instance"))
                                    {
                                        ++bc;

                                        XElement height = BInstance.Element("BeaconHeight");
                                        XElement level  = BInstance.Element("BeaconLevel");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("No instances of {0} in {1}", typeName, fi.Name);
                                }
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("No BeaconFamily in {0}", fi.Name);
                    }
                }
                catch (FileNotFoundException)
                {
                    Console.WriteLine("Error Finding XML");
                }

                lopf.Add(new ProjectFiles()
                {
                    Title = fi.Name, FullPath = fi.FullName, Attr = fi.Attributes, AccsTime = fi.LastWriteTime, Icon = bmpSrc, RenderedImg = renderedImg, BeaconCount = bc, Progress = rnd.Next(0, 100)
                });
            }

            string fname = proj + "/file_attributes.xml";

            if (fname != FileAttributePath)
            {
                FileAttributePath = fname;
                AllFileAttributes = new Dictionary <string, FileAttribute>();
                if (File.Exists(FileAttributePath))
                {
                    var lines = File.ReadLines(FileAttributePath);
                    AllFileAttributes = JsonConvert.DeserializeObject <Dictionary <string, FileAttribute> >(lines.First());
                }
                foreach (var projectFile in lopf)
                {
                    if (!AllFileAttributes.ContainsKey(projectFile.Title))
                    {
                        AllFileAttributes[projectFile.Title] = new FileAttribute();
                    }
                }
                File.WriteAllLines(FileAttributePath, new string[] { JsonConvert.SerializeObject(AllFileAttributes) });
            }
            listView33.ItemsSource = lopf;
        }
示例#33
0
 public BaseType(BType type)
 {
     this.type = type;
 }
示例#34
0
        public H264Mb(CommonMbH264 eltMb)
            : base(eltMb)
        {
            m_Mode = eltMb.getMode();
            m_SliceType = eltMb.getSliceType();
            m_MbType = eltMb.getMbType();
            m_QP = eltMb.getQP();
            m_QPC = eltMb.getQPC();
            m_CBP = eltMb.getCBP();
            m_IsIntra16x16 = eltMb.isIntra16x16();
            m_IsInter8x8 = eltMb.isInter8x8();
            m_IsIntra = eltMb.isIntra();
            m_NumMbPart = 1;
            m_MbPartSize = new Size(16, 16);

            if (m_Mode == MbMode.INTRA_4X4)
            {
                m_Intra4x4PredModes = new Intra4x4PredMode[16];
                eltMb.getIntra4x4PredMode(m_Intra4x4PredModes);
            }
            else if (m_IsIntra16x16)
            {
                m_I16x16Type = (m_SliceType == SliceType.P_SLICE) ? (I16x16Type)(m_MbType - 5) : (I16x16Type)m_MbType;
            }
            else if (m_SliceType == SliceType.P_SLICE)
            {
                if (m_MbType < 5 || m_Mode == MbMode.MODE_SKIP)
                {
                    if (m_Mode == MbMode.MODE_SKIP)
                    {
                        m_NumMbPart = 1;
                        m_MbPartSize = new Size(16, 16);
                    }
                    else
                    {
                        m_PType = (PType)m_MbType;
                        if (m_MbType < PartNumP.Length)
                        {
                            m_NumMbPart = PartNumP[m_MbType];
                        }
                        if (m_MbType < PartSizeP.Length)
                        {
                            m_MbPartSize = new Size((int)PartSizeP[m_MbType][0], (int)PartSizeP[m_MbType][1]);
                        }
                    }
                }
                else if (m_MbType == 5)
                {
                    // I_4x4
                    Debug.Assert(false);
                    m_IsIntra = true;
                }
                else
                {
                    // I_16x16
                    m_I16x16Type = (I16x16Type)(m_MbType - 5);
                    m_IsIntra = true;
                    m_IsIntra16x16 = true;
                }
            }
            else if (m_SliceType == SliceType.B_SLICE)
            {
                m_BType = (BType)m_MbType;
                if (m_MbType < PartNumB.Length)
                {
                    m_NumMbPart = PartNumB[m_MbType];
                }
                if (m_MbType < PartSizeP.Length)
                {
                    m_MbPartSize = new Size((int)PartSizeB[m_MbType][0], (int)PartSizeB[m_MbType][1]);
                }
            }

            if (m_IsInter8x8)
            {
                m_BlkModes = new BlkMode[4];
                eltMb.getBlkModes(m_BlkModes);
            }

            if (m_IsIntra)
            {
                m_IntraChromaPredMode = eltMb.getIntraChromaPredMode();
            }
            else
            {
                m_ref_idx_L0 = new Int32[4];
                m_POC0 = new Int32[4];
                m_mvd_l0 = eltMb.getMvdL0();
                m_mvL0 = eltMb.getMvL0();
                eltMb.getRefIdxL0(m_ref_idx_L0);
                eltMb.getPOC0(m_POC0);
                if (SliceType == SliceType.B_SLICE)
                {
                    m_ref_idx_L1 = new Int32[4];
                    m_POC1 = new Int32[4];
                    m_mvd_l1 = eltMb.getMvdL1();
                    m_mvL1 = eltMb.getMvL1();
                    eltMb.getRefIdxL1(m_ref_idx_L1);
                    eltMb.getPOC1(m_POC1);
                }
            }

            /*** SVC ***/
            m_IsInCropWindow = eltMb.isInCropWindow();
            m_IsResidualPredictionFlag = eltMb.isResidualPredictionFlag();
            m_IsBLSkippedFlag = eltMb.isBLSkippedFlag();
        }
示例#35
0
        /// <inheritdoc />
        public bool Equals([AllowNull] ContourCarpet other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                 ) &&
                 (
                     ShowLegend == other.ShowLegend ||
                     ShowLegend != null &&
                     ShowLegend.Equals(other.ShowLegend)
                 ) &&
                 (
                     LegendGroup == other.LegendGroup ||
                     LegendGroup != null &&
                     LegendGroup.Equals(other.LegendGroup)
                 ) &&
                 (
                     Opacity == other.Opacity ||
                     Opacity != null &&
                     Opacity.Equals(other.Opacity)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UId == other.UId ||
                     UId != null &&
                     UId.Equals(other.UId)
                 ) &&
                 (
                     Equals(Ids, other.Ids) ||
                     Ids != null && other.Ids != null &&
                     Ids.SequenceEqual(other.Ids)
                 ) &&
                 (
                     Equals(CustomData, other.CustomData) ||
                     CustomData != null && other.CustomData != null &&
                     CustomData.SequenceEqual(other.CustomData)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Equals(MetaArray, other.MetaArray) ||
                     MetaArray != null && other.MetaArray != null &&
                     MetaArray.SequenceEqual(other.MetaArray)
                 ) &&
                 (
                     Stream == other.Stream ||
                     Stream != null &&
                     Stream.Equals(other.Stream)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ) &&
                 (
                     Carpet == other.Carpet ||
                     Carpet != null &&
                     Carpet.Equals(other.Carpet)
                 ) &&
                 (
                     Equals(Z, other.Z) ||
                     Z != null && other.Z != null &&
                     Z.SequenceEqual(other.Z)
                 ) &&
                 (
                     Equals(A, other.A) ||
                     A != null && other.A != null &&
                     A.SequenceEqual(other.A)
                 ) &&
                 (
                     A0 == other.A0 ||
                     A0 != null &&
                     A0.Equals(other.A0)
                 ) &&
                 (
                     DA == other.DA ||
                     DA != null &&
                     DA.Equals(other.DA)
                 ) &&
                 (
                     Equals(B, other.B) ||
                     B != null && other.B != null &&
                     B.SequenceEqual(other.B)
                 ) &&
                 (
                     B0 == other.B0 ||
                     B0 != null &&
                     B0.Equals(other.B0)
                 ) &&
                 (
                     Db == other.Db ||
                     Db != null &&
                     Db.Equals(other.Db)
                 ) &&
                 (
                     Equals(Text, other.Text) ||
                     Text != null && other.Text != null &&
                     Text.SequenceEqual(other.Text)
                 ) &&
                 (
                     Equals(HoverText, other.HoverText) ||
                     HoverText != null && other.HoverText != null &&
                     HoverText.SequenceEqual(other.HoverText)
                 ) &&
                 (
                     Transpose == other.Transpose ||
                     Transpose != null &&
                     Transpose.Equals(other.Transpose)
                 ) &&
                 (
                     AType == other.AType ||
                     AType != null &&
                     AType.Equals(other.AType)
                 ) &&
                 (
                     BType == other.BType ||
                     BType != null &&
                     BType.Equals(other.BType)
                 ) &&
                 (
                     FillColor == other.FillColor ||
                     FillColor != null &&
                     FillColor.Equals(other.FillColor)
                 ) &&
                 (
                     AutoContour == other.AutoContour ||
                     AutoContour != null &&
                     AutoContour.Equals(other.AutoContour)
                 ) &&
                 (
                     NContours == other.NContours ||
                     NContours != null &&
                     NContours.Equals(other.NContours)
                 ) &&
                 (
                     Contours == other.Contours ||
                     Contours != null &&
                     Contours.Equals(other.Contours)
                 ) &&
                 (
                     Line == other.Line ||
                     Line != null &&
                     Line.Equals(other.Line)
                 ) &&
                 (
                     ZAuto == other.ZAuto ||
                     ZAuto != null &&
                     ZAuto.Equals(other.ZAuto)
                 ) &&
                 (
                     ZMin == other.ZMin ||
                     ZMin != null &&
                     ZMin.Equals(other.ZMin)
                 ) &&
                 (
                     ZMax == other.ZMax ||
                     ZMax != null &&
                     ZMax.Equals(other.ZMax)
                 ) &&
                 (
                     ZMid == other.ZMid ||
                     ZMid != null &&
                     ZMid.Equals(other.ZMid)
                 ) &&
                 (
                     ColorScale == other.ColorScale ||
                     ColorScale != null &&
                     ColorScale.Equals(other.ColorScale)
                 ) &&
                 (
                     AutoColorScale == other.AutoColorScale ||
                     AutoColorScale != null &&
                     AutoColorScale.Equals(other.AutoColorScale)
                 ) &&
                 (
                     ReverseScale == other.ReverseScale ||
                     ReverseScale != null &&
                     ReverseScale.Equals(other.ReverseScale)
                 ) &&
                 (
                     ShowScale == other.ShowScale ||
                     ShowScale != null &&
                     ShowScale.Equals(other.ShowScale)
                 ) &&
                 (
                     ColorBar == other.ColorBar ||
                     ColorBar != null &&
                     ColorBar.Equals(other.ColorBar)
                 ) &&
                 (
                     ColorAxis == other.ColorAxis ||
                     ColorAxis != null &&
                     ColorAxis.Equals(other.ColorAxis)
                 ) &&
                 (
                     XAxis == other.XAxis ||
                     XAxis != null &&
                     XAxis.Equals(other.XAxis)
                 ) &&
                 (
                     YAxis == other.YAxis ||
                     YAxis != null &&
                     YAxis.Equals(other.YAxis)
                 ) &&
                 (
                     IdsSrc == other.IdsSrc ||
                     IdsSrc != null &&
                     IdsSrc.Equals(other.IdsSrc)
                 ) &&
                 (
                     CustomDataSrc == other.CustomDataSrc ||
                     CustomDataSrc != null &&
                     CustomDataSrc.Equals(other.CustomDataSrc)
                 ) &&
                 (
                     MetaSrc == other.MetaSrc ||
                     MetaSrc != null &&
                     MetaSrc.Equals(other.MetaSrc)
                 ) &&
                 (
                     ZSrc == other.ZSrc ||
                     ZSrc != null &&
                     ZSrc.Equals(other.ZSrc)
                 ) &&
                 (
                     ASrc == other.ASrc ||
                     ASrc != null &&
                     ASrc.Equals(other.ASrc)
                 ) &&
                 (
                     BSrc == other.BSrc ||
                     BSrc != null &&
                     BSrc.Equals(other.BSrc)
                 ) &&
                 (
                     TextSrc == other.TextSrc ||
                     TextSrc != null &&
                     TextSrc.Equals(other.TextSrc)
                 ) &&
                 (
                     HoverTextSrc == other.HoverTextSrc ||
                     HoverTextSrc != null &&
                     HoverTextSrc.Equals(other.HoverTextSrc)
                 ));
        }
示例#36
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (ShowLegend != null)
         {
             hashCode = hashCode * 59 + ShowLegend.GetHashCode();
         }
         if (LegendGroup != null)
         {
             hashCode = hashCode * 59 + LegendGroup.GetHashCode();
         }
         if (Opacity != null)
         {
             hashCode = hashCode * 59 + Opacity.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (Carpet != null)
         {
             hashCode = hashCode * 59 + Carpet.GetHashCode();
         }
         if (Z != null)
         {
             hashCode = hashCode * 59 + Z.GetHashCode();
         }
         if (A != null)
         {
             hashCode = hashCode * 59 + A.GetHashCode();
         }
         if (A0 != null)
         {
             hashCode = hashCode * 59 + A0.GetHashCode();
         }
         if (DA != null)
         {
             hashCode = hashCode * 59 + DA.GetHashCode();
         }
         if (B != null)
         {
             hashCode = hashCode * 59 + B.GetHashCode();
         }
         if (B0 != null)
         {
             hashCode = hashCode * 59 + B0.GetHashCode();
         }
         if (Db != null)
         {
             hashCode = hashCode * 59 + Db.GetHashCode();
         }
         if (Text != null)
         {
             hashCode = hashCode * 59 + Text.GetHashCode();
         }
         if (HoverText != null)
         {
             hashCode = hashCode * 59 + HoverText.GetHashCode();
         }
         if (Transpose != null)
         {
             hashCode = hashCode * 59 + Transpose.GetHashCode();
         }
         if (AType != null)
         {
             hashCode = hashCode * 59 + AType.GetHashCode();
         }
         if (BType != null)
         {
             hashCode = hashCode * 59 + BType.GetHashCode();
         }
         if (FillColor != null)
         {
             hashCode = hashCode * 59 + FillColor.GetHashCode();
         }
         if (AutoContour != null)
         {
             hashCode = hashCode * 59 + AutoContour.GetHashCode();
         }
         if (NContours != null)
         {
             hashCode = hashCode * 59 + NContours.GetHashCode();
         }
         if (Contours != null)
         {
             hashCode = hashCode * 59 + Contours.GetHashCode();
         }
         if (Line != null)
         {
             hashCode = hashCode * 59 + Line.GetHashCode();
         }
         if (ZAuto != null)
         {
             hashCode = hashCode * 59 + ZAuto.GetHashCode();
         }
         if (ZMin != null)
         {
             hashCode = hashCode * 59 + ZMin.GetHashCode();
         }
         if (ZMax != null)
         {
             hashCode = hashCode * 59 + ZMax.GetHashCode();
         }
         if (ZMid != null)
         {
             hashCode = hashCode * 59 + ZMid.GetHashCode();
         }
         if (ColorScale != null)
         {
             hashCode = hashCode * 59 + ColorScale.GetHashCode();
         }
         if (AutoColorScale != null)
         {
             hashCode = hashCode * 59 + AutoColorScale.GetHashCode();
         }
         if (ReverseScale != null)
         {
             hashCode = hashCode * 59 + ReverseScale.GetHashCode();
         }
         if (ShowScale != null)
         {
             hashCode = hashCode * 59 + ShowScale.GetHashCode();
         }
         if (ColorBar != null)
         {
             hashCode = hashCode * 59 + ColorBar.GetHashCode();
         }
         if (ColorAxis != null)
         {
             hashCode = hashCode * 59 + ColorAxis.GetHashCode();
         }
         if (XAxis != null)
         {
             hashCode = hashCode * 59 + XAxis.GetHashCode();
         }
         if (YAxis != null)
         {
             hashCode = hashCode * 59 + YAxis.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         if (ZSrc != null)
         {
             hashCode = hashCode * 59 + ZSrc.GetHashCode();
         }
         if (ASrc != null)
         {
             hashCode = hashCode * 59 + ASrc.GetHashCode();
         }
         if (BSrc != null)
         {
             hashCode = hashCode * 59 + BSrc.GetHashCode();
         }
         if (TextSrc != null)
         {
             hashCode = hashCode * 59 + TextSrc.GetHashCode();
         }
         if (HoverTextSrc != null)
         {
             hashCode = hashCode * 59 + HoverTextSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#37
0
 public RndIdBook(string t, string a, BType ty, int prd) : base(t, a, ty, prd)
 {
 }
示例#38
0
 public static double[][] B_Create(BType b_type, double[][] Y)
 {
     var B = new double[Y.Length][];
     switch (b_type)
     {
         case BType.Type1:
             for (var i = 0; i < Y.Length; i++)
                 B[i] = new double[Y[i].Length];
             for (var i = 0; i < B.Length; i++)
                 for (var j = 0; j < B[i].Length; j++)
                     B[i][j] = (Y[i].Max() + Y[i].Min()) / 2;
             break;
         case BType.Type2:
             for (var i = 0; i < Y.Length; i++)
                 B[i] = new double[Y[i].Length];
             for (var i = 0; i < B.Length; i++)
                 for (var j = 0; j < B[i].Length; j++)
                     B[i][j] = Y[i].Average();
             break;
         case BType.Type3:
             for (var i = 0; i < Y.Length; i++)
                 B[i] = new double[Y[i].Length];
             for (var i = 0; i < B.Length; i++)
                 for (var j = 0; j < B[i].Length; j++)
                     B[i][j] = Y[i][j];
             break;
         default:
             throw new NotSupportedException();
     }
     return B;
 }