From: <fr...@us...> - 2010-05-04 04:44:53
|
Revision: 3571 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3571&view=rev Author: framug Date: 2010-05-04 04:44:46 +0000 (Tue, 04 May 2010) Log Message: ----------- - All classes indetation 2 for a better diff reading. - Update french. - Obsolete FreeResources() replaced by Dispose(). Modified Paths: -------------- trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs trunk/plugins/File Explorer/DrivesView.cs trunk/plugins/File Explorer/ExceptionViewer.cs trunk/plugins/File Explorer/File Explorer.cs trunk/plugins/File Explorer/Language/strings_fr.xml trunk/plugins/File Explorer/LocalizeStrings.cs trunk/plugins/File Explorer/Preview/ModulePreview.cs trunk/plugins/File Explorer/Preview/PicturePreview.cs trunk/plugins/File Explorer/Preview/StreamingPreview.cs trunk/plugins/File Explorer/Preview/TextPreview.cs trunk/plugins/File Explorer/XmlConfig.cs Modified: trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs =================================================================== --- trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs 2010-05-03 21:46:09 UTC (rev 3570) +++ trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs 2010-05-04 04:44:46 UTC (rev 3571) @@ -29,66 +29,69 @@ namespace FileExplorer.Dialogs { - /// <summary> - /// This class shows a dialog which shows information about - /// operations done by DrivesView class. - /// </summary> - public class GUIDialogOperation : GUIWindow, IRenderLayer - { - #region enum DialogType - /// <summary> - /// Available dialogtypes. - /// </summary> - public enum DialogType : int - { - COPY = 0, - MOVE = 1, - DELETE = 2, - ENCRYPT = 3, - DECRYPT = 4, - COMPRESS = 5, - UNCOMPRESS = 6, - HIDE = 7, - UNHIDE = 8, - READONLY_FLAG_ADD = 9, - READONLY_FLAG_REMOVE = 10, - AUDIO_PLAYLIST_CREATE = 11, - VIDEO_PLAYLIST_CREATE = 12, - AUDIO_PLAYLIST_ADD = 13, - VIDEO_PLAYLIST_ADD = 14 - }; - #endregion - - #region vars - private int parentID; - private bool running = false; - - private DialogType type = 0; - - private string file = string.Empty; - private string to = string.Empty; - - private Thread processThread = null; - #endregion - - #region skin vars - [SkinControlAttribute(2)] private GUILabelControl lblHeading = null; - [SkinControlAttribute(3)] private GUILabelControl lblText1 = null; - [SkinControlAttribute(4)] private GUILabelControl lblText2 = null; - #endregion - - #region public members - /// <summary> - /// Shows the dialog and waits until the user has closed it. - /// </summary> - /// <param name="parentID">Parentwindow id.</param> - public void DoModal(int parentID) - { - this.parentID = parentID; - - GUIWindow win = GUIWindowManager.GetWindow(parentID); - - GUIWindowManager.IsSwitchingToNewWindow = true; + /// <summary> + /// This class shows a dialog which shows information about + /// operations done by DrivesView class. + /// </summary> + public class GUIDialogOperation : GUIWindow, IRenderLayer + { + #region enum DialogType + /// <summary> + /// Available dialogtypes. + /// </summary> + public enum DialogType : int + { + COPY = 0, + MOVE = 1, + DELETE = 2, + ENCRYPT = 3, + DECRYPT = 4, + COMPRESS = 5, + UNCOMPRESS = 6, + HIDE = 7, + UNHIDE = 8, + READONLY_FLAG_ADD = 9, + READONLY_FLAG_REMOVE = 10, + AUDIO_PLAYLIST_CREATE = 11, + VIDEO_PLAYLIST_CREATE = 12, + AUDIO_PLAYLIST_ADD = 13, + VIDEO_PLAYLIST_ADD = 14 + }; + #endregion + + #region vars + private int parentID; + private bool running = false; + + private DialogType type = 0; + + private string file = string.Empty; + private string to = string.Empty; + + private Thread processThread = null; + #endregion + + #region skin vars + [SkinControlAttribute(2)] + private GUILabelControl lblHeading = null; + [SkinControlAttribute(3)] + private GUILabelControl lblText1 = null; + [SkinControlAttribute(4)] + private GUILabelControl lblText2 = null; + #endregion + + #region public members + /// <summary> + /// Shows the dialog and waits until the user has closed it. + /// </summary> + /// <param name="parentID">Parentwindow id.</param> + public void DoModal(int parentID) + { + this.parentID = parentID; + + GUIWindow win = GUIWindowManager.GetWindow(parentID); + + GUIWindowManager.IsSwitchingToNewWindow = true; GUIWindowManager.RouteToWindow(GetID); // activate this window @@ -96,25 +99,25 @@ OnMessage(msg); GUIWindowManager.IsSwitchingToNewWindow = false; - + running = true; while (running && GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.RUNNING) { GUIWindowManager.Process(); } - } - - /// <summary> - /// Shows the dialog. - /// </summary> - /// <param name="parentID">Parentwindow id.</param> - public void Show(int parentID) - { - this.parentID = parentID; - - GUIWindow win = GUIWindowManager.GetWindow(parentID); - - GUIWindowManager.IsSwitchingToNewWindow = true; + } + + /// <summary> + /// Shows the dialog. + /// </summary> + /// <param name="parentID">Parentwindow id.</param> + public void Show(int parentID) + { + this.parentID = parentID; + + GUIWindow win = GUIWindowManager.GetWindow(parentID); + + GUIWindowManager.IsSwitchingToNewWindow = true; GUIWindowManager.RouteToWindow(GetID); // activate this window @@ -123,316 +126,316 @@ GUIWindowManager.IsSwitchingToNewWindow = false; GUIWindowManager.Process(); - + running = true; - + processThread = new Thread(new ThreadStart(this.ProcessThread)); processThread.Start(); - } - - /// <summary> - /// Closes the dialog. Only available if the dialog was shown using Show(). - /// </summary> - public void Close() - { - this.OnAction(new Action(Action.ActionType.ACTION_CLOSE_DIALOG, 0, 0)); - } - - /// <summary> - /// Sets/returns the dialogtype. - /// </summary> - public DialogType Type - { - get { return type; } - set { SetType(value); } - } - - /// <summary> - /// Sets the dialogtype. - /// </summary> - /// <param name="type">Dialogtype.</param> - public void SetType(DialogType type) - { - this.type = type; - - switch (type) - { - case DialogType.AUDIO_PLAYLIST_CREATE: -// lblHeading.Label = "Create Audio Playlist"; -// lblText1.Label = "Adding File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.CREATEAUDIO; - lblText1.Label = Constants.Dialog.ADDFILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.COMPRESS: -// lblHeading.Label = "Compressing"; -// lblText1.Label = "Compressing File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.COMPRESS; - lblText1.Label = Constants.Dialog.COMPRESSFILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.COPY: -// lblHeading.Label = "Copy"; -// lblText1.Label = "File: "; -// lblText2.Label = "To: "; - lblHeading.Label = Constants.Dialog.COPY; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.TO; - break; - case DialogType.DECRYPT: -// lblHeading.Label = "Decrypting"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.DECRYPT; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.DELETE: -// lblHeading.Label = "Delete"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.DELETE; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.ENCRYPT: -// lblHeading.Label = "Encrypting"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.ENCRYPT; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.HIDE: -// lblHeading.Label = "Hide"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.HIDE; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.MOVE: -// lblHeading.Label = "Move"; -// lblText1.Label = "File: "; -// lblText2.Label = "To: "; - lblHeading.Label = Constants.Dialog.MOVE; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.TO; - break; - case DialogType.READONLY_FLAG_ADD: -// lblHeading.Label = "Set readonly flag"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.SETREADONLY; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.READONLY_FLAG_REMOVE: -// lblHeading.Label = "Remove readonly flag"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.REMOVEREADONLY; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.UNCOMPRESS: -// lblHeading.Label = "Uncompressing"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.UNCOMPRESS; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.UNHIDE: -// lblHeading.Label = "Unhide"; -// lblText1.Label = "File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.UNHIDE; - lblText1.Label = Constants.Dialog.FILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.VIDEO_PLAYLIST_CREATE: -// lblHeading.Label = "Create Video Playlist"; -// lblText1.Label = "Adding File: "; -// lblText2.Label = "Path: "; - lblHeading.Label = Constants.Dialog.CREATEVIDEO; - lblText1.Label = Constants.Dialog.ADDFILE; - lblText2.Label = Constants.Dialog.PATH; - break; - case DialogType.AUDIO_PLAYLIST_ADD: -// lblHeading.Label = "Add to Audio Playlist"; -// lblText1.Label = "Reading files . . . "; - lblHeading.Label = Constants.Dialog.ADDAUDIO; - lblText1.Label = Constants.Dialog.READFILE; - lblText2.Label = string.Empty; - break; - case DialogType.VIDEO_PLAYLIST_ADD: -// lblHeading.Label = "Add to Video Playlist"; -// lblText1.Label = "Reading files . . . "; - lblHeading.Label = Constants.Dialog.ADDVIDEO; - lblText1.Label = Constants.Dialog.READFILE; - lblText2.Label = string.Empty; - break; - } - } - - public void SetCurrentFile(string file) - { - SuspendThread(); - this.file = file; -// lblText1.Label = "File: " + file; - lblText1.Label = Constants.Dialog.FILE + file; - ResumeThread(); - } - - public void SetToPath(string path) - { - SuspendThread(); - if (path.Length > 30) - { - path = path.Substring(0, 3) + "..\\" + GetFilename(path); - } - this.to = path; -// lblText2.Label = "To: " + path; - lblText2.Label = Constants.Dialog.TO + path; - ResumeThread(); - } - - public void SetPath(string path) - { - SuspendThread(); - if (path.Length > 30) - { - path = path.Substring(0, 3) + "..\\" + GetFilename(path); - } -// lblText2.Label = "Path: " + path; - lblText2.Label = Constants.Dialog.PATH + path; - ResumeThread(); - } - - /// <summary> - /// Adds text to the dialog's first label. - /// </summary> - /// <param name="text">Text</param> - public void SetText(string text) - { - SuspendThread(); - lblText1.Label = text; - lblText2.Label = string.Empty; - ResumeThread(); - } - - /// <summary> - /// Adds text to the dialog's first and second label. - /// </summary> - /// <param name="text1">Text for label 1.</param> - /// <param name="text2">Text for label 2.</param> - public void SetText(string text1, string text2) - { - SuspendThread(); - lblText1.Label = text1; - lblText1.Label = text2; - ResumeThread(); - } - #endregion - - #region private members - private void ProcessThread() - { - while (running) - { - GUIWindowManager.Process(); - } - } - //fmu if someone know how to remove this obsolete m$soft method ? - private void SuspendThread() - { - processThread.Suspend(); - } + } + + /// <summary> + /// Closes the dialog. Only available if the dialog was shown using Show(). + /// </summary> + public void Close() + { + this.OnAction(new Action(Action.ActionType.ACTION_CLOSE_DIALOG, 0, 0)); + } + + /// <summary> + /// Sets/returns the dialogtype. + /// </summary> + public DialogType Type + { + get { return type; } + set { SetType(value); } + } + + /// <summary> + /// Sets the dialogtype. + /// </summary> + /// <param name="type">Dialogtype.</param> + public void SetType(DialogType type) + { + this.type = type; + + switch (type) + { + case DialogType.AUDIO_PLAYLIST_CREATE: + // lblHeading.Label = "Create Audio Playlist"; + // lblText1.Label = "Adding File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.CREATEAUDIO; + lblText1.Label = Constants.Dialog.ADDFILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.COMPRESS: + // lblHeading.Label = "Compressing"; + // lblText1.Label = "Compressing File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.COMPRESS; + lblText1.Label = Constants.Dialog.COMPRESSFILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.COPY: + // lblHeading.Label = "Copy"; + // lblText1.Label = "File: "; + // lblText2.Label = "To: "; + lblHeading.Label = Constants.Dialog.COPY; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.TO; + break; + case DialogType.DECRYPT: + // lblHeading.Label = "Decrypting"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.DECRYPT; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.DELETE: + // lblHeading.Label = "Delete"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.DELETE; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.ENCRYPT: + // lblHeading.Label = "Encrypting"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.ENCRYPT; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.HIDE: + // lblHeading.Label = "Hide"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.HIDE; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.MOVE: + // lblHeading.Label = "Move"; + // lblText1.Label = "File: "; + // lblText2.Label = "To: "; + lblHeading.Label = Constants.Dialog.MOVE; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.TO; + break; + case DialogType.READONLY_FLAG_ADD: + // lblHeading.Label = "Set readonly flag"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.SETREADONLY; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.READONLY_FLAG_REMOVE: + // lblHeading.Label = "Remove readonly flag"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.REMOVEREADONLY; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.UNCOMPRESS: + // lblHeading.Label = "Uncompressing"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.UNCOMPRESS; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.UNHIDE: + // lblHeading.Label = "Unhide"; + // lblText1.Label = "File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.UNHIDE; + lblText1.Label = Constants.Dialog.FILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.VIDEO_PLAYLIST_CREATE: + // lblHeading.Label = "Create Video Playlist"; + // lblText1.Label = "Adding File: "; + // lblText2.Label = "Path: "; + lblHeading.Label = Constants.Dialog.CREATEVIDEO; + lblText1.Label = Constants.Dialog.ADDFILE; + lblText2.Label = Constants.Dialog.PATH; + break; + case DialogType.AUDIO_PLAYLIST_ADD: + // lblHeading.Label = "Add to Audio Playlist"; + // lblText1.Label = "Reading files . . . "; + lblHeading.Label = Constants.Dialog.ADDAUDIO; + lblText1.Label = Constants.Dialog.READFILE; + lblText2.Label = string.Empty; + break; + case DialogType.VIDEO_PLAYLIST_ADD: + // lblHeading.Label = "Add to Video Playlist"; + // lblText1.Label = "Reading files . . . "; + lblHeading.Label = Constants.Dialog.ADDVIDEO; + lblText1.Label = Constants.Dialog.READFILE; + lblText2.Label = string.Empty; + break; + } + } + + public void SetCurrentFile(string file) + { + SuspendThread(); + this.file = file; + // lblText1.Label = "File: " + file; + lblText1.Label = Constants.Dialog.FILE + file; + ResumeThread(); + } + + public void SetToPath(string path) + { + SuspendThread(); + if (path.Length > 30) + { + path = path.Substring(0, 3) + "..\\" + GetFilename(path); + } + this.to = path; + // lblText2.Label = "To: " + path; + lblText2.Label = Constants.Dialog.TO + path; + ResumeThread(); + } + + public void SetPath(string path) + { + SuspendThread(); + if (path.Length > 30) + { + path = path.Substring(0, 3) + "..\\" + GetFilename(path); + } + // lblText2.Label = "Path: " + path; + lblText2.Label = Constants.Dialog.PATH + path; + ResumeThread(); + } + + /// <summary> + /// Adds text to the dialog's first label. + /// </summary> + /// <param name="text">Text</param> + public void SetText(string text) + { + SuspendThread(); + lblText1.Label = text; + lblText2.Label = string.Empty; + ResumeThread(); + } + + /// <summary> + /// Adds text to the dialog's first and second label. + /// </summary> + /// <param name="text1">Text for label 1.</param> + /// <param name="text2">Text for label 2.</param> + public void SetText(string text1, string text2) + { + SuspendThread(); + lblText1.Label = text1; + lblText1.Label = text2; + ResumeThread(); + } + #endregion + + #region private members + private void ProcessThread() + { + while (running) + { + GUIWindowManager.Process(); + } + } //fmu if someone know how to remove this obsolete m$soft method ? - private void ResumeThread() - { - processThread.Resume(); - } - - private string GetFilename(string filePath) - { - int index = filePath.LastIndexOf("\\"); - - if (index == -1) - { - index = filePath.LastIndexOf("/"); - } - - if (index == -1) - { - return filePath; - } - - return filePath.Substring(index + 1); - } - #endregion - - #region Overrides - public override int GetID - { - get { return Constants.WindowIDs.DIALOGOPERATION; } - set { base.GetID = value; } - } - - public override bool Init() - { - return Load(GUIGraphicsContext.Skin + "\\File Explorer_dialog.xml"); - } - - public override void OnAction(Action action) - { - if (action.wID == Action.ActionType.ACTION_CLOSE_DIALOG || action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + private void SuspendThread() + { + processThread.Suspend(); + } + //fmu if someone know how to remove this obsolete m$soft method ? + private void ResumeThread() + { + processThread.Resume(); + } + + private string GetFilename(string filePath) + { + int index = filePath.LastIndexOf("\\"); + + if (index == -1) { + index = filePath.LastIndexOf("/"); + } + + if (index == -1) + { + return filePath; + } + + return filePath.Substring(index + 1); + } + #endregion + + #region Overrides + public override int GetID + { + get { return Constants.WindowIDs.DIALOGOPERATION; } + set { base.GetID = value; } + } + + public override bool Init() + { + return Load(GUIGraphicsContext.Skin + "\\File Explorer_dialog.xml"); + } + + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_CLOSE_DIALOG || action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null); OnMessage(msg); - + return; } - - base.OnAction(action); - } - - public override bool OnMessage(GUIMessage message) - { - if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT) - { - GUIWindowManager.IsSwitchingToNewWindow = true; - - lock (this) - { - FreeResources(); + + base.OnAction(action); + } + + public override bool OnMessage(GUIMessage message) + { + if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT) + { + GUIWindowManager.IsSwitchingToNewWindow = true; + + lock (this) + { + Dispose(); DeInitControls(); GUILayerManager.UnRegisterLayer(this); - - GUIWindowManager.UnRoute(); - running = false; - } - GUIWindowManager.IsSwitchingToNewWindow = false; - } - else if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_INIT) - { - base.OnMessage(message); + GUIWindowManager.UnRoute(); + running = false; + } + + GUIWindowManager.IsSwitchingToNewWindow = false; + } + else if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_INIT) + { + base.OnMessage(message); GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog); - } - return base.OnMessage(message); - } - - protected override void OnPageLoad() - { - - } - #endregion - - #region IRenderLayer + } + return base.OnMessage(message); + } + + protected override void OnPageLoad() + { + + } + #endregion + + #region IRenderLayer public bool ShouldRenderLayer() { return true; @@ -443,5 +446,5 @@ Render(timePassed); } #endregion - } + } } Modified: trunk/plugins/File Explorer/DrivesView.cs =================================================================== --- trunk/plugins/File Explorer/DrivesView.cs 2010-05-03 21:46:09 UTC (rev 3570) +++ trunk/plugins/File Explorer/DrivesView.cs 2010-05-04 04:44:46 UTC (rev 3571) @@ -36,178 +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 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 struct Info + { + public FileInfo File; + public PathInfo Path; + public bool IsPath; - public bool IsFile - { - get { return !IsPath; } - set { IsPath = !value; } - } - } - #endregion - - #region Enums - enum RecycleFlags : uint + public bool IsFile { - SHERB_NOCONFIRMATION = 0x00000001, - SHERB_NOPROGRESSUI = 0x00000002, - SHERB_NOSOUND = 0x00000004 + get { return !IsPath; } + set { IsPath = !value; } } - #endregion + } + #endregion - /// <summary> - /// Description of DrivesView. - /// </summary> - public class DrivesView - { - [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] - static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags); + #region Enums + enum RecycleFlags : uint + { + SHERB_NOCONFIRMATION = 0x00000001, + SHERB_NOPROGRESSUI = 0x00000002, + SHERB_NOSOUND = 0x00000004 + } + #endregion - #region static members - [DllImport(".\\Plugins\\Windows\\Compression.dll")] - private static extern bool CompressFile(string file); + /// <summary> + /// Description of DrivesView. + /// </summary> + public class DrivesView + { + [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] + static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags); - [DllImport(".\\Plugins\\Windows\\Compression.dll")] - private static extern bool UncompressFile(string file); + #region static members + [DllImport(".\\Plugins\\Windows\\Compression.dll")] + private static extern bool CompressFile(string file); - [DllImport("kernel32.dll")] - private static extern int SetFileAttributes(string filename, System.UInt32 dwFileAttributes); + [DllImport(".\\Plugins\\Windows\\Compression.dll")] + private static extern bool UncompressFile(string file); - 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 + [DllImport("kernel32.dll")] + private static extern int SetFileAttributes(string filename, System.UInt32 dwFileAttributes); - #region vars - private int lstId; - private int winId; - private int lblId; - private int lblDirId; + 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 string currentPath = null; - private string currentDrive = null; - private ArrayList drives = null; - private ArrayList currentPathList = null; + #region vars + private int lstId; + private int winId; + private int lblId; + private int lblDirId; - private ArrayList selectedList = null; + private string currentPath = null; + private string currentDrive = null; + private ArrayList drives = null; + private ArrayList currentPathList = null; - private bool showExtensions; - private bool trashcan; - private bool showAllFiles; - private bool showSystemFiles; - private bool showSystemDirs; - private bool selectionMode = false; + private ArrayList selectedList = null; - private DrivesView secondView = null; + private bool showExtensions; + private bool trashcan; + private bool showAllFiles; + private bool showSystemFiles; + private bool showSystemDirs; + private bool selectionMode = false; - private ArrayList lstFiles = null; + private DrivesView secondView = null; - private GUIDialogOperation dlgOp = null; + private ArrayList lstFiles = null; - #endregion + private GUIDialogOperation dlgOp = 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; + #endregion - CreateDrivesList(); - // SetStandardValues(); - SetStandardValues(this.lstId); - LoadPath(); - FillListControl(); - } - #endregion + #region ctor + public DrivesView(int windowID, int guiListViewControlID, int infoLabelID, int dirLabelID) + { + this.lstId = guiListViewControlID; + this.winId = windowID; + this.lblId = infoLabelID; + this.lblDirId = dirLabelID; - #region private members - private void CreateDrivesList() - { - drives = new ArrayList(); + CreateDrivesList(); + // SetStandardValues(); + SetStandardValues(this.lstId); + LoadPath(); + FillListControl(); + } + #endregion - foreach (string d in Environment.GetLogicalDrives()) - { - Drive drv = new Drive(); - drv.Path = d; - drv.Type = Utils.getDriveType(d); + #region private members + private void CreateDrivesList() + { + drives = new ArrayList(); - 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; - } + foreach (string d in Environment.GetLogicalDrives()) + { + Drive drv = new Drive(); + drv.Path = d; + drv.Type = Utils.getDriveType(d); - drives.Add(drv); - } + 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); + } + } + private void SetStandardValues(int lstId) { SetStandardValues(); @@ -227,3028 +227,3028 @@ } } - private void SetStandardValues() + private void SetStandardValues() + { + foreach (Drive d in drives) + { + if (d.Type == Constants.DriveTypes.FIXED) { - foreach (Drive d in drives) - { - if (d.Type == Constants.DriveTypes.FIXED) - { - currentDrive = d.Path; - currentPath = d.Path; + currentDrive = d.Path; + currentPath = d.Path; - 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; + break; } + } - private bool LoadPath() + 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)) { - selectedList = null; - string[] files = null; - try - { - files = System.IO.Directory.GetFileSystemEntries(currentPath); - } - catch (Exception e) - { - ExceptionViewer.ShowException(e); - return false; - } + System.IO.FileInfo fi = new System.IO.FileInfo(s); - currentPathList = new ArrayList(); + 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; - foreach (string s in files) - { - Info info = new Info(); + 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); - if (System.IO.File.Exists(s)) - { - System.IO.FileInfo fi = new System.IO.FileInfo(s); + 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); + } - 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.Add(info); + } - 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); + return true; + } - 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); - } + private void FillListControl() + { + GUIControl.ClearControl(winId, lstId); + string path = Utils.RemoveTrailingSlash(currentPath); - currentPathList.Add(info); - } + if (!currentPath.Equals(currentDrive)) + { + GUIListItem item = new GUIListItem(".."); + item.Path = GetPath(currentPath); - return true; + 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; + item.MusicTag = info; + + Utils.SetDefaultIcons(item); + GUIControl.AddListItemControl(winId, lstId, item); + } } + } - private void FillListControl() + foreach (Info info in currentPathList) + { + if (info.IsFile) { - GUIControl.ClearControl(winId, lstId); - string path = Utils.RemoveTrailingSlash(currentPath); + bool b = true; - if (!currentPath.Equals(currentDrive)) - { - GUIListItem item = new GUIListItem(".."); - item.Path = GetPath(currentPath); + if ((!this.showAllFiles) && (info.File.Hidden)) + { + b = false; + } - Utils.SetDefaultIcons(item); - GUIControl.AddListItemControl(winId, lstId, item); - } + if ((!this.showSystemFiles) && (info.File.SystemFile)) + { + b = false; + } - foreach (Info info in currentPathList) - { - if (info.IsPath) - { - bool b = true; + 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; - if ((!this.showAllFiles) && (info.Path.Hidden)) - { - b = false; - } + GUIControl.AddListItemControl(winId, lstId, item); + } + } + } - if ((!this.showSystemDirs) && (info.Path.SystemFile)) - { - b = false; - } + // string cf = "Folder: "; + //string cf = Constants.View.FOLDER; + string cf = String.Empty; + /* + if (currentPath.Length > 50) + { + cf += currentDrive + "..\\" + GetFilename(currentPath); + } + else + { + cf += currentPath; + } + */ + cf += currentPath; - if (b) - { - GUIListItem item = new GUIListItem(info.Path.Name); - item.IsFolder = true; - item.Path = info.Path.Path; - item.MusicTag = info; + // 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 + { + GUIPropertyManager.SetProperty("#FileExplorer.Left.CurrentDir", " "); + GUIPropertyManager.SetProperty("#FileExplorer.Right.CurrentDir", " "); + } + GUIControl.SetControlLabel(winId, lblDirId, cf); + } + #endregion - Utils.SetDefaultIcons(item); - GUIControl.AddListItemControl(winId, lstId, item); - } - } - } + #region public members + public void Update() + { + LoadPath(); + FillListControl(); + } - foreach (Info info in currentPathList) - { - if (info.IsFile) - { - bool b = true; + #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 - if ((!this.showAllFiles) && (info.File.Hidden)) - { - b = false; - } + 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 ((!this.showSystemFiles) && (info.File.SystemFile)) - { - b = false; - } + 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 (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.Add("Select All"); + // mnu.Add("Disable selections"); + mnu.Add(Constants.View.SELECTALL); + mnu.Add(Constants.View.DISABLESEL); - GUIControl.AddListItemControl(winId, lstId, item); - } - } - } + if (selectionMode) + { + // mnu.Add("Disable selection mode"); + mnu.Add(Constants.View.DISABLESELMODE); + } + else + { + // mnu.Add("Enable selection mode"); + mnu.Add(Constants.View.ENABLESELMODE); + } - // string cf = "Folder: "; - //string cf = Constants.View.FOLDER; - string cf = String.Empty; - /* - if (currentPath.Length > 50) + mnu.Add(Constants.Dialog.EMPTYRECYCLEBIN); + + 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) { - cf += currentDrive + "..\\" + GetFilename(currentPath); + CreateAudioPlaylist(); } else { - cf += currentPath; + CreateAudioPlaylistFromSelectedFiles(); } - */ - 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); + break; + } + case MenuIDs.VideoPlayList: + { + if (selectedList == null) + { + CreateVideoPlaylist(); + } else { - GUIPropertyManager.SetProperty("#FileExplorer.Left.CurrentDir", " "); - GUIPropertyManager.SetProperty("#FileExplorer.Right.CurrentDir", " "); + CreateVideoPlaylistFromSelectedFiles(); } - 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); - + break; + } + case MenuIDs.AddToAudioPlaylist: + { 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 + AddToAudioPlaylist(); } 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); + AddSelectedFilesToAudioPlaylist(); } - - // mnu.Add("Select All"); - // mnu.Add("Disable selections"); - mnu.Add(Constants.View.SELECTALL); - mnu.Add(Constants.View.DISABLESEL); - - if (selectionMode) + break; + } + case MenuIDs.AddToVideoPlaylist: + { + if (selectedList == null) { - // mnu.Add("Disable selection mode"); - mnu.Add(Constants.View.DISABLESELMODE); + AddToVideoPlaylist(); } else { - // mnu.Add("Enable selection mode"); - mnu.Add(Constants.View.ENABLESELMODE); + AddSelectedFilesToVideoPlaylist(); } + break; + } + case MenuIDs.SelectAll: + { + SelectAll(); + break; + } + case MenuIDs.DisableSelections: + { + DeleteSelections(); + break; + } + case MenuIDs.SelectionMode: + { + SelectionMode = !SelectionMode; + break; + } + case MenuIDs.EmptyRecycleBin: + { + EmptyRecycleBin(); + break; + } + } + } + #endregion - mnu.Add(Constants.Dialog.EMPTYRECYCLEBIN); + #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.DoModal(GUIWindowManager.ActiveWindow); + foreach (Drive d in drives) + { + mnu.Add(d.Path + " " + d.TypeDescription); + } - 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; - ... [truncated message content] |