-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackageControl.cs
More file actions
82 lines (72 loc) · 2.63 KB
/
Copy pathPackageControl.cs
File metadata and controls
82 lines (72 loc) · 2.63 KB
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
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace CerediraPackageManagerUI
{
/// <summary>
/// Пользовательский компонент Карточка пакета
/// </summary>
public partial class PackageControl : UserControl
{
private PackageInfo packageInfo;
private Form1 mainForm;
public PackageControl()
{
InitializeComponent();
}
public void ShowPackageInfo(Form1 form1, PackageInfo packageInfo)
{
this.mainForm = form1;
this.packageInfo = packageInfo;
packageChangelog.Text = packageInfo.Changelog;
packageName.Text = packageInfo.Name + " " + packageInfo.PackageVersion;
packageDescription.Text = packageInfo.Description;
packageAuthor.Text = packageInfo.PackageAuthor;
packageWebsite.Text = packageInfo.Website;
if (packageInfo.Installed == true)
{
installPackage.Enabled = false;
deletePackage.Enabled = true;
packageIcon.Image = Properties.Resources.product_package_delivered_icon;
}
else
{
installPackage.Enabled = true;
deletePackage.Enabled = false;
packageIcon.Image = Properties.Resources.box_package_icon;
}
infoPackageName.Text = packageInfo.Name;
infoPackageVersion.Text = packageInfo.PackageVersion;
infoPackageAuthor.Text = packageInfo.PackageAuthor;
infoWebsite.Text = packageInfo.Website;
infoDownloadPath.Text = packageInfo.DownloadPath;
infoOriginalPackageName.Text = packageInfo.OriginalPackageName;
infoPackageSourceSize.Text = packageInfo.PackageSourceSize;
infoPackageSize.Text = "";
packageFiles.Text = packageInfo.PackageFiles;
}
private void DeletePackage_Click(object sender, System.EventArgs e)
{
foreach (var item in packageInfo.PackageFiles.Split('\n').Reverse())
{
try
{
if (File.Exists(item))
{
File.Delete(item);
}
} catch { }
}
foreach (var item in packageInfo.PackageDirs.Split('\n').Reverse())
{
try
{
if (Directory.Exists(item))
{
Directory.Delete(item);
}
} catch { }
}
}
}
}