Skip to content

Commit

Permalink
Merge branch '1.0.6' of github.com:CadeEvs/FrostyToolsuite into 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
CadeEvs committed May 24, 2022
2 parents b0c2166 + 929f8ae commit b5c8dec
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 79 deletions.
3 changes: 2 additions & 1 deletion FrostyControls/Themes/Generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<!-- TextBox -->
<Style x:Key="{x:Type TextBoxBase}" TargetType="{x:Type TextBoxBase}" BasedOn="{x:Null}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="{StaticResource ControlBackground}"/>
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
<Setter Property="Foreground" Value="{StaticResource FontColor}"/>
<Setter Property="CaretBrush" Value="{StaticResource FontColor}"/>
Expand All @@ -170,7 +171,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}" >
<Border x:Name="border" BorderBrush="{StaticResource ControlBackground}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Padding="0"/>
</Border>
<ControlTemplate.Triggers>
Expand Down
2 changes: 1 addition & 1 deletion FrostyEditor/BuildDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Mon 05/16/2022 0:34:23.10
Thu 04/07/2022 13:27:09.12
2 changes: 1 addition & 1 deletion FrostyModManager/BuildDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Mon 05/16/2022 0:34:23.10
Thu 04/07/2022 13:27:09.12
98 changes: 55 additions & 43 deletions FrostyModManager/Controls/FrostyModDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,69 +118,81 @@ private async void FrostyModDescription_Loaded(object sender, RoutedEventArgs e)
}

List<AffectedFileInfo> affectedFiles = new List<AffectedFileInfo>();
FrostyMod localMod = Mod as FrostyMod;
FrostyMod[] localMods;
if (Mod is FrostyModCollection)
{
localMods = (Mod as FrostyModCollection).Mods.ToArray();
}
else
{
localMods = new FrostyMod[1];
localMods[0] = Mod as FrostyMod;
}

if (localMod != null)
foreach (FrostyMod localMod in localMods)
{
await Task.Run(() =>
if (localMod != null)
{
if (localMod.NewFormat)
await Task.Run(() =>
{
foreach (BaseModResource resource in localMod.Resources)
if (localMod.NewFormat)
{
if (resource.Type == ModResourceType.Embedded)
continue;
foreach (BaseModResource resource in localMod.Resources)
{
if (resource.Type == ModResourceType.Embedded)
continue;

string resType = resource.Type.ToString().ToUpper();
string resourceName = resource.Name;
string resType = resource.Type.ToString().ToUpper();
string resourceName = resource.Name;

if (resource.UserData != "")
{
string[] arr = resource.UserData.Split(';');
resType = arr[0].ToUpper();
resourceName = arr[1];
if (resource.UserData != "")
{
string[] arr = resource.UserData.Split(';');
resType = arr[0].ToUpper();
resourceName = arr[1];
}
affectedFiles.Add(new AffectedFileInfo(resourceName, resType, resource.IsAdded, resource.IsModified));
}
affectedFiles.Add(new AffectedFileInfo(resourceName, resType, resource.IsAdded, resource.IsModified));
}
}
else
{
// affected files
DbObject modObj = null;
using (DbReader reader = new DbReader(new FileStream(localMod.Path, FileMode.Open, FileAccess.Read), null))
modObj = reader.ReadDbObject();

int resourceId = -1;
foreach (DbObject resource in modObj.GetValue<DbObject>("resources"))
else
{
resourceId++;
// affected files
DbObject modObj = null;
using (DbReader reader = new DbReader(new FileStream(localMod.Path, FileMode.Open, FileAccess.Read), null))
modObj = reader.ReadDbObject();

string resourceType = resource.GetValue<string>("type");
if (resourceType == "embedded")
continue;
int resourceId = -1;
foreach (DbObject resource in modObj.GetValue<DbObject>("resources"))
{
resourceId++;

string name = resource.GetValue<string>("name");
string resourceType = resource.GetValue<string>("type");
if (resourceType == "embedded")
continue;

bool isModify = false;
bool isAdded = false;
string name = resource.GetValue<string>("name");

foreach (DbObject action in modObj.GetValue<DbObject>("actions"))
{
if (action.GetValue<int>("resourceId") == resourceId)
bool isModify = false;
bool isAdded = false;

foreach (DbObject action in modObj.GetValue<DbObject>("actions"))
{
string type = action.GetValue<string>("type");
switch (type)
if (action.GetValue<int>("resourceId") == resourceId)
{
case "modify": isModify = true; break;
case "add": isAdded = true; break;
string type = action.GetValue<string>("type");
switch (type)
{
case "modify": isModify = true; break;
case "add": isAdded = true; break;
}
}
}
}

affectedFiles.Add(new AffectedFileInfo(name, resource.GetValue<string>("type").ToUpper(), isAdded, isModify));
affectedFiles.Add(new AffectedFileInfo(name, resource.GetValue<string>("type").ToUpper(), isAdded, isModify));
}
}
}
});
});
}
}

