예제 #1
0
        private void AddPathButtonClick(object sender, EventArgs e)
        {
            LOGGER.Debug($"User pressed button to add a new path");

            var result = folderBrowserDialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                LOGGER.Info($"Trying to add a new path");

                if (Directory.Exists(folderBrowserDialog.SelectedPath) && !pathContainer.RegisteredPaths.Any(path => path.Fullname == folderBrowserDialog.SelectedPath))
                {
                    var newPath = new Lib.Youtube.Automation.Paths.Path()
                    {
                        Fullname           = folderBrowserDialog.SelectedPath,
                        Filter             = "*.mp4;*.mkv",
                        SelectedTemplateId = 0,
                        SearchRecursively  = false,
                        Inactive           = false,
                        SearchHidden       = false
                    };

                    LOGGER.Info($"Adding newly created path: '{newPath}'");

                    pathContainer.RegisterPath(newPath);
                    RefillListView();
                    lvPaths.SelectedIndices.Add(lvPaths.Items.Count - 1);
                }
                else
                {
                    LOGGER.Error($"Could not add path '{folderBrowserDialog.SelectedPath}': either it doesn't exist or it's already part of the path array.");
                }
            }
        }
예제 #2
0
        private void RecreateSaved()
        {
            LOGGER.Debug($"Recreating cache of saved paths");
            Saved = new PathContainer();
            foreach (var path in Container.RegisteredPaths)
            {
                LOGGER.Debug($"Recreating cache for path '{path.Fullname}'");
                var newPath = new Automation.Paths.Path()
                {
                    Filter             = path.Filter,
                    Fullname           = path.Fullname,
                    Inactive           = path.Inactive,
                    SearchHidden       = path.SearchHidden,
                    SearchRecursively  = path.SearchRecursively,
                    SelectedTemplateId = path.SelectedTemplateId,
                    MoveAfterUpload    = path.MoveAfterUpload,
                    MoveDirectoryPath  = path.MoveDirectoryPath,
                    SearchOrder        = path.SearchOrder
                };

                Saved.RegisterPath(newPath);
            }
        }