/// <summary> /// /// </summary> /// <param name="dest"></param> /// <param name="addr"></param> /// <param name="size"></param> /// <param name="fp"></param> /// <returns></returns> public int fread(Setable dest, int addr, int size, int fp) { if ((fp & 0x80) == 0) { return(0); } fp &= 0x7f; if (fp >= MAX_FILE_COUNT) { return(0); } if (usable[fp] || !canRead[fp]) { return(0); } VirtualFile file = files[fp]; int count = 0, b; while (count < size && (b = file.getc()) != -1) { dest.setByte(addr++, (sbyte)b); count++; } return(count); }
public OrderCalculationEngine(IDataService data) : base() { // inputs _inventory = Setable(data.LoadInventory(), "Inventory"); _order = Setable(data.LoadOrder(), "Order"); // outputs _orderResult = Computed(() => OrderMethods.GetOrderResults(_order, _inventory), "OrderResult"); }
/// <summary> /// 取得该拼音从id开始的len个汉字的gb2312编码数据 /// </summary> /// <param name="dst">用于保存数据</param> /// <param name="offset"></param> /// <param name="id">开始的汉字编号,从0开始</param> /// <param name="len">欲获取的汉字个数</param> /// <returns>实际获取的汉字个数</returns> public int getGB(Setable dst, int offset, int id, int len) { id <<= 1; len <<= 1; int index = 0; while (index < len && id + index < data.Length) { dst.setByte(offset + index, data[id + index]); index++; dst.setByte(offset + index, data[id + index]); index++; } //return index >>> 1; return(index >> 1);//这里有问题,稍后再改 }
/** * 该方法不对x,y,width,height检查,可能会抛出IndexOutOfBoundsException */ public int getRegion(int x, int y, int width, int height, Setable dest, int addr) { //每行占用的byte数,忽略低3位 int bytePerLine = width / 8; //图片数据在显存中开始地址,x忽略低三位 int dataOffset = y * BYTES_PER_LINE + x / 8; int size = height * bytePerLine; while (height-- > 0) { for (int byteCount = 0; byteCount < bytePerLine; byteCount++) { dest.setByte(addr++, currData[dataOffset + byteCount]); } dataOffset += BYTES_PER_LINE; } return(size); }
public Caractéristique() { _carac = new Setable <int>(); _modificateur = new Computed <int>(() => (Carac - 10) / 2); }
public Caractéristique() { _carac = new Setable<int>(); _modificateur = new Computed<int>(() => (Carac - 10) / 2); }