Browse Source

Ported some fixes for unit test mode from Fidalgo rev. 2014.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@256 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
d62435fb23
  1. 1
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/AbstractCompletionDataProvider.cs
  2. 8
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  3. 18
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
  4. 1
      src/Main/Core/Project/Src/Services/MessageService/InputBox.cs
  5. 2
      src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs
  6. 29
      src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs

1
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/AbstractCompletionDataProvider.cs

@ -87,7 +87,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
if (list == null) { if (list == null) {
return; return;
} }
System.Diagnostics.Debugger.Break();
completionData.Capacity += list.Count; completionData.Capacity += list.Count;
CodeCompletionData suggestedData = null; CodeCompletionData suggestedData = null;
foreach (object o in list) { foreach (object o in list) {

8
src/Main/Core/Project/Src/AddInTree/AddInTree.cs

@ -28,13 +28,7 @@ namespace ICSharpCode.Core
static AddInTree() static AddInTree()
{ {
try { defaultCoreDirectory = FileUtility.Combine(FileUtility.SharpDevelopRootPath, "AddIns");
// might fail in unit test mode
Assembly entryAssembly = Assembly.GetEntryAssembly();
defaultCoreDirectory = FileUtility.Combine(Path.GetDirectoryName(entryAssembly.Location), "..", "AddIns");
} catch (Exception) {
defaultCoreDirectory = "";
}
erbauer.Add("Class", new ClassErbauer()); erbauer.Add("Class", new ClassErbauer());
erbauer.Add("FileFilter", new FileFilterErbauer()); erbauer.Add("FileFilter", new FileFilterErbauer());

18
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -74,7 +74,7 @@ namespace ICSharpCode.Core
} }
} }
public static string[] GetAvaiableRuntimeVersions() public static string[] GetAvailableRuntimeVersions()
{ {
string installRoot = NETFrameworkInstallRoot; string installRoot = NETFrameworkInstallRoot;
string[] files = Directory.GetDirectories(installRoot); string[] files = Directory.GetDirectories(installRoot);
@ -95,19 +95,11 @@ namespace ICSharpCode.Core
return String.Empty; return String.Empty;
} }
if (paths.Length == 1) { string result = paths[0];
return paths[0]; for (int i = 1; i < paths.Length; i++) {
result = Path.Combine(result, paths[i]);
} }
return result;
string[] newPaths = new string[paths.Length - 1];
newPaths[0] = Path.Combine(paths[0], paths[1]);
Array.Copy(paths, 2,
newPaths, 1,
paths.Length - 2);
return Combine(newPaths);
} }

1
src/Main/Core/Project/Src/Services/MessageService/InputBox.cs

@ -109,7 +109,6 @@ namespace ICSharpCode.Core
// InputBox // InputBox
// //
this.AcceptButton = this.acceptButton; this.AcceptButton = this.acceptButton;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.cancelButton; this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(338, 144); this.ClientSize = new System.Drawing.Size(338, 144);
this.Controls.Add(this.textBox); this.Controls.Add(this.textBox);

2
src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs

@ -19,7 +19,7 @@ namespace ICSharpCode.Core
const string propertyXmlRootNodeName = "SharpDevelopProperties"; const string propertyXmlRootNodeName = "SharpDevelopProperties";
static string configDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".ICSharpCode", "Corsavy") + Path.DirectorySeparatorChar; static string configDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".ICSharpCode", "Corsavy") + Path.DirectorySeparatorChar;
static string dataDirectory = FileUtility.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "..", "data"); static string dataDirectory = FileUtility.Combine(FileUtility.SharpDevelopRootPath, "data");
static Properties properties = new Properties(); static Properties properties = new Properties();

29
src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs

