From: <nor...@us...> - 2007-06-09 08:11:48
|
Revision: 494 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=494&view=rev Author: northern_sky Date: 2007-06-09 01:11:46 -0700 (Sat, 09 Jun 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSettings.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FileItemList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/FileItems/FilelinkList.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIFileDetailsInfoParser.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramFilterItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs 2007-06-08 17:14:57 UTC (rev 493) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem .cs 2007-06-09 08:11:46 UTC (rev 494) @@ -40,1244 +40,1244 @@ namespace GUIPrograms.ApplicationItems { - /// <summary> - /// Summary description for Application. - /// </summary> - public class ApplicationItem + /// <summary> + /// Summary description for Application. + /// </summary> + public class ApplicationItem + { + protected static SQLiteClient sqlDB = null; + private DatabaseSorter dbPc = new DatabaseSorter(); + + public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + + public event FilelinkLaunchEventHandler OnLaunchFilelink = null; + + int appID; + int fatherID; + string title; + string shortTitle; + string filename; + string arguments; + ProcessWindowStyle windowStyle; + Process proc; + string startupDir; + bool useShellExecute; + bool useQuotes; + ApplicationType sourceType; + string sourceFile; + string imageFile; + string imageDirectories; // in one string for sqlite db field + public string[] imageDirs; // imageDirectories splitted + string fileDirectory; + string validExtensions; + bool importValidImagesOnly; + int appPosition; + bool enabled; + bool enableGUIRefresh; + int pincode; + int contentID; + string systemDefault; + bool waitForExit; + string preLaunch; + string postLaunch; + bool importMamePlaychoice10 = false; + + public bool ImportMamePlaychoice10 { - protected static SQLiteClient sqlDB = null; - private DatabaseSorter dbPc = new DatabaseSorter(); + get { return importMamePlaychoice10; } + set { importMamePlaychoice10 = value; } + } + bool importMameMahjong = false; - public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + public bool ImportMameMahjong + { + get { return importMameMahjong; } + set { importMameMahjong = value; } + } - public event FilelinkLaunchEventHandler OnLaunchFilelink = null; - int appID; - int fatherID; - string title; - string shortTitle; - string filename; - string arguments; - ProcessWindowStyle windowStyle; - Process proc; - string startupDir; - bool useShellExecute; - bool useQuotes; - ApplicationType sourceType; - string sourceFile; - string imageFile; - string imageDirectories; // in one string for sqlite db field - public string[] imageDirs; // imageDirectories splitted - string fileDirectory; - string validExtensions; - bool importValidImagesOnly; - int appPosition; - bool enabled; - bool enableGUIRefresh; - int pincode; - int contentID; - string systemDefault; - bool waitForExit; - string preLaunch; - string postLaunch; - bool importMamePlaychoice10 = false; + string launchErrorMsg; - public bool ImportMamePlaychoice10 - { - get { return importMamePlaychoice10; } - set { importMamePlaychoice10 = value; } - } - bool importMameMahjong = false; - public bool ImportMameMahjong - { - get { return importMameMahjong; } - set { importMameMahjong = value; } - } + // two magic image-slideshow counters + int thumbIndex = 0; + int thumbFolderIndex = -1; + string lastFilepath = ""; // cached path - string launchErrorMsg; + public bool filesAreLoaded = false; // load on demand.... + protected FileItemList fileList = null; + public bool linksAreLoaded = false; + protected FilelinkItemList fileLinks = null; - // two magic image-slideshow counters - int thumbIndex = 0; - int thumbFolderIndex = -1; + // event: read new file + public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); - string lastFilepath = ""; // cached path + public event RefreshInfoEventHandler OnRefreshInfo = null; - public bool filesAreLoaded = false; // load on demand.... - protected FileItemList fileList = null; + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) + { + if (OnRefreshInfo != null) + { + OnRefreshInfo(informationMessage, progressBarCtr); + } + } - public bool linksAreLoaded = false; - protected FilelinkItemList fileLinks = null; + protected int GetID = ProgramUtils.GetID; - // event: read new file - public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); + public ApplicationItem(SQLiteClient initSqlDB) + { - public event RefreshInfoEventHandler OnRefreshInfo = null; + // constructor: save SQLiteDB object + sqlDB = initSqlDB; + // .. init member variables ... + appID = -1; + fatherID = -1; + title = ""; + shortTitle = ""; + filename = ""; + arguments = ""; + windowStyle = ProcessWindowStyle.Normal; + startupDir = "%FILEDIR%"; + useShellExecute = false; + useQuotes = true; + enabled = true; + sourceType = ApplicationType.UNKNOWN; + sourceFile = ""; + imageFile = ""; + fileDirectory = ""; + imageDirectories = ""; + validExtensions = ""; + appPosition = 0; + importValidImagesOnly = false; + enableGUIRefresh = false; + pincode = -1; + contentID = 100; + systemDefault = ""; + waitForExit = true; + filesAreLoaded = false; + preLaunch = ""; + postLaunch = ""; - protected void SendRefreshInfo(string informationMessage, int progressBarCtr) - { - if (OnRefreshInfo != null) - { - OnRefreshInfo(informationMessage, progressBarCtr); - } - } + } - protected int GetID = ProgramUtils.GetID; + public SQLiteClient db + { + get { return sqlDB; } + } - public ApplicationItem(SQLiteClient initSqlDB) - { + public int CurrentSortIndex + { + get { return GetCurrentSortIndex(); } + set { SetCurrentSortIndex(value); } + } - // constructor: save SQLiteDB object - sqlDB = initSqlDB; - // .. init member variables ... - appID = -1; - fatherID = -1; - title = ""; - shortTitle = ""; - filename = ""; - arguments = ""; - windowStyle = ProcessWindowStyle.Normal; - startupDir = "%FILEDIR%"; - useShellExecute = false; - useQuotes = true; - enabled = true; - sourceType = ApplicationType.UNKNOWN; - sourceFile = ""; - imageFile = ""; - fileDirectory = ""; - imageDirectories = ""; - validExtensions = ""; - appPosition = 0; - importValidImagesOnly = false; - enableGUIRefresh = false; - pincode = -1; - contentID = 100; - systemDefault = ""; - waitForExit = true; - filesAreLoaded = false; - preLaunch = ""; - postLaunch = ""; + public bool CurrentSortIsAscending + { + get { return GetCurrentSortIsAscending(); } + set { SetCurrentSortIsAscending(value); } + } - } - public SQLiteClient db + public FileItem PrevFile(FileItem curFile) + { + if (Files == null) + { + return null; + } + if (Files.Count == 0) + { + return null; + } + int index = this.Files.IndexOf(curFile); + index = index - 1; + if (index < 0) + index = Files.Count - 1; + return (FileItem)Files[index]; + } + + public FileItem NextFile(FileItem curFile) + { + if (Files == null) + { + return null; + } + if (Files.Count == 0) + { + return null; + } + int index = this.Files.IndexOf(curFile); + index = index + 1; + if (index > Files.Count - 1) + index = 0; + return (FileItem)Files[index]; + } + + + public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) + { + string curFilename = curFile.Filename; + if (curFilename == "") + { + return; + } + + // Launch File by item + if (mpGuiMode) + { + curFile.UpdateLaunchInfo(); + } + ProcessStartInfo procStart = new ProcessStartInfo(); + + if (Filename != "") + { + // use the APPLICATION launcher and add current file information + procStart.FileName = Filename; // filename of the application + // set the arguments: one of the arguments is the fileitem-filename + procStart.Arguments = " " + this.Arguments + " "; + if (UseQuotes) { - get { return sqlDB; } + // avoid double quotes around the filename-argument..... + curFilename = "\"" + (curFile.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; } - public int CurrentSortIndex + if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) { - get { return GetCurrentSortIndex(); } - set { SetCurrentSortIndex(value); } + // ex. kawaks: + // winkawaks.exe alpham2 + // => filename without path and extension is necessary! + string filenameNoPathNoExt = curFile.ExtractFileName(); + filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); + filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); + procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); } - - public bool CurrentSortIsAscending + else { - get { return GetCurrentSortIsAscending(); } - set { SetCurrentSortIsAscending(value); } + // the fileitem-argument can be positioned anywhere in the argument string... + if (procStart.Arguments.IndexOf("%FILE%") == -1) + { + // no placeholder found => default handling: add the fileitem as the last argument + procStart.Arguments = procStart.Arguments + curFilename; + } + else + { + // placeholder found => replace the placeholder by the correct filename + procStart.Arguments = procStart.Arguments.Replace("%FILE%", curFilename); + } } - - - public FileItem PrevFile(FileItem curFile) + procStart.WorkingDirectory = Startupdir; + if (procStart.WorkingDirectory.IndexOf("%FILEDIR%") != -1) { - if (Files == null) - { - return null; - } - if (Files.Count == 0) - { - return null; - } - int index = this.Files.IndexOf(curFile); - index = index - 1; - if (index < 0) - index = Files.Count - 1; - return (FileItem)Files[index]; + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); } + procStart.UseShellExecute = UseShellExecute; + } + else + { + // application has no launch-file + // => try to make a correct launch using the current FILE object + procStart.FileName = curFile.Filename; + procStart.WorkingDirectory = Path.GetFullPath(curFile.Filename); - public FileItem NextFile(FileItem curFile) + + if (Startupdir != "") { - if (Files == null) - { - return null; - } - if (Files.Count == 0) - { - return null; - } - int index = this.Files.IndexOf(curFile); - index = index + 1; - if (index > Files.Count - 1) - index = 0; - return (FileItem)Files[index]; + if (Startupdir.Contains("%FILEDIR%")) + { + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); + } + else + { + procStart.WorkingDirectory = Startupdir; + } } + procStart.UseShellExecute = UseShellExecute; + } + procStart.WindowStyle = this.WindowStyle; - public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) + this.LaunchErrorMsg = ""; + try + { + DoPreLaunch(); + + + if (mpGuiMode) { - string curFilename = curFile.Filename; - if (curFilename == "") - { - return; - } + AutoPlay.StopListening(); + if (g_Player.Playing) + { + g_Player.Stop(); + } + } - // Launch File by item - if (mpGuiMode) - { - curFile.UpdateLaunchInfo(); - } - ProcessStartInfo procStart = new ProcessStartInfo(); + proc = new Process(); + proc.EnableRaisingEvents = true; + proc.Exited += new EventHandler(proc_Exited); - if (Filename != "") - { - // use the APPLICATION launcher and add current file information - procStart.FileName = Filename; // filename of the application - // set the arguments: one of the arguments is the fileitem-filename - procStart.Arguments = " " + this.Arguments + " "; - if (UseQuotes) - { - // avoid double quotes around the filename-argument..... - curFilename = "\"" + (curFile.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; - } + proc.StartInfo = procStart; + ProgramUtils.StartProcess(proc, WaitForExit); - if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) - { - // ex. kawaks: - // winkawaks.exe alpham2 - // => filename without path and extension is necessary! - string filenameNoPathNoExt = curFile.ExtractFileName(); - filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); - filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); - procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); - } - else - { - // the fileitem-argument can be positioned anywhere in the argument string... - if (procStart.Arguments.IndexOf("%FILE%") == -1) - { - // no placeholder found => default handling: add the fileitem as the last argument - procStart.Arguments = procStart.Arguments + curFilename; - } - else - { - // placeholder found => replace the placeholder by the correct filename - procStart.Arguments = procStart.Arguments.Replace("%FILE%", curFilename); - } - } - procStart.WorkingDirectory = Startupdir; - if (procStart.WorkingDirectory.IndexOf("%FILEDIR%") != -1) - { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); - } - procStart.UseShellExecute = UseShellExecute; - } - else - { - // application has no launch-file - // => try to make a correct launch using the current FILE object - procStart.FileName = curFile.Filename; - procStart.WorkingDirectory = Path.GetFullPath(curFile.Filename); - - - if (Startupdir != "") - { - if (Startupdir.Contains("%FILEDIR%")) - { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); - } - else - { - procStart.WorkingDirectory = Startupdir; - } - } - procStart.UseShellExecute = UseShellExecute; - } - procStart.WindowStyle = this.WindowStyle; + if (mpGuiMode) + { + //GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); + AutoPlay.StartListening(); + } - this.LaunchErrorMsg = ""; - try - { - DoPreLaunch(); + } + catch (Exception ex) + { + string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", + procStart.FileName, + procStart.Arguments, + procStart.WorkingDirectory, + ex.Message, + ex.Source, + ex.StackTrace); + Log.Info(ErrorString); + this.LaunchErrorMsg = ErrorString; + } + finally + { + DoPostLaunch(); + } + } + void proc_Exited(object sender, EventArgs e) + { - if (mpGuiMode) - { - AutoPlay.StopListening(); - if (g_Player.Playing) - { - g_Player.Stop(); - } - } + if (proc != null) + { + proc.Dispose(); + proc = null; + } + } - proc = new Process(); - proc.EnableRaisingEvents = true; - proc.Exited += new EventHandler(proc_Exited); + protected void DoPreLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(preLaunch); + } + } - proc.StartInfo = procStart; - ProgramUtils.StartProcess(proc, WaitForExit); + protected void DoPostLaunch() + { + if (waitForExit && (preLaunch != "")) + { + LaunchCmd(postLaunch); + } + } + protected void LaunchCmd(string commands) + { + string results = ""; + string errors = ""; + string[] script; + string curLine; + Process p = new Process(); + StreamWriter sw; + StreamReader sr; + StreamReader err; - if (mpGuiMode) - { - //GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); - AutoPlay.StartListening(); - } + script = commands.Split(';'); + if (script.Length > 0) + { + ProcessStartInfo psI = new ProcessStartInfo("cmd"); + psI.UseShellExecute = false; + psI.RedirectStandardInput = true; + psI.RedirectStandardOutput = true; + psI.RedirectStandardError = true; + psI.CreateNoWindow = true; + p.StartInfo = psI; - } - catch (Exception ex) - { - string ErrorString = String.Format("myPrograms: error launching program\n filename: {0}\n arguments: {1}\n WorkingDirectory: {2}\n stack: {3} {4} {5}", - procStart.FileName, - procStart.Arguments, - procStart.WorkingDirectory, - ex.Message, - ex.Source, - ex.StackTrace); - Log.Info(ErrorString); - this.LaunchErrorMsg = ErrorString; - } - finally - { - DoPostLaunch(); - } - } + p.Start(); + sw = p.StandardInput; + sr = p.StandardOutput; + err = p.StandardError; - void proc_Exited(object sender, EventArgs e) - { + sw.AutoFlush = true; - if (proc != null) - { - proc.Dispose(); - proc = null; - } - } - - protected void DoPreLaunch() + for (int i = 0; i < script.Length; i++) { - if (waitForExit && (preLaunch != "")) - { - LaunchCmd(preLaunch); - } + curLine = script[i].Trim(); + curLine = curLine.TrimStart('\n'); + if (curLine != "") + sw.WriteLine(curLine); } + sw.Close(); - protected void DoPostLaunch() + results += sr.ReadToEnd(); + errors += err.ReadToEnd(); + + if (errors.Trim() != "") { - if (waitForExit && (preLaunch != "")) - { - LaunchCmd(postLaunch); - } + Log.Info("Application PrePost errors: {0}", errors); } + } + } - protected void LaunchCmd(string commands) - { - string results = ""; - string errors = ""; - string[] script; - string curLine; - Process p = new Process(); - StreamWriter sw; - StreamReader sr; - StreamReader err; + public virtual void LaunchFile(GUIListItem item) + { + // Launch File by GUILISTITEM + // => look for FileItem and launch it using the found object + if (item.MusicTag == null) + { + return; + } + FileItem curFile = (FileItem)item.MusicTag; - script = commands.Split(';'); - if (script.Length > 0) - { - ProcessStartInfo psI = new ProcessStartInfo("cmd"); - psI.UseShellExecute = false; - psI.RedirectStandardInput = true; - psI.RedirectStandardOutput = true; - psI.RedirectStandardError = true; - psI.CreateNoWindow = true; - p.StartInfo = psI; + if (curFile == null) + { + return; + } + this.LaunchFile(curFile, true); + } - p.Start(); - sw = p.StandardInput; - sr = p.StandardOutput; - err = p.StandardError; + protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + this.OnLaunchFilelink(curLink, MPGUIMode); + } - sw.AutoFlush = true; + public virtual string DefaultFilepath() + { + return ""; // override this if the appitem can have subfolders + } - for (int i = 0; i < script.Length; i++) - { - curLine = script[i].Trim(); - curLine = curLine.TrimStart('\n'); - if (curLine != "") - sw.WriteLine(curLine); - } - sw.Close(); + public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) + { + int totalItems = 0; + if (filePath != lastFilepath) + { + Files.Load(AppID, filePath); + Filelinks.Load(AppID, filePath); + } + totalItems = totalItems + DisplayArrayList(filePath, this.Files, facadeView); + totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); + lastFilepath = filePath; + return totalItems; + } - results += sr.ReadToEnd(); - errors += err.ReadToEnd(); - - if (errors.Trim() != "") - { - Log.Info("Application PrePost errors: {0}", errors); - } - } + protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) + { + int totalItems = 0; + //foreach (FileItem currentFileItem in dbItems) + foreach (object obj in dbItems) + { + totalItems = totalItems + 1; + if (obj is FileItem) + { + FileItem curFile = obj as FileItem; + GUIListItem gli = new GUIListItem(curFile.Title); + gli.Label2 = curFile.Title2; + gli.MusicTag = curFile; + gli.IsFolder = curFile.IsFolder; + gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + facadeView.Add(gli); } - - public virtual void LaunchFile(GUIListItem item) + else if (obj is ProgramFilterItem) { - // Launch File by GUILISTITEM - // => look for FileItem and launch it using the found object - if (item.MusicTag == null) - { - return; - } - FileItem curFile = (FileItem)item.MusicTag; + ProgramFilterItem curFilter = obj as ProgramFilterItem; + GUIListItem gli = new GUIListItem(curFilter.Title); + gli.Label2 = curFilter.Title2; // some filters may have more than one text + gli.MusicTag = curFilter; + gli.IsFolder = true; + //ck + gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - if (curFile == null) - { - return; - } - this.LaunchFile(curFile, true); + + facadeView.Add(gli); + } + } + return totalItems; + } - protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + + void OnRetrieveCoverArt(GUIListItem gli) + { + if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) + { + FileItem curFile = (FileItem)gli.MusicTag; + if (curFile.Imagefile != "") { - this.OnLaunchFilelink(curLink, MPGUIMode); + gli.ThumbnailImage = curFile.Imagefile; + gli.IconImageBig = curFile.Imagefile; + gli.IconImage = curFile.Imagefile; } - - public virtual string DefaultFilepath() + else { - return ""; // override this if the appitem can have subfolders + gli.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + gli.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + gli.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; } + } + } - public virtual int DisplayFiles(string filePath, GUIFacadeControl facadeView) - { - int totalItems = 0; - if (filePath != lastFilepath) + /* private void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; + if (filmstrip == null) return; + if (item == null) return; + if ((item.MusicTag != null) && (item.MusicTag is FileItem) && (!item.IsFolder)) + { + filmstrip.InfoImageFileName = item.ThumbnailImage; + } + else + { + filmstrip.InfoImageFileName = ""; + } + }*/ + private void OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIPrograms.ThumbnailPath = ""; + if (item.ThumbnailImage != "" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" + && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" + ) + { + // only show big thumb if there is really one.... + GUIPrograms.ThumbnailPath = item.ThumbnailImage; + } + } + + public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) + { + /* + * if (!filesAreLoaded) { - Files.Load(AppID, filePath); - Filelinks.Load(AppID, filePath); + LoadFiles(); } - totalItems = totalItems + DisplayArrayList(filePath, this.Files, facadeView); - totalItems = totalItems + DisplayArrayList(filePath, this.Filelinks, facadeView); - lastFilepath = filePath; - return totalItems; - } - protected int DisplayArrayList(string filePath, List<object> dbItems, GUIFacadeControl facadeView) - { - int totalItems = 0; - //foreach (FileItem currentFileItem in dbItems) - foreach (object obj in dbItems) + if (doSwitchState) { - totalItems = totalItems + 1; - if (obj is FileItem) - { - FileItem curFile = obj as FileItem; - GUIListItem gli = new GUIListItem(curFile.Title); - gli.Label2 = curFile.Title2; - gli.MusicTag = curFile; - gli.IsFolder = curFile.IsFolder; - gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); - } - else if (obj is ProgramFilterItem) - { - ProgramFilterItem curFilter = obj as ProgramFilterItem; - GUIListItem gli = new GUIListItem(curFilter.Title); - gli.Label2 = curFilter.Title2; // some filters may have more than one text - gli.MusicTag = curFilter; - gli.IsFolder = true; - //ck - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); + dbPc.UpdateState(); + } + view.Sort(dbPc); + */ + } + public virtual void OnSortToggle(GUIFacadeControl view) + { + dbPc.sortAscending = (!dbPc.sortAscending); + view.Sort(dbPc); + } - facadeView.Add(gli); + public virtual int GetCurrentSortIndex() + { + return dbPc.CurrentSortMethodIndex; + } - } - } - return totalItems; - } + public virtual void SetCurrentSortIndex(int newValue) + { + dbPc.CurrentSortMethodIndex = newValue; + } + public virtual string CurrentSortTitle() + { + return dbPc.CurrentSortMethodAsText; + } - void OnRetrieveCoverArt(GUIListItem gli) - { - if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) - { - FileItem curFile = (FileItem)gli.MusicTag; - if (curFile.Imagefile != "") - { - gli.ThumbnailImage = curFile.Imagefile; - gli.IconImageBig = curFile.Imagefile; - gli.IconImage = curFile.Imagefile; - } - else - { - gli.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - gli.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - gli.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; - } - } - } + public virtual bool GetCurrentSortIsAscending() + { + return dbPc.sortAscending; + } - /* private void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip == null) return; - if (item == null) return; - if ((item.MusicTag != null) && (item.MusicTag is FileItem) && (!item.IsFolder)) - { - filmstrip.InfoImageFileName = item.ThumbnailImage; - } - else - { - filmstrip.InfoImageFileName = ""; - } - }*/ - private void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIPrograms.ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" - ) - { - // only show big thumb if there is really one.... - GUIPrograms.ThumbnailPath = item.ThumbnailImage; - } - } + public virtual void SetCurrentSortIsAscending(bool newValue) + { + dbPc.sortAscending = newValue; + } - public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) - { - /* - * if (!filesAreLoaded) - { - LoadFiles(); - } + public virtual bool RefreshButtonVisible() + { + return false; // otherwise, override this in child class + } - if (doSwitchState) - { - dbPc.UpdateState(); - } - view.Sort(dbPc); - */ - } + public virtual bool FileEditorAllowed() + { + return true; // otherwise, override this in child class + } - public virtual void OnSortToggle(GUIFacadeControl view) - { - dbPc.sortAscending = (!dbPc.sortAscending); - view.Sort(dbPc); - } + public virtual bool FileAddAllowed() + { + return true; // otherwise, override this in child class + } - public virtual int GetCurrentSortIndex() - { - return dbPc.CurrentSortMethodIndex; - } + public virtual bool FilesCanBeFavourites() + { + return true; // otherwise, override this in child class + } - public virtual void SetCurrentSortIndex(int newValue) - { - dbPc.CurrentSortMethodIndex = newValue; - } + public virtual bool FileBrowseAllowed() + { + // set this to true, if SUBDIRECTORIES are allowed + // (example: possible for DIRECTORY-CACHE) + return false; // otherwise, override this in child class + } - public virtual string CurrentSortTitle() - { - return dbPc.CurrentSortMethodAsText; - } + public virtual bool SubItemsAllowed() + { + return false; + } - public virtual bool GetCurrentSortIsAscending() - { - return dbPc.sortAscending; - } + public virtual bool ProfileLoadingAllowed() + { + return false; + } - public virtual void SetCurrentSortIsAscending(bool newValue) - { - dbPc.sortAscending = newValue; - } + public virtual void Refresh(bool mpGuiMode) + { + // descendant classes do that! + } - public virtual bool RefreshButtonVisible() - { - return false; // otherwise, override this in child class - } - public virtual bool FileEditorAllowed() + public virtual void OnInfo(GUIListItem item, ref bool isOverviewVisible, ref ProgramInfoAction modalResult, ref int selectedFileID) + { + GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); + if (null != fileInfoDialog) + { + if (item.MusicTag == null) { - return true; // otherwise, override this in child class + return; } + FileItem curFile = (FileItem)item.MusicTag; + fileInfoDialog.App = this; + fileInfoDialog.File = curFile; + fileInfoDialog.IsOverviewVisible = isOverviewVisible; + fileInfoDialog.DoModal(GetID); + isOverviewVisible = fileInfoDialog.IsOverviewVisible; + modalResult = fileInfoDialog.ModalResult; + selectedFileID = fileInfoDialog.SelectedFileID; + return; + } + } - public virtual bool FileAddAllowed() - { - return true; // otherwise, override this in child class - } + public int AppID + { + get { return appID; } + set { appID = value; } + } - public virtual bool FilesCanBeFavourites() - { - return true; // otherwise, override this in child class - } + public int FatherID + { + get { return fatherID; } + set { fatherID = value; } + } - public virtual bool FileBrowseAllowed() - { - // set this to true, if SUBDIRECTORIES are allowed - // (example: possible for DIRECTORY-CACHE) - return false; // otherwise, override this in child class - } + public string Title + { + get { return title; } + set { title = value; } + } - public virtual bool SubItemsAllowed() - { - return false; - } + public string ShortTitle + { + get { return shortTitle; } + set { shortTitle = value; } + } - public virtual bool ProfileLoadingAllowed() - { - return false; - } + public string Filename + { + get { return filename; } + set { filename = value; } + } - public virtual void Refresh(bool mpGuiMode) - { - // descendant classes do that! - } + public string Arguments + { + get { return arguments; } + set { arguments = value; } + } + public bool UseQuotes + { + get { return useQuotes; } + set { useQuotes = value; } + } - public virtual void OnInfo(GUIListItem item, ref bool isOverviewVisible, ref ProgramInfoAction modalResult, ref int selectedFileID) - { - GUIFileInfo fileInfoDialog = (GUIFileInfo)GUIWindowManager.GetWindow(ProgramUtils.ProgramInfoID); - if (null != fileInfoDialog) - { - if (item.MusicTag == null) - { - return; - } - FileItem curFile = (FileItem)item.MusicTag; - fileInfoDialog.App = this; - fileInfoDialog.File = curFile; - fileInfoDialog.IsOverviewVisible = isOverviewVisible; - fileInfoDialog.DoModal(GetID); - isOverviewVisible = fileInfoDialog.IsOverviewVisible; - modalResult = fileInfoDialog.ModalResult; - selectedFileID = fileInfoDialog.SelectedFileID; - return; - } - } + public bool UseShellExecute + { + get { return useShellExecute; } + set { useShellExecute = value; } + } - public int AppID - { - get { return appID; } - set { appID = value; } - } + public bool Enabled + { + get { return enabled; } + set { enabled = value; } + } - public int FatherID - { - get { return fatherID; } - set { fatherID = value; } - } + public ProcessWindowStyle WindowStyle + { + get { return windowStyle; } + set { windowStyle = value; } + } - public string Title - { - get { return title; } - set { title = value; } - } + public string Startupdir + { + get { return startupDir; } + set { startupDir = value; } + } - public string ShortTitle - { - get { return shortTitle; } - set { shortTitle = value; } - } + public string FileDirectory + { + get { return fileDirectory; } + set { fileDirectory = value; } + } - public string Filename - { - get { return filename; } - set { filename = value; } - } + public string ImageDirectory + { + get { return imageDirectories; } + set { SetImageDirectory(value); } + } - public string Arguments - { - get { return arguments; } - set { arguments = value; } - } + private void SetImageDirectory(string value) + { + imageDirectories = value; + imageDirs = imageDirectories.Split(';'); + for (int i = 0; i < imageDirs.Length; i++) + { + imageDirs[i] = imageDirs[i].Trim(); + // hack the \n away.... + // imageDirs[i] = imageDirs[i].TrimStart('\n'); + // hack trailing backslashes away + imageDirs[i] = imageDirs[i].TrimEnd('\\'); + } + } - public bool UseQuotes - { - get { return useQuotes; } - set { useQuotes = value; } - } + public string Imagefile + { + get { return imageFile; } + set { imageFile = value; } + } - public bool UseShellExecute - { - get { return useShellExecute; } - set { useShellExecute = value; } - } + public string Source + { + get { return sourceFile; } + set { sourceFile = value; } + } - public bool Enabled - { - get { return enabled; } - set { enabled = value; } - } + public ApplicationType SourceType + { + get { return sourceType; } + set { sourceType = value; } + } - public ProcessWindowStyle WindowStyle - { - get { return windowStyle; } - set { windowStyle = value; } - } + public string ValidExtensions + { + get { return validExtensions; } + set { validExtensions = value; } + } - public string Startupdir - { - get { return startupDir; } - set { startupDir = value; } - } + public bool ImportValidImagesOnly + { + get { return importValidImagesOnly; } + set { importValidImagesOnly = value; } + } - public string FileDirectory - { - get { return fileDirectory; } - set { fileDirectory = value; } - } + public int Position + { + get { return appPosition; } + set { appPosition = value; } + } - public string ImageDirectory - { - get { return imageDirectories; } - set { SetImageDirectory(value); } - } + public int ContentID + { + get { return contentID; } + set { contentID = value; } + } - private void SetImageDirectory(string value) - { - imageDirectories = value; - imageDirs = imageDirectories.Split(';'); - for (int i = 0; i < imageDirs.Length; i++) - { - imageDirs[i] = imageDirs[i].Trim(); - // hack the \n away.... - // imageDirs[i] = imageDirs[i].TrimStart('\n'); - // hack trailing backslashes away - imageDirs[i] = imageDirs[i].TrimEnd('\\'); - } - } + public string SystemDefault + { + get { return systemDefault; } + set { systemDefault = value; } + } - public string Imagefile - { - get { return imageFile; } - set { imageFile = value; } - } + public bool WaitForExit + { + get { return waitForExit; } + set { waitForExit = value; } + } - public string Source - { - get { return sourceFile; } - set { sourceFile = value; } - } - public ApplicationType SourceType - { - get { return sourceType; } - set { sourceType = value; } - } + public bool GUIRefreshPossible + { + get { return RefreshButtonVisible(); } + } - public string ValidExtensions - { - get { return validExtensions; } - set { validExtensions = value; } - } + public bool EnableGUIRefresh + { + get { return enableGUIRefresh; } + set { enableGUIRefresh = value; } + } - public bool ImportValidImagesOnly - { - get { return importValidImagesOnly; } - set { importValidImagesOnly = value; } - } + public string LaunchErrorMsg + { + get { return launchErrorMsg; } + set { launchErrorMsg = value; } + } - public int Position + public string PreLaunch + { + get { return preLaunch; } + set { preLaunch = value; } + } + + public string PostLaunch + { + get { return postLaunch; } + set { postLaunch = value; } + } + + + public FileItemList Files + { + // load on demand.... + get + { + if (!filesAreLoaded) { - get { return appPosition; } - set { appPosition = value; } + LoadFiles(); } + return fileList; + } + } - public int ContentID + + public FilelinkItemList Filelinks + { + // load on demand.... + get + { + if (!linksAreLoaded) { - get { return contentID; } - set { contentID = value; } + LoadFileLinks(); } + return fileLinks; + } + } - public string SystemDefault + + private int GetNewAppID() + { + // get an unused SQL application KEY-number + if (sqlDB != null) + { + // won't work in multiuser environment :) + SQLiteResultSet results; + int res = 0; + results = sqlDB.Execute("SELECT MAX(APPID) FROM application"); + SQLiteResultSet.Row arr = results.Rows[0]; + if (arr.fields[0] != null) { - get { return systemDefault; } - set { systemDefault = value; } + if (arr.fields[0] != "") + { + res = Int32.Parse(arr.fields[0]); + } } + return res + 1; + } + else return -1; + } - public bool WaitForExit + private void Insert() + { + if (sqlDB != null) + { + try { - get { return waitForExit; } - set { waitForExit = value; } + if (ContentID <= 0) + { + ContentID = 100; + } + //to remove + string Pincode = ""; + AppID = GetNewAppID(); // important to avoid subsequent inserts! + string sql = String.Format("insert into application (appid, fatherID, title, shorttitle, filename, arguments, windowstyle, startupdir, useshellexecute, usequotes, source_type, source, imagefile, filedirectory, imagedirectory, validextensions, importvalidimagesonly, iposition, enabled, enableGUIRefresh, GUIRefreshPossible, pincode, contentID, systemDefault, WaitForExit, preLaunch, postLaunch) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}')", + AppID, FatherID, ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), + ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), + ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), + ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, + ProgramUtils.BooleanToStr(Enabled), ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible), Pincode, + ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch) + ); + sqlDB.Execute(sql); } - - - public bool GUIRefreshPossible + catch (SQLiteException ex) { - get { return RefreshButtonVisible(); } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } + } + } - public bool EnableGUIRefresh + private void Update() + { + string sql = ""; + //to remove + string Pincode = ""; + if ((AppID >= 0) && (sqlDB != null)) + { + if (ContentID <= 0) { - get { return enableGUIRefresh; } - set { enableGUIRefresh = value; } + ContentID = 100; } - - public string LaunchErrorMsg + try { - get { return launchErrorMsg; } - set { launchErrorMsg = value; } + sql = String.Format("update application set title = '{0}', shorttitle = '{1}', filename = '{2}', arguments = '{3}', windowstyle = '{4}', startupdir = '{5}', useshellexecute = '{6}', usequotes = '{7}', source_type = '{8}', source = '{9}', imagefile = '{10}',filedirectory = '{11}',imagedirectory = '{12}',validextensions = '{13}',importvalidimagesonly = '{14}',iposition = {15}, enabled = '{16}', fatherID = '{17}', enableGUIRefresh = '{18}', GUIRefreshPossible = '{19}', pincode = '{20}', contentID = '{21}', systemDefault = '{22}', WaitForExit = '{23}', preLaunch = '{24}', postLaunch = '{25}' where appID = {26}", + ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), + ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), + ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), + ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, + ProgramUtils.BooleanToStr(Enabled), FatherID, ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible), + Pincode, ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch), + AppID); + sqlDB.Execute(sql); } - - public string PreLaunch + catch (SQLiteException ex) { - get { return preLaunch; } - set { preLaunch = value; } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + Log.Info("sql \n{0}", sql); } + } + } - public string PostLaunch + public void Delete() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try { - get { return postLaunch; } - set { postLaunch = value; } + DeleteFiles(); + DeleteFileLinks(); + sqlDB.Execute(String.Format("delete from application where appid = {0}", AppID)); } - - - public FileItemList Files + catch (SQLiteException ex) { - // load on demand.... - get - { - if (!filesAreLoaded) - { - LoadFiles(); - } - return fileList; - } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } + } + } - public FilelinkItemList Filelinks - { - // load on demand.... - get - { - if (!linksAreLoaded) - { - LoadFileLinks(); - } - return fileLinks; - } - } - private int GetNewAppID() + protected void DeleteFiles() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try { - // get an unused SQL application KEY-number - if (sqlDB != null) - { - // won't work in multiuser environment :) - SQLiteResultSet results; - int res = 0; - results = sqlDB.Execute("SELECT MAX(APPID) FROM application"); - SQLiteResultSet.Row arr = results.Rows[0]; - if (arr.fields[0] != null) - { - if (arr.fields[0] != "") - { - res = Int32.Parse(arr.fields[0]); - } - } - return res + 1; - } - else return -1; + sqlDB.Execute(String.Format("delete from tblfile where appid = {0}", AppID)); } - - private void Insert() + catch (SQLiteException ex) { - if (sqlDB != null) - { - try - { - if (ContentID <= 0) - { - ContentID = 100; - } - //to remove - string Pincode = ""; - AppID = GetNewAppID(); // important to avoid subsequent inserts! - string sql = String.Format("insert into application (appid, fatherID, title, shorttitle, filename, arguments, windowstyle, startupdir, useshellexecute, usequotes, source_type, source, imagefile, filedirectory, imagedirectory, validextensions, importvalidimagesonly, iposition, enabled, enableGUIRefresh, GUIRefreshPossible, pincode, contentID, systemDefault, WaitForExit, preLaunch, postLaunch) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}')", - AppID, FatherID, ProgramUtils.Encode(Title), ProgramUtils.Encode(ShortTitle), ProgramUtils.Encode(Filename), ProgramUtils.Encode(Arguments), - ProgramUtils.WindowStyleToStr(WindowStyle), ProgramUtils.Encode(Startupdir), ProgramUtils.BooleanToStr(UseShellExecute), - ProgramUtils.BooleanToStr(UseQuotes), ProgramUtils.ApplicationTypeToString(SourceType), ProgramUtils.Encode(Source), ProgramUtils.Encode(Imagefile), - ProgramUtils.Encode(FileDirectory), ProgramUtils.Encode(ImageDirectory), ProgramUtils.Encode(ValidExtensions), ProgramUtils.BooleanToStr(importValidImagesOnly), Position, - ProgramUtils.BooleanToStr(Enabled), ProgramUtils.BooleanToStr(EnableGUIRefresh), ProgramUtils.BooleanToStr(GUIRefreshPossible),Pincode , - ContentID, ProgramUtils.Encode(SystemDefault), ProgramUtils.BooleanToStr(WaitForExit), ProgramUtils.Encode(PreLaunch), ProgramUtils.Encode(PostLaunch) - ); - sqlDB.Execute(sql); - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - } - } + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } + } + } - private void Update() + protected void DeleteFileLinks() + { + if ((AppID >= 0) && (sqlDB != null)) + { + try { - string sql = ""; - //to remove - string Pincode = ""; - if ((AppID >= 0) && (sqlDB != null)) - { - if (ContentID <= 0) - { - ContentID = 100; - } - try - { - sql = String.Format("update application set title = '{0}', shorttitle = '{1}', filename = '{2}', arguments = '{3}', windowstyle = '{4}', startupdir = '{5}', useshellexecute = '{6}', usequotes = '{7}', source_type = '{8}', source = '{9}', imagefile = '{10}',filedirectory = '{11}',imagedirectory = '{12}',validextensions = '{13}',importvalidimagesonly = '{14}',iposition = {15}, enabled = '{16}', fatherID = '{17}', enableGUIRefresh = '{18}', GUIRefreshPossible = '{19}', pincode = '{20}', contentID = '{21}', systemDefault = '{22}', WaitForExit = '{23}', preLaunc... [truncated message content] |