Browse Source

initial commit

master
kougyoku 2 months ago
parent
commit
db737f37b2
  1. 3
      .gitignore
  2. 6
      App.config
  3. 59
      LocalExplorer.csproj
  4. BIN
      LocalExplorer.ico
  5. 25
      LocalExplorer.sln
  6. 59
      Program.cs
  7. 36
      Properties/AssemblyInfo.cs
  8. 10
      RegistryEntries.reg
  9. 6
      test.html

3
.gitignore

@ -0,0 +1,3 @@
bin/*
obj/*
.vs/*

6
App.config

@ -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>

59
LocalExplorer.csproj

@ -0,0 +1,59 @@
<?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>{0D23F17D-49B7-4C13-B631-87BB53C05BD0}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>LocalExplorer</RootNamespace>
<AssemblyName>LocalExplorer</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>
<PropertyGroup>
<ApplicationIcon>LocalExplorer.ico</ApplicationIcon>
</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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="LocalExplorer.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

BIN
LocalExplorer.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

25
LocalExplorer.sln

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32413.511
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalExplorer", "LocalExplorer.csproj", "{0D23F17D-49B7-4C13-B631-87BB53C05BD0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D23F17D-49B7-4C13-B631-87BB53C05BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D23F17D-49B7-4C13-B631-87BB53C05BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D23F17D-49B7-4C13-B631-87BB53C05BD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D23F17D-49B7-4C13-B631-87BB53C05BD0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A44831A6-930D-4EBB-B2DE-D3892049D333}
EndGlobalSection
EndGlobal

59
Program.cs

@ -0,0 +1,59 @@
/*
* REFERENCE:
* https://www.joe0.com/2019/01/27/how-create-a-custom-browser-uri-scheme-and-c-protocol-handler-client-that-supports-opening-and-editing-of-remotely-hosted-documents-through-webdav/
*/
using System;
using System.Diagnostics;
using System.IO;
namespace LocalExplorer
{
class Program
{
static void Main(string[] args)
{
//Check to make sure a path was passed in as an argument to the program.
if (args.Length == 0)
{
Console.WriteLine("usage: LocalExplorer.exe <path to open with Explorer.exe>");
WriteOutputFile("no args passed to program");
Environment.Exit(1);
}
//Collect up the path
//the replace function is here to trim out the arg as it
//comes in from the url protocol handler
string path = args[0].Replace("localexplorer:", "").Replace("%5C", "\\"); ;
WriteOutputFile($"arg passed: {path}");
//Check to see if the directory exists.
//if so, pop it open.
if (Directory.Exists(path))
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
Arguments = path,
FileName = "explorer.exe"
};
Process.Start(startInfo);
}
else
{
WriteOutputFile($"Directory does not exist: {path}");
Console.WriteLine("Directory does not exist.");
}
} //end main
private static void WriteOutputFile(string debugLine)
{
return;
// remove the above return for debugging
StreamWriter outFile = new StreamWriter(@"C:\LocalExplorer\OUTPUT.txt", true);
outFile.WriteLine(debugLine);
outFile.Close();
}
}
}

36
Properties/AssemblyInfo.cs

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LocalExplorer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LocalExplorer")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0d23f17d-49b7-4c13-b631-87bb53c05bd0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

10
RegistryEntries.reg

@ -0,0 +1,10 @@
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\LocalExplorer]
@="URL:LocalExplorer Protocol"
"URL Protocol"="LocalExplorer"
[HKEY_CLASSES_ROOT\LocalExplorer\DefaultIcon]
@="C:\\LocalExplorer\\LocalExplorer.exe"
[HKEY_CLASSES_ROOT\LocalExplorer\shell]
[HKEY_CLASSES_ROOT\LocalExplorer\shell\open]
[HKEY_CLASSES_ROOT\LocalExplorer\shell\open\command]
@="C:\\LocalExplorer\\LocalExplorer.exe \"%1\""

6
test.html

@ -0,0 +1,6 @@
<html>
<body>
<h4>klicken</h4>
<a href="localexplorer:\\server\sharname">sharename</a>
</body>
</html>
Loading…
Cancel
Save