From: <fr...@us...> - 2007-01-31 19:32:59
|
Revision: 61 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=61&view=rev Author: framug Date: 2007-01-31 11:32:51 -0800 (Wed, 31 Jan 2007) Log Message: ----------- Add My Explorer plugin Added Paths: ----------- trunk/plugins/My Explorer/ trunk/plugins/My Explorer/GUIExplorer.cs trunk/plugins/My Explorer/My Explorer.csproj trunk/plugins/My Explorer/My Explorer.sln trunk/plugins/My Explorer/My Explorer.suo trunk/plugins/My Explorer/Properties/ trunk/plugins/My Explorer/Properties/AssemblyInfo.cs trunk/plugins/My Explorer/SetupForm.cs trunk/plugins/My Explorer/SetupForm.resx trunk/plugins/My Explorer/bin/ trunk/plugins/My Explorer/bin/Release/ trunk/plugins/My Explorer/bin/Release/Core.dll trunk/plugins/My Explorer/bin/Release/Dialogs.dll trunk/plugins/My Explorer/bin/Release/My Explorer.dll trunk/plugins/My Explorer/bin/Release/My Explorer.pdb trunk/plugins/My Explorer/bin/Release/Utils.dll Added: trunk/plugins/My Explorer/GUIExplorer.cs =================================================================== --- trunk/plugins/My Explorer/GUIExplorer.cs (rev 0) +++ trunk/plugins/My Explorer/GUIExplorer.cs 2007-01-31 19:32:51 UTC (rev 61) @@ -0,0 +1,825 @@ +/* + * Copyright (C) 2005 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#region usings +using System; +using System.IO; +using System.Collections; +using MediaPortal.Util; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +#endregion + +namespace MediaPortal.GUI.GUIExplorer +{ + /// <summary> + /// Summary description for GUIExplorer + /// </summary> + public class GUIExplorer : GUIWindow + { + public static int WINDOW_STATUS = 770; + + #region Private Enumerations + + enum Controls + { + CONTROL_SELECT_SOURCE = 2, + CONTROL_SELECT_DEST = 3, + CONTROL_COPY = 4, + CONTROL_MOVE = 5, + CONTROL_DELETE = 6, + CONTROL_MAKE_DIR = 7, + CONTROL_RESET_SELECT = 8, + CONTROL_MARK_ALL = 9, + CONTROL_TRASHCAN = 10, + CONTROL_LIST_DIR = 20 + }; + + enum States + { + STATE_MAIN = 0, + STATE_SELECT_SOURCE = 1, + STATE_SELECT_DEST = 2, + STATE_COPY = 3, + STATE_MAKE_DIR = 4, + STATE_RESET_SELECT = 5 + }; + + private States currentState = States.STATE_MAIN; + + #endregion + + #region Private Variables + private struct file + { + public string name; + public long size; + public string fullpath; + public string path; + } + + string[] video = new string[20]; // video shares folder + string[] vname = new string[20]; // video share names + string[] sound = new string[20]; // sound shares folder + string[] sname = new string[20]; // sound shares names + string[] pictures = new string[20]; // pictures shares folder + string[] pname = new string[20]; // pictures shares names + + private string tempFolder=""; // trashcan folder + private bool showOnlyShares=false; // shows only shares in destination folder + private bool enableDelete=false; // shows delete button + private bool deleteImmed=false; // enable immediate delete funtion + private bool deleteTemp=false; // enable trashcan + + private ArrayList files = new ArrayList(); + private ArrayList selected = new ArrayList(); + private string tmpStr; + private ArrayList currentExt= new ArrayList(); + private string currentFolder=null; + private string[] drives=new string[27]; + private string[] drivesCd=new string[27]; + private int driveCount=0; + private int driveCdCount=0; + private long actSize=0; + private int fileCount=0; + #endregion + + #region Constructor + public GUIExplorer() + { + // + // TODO: Add constructor logic here + // + } + #endregion + + #region Overrides + public override int GetID + { + get { return WINDOW_STATUS; } + set { base.GetID = value; } + } + + public override bool Init() + { + return Load (GUIGraphicsContext.Skin+@"\myexplorer.xml"); + } + + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + GUIWindowManager.ShowPreviousWindow(); + return; + } + base.OnAction(action); + } + + public override bool OnMessage(GUIMessage message) + { + switch ( message.Message ) + { + case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: // MyExplorer starts + base.OnMessage(message); + GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(2200)); + GUIPropertyManager.SetProperty("#explorer_title",GUILocalizeStrings.Get(2200)); + GUIPropertyManager.SetProperty("#explorer_size"," "); + LoadShareSettings(); // loads showShares settings from XML + driveCount=0; + driveCdCount=0; + GetDrives(); // loads all drives + LoadSettings(); // loads all settings from XML + ResetValues(); + currentExt.Add("*"); + return true; + case GUIMessage.MessageType.GUI_MSG_CLICKED: + //get sender control + base.OnMessage(message); + int iControl=message.SenderControlId; + if (iControl==(int)Controls.CONTROL_SELECT_SOURCE) // select source + { + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_SELECT_DEST); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_COPY); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_MOVE); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_DELETE); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_MAKE_DIR); + currentState=States.STATE_SELECT_SOURCE; + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST_DIR); + GUIPropertyManager.SetProperty("#explorer_title",GUILocalizeStrings.Get(2201)); + LoadDriveListControl(true); + currentFolder=""; + actSize=0; + return true; + } + if (iControl==(int)Controls.CONTROL_SELECT_DEST) // select destination + { + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_COPY); + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_MOVE); + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_MAKE_DIR); + currentState=States.STATE_SELECT_DEST; + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST_DIR); + GUIPropertyManager.SetProperty("#explorer_title",GUILocalizeStrings.Get(2202)); + LoadDriveListControl(false); + currentFolder=""; + actSize=0; + return true; + } + if (iControl==(int)Controls.CONTROL_TRASHCAN) // select trashcan + { + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_COPY); + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_MOVE); + currentState=States.STATE_SELECT_SOURCE; + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST_DIR); + GUIPropertyManager.SetProperty("#explorer_title",GUILocalizeStrings.Get(2202)); + LoadListControl(tempFolder,currentExt); + currentFolder=tempFolder; + actSize=0; + return true; + } + if (iControl==(int)Controls.CONTROL_COPY || iControl==(int)Controls.CONTROL_MOVE) // select copy data + { + if (currentState==States.STATE_SELECT_DEST) + { + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + if (null==dlgYesNo) break; + dlgYesNo.SetHeading(GUILocalizeStrings.Get(2200)); + if (iControl==(int)Controls.CONTROL_COPY) + { + dlgYesNo.SetLine(2,GUILocalizeStrings.Get(2209)); + GUIPropertyManager.SetProperty("#explorer_size",GUILocalizeStrings.Get(2211)); + } + else + { + dlgYesNo.SetLine(2,GUILocalizeStrings.Get(2214)); + GUIPropertyManager.SetProperty("#explorer_size",GUILocalizeStrings.Get(2215)); + } + dlgYesNo.DoModal(GetID); + if (dlgYesNo.IsConfirmed) + { + foreach(file f in selected) + { + if (iControl==(int)Controls.CONTROL_COPY) + { + Move(false,f.fullpath, f.name, currentFolder+"\\"); + } + else + { + Move(true,f.fullpath, f.name, currentFolder+"\\"); + } + } + GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlgOk.SetHeading(GUILocalizeStrings.Get(2200)); + if (iControl==(int)Controls.CONTROL_COPY) + { + dlgOk.SetLine(2,fileCount.ToString()+" "+GUILocalizeStrings.Get(2210)); + } + else + { + dlgOk.SetLine(2,fileCount.ToString()+" "+GUILocalizeStrings.Get(2216)); + } + dlgOk.DoModal(GetID); + } + ResetValues(); + LoadListControl(currentFolder,currentExt); + } + } + if (iControl==(int)Controls.CONTROL_MAKE_DIR) // select make directory + { + if (currentState==States.STATE_SELECT_DEST) + { + int activeWindow=(int)GUIWindowManager.ActiveWindow; + GUIPropertyManager.SetProperty("#explorer_title",GUILocalizeStrings.Get(2204)); +//fmu VirtualSearchKeyboard keyBoard=(VirtualSearchKeyboard)GUIWindowManager.GetWindow(1001); +//fmu keyBoard.Text = ""; +//fmu keyBoard.Reset(); +//fmu keyBoard.TextChanged+=new MediaPortal.Dialogs.VirtualSearchKeyboard.TextChangedEventHandler(keyboard_TextChanged); // add the event handler +//fmu keyBoard.DoModal(activeWindow); // show it... +//fmu keyBoard.TextChanged-=new MediaPortal.Dialogs.VirtualSearchKeyboard.TextChangedEventHandler(keyboard_TextChanged); // remove the handler +//fmu string verStr = keyBoard.Text; + + VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); + keyboard.Text = ""; + keyboard.Reset(); + keyboard.TextChanged += new MediaPortal.Dialogs.VirtualKeyboard.TextChangedEventHandler(keyboard_TextChanged); // add the event handler + keyboard.DoModal(activeWindow); // show it... + keyboard.TextChanged -= new MediaPortal.Dialogs.VirtualKeyboard.TextChangedEventHandler(keyboard_TextChanged); // remove the handler + string verStr = keyboard.Text; + + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + if (null == dlgYesNo) break; + dlgYesNo.SetHeading(GUILocalizeStrings.Get(2200)); + dlgYesNo.SetLine(1,GUILocalizeStrings.Get(2207)); + dlgYesNo.SetLine(2,verStr+" "+GUILocalizeStrings.Get(2208)); + dlgYesNo.DoModal(GetID); + if (dlgYesNo.IsConfirmed) + { + string path = currentFolder+"\\"+verStr; + try + { + // Determine whether the directory exists. + if (Directory.Exists(path)) + { + GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlgOk.SetHeading(GUILocalizeStrings.Get(2200)); + dlgOk.SetLine(2,GUILocalizeStrings.Get(2224)); + dlgOk.DoModal(GetID); + } + else + { + DirectoryInfo di = Directory.CreateDirectory(path); + GUIDialogOK dlgOk2 = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlgOk2.SetHeading(GUILocalizeStrings.Get(2200)); + dlgOk2.SetLine(2,GUILocalizeStrings.Get(2224)); + dlgOk2.DoModal(GetID); + } + } + catch (Exception ) + { +//fmu Log.Write("Error Make Dir"); + Log.Error("Error Make Dir"); + } + LoadListControl(currentFolder,currentExt); + } + } + } + if (iControl==(int)Controls.CONTROL_RESET_SELECT) // select reset all selections + { + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + if (null==dlgYesNo) break; + dlgYesNo.SetHeading(GUILocalizeStrings.Get(2200)); + dlgYesNo.SetLine(2,GUILocalizeStrings.Get(2205)); + dlgYesNo.DoModal(GetID); + if (dlgYesNo.IsConfirmed) + { + ResetValues(); + } + return true; + } + + if (iControl==(int)Controls.CONTROL_MARK_ALL) // select mark all + { + if (currentState==States.STATE_SELECT_SOURCE) + { + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_SELECT_DEST); // you can select destination only when a file is selected + if(enableDelete==true) + { + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_DELETE); // you can delete files only when a file is selected + } + int count = GUIControl.GetItemCount(GetID, (int)Controls.CONTROL_LIST_DIR); + for (int i=0; i<count; i++) + { + GUIListItem item = GUIControl.GetListItem(GetID, (int)Controls.CONTROL_LIST_DIR,i); + if (item.IconImage!="check-box.png" && !item.Label.StartsWith("\\..") && !item.Label.StartsWith("\\") && item.Label.Substring(1,1)!=":") + { + item.IconImage = "check-box.png"; + file fl = new file(); + fl.name=item.Label; + fl.fullpath=currentFolder+"\\"+item.Label; + fl.path=currentFolder; + + foreach(file f in files) + { + if (f.name==item.Label) + { + actSize=actSize+f.size; + fl.size=f.size; + break; + } + } + selected.Add(fl); + fileCount++; +//fmu tmpStr=fileCount.ToString()+ " Files "+Utils.GetSize(actSize)+" "; + tmpStr = fileCount.ToString() + " Files " + Util.Utils.GetSize(actSize) + " "; + GUIPropertyManager.SetProperty("#explorer_size", tmpStr); + } + } + } + } + if (iControl==(int)Controls.CONTROL_DELETE) // delete selected files + { + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + if (null==dlgYesNo) break; + dlgYesNo.SetHeading(GUILocalizeStrings.Get(2200)); + dlgYesNo.SetLine(2,GUILocalizeStrings.Get(2221)); + GUIPropertyManager.SetProperty("#explorer_size",GUILocalizeStrings.Get(2211)); + dlgYesNo.DoModal(GetID); + if (dlgYesNo.IsConfirmed) + { + foreach(file f in selected) + { + if(deleteImmed==true) + { +//fmu Utils.FileDelete(f.fullpath); + Util.Utils.FileDelete(f.fullpath); + } + else + { + if(deleteTemp==true) + { + try + { + if(currentFolder==tempFolder) + { +//fmu Utils.FileDelete(f.fullpath); + Util.Utils.FileDelete(f.fullpath); + } + else + { + FileInfo fi = new FileInfo(f.fullpath); + fi.MoveTo(tempFolder+"\\"+f.name); + } + } + catch (Exception) + { +//fmu Log.Write("MyExplorer Delete Error: {0} | {1}",f.fullpath,tempFolder); + Log.Error("MyExplorer Delete Error: {0} | {1}", f.fullpath, tempFolder); + } + } + } + } + GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlgOk.SetHeading(GUILocalizeStrings.Get(2200)); + dlgOk.SetLine(2,fileCount.ToString()+" "+GUILocalizeStrings.Get(2222)); + dlgOk.DoModal(GetID); + } + ResetValues(); + LoadListControl(currentFolder,currentExt); + } + if (iControl==(int)Controls.CONTROL_LIST_DIR) // select list dir + { + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED,GetID,0,iControl,0,0,null); + OnMessage(msg); + int iItem=(int)msg.Param1; + int iAction=(int)message.Param1; + if (iAction == (int)Action.ActionType.ACTION_SELECT_ITEM) + { + GUIListItem item = GUIControl.GetSelectedListItem(GetID, (int)Controls.CONTROL_LIST_DIR ); + if (item.Label.StartsWith("..")) // go back folder + { + if (item.Path=="") + LoadDriveListControl(true); + else + LoadListControl(item.Path,currentExt); + } + else if(item.Label.StartsWith("(")) + { + if (item.Label.Contains(":)")) LoadListControl(item.Label[1] + @":\", currentExt); + else LoadListControl(item.Path, currentExt); // is a folder + } + else if (item.Label.StartsWith("[")) // is a share + { + String shareName=item.Label.Substring(1); + shareName=shareName.Substring(0,shareName.Length-1); + bool shareFound = false; + for (int i=0; i<20; i++) + { + if (pname[i]==shareName) + { + currentFolder=pictures[i]; + LoadListControl(currentFolder,currentExt); + shareFound = true; + break; + } + if (sname[i]==shareName) + { + currentFolder=sound[i]; + LoadListControl(currentFolder,currentExt); + shareFound = true; + break; + } + if (vname[i]==shareName) + { + currentFolder=video[i]; + LoadListControl(currentFolder,currentExt); + shareFound = true; + break; + } + } + if (shareFound) LoadListControl(currentFolder,currentExt); + else LoadListControl(item.Path, currentExt); // is a folder + } + else if (item.IsFolder) // is a folder + { + LoadListControl(item.Path,currentExt); + } + else if (item.Label.Substring(1,1)==":") // is a drive + { + currentFolder=item.Label; + if (currentFolder!=String.Empty) + LoadListControl(currentFolder,currentExt); + else + LoadDriveListControl(true); + } + else + { + if (currentState==States.STATE_SELECT_SOURCE) // mark files only in source select mode + { + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_SELECT_DEST); // you can select destination only when a file is selected + if(enableDelete==true) + { + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_DELETE); // you can delete files only when a file is selected + } + if (item.IconImage=="check-box.png") // if file selected then unselect now + { + item.FreeIcons(); + int indx=0; + int indxm=-1; + long s=0; + foreach(file fil in selected) + { + if (item.Label==fil.name) + { + indxm=indx; + s=fil.size; + break; + } + indx++; + } + if (indxm>=0) + { + selected.RemoveAt(indxm); + actSize=actSize-s; + fileCount--; + } + } + else + { // select file + item.IconImage = "check-box.png"; + int indx=currentFolder.IndexOf("\\\\"); + if (indx>0) + { + currentFolder=currentFolder.Remove(indx,1); + } + file fl = new file(); + fl.name=item.Label; + fl.fullpath=currentFolder+"\\"+item.Label; + fl.path=currentFolder; + + foreach(file f in files) + { + if (f.name==item.Label) + { + actSize=actSize+f.size; + fl.size=f.size; + break; + } + } + selected.Add(fl); + fileCount++; + } +//fmu tmpStr=fileCount.ToString()+ " Files "+Utils.GetSize(actSize)+" "; + tmpStr = fileCount.ToString() + " Files " + Util.Utils.GetSize(actSize) + " "; + GUIPropertyManager.SetProperty("#explorer_size", tmpStr); + } + } + } + return true; + } + return true; + } + return base.OnMessage (message); + } + + #endregion + + #region Private Methods + + /// <summary> + /// Reset all Values to start settings + /// </summary> + private void ResetValues() + { + fileCount=0; + selected.Clear(); + currentState=States.STATE_MAIN; + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST_DIR); + GUIPropertyManager.SetProperty("#explorer_size"," "); + if(deleteTemp==false) + { + GUIControl.HideControl(GetID,(int)Controls.CONTROL_TRASHCAN); + } + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_SELECT_DEST); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_COPY); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_MOVE); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_DELETE); + GUIControl.DisableControl(GetID,(int)Controls.CONTROL_MAKE_DIR); + GUIControl.EnableControl(GetID,(int)Controls.CONTROL_SELECT_SOURCE); + } + + /// <summary> + /// Loads files from folder in a list control + /// </summary> + private void LoadListControl(string folder,ArrayList Exts) + { + //clear the list +//fmu folder=Utils.RemoveTrailingSlash(folder); + folder = Util.Utils.RemoveTrailingSlash(folder); + file f = new file(); + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST_DIR); + VirtualDirectory Directory; + ArrayList itemlist; + Directory = new VirtualDirectory(); + Directory.SetExtensions(Exts); + itemlist = Directory.GetDirectory(folder); + + foreach (GUIListItem item in itemlist) + { + if(!item.IsFolder) // if item a folder + { + GUIListItem pItem = new GUIListItem(item.FileInfo.Name); + pItem.IsFolder=false; + pItem.Path=String.Format(@"{0}\{1}", folder,item.FileInfo.Name); + GUIControl.AddListItemControl(GetID,(int)Controls.CONTROL_LIST_DIR,pItem); + f.name=item.FileInfo.Name; + f.size=item.FileInfo.Length; + files.Add(f); + } + else + { + GUIListItem pItem = new GUIListItem(item.Label); + pItem.IsFolder=true; + pItem.Path=String.Format(@"{0}\{1}", folder,item.Label); + if (item.Label=="..") + { + string prevFolder=""; + int pos=folder.LastIndexOf(@"\"); + if (pos>=0) prevFolder=folder.Substring(0,pos); + pItem.Path=prevFolder; + } +//fmu Utils.SetDefaultIcons(pItem); + Util.Utils.SetDefaultIcons(pItem); + GUIControl.AddListItemControl(GetID, (int)Controls.CONTROL_LIST_DIR, pItem); + } + } + string strObjects =String.Format("{0} {1}",GUIControl.GetItemCount(GetID,(int)Controls.CONTROL_LIST_DIR).ToString(), GUILocalizeStrings.Get(632)); + GUIPropertyManager.SetProperty("#itemcount",strObjects); + + currentFolder=folder; + } + + /// <summary> + /// Loads drivelist and shares in a list control + /// </summary> + private void LoadDriveListControl(bool cd) + { + currentFolder=""; + //clear the list + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST_DIR); + + cd = false; + + if (cd==true) + { + for (int i=0; i<driveCdCount; i++) + { + GUIListItem pItem = new GUIListItem(drivesCd[i]); + pItem.Path=drivesCd[i]; + pItem.IsFolder=true; +//fmu Utils.SetDefaultIcons(pItem); + Util.Utils.SetDefaultIcons(pItem); + GUIControl.AddListItemControl(GetID, (int)Controls.CONTROL_LIST_DIR, pItem); + } + } + else + { + for (int i=0; i<driveCount; i++) + { + GUIListItem pItem = new GUIListItem(drives[i]); + pItem.Path=drives[i]; + pItem.IsFolder=true; +//fmu Utils.SetDefaultIcons(pItem); + Util.Utils.SetDefaultIcons(pItem); + GUIControl.AddListItemControl(GetID, (int)Controls.CONTROL_LIST_DIR, pItem); + } + } + + string strObjects = String.Format("{0} {1}", GUIControl.GetItemCount(GetID, (int)Controls.CONTROL_LIST_DIR).ToString(), GUILocalizeStrings.Get(632)); + GUIPropertyManager.SetProperty("#itemcount", strObjects); + } + + + void keyboard_TextChanged(int kindOfSearch,string data) + { + // + } + + enum DriveType + { + Removable = 2, + Fixed = 3, + RemoteDisk = 4, + CD = 5, + DVD = 5, + RamDisk = 6 + } + + /// <summary> + /// fills the drive array. + /// when showOnlyShares==false then the array drives contains all drives witout CD. + /// array drivesCd contains all drives + /// </summary> + void GetDrives() + { + foreach(string drive in Environment.GetLogicalDrives()) + { + DriveType driveType = (DriveType)Util.Utils.getDriveType(drive); + string name=""; + + switch(driveType) + { + case DriveType.Removable: + name=String.Format("({0}:) Removable",drive.Substring(0, 1).ToUpper()); + break; + case DriveType.Fixed: + name=String.Format("({0}:) Fixed",drive.Substring(0, 1).ToUpper()); + break; + case DriveType.RemoteDisk: + name=String.Format("({0}:) Remote",drive.Substring(0, 1).ToUpper()); + break; + case DriveType.DVD: + name=String.Format("({0}:) CD/DVD",drive.Substring(0, 1).ToUpper()); + break; + case DriveType.RamDisk: + name=String.Format("({0}:) Ram",drive.Substring(0, 1).ToUpper()); + break; + } + + if(showOnlyShares == false) + { + drives[driveCount]=name; + driveCount++; + } + + if(driveType == DriveType.DVD) + { + drivesCd[driveCdCount]=name; + driveCdCount++; + } + } + } + + /// <summary> + /// Moves or Copy a file + /// if mc==false copy a file otherwise move a file + /// </summary> + + void Move(bool mc, string source, string name, string destination) + { + bool doNot=false; + try + { + if (System.IO.File.Exists(destination+name)) + { + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + dlgYesNo.SetHeading(GUILocalizeStrings.Get(2200)); + dlgYesNo.SetLine(1,name); + dlgYesNo.SetLine(2,GUILocalizeStrings.Get(2217)); + dlgYesNo.SetLine(3,GUILocalizeStrings.Get(2218)); + dlgYesNo.DoModal(GetID); + if (dlgYesNo.IsConfirmed) + { + doNot=false; +//fmu Utils.FileDelete(destination+name); + Util.Utils.FileDelete(destination + name); + } + else + { + doNot=true; + } + } + if (doNot==false) + { + FileInfo fi = new FileInfo(source); + if (mc) + { + fi.MoveTo(destination+name); + } + else + { + fi.CopyTo(destination+name,false); + } + } + } + catch (Exception) + { +//fmu Log.Write("MyExplorer Error: from {0} to {1} MC:{2}",source,destination+name,mc); + Log.Error("MyExplorer Error: from {0} to {1} MC:{2}", source, destination + name, mc); + } + } + + /// <summary> + /// Loads only the ShowOnlyShare status + /// </summary> + private void LoadShareSettings() + { + using(MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + showOnlyShares=xmlreader.GetValueAsBool("myexplorer","show_only_shares",false); + } + } + + /// <summary> + /// Loads all Settings from MediaPortal.xml + /// </summary> + private void LoadSettings() + { + using(MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + tempFolder=xmlreader.GetValueAsString("myexplorer","temp_folder",""); + enableDelete=xmlreader.GetValueAsBool("myexplorer","enable_delete",false); + deleteImmed=xmlreader.GetValueAsBool("myexplorer","delete_immediately",false); + deleteTemp=xmlreader.GetValueAsBool("myexplorer","delete_temp",false); + for (int i=0; i<20; i++) + { + sound[i]=xmlreader.GetValueAsString("music","sharepath"+i.ToString()," ").Trim(); + sname[i]=xmlreader.GetValueAsString("music","sharename"+i.ToString()," ").Trim(); + vname[i]=xmlreader.GetValueAsString("movies","sharename"+i.ToString()," ").Trim(); + video[i]=xmlreader.GetValueAsString("movies","sharepath"+i.ToString()," ").Trim(); + pname[i]=xmlreader.GetValueAsString("pictures","sharename"+i.ToString()," ").Trim(); + pictures[i]=xmlreader.GetValueAsString("pictures","sharepath"+i.ToString()," ").Trim(); + + if (pname[i].Contains("CD/")==false && pictures[i]!="") + { + drives[driveCount]="["+pname[i]+"]"; + driveCount++; + drivesCd[driveCdCount]="["+pname[i]+"]"; + driveCdCount++; + } + if (vname[i].Contains("CD/") == false && video[i] != "") + { + drives[driveCount]="["+vname[i]+"]"; + driveCount++; + drivesCd[driveCdCount]="["+vname[i]+"]"; + driveCdCount++; + } + if (sname[i].Contains("CD/") == false && sound[i] != "") + { + drives[driveCount]="["+sname[i]+"]"; + driveCount++; + drivesCd[driveCdCount]="["+sname[i]+"]"; + driveCdCount++; + } + } + } + } + #endregion + } +} Added: trunk/plugins/My Explorer/My Explorer.csproj =================================================================== --- trunk/plugins/My Explorer/My Explorer.csproj (rev 0) +++ trunk/plugins/My Explorer/My Explorer.csproj 2007-01-31 19:32:51 UTC (rev 61) @@ -0,0 +1,70 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{083BEF5E-D67F-49E4-8B98-783294A095BD}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>MediaPortal.GUI.GUIExplorer</RootNamespace> + <AssemblyName>My Explorer</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=1.0.2582.33626, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>D:\sources mp\Core\bin\Release\Core.dll</HintPath> + </Reference> + <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>D:\sources mp\WindowPlugins\bin\Release\Dialogs.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=1.0.2582.33625, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>D:\sources mp\Core\bin\Release\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="GUIExplorer.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SetupForm.cs"> + <SubType>Form</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="SetupForm.resx"> + <DependentUpon>SetupForm.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Added: trunk/plugins/My Explorer/My Explorer.sln =================================================================== --- trunk/plugins/My Explorer/My Explorer.sln (rev 0) +++ trunk/plugins/My Explorer/My Explorer.sln 2007-01-31 19:32:51 UTC (rev 61) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C# Express 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "My Explorer", "My Explorer.csproj", "{083BEF5E-D67F-49E4-8B98-783294A095BD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {083BEF5E-D67F-49E4-8B98-783294A095BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {083BEF5E-D67F-49E4-8B98-783294A095BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {083BEF5E-D67F-49E4-8B98-783294A095BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {083BEF5E-D67F-49E4-8B98-783294A095BD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: trunk/plugins/My Explorer/My Explorer.suo =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Explorer/My Explorer.suo ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Explorer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/My Explorer/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/My Explorer/Properties/AssemblyInfo.cs 2007-01-31 19:32:51 UTC (rev 61) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("My Explorer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("My Explorer")] +[assembly: AssemblyCopyright("Copyright © 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("e1e38504-09ec-4c73-88b0-ec159a7db045")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: trunk/plugins/My Explorer/SetupForm.cs =================================================================== --- trunk/plugins/My Explorer/SetupForm.cs (rev 0) +++ trunk/plugins/My Explorer/SetupForm.cs 2007-01-31 19:32:51 UTC (rev 61) @@ -0,0 +1,388 @@ +#region Copyright (C) 2005-2006 Team MediaPortal + +/* + * Copyright (C) 2005-2006 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using MediaPortal.GUI.Library; + +namespace GUIExplorer +{ + /// <summary> + /// Summary description for SetupForm. + /// </summary> + public class SetupForm : System.Windows.Forms.Form, ISetupForm, IShowPlugin + { + private MediaPortal.UserInterface.Controls.MPLabel label1; + private MediaPortal.UserInterface.Controls.MPLabel label2; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox2; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox3; + private MediaPortal.UserInterface.Controls.MPLabel label3; + private MediaPortal.UserInterface.Controls.MPLabel label4; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox4; + private MediaPortal.UserInterface.Controls.MPTextBox textBox1; + private MediaPortal.UserInterface.Controls.MPLabel label5; + private MediaPortal.UserInterface.Controls.MPButton button1; + private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + private MediaPortal.UserInterface.Controls.MPButton button2; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox1; + + public SetupForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + LoadSettings(); + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose(bool disposing) + { + if (disposing) + { + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.label1 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.checkBox1 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.label2 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.checkBox2 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.checkBox3 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.label3 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.label4 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.checkBox4 = new MediaPortal.UserInterface.Controls.MPCheckBox(); + this.textBox1 = new MediaPortal.UserInterface.Controls.MPTextBox(); + this.label5 = new MediaPortal.UserInterface.Controls.MPLabel(); + this.button1 = new MediaPortal.UserInterface.Controls.MPButton(); + this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); + this.button2 = new MediaPortal.UserInterface.Controls.MPButton(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(16, 24); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(168, 16); + this.label1.TabIndex = 0; + this.label1.Text = "Show only Shares (Destination)"; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBox1.Location = new System.Drawing.Point(264, 16); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(13, 12); + this.checkBox1.TabIndex = 1; + this.checkBox1.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(16, 48); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(152, 23); + this.label2.TabIndex = 2; + this.label2.Text = "Enable Delete Function"; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBox2.Location = new System.Drawing.Point(264, 40); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(13, 12); + this.checkBox2.TabIndex = 3; + this.checkBox2.UseVisualStyleBackColor = true; + // + // checkBox3 + // + this.checkBox3.AutoSize = true; + this.checkBox3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBox3.Location = new System.Drawing.Point(264, 64); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Size = new System.Drawing.Size(13, 12); + this.checkBox3.TabIndex = 4; + this.checkBox3.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(16, 72); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(160, 24); + this.label3.TabIndex = 5; + this.label3.Text = "Delete Files immediately "; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(16, 96); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(256, 23); + this.label4.TabIndex = 6; + this.label4.Text = "Delete moves files to Temp Folder (like Trashcan)"; + // + // checkBox4 + // + this.checkBox4.AutoSize = true; + this.checkBox4.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.checkBox4.Location = new System.Drawing.Point(264, 88); + this.checkBox4.Name = "checkBox4"; + this.checkBox4.Size = new System.Drawing.Size(13, 12); + this.checkBox4.TabIndex = 7; + this.checkBox4.UseVisualStyleBackColor = true; + // + // textBox1 + // + this.textBox1.BorderColor = System.Drawing.Color.Empty; + this.textBox1.Location = new System.Drawing.Point(264, 120); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(216, 20); + this.textBox1.TabIndex = 8; + // + // label5 + // + this.label5.Location = new System.Drawing.Point(16, 120); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(176, 23); + this.label5.TabIndex = 9; + this.label5.Text = "Temp Folder"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(496, 120); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(32, 24); + this.button1.TabIndex = 10; + this.button1.Text = "..."; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(472, 176); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(56, 24); + this.button2.TabIndex = 11; + this.button2.Text = "OK"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // SetupForm + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(552, 214); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.label5); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.checkBox4); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.checkBox3); + this.Controls.Add(this.checkBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.checkBox1); + this.Controls.Add(this.label1); + this.Name = "SetupForm"; + this.Text = "SetupForm"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + #endregion + + #region plugin vars + + public string PluginName() + { + return "My Explorer"; + } + + public string Description() + { + return "Browse your files with MediaPortal"; + } + + public string Author() + { + return "Gucky62"; + } + + public void ShowPlugin() + { + ShowDialog(); + } + + public bool DefaultEnabled() + { + return false; + } + + public bool CanEnable() + { + return true; + } + + public bool HasSetup() + { + return true; + } + + public int GetWindowId() + { + return 770; + } + + /// <summary> + /// If the plugin should have its own button on the home screen then it + /// should return true to this method, otherwise if it should not be on home + /// it should return false + /// </summary> + /// <param name="strButtonText">text the button should have</param> + /// <param name="strButtonImage">image for the button, or empty for default</param> + /// <param name="strButtonImageFocus">image for the button, or empty for default</param> + /// <param name="strPictureImage">subpicture for the button or empty for none</param> + /// <returns>true : plugin needs its own button on home + /// false : plugin does not need its own button on home</returns> + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = GUILocalizeStrings.Get(2200); + strButtonImage = ""; + strButtonImageFocus = ""; + strPictureImage = ""; + return true; + } + + #endregion + + #region IShowPlugin Members + + public bool ShowDefaultHome() + { + return false; + } + + #endregion + + private void button1_Click(object sender, System.EventArgs e) + { + using (folderBrowserDialog1 = new FolderBrowserDialog()) + { + folderBrowserDialog1.Description = "Select the folder where delete file will be stored"; + folderBrowserDialog1.ShowNewFolderButton = true; + folderBrowserDialog1.SelectedPath = textBox1.Text; + DialogResult dialogResult = folderBrowserDialog1.ShowDialog(this); + + if (dialogResult == DialogResult.OK) + { + textBox1.Text = folderBrowserDialog1.SelectedPath; + } + } + } + + private void LoadSettings() + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + textBox1.Text = xmlreader.GetValueAsString("myexplorer", "temp_folder", ""); + checkBox1.Checked = xmlreader.GetValueAsBool("myexplorer", "show_only_shares", false); + checkBox2.Checked = xmlreader.GetValueAsBool("myexplorer", "enable_delete", false); + checkBox3.Checked = xmlreader.GetValueAsBool("myexplorer", "delete_immediately", false); + checkBox4.Checked = xmlreader.GetValueAsBool("myexplorer", "delete_temp", false); + } + } + + private void SaveSettings() + { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + xmlwriter.SetValue("myexplorer", "temp_folder", textBox1.Text); + xmlwriter.SetValueAsBool("myexplorer", "show_only_shares", checkBox1.Checked); + xmlwriter.SetValueAsBool("myexplorer", "enable_delete", checkBox2.Checked); + if (checkBox2.Checked == true) + { + xmlwriter.SetValueAsBool("myexplorer", "delete_immediately", checkBox3.Checked); + if (checkBox3.Checked == true) + { + xmlwriter.SetValueAsBool("myexplorer", "delete_temp", false); + } + else + { + xmlwriter.SetValueAsBool("myexplorer", "delete_temp", checkBox4.Checked); + } + } + else + { + xmlwriter.SetValueAsBool("myexplorer", "delete_immediately", false); + xmlwriter.SetValueAsBool("myexplorer", "delete_temp", false); + } + } + } + + private void button2_Click(object sender, System.EventArgs e) + { + if (checkBox4.Checked == true) + { + if (textBox1.Text == "") + { + MessageBox.Show("Please select a temp path!"); + } + else + { + SaveSettings(); + this.Visible = false; + } + } + else + { + if (checkBox2.Checked == true && checkBox3.Checked == false && checkBox4.Checked == false) + { + MessageBox.Show("Please a Option: \n(Delete Files immediately)\n or \n(Delete moves files to Temp Folder)"); + } + else + { + SaveSettings(); + this.Visible = false; + } + } + } + + } +} Added: trunk/plugins/My Explorer/SetupForm.resx =================================================================== --- trunk/plugins/My Explorer/SetupForm.resx (rev 0) +++ trunk/plugins/My Explorer/SetupForm.resx 2007-01-31 19:32:51 UTC (rev 61) @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file Added: trunk/plugins/My Explorer/bin/Release/Core.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Explorer/bin/Release/Core.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Explorer/bin/Release/Dialogs.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Explorer/bin/Release/Dialogs.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Explorer/bin/Release/My Explorer.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Explorer/bin/Release/My Explorer.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Explorer/bin/Release/My Explorer.pdb =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Explorer/bin/Release/My Explorer.pdb ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Explorer/bin/Release/Utils.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Explorer/bin/Release/Utils.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |