Ejemplo n.º 1
0
        public void Load(TagQueryCriteria tagQueryCriteria = null, bool newAdditionsOnly = false)
        {
            FileNames.Clear();

            currentQuery = tagQueryCriteria ?? new TagQueryCriteria();
            var sourcePath = PersistanceUtil.RetreiveSetting(Setting.SourceDirectory);

            if (!Directory.Exists(sourcePath))
            {
                sourcePath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                PersistanceUtil.RecordSetting(Setting.SourceDirectory, sourcePath);
            }
            if (newAdditionsOnly)
            {
                FileNames.Add(NewFiles);
            }
            else
            {
                FileNames.Add(ImageFileUtil.GetImageFilenames(sourcePath, currentQuery));
            }

            if (currentQuery.orderDirection == OrderDirection.RANDOM)
            {
                FileNames.Shuffle();
            }
            watcher.Path = sourcePath;
            watcher.EnableRaisingEvents = true;
            FilesLoaded(null, new EventArgs());
        }
Ejemplo n.º 2
0
        public static void Prepare(string[] args)
        {
            FileNames.Clear();

            for (var i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "/lang":
                case "-lang":
                {
                    //Changes the language of the app, example: -lang pt
                    if (args.Length > i + 1)
                    {
                        UserSettings.All.LanguageCode = args[++i];
                    }

                    break;
                }

                case "-sm":
                case "/sm":
                case "-softmode":
                case "/softmode":
                {
                    //Forces using software mode.
                    UserSettings.All.DisableHardwareAcceleration = true;
                    break;
                }

                case "-hm":
                case "/hm":
                case "-hardmode":
                case "/hardmode":
                {
                    //Forces using hardware mode.
                    UserSettings.All.DisableHardwareAcceleration = false;
                    break;
                }

                default:
                {
                    //Anything else is treated as file to be imported.
                    if (File.Exists(args[i]))
                    {
                        FileNames.Add(args[i]);
                    }

                    break;
                }
                }
            }
        }
Ejemplo n.º 3
0
        public async Task <DialogResult> ShowDialog(Window window)
        {
            var dialog = new Avalonia.Controls.OpenFileDialog {
                AllowMultiple   = AllowMultiple,
                Directory       = InitialDirectory,
                InitialFileName = FileName,
                Title           = Title,
                Filters         = filters
            };

            var files = await dialog.ShowAsync(window.window);

            FileNames.Clear();
            FileNames.AddRange(files.Select(f => Path.GetFullPath(f)));

            return(FileNames.Count > 0 ? DialogResult.OK : DialogResult.Cancel);
        }
