|
From: <hap...@us...> - 2007-03-31 12:18:18
|
Revision: 267
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=267&view=rev
Author: happytalk
Date: 2007-03-31 05:18:16 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
fixed "{"There is no row at position -1."} exception
Modified Paths:
--------------
trunk/plugins/MyFilms/MesFilms.cs
Modified: trunk/plugins/MyFilms/MesFilms.cs
===================================================================
--- trunk/plugins/MyFilms/MesFilms.cs 2007-03-31 11:14:14 UTC (rev 266)
+++ trunk/plugins/MyFilms/MesFilms.cs 2007-03-31 12:18:16 UTC (rev 267)
@@ -134,7 +134,6 @@
public string WStrSortSens = null;
public bool boolreturn = false;
public bool boolstorage = false;
- public bool choice_menu = false;
string StrDfltSelect = null;
string CurrentSortMethod = null;
decimal w_rating = 0;
@@ -257,15 +256,6 @@
{
if (GetPrevFilmList() || (actionType.wID != Action.ActionType.ACTION_PREVIOUS_MENU)) return;
}
- //if (actionType.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
- //{
- // if (choice_menu)
- // base.OnPreviousWindow();
- //// using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MyFilms.xml"))
- //// {
- //// xmlwriter.SetValue("MyFilms", "Current_Config", "");
- //// }
- //}
base.OnAction(actionType);
}
//---------------------------------------------------------------------------------------
@@ -312,16 +302,27 @@
if (CurrentConfig == "")
CurrentConfig = xmlreader.GetValueAsString("MyFilms", "Current_Config", "");
if (CurrentConfig == "")
- CurrentConfig = Choice_Config();
- Load_Config(CurrentConfig,true);
- Fin_Charge_Init(true);
+ {
+ CurrentConfig = Choice_Config(); // "" => user esc's dialog on plugin startup so exit plugin unchanged
+ }
+
+ if (CurrentConfig == "") //continuing here with CurrentConfig = "" will cause exception in GuiWindowManager.cs so exit plugin
+ {
+ base.OnMessage(messageType);
+ GUIWindowManager.ShowPreviousWindow();
+ }
+ else
+ {
+ Load_Config(CurrentConfig, true);
+ Fin_Charge_Init(true);
+ }
}
}
}
return true;
case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: //called when exiting plugin either by prev menu or pressing home button
- save_config_values();
+ if (CurrentConfig != "") save_config_values();
mydivx.Clear();
mydivx.Dispose();
return true; // fall through to call base class?
@@ -912,8 +913,6 @@
//-----------------------------------------------------------------------------------------
private bool ControlFichierDonn\xE9es()
{
- if (StrFileXml == "")
- return false;
if (File.Exists(StrFileXml))
return true;
else
@@ -1111,6 +1110,7 @@
}
}
}
+
private void Load_Config(string CurrentConfig,bool create_temp)
{
//-----------------------------------------------------------------------------------------------
@@ -1133,7 +1133,6 @@
StrViewText2 = xmlreader.GetValueAsString(CurrentConfig, "AntViewText2", "");
StrFileXml = xmlreader.GetValueAsString(CurrentConfig, "AntCatalog", "");
StrFileType = xmlreader.GetValueAsString(CurrentConfig, "CatalogType", "0");
- StrPathImg = xmlreader.GetValueAsString(CurrentConfig, "AntPicture", "");
switch (StrFileType)
{
case "0":
@@ -1141,25 +1140,21 @@
case "1":
if (create_temp)
{
- string WStrPathImg;
- if (StrPathImg.Substring(StrPathImg.Length - 1) == "\\")
- WStrPathImg = StrPathImg.Substring(0, StrPathImg.LastIndexOf(@"\"));
- else
- WStrPathImg = StrPathImg;
- string destFile = WStrPathImg + "\\" + StrFileXml.Substring(StrFileXml.LastIndexOf(@"\") + 1, StrFileXml.Length - StrFileXml.LastIndexOf(@"\") - 5) + "_tmp.xml";
+ string destFile = StrFileXml.Substring(0, StrFileXml.Length - 4) + "_tmp.xml";
if ((System.IO.File.Exists(destFile) && (System.IO.File.GetLastWriteTime(destFile) > System.IO.File.GetLastWriteTime(StrFileXml))))
{
StrFileXml = destFile;
break;
}
CatalogConverter cv = new CatalogConverter();
- StrFileXml = cv.ConvertProfiler(StrFileXml,StrPathImg);
+ StrFileXml = cv.ConvertProfiler(StrFileXml);
}
else
StrFileXml = xmlreader.GetValueAsString(CurrentConfig, "AntCatalogTemp", "");
break;
}
+ StrPathImg = xmlreader.GetValueAsString(CurrentConfig, "AntPicture", "");
StrSelect = xmlreader.GetValueAsString(CurrentConfig, "StrSelect", "");
StrActors = xmlreader.GetValueAsString(CurrentConfig, "StrActors", "");
StrDfltSelect = xmlreader.GetValueAsString(CurrentConfig, "StrDfltSelect", "");
@@ -1183,12 +1178,11 @@
//--------------------------------------------------------------------------------------------
private string Choice_Config()
{
- choice_menu = true;
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
if (dlg == null)
{
StrFileXml = "";
- return CurrentConfig;
+ return "";
}
dlg.Reset();
dlg.SetHeading(924); // menu
@@ -1204,7 +1198,7 @@
if (dlg.SelectedLabel == -1)
{
StrFileXml = "";
- return CurrentConfig;
+ return "";
}
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MyFilms.xml"))
{
@@ -1299,6 +1293,7 @@
GetFilmList(l_index);
}
+
}
}
@@ -1392,11 +1387,16 @@
}
if (choice_view == "Config")
{
- //Change "Config":
- save_config_values();
- mydivx.Clear();
- Load_Config(Choice_Config(),true);
- Fin_Charge_Init(true);
+ string oldConfig = CurrentConfig;
+ string newView = Choice_Config();
+ if (newView != "" && newView != oldConfig) // if user escapes dialog or bad value leave system unchanged
+ {
+ //Change "Config":
+ save_config_values();
+ mydivx.Clear();
+ Load_Config(newView, true);
+ Fin_Charge_Init(true);
+ }
return;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|