Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strDataSrcFile"></param>
        /// <param name="strDataDestFile"></param>

        public void processFile(StocksDbOper pStocksDbOper, System.String strDataSrcFile, System.String strDataDestFile)
        {
            System.IO.StreamReader fileReadHander    = null;
            System.IO.StreamWriter fileWriterHander  = null;
            System.String          str_Symbol_Extern = ".SS";


            //System.IO.FileInfo fileinfo = new System.IO.FileInfo(strDataSrcFile);
            fileReadHander   = new System.IO.StreamReader(strDataSrcFile);
            fileWriterHander = new System.IO.StreamWriter(strDataDestFile);

            System.String strGetLineSrc = System.String.Empty;
            // Read and display lines from the file until the end of
            // the file is reached.
            while ((strGetLineSrc = fileReadHander.ReadLine()) != null)
            {
                if (strDataSrcFile.Contains("SS"))
                {
                    str_Symbol_Extern = ".SS";
                }
                else if (strDataSrcFile.Contains("SZ"))
                {
                    str_Symbol_Extern = ".SZ";
                }
                else
                {
                    str_Symbol_Extern = "";
                }
                _ProcessEachLine(pStocksDbOper, strGetLineSrc, fileWriterHander, str_Symbol_Extern);
            }//end while

            fileReadHander.Close();
            fileWriterHander.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private void _InitializeData()
        {
            this.m_strDataSrcPath              = "./DataSrc";
            this.m_strDataDestPath             = "./DataDest";
            this.m_backgroundWorkerAnalystFile = new System.ComponentModel.BackgroundWorker();

            m_FileSYstemFolder     = new FileSystemFolder();
            m_ProcessFileSSSZStock = new ProcessFileSSSZStock();

            m_StocksDbOper = new StocksDbOper();
            System.IO.File.Delete("STOCKSSQLITE_DB.db");
            m_StocksDbOper.createNewDatabase();
            m_StocksDbOper.connectToDatabase();
            m_StocksDbOper.createTable();
            m_StocksDbOper.BeginTransaction();
            m_StocksDbOper.Commit();
            //m_StocksDbOper.disConnectToDatabase();
        }//InitializeData
Exemplo n.º 3
0
        public void _ProcessEachLine(StocksDbOper pStocksDbOper, System.String strLineSrc, System.IO.StreamWriter fileWriterHander, System.String str_Symbol_Extern)
        {
            System.String strLineDest = System.String.Empty;
            System.String strLineCopy = strLineSrc;
            System.Int32  nFindFisrt  = 0;
            System.Int32  nFindSecond = 0;
            System.String str_symbol  = System.String.Empty;          //201009
            //System.String str_symbolExtern = System.String.Empty;//.SS
            System.String str_symboluse        = System.String.Empty; //201009.SS
            System.String str_namePinYinFirst  = System.String.Empty;
            System.String str_namePinYinFull_0 = System.String.Empty;
            System.String str_namePinYinFull_4 = System.String.Empty;
            System.String str_name_utf8        = System.String.Empty;

            //log4net.LogManager.GetLogger("ExeLogger").Info(System.String.Format("_ProcessEachLine {0}", strLineSrc));
            strLineCopy = strLineSrc.Trim();
            if (strLineCopy.Length <= 0)
            {
                return;
            }
            //R002(201009)
            nFindFisrt  = strLineCopy.IndexOf("(");
            nFindSecond = strLineCopy.IndexOf(")");

            str_name_utf8        = strLineCopy.Substring(0, nFindFisrt);//m_n_Name
            str_name_utf8        = str_name_utf8.Trim();
            str_namePinYinFirst  = GetFirstPinyin(str_name_utf8);
            str_namePinYinFirst  = str_namePinYinFirst.Trim();
            str_namePinYinFull_0 = GetHanZiArray_PinYin_Full_0(str_name_utf8);
            str_namePinYinFull_0 = str_namePinYinFull_0.Trim();
            str_namePinYinFull_4 = GetHanZiArray_PinYin_Full_4(str_name_utf8);
            str_namePinYinFull_4 = str_namePinYinFull_4.Trim();

            str_symbol    = strLineCopy.Substring(nFindFisrt + 1, nFindSecond - nFindFisrt - 1);//m_s_Symbol
            str_symbol    = str_symbol.Trim();
            str_symboluse = str_symbol + str_Symbol_Extern;

            strLineDest = "{";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "\t" + "/*Symbol*/" + "(\"" + str_symbol + "\"),";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "\t" + "/*SymbolExtern*/" + "(\"" + str_Symbol_Extern + "\"),";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "\t" + "/*SymbolUse*/" + "(\"" + str_symboluse + "\"),";
            fileWriterHander.WriteLine(strLineDest);


            strLineDest = "\t" + "/*NamePinYinFirst*/" + "(\"" + str_namePinYinFirst + "\"),";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "\t" + "/*NamePinYinFull0*/" + "(\"" + str_namePinYinFull_0 + "\"),";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "\t" + "/*NamePinYinFull4*/" + "(\"" + str_namePinYinFull_4 + "\"),";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "\t" + "/*NameUtf8*/" + "(L\"" + str_name_utf8 + "\")";
            fileWriterHander.WriteLine(strLineDest);

            strLineDest = "},";
            fileWriterHander.WriteLine(strLineDest);


            // {
            //  /*Symbol*/("600652"),
            //  /*SymbolExtern*/(".SS"),
            //  /*SymbolUse*/("600652.SS"),
            //  /*NamePinYinFirst*/("ASGF"),
            //  /*NamePinYinFull0*/("AI SI GU FEN"),
            //  /*NamePinYinFull4*/("AI4 SI3 GU3 FEN4"),
            //  /*NameUtf8*/(L"爱使股份")
            // },

            pStocksDbOper.AddToSQLArray(str_symboluse, str_namePinYinFirst, str_namePinYinFull_0, str_namePinYinFull_4, str_name_utf8);

            return;
        }