mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Fixed path locating in DesignMode
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1786 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
75b0204c57
commit
2a07d84033
2 changed files with 19 additions and 13 deletions
|
@ -31,11 +31,12 @@ namespace GreenshotPlugin.Controls {
|
||||||
ITypeResolutionService typeResService = GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
|
ITypeResolutionService typeResService = GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
|
||||||
Assembly currentAssembly = this.GetType().Assembly;
|
Assembly currentAssembly = this.GetType().Assembly;
|
||||||
string assemblyPath = typeResService.GetPathOfAssembly(currentAssembly.GetName());
|
string assemblyPath = typeResService.GetPathOfAssembly(currentAssembly.GetName());
|
||||||
string designTimeLanguagePath = Path.Combine(Path.GetDirectoryName(assemblyPath), "../../../Greenshot/Languages/");
|
if (!Language.AddLanguageFilePath(Path.Combine(Path.GetDirectoryName(assemblyPath), @"..\..\Greenshot\Languages\"))) {
|
||||||
string designTimePluginLanguagePath = Path.Combine(Path.GetDirectoryName(assemblyPath), "../../Languages/");
|
Language.AddLanguageFilePath(Path.Combine(Path.GetDirectoryName(assemblyPath), @"..\..\..\Greenshot\Languages\"));
|
||||||
//MessageBox.Show(designTimeLanguagePath);
|
}
|
||||||
Language.AddLanguageFilePath(designTimeLanguagePath);
|
if (!Language.AddLanguageFilePath(Path.Combine(Path.GetDirectoryName(assemblyPath), @"..\..\Languages\"))) {
|
||||||
Language.AddLanguageFilePath(designTimePluginLanguagePath);
|
Language.AddLanguageFilePath(Path.Combine(Path.GetDirectoryName(assemblyPath), @"..\..\..\Languages\"));
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
MessageBox.Show(ex.ToString());
|
MessageBox.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
|
@ -48,7 +49,6 @@ namespace GreenshotPlugin.Controls {
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
protected override void OnPaint(PaintEventArgs e) {
|
protected override void OnPaint(PaintEventArgs e) {
|
||||||
if (this.DesignMode) {
|
if (this.DesignMode) {
|
||||||
LOG.InfoFormat("OnPaint called from designer. Key={0}", LanguageKey);
|
|
||||||
if (!isLanguageSet) {
|
if (!isLanguageSet) {
|
||||||
isLanguageSet = true;
|
isLanguageSet = true;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -148,24 +148,30 @@ namespace GreenshotPlugin.Core {
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddPath(string path) {
|
private static bool AddPath(string path) {
|
||||||
if (!languagePaths.Contains(path)) {
|
if (!languagePaths.Contains(path)) {
|
||||||
if (Directory.Exists(path)) {
|
if (Directory.Exists(path)) {
|
||||||
LOG.DebugFormat("Adding language path {0}", path);
|
LOG.DebugFormat("Adding language path {0}", path);
|
||||||
languagePaths.Add(path);
|
languagePaths.Add(path);
|
||||||
} else {
|
} else {
|
||||||
LOG.InfoFormat("Not adding non existing language path {0}", path);
|
LOG.InfoFormat("Not adding non existing language path {0}", path);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddLanguageFilePath(string path) {
|
public static bool AddLanguageFilePath(string path) {
|
||||||
if (!languagePaths.Contains(path)) {
|
if (!languagePaths.Contains(path)) {
|
||||||
LOG.DebugFormat("New language path {0}", path);
|
LOG.DebugFormat("New language path {0}", path);
|
||||||
AddPath(path);
|
if (AddPath(path)) {
|
||||||
ScanFiles();
|
ScanFiles();
|
||||||
Reload();
|
Reload();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadFiles(string ietf) {
|
private static void LoadFiles(string ietf) {
|
||||||
|
@ -278,7 +284,7 @@ namespace GreenshotPlugin.Core {
|
||||||
languageFile.Version = new Version(node.Attributes["version"].Value);
|
languageFile.Version = new Version(node.Attributes["version"].Value);
|
||||||
}
|
}
|
||||||
if (node.Attributes["prefix"] != null) {
|
if (node.Attributes["prefix"] != null) {
|
||||||
languageFile.Prefix = node.Attributes["prefix"].Value;
|
languageFile.Prefix = node.Attributes["prefix"].Value.ToLower();
|
||||||
}
|
}
|
||||||
if (node.Attributes["languagegroup"] != null) {
|
if (node.Attributes["languagegroup"] != null) {
|
||||||
string languageGroup = node.Attributes["languagegroup"].Value;
|
string languageGroup = node.Attributes["languagegroup"].Value;
|
||||||
|
@ -317,7 +323,7 @@ namespace GreenshotPlugin.Core {
|
||||||
if (PREFIX_REGEXP.IsMatch(languageFilename)) {
|
if (PREFIX_REGEXP.IsMatch(languageFilename)) {
|
||||||
languageFile.Prefix = PREFIX_REGEXP.Replace(languageFilename, "$1");
|
languageFile.Prefix = PREFIX_REGEXP.Replace(languageFilename, "$1");
|
||||||
if (!string.IsNullOrEmpty(languageFile.Prefix)) {
|
if (!string.IsNullOrEmpty(languageFile.Prefix)) {
|
||||||
languageFile.Prefix = languageFile.Prefix.Replace("plugin", "");
|
languageFile.Prefix = languageFile.Prefix.Replace("plugin", "").ToLower();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue