public void save(xDataOutput o)
        {
            o.writeUTF(this.getName());
            o.writeInt(this.getType());

            int members = this.getTotal();

            o.writeInt(members);
            for (int j = 0; j < members; j++)
            {
                o.writeUTF(this.getCodeAt(j));
            }
        }
Exemple #2
0
        static public void saveData()
        {
            String      str = data.toJson();
            xDataOutput o   = new xDataOutput(10 * 1024);

            o.writeUTF(str);
            xFileManager.saveFile(o, "global.dat");
        }
Exemple #3
0
        public static void saveAppConfig()
        {
            if (appConfig != null)
            {
                String      s = JsonConvert.SerializeObject(appConfig);
                xDataOutput o = new xDataOutput(s.Length * 2);
                o.writeUTF(s);

                xFileManager.saveFile(o, "appconfig2");
            }
        }
        public void saveAlarms()
        {
            xDataOutput o = new xDataOutput(2048);

            o.writeInt(Context.FILE_VERSION_LATEST);

            int cnt = mAlarms.size();

            o.writeInt(cnt);
            for (int i = 0; i < cnt; i++)
            {
                stAlarm a = (stAlarm)mAlarms.elementAt(i);
                o.writeUTF(a.code);
                o.writeInt(a.date);
                o.writeInt(a.lowerPrice);
                o.writeInt(a.upperPrice);

                o.writeUTF(a.comment);
            }

            xFileManager.saveFile(o, Context.FILE_ALARM);
        }
Exemple #5
0
        public void savePriceboard()
        {
            xDataOutput o = new xDataOutput(10000);

            o.writeInt(Context.FILE_VERSION);
            //  indices
            o.writeInt(mIndices.size());
            int i = 0;

            for (i = 0; i < mIndices.size(); i++)
            {
                stPriceboardStateIndex idx = (stPriceboardStateIndex)mIndices.elementAt(i);
                o.writeShort(idx.id);
                o.writeUTF(idx.code);
                o.writeInt(idx.marketID);
                o.writeFloat(idx.current_point);        //	*100
                o.writeFloat(idx.changed_point);        //	*100
                o.writeInt(idx.changed_percent);        //	*100
                o.writeInt((int)idx.total_volume);
                o.writeInt(idx.inc_cnt);
                o.writeInt(idx.ce_cnt);
                o.writeInt(idx.dec_cnt);
                o.writeInt(idx.floor_cnt);
                o.writeInt(idx.ref_num);
                o.writeInt(idx.totalGTGD);              //	*10000
                o.writeInt(idx.market_status);
                o.writeFloat(idx.reference);

                o.writeUTF(idx.mDate);
            }
            //  shares
            for (i = 0; i < mIndices.size(); i++)
            {
                stPriceboardStateIndex idx = (stPriceboardStateIndex)mIndices.elementAt(i);
                stPriceboardState.flush(o, idx.marketID);
            }

            xFileManager.saveFile(o, PRICEBOARD_FILE);
        }
        //=================================
        xDataOutput gainlossBlock()
        {
            xDataOutput o = new xDataOutput(2 * 1024);

            o.writeInt(_gainLossManager.getTotal());
            for (int i = 0; i < _gainLossManager.getTotal(); i++)
            {
                stGainloss g = _gainLossManager.getGainLossAt(i);

                o.writeUTF(g.code);
                o.writeInt(g.date);
                o.writeInt((int)(g.price * 1000));
                o.writeInt(g.volume);
            }

            return(o);
        }
Exemple #7
0
        void saveFibonaccie()
        {
            if (!mShouldSaveFile)
            {
                return;
            }
            Share share = mShare;

            if (share == null)
            {
                return;
            }

            string filename = getFilename();

            if (mTrends.size() == 0)
            {
                xFileManager.removeFile(filename);
                return;
            }
            xDataOutput o = new xDataOutput(1000);

            o.writeInt(Context.FILE_VERSION);
            o.writeInt(mTrends.size());
            for (int i = 0; i < mTrends.size(); i++)
            {
                stTrendLine t = (stTrendLine)mTrends.elementAt(i);
                o.writeByte(t.type);
                o.writeInt(t.color);
                o.writeFloat(t.thickness);
                for (int j = 0; j < 3; j++)
                {
                    o.writeFloat(t.candleIdx[j]);
                    //Utils.trace("=====savefile: candle=" + t.candleIdx[j]);
                    o.writeFloat(t.price[j]);
                }

                if (t.type == DRAW_ABC)
                {
                    o.writeUTF((string)t.data);
                }
            }

            //Utils.trace("=====savefile");
            xFileManager.saveFile(o, filename);
        }
        public void save(xDataOutput o)
        {
            o.writeInt(mDate);
            o.writeInt(mShareID);
            o.writeUTF(mCode);
            o.writeByte(mFloorID);
            o.writeFloat(mPriceRef);
            o.writeBoolean(mIsIndex);
            o.writeInt(mMaxTradeVolume);

            o.writeInt(mTradeTransactionCount);
            int cnt = mTradeTransactionCount * FIELD_CNT;

            for (int i = 0; i < cnt; i++)
            {
                o.writeInt(mTradeTransactionBuffer[i]);
            }
        }
Exemple #9
0
        public void save()
        {
            xDataOutput o = new xDataOutput(2048);

            o.writeInt(FILE_GAINLOSS_VERSION);

            o.writeInt(mGainlosses.size());
            for (int i = 0; i < mGainlosses.size(); i++)
            {
                stGainloss g = (stGainloss)mGainlosses.elementAt(i);
                o.writeUTF(g.code);
                o.writeInt(g.date);
                o.writeFloat(g.price);
                o.writeInt(g.volume);
            }

            xFileManager.saveFile(o, FILE_GAINLOSS);
        }
        public xDataOutput getUserDataAsStreamOldVersion()
        {
            xDataOutput o = new xDataOutput(5 * 1024);

            o.writeInt(FILE_ONLINE_USERDATA_VER);
            int i;

            xVector         v                = new xVector(10);
            xVector         mFavorGroups     = shareGroups();
            GainLossManager mGainLossManager = gainLossManager();

            int groupCnt = mFavorGroups.size() < 30?mFavorGroups.size():30;

            for (i = 0; i < groupCnt; i++)
            {
                stShareGroup p = (stShareGroup)mFavorGroups.elementAt(i);

                bool added = false;
                for (int j = 0; j < v.size(); j++)
                {
                    stShareGroup o1 = (stShareGroup)v.elementAt(j);
                    if (o1.getName().CompareTo(p.getName()) == 0)
                    {
                        added = true;
                        break;
                    }
                }

                if (added == false)
                {
                    v.addElement(p);
                }
            }

            o.writeInt(v.size());

            for (i = 0; i < v.size(); i++)
            {
                stShareGroup p = (stShareGroup)v.elementAt(i);

                p.save(o);
            }

            //  gainloss com.data
            o.writeInt(FILE_GAINLOSS_SIGNAL);
            o.writeInt(mGainLossManager.getTotal());
            for (i = 0; i < mGainLossManager.getTotal(); i++)
            {
                stGainloss g = mGainLossManager.getGainLossAt(i);

                o.writeUTF(g.code);
                o.writeInt(g.date);
                o.writeInt((int)g.price);
                o.writeInt(g.volume);
            }

            //  filter sets
            o.writeInt(FILE_FILTER_SET_VERSION);
            FilterManager.getInstance().saveFilterSets(o);

            //  down signal group
            //o.writeInt(FILE_DOWN_SIGNAL);
            //mAlarmGroup.save(o);

            return(o);
        }