@ -24,18 +24,18 @@ namespace ICSharpCode.Core
/// This Class contains two ResourceManagers, which handle string and image resources /// This Class contains two ResourceManagers, which handle string and image resources
/// for the application. It do handle localization strings on this level. /// for the application. It do handle localization strings on this level.
/// </summary> /// </summary>
public sealed class ResourceService public static class ResourceService
{ {
readonly static string uiLanguageProperty = "CoreProperties.UILanguage"; readonly static string uiLanguageProperty = "CoreProperties.UILanguage";
readonly static string stringResources = "StringResources"; readonly static string stringResources = "StringResources";
readonly static string imageResources = "BitmapResources"; readonly static string imageResources = "BitmapResources";
static string resourceDirctory; static string resourceDirectory;
static ResourceService() static ResourceService()
{ {
resourceDirctory = FileUtility.Combine(PropertyService.DataDirectory, "resources"); resourceDirectory = FileUtility.Combine(PropertyService.DataDirectory, "resources");
LoadLanguageResources(); LoadLanguageResources();
} }
@ -58,7 +58,7 @@ namespace ICSharpCode.Core
static void ChangeProperty(object sender, PropertyChangedEventArgs e) static void ChangeProperty(object sender, PropertyChangedEventArgs e)
{ {
if (e.Key == uiLanguageProperty && e.OldValue != e.NewValue) { if (e.Key == uiLanguageProperty && e.OldValue != e.NewValue) {
LoadLanguageResources(); LoadLanguageResources();
} }
} }
@ -73,7 +73,7 @@ namespace ICSharpCode.Core
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(language.Split('-')[0]); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(language.Split('-')[0]);
} catch (Exception) {} } catch (Exception) {}
} }
// TODO: AppSettings is obsolete // TODO: AppSettings is obsolete
// if (System.Configuration.ConfigurationSettings.AppSettings["UserStrings"] != null) { // if (System.Configuration.ConfigurationSettings.AppSettings["UserStrings"] != null) {
// string resourceName = System.Configuration.ConfigurationSettings.AppSettings["UserStrings"]; // string resourceName = System.Configuration.ConfigurationSettings.AppSettings["UserStrings"];
// resourceName = resourceName.Insert(resourceName.LastIndexOf(".resources"), "." + language); // resourceName = resourceName.Insert(resourceName.LastIndexOf(".resources"), "." + language);
@ -111,25 +111,16 @@ namespace ICSharpCode.Core
static void InitializeService() static void InitializeService()
{ {
RegisterAssembly(Assembly.GetEntryAssembly()); Assembly assembly = Assembly.GetEntryAssembly();
if (assembly != null) {
RegisterAssembly(assembly);
}
PropertyService.PropertyChanged += new PropertyChangedEventHandler(ChangeProperty); PropertyService.PropertyChanged += new PropertyChangedEventHandler(ChangeProperty);
LoadLanguageResources(); LoadLanguageResources();
} }
// core service : Can't use Initialize, because all other stuff needs this service before initialize is called.
ResourceService()
{
// if (System.Configuration.ConfigurationSettings.AppSettings["UserStrings"] != null) {
// userStrings = Load(resourceDirctory + Path.DirectorySeparatorChar + System.Configuration.ConfigurationSettings.AppSettings["UserStrings"]);
// }
// if (System.Configuration.ConfigurationSettings.AppSettings["UserIcons"] != null) {
// userIcons = Load(resourceDirctory + Path.DirectorySeparatorChar + System.Configuration.ConfigurationSettings.AppSettings["UserIcons"]);
// }
InitializeService();
}
/// <summary> /// <summary>
/// The LoadFont routines provide a safe way to load fonts. /// The LoadFont routines provide a safe way to load fonts.
/// </summary> /// </summary>
@ -210,7 +201,7 @@ namespace ICSharpCode.Core
static Hashtable Load(string name, string language) static Hashtable Load(string name, string language)
{ {
return Load(resourceDirctory + Path.DirectorySeparatorChar + name + "." + language + ".resources"); return Load(resourceDirectory + Path.DirectorySeparatorChar + name + "." + language + ".resources");
} }

Loading…
Cancel
Save