From: <Sil...@us...> - 2010-05-03 21:46:16
|
Revision: 3570 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3570&view=rev Author: SilentException Date: 2010-05-03 21:46:09 +0000 (Mon, 03 May 2010) Log Message: ----------- Updated version to 1.3 Calling dlg.Reset() on dialogs Added option to clear Recycle Bin Fixed selection operations Extra error checking on ReadDirectories2 ReadDirectories2 honors subdirectories boolean GetExtension returns empty string if no extension (not null) No more cutting of directory names (skinners should use fadelabels for current directories and dialogs already use fadelabels) - this cutting was until now relative to the number of characters, thus not ok for every skin..it should be done by checking textwidth if skin isn't using fadelabels (TODO) Improved action handling on facade controls (OnClicked is raised for some other events on facades) Added setting of #currentmodule property Modified "Attributes" localization string with no space FreeResource replaced by Dispose for RC2 compatibility Preparing for MpeRelease :) Skinning improvements (no skin changes needed on old skins, everything is optional): * controls 6,7,9,10 are no longer gui labels, they can be anything (fadelabel, textbox, textboxscrollup, ...) * Setting properties #FileExplorer.Left.CurrentDir and #FileExplorer.Right.CurrentDir for control id 9 and 10 for skinners (because SetControlLabel does not work so well when using with FadeLabel with <wrapString> :/) * Added label id 4 on TextPreview (for showing of current file name) - optional for skinners * Added properties #FileExplorer.Left.SelectionMode and #FileExplorer.Right.SelectionMode - for conditional visibility if selection mode is enabled or disabled (properties contain values True / False) Modified Paths: -------------- trunk/plugins/File Explorer/Constants.cs trunk/plugins/File Explorer/DrivesView.cs trunk/plugins/File Explorer/File Explorer.cs trunk/plugins/File Explorer/Language/strings_de.xml trunk/plugins/File Explorer/Language/strings_en.xml trunk/plugins/File Explorer/Language/strings_fr.xml trunk/plugins/File Explorer/Preview/TextPreview.cs trunk/plugins/File Explorer/Properties/AssemblyInfo.cs Modified: trunk/plugins/File Explorer/Constants.cs =================================================================== --- trunk/plugins/File Explorer/Constants.cs 2010-05-03 09:46:56 UTC (rev 3569) +++ trunk/plugins/File Explorer/Constants.cs 2010-05-03 21:46:09 UTC (rev 3570) @@ -171,8 +171,9 @@ SelectPlaylist = 127, DefaultFolderLeft = 128, DefaultFolderRight = 129, - Browse = 130 - + Browse = 130, + EmptyRecycleBin = 131, + Confirm = 132 } #endregion @@ -315,6 +316,8 @@ public static readonly string ADDAUDIO = LocalizeStrings.Get((int)LocalizedMessages.AddAudio); public static readonly string READFILE = LocalizeStrings.Get((int)LocalizedMessages.ReadFile); public static readonly string ADDVIDEO = LocalizeStrings.Get((int)LocalizedMessages.AddVideo); + public static readonly string EMPTYRECYCLEBIN = LocalizeStrings.Get((int)LocalizedMessages.EmptyRecycleBin); + public static readonly string CONFIRM = LocalizeStrings.Get((int)LocalizedMessages.Confirm); } #endregion Modified: trunk/plugins/File Explorer/DrivesView.cs =================================================================== --- trunk/plugins/File Explorer/DrivesView.cs 2010-05-03 09:46:56 UTC (rev 3569) +++ trunk/plugins/File Explorer/DrivesView.cs 2010-05-03 21:46:09 UTC (rev 3570) @@ -36,166 +36,178 @@ namespace FileExplorer { - #region Structs - public struct Drive - { - public string Path; - public string TypeDescription; - public int Type; - } + #region Structs + public struct Drive + { + public string Path; + public string TypeDescription; + public int Type; + } - public struct FileInfo - { - public string Path; - public string Name; - public float SizeInByte; - public float SizeInKB; - public float SizeInMB; - public float SizeInGB; - public string LastChanged; - public string CreatedOn; - public string LastRead; - public bool ReadOnly; - public bool Hidden; - public bool SystemFile; - public bool Encrypted; - public bool Compressed; - } + public struct FileInfo + { + public string Path; + public string Name; + public float SizeInByte; + public float SizeInKB; + public float SizeInMB; + public float SizeInGB; + public string LastChanged; + public string CreatedOn; + public string LastRead; + public bool ReadOnly; + public bool Hidden; + public bool SystemFile; + public bool Encrypted; + public bool Compressed; + } - public struct PathInfo - { - public string Name; - public string Path; - public string CreatedOn; - public string LastChanged; - public string LastRead; - public bool ReadOnly; - public bool Hidden; - public bool SystemFile; - public bool Encrypted; - public bool Compressed; - } - - public struct Info - { - public FileInfo File; - public PathInfo Path; - public bool IsPath; - - public bool IsFile + public struct PathInfo { - get { return !IsPath; } - set { IsPath = !value; } + public string Name; + public string Path; + public string CreatedOn; + public string LastChanged; + public string LastRead; + public bool ReadOnly; + public bool Hidden; + public bool SystemFile; + public bool Encrypted; + public bool Compressed; } - } - #endregion - /// <summary> - /// Description of DrivesView. - /// </summary> - public class DrivesView - { - #region static members - [DllImport(".\\Plugins\\Windows\\Compression.dll")] - private static extern bool CompressFile(string file); + public struct Info + { + public FileInfo File; + public PathInfo Path; + public bool IsPath; - [DllImport(".\\Plugins\\Windows\\Compression.dll")] - private static extern bool UncompressFile(string file); + public bool IsFile + { + get { return !IsPath; } + set { IsPath = !value; } + } + } + #endregion - [DllImport("kernel32.dll")] - private static extern int SetFileAttributes(string filename, System.UInt32 dwFileAttributes); - - private static readonly System.UInt32 FILE_ATTRIBUTE_NORMAL = 0x00000080; - private static readonly System.UInt32 FILE_ATTRIBUTE_HIDDEN = 0x00000002; - private static readonly System.UInt32 FILE_ATTRIBUTE_READONLY = 0x00000001; - private static readonly System.UInt32 FILE_ATTRIBUTE_SYSTEM = 0x00000004; + #region Enums + enum RecycleFlags : uint + { + SHERB_NOCONFIRMATION = 0x00000001, + SHERB_NOPROGRESSUI = 0x00000002, + SHERB_NOSOUND = 0x00000004 + } #endregion - #region vars - private int lstId; - private int winId; - private int lblId; - private int lblDirId; + /// <summary> + /// Description of DrivesView. + /// </summary> + public class DrivesView + { + [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] + static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags); - private string currentPath = null; - private string currentDrive = null; - private ArrayList drives = null; - private ArrayList currentPathList = null; + #region static members + [DllImport(".\\Plugins\\Windows\\Compression.dll")] + private static extern bool CompressFile(string file); - private ArrayList selectedList = null; + [DllImport(".\\Plugins\\Windows\\Compression.dll")] + private static extern bool UncompressFile(string file); - private bool showExtensions; - private bool trashcan; - private bool showAllFiles; - private bool showSystemFiles; - private bool showSystemDirs; - private bool selectionMode = false; + [DllImport("kernel32.dll")] + private static extern int SetFileAttributes(string filename, System.UInt32 dwFileAttributes); - private DrivesView secondView = null; + private static readonly System.UInt32 FILE_ATTRIBUTE_NORMAL = 0x00000080; + private static readonly System.UInt32 FILE_ATTRIBUTE_HIDDEN = 0x00000002; + private static readonly System.UInt32 FILE_ATTRIBUTE_READONLY = 0x00000001; + private static readonly System.UInt32 FILE_ATTRIBUTE_SYSTEM = 0x00000004; + #endregion - private ArrayList lstFiles = null; + #region vars + private int lstId; + private int winId; + private int lblId; + private int lblDirId; - private GUIDialogOperation dlgOp = null; + private string currentPath = null; + private string currentDrive = null; + private ArrayList drives = null; + private ArrayList currentPathList = null; - #endregion + private ArrayList selectedList = null; - #region ctor - public DrivesView(int windowID, int guiListViewControlID, int infoLabelID, int dirLabelID) - { - this.lstId = guiListViewControlID; - this.winId = windowID; - this.lblId = infoLabelID; - this.lblDirId = dirLabelID; + private bool showExtensions; + private bool trashcan; + private bool showAllFiles; + private bool showSystemFiles; + private bool showSystemDirs; + private bool selectionMode = false; - CreateDrivesList(); - // SetStandardValues(); - SetStandardValues(this.lstId); - LoadPath(); - FillListControl(); - } - #endregion + private DrivesView secondView = null; - #region private members - private void CreateDrivesList() - { - drives = new ArrayList(); + private ArrayList lstFiles = null; - foreach (string d in Environment.GetLogicalDrives()) - { - Drive drv = new Drive(); - drv.Path = d; - drv.Type = Utils.getDriveType(d); + private GUIDialogOperation dlgOp = null; - if (drv.Type == Constants.DriveTypes.CD_DVD) + #endregion + + #region ctor + public DrivesView(int windowID, int guiListViewControlID, int infoLabelID, int dirLabelID) { - // drv.TypeDescription = "CD/DVD Drive"; - drv.TypeDescription = Constants.View.CD; + this.lstId = guiListViewControlID; + this.winId = windowID; + this.lblId = infoLabelID; + this.lblDirId = dirLabelID; + + CreateDrivesList(); + // SetStandardValues(); + SetStandardValues(this.lstId); + LoadPath(); + FillListControl(); } - else if (drv.Type == Constants.DriveTypes.FIXED) + #endregion + + #region private members + private void CreateDrivesList() { - // drv.TypeDescription = "HDD"; - drv.TypeDescription = Constants.View.HDD; + drives = new ArrayList(); + + foreach (string d in Environment.GetLogicalDrives()) + { + Drive drv = new Drive(); + drv.Path = d; + drv.Type = Utils.getDriveType(d); + + if (drv.Type == Constants.DriveTypes.CD_DVD) + { + // drv.TypeDescription = "CD/DVD Drive"; + drv.TypeDescription = Constants.View.CD; + } + else if (drv.Type == Constants.DriveTypes.FIXED) + { + // drv.TypeDescription = "HDD"; + drv.TypeDescription = Constants.View.HDD; + } + else if (drv.Type == Constants.DriveTypes.RAMDISK) + { + // drv.TypeDescription = "RamDisk"; + drv.TypeDescription = Constants.View.RAMDISK; + } + else if (drv.Type == Constants.DriveTypes.REMOTEDISK) + { + // drv.TypeDescription = "Network Drive"; + drv.TypeDescription = Constants.View.NETWORK; + } + else if (drv.Type == Constants.DriveTypes.REMOVEABLE) + { + // drv.TypeDescription = "Removeable"; + drv.TypeDescription = Constants.View.REMOVEABLE; + } + + drives.Add(drv); + } } - else if (drv.Type == Constants.DriveTypes.RAMDISK) - { - // drv.TypeDescription = "RamDisk"; - drv.TypeDescription = Constants.View.RAMDISK; - } - else if (drv.Type == Constants.DriveTypes.REMOTEDISK) - { - // drv.TypeDescription = "Network Drive"; - drv.TypeDescription = Constants.View.NETWORK; - } - else if (drv.Type == Constants.DriveTypes.REMOVEABLE) - { - // drv.TypeDescription = "Removeable"; - drv.TypeDescription = Constants.View.REMOVEABLE; - } - drives.Add(drv); - } - } - private void SetStandardValues(int lstId) { SetStandardValues(); @@ -215,2864 +227,3028 @@ } } - private void SetStandardValues() - { - foreach (Drive d in drives) - { - if (d.Type == Constants.DriveTypes.FIXED) + private void SetStandardValues() { - currentDrive = d.Path; - currentPath = d.Path; + foreach (Drive d in drives) + { + if (d.Type == Constants.DriveTypes.FIXED) + { + currentDrive = d.Path; + currentPath = d.Path; - break; + break; + } + } + + showExtensions = Constants.SetupForm.valueStandards[0]; + trashcan = Constants.SetupForm.valueStandards[1]; + showAllFiles = Constants.SetupForm.valueStandards[2]; + showSystemFiles = Constants.SetupForm.valueStandards[3]; + showSystemDirs = Constants.SetupForm.valueStandards[4]; + SelectionMode = false; } - } - showExtensions = Constants.SetupForm.valueStandards[0]; - trashcan = Constants.SetupForm.valueStandards[1]; - showAllFiles = Constants.SetupForm.valueStandards[2]; - showSystemFiles = Constants.SetupForm.valueStandards[3]; - showSystemDirs = Constants.SetupForm.valueStandards[4]; - selectionMode = false; - } - - private bool LoadPath() - { - selectedList = null; - string[] files = null; - try - { - files = System.IO.Directory.GetFileSystemEntries(currentPath); - } - catch (Exception e) - { - ExceptionViewer.ShowException(e); - return false; - } - - currentPathList = new ArrayList(); - - foreach (string s in files) - { - Info info = new Info(); - - if (System.IO.File.Exists(s)) + private bool LoadPath() { - System.IO.FileInfo fi = new System.IO.FileInfo(s); + selectedList = null; + string[] files = null; + try + { + files = System.IO.Directory.GetFileSystemEntries(currentPath); + } + catch (Exception e) + { + ExceptionViewer.ShowException(e); + return false; + } - info.IsFile = true; - info.File.Name = GetFilename(s); - info.File.Path = GetPath(s); - info.File.CreatedOn = fi.CreationTime.ToString(); - info.File.LastChanged = fi.LastWriteTime.ToString(); - info.File.LastRead = fi.LastAccessTime.ToString(); - info.File.SizeInByte = (float)fi.Length; - info.File.SizeInKB = info.File.SizeInByte / 1024; - info.File.SizeInMB = info.File.SizeInKB / 1024; - info.File.SizeInGB = info.File.SizeInMB / 1024; + currentPathList = new ArrayList(); - info.File.Hidden = this.IsHiddenAttribute(fi.Attributes); - info.File.ReadOnly = this.IsReadOnlyAttribute(fi.Attributes); - info.File.SystemFile = this.IsSystemAttribute(fi.Attributes); - info.File.Compressed = this.IsCompressedAttribute(fi.Attributes); - info.File.Encrypted = this.IsEncryptedAttribute(fi.Attributes); - } - else - { - System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(s); + foreach (string s in files) + { + Info info = new Info(); - info.IsPath = true; - info.Path.Name = GetFilename(s); - info.Path.Path = s; - info.Path.CreatedOn = di.CreationTime.ToString(); - info.Path.LastChanged = di.LastWriteTime.ToString(); - info.Path.LastRead = di.LastAccessTime.ToString(); - info.Path.Hidden = this.IsHiddenAttribute(di.Attributes); - info.Path.ReadOnly = this.IsReadOnlyAttribute(di.Attributes); - info.Path.SystemFile = this.IsSystemAttribute(di.Attributes); - info.Path.Compressed = this.IsCompressedAttribute(di.Attributes); - info.Path.Encrypted = this.IsEncryptedAttribute(di.Attributes); - } + if (System.IO.File.Exists(s)) + { + System.IO.FileInfo fi = new System.IO.FileInfo(s); - currentPathList.Add(info); - } + info.IsFile = true; + info.File.Name = GetFilename(s); + info.File.Path = GetPath(s); + info.File.CreatedOn = fi.CreationTime.ToString(); + info.File.LastChanged = fi.LastWriteTime.ToString(); + info.File.LastRead = fi.LastAccessTime.ToString(); + info.File.SizeInByte = (float)fi.Length; + info.File.SizeInKB = info.File.SizeInByte / 1024; + info.File.SizeInMB = info.File.SizeInKB / 1024; + info.File.SizeInGB = info.File.SizeInMB / 1024; - return true; - } + info.File.Hidden = this.IsHiddenAttribute(fi.Attributes); + info.File.ReadOnly = this.IsReadOnlyAttribute(fi.Attributes); + info.File.SystemFile = this.IsSystemAttribute(fi.Attributes); + info.File.Compressed = this.IsCompressedAttribute(fi.Attributes); + info.File.Encrypted = this.IsEncryptedAttribute(fi.Attributes); + } + else + { + System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(s); - private void FillListControl() - { - GUIControl.ClearControl(winId, lstId); - string path = Utils.RemoveTrailingSlash(currentPath); + info.IsPath = true; + info.Path.Name = GetFilename(s); + info.Path.Path = s; + info.Path.CreatedOn = di.CreationTime.ToString(); + info.Path.LastChanged = di.LastWriteTime.ToString(); + info.Path.LastRead = di.LastAccessTime.ToString(); + info.Path.Hidden = this.IsHiddenAttribute(di.Attributes); + info.Path.ReadOnly = this.IsReadOnlyAttribute(di.Attributes); + info.Path.SystemFile = this.IsSystemAttribute(di.Attributes); + info.Path.Compressed = this.IsCompressedAttribute(di.Attributes); + info.Path.Encrypted = this.IsEncryptedAttribute(di.Attributes); + } - if (!currentPath.Equals(currentDrive)) - { - GUIListItem item = new GUIListItem(".."); - item.Path = GetPath(currentPath); + currentPathList.Add(info); + } - Utils.SetDefaultIcons(item); - GUIControl.AddListItemControl(winId, lstId, item); - } - - foreach (Info info in currentPathList) - { - if (info.IsPath) - { - bool b = true; - - if ((!this.showAllFiles) && (info.Path.Hidden)) - { - b = false; - } - - if ((!this.showSystemDirs) && (info.Path.SystemFile)) - { - b = false; - } - - if (b) - { - GUIListItem item = new GUIListItem(info.Path.Name); - item.IsFolder = true; - item.Path = info.Path.Path; - - Utils.SetDefaultIcons(item); - GUIControl.AddListItemControl(winId, lstId, item); - } + return true; } - } - foreach (Info info in currentPathList) - { - if (info.IsFile) + private void FillListControl() { - bool b = true; + GUIControl.ClearControl(winId, lstId); + string path = Utils.RemoveTrailingSlash(currentPath); - if ((!this.showAllFiles) && (info.File.Hidden)) - { - b = false; - } + if (!currentPath.Equals(currentDrive)) + { + GUIListItem item = new GUIListItem(".."); + item.Path = GetPath(currentPath); - if ((!this.showSystemFiles) && (info.File.SystemFile)) - { - b = false; - } + Utils.SetDefaultIcons(item); + GUIControl.AddListItemControl(winId, lstId, item); + } - if (b) - { - GUIListItem item = new GUIListItem(info.File.Name); - item.IsFolder = false; - item.Path = info.File.Path; - item.Label2 = Utils.GetSize((long)info.File.SizeInByte); + foreach (Info info in currentPathList) + { + if (info.IsPath) + { + bool b = true; - GUIControl.AddListItemControl(winId, lstId, item); - } - } - } + if ((!this.showAllFiles) && (info.Path.Hidden)) + { + b = false; + } - // string cf = "Folder: "; - string cf = Constants.View.FOLDER; - if (currentPath.Length > 50) - { - cf += currentDrive + "..\\" + GetFilename(currentPath); - } - else - { - cf += currentPath; - } - GUIControl.SetControlLabel(winId, lblDirId, cf); - } - #endregion + if ((!this.showSystemDirs) && (info.Path.SystemFile)) + { + b = false; + } - #region public members - public void Update() - { - LoadPath(); - FillListControl(); - } + if (b) + { + GUIListItem item = new GUIListItem(info.Path.Name); + item.IsFolder = true; + item.Path = info.Path.Path; + item.MusicTag = info; - #region menu id constants - private struct MenuIDs - { - public const int SelectDrive = 0; - public const int Copy = 1; - public const int Move = 2; - public const int Delete = 3; - public const int Rename = 4; - public const int CreateDirectory = 5; - public const int EncryptDecrypt = 6; - public const int CompressUncomopress = 7; - public const int HideUnhide = 8; - public const int ReadOnlyFlag = 9; - public const int AudioPlaylist = 10; - public const int VideoPlayList = 11; - public const int AddToAudioPlaylist = 12; - public const int AddToVideoPlaylist = 13; - public const int SelectAll = 14; - public const int DisableSelections = 15; - public const int SelectionMode = 16; - } - #endregion + Utils.SetDefaultIcons(item); + GUIControl.AddListItemControl(winId, lstId, item); + } + } + } - public void ShowMenu() - { - GUIDialogMenu mnu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - mnu.Reset(); - /* mnu.SetHeading("Menu"); - mnu.Add("Select Drive"); - mnu.Add("Copy"); - mnu.Add("Move"); - mnu.Add("Delete"); - mnu.Add("Rename"); - mnu.Add("Create directory"); - mnu.Add("Encrypt/Decrypt (NTFS only)"); - mnu.Add("Compress/Uncompress (NTFS only)"); - mnu.Add("Hide/Unhide"); - mnu.Add("Add/Remove readonly flag"); */ - mnu.SetHeading(Constants.View.MENU); - mnu.Add(Constants.View.SELECTDRIVE); - mnu.Add(Constants.Dialog.COPY); // was already defined in Dialog - mnu.Add(Constants.Dialog.MOVE); // was already defined in Dialog - mnu.Add(Constants.Dialog.DELETE); // was already defined in Dialog - mnu.Add(Constants.View.RENAME); - mnu.Add(Constants.View.CREATEDIR); - mnu.Add(Constants.View.ENCRYPT2); - mnu.Add(Constants.View.COMPRESS3); - mnu.Add(Constants.View.HIDEUNHIDE); - mnu.Add(Constants.View.ADDREADONLY); + foreach (Info info in currentPathList) + { + if (info.IsFile) + { + bool b = true; - if (selectedList == null) - { - /* mnu.Add("Create Audioplaylist from Directory"); - mnu.Add("Create Videoplaylist from Directory"); - mnu.Add("Add to Audioplaylist"); - mnu.Add("Add to Videoplaylist"); */ - mnu.Add(Constants.View.CREATEAUDIODIR); - mnu.Add(Constants.View.CREATEVIDEODIR); - mnu.Add(Constants.Dialog.ADDAUDIO); // was already defined in Dialog - mnu.Add(Constants.Dialog.ADDVIDEO); // was already defined in Dialog - } - else - { - /* mnu.Add("Create Audioplaylist from selected files/directories"); - mnu.Add("Create Videoplaylist from selected files/directories"); - mnu.Add("Add selected files/directories to Audioplaylist"); - mnu.Add("Add selected files/directories to Videoplaylist"); */ - mnu.Add(Constants.View.CREATEAUDIOSEL); - mnu.Add(Constants.View.CREATEVIDEOSEL); - mnu.Add(Constants.View.ADDAUDIOSEL); - mnu.Add(Constants.View.ADDVIDEOSEL); - } + if ((!this.showAllFiles) && (info.File.Hidden)) + { + b = false; + } - // mnu.Add("Select All"); - // mnu.Add("Disable selections"); - mnu.Add(Constants.View.SELECTALL); - mnu.Add(Constants.View.DISABLESEL); + if ((!this.showSystemFiles) && (info.File.SystemFile)) + { + b = false; + } - if (selectionMode) - { - // mnu.Add("Disable selection mode"); - mnu.Add(Constants.View.DISABLESELMODE); - } - else - { - // mnu.Add("Enable selection mode"); - mnu.Add(Constants.View.ENABLESELMODE); - } + if (b) + { + GUIListItem item = new GUIListItem(info.File.Name); + item.IsFolder = false; + item.Path = info.File.Path; + item.Label2 = Utils.GetSize((long)info.File.SizeInByte); + item.MusicTag = info; - mnu.DoModal(GUIWindowManager.ActiveWindow); + GUIControl.AddListItemControl(winId, lstId, item); + } + } + } - switch (mnu.SelectedLabel) - { - case MenuIDs.SelectDrive: - { - SelectDrive(); - break; - } - case MenuIDs.Copy: - { - Copy(); - break; - } - case MenuIDs.Move: - { - Move(); - break; - } - case MenuIDs.Delete: - { - Delete(); - break; - } - case MenuIDs.Rename: - { - Rename(); - break; - } - case MenuIDs.CreateDirectory: - { - CreateDirectory(); - break; - } - case MenuIDs.EncryptDecrypt: - { - EncryptDecrypt(); - break; - } - case MenuIDs.CompressUncomopress: - { - CompressUncompress(); - break; - } - case MenuIDs.HideUnhide: - { - HideUnhide(); - break; - } - case MenuIDs.ReadOnlyFlag: - { - SetRemoveReadOnlyFlag(); - break; - } - case MenuIDs.AudioPlaylist: - { - if (selectedList == null) + // string cf = "Folder: "; + //string cf = Constants.View.FOLDER; + string cf = String.Empty; + /* + if (currentPath.Length > 50) { - CreateAudioPlaylist(); + cf += currentDrive + "..\\" + GetFilename(currentPath); } else { - CreateAudioPlaylistFromSelectedFiles(); + cf += currentPath; } - break; - } - case MenuIDs.VideoPlayList: - { - if (selectedList == null) - { - CreateVideoPlaylist(); - } + */ + cf += currentPath; + + // Setting property for skinners.. SetControlLabel does not work so well when using with FadeLabel with <wrapString> :/ + if (lstId == 3) + GUIPropertyManager.SetProperty("#FileExplorer.Left.CurrentDir", cf); + else if (lstId == 4) + GUIPropertyManager.SetProperty("#FileExplorer.Right.CurrentDir", cf); else { - CreateVideoPlaylistFromSelectedFiles(); + GUIPropertyManager.SetProperty("#FileExplorer.Left.CurrentDir", " "); + GUIPropertyManager.SetProperty("#FileExplorer.Right.CurrentDir", " "); } - break; - } - case MenuIDs.AddToAudioPlaylist: - { + GUIControl.SetControlLabel(winId, lblDirId, cf); + } + #endregion + + #region public members + public void Update() + { + LoadPath(); + FillListControl(); + } + + #region menu id constants + private struct MenuIDs + { + public const int SelectDrive = 0; + public const int Copy = 1; + public const int Move = 2; + public const int Delete = 3; + public const int Rename = 4; + public const int CreateDirectory = 5; + public const int EncryptDecrypt = 6; + public const int CompressUncomopress = 7; + public const int HideUnhide = 8; + public const int ReadOnlyFlag = 9; + public const int AudioPlaylist = 10; + public const int VideoPlayList = 11; + public const int AddToAudioPlaylist = 12; + public const int AddToVideoPlaylist = 13; + public const int SelectAll = 14; + public const int DisableSelections = 15; + public const int SelectionMode = 16; + public const int EmptyRecycleBin = 17; + } + #endregion + + public void ShowMenu() + { + GUIDialogMenu mnu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + mnu.Reset(); + /* mnu.SetHeading("Menu"); + mnu.Add("Select Drive"); + mnu.Add("Copy"); + mnu.Add("Move"); + mnu.Add("Delete"); + mnu.Add("Rename"); + mnu.Add("Create directory"); + mnu.Add("Encrypt/Decrypt (NTFS only)"); + mnu.Add("Compress/Uncompress (NTFS only)"); + mnu.Add("Hide/Unhide"); + mnu.Add("Add/Remove readonly flag"); */ + mnu.SetHeading(Constants.View.MENU); + mnu.Add(Constants.View.SELECTDRIVE); + mnu.Add(Constants.Dialog.COPY); // was already defined in Dialog + mnu.Add(Constants.Dialog.MOVE); // was already defined in Dialog + mnu.Add(Constants.Dialog.DELETE); // was already defined in Dialog + mnu.Add(Constants.View.RENAME); + mnu.Add(Constants.View.CREATEDIR); + mnu.Add(Constants.View.ENCRYPT2); + mnu.Add(Constants.View.COMPRESS3); + mnu.Add(Constants.View.HIDEUNHIDE); + mnu.Add(Constants.View.ADDREADONLY); + if (selectedList == null) { - AddToAudioPlaylist(); + /* mnu.Add("Create Audioplaylist from Directory"); + mnu.Add("Create Videoplaylist from Directory"); + mnu.Add("Add to Audioplaylist"); + mnu.Add("Add to Videoplaylist"); */ + mnu.Add(Constants.View.CREATEAUDIODIR); + mnu.Add(Constants.View.CREATEVIDEODIR); + mnu.Add(Constants.Dialog.ADDAUDIO); // was already defined in Dialog + mnu.Add(Constants.Dialog.ADDVIDEO); // was already defined in Dialog } else { - AddSelectedFilesToAudioPlaylist(); + /* mnu.Add("Create Audioplaylist from selected files/directories"); + mnu.Add("Create Videoplaylist from selected files/directories"); + mnu.Add("Add selected files/directories to Audioplaylist"); + mnu.Add("Add selected files/directories to Videoplaylist"); */ + mnu.Add(Constants.View.CREATEAUDIOSEL); + mnu.Add(Constants.View.CREATEVIDEOSEL); + mnu.Add(Constants.View.ADDAUDIOSEL); + mnu.Add(Constants.View.ADDVIDEOSEL); } - break; - } - case MenuIDs.AddToVideoPlaylist: - { - if (selectedList == null) + + // mnu.Add("Select All"); + // mnu.Add("Disable selections"); + mnu.Add(Constants.View.SELECTALL); + mnu.Add(Constants.View.DISABLESEL); + + if (selectionMode) { - AddToVideoPlaylist(); + // mnu.Add("Disable selection mode"); + mnu.Add(Constants.View.DISABLESELMODE); } else { - AddSelectedFilesToVideoPlaylist(); + // mnu.Add("Enable selection mode"); + mnu.Add(Constants.View.ENABLESELMODE); } - break; - } - case MenuIDs.SelectAll: - { - SelectAll(); - break; - } - case MenuIDs.DisableSelections: - { - DeleteSelections(); - break; - } - case MenuIDs.SelectionMode: - { - selectionMode = !SelectionMode; - break; - } - } - } - #endregion - #region Operations - #region Select Drive routines - private void SelectDrive() - { - GUIDialogMenu mnu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - mnu.Reset(); - // mnu.SetHeading("Select drive"); - mnu.SetHeading(Constants.View.SELECTDRIVE); + mnu.Add(Constants.Dialog.EMPTYRECYCLEBIN); - foreach (Drive d in drives) - { - mnu.Add(d.Path + " " + d.TypeDescription); - } + mnu.DoModal(GUIWindowManager.ActiveWindow); - mnu.DoModal(GUIWindowManager.ActiveWindow); + switch (mnu.SelectedLabel) + { + case MenuIDs.SelectDrive: + { + SelectDrive(); + break; + } + case MenuIDs.Copy: + { + Copy(); + break; + } + case MenuIDs.Move: + { + Move(); + break; + } + case MenuIDs.Delete: + { + Delete(); + break; + } + case MenuIDs.Rename: + { + Rename(); + break; + } + case MenuIDs.CreateDirectory: + { + CreateDirectory(); + break; + } + case MenuIDs.EncryptDecrypt: + { + EncryptDecrypt(); + break; + } + case MenuIDs.CompressUncomopress: + { + CompressUncompress(); + break; + } + case MenuIDs.HideUnhide: + { + HideUnhide(); + break; + } + case MenuIDs.ReadOnlyFlag: + { + SetRemoveReadOnlyFlag(); + break; + } + case MenuIDs.AudioPlaylist: + { + if (selectedList == null) + { + CreateAudioPlaylist(); + } + else + { + CreateAudioPlaylistFromSelectedFiles(); + } + break; + } + case MenuIDs.VideoPlayList: + { + if (selectedList == null) + { + CreateVideoPlaylist(); + } + else + { + CreateVideoPlaylistFromSelectedFiles(); + } + break; + } + case MenuIDs.AddToAudioPlaylist: + { + if (selectedList == null) + { + AddToAudioPlaylist(); + } + else + { + AddSelectedFilesToAudioPlaylist(); + } + break; + } + case MenuIDs.AddToVideoPlaylist: + { + if (selectedList == null) + { + AddToVideoPlaylist(); + } + else + { + AddSelectedFilesToVideoPlaylist(); + } + break; + } + case MenuIDs.SelectAll: + { + SelectAll(); + break; + } + case MenuIDs.DisableSelections: + { + DeleteSelections(); + break; + } + case MenuIDs.SelectionMode: + { + SelectionMode = !SelectionMode; + break; + } + case MenuIDs.EmptyRecycleBin: + { + EmptyRecycleBin(); + break; + } + } + } + #endregion - int i = 0; - foreach (Drive d in drives) - { - if (i == mnu.SelectedLabel) + #region Operations + #region Select Drive routines + private void SelectDrive() { - currentDrive = d.Path; - currentPath = d.Path; + GUIDialogMenu mnu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + mnu.Reset(); + // mnu.SetHeading("Select drive"); + mnu.SetHeading(Constants.View.SELECTDRIVE); - LoadPath(); - FillListControl(); + foreach (Drive d in drives) + { + mnu.Add(d.Path + " " + d.TypeDescription); + } - return; - } + mnu.DoModal(GUIWindowManager.ActiveWindow); - i++; - } - } - #endregion + int i = 0; + foreach (Drive d in drives) + { + if (i == mnu.SelectedLabel) + { + currentDrive = d.Path; + currentPath = d.Path; - #region Copy routines - private void Copy() - { - if (selectedList == null) - { - GUIListItem item = GUIControl.GetSelectedListItem(winId, lstId); + LoadPath(); + FillListControl(); - GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + return; + } - if (!item.IsFolder) - { - // dlg.SetHeading("Copy File \"" + item.Label + "\""); - dlg.SetHeading(Constants.Operation.COPYFILE + "\"" + item.Label + "\""); - // dlg.SetLine(2, "From: " + item.Path); - dlg.SetLine(2, Constants.Operation.FROM + item.Path); - // dlg.SetLine(3, "To: " + secondView.Path); - dlg.SetLine(3, Constants.Dialog.TO + secondView.Path); // already defined in Dialog - dlg.DoModal(GUIWindowManager.ActiveWindow); - - if (dlg.IsConfirmed) - { - CopySingleFile(item.Path + "\\" + item.Label, secondView.Path + "\\" + item.Label); - secondView.Update(); - } + i++; + } } - else - { - // dlg.SetHeading("Copy Directory \"" + item.Label + "\""); - dlg.SetHeading(Constants.Operation.COPYDIR + "\"" + item.Label + "\""); - // dlg.SetLine(2, "To: " + secondView.Path); - dlg.SetLine(2, Constants.Dialog.TO + secondView.Path); // already defined in Dialog - dlg.DoModal(GUIWindowManager.ActiveWindow); + #endregion - if (dlg.IsConfirmed) - { - ShowDialogOperation(GUIDialogOperation.DialogType.COPY); - CopyDirectory(item.Path, secondView.Path + "\\" + GetFilename(item.Path)); - secondView.Update(); - dlgOp.Close(); - } - } - } - else - { - foreach (Info info in selectedList) + #region Copy routines + private void Copy() { - if (info.IsPath) - { - ShowDialogOperation(GUIDialogOperation.DialogType.COPY); - CopyDirectory(info.Path.Path, secondView.Path + "\\" + GetFilename(info.Path.Path)); - dlgOp.Close(); - } - else - { - CopySingleFile(info.File.Path + "\\" + info.File.Name, secondView.Path + "\\" + info.File.Name, true); - } - } + if (selectedList == null) + { + GUIListItem item = GUIControl.GetSelectedListItem(winId, lstId); - secondView.Update(); - } - } + GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + dlg.Reset(); - private void CopySingleFile(string scr, string dest) - { - CopySingleFile(scr, dest, false); - } + if (!item.IsFolder) + { + // dlg.SetHeading("Copy File \"" + item.Label + "\""); + dlg.SetHeading(Constants.Operation.COPYFILE + "\"" + item.Label + "\""); + // dlg.SetLine(2, "From: " + item.Path); + dlg.SetLine(2, Constants.Operation.FROM + item.Path); + // dlg.SetLine(3, "To: " + secondView.Path); + dlg.SetLine(3, Constants.Dialog.TO + secondView.Path); // already defined in Dialog + dlg.DoModal(GUIWindowManager.ActiveWindow); - private void CopySingleFile(string src, string dest, bool showDlg) - { - if (System.IO.File.Exists(dest)) - { - GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); - // dlg.SetHeading("Copying file"); - dlg.SetHeading(Constants.Operation.COPYINGFILE); - // dlg.SetLine(1, "The file \"" + GetFilename(src) + "\""); - dlg.SetLine(1, Constants.Operation.THEFILE + "\"" + GetFilename(src) + "\""); - // dlg.SetLine(2, "alread exists!"); - dlg.SetLine(2, Constants.Operation.ALREADYEXIST); - // dlg.SetLine(3, "Do you want to overwrite it?"); - dlg.SetLine(3, Constants.Operation.OVERWRITE); - dlg.DoModal(GUIWindowManager.ActiveWindow); + if (dlg.IsConfirmed) + { + CopySingleFile(item.Path + "\\" + item.Label, secondView.Path + "\\" + item.Label); + secondView.Update(); + } + } + else + { + // dlg.SetHeading("Copy Directory \"" + item.Label + "\""); + dlg.SetHeading(Constants.Operation.COPYDIR + "\"" + item.Label + "\""); + // dlg.SetLine(2, "To: " + secondView.Path); + dlg.SetLine(2, Constants.Dialog.TO + secondView.Path); // already defined in Dialog + dlg.DoModal(GUIWindowManager.ActiveWindow); - if (!dlg.IsConfirmed) - { - return; + if (dlg.IsConfirmed) + { + ShowDialogOperation(GUIDialogOperation.DialogType.COPY); + CopyDirectory(item.Path, secondView.Path + "\\" + GetFilename(item.Path)); + secondView.Update(); + dlgOp.Close(); + } + } + } + else + { + foreach (Info info in selectedList) + { + if (info.IsPath) + { + ShowDialogOperation(GUIDialogOperation.DialogType.COPY); + CopyDirectory(info.Path.Path, secondView.Path + "\\" + GetFilename(info.Path.Path)); + dlgOp.Close(); + } + else + { + CopySingleFile(info.File.Path + "\\" + info.File.Name, secondView.Path + "\\" + info.File.Name, true); + } + } + + secondView.Update(); + } } - FileIO.FileSystem.DeleteFile(dest, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin); - } - - try - { - if (showDlg) + private void CopySingleFile(string scr, string dest) { - ShowDialogOperation(GUIDialogOperation.DialogType.COPY); - dlgOp.SetCurrentFile(GetFilename(src)); - dlgOp.SetToPath(GetPath(dest)); - dlgOp.Show(winId); + CopySingleFile(scr, dest, false); } - System.IO.File.Copy(src, dest); - if (showDlg) dlgOp.Close(); - } - catch (Exception e) - { - ExceptionViewer.ShowException(e); - } - } - private void CopyDirectory(string scr, string dest) - { - string[] files = null; - - try - { - System.IO.Directory.CreateDirectory(dest); - files = System.IO.Directory.GetFileSystemEntries(scr); - } - catch (Exception e) - { - ExceptionViewer.ShowException(e); - } - - foreach (string s in files) - { - if (System.IO.File.Exists(s)) + private void CopySingleFile(string src, string dest, bool showDlg) { - dlgOp.SetToPath(dest); - dlgOp.SetCurrentFile(GetFilename(s)); - CopySingleFile(s, dest + "\\" + GetFilename(s)); - } - else - { - CopyDirectory(s, dest + "\\" + GetFilename(s)); - } - } - } - #endregion + if (System.IO.File.Exists(dest)) + { + GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + dlg.Reset(); + // dlg.SetHeading("Copying file"); + dlg.SetHeading(Constants.Operation.COPYINGFILE); + // dlg.SetLine(1, "The file \"" + GetFilename(src) + "\""); + dlg.SetLine(1, Constants.Operation.THEFILE + "\"" + GetFilename(src) + "\""); + // dlg.SetLine(2, "alread exists!"); + dlg.SetLine(2, Constants.Operation.ALREADYEXIST); + // dlg.SetLine(3, "Do you want to overwrite it?"); + dlg.SetLine(3, Constants.Operation.OVERWRITE); + dlg.DoModal(GUIWindowManager.ActiveWindow); - #region Move routines - private void Move() - { - if (selectedList == null) - { - GUIListItem item = GUIControl.GetSelectedListItem(winId, lstId); + if (!dlg.IsConfirmed) + { + return; + } - GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + FileIO.FileSystem.DeleteFile(dest, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin); + } - if (!item.IsFolder) - { - // dlg.SetHeading("Move File \"" + item.Label + "\""); - dlg.SetHeading(Constants.Operation.MOVEFILE + "\"" + item.Label + "\""); - // dlg.SetLine(2, "From: " + item.Path); - dlg.SetLine(2, Constants.Operation.FROM + item.Path); - // dlg.SetLine(3, "To: " + secondView.Path); - dlg.SetLine(3, Constants.Dialog.TO + secondView.Path); // already defined in Dialog - dlg.DoModal(GUIWindowManager.ActiveWindow); - - if (dlg.IsConfirmed) - { - MoveSingleFile(item.Path + "\\" + item.Label, secondView.Path + "\\" + item.Label); - Update(); - secondView.Update(); - } + try + { + if (showDlg) + { + ShowDialogOperation(GUIDialogOperation.DialogType.COPY); + dlgOp.SetCurrentFile(GetFilename(src)); + dlgOp.SetToPath(GetPath(dest)); + dlgOp.Show(winId); + } + System.IO.File.Copy(src, dest); + if (showDlg) dlgOp.Close(); + } + catch (Exception e) + { + ExceptionViewer.ShowException(e); + } } - else - { - // dlg.SetHeading("Move Directory \"" + item.Label + "\""); - dlg.SetHeading(Constants.Operation.MOVEDIR + "\"" + item.Label + "\""); - // dlg.SetLine(2, "To: " + secondView.Path); - dlg.SetLine(2, Constants.Dialog.TO + secondView.Path); // already defined in Dialog - dlg.DoModal(GUIWindowManager.ActiveWindow); - if (dlg.IsConfirmed) - { - ShowDialogOperation(GUIDialogOperation.DialogType.MOVE); - MoveDirectory(item.Path, secondView.Path + "\\" + GetFilename(item.Path)); - Update(); - secondView.Update(); - dlgOp.Close(); - } - } - } - else - { - foreach (Info info in selectedList) + private void CopyDirectory(string scr, string dest) { - if (info.IsPath) - { - ShowDialogOperation(GUIDialogOperation.DialogType.MOVE); - MoveDirectory(info.Path.Path, secondView.Path + "\\" + GetFilename(info.Path.Path)); - dlgOp.Close(); - } - else - { - MoveSingleFile(info.File.Path + "\\" + info.File.Name, secondView.Path + "\\" + info.File.Name); - } - } + string[] files = null; - secondView.Update(); - } - } + try + { + System.IO.Directory.CreateDirectory(dest); + files = System.IO.Directory.GetFileSystemEntries(scr); + } + catch (Exception e) + { + ExceptionViewer.ShowException(e); + } - private void MoveSingleFile(string src, string dest) - { - if (System.IO.File.Exists(dest)) - { - GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); - /* dlg.SetHeading("Moving file"); - dlg.SetLine(1, "The file \"" + GetFilename(src) + "\""); - dlg.SetLine(2, "alread exists!"); - dlg.SetLine(3, "Do you want to overwrite it?"); */ - dlg.SetHeading(Constants.Operation.MOVINGFILE); - dlg.SetLine(1, Constants.Operation.THEFILE + "\"" + GetFilename(src) + "\""); - dlg.SetLine(2, Constants.Operation.ALREADYEXIST); - dlg.SetLine(3, Constants.Operation.OVERWRITE); - dlg.DoModal(GUIWindowManager.ActiveWindow); + foreach (string s in files) + { + if (System.IO.File.Exists(s)) + { + dlgOp.SetToPath(dest); + dlgOp.SetCurrentFile(GetFilename(s)); + CopySingleFile(s, dest + "\\" + GetFilename(s)); + } + else + { + CopyDirectory(s, dest + "\\" + GetFilename(s)); + } + } + } + #endregion - if (!dlg.IsConfirmed) + #region Move routines + private void Move() { - return; - } - } + if (selectedList == null) + { + GUIListItem item = GUIControl.GetSelectedListItem(winId, lstId); - try - { - System.IO.File.Move(src, dest); - } - catch (Exception e) - { - ExceptionViewer.ShowException(e); - } - } + GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + dlg.Reset(); - private void MoveDirectory(string scr, string dest) - { - if (System.IO.Directory.Exists(dest)) - { - GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); - /* dlg.SetHeading("Moving directory"); - dlg.SetLine(1, "The directory \"" + GetFilename(dest) + "\""); - dlg.SetLine(2, "alread exists!"); - dlg.SetLine(3, "Do you want to overwrite it?"); */ - dlg.SetHeading(Constants.Operation.MOVINGDIR); - dlg.SetLine(1, Constants.Operation.THEDIR + "\"" + GetFilename(dest) + "\""); - dlg.SetLine(2, Constants.Operation.ALREADYEXIST); - dlg.SetLine(3, Constants.Operation.OVERWRITE); - dlg.DoModal(GUIWindowManager.ActiveWindow); + if (!item.IsFolder) + { + // dlg.SetHeading("Move File \"" + item.Label + "\""); + dlg.SetHeading(Constants.Operation.MOVEFILE + "\"" + item.Label + "\""); + // dlg.SetLine(2, "From: " + item.Path); + dlg.SetLine(2, Constants.Operation.FROM + item.Path); + // dlg.SetLine(3, "To: " + secondView.Path); + dlg.SetLine(3, Constants.Dialog.TO + secondView.Path); // already defined in Dialog + dlg.DoModal(GUIWindowManager.ActiveWindow); - if (!dlg.IsConfirmed) - { - return; - } - } + if (dlg.IsConfirmed) + { + MoveSingleFile(item.Path + "\\" + item.Label, secondView.Path + "\\" + item.Label); + Update(); + secondView.Update(); + } + } + else + { + // dlg.SetHeading("Move Directory \"" + item.Label + "\""); + dlg.SetHeading(Constants.Operation.MOVEDIR + "\"" + item.Label + "\""); + // dlg.SetLine(2, "To: " + secondView.Path); + dlg.SetLine(2, Constants.Dialog.TO + secondView.Path); // already defined in Dialog + dlg.DoModal(GUIWindowManager.ActiveWindow); - if (this.Drive.Equals(secondView.Drive)) - { - dlgOp.SetCurrentFile("*.*"); - dlgOp.SetToPath(dest); + if (dlg.IsConfirmed) + { + ShowDialogOperation(GUIDialogOperation.DialogType.MOVE); + MoveDirectory(item.Path, secondView.Path + "\\" + GetFilename(item.Path)); + Update(); + secondView.Update(); + dlgOp.Close(); + } + } + } + else + { + foreach (Info info in selectedList) + { + if (info.IsPath) + { + ShowDialogOperation(GUIDialogOperation.DialogType.MOVE); + MoveDirectory(info.Path.Path, secondView.Path + "\\" + GetFilename(info.Path.Path)); + dlgOp.Close(); + } + else + { + MoveSingleFile(info.File.Path + "\\" + info.File.Name, secondView.Path + "\\" + info.File.Name); + } + } - try - { - System.IO.Directory.Move(scr, dest); + secondView.Update(); + } } - catch (Exception e) + + private void MoveSingleFile(string src, string dest) { - ExceptionViewer.ShowException(e); - } - } - else - { - CopyDirectory(scr, dest); - FileIO.FileSystem.DeleteDirectory(scr, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin); - } - } - #endregion + if (System.IO.File.Exists(dest)) + { + GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + /* dlg.SetHeading("Moving file"); + dlg.SetLine(1, "The file \"" + GetFilename(src) + "\""); + dlg.SetLine(2, "alread exists!"); + dlg.SetLine(3, "Do you want to overwrite it?"); */ + dlg.Reset(); + dlg.SetHeading(Constants.Operation.MOVINGFILE); + dlg.SetLine(1, Constants.Operation.THEFILE + "\"" + GetFilename(src) + "\""); + dlg.SetLine(2, Constants.Operation.ALREADYEXIST); + dlg.SetLine(3, Constants.Operation.OVERWRITE); + dlg.DoModal(GUIWindowManager.ActiveWindow); - #region Delete routines - private void Delete() - { - if (selectedList != null) - { - Info[] info = new Info[selectedList.Count]; - selectedList.CopyTo(info); - selectedList = null; + if (!dlg.IsConfirmed) + { + return; + } + } - for (int i = 0; i < info.Length; i++) - { - if (info[i].IsPath) - { - ShowDialogOperation(GUIDialogOperation.DialogType... [truncated message content] |