示例#1
0
        protected override int RecordOne(string list, int curpos, ref information info)
        {
            //code
            int code_pos = list.IndexOf(codeBegin, curpos);
            if (code_pos < 0){
                return -1; //this page don't have enough
            }
            curpos = code_pos + codeBegin.Length;
            string strCode = list.Substring(curpos, 6);
            int nCode;
            if( ! int.TryParse(strCode, out nCode)){
                RecordOne_Throw( -1, list, curpos);
            }
            if (nCode < 600000)
                RecordOne_Throw( nCode, list, curpos);

            //name
            int name_pos = list.IndexOf("<td", curpos);
            if (name_pos < 0)
                RecordOne_Throw(nCode, list, curpos);

            curpos = name_pos + 4;
            name_pos = list.IndexOf(">", curpos);
            if (name_pos < 0)
                RecordOne_Throw(nCode, list, curpos);

            curpos = name_pos = name_pos + 1;
            int name_pos_end = list.IndexOf("</td>", curpos);
            if (name_pos_end < 0)
                RecordOne_Throw(nCode, list, curpos);

            string strName = list.Substring(name_pos, name_pos_end - name_pos);
            if (strCode == "")
                RecordOne_Throw(nCode, list, curpos);

            curpos = name_pos_end + 5;

            info.CodeInt = nCode;
            info._market._value = market.type.ShangHai;
            info._name = strName;

            return curpos;
        }
示例#2
0
        protected override int RecordOne(string list, int curpos, ref information info)
        {
            int keypoint = list.IndexOf(nameKeyPoint1, curpos);
            if (keypoint < 0)
                return -1; //no more code;
            curpos = keypoint;

            //code
            int pos_after_end;
            string strCode = Util.Mid(list, curpos, codeBegin, codeEnd, out pos_after_end);
            if (pos_after_end < 0)
                RecordOne_Throw(-2, list, curpos);

            int nCode;
            if (! int.TryParse(strCode, out nCode)) {
                RecordOne_Throw(-3, list, curpos);
            }
            if (nCode == 0)
                RecordOne_Throw(nCode, list, curpos);

            curpos = pos_after_end;

            //name:

            //shorten market name
            string strName = Util.Mid(list, curpos, shortBegin, shortEnd, out pos_after_end);
            if (pos_after_end < 0)
                RecordOne_Throw(nCode, list, curpos);

            curpos = pos_after_end;

            info.CodeInt = nCode;
            info._market._value = market.type.ShenZhen;
            info._name = strName;

            return curpos;
        }
示例#3
0
文件: Quote.cs 项目: williamxhero/SF
 public Quote(information info)
 {
     _info = info;
 }
示例#4
0
 public void copy(information other)
 {
     _code = other._code;
     _market = other._market;
     _name = other._name;
 }
示例#5
0
 protected virtual int RecordOne(string list, int curpos, ref information info)
 {
     return 0;
 }
示例#6
0
 protected void SaveInfomation(information info)
 {
     Quote q = new Quote(info);
     q.SaveInformation();
     _callback(q);
 }