예제 #1
0
        public void Save(DeviceRepository source, LocalRepository target, SaveOption options)
        {
            Debug.Assert(source != null);
            Debug.Assert(target != null);
            Debug.Assert(options != null);

            IEnumerable<Track> m_tracks = null;
            switch (options.Scope) {
            case SaveScope.All:
                m_tracks = source.Tracks;
                break;
            case SaveScope.Selection:
                m_tracks = source.Selection;
                break;
            case SaveScope.Range:
                m_tracks = source.Tracks.Where((t) =>
                    (t.StartTime >= options.StartDate) && (t.StartTime <= options.EndDate));
                break;
            }

            if (m_tracks != null) {
                List<string> files = new List<string>();
                foreach (Track track in m_tracks) {
                    files.Add(track.TrackFile);
                }
                new TrackImportHelper(target).Import(source.Vehicle, files, options.Convert, options.Overwrite);
            }
        }
 public void ImportAllTest()
 {
     string repoDir = PersonalTest.StorageRoot;
     string sourceDir = PersonalTest.DeviceRoot;
     //string sourceDir = @"x:\gfdata";
     LocalRepository repo = new LocalRepository();
     repo.Open(repoDir, null);
     Vehicle vehicle = new Vehicle() { VehicleId = "v121212121212" };
     TrackImportHelper helper = new TrackImportHelper(repo);
     helper.ImportAll(vehicle, sourceDir, false, true);
 }
 public void GetFolderTest()
 {
     LocalRepository repo = new LocalRepository();
     repo.Open(PersonalTest.StorageRoot, null);
     TrackFolderManager manager = new TrackFolderManager(repo);
     Vehicle vehicle = new Vehicle() {
         VehicleId = "v121212121212"
     };
     string trackFile = "all_2012_03_11_20_37_31";
     string folder = manager.GetFolder(vehicle, trackFile, true);
     Assert.AreEqual(folder, vehicle.VehicleId + @"\2012\03\11");
 }
        public void ImportTest()
        {
            LocalRepository repo = new LocalRepository();
            repo.Open(PersonalTest.StorageRoot, null);
            Vehicle vehicle = new Vehicle() { VehicleId = "v121212121212" };
            TrackImportHelper helper = new TrackImportHelper(repo);

            List<string> files = new List<string>();
            files.Add(Path.Combine(PersonalTest.DeviceRoot, @"all_2012_03_11_20_37_31"));
            files.Add(Path.Combine(PersonalTest.DeviceRoot, @"all_2012_03_11_20_38_00"));
            files.Add(Path.Combine(PersonalTest.DeviceRoot, @"event_2012_03_11_20_38_31"));

            helper.Import(vehicle, files, true, true);
        }
 public TrackFolderManager(LocalRepository owner)
 {
     Debug.Assert(owner != null, "owner is null");
     m_owner = owner;
 }
예제 #6
0
 private PersonalDomain()
 {
     m_preferences = new Preferences();
     m_vehicles = new VehicleManager();
     m_repository = new LocalRepository();
 }
예제 #7
0
 public TrackImportHelper(LocalRepository owner)
 {
     Debug.Assert(owner != null, "owner is null");
     m_owner = owner;
 }