diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..515604e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin/* +obj/* +.vs/* diff --git a/App.config b/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LocalExplorer.csproj b/LocalExplorer.csproj new file mode 100644 index 0000000..b0d4d2f --- /dev/null +++ b/LocalExplorer.csproj @@ -0,0 +1,59 @@ + + + + + Debug + AnyCPU + {0D23F17D-49B7-4C13-B631-87BB53C05BD0} + Exe + LocalExplorer + LocalExplorer + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + LocalExplorer.ico + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LocalExplorer.ico b/LocalExplorer.ico new file mode 100644 index 0000000..323bbe6 Binary files /dev/null and b/LocalExplorer.ico differ diff --git a/LocalExplorer.sln b/LocalExplorer.sln new file mode 100644 index 0000000..5afcb20 --- /dev/null +++ b/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 diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..0b8eea3 --- /dev/null +++ b/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 "); + 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(); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d355b40 --- /dev/null +++ b/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")] diff --git a/RegistryEntries.reg b/RegistryEntries.reg new file mode 100644 index 0000000..847a9e3 --- /dev/null +++ b/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\"" \ No newline at end of file diff --git a/test.html b/test.html new file mode 100644 index 0000000..ad3e02b --- /dev/null +++ b/test.html @@ -0,0 +1,6 @@ + + +

klicken

+ sharename + +