-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuExtensions.cs
More file actions
147 lines (116 loc) · 5.5 KB
/
MenuExtensions.cs
File metadata and controls
147 lines (116 loc) · 5.5 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
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
using BundleManagerRewrite;
using Frosty.Controls;
using Frosty.Core;
using Frosty.Core.Controls;
using Frosty.Core.Windows;
using FrostySdk;
using FrostySdk.Managers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
namespace BundleManager
{
internal class MenuExtensions
{
public static string BMMenuName => "Tools";
public static string SubBMMenuName => "Bundle Manager";
public class BundleManagerMenuExtension : MenuExtension
{
public override string TopLevelMenuName => BMMenuName;
public override string SubLevelMenuName => SubBMMenuName;
public override string MenuItemName => "Complete Bundles (Gameplay)";
public override ImageSource Icon => new ImageSourceConverter().ConvertFromString("pack://application:,,,/FrostyEditor;component/Images/Compile.png") as ImageSource;
public override RelayCommand MenuItemClicked => new RelayCommand((o) =>
{
FrostyTaskWindow.Show("Completing Bundles", "", (task) =>
{
if (BmCache.LoadCache(task))
{
BundleManager BM = new BundleManager(task);
BM.CompleteBundleManage();
}
});
});
}
public class BundleManagerCosmeticMenuExtension : MenuExtension
{
public override string TopLevelMenuName => BMMenuName;
public override string SubLevelMenuName => SubBMMenuName;
public override string MenuItemName => "Complete Bundles (Cosmetic)";
public override ImageSource Icon => new ImageSourceConverter().ConvertFromString("pack://application:,,,/FrostyEditor;component/Images/Compile.png") as ImageSource;
public override RelayCommand MenuItemClicked => new RelayCommand((o) =>
{
FrostyTaskWindow.Show("Completing Bundles", "", (task) =>
{
if (BmCache.LoadCache(task))
{
BundleManager BM = new BundleManager(task, true);
BM.CompleteBundleManage();
}
});
});
}
public class BundleManagerLevelsMenuExtension : MenuExtension
{
public override string TopLevelMenuName => BMMenuName;
public override string SubLevelMenuName => SubBMMenuName;
public override string MenuItemName => "Complete Level Bundles";
public override ImageSource Icon => new ImageSourceConverter().ConvertFromString("pack://application:,,,/FrostyEditor;component/Images/Compile.png") as ImageSource;
public override RelayCommand MenuItemClicked => new RelayCommand((o) =>
{
LevelBundlesPopup win = new LevelBundlesPopup();
if (win.ShowDialog() == false)
return;
string name = win.LevelName;
if (win.LevelName.Contains(" "))
name = win.LevelName.Substring(0, win.LevelName.IndexOf(' '));
FrostyTaskWindow.Show(String.Format("Completing {0} bundles", name), "", (task) =>
{
if (BmCache.LoadCache(task))
{
BundleManager BM = new BundleManager(task);
BM.CompleteBundleManage(win.Bundles.Select(bunName => App.AssetManager.GetBundleId(bunName)).ToList());
}
});
});
}
public class ClearBundlesMenuExtension : MenuExtension
{
public override string TopLevelMenuName => BMMenuName;
public override string SubLevelMenuName => SubBMMenuName;
public override string MenuItemName => "Clear Bundles";
public override ImageSource Icon => new ImageSourceConverter().ConvertFromString("pack://application:,,,/FrostyEditor;component/Images/Clear.png") as ImageSource;
public override RelayCommand MenuItemClicked => new RelayCommand((o) =>
{
FrostyTaskWindow.Show("Clearing Bundles", "", (task) =>
{
BundleManager BM = new BundleManager(task);
BM.ClearBundleEdits();
});
});
}
public class ExportPrerequisitsMenuExtension : MenuExtension
{
public override string TopLevelMenuName => BMMenuName;
public override string SubLevelMenuName => SubBMMenuName;
public override string MenuItemName => "Export Preqrequists";
public override ImageSource Icon => new ImageSourceConverter().ConvertFromString("pack://application:,,,/FrostyEditor;component/Images/Database.png") as ImageSource;
public override RelayCommand MenuItemClicked => new RelayCommand((o) =>
{
FrostySaveFileDialog sfd = new FrostySaveFileDialog("Save Bundle Manager Prerequisites", "*.bmpre (Bundle Manager Prerequisites File)|*.bmpre", "My Mod");
if (sfd.ShowDialog())
{
FrostyTaskWindow.Show("Exporting Prerequisites", "", (task) =>
{
BundleManager BM = new BundleManager(task);
BM.ExportPrerequistis(sfd.FileName);
});
};
});
}
}
}