Ejemplo n.º 4
0
        public async Task <DialogResult> ShowDialog(Window window)
        {
            var dialog = new Avalonia.Controls.SaveFileDialog {
                DefaultExtension = DefaultExtension,
                Directory        = InitialDirectory,
                InitialFileName  = FileName,
                Title            = Title,
                Filters          = filters
            };

            var file = await dialog.ShowAsync(window.window);

            FileNames.Clear();

            if (file != null)
            {
                FileNames.Add(file);
            }

            return(FileNames.Count > 0 ? DialogResult.OK : DialogResult.Cancel);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Shows the dialog to the user.
        /// </summary>
        /// <param name="owner">The window that owns this dialog.</param>
        public async Task <DialogResult> ShowDialog(Form owner)
        {
            var dialog = new Modern.WindowKit.Controls.OpenFileDialog {
                AllowMultiple   = AllowMultiple,
                Directory       = InitialDirectory,
                InitialFileName = FileName,
                Title           = Title,
                Filters         = filters
            };

            var files = await dialog.ShowAsync(owner.window);

            FileNames.Clear();

            if (files?.Any() == true)
            {
                FileNames.AddRange(files.Select(f => Path.GetFullPath(f)));
            }

            return(FileNames.Count > 0 ? DialogResult.OK : DialogResult.Cancel);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Shows the dialog to the user.
        /// </summary>
        /// <param name="owner">The window that owns this dialog.</param>
        public async Task <DialogResult> ShowDialog(Form owner)
        {
            var dialog = new Modern.WindowKit.Controls.SaveFileDialog {
                DefaultExtension = DefaultExtension,
                Directory        = InitialDirectory,
                InitialFileName  = FileName,
                Title            = Title,
                Filters          = filters
            };

            var file = await dialog.ShowAsync(owner.window);

            FileNames.Clear();

            if (file is not null)
            {
                FileNames.Add(file);
            }

            return(FileNames.Count > 0 ? DialogResult.OK : DialogResult.Cancel);
        }
Ejemplo n.º 7
0
        public void Build()
        {
            OnProgress?.Invoke($"Building {Project.Name}...", 0, 1, false);

            Log.Message($"Processing {Project.Name} - Developed by {Project.Producer}");
            Log.Message($"Version {Project.Version}");
            Log.Message($"{Project.Copyright} {Project.Year}");

            var entries = Project.GetFiles()
                          .Select(x => new Entry()
            {
                Project     = Project,
                ProjectFile = x
            })
                          .ToList();

            FileNames.Clear();
#if true //DEBUG
            int filesProcessed = 0;
            int filesCount     = entries.Count;
            foreach (var entry in entries)
            {
                OnProgress?.Invoke($"Processing {entry.ProjectFile.Name}...", filesProcessed, filesCount, false);
                ProcessEntry(entry, OutputFolder);
                OnProgress?.Invoke($"Processed {entry.ProjectFile.Name}!", filesProcessed, filesCount, false);
            }
            OnProgress?.Invoke($"Build completed.", 1, 1, true);
#else
            var dispatcher = new Dispatcher <Entry>(entries);
            dispatcher.Process((e) => ProcessEntryAsync(e, OutputFolder));
            OnProgress?.Invoke($"Build completed in {dispatcher.ElapsedMilliseconds / 1000.0} seconds.", 1, 1, true);
#endif

            var fileSystemName = Path.Combine(OutputFolder, Path.Combine("data", "filesystem.bin"));
            ExportFileSystem(fileSystemName);
        }
Ejemplo n.º 8
0
        public static void Prepare(string[] args)
        {
            FileNames.Clear();

            for (var i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "/lang":
                case "-lang":
                {
                    //Changes the language of the app, example: -lang pt
                    if (args.Length > i + 1)
                    {
                        try
                        {
                            //Fail silently if the language is not properly set.
                            UserSettings.All.LanguageCode = new CultureInfo(args[i + 1]).ThreeLetterISOLanguageName;
                            i++;
                        }
                        catch (Exception e)
                        {
                            LogWriter.Log(e, $"The language code {args[i + 1]} was not recognized.");
                        }
                    }

                    break;
                }

                case "-d":
                case "/d":
                case "-download":
                case "/download":
                {
                    if (args.Length > i + 2)
                    {
                        IsInDownloadMode = true;
                        i++;

                        DownloadMode = args[i++];
                        DownloadPath = args[i++];
                    }
                    break;
                }

                case "-sm":
                case "/sm":
                case "-softmode":
                case "/softmode":
                {
                    //Forces using software mode.
                    UserSettings.All.DisableHardwareAcceleration = true;
                    break;
                }

                case "-hm":
                case "/hm":
                case "-hardmode":
                case "/hardmode":
                {
                    //Forces using hardware mode.
                    UserSettings.All.DisableHardwareAcceleration = false;
                    break;
                }

                case "-settings":
                {
                    //Enables the mode which will try to save the settings using administrative privileges.
                    IsInSettingsMode = true;
                    break;
                }

                default:
                {
                    var path = args[i].Trim('"').Trim('\'');

                    //Anything else is treated as file to be imported.
                    if (File.Exists(path))
                    {
                        FileNames.Add(path);
                    }

                    break;
                }
                }
            }
        }
Ejemplo n.º 9
0
    public static void Prepare(string[] args)
    {
        FileNames.Clear();

        for (var i = 0; i < args.Length; i++)
        {
            switch (args[i])
            {
            case "/lang":
            case "-lang":
            {
                //Changes the language of the app, example: -lang pt
                if (args.Length > i + 1)
                {
                    try
                    {
                        //Fail silently if the language is not properly set.
                        UserSettings.All.LanguageCode = new CultureInfo(args[i + 1]).ThreeLetterISOLanguageName;
                        i++;
                    }
                    catch (Exception e)
                    {
                        LogWriter.Log(e, $"The language code {args[i + 1]} was not recognized.");
                    }
                }

                break;
            }

            case "-d":
            case "/d":
            case "-download":
            case "/download":
            {
                if (args.Length > i + 2)
                {
                    IsInDownloadMode = true;
                    i++;

                    DownloadMode = args[i++];
                    DownloadPath = args[i++];
                }
                break;
            }

            case "-sm":
            case "/sm":
            case "-softmode":
            case "/softmode":
            {
                //Forces using software mode.
                UserSettings.All.DisableHardwareAcceleration = true;
                break;
            }

            case "-hm":
            case "/hm":
            case "-hardmode":
            case "/hardmode":
            {
                //Forces using hardware mode.
                UserSettings.All.DisableHardwareAcceleration = false;
                break;
            }

            case "-settings":
            {
                //Enables the mode which will try to save the settings using administrative privileges.
                IsInSettingsMode = true;
                break;
            }

            case "-n":
            case "/n":
            case "/new":
            case "-new":
            {
                NewInstance = true;
                break;
            }

            case "-o":
            case "/o":
            case "/open":
            case "-open":
            {
                if (args.Length <= i + 1)
                {
                    return;
                }

                //-open screen-recorder(webcam-recorder/board-recorder/editor/options/startup/minimized)
                Open = true;

                #region Get window to open

                var window = args[++i];

                switch (window)
                {
                case "m":
                case "min":
                case "minimized":
                    WindownToOpen = -1;
                    break;

                case "up":
                case "start":
                case "startup":
                    WindownToOpen = 0;
                    break;

                case "s":
                case "screen":
                case "screen-recorder":
                    WindownToOpen = 1;
                    break;

                case "w":
                case "webcam":
                case "webcam-recorder":
                    WindownToOpen = 2;
                    break;

                case "b":
                case "board":
                case "board-recorder":
                    WindownToOpen = 3;
                    break;

                case "e":
                case "editor":
                    WindownToOpen = 4;
                    break;

                case "o":
                case "options":
                    WindownToOpen = 5;
                    break;

                default:
                    Open = false;
                    break;
                }

                #endregion

                break;
            }

            case "-r":
            case "/r":
            case "/region":
            case "-region":
            {
                try
                {
                    //-region/-r 100,50,500,200
                    if (args.Length > i + 1)
                    {
                        Region = Rect.Parse(args[++i]);
                    }
                }
                catch (Exception ex)
                {
                    LogWriter.Log(ex, "Not possible to parse the capture rectangle from arguments", args[i++]);
                }

                break;
            }

            case "-f":
            case "/f":
            case "/framerate":
            case "-framerate":
            case "/frequency":
            case "-frequency":
            {
                if (args.Length <= i + 1)
                {
                    return;
                }

                //-framerate/-f (60fps/60fpm/60fph/manual/interaction)
                ParseFramerate(args[++i].Trim());
                break;
            }

            case "-l":
            case "/l":
            case "/limit":
            case "-limit":
            {
                //-limit/-l 01:30
                if (args.Length <= i + 1)
                {
                    return;
                }

                if (TimeSpan.TryParse(args[++i].Trim(), CultureInfo.InvariantCulture, out var time))
                {
                    Limit = time;
                }

                break;
            }

            case "-c":
            case "/c":
            case "/capture":
            case "-capture":
            {
                StartCapture = true;
                break;
            }

            default:
            {
                var path = args[i].Trim('"').Trim('\'');

                //Anything else is treated as file to be imported.
                if (File.Exists(path))
                {
                    FileNames.Add(path);
                }

                break;
            }
            }
        }
    }