Example #1
0
        public static void DbDirectCopyWriter <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db)
        {
            try {
                if (debug.OldPath != debug.FilePath)
                {
                    var storeCompareList = db.Attached["StoreCompare"] as List <string>;

                    if (storeCompareList != null)
                    {
                        foreach (var path in storeCompareList)
                        {
                            var oldPath = DbPathLocator.GetStoredFile(path);

                            if (!IOHelper.SameFile(oldPath, path))
                            {
                                // Test their modified date
                                IOHelper.Delete(path);
                                IOHelper.Copy(oldPath, path);
                            }
                        }
                    }
                    else if (!IOHelper.SameFile(debug.OldPath, debug.FilePath))
                    {
                        // Test their modified date
                        IOHelper.Delete(debug.FilePath);
                        IOHelper.Copy(debug.OldPath, debug.FilePath);
                    }
                }
            }
            catch (Exception err) {
                debug.ReportException(err);
            }
        }