Skip to content

Commit

Permalink
V1.1.1 Fixes
Browse files Browse the repository at this point in the history
Fixed the known issues
  • Loading branch information
Jan-Fcloud authored Feb 23, 2022
1 parent 1e88e56 commit 057ab60
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 10 deletions.
13 changes: 9 additions & 4 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@
<ColumnDefinition/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Label x:Name="InfoText" Foreground="White" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20"/>
<Label x:Name="InfoText" Foreground="White" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left" Margin="11,5,0,5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20"/>
<StackPanel Grid.Row="1" Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2">
<TextBlock Text="EasyExtractUnitypackge is a Program to Extract Unitypackages to get files from .Unitypackage Files." HorizontalAlignment="Center" Margin="5" FontSize="10" Foreground="White"/>

<TextBlock Text="UEaC is a Program to Extract Unitypackages to get files from .Unitypackage Files." HorizontalAlignment="Center" Margin="5" FontSize="10" Foreground="White"/>
<Label Content="Adding multiple files, can take a while!" Foreground="Red" HorizontalAlignment="Center" FontSize="9" Background="Black"/>

<Border Height="160" BorderThickness="1" BorderBrush="White">
<TextBlock VerticalAlignment="Top" Text="Search or just Drag Drop .Unitypackage" HorizontalAlignment="Center" Margin="0,141,0,0" FontSize="10" Foreground="White"/>
</Border>
<Button x:Name="searchUnitybtn" Click="searchUnitybtn_Click" Content="Search Unitypackage" Foreground="White" Width="150" FontSize="10"/>
</StackPanel>
<CheckBox x:Name="deletemalware" Click="deletemalware_Click" Grid.Column="1" Content="Delete .dll and .cs files" HorizontalAlignment="Left" Margin="30,19,0,0" Grid.Row="3" VerticalAlignment="Top" Width="142" IsChecked="True" Background="White" Foreground="White"/>
<Label Grid.Column="1" Content="Note: no plugins/scripts will be usable&#xD;&#xA;(it is meant to protect against Unity malware)" HorizontalAlignment="Left" Margin="177,0,0,0" Grid.Row="3" VerticalAlignment="Center" Width="253" Grid.ColumnSpan="2" Foreground="Red" Height="44"/>
<Button x:Name="information" Click="information_Click" Content="Info" Margin="147,0,0,16" Grid.Column="2" Grid.Row="3" HorizontalAlignment="Left" Width="73" Height="25" VerticalAlignment="Bottom" Foreground="White"/>
<CheckBox x:Name="deletemalware" Click="deletemalware_Click" Grid.Column="1" Content="Delete .dll and .cs files" HorizontalAlignment="Left" Margin="10,25,0,0" Grid.Row="3" VerticalAlignment="Top" Width="142" IsChecked="True" Background="White" Foreground="White"/>
<Label Grid.Column="1" Content="Note: no plugins/scripts will be usable" HorizontalAlignment="Left" Margin="152,23,0,0" Grid.Row="3" VerticalAlignment="Top" Width="253" Grid.ColumnSpan="2" Foreground="Red" Height="25"/>
<CheckBox x:Name="updelete" Click="updelete_Click" Grid.Column="1" Content="Delete .unitypackage after" HorizontalAlignment="Left" Margin="10,1,0,0" Grid.Row="3" VerticalAlignment="Top" Foreground="White" Width="220"/>
<CheckBox x:Name="notefailed" Click="notefailed_Click" Grid.Column="2" Content="Write failed to file" HorizontalAlignment="Center" Margin="0,5,0,0" Grid.Row="3" VerticalAlignment="Top" Width="145" Foreground="White" Visibility="Hidden" IsEnabled="False"/>
</Grid>
</Window>
73 changes: 67 additions & 6 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using ICSharpCode.SharpZipLib.GZip;
using Microsoft.Win32;
using System.Windows.Input;
using System.Threading.Tasks;

namespace EasyExtractUnitypackage
{
Expand All @@ -17,13 +18,19 @@ public partial class MainWindow : Window
private int assetCounter;
private int packagesExtracted;
private bool deleteMalwareC = true;
private int noAccess;
private bool deleteUnityP = false;
//private bool noteFails = false;
//public string failedFiles = "";


public MainWindow()
{
InitializeComponent();
removedfiles = 0;
assetCounter = 0;
packagesExtracted = 0;
noAccess = 0;
}

private void Window_DragEnter(object sender, DragEventArgs e)
Expand Down Expand Up @@ -59,7 +66,7 @@ private void Window_Drop(object sender, DragEventArgs e)

}