loadingText.Visibility = Visibility.Collapsed;
Expand Down
2 changes: 1 addition & 1 deletion FrostyModManager/Windows/CollectionSettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</DockPanel>
<DockPanel LastChildFill="True">
<Label Content="Link " FontFamily="Global User Interface" Width="75"/>
<TextBox x:Name="modLinkTextBox" VerticalContentAlignment="Center" Text="" Margin="1" BorderThickness="1" Style="{StaticResource TextBoxValidate}"/>
<TextBox x:Name="modLinkTextBox" VerticalContentAlignment="Center" Text="" Margin="1" BorderThickness="1"/>
</DockPanel>
</StackPanel>
</Grid>
Expand Down
8 changes: 6 additions & 2 deletions FrostyModManager/Windows/CollectionSettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ private void saveButton_Click(object sender, System.Windows.RoutedEventArgs e)

for (int i = 0; i < availableMods.Count; i++)
{
if (availableMods[i].IsEnabled)
appliedMods.Add(availableMods[i].Mod as FrostyMod);
if (availableMods[i].IsEnabled && availableMods[i].Mod is FrostyMod fmod)
appliedMods.Add(fmod);
}

CollectionManifest details = new CollectionManifest()
Expand Down Expand Up @@ -124,6 +124,10 @@ private void saveButton_Click(object sender, System.Windows.RoutedEventArgs e)
foreach (FrostyMod mod in appliedMods)
{
archive.CreateEntryFromFile(mod.Path, mod.Filename);
if (!mod.NewFormat)
{
archive.CreateEntryFromFile(mod.Path.Replace(".fbmod", "_01.archive"), mod.Filename.Replace(".fbmod", "_01.archive"));
}
}

archive.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion FrostyModManager/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@

<Expander x:Name="modsExpander" IsExpanded="False">
<Border BorderThickness="1" BorderBrush="#454545" Margin="16, 0, -97, 2">
<ListView x:Name="collectionModsList" ItemsSource="{Binding Path=Mods}" MouseDoubleClick="collectionModsList_MouseDoubleClick" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView x:Name="collectionModsList" ItemsSource="{Binding Path=Mods}" MouseDoubleClick="collectionModsList_MouseDoubleClick" ScrollViewer.HorizontalScrollBarVisibility="Disabled" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel" LostFocus="collectionModsList_LostFocus">
<ListView.View>
<GridView ScrollViewer.CanContentScroll="False">
<GridView.ColumnHeaderContainerStyle>
Expand Down
39 changes: 33 additions & 6 deletions FrostyModManager/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,17 @@ private void FrostyWindow_FrostyLoaded(object sender, EventArgs e)
bool isEnabled = bool.Parse(modEnabledPair[1]);

