public void load(xDataInput di) { this.setName(di.readUTF()); // already this.setType(di.readInt()); int members = di.readInt(); for (int j = 0; j < members; j++) { String code = di.readUTF(); if (code != null && code.Length >= 3) { if (Context.getInstance() != null && Context.getInstance().mShareManager != null) { int id = Context.getInstance().mShareManager.getShareID(code); if (id > 0) { this.addCode(code); } } else { this.addCode(code); } } } }
public void loadAlarms() { xDataInput di = xFileManager.readFile(Context.FILE_ALARM, false); if (di == null) { return; } int ver = 0; if (di != null) { ver = di.readInt(); } if (ver >= Context.FILE_VERSION_33) { int cnt = di.readInt(); for (int i = 0; i < cnt; i++) { stAlarm a = new stAlarm(); a.code = di.readUTF(); a.date = di.readInt(); a.lowerPrice = di.readInt(); a.upperPrice = di.readInt(); a.comment = di.readUTF(); mAlarms.addElement(a); } } }
public void loadPriceboard() { if (true) { return; } if (!Context.mInvalidSavedFile) { return; } xDataInput di = xFileManager.readFile(PRICEBOARD_FILE, false); if (di != null) { int ver = di.readInt(); if (ver < Context.FILE_VERSION_10) { return; } int floor_count = di.readInt(); int i = 0; // indices mIndices.removeAllElements(); for (i = 0; i < floor_count; i++) { stPriceboardStateIndex idx = new stPriceboardStateIndex(); mIndices.addElement(idx); idx.id = di.readShort(); idx.code = di.readUTF(); idx.marketID = di.readInt(); idx.current_point = di.readFloat(); // *100 idx.changed_point = di.readFloat(); // *100 idx.changed_percent = di.readInt(); // *100 idx.total_volume = di.readInt(); idx.inc_cnt = di.readInt(); idx.ce_cnt = di.readInt(); idx.dec_cnt = di.readInt(); idx.floor_cnt = di.readInt(); idx.ref_num = di.readInt(); idx.totalGTGD = di.readInt(); // *10000 idx.market_status = di.readInt(); idx.reference = di.readFloat(); idx.mDate = di.readUTF(); } // shares for (i = 0; i < floor_count; i++) { stPriceboardState.load(di); } } }
public bool load(xDataInput di) { mDate = di.readInt(); mShareID = di.readInt(); mCode = di.readUTF(); mFloorID = di.readByte(); mPriceRef = di.readFloat(); mIsIndex = di.readBoolean(); mMaxTradeVolume = di.readInt(); mTradeTransactionCount = di.readInt(); int cnt = mTradeTransactionCount * FIELD_CNT; if (cnt > mTradeTransactionBuffer.Length) { int[] p = new int[cnt + 20 * FIELD_CNT]; mTradeTransactionBuffer = p; } for (int i = 0; i < cnt; i++) { mTradeTransactionBuffer[i] = di.readInt(); } return(true); }
public void setOnlineIndexData(xDataInput di) { String date = di.readUTF(); mDate = parseDate(date); mTime = parseTime(date); int floor = di.readInt(); int max = 10; if (floor < 1 || floor > max) { return; } //=====================index=================== stPriceboardStateIndex index = getPriceboardIndexOfMarket(floor); if (di.available() < 44) { mContext.err++; return; } if (index != null) { index.mDate = date; index.current_point = di.readInt() / 100.0f; index.changed_point = di.readInt() / 100.0f; index.changed_percent = di.readInt(); index.total_volume = di.readInt(); index.inc_cnt = di.readInt(); index.ce_cnt = di.readInt(); index.dec_cnt = di.readInt(); index.floor_cnt = di.readInt(); index.ref_num = di.readInt(); index.totalGTGD = di.readInt() / 10; // dv 1tr index.market_status = di.readInt(); index.update_time = date; index.reference = index.current_point - index.changed_point; } // set timing clock if (index != null && index.market_status == MARKET_STATUS_OPENNING) { //mContext.mClock.reset(mTime * 1000); } else { //mContext.mClock.reset(); } }
void loadFibonaccie() { if (!mShouldSaveFile) { return; } Share share = mShare; if (share == null) { return; } string sz = getFilename(); xDataInput di = xFileManager.readFile(sz, false); mTrends.removeAllElements(); mSelectedTrend = null; if (di != null) { if (di.readInt() == Context.FILE_VERSION) { int cnt = di.readInt(); for (int i = 0; i < cnt; i++) { stTrendLine t = new stTrendLine(); t.type = di.readByte(); t.color = (uint)di.readInt(); t.thickness = di.readFloat(); for (int j = 0; j < 3; j++) { t.candleIdx[j] = di.readFloat(); Utils.trace("=====loadfile: candle=" + t.candleIdx[j]); t.price[j] = di.readFloat(); } if (t.type == DRAW_ABC) { t.data = di.readUTF(); } mTrends.addElement(t); } recalcPosition(); } } Utils.trace("=====loadfile"); }
static public void loadData() { xDataInput di = xFileManager.readFile("global.dat", false); if (di != null) { String str = di.readUTF(); if (str != null) { data = new VTDictionary(str); } } }
public static void loadAppConfig() { xDataInput di = xFileManager.readFile("appconfig2", false); if (di != null) { try { String s = di.readUTF(); appConfig = Newtonsoft.Json.JsonConvert.DeserializeObject <AppConfig>(s); } catch (Exception e) { Utils.trace(e.Message); } } }
void loadGainload(xDataInput di) { int cnt = di.readInt(); if (cnt > 50) { cnt = 50; } GainLossManager m = gainLossManager(); if (cnt > 0) { m.clearAll(); } for (int i = 0; i < cnt; i++) { String code = di.readUTF(); int date = di.readInt(); float price = di.readInt() / 1000.0f; int vol = di.readInt(); if (date == 0) { date = Utils.getDateAsInt(); GlobalData.vars().setValueBool("should_flush_userdata", true); } if (code != null && code.Length >= 3 && code.Length < 15) { if (Context.getInstance() != null && Context.getInstance().mShareManager != null) { int id = Context.getInstance().mShareManager.getShareID(code); if (id > 0) { m.addGainLoss(code, date, price, vol); } } //m.addGainLoss(code, date, price, vol); } } m.sortList(); }
public void loadUserDataOldVersion(xDataInput di) { int ver = 0; if (di != null) { ver = di.readInt(); } xVector mFavorGroups = shareGroups(); GainLossManager mGainLossManager = gainLossManager(); if (di != null && (ver == FILE_VERSION_FAVORITE || ver == FILE_ONLINE_USERDATA_VER)) { mFavorGroups.removeAllElements(); mGainLossManager.clearAll(); int cnt = di.readInt(); for (int i = 0; i < cnt; i++) { stShareGroup g = new stShareGroup(); g.load(di); //g.setType(stShareGroup::GROUP_TYPE_FAVORITE); mFavorGroups.addElement(g); } /* * // sort * Collections.sort(mFavorGroups, new Comparator<stShareGroup>() { * @Override * public int compare(stShareGroup o1, stShareGroup o2) { * return o1.getName().compareToIgnoreCase(o2.getName()); * } * }); */ //======this version does not support gainloss====== if (di.available() > 0) { ver = di.readInt(); if (ver == FILE_GAINLOSS_SIGNAL) { cnt = di.readInt(); mGainLossManager.clearAll(); for (int i = 0; i < cnt; i++) { String code = di.readUTF(); int date = di.readInt(); int price = di.readInt(); int vol = di.readInt(); if (date == 0) { GlobalData.vars().setValueBool("should_flush_userdata", true); } if (code != null && code.Length >= 3) { mGainLossManager.addGainLoss(code, date, price, vol); } } mGainLossManager.sortList(); if (mGainLossManager.getTotal() > 0) { mGainLossManager.save(); } } ver = di.readInt(); if (ver == FILE_FILTER_SET_VERSION) { FilterManager.getInstance().loadFilterSets(di); } } } }
/* * public void setRefPrice(xDataInput di) { * if (true) // invalid method and not used anymore * return; * int floor = di.readInt(); * int cnt = di.readInt(); * if (cnt < 0) { * return; * } * if (cnt > 5000) { * return; * } * * if (floor < 1 || floor > 2) { * return; * } * * stPriceboardState.alloc_buffer(floor, cnt); * * mHasRefvalue = true; * int j = 0; * //==================================================================== * byte[] data = di.getBytes(); * int off = di.getCurrentOffset(); * * for (int i = 0; i < cnt; i++) { * j = 0; * stPriceboardState p = stPriceboardState.seekPriceboard(floor, data, off); * // code * p.setRef(data, off); * off += 8 + 3 * 4; * } * } * */ /* * public void setZeroPriceboard(xDataInput di) * { * String nextfile = di.readUTF(); * //nextfile = "0"; // CHEAT * * String date = di.readUTF(); * mDate = parseDate(date); * * int floor = di.readInt(); * int max = 10; * if (floor < 1 || floor > max) * { * return; * } * * mNextfile[floor - 1] = nextfile; * * //=====================index=================== * stPriceboardStateIndex index = getPriceboardIndexOfMarket(floor); * int oldStatus = index.market_status; * index.current_point = di.readInt()/100.0f; * index.changed_point = di.readInt()/100.0f; * index.changed_percent = di.readInt(); * index.total_volume = di.readInt(); * index.inc_cnt = di.readInt(); * index.ce_cnt = di.readInt(); * index.dec_cnt = di.readInt(); * index.floor_cnt = di.readInt(); * index.ref_num = di.readInt(); * index.totalGTGD = di.readInt() / 10; // dv 1tr * index.market_status = di.readInt(); * index.update_time = date; * index.reference = index.current_point - index.changed_point; * * index.status_changed = oldStatus != index.market_status ? true : false; * //=====================end of index=================== * * int cnt = di.readInt(); * if (cnt < 0 || cnt > 5000) * { * return; * } * * byte[] data = di.getBytes(); * * int j = 0; * for (int i = 0; i < cnt; i++) * { * stPriceboardState p = getPriceboard(floor, data, di.getCurrentOffset()); * * //Utils.trace("=====" + c0 + c1 + c2); * * if (p == null) * { * di.skip(Share.SHARE_CODE_LENGTH + 54); * continue; * } * di.skip(Share.SHARE_CODE_LENGTH); * * p.setZero(di); * } * } */ public void setZeroPriceboard2016(xDataInput di) { String nextfile = di.readUTF(); //nextfile = "0"; // CHEAT String date = di.readUTF(); mDate = parseDate(date); int floor = di.readInt(); int max = 10; if (floor < 1 || floor > max) { return; } mNextfile[floor - 1] = nextfile; //=====================index=================== stPriceboardStateIndex index = getPriceboardIndexOfMarket(floor); int oldStatus = index.market_status; index.current_point = di.readInt() / 100.0f; index.changed_point = di.readInt() / 100.0f; index.changed_percent = di.readInt(); index.total_volume = di.readInt(); index.inc_cnt = di.readInt(); index.ce_cnt = di.readInt(); index.dec_cnt = di.readInt(); index.floor_cnt = di.readInt(); index.ref_num = di.readInt(); index.totalGTGD = di.readInt() / 10; // dv 1tr index.market_status = di.readInt(); index.update_time = date; index.reference = index.current_point - index.changed_point; index.status_changed = oldStatus != index.market_status ? true : false; //=====================end of index=================== int cnt = di.readInt(); if (cnt < 0 || cnt > 5000) { return; } byte[] data = di.getBytes(); int j = 0; for (int i = 0; i < cnt; i++) { //stPriceboardState p = getPriceboard(floor, data, di.getCurrentOffset()); String scode = Utils.bytesNullTerminatedToString(data, di.getCurrentOffset(), 20); stPriceboardState p = getPriceboard(scode); if (p == null) { di.skip(Share.SHARE_CODE_LENGTH + 72); continue; } p.code = scode; //Utils.trace("=====" + c0 + c1 + c2); di.skip(Share.SHARE_CODE_LENGTH); p.setZero(di); } }