mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Improving the responsiveness of the editor and optimizing some general code.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1922 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
9d5e3e33be
commit
4f64dfe676
7 changed files with 192 additions and 158 deletions
|
@ -272,10 +272,9 @@ namespace Greenshot.IniFile {
|
|||
/// <param name="sectionName"></param>
|
||||
/// <returns></returns>
|
||||
public static IniSection GetIniSection(string sectionName) {
|
||||
if (sectionMap.ContainsKey(sectionName)) {
|
||||
return sectionMap[sectionName];
|
||||
}
|
||||
return null;
|
||||
IniSection returnValue = null;
|
||||
sectionMap.TryGetValue(sectionName, out returnValue);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -286,7 +285,7 @@ namespace Greenshot.IniFile {
|
|||
T section;
|
||||
|
||||
Type iniSectionType = typeof(T);
|
||||
string sectionName = getSectionName(iniSectionType);
|
||||
string sectionName = IniSection.GetIniSectionAttribute(iniSectionType).Name;
|
||||
if (sectionMap.ContainsKey(sectionName)) {
|
||||
//LOG.Debug("Returning pre-mapped section " + sectionName);
|
||||
section = (T)sectionMap[sectionName];
|
||||
|
@ -307,7 +306,7 @@ namespace Greenshot.IniFile {
|
|||
|
||||
public static Dictionary<string, string> PropertiesForSection(IniSection section) {
|
||||
Type iniSectionType = section.GetType();
|
||||
string sectionName = getSectionName(iniSectionType);
|
||||
string sectionName = section.IniSectionAttribute.Name;
|
||||
// Get the properties for the section
|
||||
Dictionary<string, string> properties = null;
|
||||
if (sections.ContainsKey(sectionName)) {
|
||||
|
@ -319,17 +318,6 @@ namespace Greenshot.IniFile {
|
|||
return properties;
|
||||
}
|
||||
|
||||
private static string getSectionName(Type iniSectionType) {
|
||||
Attribute[] classAttributes = Attribute.GetCustomAttributes(iniSectionType);
|
||||
foreach (Attribute attribute in classAttributes) {
|
||||
if (attribute is IniSectionAttribute) {
|
||||
IniSectionAttribute iniSectionAttribute = (IniSectionAttribute)attribute;
|
||||
return iniSectionAttribute.Name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Save() {
|
||||
string iniLocation = CreateIniLocation(configName + INI_EXTENSION);
|
||||
try {
|
||||
|
@ -340,7 +328,6 @@ namespace Greenshot.IniFile {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static void SaveInternally(string iniLocation) {
|
||||
WatchConfigFile(false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue