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

PEProfileFolder.cs « Forms « UVtools.GUI - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15ea1aaec4d7cc0b50e1f8f582bcb21703f72ce0 (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
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace UVtools.GUI.Forms
{
    public class PEProfileFolder
    {
        public enum FolderType
        {
            Print,
            Printer
        }

        public FolderType Type { get; }

        public ListView ListView { get; }
        public ToolStripLabel LabelCount { get; }
        public string SourcePath { get; }
        public string TargetPath { get; }

        public string SelectedFiles
        {
            get
            {
                StringBuilder sb = new StringBuilder();
                foreach (ListViewItem item in ListView.Items)
                {
                    if (!item.Checked) continue;
                    sb.AppendLine(item.Text);
                }

                return sb.ToString();
            }
        }

        public PEProfileFolder(FolderType type, ListView listView, ToolStripLabel labelCount)
        {
            Type = type;
            ListView = listView;
            LabelCount = labelCount;

            switch (type)
            {
                case FolderType.Print:
                    SourcePath = $"{Application.StartupPath}{Path.DirectorySeparatorChar}PrusaSlicer{Path.DirectorySeparatorChar}sla_print";
                    TargetPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}{Path.DirectorySeparatorChar}PrusaSlicer{Path.DirectorySeparatorChar}sla_print";
                    break;
                case FolderType.Printer:
                    SourcePath = $"{Application.StartupPath}{Path.DirectorySeparatorChar}PrusaSlicer{Path.DirectorySeparatorChar}printer";
                    TargetPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}{Path.DirectorySeparatorChar}PrusaSlicer{Path.DirectorySeparatorChar}printer";
                    break;
            }
        }
    }
}