コード例 #1
0
        private void AdjustFile(AgdFile agdFile, string timeZoneInfoId)
        {
            if (agdFile == null)
                throw new NullReferenceException("agdFile can't be null");

            if (string.IsNullOrEmpty(timeZoneInfoId))
                throw new NullReferenceException("timeZoneInfoId can't be null");

            var daylightTime = TimeZoneHelpers.GetDaylightChanges(timeZoneInfoId, agdFile.LastEpoch.Year);

            richTextBox1.AppendText(string.Format("{0}: started adjusting\r\n", agdFile));

            using (var db = new OrmLiteConnectionFactory(agdFile.GetSQLiteConnectionString(), SqliteDialect.Provider).OpenDbConnection())
            {
                AdjustFileForFallDst(agdFile, db, daylightTime);
                AdjustFileForSpringDst(agdFile, db, daylightTime);

                var oldFirstEpoch = agdFile.FirstEpoch;
                var oldLastEpoch = agdFile.LastEpoch;
                var totalEpochs = agdFile.EpochCount;
                agdFile.GetFirstAndLastEpoch();
                richTextBox1.AppendText(string.Format("{0}: original first epoch - {1:G} | new first epoch - {2:G}\r\n", agdFile, oldFirstEpoch, agdFile.FirstEpoch));
                richTextBox1.AppendText(string.Format("{0}: original last epoch - {1:G} | new last epoch - {2:G}\r\n", agdFile, oldLastEpoch, agdFile.LastEpoch));
                richTextBox1.AppendText(string.Format("{0}: original totalEpochs - {1:G} | new total epochs - {2:G}\r\n", agdFile, totalEpochs, agdFile.EpochCount));
                richTextBox1.AppendText(string.Format("{0}: finished adjusting file\r\n", agdFile));
            }
        }