-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8054017
Showing
25 changed files
with
1,935 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bin | ||
obj | ||
!.gitignore | ||
.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{95A18481-113E-417E-9F41-0459AB354A43}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<RootNamespace>Exquad</RootNamespace> | ||
<AssemblyName>Exquad</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="FileExplorer.cs"> | ||
<SubType>Component</SubType> | ||
</Compile> | ||
<Compile Include="MainForm.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="MainForm.Designer.cs"> | ||
<DependentUpon>MainForm.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<EmbeddedResource Include="MainForm.resx"> | ||
<DependentUpon>MainForm.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
<DesignTime>True</DesignTime> | ||
</Compile> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\blue-arrow-left.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\blue-arrow-right.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\blue-arrow-up.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\blue-icon-open.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\png\left.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\png\open.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\png\right.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\png\up.png" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.32602.291 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exquad", "Exquad.csproj", "{95A18481-113E-417E-9F41-0459AB354A43}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{95A18481-113E-417E-9F41-0459AB354A43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{95A18481-113E-417E-9F41-0459AB354A43}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{95A18481-113E-417E-9F41-0459AB354A43}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{95A18481-113E-417E-9F41-0459AB354A43}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {641207BF-829F-46C4-A5B0-CE1B077D9247} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
/* | ||
Copyright 2022 Mark Lagodych | ||
This file is part of Exquad. | ||
Exquad is free software: you can redistribute it and/or modify it under the | ||
terms of the GNU General Public License as published by the Free Software | ||
Foundation, either version 3 of the License, or (at your option) any later | ||
version. | ||
Exquad is distributed in the hope that it will be useful, but WITHOUT ANY | ||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along with | ||
Exquad. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
using System.Windows.Forms; | ||
|
||
namespace Exquad | ||
{ | ||
class FileExplorer : Control | ||
{ | ||
private WebBrowser browser; | ||
private Button buttonBack, buttonForward, buttonUp, buttonOpen; | ||
private TextBox textboxPath; | ||
|
||
public FileExplorer() | ||
{ | ||
var table1 = new TableLayoutPanel(); | ||
this.Controls.Add(table1); | ||
table1.Dock = DockStyle.Fill; | ||
table1.RowCount = 2; | ||
table1.ColumnCount = 1; | ||
table1.RowStyles.Add(new RowStyle(SizeType.AutoSize, 0)); | ||
table1.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); | ||
|
||
var table2 = new TableLayoutPanel(); | ||
table1.Controls.Add(table2); | ||
table2.RowCount = 1; | ||
table2.ColumnCount = 5; | ||
table2.Dock = DockStyle.Fill; | ||
table2.Height = 35; | ||
//table2.RowStyles.Add(new RowStyle(SizeType.AutoSize, 0)); | ||
table2.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); | ||
table2.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); | ||
table2.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); | ||
table2.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0)); | ||
table2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); | ||
|
||
buttonBack = new Button(); | ||
table2.Controls.Add(buttonBack); | ||
buttonBack.BackgroundImage = Properties.Resources.IconLeft; | ||
buttonBack.Click += (sender, e) => { GoBack(); }; | ||
|
||
buttonForward = new Button(); | ||
table2.Controls.Add(buttonForward); | ||
buttonForward.BackgroundImage = Properties.Resources.IconRight; | ||
buttonForward.Click += (sender, e) => { GoForward(); }; | ||
|
||
buttonUp = new Button(); | ||
table2.Controls.Add(buttonUp); | ||
buttonUp.BackgroundImage = Properties.Resources.IconUp; | ||
buttonUp.Click += (sender, e) => { GoUp(); }; | ||
|
||
buttonOpen = new Button(); | ||
table2.Controls.Add(buttonOpen); | ||
buttonOpen.BackgroundImage = Properties.Resources.IconOpen; | ||
buttonOpen.Click += (sender, e) => { OpenFolder(); }; | ||
|
||
textboxPath = new TextBox(); | ||
table2.Controls.Add(textboxPath); | ||
textboxPath.Dock = DockStyle.Fill; | ||
textboxPath.Font = new System.Drawing.Font("Calibri", 11); | ||
textboxPath.KeyPress += (sender, e) => { if (e.KeyChar == (char)Keys.Enter) BrowsePath(); }; | ||
|
||
|
||
browser = new WebBrowser(); | ||
table1.Controls.Add(browser); | ||
browser.Navigated += (sender, e) => { UpdateControls(); }; | ||
browser.Dock = DockStyle.Fill; | ||
browser.Navigate("C:\\"); | ||
|
||
foreach (var btn in new Button[] {buttonBack, buttonForward, buttonUp, buttonOpen}) | ||
{ | ||
btn.BackgroundImageLayout = ImageLayout.Zoom; | ||
btn.Size = new System.Drawing.Size(24, 24); | ||
btn.BackColor = System.Drawing.Color.Transparent; | ||
btn.FlatStyle = FlatStyle.Flat; | ||
btn.FlatAppearance.BorderSize = 0; | ||
} | ||
|
||
} | ||
|
||
private void GoBack() | ||
{ | ||
if (browser.CanGoBack) | ||
browser.GoBack(); | ||
} | ||
|
||
private void GoForward() | ||
{ | ||
if (browser.CanGoForward) | ||
browser.GoForward(); | ||
} | ||
|
||
private void GoUp() | ||
{ | ||
var currentDir = browser.Url.LocalPath; | ||
var parentDir = Directory.GetParent(RemoveProtocolPrefix(currentDir)); | ||
|
||
if (parentDir != null) | ||
browser.Navigate(parentDir.FullName); | ||
} | ||
|
||
private string RemoveProtocolPrefix(string path) | ||
{ | ||
if (path.StartsWith("file:///")) | ||
return path.Remove(0, "file:///".Length); | ||
return path; | ||
} | ||
|
||
private bool CanGoUp() | ||
{ | ||
return Directory.GetParent(browser.Url.AbsolutePath) != null; | ||
} | ||
|
||
private void UpdateControls() | ||
{ | ||
buttonBack.Enabled = browser.CanGoBack; | ||
buttonForward.Enabled = browser.CanGoForward; | ||
buttonUp.Enabled = CanGoUp(); | ||
textboxPath.Text = RemoveProtocolPrefix(browser.Url.ToString()); | ||
} | ||
|
||
private void OpenFolder() | ||
{ | ||
var fd = new FolderBrowserDialog(); | ||
fd.Description = "Select a location to display"; | ||
fd.ShowNewFolderButton = true; | ||
|
||
if (fd.ShowDialog() == DialogResult.OK) | ||
browser.Navigate(fd.SelectedPath); | ||
} | ||
|
||
private void BrowsePath() | ||
{ | ||
browser.Navigate(textboxPath.Text); | ||
} | ||
} | ||
} |
Oops, something went wrong.