|
From: <nic...@us...> - 2014-05-20 13:03:03
|
Revision: 4811
http://sourceforge.net/p/mp-plugins/code/4811
Author: nicsergio
Date: 2014-05-20 13:03:01 +0000 (Tue, 20 May 2014)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs
Modified: trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs
===================================================================
--- trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-20 05:19:54 UTC (rev 4810)
+++ trunk/plugins/ShortCuter&SkinEditor/Source/ShortCuter/ShortCuts.cs 2014-05-20 13:03:01 UTC (rev 4811)
@@ -514,14 +514,11 @@
{
xmlFile.Load(defaultConfig); //Configurazione predefinita --> lettura file xml incapsulato
}
- return LoadConfig(ref xmlFile); //--> caricamento configurazione Skin Navigator
- }
- catch
- {
- return false;
+ return LoadConfig(xmlFile); //--> caricamento configurazione Skin Navigator
}
+ catch { return false; }
}
- public bool LoadConfig(ref XmlDocument xmlFile) //Caricamento configurazione
+ public bool LoadConfig(XmlDocument xmlFile) //Caricamento configurazione
{
_items.Clear(); //--> pulizia lista elementi di navigazione
@@ -595,7 +592,7 @@
else
return false; //--> impostazioni non caricate (sezione Navigator non presente)
}
- public void SaveConfig(ref XmlTextWriter xmlSettings) //Salvataggio configurazione
+ public void SaveConfig(XmlTextWriter xmlSettings) //Salvataggio configurazione
{
xmlSettings.WriteStartElement("Navigator");
xmlSettings.WriteStartElement("General");
@@ -732,33 +729,37 @@
#region Metodi Privati
private bool LoadDeprecatedConfig() //Caricamento configurazione obsoleta
{
- using (Settings confReader = new Settings(SettingsFile))
+ try
{
- const string sectionName = "ShortCuterForm";
- const string capPrefix = "Titel";
- const string keyPrefix = "Key";
- const string widPrefix = "ID";
+ using (Settings confReader = new Settings(SettingsFile))
+ {
+ const string sectionName = "ShortCuterForm";
+ const string capPrefix = "Titel";
+ const string keyPrefix = "Key";
+ const string widPrefix = "ID";
- if (!confReader.HasSection<string>(sectionName))
- return false; //--> se sezione non presente: il file non corrisponde
+ if (!confReader.HasSection<string>(sectionName))
+ return false; //--> se sezione non presente: il file non corrisponde
- bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut
- bool shift = confReader.GetValueAsBool(sectionName, "ModShift", false); //--> utilizzo del modificatore shift per tutti gli shortcut
+ bool ctrl = confReader.GetValueAsBool(sectionName, "ModCtrl", false); //--> utilizzo del modificatore ctrl per tutti gli shortcut
+ bool shift = confReader.GetValueAsBool(sectionName, "ModShift", false); //--> utilizzo del modificatore shift per tutti gli shortcut
- for (int i = 1; i <= 20; i++) //Iterazione di lettura shortcut
- {
- ShortCut sc = new ShortCut();
- sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), "");
- sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper();
- sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1);
- sc.Ctrl = ctrl;
- sc.Alt = false;
- sc.Shift = shift;
- if (sc.IsValid) //Se shortcut valido
- _items.Add(sc); //--> aggiunta dello shortcut nella lista
+ for (int i = 1; i <= 20; i++) //Iterazione di lettura shortcut
+ {
+ ShortCut sc = new ShortCut();
+ sc.Caption = confReader.GetValueAsString(sectionName, capPrefix + string.Format("{0:00}", i), "");
+ sc.Key = confReader.GetValueAsString(sectionName, keyPrefix + string.Format("{0:00}", i), "").ToUpper();
+ sc.WindowID = confReader.GetValueAsInt(sectionName, widPrefix + string.Format("{0:00}", i), -1);
+ sc.Ctrl = ctrl;
+ sc.Alt = false;
+ sc.Shift = shift;
+ if (sc.IsValid) //Se shortcut valido
+ _items.Add(sc); //--> aggiunta dello shortcut nella lista
+ }
+ return (_items.Count > 0);
}
- return (_items.Count > 0);
}
+ catch { return false; }
}
private List<ShortCut> GetShortCutsGroup(KeyCombination k) //Raccolta lista shortcut associati alla combinazione di tasti
{
@@ -902,7 +903,7 @@
}
if (_items.Count > 0)
{
- if (!_navigator.LoadConfig(ref xmlFile) && Log != null) //--> caricamento configurazione Skin Navigator
+ if (!_navigator.LoadConfig(xmlFile) && Log != null) //--> caricamento configurazione Skin Navigator
Log(this, new LogEventArgs(LogEventArgs.LogLevels.Debug, "No Skin Navigator settings found loading configuration."));
return true; //--> lettura configurazione effettuata
}
@@ -961,10 +962,9 @@
xmlSettings.WriteEndElement();
}
xmlSettings.WriteEndElement();
+ _navigator.SaveConfig(xmlSettings); //--> salvataggio configurazione Skin Navigator
xmlSettings.WriteEndElement();
- _navigator.SaveConfig(ref xmlSettings); //--> salvataggio configurazione Skin Navigator
-
xmlSettings.Flush();
xmlSettings.Close();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|