Skip to content

Commit 035918a

Browse files
committed
Changelog:
- Backup changes.
1 parent ed91eea commit 035918a

15 files changed

+660
-63
lines changed

AboutScreen.xaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<UserControl x:Class="Java_Bytecode_Toolkit.AboutScreen"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Java_Bytecode_Toolkit"
7+
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
8+
mc:Ignorable="d"
9+
d:DesignHeight="450" d:DesignWidth="800"
10+
Background="{DynamicResource BackgroundColor1}">
11+
<Grid>
12+
<Grid.RowDefinitions>
13+
<RowDefinition Height="*"/>
14+
</Grid.RowDefinitions>
15+
16+
<Grid.ColumnDefinitions>
17+
<ColumnDefinition Width="*"/>
18+
</Grid.ColumnDefinitions>
19+
20+
<mdxam:MarkdownScrollViewer Grid.Row="0" Grid.Column="0" Name="MainMarkdownScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Padding="10">
21+
22+
</mdxam:MarkdownScrollViewer>
23+
</Grid>
24+
</UserControl>

AboutScreen.xaml.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Java_Bytecode_Toolkit
17+
{
18+
/// <summary>
19+
/// Interaction logic for AboutScreen.xaml
20+
/// </summary>
21+
public partial class AboutScreen : UserControl
22+
{
23+
public AboutScreen()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

App.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
1010
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
1111
</dependentAssembly>
12+
<dependentAssembly>
13+
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
14+
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
15+
</dependentAssembly>
16+
<dependentAssembly>
17+
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
18+
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
19+
</dependentAssembly>
20+
<dependentAssembly>
21+
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
22+
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
23+
</dependentAssembly>
1224
</assemblyBinding>
1325
</runtime>
1426
</configuration>

App.xaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
<clr:String x:Key="AppName">Java Bytecode Toolkit</clr:String>
1414

15+
<Path x:Key="AppIcon" Stretch="Uniform" Fill="#333333" Data="M 7.082 11.934 Q 7.082 13.622 6.3 14.518 Q 5.517 15.414 4.035 15.414 Q 3.373 15.414 2.81 15.186 L 2.81 13.411 Q 3.297 13.78 3.9 13.78 Q 5.195 13.78 5.195 11.858 L 5.195 6.866 L 7.082 6.866 Z M 8.914 15.268 L 8.914 6.866 L 11.973 6.866 Q 13.379 6.866 14.135 7.381 Q 14.891 7.897 14.891 8.834 Q 14.891 9.514 14.431 10.024 Q 13.971 10.534 13.256 10.733 L 13.256 10.756 Q 14.152 10.868 14.688 11.418 Q 15.225 11.969 15.225 12.76 Q 15.225 13.914 14.398 14.591 Q 13.572 15.268 12.143 15.268 Z M 10.807 8.26 L 10.807 10.252 L 11.639 10.252 Q 12.225 10.252 12.561 9.968 Q 12.898 9.684 12.898 9.186 Q 12.898 8.26 11.516 8.26 Z M 10.807 11.659 L 10.807 13.873 L 11.832 13.873 Q 12.488 13.873 12.86 13.569 Q 13.232 13.264 13.232 12.737 Q 13.232 12.233 12.866 11.946 Q 12.5 11.659 11.844 11.659 Z M 22.225 8.407 L 19.828 8.407 L 19.828 15.268 L 17.93 15.268 L 17.93 8.407 L 15.545 8.407 L 15.545 6.866 L 22.225 6.866 Z"/>
16+
1517
<Path x:Key="LightThemeIcon" Stretch="Uniform" Fill="#212121" Data="M11.996 19.01a.75.75 0 0 1 .743.649l.007.102v1.5a.75.75 0 0 1-1.493.101l-.007-.101v-1.5a.75.75 0 0 1 .75-.75Zm6.022-2.072 1.06 1.06a.75.75 0 1 1-1.06 1.061l-1.06-1.06a.75.75 0 0 1 1.06-1.061Zm-10.983 0a.75.75 0 0 1 0 1.06L5.974 19.06a.75.75 0 0 1-1.06-1.06l1.06-1.061a.75.75 0 0 1 1.06 0ZM12 6.475a5.525 5.525 0 1 1 0 11.05 5.525 5.525 0 0 1 0-11.05Zm0 1.5a4.025 4.025 0 1 0 0 8.05 4.025 4.025 0 0 0 0-8.05Zm9.25 3.293a.75.75 0 0 1 .102 1.493l-.102.007h-1.5a.75.75 0 0 1-.102-1.493l.102-.007h1.5Zm-17-.029a.75.75 0 0 1 .102 1.494l-.102.006h-1.5a.75.75 0 0 1-.102-1.493l.102-.007h1.5Zm1.64-6.37.084.072 1.06 1.06a.75.75 0 0 1-.976 1.134l-.084-.073-1.06-1.06a.75.75 0 0 1 .976-1.134Zm13.188.072a.75.75 0 0 1 .073.977l-.073.084-1.06 1.06a.75.75 0 0 1-1.133-.976l.072-.084 1.06-1.061a.75.75 0 0 1 1.061 0ZM12 1.99a.75.75 0 0 1 .743.648l.007.102v1.5a.75.75 0 0 1-1.493.101l-.007-.102v-1.5a.75.75 0 0 1 .75-.75Z"/>
1618

1719
<Path x:Key="DarkThemeIcon" Stretch="Uniform" Fill="#212121" Data="M20.026 17.001c-2.762 4.784-8.879 6.423-13.663 3.661a9.964 9.964 0 0 1-3.234-2.983.75.75 0 0 1 .365-1.131c3.767-1.348 5.785-2.911 6.956-5.146 1.232-2.353 1.551-4.93.689-8.464a.75.75 0 0 1 .769-.926 9.961 9.961 0 0 1 4.457 1.327C21.149 6.1 22.788 12.217 20.025 17Zm-8.248-4.903c-1.25 2.388-3.31 4.099-6.817 5.499a8.492 8.492 0 0 0 2.152 1.766 8.501 8.501 0 1 0 8.502-14.725 8.485 8.485 0 0 0-2.792-1.016c.647 3.384.23 6.044-1.045 8.476Z"/>
@@ -77,6 +79,20 @@
7779
</Trigger>
7880
</Style.Triggers>
7981
</Style>
82+
83+
<Style x:Key="ConcealedButtonStyle" TargetType="Button">
84+
<Setter Property="Template">
85+
<Setter.Value>
86+
<ControlTemplate TargetType="Button">
87+
<Border Background="{TemplateBinding Background}">
88+
<ContentPresenter Content="{TemplateBinding Content}">
89+
90+
</ContentPresenter>
91+
</Border>
92+
</ControlTemplate>
93+
</Setter.Value>
94+
</Setter>
95+
</Style>
8096
</ResourceDictionary>
8197
</Application.Resources>
8298
</Application>

App.xaml.cs

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using Java_Bytecode_Toolkit.ExtensionsNS;
2+
using MdXaml;
3+
using Octokit;
24
using System;
35
using System.Collections.Generic;
46
using System.Configuration;
@@ -7,6 +9,7 @@
79
using System.Linq;
810
using System.Threading.Tasks;
911
using System.Windows;
12+
using Application = System.Windows.Application;
1013

1114
namespace Java_Bytecode_Toolkit
1215
{
@@ -15,6 +18,10 @@ namespace Java_Bytecode_Toolkit
1518
/// </summary>
1619
public partial class App : Application
1720
{
21+
public const string GITHUB_REPO_NAME = "Java-Bytecode-Toolkit";
22+
23+
public const string GITHUB_REPO_AUTHOR_NAME = "ArcaneDegree";
24+
1825
public readonly ResourceDictionary LIGHT_THEME = null;
1926

2027
public readonly ResourceDictionary DARK_THEME = null;
@@ -97,8 +104,6 @@ public App()
97104

98105
this.CONFIG_FILE_PATH = this.CONFIG_DIR_FILE_PATH + "/config.json";
99106

100-
this.CreateTempDirIfDoesNotExist();
101-
102107
this.LIGHT_THEME = new ResourceDictionary()
103108
{
104109
Source = new Uri("/Themes/LightTheme.xaml", UriKind.Relative)
@@ -113,5 +118,55 @@ public App()
113118

114119
this.logger = new Logger();
115120
}
121+
122+
public async void Init()
123+
{
124+
this.CreateTempDirIfDoesNotExist();
125+
126+
this.ClearTempDir();
127+
128+
GitHubClient gitHubClient = new GitHubClient(
129+
new ProductHeaderValue(
130+
(this.Resources["AppName"] as string).Replace(
131+
" ",
132+
"-"
133+
)
134+
)
135+
);
136+
137+
IReadOnlyList<RepositoryContent> repoContent = await gitHubClient.Repository.Content.GetAllContents(
138+
GITHUB_REPO_AUTHOR_NAME,
139+
GITHUB_REPO_NAME,
140+
"README.md"
141+
);
142+
143+
if (repoContent.Count > 0)
144+
{
145+
this.MainWindow.aboutScreen.MainMarkdownScrollViewer.Markdown = repoContent[0].Content;
146+
}
147+
else
148+
{
149+
this.logger.WriteLine(
150+
"Failed to retrieve contents from README.md file in application's Github repository."
151+
);
152+
}
153+
}
154+
155+
public void ClearTempDir()
156+
{
157+
DirectoryInfo tempDirInfo = new DirectoryInfo(
158+
App.Current.TEMP_DIR_FILE_PATH
159+
);
160+
161+
foreach (FileInfo fileInfo in tempDirInfo.GetFiles())
162+
{
163+
fileInfo.Delete();
164+
}
165+
166+
foreach (DirectoryInfo directoryInfo in tempDirInfo.GetDirectories())
167+
{
168+
directoryInfo.Delete(true);
169+
}
170+
}
116171
}
117172
}

HomeScreen.xaml.cs

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Java_Bytecode_Toolkit.ExtensionsNS;
1+
using ICSharpCode.SharpZipLib.Zip;
2+
using Java_Bytecode_Toolkit.ExtensionsNS;
23
using Microsoft.Win32;
34
using System;
45
using System.Collections.Generic;
@@ -24,30 +25,7 @@ namespace Java_Bytecode_Toolkit
2425
/// </summary>
2526
public partial class HomeScreen : UserControl
2627
{
27-
public Dictionary<JavaClassFileTreeViewItem, JavaClassFile> javaClassFileTreeViewItemToJavaClassFileMap = new Dictionary<JavaClassFileTreeViewItem, JavaClassFile>();
28-
29-
private void OpenJavaClassFile(string javaClassFilePath)
30-
{
31-
JavaClassFile javaClassFile = new JavaClassFile(javaClassFilePath);
32-
33-
JavaClassFileTreeViewItem javaClassFileTreeViewItem = new JavaClassFileTreeViewItem()
34-
{
35-
DataContext = javaClassFile
36-
};
37-
38-
this.MainTreeView.Items.Add(
39-
javaClassFileTreeViewItem
40-
);
41-
42-
this.javaClassFileTreeViewItemToJavaClassFileMap[javaClassFileTreeViewItem] = javaClassFile;
43-
44-
javaClassFileTreeViewItem.IsSelected = true;
45-
}
46-
47-
private void OpenJarFile(string jarFilePath)
48-
{
49-
50-
}
28+
public Dictionary<JavaFileTreeViewItem, JavaClassFile> javaClassFileTreeViewItemToJavaClassFileMap = new Dictionary<JavaFileTreeViewItem, JavaClassFile>();
5129

5230
private void OnMainTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
5331
{
@@ -58,7 +36,7 @@ private void OnMainTreeViewSelectedItemChanged(object sender, RoutedPropertyChan
5836
return;
5937
}
6038

61-
JavaClassFile selectedJavaClassFile = this.javaClassFileTreeViewItemToJavaClassFileMap[this.MainTreeView.SelectedItem as JavaClassFileTreeViewItem];
39+
JavaClassFile selectedJavaClassFile = this.javaClassFileTreeViewItemToJavaClassFileMap[this.MainTreeView.SelectedItem as JavaFileTreeViewItem];
6240

6341
this.ClassNameTextBlock.Text = selectedJavaClassFile.Name.Split('.')[0];
6442

@@ -93,22 +71,5 @@ public HomeScreen()
9371

9472
this.MainTreeView.SelectedItemChanged += this.OnMainTreeViewSelectedItemChanged;
9573
}
96-
97-
public void OpenFile(params string[] filePaths)
98-
{
99-
foreach (string currentFilePath in filePaths)
100-
{
101-
string currentFileName = System.IO.Path.GetFileName(currentFilePath);
102-
103-
if (currentFileName.Contains(".class") == true)
104-
{
105-
this.OpenJavaClassFile(currentFilePath);
106-
}
107-
else if (currentFileName.Contains(".jar") == true)
108-
{
109-
this.OpenJarFile(currentFilePath);
110-
}
111-
}
112-
}
11374
}
11475
}

Java-Bytecode-Toolkit.csproj

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,24 @@
5555
<ApplicationIcon>Icon.ico</ApplicationIcon>
5656
</PropertyGroup>
5757
<ItemGroup>
58+
<Reference Include="ICSharpCode.AvalonEdit, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
59+
<HintPath>packages\AvalonEdit.6.0.0\lib\net45\ICSharpCode.AvalonEdit.dll</HintPath>
60+
</Reference>
61+
<Reference Include="ICSharpCode.SharpZipLib, Version=1.4.2.13, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
62+
<HintPath>packages\SharpZipLib.1.4.2\lib\netstandard2.0\ICSharpCode.SharpZipLib.dll</HintPath>
63+
</Reference>
64+
<Reference Include="MdXaml, Version=1.21.0.0, Culture=neutral, PublicKeyToken=9f8c7afb435b7edc, processorArchitecture=MSIL">
65+
<HintPath>packages\MdXaml.1.21.0\lib\net45\MdXaml.dll</HintPath>
66+
</Reference>
67+
<Reference Include="MdXaml.Plugins, Version=1.21.0.0, Culture=neutral, PublicKeyToken=9f8c7afb435b7edc, processorArchitecture=MSIL">
68+
<HintPath>packages\MdXaml.Plugins.1.21.0\lib\net45\MdXaml.Plugins.dll</HintPath>
69+
</Reference>
5870
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
5971
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
6072
</Reference>
73+
<Reference Include="Octokit, Version=8.0.1.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
74+
<HintPath>packages\Octokit.8.0.1\lib\netstandard2.0\Octokit.dll</HintPath>
75+
</Reference>
6176
<Reference Include="System" />
6277
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
6378
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -85,6 +100,7 @@
85100
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
86101
<HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
87102
</Reference>
103+
<Reference Include="System.Windows.Forms" />
88104
<Reference Include="System.Xml" />
89105
<Reference Include="Microsoft.CSharp" />
90106
<Reference Include="System.Core" />
@@ -103,16 +119,31 @@
103119
<Generator>MSBuild:Compile</Generator>
104120
<SubType>Designer</SubType>
105121
</ApplicationDefinition>
122+
<Compile Include="AboutScreen.xaml.cs">
123+
<DependentUpon>AboutScreen.xaml</DependentUpon>
124+
</Compile>
106125
<Compile Include="Configuration.cs" />
107126
<Compile Include="ExtendedButton.cs" />
127+
<Compile Include="LoadingScreen.xaml.cs">
128+
<DependentUpon>LoadingScreen.xaml</DependentUpon>
129+
</Compile>
108130
<Compile Include="Logger.cs" />
109131
<Compile Include="SettingsScreen.xaml.cs">
110132
<DependentUpon>SettingsScreen.xaml</DependentUpon>
111133
</Compile>
134+
<Compile Include="Spinner.cs" />
135+
<Page Include="AboutScreen.xaml">
136+
<SubType>Designer</SubType>
137+
<Generator>MSBuild:Compile</Generator>
138+
</Page>
112139
<Page Include="HomeScreen.xaml">
113140
<SubType>Designer</SubType>
114141
<Generator>MSBuild:Compile</Generator>
115142
</Page>
143+
<Page Include="LoadingScreen.xaml">
144+
<SubType>Designer</SubType>
145+
<Generator>MSBuild:Compile</Generator>
146+
</Page>
116147
<Page Include="SettingsScreen.xaml">
117148
<SubType>Designer</SubType>
118149
<Generator>MSBuild:Compile</Generator>
@@ -143,7 +174,7 @@
143174
<DependentUpon>HomeScreen.xaml</DependentUpon>
144175
</Compile>
145176
<Compile Include="JavaClassFile.cs" />
146-
<Compile Include="JavaClassFileTreeViewItem.cs" />
177+
<Compile Include="JavaFileTreeViewItem.cs" />
147178
<Compile Include="MainWindow.xaml.cs">
148179
<DependentUpon>MainWindow.xaml</DependentUpon>
149180
<SubType>Code</SubType>

JavaClassFileTreeViewItem.cs renamed to JavaFileTreeViewItem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
namespace Java_Bytecode_Toolkit
2222
{
23-
public class JavaClassFileTreeViewItem : TreeViewItem
23+
public class JavaFileTreeViewItem : TreeViewItem
2424
{
2525
private MenuItem closeContextMenuItem = null;
2626

2727
private MenuItem exportAsXMLFileContextMenuItem = null;
2828

2929
private SaveFileDialog exportAsXMLFileSaveFileDialog = new SaveFileDialog();
3030

31-
static JavaClassFileTreeViewItem()
31+
static JavaFileTreeViewItem()
3232
{
33-
DefaultStyleKeyProperty.OverrideMetadata(typeof(JavaClassFileTreeViewItem), new FrameworkPropertyMetadata(typeof(JavaClassFileTreeViewItem)));
33+
DefaultStyleKeyProperty.OverrideMetadata(typeof(JavaFileTreeViewItem), new FrameworkPropertyMetadata(typeof(JavaFileTreeViewItem)));
3434
}
3535

3636
private void OnExportAsXMLFileSaveFileDialogFileOk(object sender, CancelEventArgs e)
@@ -50,7 +50,7 @@ private void OnCloseContextMenuItemClick(object sender, RoutedEventArgs e)
5050
App.Current.MainWindow.homeScreen.MainTreeView.Items.Remove(this);
5151
}
5252

53-
public JavaClassFileTreeViewItem()
53+
public JavaFileTreeViewItem()
5454
{
5555

5656
}

0 commit comments

Comments
 (0)