mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 14:03:23 -07:00
Small fixes that make it possible to run the not installed Greenshot from a network share.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1616 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
23e9843d07
commit
fddeb05d67
4 changed files with 25 additions and 10 deletions
|
@ -234,7 +234,7 @@ namespace Greenshot.Helpers {
|
|||
foreach (string pluginFile in pluginFiles) {
|
||||
LOG.DebugFormat("Checking the following file for plugins: {0}", pluginFile);
|
||||
try {
|
||||
Assembly assembly = Assembly.LoadFile(pluginFile);
|
||||
Assembly assembly = Assembly.LoadFile(pluginFile, Assembly.GetExecutingAssembly().Evidence);
|
||||
PluginAttribute[] pluginAttributes = assembly.GetCustomAttributes(typeof(PluginAttribute), false) as PluginAttribute[];
|
||||
if (pluginAttributes.Length > 0) {
|
||||
PluginAttribute pluginAttribute = pluginAttributes[0];
|
||||
|
|
|
@ -41,12 +41,21 @@ namespace ExternalCommand {
|
|||
public Dictionary<string, string> arguments;
|
||||
|
||||
private const string MSPAINT = "MS Paint";
|
||||
private static string paintPath = AbstractDestination.GetExePath("pbrush.exe");
|
||||
private static bool hasPaint = !string.IsNullOrEmpty(paintPath) && File.Exists(paintPath);
|
||||
private static string paintPath;
|
||||
private static bool hasPaint = false;
|
||||
|
||||
private const string PAINTDOTNET = "Paint.NET";
|
||||
private static string paintDotNetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Paint.NET\PaintDotNet.exe");
|
||||
private static bool hasPaintDotNet = !string.IsNullOrEmpty(paintDotNetPath) && File.Exists(paintDotNetPath);
|
||||
private static string paintDotNetPath;
|
||||
private static bool hasPaintDotNet = false;
|
||||
static ExternalCommandConfiguration() {
|
||||
try {
|
||||
paintPath = AbstractDestination.GetExePath("pbrush.exe");
|
||||
hasPaint = !string.IsNullOrEmpty(paintPath) && File.Exists(paintPath);
|
||||
paintDotNetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Paint.NET\PaintDotNet.exe");
|
||||
hasPaintDotNet = !string.IsNullOrEmpty(paintDotNetPath) && File.Exists(paintDotNetPath);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supply values we can't put as defaults
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace GreenshotPlugin.Core {
|
|||
languageDirectories.Add(STARTUP_LANGUAGE_PATH);
|
||||
foreach(string path in languageDirectories) {
|
||||
// Search in executable directory
|
||||
LOG.DebugFormat("Searching language directory '{0}' for language files with pattern '{1}'", path, languageFilePattern);
|
||||
LOG.InfoFormat("Searching language directory '{0}' for language files with pattern '{1}'", path, languageFilePattern);
|
||||
try {
|
||||
foreach(string languageFile in Directory.GetFiles(path, languageFilePattern, SearchOption.AllDirectories)) {
|
||||
LOG.DebugFormat("Found language file: {0}", languageFile);
|
||||
|
@ -284,7 +284,7 @@ namespace GreenshotPlugin.Core {
|
|||
// Try to force internal english
|
||||
try {
|
||||
LOG.Info("No languages found, using embedded en-US.");
|
||||
using (Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream("Greenshot.Languages.language-en-US.xml")) {
|
||||
using (Stream stream = Assembly.GetEntryAssembly().GetManifestResourceStream("Greenshot.Languages.language-en-US.xml")) {
|
||||
LanguageConfiguration languageConfig = LanguageConfiguration.Load(stream);
|
||||
if (languageConfig != null) {
|
||||
loadedLanguages.Add(languageConfig);
|
||||
|
|
|
@ -81,10 +81,10 @@ namespace IniFile {
|
|||
/// Default init
|
||||
/// </summary>
|
||||
public static void Init() {
|
||||
AssemblyProductAttribute[] assemblyProductAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false) as AssemblyProductAttribute[];
|
||||
AssemblyProductAttribute[] assemblyProductAttributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false) as AssemblyProductAttribute[];
|
||||
if (assemblyProductAttributes.Length > 0) {
|
||||
string productName = assemblyProductAttributes[0].Product;
|
||||
LOG.DebugFormat("Using ProductName {0}", productName);
|
||||
LOG.InfoFormat("Using ProductName {0}", productName);
|
||||
Init(productName, productName);
|
||||
} else {
|
||||
throw new InvalidOperationException("Assembly ProductName not set.");
|
||||
|
@ -160,7 +160,13 @@ namespace IniFile {
|
|||
throw new InvalidOperationException("IniConfig.Init not called!");
|
||||
}
|
||||
string iniFilePath = null;
|
||||
string applicationStartupPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
string applicationStartupPath = "";
|
||||
try {
|
||||
applicationStartupPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
} catch (Exception exception) {
|
||||
LOG.WarnFormat("Problem retrieving the AssemblyLocation: {0}", exception.Message);
|
||||
applicationStartupPath = @".";
|
||||
}
|
||||
string pafPath = Path.Combine(applicationStartupPath, @"App\" + applicationName);
|
||||
|
||||
if (portable || !portableCheckMade) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue