Skip to content

Commit

Permalink
Fix Process.Start
Browse files Browse the repository at this point in the history
  • Loading branch information
Beelink committed Dec 21, 2023
1 parent 0c16401 commit 4f9116c
Show file tree
Hide file tree
Showing 11 changed files with 339 additions and 231 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "dependencies/quick-library"]
path = dependencies/quick-library
url = https://github.com/ModuleArt/quick-library
[submodule "dependencies/qpv-plugins"]
path = dependencies/qpv-plugins
url = https://github.com/ModuleArt/qpv-plugins
3 changes: 0 additions & 3 deletions quick-picture-viewer/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<section name="quick_picture_viewer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2"/>
</System.Windows.Forms.ApplicationConfigurationSection>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
Expand Down
37 changes: 37 additions & 0 deletions quick-picture-viewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Resources;
using System.Reflection;
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("Quick Picture Viewer")]
[assembly: AssemblyDescription("Lightweight, versatile desktop image viewer for Windows. The best replacement for the default Windows photo viewer.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Module Art")]
[assembly: AssemblyProduct("Quick Picture Viewer")]
[assembly: AssemblyCopyright("Copyright © 2023 Module Art")]
[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("53748c49-255e-424b-b789-5919cefef473")]

// 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("3.1.5")]
[assembly: AssemblyFileVersion("3.1.5")]
[assembly: NeutralResourcesLanguage("en")]
2 changes: 1 addition & 1 deletion quick-picture-viewer/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

345 changes: 171 additions & 174 deletions quick-picture-viewer/forms/AboutForm.Designer.cs

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions quick-picture-viewer/forms/AboutForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ private void InitLanguage()

private void makeDefaultBtn_Click(object sender, EventArgs e)
{
Process.Start("ms-settings:defaultapps");
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "ms-settings:defaultapps"
});
}

private void updatesBtn_Click(object sender, EventArgs e)
Expand All @@ -64,12 +68,20 @@ private void updatesBtn_Click(object sender, EventArgs e)

private void button1_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/ModuleArt/quick-picture-viewer/");
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "https://github.com/ModuleArt/quick-picture-viewer/"
});
}

private void developerBtn_Click(object sender, EventArgs e)
{
Process.Start("https://moduleart.github.io");
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "https://moduleart.github.io"
});
}
}
}
70 changes: 35 additions & 35 deletions quick-picture-viewer/forms/AboutForm.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -123,16 +123,16 @@
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="developerBtn.Image" type="System.Drawing.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CCDwABkGp9UyKpVCkl7/2sUn8GqGYS1yi/8lw5b8V/IacIVXuMia6A+kMUMLKJO
bWEykVv/wzDIIJBiZI1ysRv/CzlP+i9g3wfGfBb1/UC9bCADWIVta2KRDYBhpbSD/xUStqFohBtgXj0Z
qJcDrwEwLOI+C9MAs+opQL2cGAaIufVvFXPpXiYdvvELXMxn0X9+q6aLXBrRUwkaIO41fSZQTE3AMLUY
boDH5DVAMQ0u9Yg0ggZI+M4BSQgIW1ckwMV8Zk0FiXFrJ8QRawCfsG11HLoYt3ZiLFYDBM0LfWGKJf3m
TwSK8WAxlBfoBV+4Aea1IHXsIANAiUFUxL6xQNxjUhe3iqc6kM+JxQBukDpu3dQCXuPiLjYpS5A6UP4A
AxADlM55gZgViNlQDZgLinOQc9HV4cxcLPz6CTYyEZs+gwwQdenKAIqBUx0qYGAAAGTbHBnwyr2cAAAA
AElFTkSuQmCC
</value>
</data>
<data name="githubBtn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
35 changes: 30 additions & 5 deletions quick-picture-viewer/forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Linq;
using System.Timers;
using System.Windows.Forms;
using static System.Net.Mime.MediaTypeNames;

namespace quick_picture_viewer
{
Expand Down Expand Up @@ -1383,7 +1384,12 @@ private void showOpenWithDialog(string path)
{
string args = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "shell32.dll");
args += ",OpenAs_RunDLL " + path;
Process.Start("rundll32.exe", args);
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "rundll32.exe",
Arguments = args
});
}

private void externalButton_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1744,7 +1750,11 @@ public void RestartApp()