MessageBox.Show(packagesExtracted + " .unitypackage files proccessed\n" + assetCounter + " Files Extracted \n" + removedfiles + " Files Removed", "Unitypackage Extract & Clean");
MessageBox.Show(packagesExtracted + " .unitypackage files proccessed\n" + assetCounter + " Files Extracted \n" + removedfiles + " Files Removed\n" + noAccess + " Errors (File Access Error)", "Unitypackage Extract & Clean");
//InfoText.Content = "Completed";

}
Expand All @@ -84,6 +91,10 @@ private void ExtractUnitypackage(string filename)
ExtractTGZ(filename, tempFolder);
ProcessExtracted(tempFolder, targetFolder);

/*if (noteFails)
{
File.WriteAllText("FAILED.txt", failedFiles);
}*/
if (deleteMalwareC)
{
string root = targetFolder;
Expand All @@ -94,14 +105,29 @@ private void ExtractUnitypackage(string filename)

foreach (string subdirectory in subdirectoryEntries) {

LoadSubDirs(subdirectory);

foreach (string f in Directory.GetFiles(subdirectory))
{
if (f.Contains(".dll") || f.Contains(".cs"))
{
File.Delete(f);
removedfiles++;
}

}

LoadSubDirs(subdirectory);
}

}


Directory.Delete(tempFolder, true);
packagesExtracted++;
if (deleteUnityP)
{
File.Delete(filename);
}
Mouse.OverrideCursor = Cursors.Arrow;

}
Expand All @@ -118,7 +144,7 @@ void LoadSubDirs(string dir)

foreach (string f in Directory.GetFiles(subdirectory))
{
if (f.EndsWith(".dll") || f.EndsWith(".cs") || f.EndsWith(".dll.meta"))
if (f.Contains(".dll") || f.Contains(".cs"))
{
File.Delete(f);
removedfiles++;
Expand All @@ -139,7 +165,14 @@ public void ExtractTGZ(string gzArchiveName, string destFolder)
Stream gzipStream = new GZipInputStream(inStream);

TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream);
tarArchive.ExtractContents(destFolder);
try {
tarArchive.ExtractContents(destFolder);
}
catch (System.Exception ex)
{
noAccess++;
}

tarArchive.Close();

gzipStream.Close();
Expand Down Expand Up @@ -183,7 +216,11 @@ private void ProcessExtracted(string tempFolder, string targetFolder)
}
catch (System.Exception ex)
{
MessageBox.Show("Error", ex.Message);
// MessageBox.Show("Error", ex.Message);
noAccess++;
//failedFiles += targetFolder + "\n";


}

}
Expand Down Expand Up @@ -214,9 +251,33 @@ private void searchUnitybtn_Click(object sender, RoutedEventArgs e)
ExtractUnitypackage(openFile.FileName);
}

private void deletemalware_Click_1(object sender, RoutedEventArgs e)
private void updelete_Click(object sender, RoutedEventArgs e)
{
if (updelete.IsChecked == true)
{
deleteUnityP = true;
}
else if (updelete.IsChecked == false)
{
deleteUnityP = false;
}
}

private void notefailed_Click(object sender, RoutedEventArgs e)
{
/*if (notefailed.IsChecked == true)
{
noteFails = true;
}
else if (notefailed.IsChecked == false)
{
noteFails = false;
}*/
}

private void information_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("You can't avoid extraction errors.\nLuckily, the files that you lose from them likely aren't mandatory.\nSo any models SHOULD be fine!\nBut mostly things should extract normally.\nIt mostly happens for corrupt data and such...\n\n\nNote: Adding packages in the double or tripple diggits will take a while.", "UEaC V1.1.1 Information");
}
}
}

2 comments on commit 057ab60

@HakuSystems
Copy link

@HakuSystems HakuSystems commented on 057ab60 Feb 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to collab on my main github page of this project?

add me on discord "lyze#2001"

@Jan-Fcloud
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing! I've sent you a request on discord.

Please sign in to comment.