Esempio n. 1
0
        private void SourceListBox_DoubleClick(object sender, EventArgs e)
        {
            IngressListBoxItem ie = (IngressListBoxItem)(SourceListBox.Items[SourceListBox.SelectedIndex]);

            try
            {
                // Look for a file extension.
                if (ie.Identifier.Path().Contains("."))
                {
                    System.Diagnostics.Process.Start(ie.Identifier.Path());
                }
            }
            // If the file is not found, handle the exception and inform the user.
            catch (System.ComponentModel.Win32Exception)
            {
                MessageBox.Show("\"" + ie.Identifier.Path() + "\" File not found.");
            }
        }
Esempio n. 2
0
        private void AddCopyButton_Click(object sender, EventArgs e)
        {
            if (_selectedCamNode == null)
            {
                Console.WriteLine("No Selected Node");
            }
            else
            {
                Console.WriteLine("Copy using \"" + _selectedCamNode.DorF.Name() + "\"");
            }
            if (!_sources.Contains(_selectedCamNode.DorF))
            {
                _sources.Add(_selectedCamNode.DorF);
                IngressListBoxItem ib = new IngressListBoxItem();
                ib.DisplayName = _selectedCamNode.DorF.Name();
                ib.Identifier  = _selectedCamNode.DorF;

                ////SourceListBox.Items.Add(_selectedCamNode.DorF.Name());
                //SourceListBox.Items.Add(ib);
                //_sourceCams.Add(_currentCamera);
                //CamNumListBox.Items.Add(_currentCamera);

                int sel = -1;
                IngressListDialog dlg = new IngressListDialog(SceneListBox);
                if (dlg.ShowListDialog("Select Scene", ref sel) == DialogResult.OK)
                {
                    _destinationScenes.Add(_scenes[sel]);
                    //DestListBox.SelectedIndex = SceneListBox.Items.Count - 1;

                    ib.CamNum    = _currentCamera;
                    ib.SceneName = _scenes[sel];

                    SourceListBox.Items.Add(ib);
                    _sourceCams.Add(_currentCamera);

                    EnableExecuteCopyButton();
                }
            }
        }
Esempio n. 3
0
        private void MakeCopyGuessByDate(int camNum, int numMovieFilesToGuess)
        {
            if (_previousCamRoot == null)
            {
                return;
            }

            if (_previousSources == null)
            {
                return;
            }

            // start by aligning movie from cam directory with movies in copy list by Date

            tSortType tempSortType = _cameraFileSortType;

            _cameraFileSortType = tSortType.SORT_BY_DATE;

            List <DirectoryOrFile> moviesOnPrevCam = new List <DirectoryOrFile>();

            _previousCamRoot.SortBy(_cameraFileSortType);
            TraverseLoadMovieList(ref _previousCamRoot, ref moviesOnPrevCam);

            for (int i = 0; i < moviesOnPrevCam.Count; i++)
            {
                Console.WriteLine("Guess: " + i + " \"" + moviesOnPrevCam[i].Name() + "\" " + File.GetLastWriteTime(moviesOnPrevCam[i].Path()).ToString());
            }

            List <DirectoryOrFile> moviesOnThisCam = new List <DirectoryOrFile>();

            _camRoot.SortBy(_cameraFileSortType);
            TraverseLoadMovieList(ref _camRoot, ref moviesOnThisCam);

            _cameraFileSortType = tempSortType;

            for (int i = 0; i < moviesOnThisCam.Count; i++)
            {
                Console.WriteLine("New: " + i + " \"" + moviesOnThisCam[i].Name() + "\" " + File.GetLastWriteTime(moviesOnThisCam[i].Path()).ToString());
            }

            // _previoiusSources is list of movies selected for copy
            // moviesOnThisCam is sorted list of movies on camera directory being querried
            // - Find selected movie timestamp and select closest movie from moviesOnThisCam
            for (int i = 0; i < numMovieFilesToGuess; i++)
            {
                int      closestDateMatch = -1;
                DateTime sourceDT         = File.GetLastWriteTime(_previousSources[i].Path());
                long     minDelta         = 0;

                int j = 0;
                for (j = 0; j < moviesOnThisCam.Count; j++)
                {
                    DateTime thisDT = File.GetLastWriteTime(moviesOnThisCam[j].Path());
                    long     delta  = Math.Abs(thisDT.Ticks - sourceDT.Ticks);

                    if (j == 0)
                    {
                        closestDateMatch = j;
                        minDelta         = delta;
                    }
                    else if (delta < minDelta)
                    {
                        closestDateMatch = j;
                        minDelta         = delta;
                    }
                }

                j = closestDateMatch;
                // found it
                _sources.Add(moviesOnThisCam[j]);
                IngressListBoxItem ib = new IngressListBoxItem();
                ib.DisplayName = moviesOnThisCam[j].Name();
                ib.Identifier  = moviesOnThisCam[j];
                ib.CamNum      = camNum;
                ib.SceneName   = _previousDestinationScenes[i];
                SourceListBox.Items.Add(ib);
                _destinationScenes.Add(_previousDestinationScenes[i]);
                _sourceCams.Add(camNum);
            }
        }
Esempio n. 4
0
        private void MakeCopyGuessBySortOrder(int camNum)
        {
            if (_previousCamRoot == null)
            {
                return;
            }

            if (_previousSources == null)
            {
                return;
            }

            // start by aligning movie from cam directory with movies in copy list
            List <DirectoryOrFile> moviesOnPrevCam = new List <DirectoryOrFile>();

            _previousCamRoot.SortBy(_cameraFileSortType);
            TraverseLoadMovieList(ref _previousCamRoot, ref moviesOnPrevCam);

            for (int i = 0; i < moviesOnPrevCam.Count; i++)
            {
                Console.WriteLine("Guess: " + i + " \"" + moviesOnPrevCam[i].Name() + "\"");
            }

            List <DirectoryOrFile> moviesOnThisCam = new List <DirectoryOrFile>();

            _camRoot.SortBy(_cameraFileSortType);
            TraverseLoadMovieList(ref _camRoot, ref moviesOnThisCam);

            for (int i = 0; i < moviesOnThisCam.Count; i++)
            {
                Console.WriteLine("New: " + i + " \"" + moviesOnThisCam[i].Name() + "\"");
            }

            // _previoiusSources is list of movies selected for copy
            // moviesOnPrevCam is sorted list of movies from prev camera directory
            // moviesOnThisCam is sorted list of movies on camera directory being querried
            // - Find selected movie in moviesOnPrevCam and select corresponding movie from moviesOnThisCam
            for (int i = 0; i < _previousSources.Count; i++)
            {
                int j = 0;
                for (j = 0; j < moviesOnPrevCam.Count; j++)
                {
                    if (moviesOnPrevCam[j].Path() == _previousSources[i].Path())
                    {
                        // look for j'th movie on new movie list
                        if (j < moviesOnThisCam.Count)
                        {
                            // found it
                            _sources.Add(moviesOnThisCam[j]);
                            IngressListBoxItem ib = new IngressListBoxItem();
                            ib.DisplayName = moviesOnThisCam[j].Name();
                            ib.Identifier  = moviesOnThisCam[j];
                            ib.CamNum      = camNum;
                            ib.SceneName   = _previousDestinationScenes[i];
                            SourceListBox.Items.Add(ib);
                            _destinationScenes.Add(_previousDestinationScenes[i]);
                            //_sourceCams.Add(_previousSourceCams[i]);
                            //CamNumListBox.Items.Add(_previousSourceCams[i]);
                            _sourceCams.Add(camNum);
                            break;
                        }
                    }
                }
            }
        }