public void NewWindow()
{
Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "quick-picture-viewer.exe"));
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "quick-picture-viewer.exe")
});
}

private void rotate180Button_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1823,7 +1833,12 @@ private void externalRunBtn_Click(object sender, EventArgs e)
{
string ext = "bmp";
if (currentFile != null) ext = Path.GetExtension(currentFile).Substring(1, Path.GetExtension(currentFile).Length - 1);
Process.Start(FileAssociation.GetExecFileAssociatedToExtension(ext), '"' + Path.Combine(currentFolder, currentFile) + '"');
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = FileAssociation.GetExecFileAssociatedToExtension(ext),
Arguments = '"' + Path.Combine(currentFolder, currentFile) + '"'
});
}
catch
{
Expand All @@ -1835,7 +1850,12 @@ private void externalFavoriteBtn_Click(object sender, EventArgs e)
{
try
{
Process.Start(Properties.Settings.Default.FavoriteExternalApp, '"' + Path.Combine(currentFolder, currentFile) + '"');
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = Properties.Settings.Default.FavoriteExternalApp,
Arguments = '"' + Path.Combine(currentFolder, currentFile) + '"'
});
}
catch
{
Expand Down Expand Up @@ -2411,7 +2431,12 @@ private void directoryLabel_Click(object sender, EventArgs e)
if (File.Exists(path))
{
string argument = "/select, \"" + path + "\"";
Process.Start("explorer.exe", argument);
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "explorer.exe",
Arguments = argument
});
}
else
{
Expand Down
12 changes: 10 additions & 2 deletions quick-picture-viewer/forms/PluginManForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,20 @@ private void deletePlugin(int numberInList)

private void morePluginsBtn_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/ModuleArt/qpv-plugins");
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "https://github.com/ModuleArt/qpv-plugins"
});
}

private void pluginWebsiteBtn_Click(object sender, EventArgs e)
{
if (listView1.SelectedIndices != null && listView1.SelectedIndices.Count > 0) Process.Start(pluginsLinks[listView1.SelectedIndices[0]]);
if (listView1.SelectedIndices != null && listView1.SelectedIndices.Count > 0) Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = pluginsLinks[listView1.SelectedIndices[0]]
});
}

private void AutoSizeColumns()
Expand Down
28 changes: 23 additions & 5 deletions quick-picture-viewer/forms/SettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Security.Policy;
using System.Windows.Forms;

namespace quick_picture_viewer
Expand Down Expand Up @@ -311,7 +312,11 @@ private void langComboBox_SelectedIndexChanged(object sender, EventArgs e)

private void Ll_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/" + (sender as LinkLabel).Text);
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "https://github.com/" + (sender as LinkLabel).Text
});
}

private void SettingsForm_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -475,8 +480,13 @@ private bool GetBrowseFolderWithState()
{
const string browseWithKey1 = "HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\QuickPictureViewer";
const string browseWithKey2 = "HKEY_CLASSES_ROOT\\Directory\\shell\\QuickPictureViewer";
string browseWithValue1 = (string)Registry.GetValue(browseWithKey1, string.Empty, string.Empty);
string browseWithValue2 = (string)Registry.GetValue(browseWithKey2, string.Empty, string.Empty);

string key1 = Registry.GetValue(browseWithKey1, string.Empty, string.Empty)?.ToString();
string key2 = Registry.GetValue(browseWithKey2, string.Empty, string.Empty)?.ToString();

string browseWithValue1 = !String.IsNullOrEmpty(key1) ? key1.ToString() : "";
string browseWithValue2 = !String.IsNullOrEmpty(key2) ? key2.ToString() : "";

if (browseWithValue1.Length > 0 && browseWithValue2.Length > 0) return true;
return false;
}
Expand All @@ -488,12 +498,20 @@ private bool GetBrowseFolderWithState()

private void makeDefaultBtn_Click(object sender, EventArgs e)
{
Process.Start("ms-settings:defaultapps");
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "ms-settings:defaultapps"
});
}

private void helpTranslateBtn_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/ModuleArt/quick-picture-viewer/wiki/Help-us-translate-this-app");
Process.Start(new ProcessStartInfo
{
UseShellExecute = true,
FileName = "https://github.com/ModuleArt/quick-picture-viewer/wiki/Help-us-translate-this-app"
});
}
}
}
Loading

0 comments on commit 4f9116c

Please sign in to comment.