Beispiel #1
0
        private void processFile(string phoneId, string path, DBManager dbm)
        {
            string fileName = Path.GetFileName(path);

            if (!dbm.isFileProcess(phoneId, fileName, false))
            {
                dbm.saveFile(phoneId, fileName, false, false, new FileInfo(path).Length);

                try
                {
                    dbm.beginTransaction(phoneId + fileName);
                    string date = Path.GetFileNameWithoutExtension(path).Substring(0, 8);

                    StreamReader sr = new StreamReader(path);

                    while (!sr.EndOfStream)
                        this.processLine(sr.ReadLine(), fileName, date, dbm);

                    sr.Close();
                    dbm.saveFile(phoneId, fileName, true, false, new FileInfo(path).Length);
                    dbm.endTransaction(phoneId + fileName,true);
                }
                catch (Exception ex)
                {
                    dbm.endTransaction(phoneId + fileName, false);
                }
            }
        }