IFrostyMod mod = availableMods.Find((IFrostyMod a) => a.Filename == modEnabledPair[0]);
if (mod == null)
{
List<IFrostyMod> collections = availableMods.FindAll((IFrostyMod a) => a is FrostyModCollection);
foreach (FrostyModCollection collection in collections)
{
mod = collection.Mods.Find((FrostyMod a) => a.Filename == modEnabledPair[0]);
if (mod != null)
break;
}
}

pack.AddMod(mod, isEnabled, backupFileName);
}
}
Expand Down Expand Up @@ -494,7 +505,7 @@ private void removeProfileButton_Click(object sender, RoutedEventArgs e)

DirectoryInfo di = new DirectoryInfo(fs.BasePath + "ModData\\" + selectedPack.Name);
if (di.Exists)
di.Delete();
di.Delete(true);


packsComboBox.Items.Refresh();
Expand Down Expand Up @@ -643,7 +654,7 @@ private void installModButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog
{
Filter = "(All supported formats)|*.fbmod;*.rar;*.zip;*.7z;*.daimod;*.fbcollection" + "|*.fbmod (Frostbite Mod)|*.fbmod" + "|*.rar (Rar File)|*.rar" + "|*.zip (Zip File)|*.zip" + "|*.7z (7z File)|*.7z" + "|*.daimod (DragonAge Mod)|*.daimod" + "|*.fbcollection (Fb Collection)|*.fbcollection",
Filter = "(All supported formats)|*.fbmod;*.rar;*.zip;*.7z;*.daimod" + "|*.fbmod (Frostbite Mod)|*.fbmod" + "|*.rar (Rar File)|*.rar" + "|*.zip (Zip File)|*.zip" + "|*.7z (7z File)|*.7z" + "|*.daimod (DragonAge Mod)|*.daimod",
Title = "Install Mod",
Multiselect = true
};
Expand Down Expand Up @@ -676,8 +687,7 @@ private void uninstallModButton_Click(object sender, RoutedEventArgs e)

File.Delete(fi.FullName);

// TODO: delete collection mods option maybe
if (mod is FrostyModCollection && Config.Get<bool>("DELETECOLLECTIONMODS", false))
if (mod is FrostyModCollection && Config.Get<bool>("DeleteCollectionMods", true))
{
foreach (FrostyMod cmod in ((FrostyModCollection)mod).Mods)
{
Expand Down Expand Up @@ -1374,7 +1384,7 @@ private void availableModsList_MouseDoubleClick(object sender, MouseButtonEventA

private void addModButton_Click(object sender, RoutedEventArgs e)
{
foreach (FrostyMod mod in availableModsList.SelectedItems)
foreach (IFrostyMod mod in availableModsList.SelectedItems)
selectedPack.AddMod(mod);

appliedModsList.Items.Refresh();
Expand Down Expand Up @@ -1627,7 +1637,7 @@ private void availableModsFilter_LostFocus(object sender, RoutedEventArgs e)
return;
}

availableModsList.Items.Filter = new Predicate<object>((object a) => ((FrostyMod)a).ModDetails.Title.ToLower().Contains(availableModsFilterTextBox.Text.ToLower()));
availableModsList.Items.Filter = new Predicate<object>((object a) => ((IFrostyMod)a).ModDetails.Title.ToLower().Contains(availableModsFilterTextBox.Text.ToLower()));
}

private void PART_ShowOnlyReplacementsCheckBox_Checked(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -1752,5 +1762,22 @@ private void collectionModsList_MouseDoubleClick(object sender, MouseButtonEvent
// focus on tab item
appliedModsTabItem.IsSelected = true;
}

private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (sender is ListBox && !e.Handled)
{
e.Handled = true;
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
eventArg.Source = sender;
var parent = ((Control)sender).Parent as UIElement;
parent.RaiseEvent(eventArg);
}
}

private void collectionModsList_LostFocus(object sender, RoutedEventArgs e) {
((ListView)sender).UnselectAll();
}
}
}
Loading

0 comments on commit b5c8dec

Please sign in to comment.