Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Helpers.cs « Controls « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ed5d288617b542977385ee1d53aa592c533faacc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
 *                     GNU AFFERO GENERAL PUBLIC LICENSE
 *                       Version 3, 19 November 2007
 *  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 *  Everyone is permitted to copy and distribute verbatim copies
 *  of this license document, but changing it is not allowed.
 */
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;

namespace UVtools.WPF.Controls
{
    public static class Helpers
    {
        public static readonly List<FileDialogFilter> ImagesFileFilter = new()
        {
            new()
            {
                Name = "Image Files",
                Extensions = new List<string>
                {
                    "png",
                    "bmp",
                    "jpeg",
                    "jpg",
                    "tif",
                    "tiff",
                }
            },
        };

        public static readonly List<FileDialogFilter> ImagesFullFileFilter = new()
        {
            new()
            {
                Name = "PNG Files",
                Extensions = new List<string>
                {
                    "png"
                }
            },
            new()
            {
                Name = "JPG Files",
                Extensions = new List<string>
                {
                    "jpg",
                    "jpeg"
                }
            },
            new()
            {
                Name = "BMP Files",
                Extensions = new List<string>
                {
                    "bmp",
                }
            },
            new()
            {
                Name = "TIF Files",
                Extensions = new List<string>
                {
                    "tif",
                    "tiff",
                }
            },
        };

        public static readonly List<FileDialogFilter> PngFileFilter = new()
        {
            new()
            {
                Name = "Image Files",
                Extensions = new List<string>
                {
                    "png",
                }
            }
        };

        public static readonly List<FileDialogFilter> TxtFileFilter = new()
        {
            new()
            {
                Name = "Text Files",
                Extensions = new List<string>
                {
                    "txt",
                }
            }
        };

        public static readonly List<FileDialogFilter> IniFileFilter = new()
        {
            new()
            {
                Name = "Ini Files",
                Extensions = new List<string>
                {
                    "ini",
                }
            }
        };

        public static readonly List<FileDialogFilter> OperationSettingFileFilter = new()
        {
            new()
            {
                Name = "UVtools operation settings",
                Extensions = new List<string>
                {
                    "uvtop",
                }
            }
        };

        public static readonly List<FileDialogFilter> ScriptsFileFilter = new()
        {
            new()
            {
                Name = "Script Files",
                Extensions = new List<string>
                {
                    "csx",
                    "cs",
                }
            }
        };

        public static List<FileDialogFilter> ToAvaloniaFileFilter(List<KeyValuePair<string, List<string>>> data)
        {
            var result = new List<FileDialogFilter>(data.Capacity);
            result.AddRange(data.Select(kv => new FileDialogFilter {Name = kv.Key, Extensions = kv.Value}));
            return result;
        }

        public static List<FileDialogFilter> ToAvaloniaFilter(string name, string extension)
        {
            return new(1)
            {
                new() {Name = name, Extensions = new List<string>(1) {extension}}
            };
        }
    }
}