|
From: <Sil...@us...> - 2010-05-04 17:15:30
|
Revision: 3574
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3574&view=rev
Author: SilentException
Date: 2010-05-04 17:15:23 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Small updates to GUIDialogOperation
Dialog updates
Path concatenation updates
Video files playback improvement (full screen)
Bug fix for property setter
Modified Paths:
--------------
trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs
trunk/plugins/File Explorer/DrivesView.cs
Modified: trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs
===================================================================
--- trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs 2010-05-04 15:45:10 UTC (rev 3573)
+++ trunk/plugins/File Explorer/Dialogs/GUIDialogOperation.cs 2010-05-04 17:15:23 UTC (rev 3574)
@@ -325,6 +325,7 @@
this.file = file;
// lblText1.Label = "File: " + file;
lblText1.Label = Constants.Dialog.FILE + file;
+ GUIWindowManager.Process();
ResumeThread();
}
@@ -340,6 +341,7 @@
this.to = path;
// lblText2.Label = "To: " + path;
lblText2.Label = Constants.Dialog.TO + path;
+ GUIWindowManager.Process();
ResumeThread();
}
@@ -378,7 +380,7 @@
{
SuspendThread();
lblText1.Label = text1;
- lblText1.Label = text2;
+ lblText2.Label = text2;
ResumeThread();
}
#endregion
@@ -395,6 +397,7 @@
}
}
}
+
private void SuspendThread()
{
Paused = true;
Modified: trunk/plugins/File Explorer/DrivesView.cs
===================================================================
--- trunk/plugins/File Explorer/DrivesView.cs 2010-05-04 15:45:10 UTC (rev 3573)
+++ trunk/plugins/File Explorer/DrivesView.cs 2010-05-04 17:15:23 UTC (rev 3574)
@@ -688,17 +688,17 @@
{
// dlg.SetHeading("Copy File");
dlg.SetHeading(Constants.Operation.COPYFILE);
- // dlg.SetLine(1, item.Label);
- dlg.SetLine(1, item.Label);
- // dlg.SetLine(2, "From: " + item.Path);
- dlg.SetLine(2, Constants.Operation.FROM + item.Path);
+ // dlg.SetLine(1, "\"" + item.Label + "\"");
+ dlg.SetLine(1, "\"" + item.Label + "\"");
+ // dlg.SetLine(2, "From: " + Path);
+ dlg.SetLine(2, Constants.Operation.FROM + 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);
+ CopySingleFile(CombinePathAndFilename(item.Path, item.Label), CombinePathAndFilename(secondView.Path, item.Label));
secondView.Update();
}
}
@@ -706,10 +706,10 @@
{
// dlg.SetHeading("Copy Directory");
dlg.SetHeading(Constants.Operation.COPYDIR);
- // dlg.SetLine(1, item.Label);
- dlg.SetLine(1, item.Label);
- // dlg.SetLine(2, "From: " + item.Path);
- dlg.SetLine(2, Constants.Operation.FROM + item.Path);
+ // dlg.SetLine(1, "\"" + item.Label + "\"");
+ dlg.SetLine(1, "\"" + item.Label + "\"");
+ // dlg.SetLine(2, "From: " + Path);
+ dlg.SetLine(2, Constants.Operation.FROM + Path);
// dlg.SetLine(3, "To: " + secondView.Path);
dlg.SetLine(3, Constants.Dialog.TO + secondView.Path); // already defined in Dialog
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -717,7 +717,7 @@
if (dlg.IsConfirmed)
{
ShowDialogOperation(GUIDialogOperation.DialogType.COPY);
- CopyDirectory(item.Path, secondView.Path + "\\" + GetFilename(item.Path));
+ CopyDirectory(item.Path, CombinePathAndFilename(secondView.Path, GetFilename(item.Path)));
secondView.Update();
dlgOp.Close();
}
@@ -730,12 +730,12 @@
if (info.IsPath)
{
ShowDialogOperation(GUIDialogOperation.DialogType.COPY);
- CopyDirectory(info.Path.Path, secondView.Path + "\\" + GetFilename(info.Path.Path));
+ CopyDirectory(info.Path.Path, CombinePathAndFilename(secondView.Path, GetFilename(info.Path.Path)));
dlgOp.Close();
}
else
{
- CopySingleFile(info.File.Path + "\\" + info.File.Name, secondView.Path + "\\" + info.File.Name, true);
+ CopySingleFile(CombinePathAndFilename(info.File.Path, info.File.Name), CombinePathAndFilename(secondView.Path, info.File.Name), true);
}
}
@@ -758,7 +758,7 @@
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, "already exists!");
dlg.SetLine(2, Constants.Operation.ALREADYEXIST);
// dlg.SetLine(3, "Do you want to overwrite it?");
dlg.SetLine(3, Constants.Operation.OVERWRITE);
@@ -810,11 +810,11 @@
{
dlgOp.SetToPath(dest);
dlgOp.SetCurrentFile(GetFilename(s));
- CopySingleFile(s, dest + "\\" + GetFilename(s));
+ CopySingleFile(s, CombinePathAndFilename(dest, GetFilename(s)));
}
else
{
- CopyDirectory(s, dest + "\\" + GetFilename(s));
+ CopyDirectory(s, CombinePathAndFilename(dest, GetFilename(s)));
}
}
}
@@ -834,17 +834,17 @@
{
// dlg.SetHeading("Move File");
dlg.SetHeading(Constants.Operation.MOVEFILE);
- // dlg.SetLine(1, item.Label);
- dlg.SetLine(1, item.Label);
- // dlg.SetLine(2, "From: " + item.Path);
- dlg.SetLine(2, Constants.Operation.FROM + item.Path);
+ // dlg.SetLine(1, "\"" + item.Label + "\"");
+ dlg.SetLine(1, "\"" + item.Label + "\"");
+ // dlg.SetLine(2, "From: " + Path);
+ dlg.SetLine(2, Constants.Operation.FROM + 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);
+ MoveSingleFile(CombinePathAndFilename(item.Path, item.Label), CombinePathAndFilename(secondView.Path, item.Label));
Update();
secondView.Update();
}
@@ -853,10 +853,10 @@
{
// dlg.SetHeading("Move Directory");
dlg.SetHeading(Constants.Operation.MOVEDIR);
- // dlg.SetLine(1, item.Label);
- dlg.SetLine(1, item.Label);
- // dlg.SetLine(2, "From: " + item.Path);
- dlg.SetLine(2, Constants.Operation.FROM + item.Path);
+ // dlg.SetLine(1, "\"" + item.Label + "\"");
+ dlg.SetLine(1, "\"" + item.Label + "\"");
+ // dlg.SetLine(2, "From: " + Path);
+ dlg.SetLine(2, Constants.Operation.FROM + Path);
// dlg.SetLine(3, "To: " + secondView.Path);
dlg.SetLine(3, Constants.Dialog.TO + secondView.Path); // already defined in Dialog
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -864,7 +864,7 @@
if (dlg.IsConfirmed)
{
ShowDialogOperation(GUIDialogOperation.DialogType.MOVE);
- MoveDirectory(item.Path, secondView.Path + "\\" + GetFilename(item.Path));
+ MoveDirectory(item.Path, CombinePathAndFilename(secondView.Path, GetFilename(item.Path)));
Update();
secondView.Update();
dlgOp.Close();
@@ -878,12 +878,12 @@
if (info.IsPath)
{
ShowDialogOperation(GUIDialogOperation.DialogType.MOVE);
- MoveDirectory(info.Path.Path, secondView.Path + "\\" + GetFilename(info.Path.Path));
+ MoveDirectory(info.Path.Path, CombinePathAndFilename(secondView.Path, GetFilename(info.Path.Path)));
dlgOp.Close();
}
else
{
- MoveSingleFile(info.File.Path + "\\" + info.File.Name, secondView.Path + "\\" + info.File.Name);
+ MoveSingleFile(CombinePathAndFilename(info.File.Path, info.File.Name), CombinePathAndFilename(secondView.Path, info.File.Name));
}
}
@@ -899,7 +899,7 @@
dlg.Reset();
/* dlg.SetHeading("Moving file");
dlg.SetLine(1, "The file \"" + GetFilename(src) + "\"");
- dlg.SetLine(2, "alread exists!");
+ dlg.SetLine(2, "already exists!");
dlg.SetLine(3, "Do you want to overwrite it?"); */
dlg.SetHeading(Constants.Operation.MOVINGFILE);
dlg.SetLine(1, Constants.Operation.THEFILE + "\"" + GetFilename(src) + "\"");
@@ -931,7 +931,7 @@
dlg.Reset();
/* dlg.SetHeading("Moving directory");
dlg.SetLine(1, "The directory \"" + GetFilename(dest) + "\"");
- dlg.SetLine(2, "alread exists!");
+ dlg.SetLine(2, "already exists!");
dlg.SetLine(3, "Do you want to overwrite it?"); */
dlg.SetHeading(Constants.Operation.MOVINGDIR);
dlg.SetLine(1, Constants.Operation.THEDIR + "\"" + GetFilename(dest) + "\"");
@@ -986,7 +986,7 @@
}
else
{
- DeleteSingleFile(info[i].File.Path + "\\" + info[i].File.Name);
+ DeleteSingleFile(CombinePathAndFilename(info[i].File.Path, info[i].File.Name));
}
}
@@ -1046,7 +1046,7 @@
dlg.SetLine(2, "the file \"" + item.Label + "\"?"); */
dlg.SetHeading(Constants.Operation.DELETEFILE);
dlg.SetLine(1, Constants.Operation.WANTDELETE);
- dlg.SetLine(2, Constants.Operation.THEFILE + "\"" + item.Label + "\"?");
+ dlg.SetLine(2, LowercaseFirst(Constants.Operation.THEFILE) + "\"" + item.Label + "\"?");
dlg.SetLine(3, " ");
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -1062,7 +1062,7 @@
dlg.SetLine(3, "After deleting the file CANNOT BE RESTORED!"); */
dlg.SetHeading(Constants.Operation.DELETEFILE);
dlg.SetLine(1, Constants.Operation.WANTDELETE);
- dlg.SetLine(2, Constants.Operation.THEFILE + "\"" + item.Label + "\"?");
+ dlg.SetLine(2, LowercaseFirst(Constants.Operation.THEFILE) + "\"" + item.Label + "\"?");
dlg.SetLine(3, Constants.Operation.AFTERDELETE);
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -1071,41 +1071,7 @@
if (b)
{
- string p;
- if ((item.Path.EndsWith("\\")) || (item.Path.EndsWith("/")))
- {
- p = item.Path.Substring(0, item.Path.Length - 1);
- }
- else
- {
- p = item.Path;
- }
-
- DeleteSingleFile(p + "\\" + item.Label);
-
- /*if (this.DeleteFilesToTrashcan)
- {
- try
- {
- FileIO.FileSystem.DeleteFile(p + "\\" + item.Label, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin);
- }
- catch (Exception e)
- {
- ExceptionViewer.ShowException(e);
- }
- }
- else
- {
- try
- {
- FileIO.FileSystem.DeleteFile(p + "\\" + item.Label, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently);
- }
- catch (Exception e)
- {
- ExceptionViewer.ShowException(e);
- }
- }*/
-
+ DeleteSingleFile(CombinePathAndFilename(item.Path, item.Label));
Update();
}
}
@@ -1188,15 +1154,9 @@
{
if (info.Path.Name.Equals(item.Label))
{
- string p = info.Path.Path;
- if ((p.EndsWith("\\")) || p.EndsWith("/"))
- {
- p = p.Substring(0, p.Length - 1);
- }
-
try
{
- System.IO.Directory.Move(p, GetPath(p) + "\\" + keyboard.Text);
+ System.IO.Directory.Move(SanitizePath(info.Path.Path), CombinePathAndFilename(GetPath(SanitizePath(info.Path.Path)), keyboard.Text));
}
catch (Exception)
{
@@ -1221,7 +1181,7 @@
{
try
{
- System.IO.File.Move(info.File.Path + "\\" + info.File.Name, info.File.Path + "\\" + keyboard.Text);
+ System.IO.File.Move(CombinePathAndFilename(info.File.Path, info.File.Name), CombinePathAndFilename(info.File.Path, keyboard.Text));
}
catch (Exception)
{
@@ -1256,7 +1216,7 @@
{
try
{
- System.IO.Directory.CreateDirectory(currentPath + "\\" + keyboard.Text);
+ System.IO.Directory.CreateDirectory(CombinePathAndFilename(currentPath, keyboard.Text));
Update();
}
catch (Exception)
@@ -1358,7 +1318,7 @@
{
try
{
- System.IO.File.Decrypt(info.File.Path + "\\" + info.File.Name);
+ System.IO.File.Decrypt(CombinePathAndFilename(info.File.Path, info.File.Name));
}
catch (Exception e)
{
@@ -1369,7 +1329,7 @@
{
try
{
- System.IO.File.Encrypt(info.File.Path + "\\" + info.File.Name);
+ System.IO.File.Encrypt(CombinePathAndFilename(info.File.Path, info.File.Name));
}
catch (Exception e)
{
@@ -1397,7 +1357,7 @@
{
try
{
- System.IO.File.Decrypt(info.File.Path + "\\" + info.File.Name);
+ System.IO.File.Decrypt(CombinePathAndFilename(info.File.Path, info.File.Name));
}
catch (Exception e)
{
@@ -1408,7 +1368,7 @@
{
try
{
- System.IO.File.Encrypt(info.File.Path + "\\" + info.File.Name);
+ System.IO.File.Encrypt(CombinePathAndFilename(info.File.Path, info.File.Name));
}
catch (Exception e)
{
@@ -1492,7 +1452,6 @@
{
if (System.IO.File.Exists(s))
{
-
if (encrypt)
{
dlgOp.SetCurrentFile(GetFilename(s));
@@ -1707,13 +1666,7 @@
{
if (info.File.Name.Equals(item.Label))
{
- string p = info.File.Path;
- if ((info.File.Path.EndsWith("\\")) || (info.File.Path.EndsWith("/")))
- {
- p = p.Substring(0, p.Length - 1);
- }
-
- DrivesView.SetFileAttributes(p + "\\" + info.File.Name, this.CreateFileAtributes2(!info.File.Hidden, info.File.SystemFile, info.File.ReadOnly));
+ DrivesView.SetFileAttributes(CombinePathAndFilename(SanitizePath(info.File.Path), info.File.Name), this.CreateFileAtributes2(!info.File.Hidden, info.File.SystemFile, info.File.ReadOnly));
Update();
return;
}
@@ -1862,13 +1815,7 @@
{
if (info.File.Name.Equals(item.Label))
{
- string p = info.File.Path;
- if ((info.File.Path.EndsWith("\\")) || (info.File.Path.EndsWith("/")))
- {
- p = p.Substring(0, p.Length - 1);
- }
-
- DrivesView.SetFileAttributes(p + "\\" + info.File.Name, this.CreateFileAtributes2(info.File.Hidden, info.File.SystemFile, !info.File.ReadOnly));
+ DrivesView.SetFileAttributes(CombinePathAndFilename(SanitizePath(info.File.Path), info.File.Name), this.CreateFileAtributes2(info.File.Hidden, info.File.SystemFile, !info.File.ReadOnly));
Update();
return;
}
@@ -1975,27 +1922,11 @@
dlg.SetLine(2, Constants.Playlist.CURRENTFOLDERSUBDIR);
if (item.IsFolder)
{
- if (currentPath.Equals(currentDrive))
- {
- dlg.SetLine(3, "(" + currentDrive + item.Label + ")");
- }
- else
- {
- //dlg.SetLine(3, "(" + currentDrive + "..\\" + item.Label + ")");
- dlg.SetLine(3, "(" + currentPath + "\\" + item.Label + ")");
- }
+ dlg.SetLine(3, "(" + CombinePathAndFilename(currentPath, item.Label) + ")");
}
else
{
- if (currentPath.Equals(currentDrive))
- {
- dlg.SetLine(3, "(" + currentDrive + ")");
- }
- else
- {
- //dlg.SetLine(3, "(" + currentDrive + "..\\" + GetFilename(currentPath) + ")");
- dlg.SetLine(3, "(" + currentPath + ")");
- }
+ dlg.SetLine(3, "(" + currentPath + ")");
}
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -2019,7 +1950,7 @@
//dlgOp.SetCurrentFile(GetFilename("Reading files . . ."));
// dlgOp.SetText("Reading files . . .");
dlgOp.SetText(Constants.Dialog.READFILE);
- ReadDirectories(path, subfolders, Utils.AudioExtensions/*, lstFiles*/);
+ ReadDirectories(path, subfolders, Utils.AudioExtensions);
if (lstFiles.Count == 0)
{
@@ -2036,7 +1967,7 @@
MediaPortal.Profile.Settings s = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
string plsPath = s.GetValueAsString("music", "playlists", string.Empty);
- System.IO.StreamWriter w = System.IO.File.CreateText(plsPath + "\\" + plsFilename);
+ System.IO.StreamWriter w = System.IO.File.CreateText(CombinePathAndFilename(plsPath, plsFilename));
w.WriteLine("#EXTM3U");
foreach (string f in lstFiles)
@@ -2103,7 +2034,7 @@
MediaPortal.Profile.Settings s = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
string plsPath = s.GetValueAsString("music", "playlists", string.Empty);
- System.IO.StreamWriter w = System.IO.File.CreateText(plsPath + "\\" + keyboard.Text.Trim() + ".m3u");
+ System.IO.StreamWriter w = System.IO.File.CreateText(CombinePathAndFilename(plsPath, keyboard.Text.Trim() + ".m3u"));
w.WriteLine("#EXTM3U");
foreach (string f in lstFiles)
@@ -2138,27 +2069,11 @@
dlg.SetLine(2, Constants.Playlist.CURRENTFOLDERSUBDIR);
if (item.IsFolder)
{
- if (currentPath.Equals(currentDrive))
- {
- dlg.SetLine(3, "(" + currentDrive + item.Label + ")");
- }
- else
- {
- //dlg.SetLine(3, "(" + currentDrive + "..\\" + item.Label + ")");
- dlg.SetLine(3, "(" + currentPath + "\\" + item.Label + ")");
- }
+ dlg.SetLine(3, "(" + CombinePathAndFilename(currentPath, item.Label) + ")");
}
else
{
- if (currentPath.Equals(currentDrive))
- {
- dlg.SetLine(3, "(" + currentDrive + ")");
- }
- else
- {
- //dlg.SetLine(3, "(" + currentDrive + "..\\" + GetFilename(currentPath) + ")");
- dlg.SetLine(3, "(" + currentPath + ")");
- }
+ dlg.SetLine(3, "(" + currentPath + ")");
}
dlg.DoModal(GUIWindowManager.ActiveWindow);
@@ -2199,7 +2114,7 @@
MediaPortal.Profile.Settings s = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
string plsPath = s.GetValueAsString("movies", "playlists", string.Empty);
- System.IO.StreamWriter w = System.IO.File.CreateText(plsPath + "\\" + plsFilename);
+ System.IO.StreamWriter w = System.IO.File.CreateText(CombinePathAndFilename(plsPath, plsFilename));
w.WriteLine("#EXTM3U");
foreach (string f in lstFiles)
@@ -2265,7 +2180,7 @@
MediaPortal.Profile.Settings s = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
string plsPath = s.GetValueAsString("movies", "playlists", string.Empty);
- System.IO.StreamWriter w = System.IO.File.CreateText(plsPath + "\\" + keyboard.Text.Trim() + ".m3u");
+ System.IO.StreamWriter w = System.IO.File.CreateText(CombinePathAndFilename(plsPath, keyboard.Text.Trim() + ".m3u"));
w.WriteLine("#EXTM3U");
foreach (string f in lstFiles)
@@ -2347,7 +2262,7 @@
else
{
w.WriteLine("#EXTINF:0," + item.Label);
- w.WriteLine(item.Path + "\\" + item.Label);
+ w.WriteLine(CombinePathAndFilename(item.Path, item.Label));
}
w.Close();
@@ -2507,7 +2422,7 @@
else
{
w.WriteLine("#EXTINF:0," + item.Label);
- w.WriteLine(item.Path + "\\" + item.Label);
+ w.WriteLine(CombinePathAndFilename(item.Path, item.Label));
}
w.Close();
@@ -2610,12 +2525,8 @@
// dlg.SetHeading("Confirm");
dlg.SetHeading(Constants.Dialog.CONFIRM);
- // dlg.SetLine(1, " ");
- dlg.SetLine(1, " ");
- // dlg.SetLine(2, "Empty Recycle Bin" + "?");
- dlg.SetLine(2, Constants.Dialog.EMPTYRECYCLEBIN + "?");
- // dlg.SetLine(3, " ");
- dlg.SetLine(3, " ");
+ // dlg.SetLine(1, "Empty Recycle Bin" + "?");
+ dlg.SetLine(1, Constants.Dialog.EMPTYRECYCLEBIN + "?");
dlg.DoModal(GUIWindowManager.ActiveWindow);
if (dlg.IsConfirmed)
@@ -2721,7 +2632,7 @@
if (item.Label.Trim().Equals(".."))
{
- currentPath = this.GetPath(currentPath);
+ currentPath = item.Path; //this.GetPath(currentPath);
LoadPath();
FillListControl();
@@ -2769,8 +2680,8 @@
{
//MediaPortal.Player.g_Player.Play(info.File.Path + "\\" + info.File.Name);
MediaPortal.Player.g_Player.Play(CombinePathAndFilename(info.File.Path, info.File.Name));
- GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
-
+ MediaPortal.Player.g_Player.ShowFullScreenWindow();
+ //GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
return;
}
}
@@ -2782,8 +2693,8 @@
// Play video file
//MediaPortal.Player.g_Player.Play(info.File.Path + "\\" + info.File.Name);
MediaPortal.Player.g_Player.Play(CombinePathAndFilename(info.File.Path, info.File.Name));
- GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
-
+ MediaPortal.Player.g_Player.ShowFullScreenWindow();
+ //GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO);
return;
}
}
@@ -2807,7 +2718,7 @@
if (e.Equals(ext))
{
TextPreview txt = (TextPreview)GUIWindowManager.GetWindow(Constants.WindowIDs.TEXTVIEWER);
- if (!txt.LoadTextFile(info.File.Path + "\\" + info.File.Name))
+ if (!txt.LoadTextFile(CombinePathAndFilename(info.File.Path, info.File.Name)))
{
return;
}
@@ -2832,7 +2743,7 @@
if (dlg.IsConfirmed)
{
TextPreview txt = (TextPreview)GUIWindowManager.GetWindow(Constants.WindowIDs.TEXTVIEWER);
- txt.LoadTextFile(info.File.Path + "\\" + info.File.Name);
+ txt.LoadTextFile(CombinePathAndFilename(info.File.Path, info.File.Name));
txt.DoModal(winId);
}
@@ -2962,6 +2873,18 @@
#endregion
#region Utils
+ private string SanitizePath(string path)
+ {
+ if ((path.EndsWith("\\")) || (path.EndsWith("/")))
+ {
+ return path.Substring(0, path.Length - 1);
+ }
+ else
+ {
+ return path;
+ }
+ }
+
private void SetFileExplorerProperty(string propertyName, string propertyValue)
{
if (string.IsNullOrEmpty(propertyValue))
@@ -2969,7 +2892,7 @@
if (lstId == Constants.ControlIDs.LISTBOX_LEFT)
GUIPropertyManager.SetProperty("#FileExplorer.Left." + propertyName, propertyValue);
- if (lstId == Constants.ControlIDs.LISTBOX_RIGHT)
+ else if (lstId == Constants.ControlIDs.LISTBOX_RIGHT)
GUIPropertyManager.SetProperty("#FileExplorer.Right." + propertyName, propertyValue);
else
{
@@ -3105,6 +3028,8 @@
private string GetPath(string filePath)
{
+ filePath = SanitizePath(filePath);
+
int index = filePath.LastIndexOf("\\");
if (index == -1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|