From: <che...@us...> - 2007-06-16 00:09:54
|
Revision: 557 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=557&view=rev Author: chef_koch Date: 2007-06-15 17:09:51 -0700 (Fri, 15 Jun 2007) Log Message: ----------- no code content changes, only ordered the code and added regions Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-15 23:36:24 UTC (rev 556) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-16 00:09:51 UTC (rev 557) @@ -40,29 +40,42 @@ namespace GUIPrograms.ApplicationItems { - /// <summary> - /// Summary description for Application. - /// </summary> public class ApplicationItem { + #region Variables + 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; + bool useShellExecute; + bool waitForExit; + string preLaunch; + string postLaunch; + + bool enabled; + bool enableGUIRefresh; + int appPosition; + + public bool filesAreLoaded = false; // load on demand.... + protected FileItemList fileList = null; + public bool linksAreLoaded = false; // load on demand.... + protected FilelinkItemList fileLinks = null; + + bool importMamePlaychoice10 = false; + bool importMameMahjong = false; + + + // more variables, maybe need some renaming or anything else + Process proc; ApplicationType sourceType; string sourceFile; string imageFile; @@ -71,24 +84,142 @@ 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; + // two magic image-slideshow counters + int thumbIndex = 0; + int thumbFolderIndex = -1; + + string lastFilepath = ""; // cached path + + private DatabaseSorter dbPc = new DatabaseSorter(); + + #endregion + + #region Properties + // Helper Routines + + public int AppID + { + get { return appID; } + set { appID = value; } + } + public int FatherID + { + get { return fatherID; } + set { fatherID = value; } + } + public string Title + { + get { return title; } + set { title = value; } + } + public string ShortTitle + { + get { return shortTitle; } + set { shortTitle = value; } + } + public string Filename + { + get { return filename; } + set { filename = value; } + } + + public string Arguments + { + get { return arguments; } + set { arguments = value; } + } + public ProcessWindowStyle WindowStyle + { + get { return windowStyle; } + set { windowStyle = value; } + } + public string Startupdir + { + get { return startupDir; } + set { startupDir = value; } + } + public bool UseQuotes + { + get { return useQuotes; } + set { useQuotes = value; } + } + public bool UseShellExecute + { + get { return useShellExecute; } + set { useShellExecute = value; } + } + public bool WaitForExit + { + get { return waitForExit; } + set { waitForExit = value; } + } + public string PreLaunch + { + get { return preLaunch; } + set { preLaunch = value; } + } + public string PostLaunch + { + get { return postLaunch; } + set { postLaunch = value; } + } + + public bool Enabled + { + get { return enabled; } + set { enabled = value; } + } + public bool EnableGUIRefresh + { + get { return enableGUIRefresh; } + set { enableGUIRefresh = value; } + } + public bool GUIRefreshPossible + { + get { return RefreshButtonVisible(); } + } + public int Position + { + get { return appPosition; } + set { appPosition = value; } + } + + public FileItemList Files + { + // load on demand.... + get + { + if (!filesAreLoaded) + { + LoadFiles(); + } + return fileList; + } + } + public FilelinkItemList Filelinks + { + // load on demand.... + get + { + if (!linksAreLoaded) + { + LoadFileLinks(); + } + return fileLinks; + } + } + public bool ImportMamePlaychoice10 { get { return importMamePlaychoice10; } set { importMamePlaychoice10 = value; } } - bool importMameMahjong = false; - public bool ImportMameMahjong { get { return importMameMahjong; } @@ -96,35 +227,102 @@ } - string launchErrorMsg; + // more Properties, maybe need some renaming or anything else + public string FileDirectory + { + get { return fileDirectory; } + set { fileDirectory = value; } + } + public string ImageDirectory + { + get { return imageDirectories; } + set { SetImageDirectory(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 Imagefile + { + get { return imageFile; } + set { imageFile = value; } + } + public string Source + { + get { return sourceFile; } + set { sourceFile = value; } + } + public ApplicationType SourceType + { + get { return sourceType; } + set { sourceType = value; } + } + public string ValidExtensions + { + get { return validExtensions; } + set { validExtensions = value; } + } + public bool ImportValidImagesOnly + { + get { return importValidImagesOnly; } + set { importValidImagesOnly = value; } + } + public int ContentID + { + get { return contentID; } + set { contentID = value; } + } + public string SystemDefault + { + get { return systemDefault; } + set { systemDefault = value; } + } + public string LaunchErrorMsg + { + get { return launchErrorMsg; } + set { launchErrorMsg = value; } + } - // two magic image-slideshow counters - int thumbIndex = 0; - int thumbFolderIndex = -1; - string lastFilepath = ""; // cached path + public SQLiteClient db + { + get { return sqlDB; } + } + public int CurrentSortIndex + { + get { return GetCurrentSortIndex(); } + set { SetCurrentSortIndex(value); } + } + public bool CurrentSortIsAscending + { + get { return GetCurrentSortIsAscending(); } + set { SetCurrentSortIsAscending(value); } + } - public bool filesAreLoaded = false; // load on demand.... - protected FileItemList fileList = null; + #endregion - public bool linksAreLoaded = false; - protected FilelinkItemList fileLinks = null; + #region Events + public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + public event FilelinkLaunchEventHandler OnLaunchFilelink = null; + // event: read new file public delegate void RefreshInfoEventHandler(string informationMessage, int progressBarProgess); - public event RefreshInfoEventHandler OnRefreshInfo = null; - protected void SendRefreshInfo(string informationMessage, int progressBarCtr) - { - if (OnRefreshInfo != null) - { - OnRefreshInfo(informationMessage, progressBarCtr); - } - } + #endregion - protected int GetID = ProgramUtils.GetID; + #region Constructor public ApplicationItem(SQLiteClient initSqlDB) { @@ -162,24 +360,22 @@ } - public SQLiteClient db - { - get { return sqlDB; } - } + #endregion - public int CurrentSortIndex - { - get { return GetCurrentSortIndex(); } - set { SetCurrentSortIndex(value); } - } - public bool CurrentSortIsAscending + + + protected void SendRefreshInfo(string informationMessage, int progressBarCtr) { - get { return GetCurrentSortIsAscending(); } - set { SetCurrentSortIsAscending(value); } + if (OnRefreshInfo != null) + { + OnRefreshInfo(informationMessage, progressBarCtr); + } } + protected int GetID = ProgramUtils.GetID; + public FileItem PrevFile(FileItem curFile) { if (Files == null) @@ -214,7 +410,23 @@ return (FileItem)Files[index]; } + 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; + if (curFile == null) + { + return; + } + this.LaunchFile(curFile, true); + } + public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) { string curFilename = curFile.Filename; @@ -345,6 +557,16 @@ } } + protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) + { + this.OnLaunchFilelink(curLink, MPGUIMode); + } + + + + + + void proc_Exited(object sender, EventArgs e) { @@ -419,28 +641,6 @@ } } - 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; - - if (curFile == null) - { - return; - } - this.LaunchFile(curFile, true); - } - - protected virtual void LaunchFilelink(FilelinkItem curLink, bool MPGUIMode) - { - this.OnLaunchFilelink(curLink, MPGUIMode); - } - public virtual string DefaultFilepath() { return ""; // override this if the appitem can have subfolders @@ -496,7 +696,6 @@ return totalItems; } - void OnRetrieveCoverArt(GUIListItem gli) { if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) @@ -544,6 +743,31 @@ } } + 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; + } + } + + + + #region old sorting stuff, some(all) might be obsolete, but maybe usefull for improving new sorting method + public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) { /* @@ -591,6 +815,10 @@ dbPc.sortAscending = newValue; } + #endregion + + + public virtual bool RefreshButtonVisible() { return false; // otherwise, override this in child class @@ -634,232 +862,8 @@ } - 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; - } - } + #region DB stuff - public int AppID - { - get { return appID; } - set { appID = value; } - } - - public int FatherID - { - get { return fatherID; } - set { fatherID = value; } - } - - public string Title - { - get { return title; } - set { title = value; } - } - - public string ShortTitle - { - get { return shortTitle; } - set { shortTitle = value; } - } - - public string Filename - { - get { return filename; } - set { filename = value; } - } - - public string Arguments - { - get { return arguments; } - set { arguments = value; } - } - - public bool UseQuotes - { - get { return useQuotes; } - set { useQuotes = value; } - } - - public bool UseShellExecute - { - get { return useShellExecute; } - set { useShellExecute = value; } - } - - public bool Enabled - { - get { return enabled; } - set { enabled = value; } - } - - public ProcessWindowStyle WindowStyle - { - get { return windowStyle; } - set { windowStyle = value; } - } - - public string Startupdir - { - get { return startupDir; } - set { startupDir = value; } - } - - public string FileDirectory - { - get { return fileDirectory; } - set { fileDirectory = value; } - } - - public string ImageDirectory - { - get { return imageDirectories; } - set { SetImageDirectory(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 Imagefile - { - get { return imageFile; } - set { imageFile = value; } - } - - public string Source - { - get { return sourceFile; } - set { sourceFile = value; } - } - - public ApplicationType SourceType - { - get { return sourceType; } - set { sourceType = value; } - } - - public string ValidExtensions - { - get { return validExtensions; } - set { validExtensions = value; } - } - - public bool ImportValidImagesOnly - { - get { return importValidImagesOnly; } - set { importValidImagesOnly = value; } - } - - public int Position - { - get { return appPosition; } - set { appPosition = value; } - } - - public int ContentID - { - get { return contentID; } - set { contentID = value; } - } - - public string SystemDefault - { - get { return systemDefault; } - set { systemDefault = value; } - } - - public bool WaitForExit - { - get { return waitForExit; } - set { waitForExit = value; } - } - - - public bool GUIRefreshPossible - { - get { return RefreshButtonVisible(); } - } - - public bool EnableGUIRefresh - { - get { return enableGUIRefresh; } - set { enableGUIRefresh = value; } - } - - public string LaunchErrorMsg - { - get { return launchErrorMsg; } - set { launchErrorMsg = value; } - } - - 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) - { - LoadFiles(); - } - return fileList; - } - } - - - public FilelinkItemList Filelinks - { - // load on demand.... - get - { - if (!linksAreLoaded) - { - LoadFileLinks(); - } - return fileLinks; - } - } - - private int GetNewAppID() { // get an unused SQL application KEY-number @@ -961,8 +965,6 @@ } - - protected void DeleteFiles() { if ((AppID >= 0) && (sqlDB != null)) @@ -993,7 +995,6 @@ } } - public virtual void LoadFiles() { if (sqlDB != null) @@ -1031,6 +1032,20 @@ } } + public void InsertOrUpdateSettings() + { + if (appID == -1) + { + Insert(); + } + else + { + Update(); + } + } + + #endregion + protected virtual void FixFileLinks() { // after a import the appitem has completely new @@ -1074,25 +1089,11 @@ } - - public void InsertOrUpdateSettings() - { - if (appID == -1) - { - Insert(); - } - else - { - Update(); - } - } - public virtual string CurrentFilePath() { return this.FileDirectory; } - public void Assign(ApplicationItem sourceApp) { this.Enabled = sourceApp.Enabled; @@ -1122,9 +1123,8 @@ this.ContentID = sourceApp.ContentID; } + #region imagedirectory stuff - - // imagedirectory stuff // get next imagedirectory that holds at least one image for a fileitem // * m_pFile: the file we're looking images for private void GetNextThumbFolderIndex(FileItem fileItem) @@ -1178,7 +1178,6 @@ } } - public string GetCurThumb(FileItem fileItem) { string curThumb = ""; @@ -1226,6 +1225,7 @@ thumbIndex++; } + #endregion public void LoadFromXmlProfile(XmlNode node) { @@ -1278,6 +1278,5 @@ this.ValidExtensions = fileExtensioneNode.InnerText; } } - } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-17 10:43:30
|
Revision: 562 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=562&view=rev Author: chef_koch Date: 2007-06-17 03:43:10 -0700 (Sun, 17 Jun 2007) Log Message: ----------- renamed some objects Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-17 10:32:26 UTC (rev 561) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-17 10:43:10 UTC (rev 562) @@ -103,6 +103,11 @@ #region Properties // Helper Routines + public SQLiteClient db + { + get { return sqlDB; } + } + public int AppID { get { return appID; } @@ -294,10 +299,6 @@ } - public SQLiteClient db - { - get { return sqlDB; } - } public int CurrentSortIndex { get { return GetCurrentSortIndex(); } @@ -410,26 +411,20 @@ return (FileItem)Files[index]; } - public virtual void LaunchFile(GUIListItem item) + public virtual void LaunchFile(GUIListItem guiListItem) { // Launch File by GUILISTITEM // => look for FileItem and launch it using the found object - if (item.MusicTag == null) - { - return; - } - FileItem curFile = (FileItem)item.MusicTag; + if (guiListItem.MusicTag == null) return; + FileItem curFileItem = (FileItem)guiListItem.MusicTag; + if (curFileItem == null) return; - if (curFile == null) - { - return; - } - this.LaunchFile(curFile, true); + this.LaunchFile(curFileItem, true); } - public virtual void LaunchFile(FileItem curFile, bool mpGuiMode) + public virtual void LaunchFile(FileItem curFileItem, bool mpGuiMode) { - string curFilename = curFile.Filename; + string curFilename = curFileItem.Filename; if (curFilename == "") { return; @@ -438,7 +433,7 @@ // Launch File by item if (mpGuiMode) { - curFile.UpdateLaunchInfo(); + curFileItem.UpdateLaunchInfo(); } ProcessStartInfo procStart = new ProcessStartInfo(); @@ -451,7 +446,7 @@ if (UseQuotes) { // avoid double quotes around the filename-argument..... - curFilename = "\"" + (curFile.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; + curFilename = "\"" + (curFileItem.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; } if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) @@ -459,7 +454,7 @@ // ex. kawaks: // winkawaks.exe alpham2 // => filename without path and extension is necessary! - string filenameNoPathNoExt = curFile.ExtractFileName(); + string filenameNoPathNoExt = curFileItem.ExtractFileName(); filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); @@ -481,7 +476,7 @@ procStart.WorkingDirectory = StartupDir; if (procStart.WorkingDirectory.IndexOf("%FILEDIR%") != -1) { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); } procStart.UseShellExecute = UseShellExecute; } @@ -489,15 +484,15 @@ { // 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); + procStart.FileName = curFileItem.Filename; + procStart.WorkingDirectory = Path.GetFullPath(curFileItem.Filename); if (StartupDir != "") { if (StartupDir.Contains("%FILEDIR%")) { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFile.Filename)); + procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); } else { @@ -542,12 +537,12 @@ 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); + procStart.FileName, + procStart.Arguments, + procStart.WorkingDirectory, + ex.Message, + ex.Source, + ex.StackTrace); Log.Info(ErrorString); this.LaunchErrorMsg = ErrorString; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-17 11:03:10
|
Revision: 564 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=564&view=rev Author: chef_koch Date: 2007-06-17 04:03:06 -0700 (Sun, 17 Jun 2007) Log Message: ----------- code cleanup of LaunchFile() Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-17 10:51:25 UTC (rev 563) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-17 11:03:06 UTC (rev 564) @@ -425,83 +425,61 @@ public virtual void LaunchFile(FileItem curFileItem, bool mpGuiMode) { string curFilename = curFileItem.Filename; - if (curFilename == "") - { - return; - } + if (curFilename == "") return; // Launch File by item if (mpGuiMode) - { curFileItem.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 (this.Filename != "") + { // use the APPLICATION launcher and add current file information + + // filename of the application + procStart.FileName = this.Filename; + + // avoid double quotes around the filename-argument..... if (UseQuotes) - { - // avoid double quotes around the filename-argument..... curFilename = "\"" + (curFileItem.Filename.TrimStart('\"')).TrimEnd('\"') + "\""; - } - if (procStart.Arguments.IndexOf("%FILEnoPATHnoEXT%") >= 0) - { + // set the arguments: one of the arguments is the fileitem-filename + if (this.Arguments.Contains("%FILEnoPATHnoEXT%")) // ex. kawaks: // winkawaks.exe alpham2 // => filename without path and extension is necessary! - string filenameNoPathNoExt = curFileItem.ExtractFileName(); - filenameNoPathNoExt = (filenameNoPathNoExt.TrimStart('\"')).TrimEnd('\"'); - filenameNoPathNoExt = Path.GetFileNameWithoutExtension(filenameNoPathNoExt); - procStart.Arguments = procStart.Arguments.Replace("%FILEnoPATHnoEXT%", filenameNoPathNoExt); - } + procStart.Arguments = " " + this.Arguments.Replace("%FILEnoPATHnoEXT%", Path.GetFileNameWithoutExtension(curFileItem.Filename)); + else if (this.Arguments.Contains("%FILE%")) + // placeholder found => replace the placeholder by the correct filename + procStart.Arguments = " " + this.Arguments.Replace("%FILE%", curFilename); 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(curFileItem.Filename)); - } - procStart.UseShellExecute = UseShellExecute; + // no placeholder found => default handling: add the fileitem as the last argument + procStart.Arguments = " " + this.Arguments + " " + curFilename; + + // set WorkingDirectory + if (this.StartupDir.Contains("%FILEDIR%")) + procStart.WorkingDirectory = this.StartupDir.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); + else + procStart.WorkingDirectory = this.StartupDir; } else { // application has no launch-file // => try to make a correct launch using the current FILE object procStart.FileName = curFileItem.Filename; - procStart.WorkingDirectory = Path.GetFullPath(curFileItem.Filename); - - if (StartupDir != "") - { - if (StartupDir.Contains("%FILEDIR%")) - { - procStart.WorkingDirectory = procStart.WorkingDirectory.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); - } - else - { - procStart.WorkingDirectory = StartupDir; - } - } - - procStart.UseShellExecute = UseShellExecute; + // set WorkingDirectory + if (this.StartupDir == "") + procStart.WorkingDirectory = Path.GetDirectoryName(curFileItem.Filename); + else if (this.StartupDir.Contains("%FILEDIR%")) + procStart.WorkingDirectory = this.StartupDir.Replace("%FILEDIR%", Path.GetDirectoryName(curFileItem.Filename)); + else + procStart.WorkingDirectory = this.StartupDir; } + + // set UseShellExecute + procStart.UseShellExecute = this.UseShellExecute; + // set WindowStyle procStart.WindowStyle = this.WindowStyle; this.LaunchErrorMsg = ""; @@ -509,14 +487,11 @@ { DoPreLaunch(); - if (mpGuiMode) { AutoPlay.StopListening(); if (g_Player.Playing) - { g_Player.Stop(); - } } proc = new Process(); @@ -524,15 +499,13 @@ proc.Exited += new EventHandler(proc_Exited); proc.StartInfo = procStart; - ProgramUtils.StartProcess(proc, WaitForExit); + ProgramUtils.StartProcess(proc, this.WaitForExit); - if (mpGuiMode) { //GUIGraphicsContext.DX9Device.Reset(GUIGraphicsContext.DX9Device.PresentationParameters); AutoPlay.StartListening(); } - } catch (Exception ex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-19 19:42:23
|
Revision: 568 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=568&view=rev Author: chef_koch Date: 2007-06-19 12:42:19 -0700 (Tue, 19 Jun 2007) Log Message: ----------- commented out some lines to avoid a problem with direct input a few plugins add some methods to the OnStart / OnStopExternal event of Utils Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-17 19:17:57 UTC (rev 567) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-19 19:42:19 UTC (rev 568) @@ -494,12 +494,13 @@ g_Player.Stop(); } - proc = new Process(); - proc.EnableRaisingEvents = true; - proc.Exited += new EventHandler(proc_Exited); + //proc = new Process(); + //proc.EnableRaisingEvents = true; + //proc.Exited += new EventHandler(proc_Exited); - proc.StartInfo = procStart; - ProgramUtils.StartProcess(proc, this.WaitForExit); + //proc.StartInfo = procStart; + //ProgramUtils.StartProcess(proc, this.WaitForExit); + Utils.StartProcess(procStart, this.WaitForExit); if (mpGuiMode) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-20 18:43:34
|
Revision: 578 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=578&view=rev Author: chef_koch Date: 2007-06-20 11:43:30 -0700 (Wed, 20 Jun 2007) Log Message: ----------- just a visual change how the sql in Update() is build if there are any negative consequences with this change or you don't like it, i would revert it. ;) just drop me a note Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-20 18:27:55 UTC (rev 577) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-20 18:43:30 UTC (rev 578) @@ -905,14 +905,35 @@ } try { - sql = String.Format("update tblApplicationItem 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); + sql = String.Format( + "update tblApplicationItem set" + + "title = '" + ProgramUtils.Encode(Title) + + "', shorttitle = '" + ProgramUtils.Encode(ShortTitle) + + "', filename = '" + ProgramUtils.Encode(Filename) + + "', arguments = '" + ProgramUtils.Encode(Arguments) + + "', windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + + "', startupdir = '" + ProgramUtils.Encode(StartupDir) + + "', useshellexecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + + "', usequotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + + "', source_type = '" + ProgramUtils.ApplicationTypeToString(SourceType) + + "', source = '" + ProgramUtils.Encode(Source) + + "', imagefile = '" + ProgramUtils.Encode(Imagefile) + + "', filedirectory = '" + ProgramUtils.Encode(FileDirectory) + + "', imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + + "', validextensions = '" + ProgramUtils.Encode(ValidExtensions) + + "', importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + + "', iposition = " + Position + + ", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + + "', fatherID = '" + FatherID + + "', enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + + "', GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) + + "', pincode = '" + Pincode + + "', contentID = '" + ContentID + + "', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + + "', WaitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + + "', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + + "', postLaunch = '" + ProgramUtils.Encode(PostLaunch) + + "' where appID = " + AppID); sqlDB.Execute(sql); } catch (SQLiteException ex) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-20 19:01:05
|
Revision: 579 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=579&view=rev Author: chef_koch Date: 2007-06-20 12:01:03 -0700 (Wed, 20 Jun 2007) Log Message: ----------- cleaned up some the db methods (no sql code changes, mostly move the pre conditions to the beginning of each method) Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-20 18:43:30 UTC (rev 578) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-20 19:01:03 UTC (rev 579) @@ -540,9 +540,6 @@ - - - void proc_Exited(object sender, EventArgs e) { @@ -741,7 +738,6 @@ } - #region old sorting stuff, some(all) might be obsolete, but maybe usefull for improving new sorting method public virtual void OnSort(GUIFacadeControl view, bool doSwitchState) @@ -794,7 +790,6 @@ #endregion - public virtual bool RefreshButtonVisible() { return false; // otherwise, override this in child class @@ -837,208 +832,191 @@ // descendant classes do that! } + #region Database stuff - #region DB stuff - + /// <summary> + /// get an unused SQL application KEY-number + /// </summary> private int GetNewAppID() { - // get an unused SQL application KEY-number - if (sqlDB != null) + if (sqlDB == null) return -1; + + // won't work in multiuser environment :) + SQLiteResultSet results; + int res = 0; + results = sqlDB.Execute("SELECT MAX(APPID) FROM tblApplicationItem"); + SQLiteResultSet.Row arr = results.Rows[0]; + if (arr.fields[0] != null) { - // won't work in multiuser environment :) - SQLiteResultSet results; - int res = 0; - results = sqlDB.Execute("SELECT MAX(APPID) FROM tblApplicationItem"); - SQLiteResultSet.Row arr = results.Rows[0]; - if (arr.fields[0] != null) + if (arr.fields[0] != "") { - if (arr.fields[0] != "") - { - res = Int32.Parse(arr.fields[0]); - } + res = Int32.Parse(arr.fields[0]); } - return res + 1; } - else return -1; + return res + 1; } private void Insert() { - if (sqlDB != null) + if (sqlDB == null) return; + + string sql = ""; + string Pincode = ""; //to remove + + if (ContentID <= 0) + ContentID = 100; + try { - try - { - if (ContentID <= 0) - { - ContentID = 100; - } - //to remove - string Pincode = ""; - AppID = GetNewAppID(); // important to avoid subsequent inserts! - string sql = String.Format("insert into tblApplicationItem (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); - } + AppID = GetNewAppID(); // important to avoid subsequent inserts! + string sql = String.Format("insert into tblApplicationItem (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); + } } private void Update() { + if (sqlDB == null) return; + if (AppID == -1) return; + string sql = ""; - //to remove - string Pincode = ""; - if ((AppID >= 0) && (sqlDB != null)) + string Pincode = ""; //to remove + + if (ContentID <= 0) + ContentID = 100; + try { - if (ContentID <= 0) - { - ContentID = 100; - } - try - { - sql = String.Format( - "update tblApplicationItem set" + - "title = '" + ProgramUtils.Encode(Title) + - "', shorttitle = '" + ProgramUtils.Encode(ShortTitle) + - "', filename = '" + ProgramUtils.Encode(Filename) + - "', arguments = '" + ProgramUtils.Encode(Arguments) + - "', windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + - "', startupdir = '" + ProgramUtils.Encode(StartupDir) + - "', useshellexecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + - "', usequotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + - "', source_type = '" + ProgramUtils.ApplicationTypeToString(SourceType) + - "', source = '" + ProgramUtils.Encode(Source) + - "', imagefile = '" + ProgramUtils.Encode(Imagefile) + - "', filedirectory = '" + ProgramUtils.Encode(FileDirectory) + - "', imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + - "', validextensions = '" + ProgramUtils.Encode(ValidExtensions) + - "', importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + - "', iposition = " + Position + - ", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + - "', fatherID = '" + FatherID + - "', enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + - "', GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) + - "', pincode = '" + Pincode + - "', contentID = '" + ContentID + - "', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + - "', WaitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + - "', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + - "', postLaunch = '" + ProgramUtils.Encode(PostLaunch) + - "' where appID = " + AppID); - sqlDB.Execute(sql); - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - Log.Info("sql \n{0}", sql); - } + sql = String.Format( + "update tblApplicationItem set" + + "title = '" + ProgramUtils.Encode(Title) + + "', shorttitle = '" + ProgramUtils.Encode(ShortTitle) + + "', filename = '" + ProgramUtils.Encode(Filename) + + "', arguments = '" + ProgramUtils.Encode(Arguments) + + "', windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + + "', startupdir = '" + ProgramUtils.Encode(StartupDir) + + "', useshellexecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + + "', usequotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + + "', source_type = '" + ProgramUtils.ApplicationTypeToString(SourceType) + + "', source = '" + ProgramUtils.Encode(Source) + + "', imagefile = '" + ProgramUtils.Encode(Imagefile) + + "', filedirectory = '" + ProgramUtils.Encode(FileDirectory) + + "', imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + + "', validextensions = '" + ProgramUtils.Encode(ValidExtensions) + + "', importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + + "', iposition = " + Position + + ", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + + "', fatherID = '" + FatherID + + "', enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + + "', GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) + + "', pincode = '" + Pincode + + "', contentID = '" + ContentID + + "', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + + "', WaitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + + "', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + + "', postLaunch = '" + ProgramUtils.Encode(PostLaunch) + + "' where appID = " + AppID); + sqlDB.Execute(sql); } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + Log.Info("sql \n{0}", sql); + } } public void Delete() { - if ((AppID >= 0) && (sqlDB != null)) + if (sqlDB == null) return; + if (AppID == -1) return; + + try { - try - { - DeleteFiles(); - DeleteFileLinks(); - sqlDB.Execute(String.Format("delete from tblApplicationItem where appid = {0}", AppID)); - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - } + DeleteFiles(); + DeleteFileLinks(); + sqlDB.Execute(String.Format("delete from tblApplicationItem where appid = {0}", AppID)); } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } } protected void DeleteFiles() { - if ((AppID >= 0) && (sqlDB != null)) + if (sqlDB == null) return; + if (AppID == -1) return; + + try { - try - { - sqlDB.Execute(String.Format("delete from tblFileItem where appid = {0}", AppID)); - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - } + sqlDB.Execute(String.Format("delete from tblFileItem where appid = {0}", AppID)); } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } } protected void DeleteFileLinks() { - if ((AppID >= 0) && (sqlDB != null)) + if (sqlDB == null) return; + if (AppID == -1) return; + + try { - try - { - sqlDB.Execute(String.Format("delete from tblFilterItem where appid = {0} or grouperappid = {0}", AppID)); - } - catch (SQLiteException ex) - { - Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); - } + sqlDB.Execute(String.Format("delete from tblFilterItem where appid = {0} or grouperappid = {0}", AppID)); } + catch (SQLiteException ex) + { + Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); + } } public virtual void LoadFiles() { - if (sqlDB != null) - { - // load Files and fill Files-List<string> here! - if (fileList == null) - { - fileList = new FileItemList(sqlDB); - } - else - { - fileList.Clear(); - } - lastFilepath = ""; - fileList.Load(AppID, ""); - filesAreLoaded = true; - } + if (sqlDB == null) return; + + // load Files and fill Files-List<string> here! + if (fileList == null) + fileList = new FileItemList(sqlDB); + else + fileList.Clear(); + + lastFilepath = ""; + fileList.Load(AppID, ""); + filesAreLoaded = true; } public virtual void LoadFileLinks() { - if (sqlDB != null) - { - if (fileLinks == null) - { - fileLinks = new FilelinkItemList(sqlDB); - } - else - { - fileLinks.Clear(); - } - lastFilepath = ""; - fileLinks.Load(AppID, ""); - linksAreLoaded = true; - } + if (sqlDB == null) return; + + if (fileLinks == null) + fileLinks = new FilelinkItemList(sqlDB); + else + fileLinks.Clear(); + + lastFilepath = ""; + fileLinks.Load(AppID, ""); + linksAreLoaded = true; } public void InsertOrUpdateSettings() { if (appID == -1) - { Insert(); - } else - { Update(); - } } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-20 19:13:10
|
Revision: 580 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=580&view=rev Author: chef_koch Date: 2007-06-20 12:13:06 -0700 (Wed, 20 Jun 2007) Log Message: ----------- fixed small compiling error Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-20 19:01:03 UTC (rev 579) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-20 19:13:06 UTC (rev 580) @@ -868,7 +868,7 @@ try { AppID = GetNewAppID(); // important to avoid subsequent inserts! - string sql = String.Format("insert into tblApplicationItem (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}')", + sql = String.Format("insert into tblApplicationItem (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), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-22 00:57:18
|
Revision: 592 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=592&view=rev Author: northern_sky Date: 2007-06-21 17:57:15 -0700 (Thu, 21 Jun 2007) Log Message: ----------- update of appitem didn't work after recent updates due to formatting issue,fixed Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-21 23:40:06 UTC (rev 591) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-22 00:57:15 UTC (rev 592) @@ -436,7 +436,7 @@ // Launch File by item if (mpGuiMode) - curFileItem.UpdateLaunchInfo(); + curFileItem.UpdateLaunchInfo(); ProcessStartInfo procStart = new ProcessStartInfo(); @@ -501,13 +501,13 @@ g_Player.Stop(); } - //proc = new Process(); - //proc.EnableRaisingEvents = true; - //proc.Exited += new EventHandler(proc_Exited); + proc = new Process(); + /*proc.EnableRaisingEvents = true; + proc.Exited += new EventHandler(proc_Exited); - //proc.StartInfo = procStart; - //ProgramUtils.StartProcess(proc, this.WaitForExit); - Utils.StartProcess(procStart, this.WaitForExit); + proc.StartInfo = procStart; + ProgramUtils.StartProcess(proc, this.WaitForExit); + */Utils.StartProcess(procStart, this.WaitForExit); if (mpGuiMode) { @@ -897,34 +897,37 @@ try { sql = String.Format( - "update tblApplicationItem set" + - "title = '" + ProgramUtils.Encode(Title) + - "', shorttitle = '" + ProgramUtils.Encode(ShortTitle) + - "', filename = '" + ProgramUtils.Encode(Filename) + - "', arguments = '" + ProgramUtils.Encode(Arguments) + - "', windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + - "', startupdir = '" + ProgramUtils.Encode(StartupDir) + - "', useshellexecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + - "', usequotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + - "', source_type = '" + ProgramUtils.ApplicationTypeToString(SourceType) + - "', source = '" + ProgramUtils.Encode(Source) + - "', imagefile = '" + ProgramUtils.Encode(Imagefile) + - "', filedirectory = '" + ProgramUtils.Encode(FileDirectory) + - "', imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + - "', validextensions = '" + ProgramUtils.Encode(ValidExtensions) + - "', importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + - "', iposition = " + Position + - ", enabled = '" + ProgramUtils.BooleanToStr(Enabled) + - "', fatherID = '" + FatherID + - "', enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + - "', GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) + - "', pincode = '" + Pincode + - "', contentID = '" + ContentID + - "', systemDefault = '" + ProgramUtils.Encode(SystemDefault) + - "', WaitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + - "', preLaunch = '" + ProgramUtils.Encode(PreLaunch) + - "', postLaunch = '" + ProgramUtils.Encode(PostLaunch) + - "' where appID = " + AppID); + @"UPDATE + tblApplicationItem SET + + title = '" + ProgramUtils.Encode(Title) + @"', + shorttitle = '" + ProgramUtils.Encode(ShortTitle) + @"', + filename = '" + ProgramUtils.Encode(Filename) + @"', + arguments = '" + ProgramUtils.Encode(Arguments) + @"', + windowstyle = '" + ProgramUtils.WindowStyleToStr(WindowStyle) + @"', + startupdir = '" + ProgramUtils.Encode(StartupDir) + @"', + useshellexecute = '" + ProgramUtils.BooleanToStr(UseShellExecute) + @"', + usequotes = '" + ProgramUtils.BooleanToStr(UseQuotes) + @"', + source_type = '" + ProgramUtils.ApplicationTypeToString(SourceType) + @"', + source = '" + ProgramUtils.Encode(Source) + @"', + imagefile = '" + ProgramUtils.Encode(Imagefile) + @"', + filedirectory = '" + ProgramUtils.Encode(FileDirectory) + @"', + imagedirectory = '" + ProgramUtils.Encode(ImageDirectory) + @"', + validextensions = '" + ProgramUtils.Encode(ValidExtensions) + @"', + importvalidimagesonly = '" + ProgramUtils.BooleanToStr(importValidImagesOnly) + @"', + iposition = " + Position + @", + enabled = '" + ProgramUtils.BooleanToStr(Enabled) + @"', + fatherID = '" + FatherID + @"', + enableGUIRefresh = '" + ProgramUtils.BooleanToStr(EnableGUIRefresh) + @"', + GUIRefreshPossible = '" + ProgramUtils.BooleanToStr(GUIRefreshPossible) +@"', + pincode = '" + Pincode + @"', + contentID = '" + ContentID + @"', + systemDefault = '" + ProgramUtils.Encode(SystemDefault) + @"', + WaitForExit = '" + ProgramUtils.BooleanToStr(WaitForExit) + @"', + preLaunch = '" + ProgramUtils.Encode(PreLaunch) + @"', + postLaunch = '" + ProgramUtils.Encode(PostLaunch) + @"' + + WHERE appID = " + AppID); sqlDB.Execute(sql); } catch (SQLiteException ex) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-06-22 01:16:14
|
Revision: 596 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=596&view=rev Author: northern_sky Date: 2007-06-21 18:16:13 -0700 (Thu, 21 Jun 2007) Log Message: ----------- tired..=) Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-22 01:15:19 UTC (rev 595) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-22 01:16:13 UTC (rev 596) @@ -501,7 +501,7 @@ g_Player.Stop(); } - proc = new Process(); + //proc = new Process(); /*proc.EnableRaisingEvents = true; proc.Exited += new EventHandler(proc_Exited); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-24 08:33:24
|
Revision: 614 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=614&view=rev Author: chef_koch Date: 2007-06-24 01:33:23 -0700 (Sun, 24 Jun 2007) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-24 08:03:48 UTC (rev 613) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-24 08:33:23 UTC (rev 614) @@ -386,14 +386,9 @@ public FileItem PrevFile(FileItem curFile) { - if (Files == null) - { - return null; - } - if (Files.Count == 0) - { - return null; - } + if (Files == null) return null; + if (Files.Count == 0) return null; + int index = this.Files.IndexOf(curFile); index = index - 1; if (index < 0) @@ -403,14 +398,9 @@ public FileItem NextFile(FileItem curFile) { - if (Files == null) - { - return null; - } - if (Files.Count == 0) - { - return null; - } + 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) @@ -418,10 +408,12 @@ return (FileItem)Files[index]; } + /// <summary> + /// look for FileItem and launch it using the found object + /// </summary> + /// <param name="guiListItem"></param> public virtual void LaunchFile(GUIListItem guiListItem) { - // Launch File by GUILISTITEM - // => look for FileItem and launch it using the found object if (guiListItem.MusicTag == null) return; FileItem curFileItem = (FileItem)guiListItem.MusicTag; if (curFileItem == null) return; @@ -538,8 +530,6 @@ this.OnLaunchFilelink(curLink, MPGUIMode); } - - void proc_Exited(object sender, EventArgs e) { @@ -669,24 +659,24 @@ return totalItems; } - void OnRetrieveCoverArt(GUIListItem gli) + void OnRetrieveCoverArt(GUIListItem guiListItem) { - if ((gli.MusicTag != null) && (gli.MusicTag is FileItem)) + if (guiListItem.MusicTag == null) return; + FileItem curFileItem = (FileItem)guiListItem.MusicTag; + if (curFileItem == null) return; + + if (curFileItem.Imagefile != "") { - 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"; - } + guiListItem.ThumbnailImage = curFileItem.Imagefile; + guiListItem.IconImageBig = curFileItem.Imagefile; + guiListItem.IconImage = curFileItem.Imagefile; } + else + { + guiListItem.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + guiListItem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + guiListItem.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; + } } /* private void OnItemSelected(GUIListItem item, GUIControl parent) @@ -719,22 +709,19 @@ 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; - } + if (fileInfoDialog == null) return; + if (item.MusicTag == null) return; + FileItem curFile = (FileItem)item.MusicTag; + if (curFile == null) return; + + fileInfoDialog.App = this; + fileInfoDialog.File = curFile; + fileInfoDialog.IsOverviewVisible = isOverviewVisible; + fileInfoDialog.DoModal(GetID); + isOverviewVisible = fileInfoDialog.IsOverviewVisible; + modalResult = fileInfoDialog.ModalResult; + selectedFileID = fileInfoDialog.SelectedFileID; + return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2007-06-27 15:10:35
|
Revision: 644 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=644&view=rev Author: chef_koch Date: 2007-06-27 08:10:29 -0700 (Wed, 27 Jun 2007) Log Message: ----------- first try to using MP's thumb dir, no change in config, so it is still possible to change that by user Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-26 20:47:39 UTC (rev 643) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-06-27 15:10:29 UTC (rev 644) @@ -24,14 +24,16 @@ #endregion using System; -using System.IO; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Xml; using SQLite.NET; + +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; +using MediaPortal.Player; using MediaPortal.Ripper; -using MediaPortal.Player; -using MediaPortal.GUI.Library; using MediaPortal.Util; using GUIPrograms; @@ -128,6 +130,20 @@ get { return filename; } set { filename = value; } } + public string Imagefile + { + get + { + if (File.Exists(imageFile)) + return imageFile; + else + return MediaPortal.Util.Utils.GetCoverArtName( + Config.GetSubFolder(Config.Dir.Thumbs, @"MyProgramsAlt"), + this.Title + ); + } + set { imageFile = value; } + } public string Arguments { @@ -257,11 +273,6 @@ imageDirs[i] = imageDirs[i].TrimEnd('\\'); } } - public string Imagefile - { - get { return imageFile; } - set { imageFile = value; } - } public string Source { get { return sourceFile; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |