From: <Sil...@us...> - 2010-08-09 10:48:57
|
Revision: 3704 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3704&view=rev Author: SilentException Date: 2010-08-09 10:48:49 +0000 (Mon, 09 Aug 2010) Log Message: ----------- DriveFreeSpace plugin Added Paths: ----------- trunk/plugins/DriveFreeSpace/ trunk/plugins/DriveFreeSpace/ReadMe.txt trunk/plugins/DriveFreeSpace/Release/ trunk/plugins/DriveFreeSpace/Release/plugins/ trunk/plugins/DriveFreeSpace/Release/plugins/process/ trunk/plugins/DriveFreeSpace/Release/plugins/process/DriveFreeSpace.dll trunk/plugins/DriveFreeSpace/Release/plugins/process/Raccoom.TreeViewFolderBrowser.DataProviders.dll trunk/plugins/DriveFreeSpace/Release/plugins/process/Raccoom.TreeViewFolderBrowser.dll trunk/plugins/DriveFreeSpace/SkinControlExample.txt trunk/plugins/DriveFreeSpace/Source/ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpace.cs trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.csproj trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.sln trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.suo trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.user trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.Designer.cs trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.cs trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.resx trunk/plugins/DriveFreeSpace/Source/Properties/ trunk/plugins/DriveFreeSpace/Source/Properties/AssemblyInfo.cs trunk/plugins/DriveFreeSpace/Source/References/ trunk/plugins/DriveFreeSpace/Source/References/Raccoom.TreeViewFolderBrowser.DataProviders.dll trunk/plugins/DriveFreeSpace/Source/References/Raccoom.TreeViewFolderBrowser.dll Added: trunk/plugins/DriveFreeSpace/ReadMe.txt =================================================================== --- trunk/plugins/DriveFreeSpace/ReadMe.txt (rev 0) +++ trunk/plugins/DriveFreeSpace/ReadMe.txt 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,70 @@ +Drive Free Space 0.5 for Mediaportal + + +What it does? + +This plugin sets and refreshes different GUI properties (depending on configuration) for displaying free HDD space on your drives. It's highly configurable and flexible. Configure the plugin by selecting drives you want to "monitor" and format the output text depending on your wishes. GUI settings you can use afterwards are: +#DriveFreeSpace.AvailableSpace.Data.Drives - for formated text output +#DriveFreeSpace.AvailableSpace.Data.Total - for formated text output - total +#DriveFreeSpace.AvailableSpace.Percentage - for percentage of free space +#DriveFreeSpace.AvailableSpace.UsedPercentage - for percentage of occupied space +#DriveFreeSpace.X.AvailableSpace.Data - for formated text output for one drive you have selected in configuration; replace X with drive letter +#DriveFreeSpace.X.AvailableSpace.Percentage - for percentage of free space for one drive you have selected in configuration; replace X with drive letter +#DriveFreeSpace.X.AvailableSpace.UsedPercentage - for percentage of occupied space for one drive you have selected in configuration; replace X with drive letter +#DriveFreeSpace.Enabled - is any drive selected for monitoring +#DriveFreeSpace.X.Enabled - is drive X selected for monitoring; replace X with drive letter + +Replace string #DriveFreeSpace with the plugin file name (as there is a possibility for running multiple plugin instances now). Default plugin file name is DriveFreeSpace.dll. + +Format variables are explained in plugin configuration. + +Look for more skin examples or mods in SkinControlExample.txt in the archive or read this thread on MP forum: http://forum.team-mediaportal.com/plugins-47/drive-free-space-plugin-54798/ + + +What do i need to use it? + +Mediaportal > 1.0 + + +How do i install it? + +Open the archive and extract everything under the Release folder to you MediaPortal installation directory. Now open MP's Configuration and Enable the plugin (it's listed under Process plugins). If the plugin is not listed there, you did something wrong. + + +Changelog: + +v0.51 +increased character limit on bitrate textbox to 5 +small changes in configuration + +v0.5 +due to change in MediaPortal properties, brackets cannot be part of the property names - all properties with (X) renamed to .X. +added bitrate calculation (recording time left) - requested by daniel_1980 +property #Drives.AvailableSpace.Data split in two (#DriveFreeSpace.AvailableSpace.Data.Drives and #DriveFreeSpace.AvailableSpace.Data.Total) - .Drives works exactly as old one and .Total returns the formatted data for all selected drives - requested by cruse +added #DriveFreeSpace.Enabled and #DriveFreeSpace.X.Enabled properties - first will contain true/false strings depending on weather any drive has been selected, second will contain true/false strings depending on weather drive X is selected - requested by Bleazle +added possibility for multiple plugins: copy DriveFreeSpace.dll and rename it as you wish +due to that possibility, all gui properties are prefixed with plugin file name now: instead of #Drives* properties, they are now named #DriveFreeSpace* or whatever the plugin file name is +also, this now requires you to reconfigure the plugin +fixed for MediaPortal v1.1 + +v0.4 +added new gui properties #Drives.AvailableSpace.UsedPercentage and #Drives(X).AvailableSpace.UsedPercentage; returns percentage of used space for all or one drive; replace X with the drive letter +added new text property %uspercent% - returns a number (percent of occupied space) +added new text property %usedspace% - returns used space in GB/MB/KB +added new text property %driveletteronly% - returns drive letter only with no colon character + +v0.31 +all new lines are now processed only from configuration! +fixed a small glitch in last build (30 seconds blackout on plugin start) + +v0.3 +added new gui properties #Drives(X).AvailableSpace.Data and #Drives(X).AvailableSpace.Percentage for each drive selected in configuration; replace X with the drive letter (doh!) + +v0.2 +fixed decimals +added new text property %fspercent% - returns a number (percent) of free space +added #Drives.AvailableSpace.Percentage - note that this returns percentage of free space of ALL drives you have selected in configuration.. i'm working on a version that will create a new property #Drives(X).AvailableSpace which will return .Data or .Percentage depending on what drives you have selected +Renamed #Drives.AvailableSpace to #Drives.AvailableSpace.Data (i had problems with progress bar so i had to) + +v0.1 +initial release Added: trunk/plugins/DriveFreeSpace/Release/plugins/process/DriveFreeSpace.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/DriveFreeSpace/Release/plugins/process/DriveFreeSpace.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/DriveFreeSpace/Release/plugins/process/Raccoom.TreeViewFolderBrowser.DataProviders.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/DriveFreeSpace/Release/plugins/process/Raccoom.TreeViewFolderBrowser.DataProviders.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/DriveFreeSpace/Release/plugins/process/Raccoom.TreeViewFolderBrowser.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/DriveFreeSpace/Release/plugins/process/Raccoom.TreeViewFolderBrowser.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/DriveFreeSpace/SkinControlExample.txt =================================================================== --- trunk/plugins/DriveFreeSpace/SkinControlExample.txt (rev 0) +++ trunk/plugins/DriveFreeSpace/SkinControlExample.txt 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,30 @@ +<control> + <description>Drive space</description> + <type>textboxscrollup</type> + <id>37483</id> + <posX>1600</posX> + <posY>100</posY> + <width>300</width> + <height>300</height> + <font>font11</font> + <label>#DriveFreeSpace.AvailableSpace.Data</label> + <visible>yes</visible> +</control> + +<control> + <description>Progress Bar</description> + <type>progress</type> + <id>20</id> + <posX>560</posX> + <posY>885</posY> + <width>500</width> + <height>30</height> + <label>#DriveFreeSpace.AvailableSpace.Percentage</label> + <texturebg>progress_background_tvhome.png</texturebg> + <lefttexture>progress_blank30.png</lefttexture> + <midtexture>progress_mid_white30.png</midtexture> + <righttexture>progress_blank30.png</righttexture> + <visible>yes</visible> +</control> + +For more properties, check ReadMe.txt. \ No newline at end of file Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpace.cs =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpace.cs (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpace.cs 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,448 @@ +#region Information + +/* + * DriveFreeSpace for Mediaportal. + * + * Version 0.12 for MP 1.0.0.0 RC4 + * + * 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.Reflection; +using System.Collections.Generic; +using System.Data; +using System.Text; +using System.IO; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using System.Text.RegularExpressions; +using MediaPortal.GUI.Library; +using MediaPortal.Util; +using MediaPortal.Configuration; + +namespace DriveFreeSpacePlugin +{ + public class DriveFreeSpacePlugin : ISetupForm, IPlugin + { + private Timer _timer; + private enum UnitsCode + { + GB = 0, + MB = 1, + KB = 2 + } + private int _unit = 0; + private int _bitrate = 4086; + private int _brunit = 0; + private int _timerInterval = 30; + private string _GUIText = String.Empty; + private string _GUITextTotal = String.Empty; + private List<String> _driveList = new List<String>(); + private string _configSection = String.Empty; + private const string _configSectionDefault = "DriveFreeSpace"; + + public DriveFreeSpacePlugin() + { + _timer = new Timer(); + _timer.Interval = _timerInterval * 1000; + _timer.Enabled = false; + _timer.Tick += new EventHandler(_timer_Tick); + + ClearVariables(); + } + + private void ClearVariables() + { + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.Data", " "); + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.Percentage", "0"); + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.UsedPercentage", "0"); + + for (var i = 65; i < 65 + 26; i++) + { + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.Data", Convert.ToChar(i)), " "); + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.Percentage", Convert.ToChar(i)), "0"); + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.UsedPercentage", Convert.ToChar(i)), "0"); + } + } + + private void _timer_Tick(object sender, EventArgs e) + { + string GUIString = String.Empty; + long totalSizeAll = 0; + long totalFreeAll = 0; + long totalUsedAll = 0; + + bool[] drivesEnabled = new bool[26]; + for (int i = 0; i < drivesEnabled.Length - 1; i++) { + drivesEnabled[i] = false; + } + bool hasEnabledDrives = false; + + long recTimeLeftSec = 0; + long brDivide = 1; + String sBrUnit = String.Empty; + String sBitrate = _bitrate.ToString(); + String sRecTimeLeft = String.Empty; + + long divide = 1; + string sUnit = String.Empty; + + if (_unit == 0) { + divide = 1024 * 1024 * 1024; + sUnit = "GB"; + } + else if (_unit == 1) { + divide = 1024 * 1024; + sUnit = "MB"; + } + if (_unit == 2) { + divide = 1024; + sUnit = "KB"; + } + + foreach (string drive in _driveList) + { + char driveLetter = drive.ToUpper()[0]; + System.IO.DriveInfo di = new System.IO.DriveInfo(driveLetter.ToString()); + if (di.IsReady) + try + { + drivesEnabled[Convert.ToInt16(driveLetter) - 65] = true; + hasEnabledDrives = true; + + string sLabel = String.Empty; + if (!String.IsNullOrEmpty(di.VolumeLabel)) + sLabel = di.VolumeLabel; + + string sName = driveLetter + ":"; + if (di.Name.Length >= 2) + sName = di.Name.Substring(0, 2); + + + double totalSize = (double)di.TotalSize / divide; + long totalSizeL = di.TotalSize / divide; + double available = (double)di.AvailableFreeSpace / divide; + long availableL = di.AvailableFreeSpace / divide; + double used = ((double)di.TotalSize - (double)di.AvailableFreeSpace) / divide; + long usedL = (di.TotalSize - di.AvailableFreeSpace) / divide; + + totalSizeAll += di.TotalSize; + totalFreeAll += di.AvailableFreeSpace; + totalUsedAll += (di.TotalSize - di.AvailableFreeSpace); + + // bitrate + recTimeLeftSec = 0; + brDivide = 1; + sBrUnit = String.Empty; + sBitrate = _bitrate.ToString(); + + if (_brunit == 0) + { + brDivide = 1; + sBrUnit = "kbit/s"; + } + else if (_brunit == 1) + { + brDivide = 1000; + sBrUnit = "Mbit/s"; + } + + sRecTimeLeft = String.Empty; + if (_GUIText.IndexOf("%rectimeleft%") != -1) + { + recTimeLeftSec = di.AvailableFreeSpace / (125 * _bitrate * brDivide); + TimeSpan ts = new TimeSpan(0, 0, 0, (int)recTimeLeftSec, 0); + sRecTimeLeft = String.Format("{0:00}:{1:00}", (int)ts.TotalHours, ts.Minutes); + } + + double percentage = 0; + try + { + percentage = ((double)di.AvailableFreeSpace / (double)di.TotalSize) * 100; + if (percentage > 100) + percentage = 100; + else if (percentage < 0) + percentage = 0; + } + catch + { + percentage = 0; + } + + double percentageUsed = 0; + try + { + percentageUsed = (((double)di.TotalSize - (double)di.AvailableFreeSpace) / (double)di.TotalSize) * 100; + if (percentageUsed > 100) + percentageUsed = 100; + else if (percentageUsed < 0) + percentageUsed = 0; + } + catch + { + percentageUsed = 0; + } + + string strAvailableSpace = _GUIText; + strAvailableSpace = strAvailableSpace.Replace("%drive%", sName); + strAvailableSpace = strAvailableSpace.Replace("%driveletteronly%", sName.Substring(0, 1)); + strAvailableSpace = strAvailableSpace.Replace("%label%", sLabel); + strAvailableSpace = strAvailableSpace.Replace("%labelbrackets%", String.IsNullOrEmpty(sLabel) ? "" : ("(" + sLabel + ")")); + strAvailableSpace = strAvailableSpace.Replace("%freespace%", String.Format("{0:F}", available)); + strAvailableSpace = strAvailableSpace.Replace("%usedspace%", String.Format("{0:F}", used)); + strAvailableSpace = strAvailableSpace.Replace("%totalspace%", String.Format("{0:F}", totalSize)); + strAvailableSpace = strAvailableSpace.Replace("%unit%", sUnit); + strAvailableSpace = strAvailableSpace.Replace("%fspercent%", String.Format("{0:#}", percentage)); + strAvailableSpace = strAvailableSpace.Replace("%uspercent%", String.Format("{0:#}", percentageUsed)); + strAvailableSpace = strAvailableSpace.Replace("%bitrate%", sBitrate); + strAvailableSpace = strAvailableSpace.Replace("%bitrateunit%", sBrUnit); + strAvailableSpace = strAvailableSpace.Replace("%rectimeleft%", sRecTimeLeft); + + GUIString += strAvailableSpace; + + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.Data", driveLetter), strAvailableSpace.Trim()); + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.Percentage", driveLetter), String.Format("{0:#}", percentage)); + //Log.Info("DFS USED " + percentageUsed + " " + String.Format("{0:#}", percentageUsed)); + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.UsedPercentage", driveLetter), String.Format("{0:#}", percentageUsed)); + } + catch + { + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.Data", driveLetter), String.Format("Error on {0}: !", driveLetter)); + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.Percentage", driveLetter), "0"); + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.AvailableSpace.UsedPercentage", driveLetter), "0"); + } + } + + for (int i = 0; i < drivesEnabled.Length - 1; i++) { + GUIPropertyManager.SetProperty(String.Format("#" + _configSection + ".{0}.Enabled", Convert.ToChar(i + 65)), drivesEnabled[i].ToString().ToLower()); + } + + GUIPropertyManager.SetProperty("#" + _configSection + ".Enabled", hasEnabledDrives.ToString().ToLower()); + + //if (!String.IsNullOrEmpty(GUIString) && GUIString.EndsWith("\n")) + // GUIString = GUIString.Remove(GUIString.Length - 1); + + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.Data.Drives", GUIString.Trim()); + + double totalPercentageAll = 0; + try + { + totalPercentageAll = ((double)totalFreeAll / (double)totalSizeAll) * 100; + if (totalPercentageAll > 100) + totalPercentageAll = 100; + else if (totalPercentageAll < 0) + totalPercentageAll = 0; + } + catch + { + totalPercentageAll = 0; + } + + //Log.Info("DFS " + totalPercentageAll + " " + String.Format("{0:#}", totalPercentageAll)); + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.Percentage", String.Format("{0:#}", totalPercentageAll)); + + double totalPercentageUsedAll = 0; + try + { + totalPercentageUsedAll = ((double)totalUsedAll / (double)totalSizeAll) * 100; + if (totalPercentageUsedAll > 100) + totalPercentageUsedAll = 100; + else if (totalPercentageUsedAll < 0) + totalPercentageUsedAll = 0; + } + catch + { + totalPercentageUsedAll = 0; + } + //Log.Info("DFS " + totalPercentageUsedAll + " " + String.Format("{0:#}", totalPercentageUsedAll)); + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.UsedPercentage", String.Format("{0:#}", totalPercentageUsedAll)); + + // bitrate + recTimeLeftSec = 0; + brDivide = 1; + sBrUnit = String.Empty; + sBitrate = _bitrate.ToString(); + + if (_brunit == 0) { + brDivide = 1; + sBrUnit = "kbit/s"; + } + else if (_brunit == 1) { + brDivide = 1000; + sBrUnit = "Mbit/s"; + } + + double totalSizeAllProper = (double)totalSizeAll / divide; + double totalFreeAllProper = (double)totalFreeAll / divide; + double totalUsedAllProper = (double)totalUsedAll / divide; + + sRecTimeLeft = String.Empty; + if (_GUITextTotal.IndexOf("%rectimeleft%") != -1) { + recTimeLeftSec = totalFreeAll / (125 * _bitrate * brDivide); + TimeSpan ts = new TimeSpan(0, 0, 0, (int)recTimeLeftSec, 0); + sRecTimeLeft = String.Format("{0:00}:{1:00}", (int)ts.TotalHours, ts.Minutes); + } + string strGUITextTotal = _GUITextTotal; + strGUITextTotal = strGUITextTotal.Replace("%freespace%", String.Format("{0:F}", totalFreeAllProper)); + strGUITextTotal = strGUITextTotal.Replace("%usedspace%", String.Format("{0:F}", totalUsedAllProper)); + strGUITextTotal = strGUITextTotal.Replace("%totalspace%", String.Format("{0:F}", totalSizeAllProper)); + strGUITextTotal = strGUITextTotal.Replace("%unit%", sUnit); + strGUITextTotal = strGUITextTotal.Replace("%fspercent%", String.Format("{0:#}", totalPercentageAll)); + strGUITextTotal = strGUITextTotal.Replace("%uspercent%", String.Format("{0:#}", totalPercentageUsedAll)); + strGUITextTotal = strGUITextTotal.Replace("%bitrate%", sBitrate); + strGUITextTotal = strGUITextTotal.Replace("%bitrateunit%", sBrUnit); + strGUITextTotal = strGUITextTotal.Replace("%rectimeleft%", sRecTimeLeft); + + GUIPropertyManager.SetProperty("#" + _configSection + ".AvailableSpace.Data.Total", strGUITextTotal.Trim()); + + } + + private void LoadSettings() + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + int cbUnit = xmlreader.GetValueAsInt(_configSection, "unit", 0); + if (cbUnit > 2) cbUnit = 2; + else if (cbUnit < 0) cbUnit = 0; + _unit = cbUnit; + + int cbBRUnit = xmlreader.GetValueAsInt(_configSection, "bitrateunit", 0); + if (cbBRUnit > 1) cbBRUnit = 1; + else if (cbBRUnit < 0) cbBRUnit = 0; + _brunit = cbBRUnit; + + _GUIText = xmlreader.GetValueAsString(_configSection, "drivestext", "%drive% (%label%)\n%freespace%/%totalspace% %unit%\n\n").Replace(Environment.NewLine, "\n"); + + _GUITextTotal = xmlreader.GetValueAsString(_configSection, "drivestexttotal", "%freespace%/%totalspace% %unit%").Replace(Environment.NewLine, "\n"); + + _timerInterval = xmlreader.GetValueAsInt(_configSection, "refresh", 30); + _timer.Interval = _timerInterval * 1000; + + _bitrate = xmlreader.GetValueAsInt(_configSection, "bitrate", 4086); + + string drives = xmlreader.GetValueAsString(_configSection, "SelectedDirectories", ""); + string[] selectedDrivesArray = drives.Split(','); + Array.Sort(selectedDrivesArray); + foreach (string s in selectedDrivesArray) + if (!String.IsNullOrEmpty(s)) + _driveList.Add(s); + } + } + + private void LoadSettingsSectionName() + { + _configSection = GetSettingsSectionName(); + } + + private string GetSettingsSectionName() { + string configSection = string.Empty; + try { + configSection = System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location); + configSection = Regex.Replace(configSection, @"\W*", ""); + } + catch { + configSection = _configSectionDefault; + } + if (String.IsNullOrEmpty(configSection)) + configSection = _configSectionDefault; + + return configSection; + } + + #region IPluginReceiver Members + + #endregion + + #region IPlugin Members + + public void Start() + { + LoadSettingsSectionName(); + LoadSettings(); + ClearVariables(); + _timer.Enabled = true; + _timer_Tick(null, null); + } + + public void Stop() + { + ClearVariables(); + _timer.Enabled = false; + } + + #endregion + + #region ISetupForm Members + + public bool CanEnable() + { + return true; + } + + public string Description() + { + return "Drive free space information"; + } + + public bool DefaultEnabled() + { + return false; + } + + public int GetWindowId() + { + return -1; + } + + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = null; + strButtonImage = null; + strButtonImageFocus = null; + strPictureImage = null; + return false; + } + + public string Author() + { + return "SilentException"; + } + + public string PluginName() + { + //return "Drive Free Space"; + return GetSettingsSectionName(); + } + + public bool HasSetup() + { + return true; + } + + public void ShowPlugin() + { + DriveFreeSpaceSettings setup = new DriveFreeSpaceSettings(); + setup.ShowDialog(); + } + + #endregion + + } +} Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.csproj =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.csproj (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.csproj 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,122 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{B365DF81-7C0D-4A30-9912-85BF424809E8}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>DriveFreeSpacePlugin</RootNamespace> + <AssemblyName>DriveFreeSpace</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + </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.8.28791, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + <Private>False</Private> + </Reference> + <Reference Include="Raccoom.TreeViewFolderBrowser, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>References\Raccoom.TreeViewFolderBrowser.dll</HintPath> + </Reference> + <Reference Include="Raccoom.TreeViewFolderBrowser.DataProviders, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>References\Raccoom.TreeViewFolderBrowser.DataProviders.dll</HintPath> + </Reference> + <Reference Include="System"> + <Private>False</Private> + </Reference> + <Reference Include="System.Data"> + <Private>False</Private> + </Reference> + <Reference Include="System.Drawing"> + <Private>False</Private> + </Reference> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=2.2.7.28786, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>C:\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + <Private>False</Private> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="DriveFreeSpace.cs" /> + <Compile Include="DriveFreeSpaceSettings.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="DriveFreeSpaceSettings.Designer.cs"> + <DependentUpon>DriveFreeSpaceSettings.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="DriveFreeSpaceSettings.resx"> + <SubType>Designer</SubType> + <DependentUpon>DriveFreeSpaceSettings.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Framework.2.0"> + <Visible>False</Visible> + <ProductName>.NET Framework 2.0 %28x86%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.0"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.0 %28x86%29</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </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/DriveFreeSpace/Source/DriveFreeSpacePlugin.sln =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.sln (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.sln 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriveFreeSpacePlugin", "DriveFreeSpacePlugin.csproj", "{B365DF81-7C0D-4A30-9912-85BF424809E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B365DF81-7C0D-4A30-9912-85BF424809E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B365DF81-7C0D-4A30-9912-85BF424809E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B365DF81-7C0D-4A30-9912-85BF424809E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B365DF81-7C0D-4A30-9912-85BF424809E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.suo =================================================================== (Binary files differ) Property changes on: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.suo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.user =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.user (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpacePlugin.user 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,16 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <PublishUrlHistory> + </PublishUrlHistory> + <InstallUrlHistory> + </InstallUrlHistory> + <SupportUrlHistory> + </SupportUrlHistory> + <UpdateUrlHistory> + </UpdateUrlHistory> + <BootstrapperUrlHistory> + </BootstrapperUrlHistory> + <FallbackCulture>de-DE</FallbackCulture> + <VerifyUploadedFiles>false</VerifyUploadedFiles> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.Designer.cs =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.Designer.cs (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.Designer.cs 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,313 @@ +namespace DriveFreeSpacePlugin +{ + partial class DriveFreeSpaceSettings + { + /// <summary> + /// Erforderliche Designervariable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Verwendete Ressourcen bereinigen. + /// </summary> + /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// <summary> + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DriveFreeSpaceSettings)); + this.gbDrives = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.treeViewRecursiveChecked = new Raccoom.Windows.Forms.TreeViewFolderBrowser(); + this.mpButton1 = new MediaPortal.UserInterface.Controls.MPButton(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.tbGUIText = new System.Windows.Forms.TextBox(); + this.tbGUITextTotal = new System.Windows.Forms.TextBox(); + this.gbGUIText = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.mpButton2 = new MediaPortal.UserInterface.Controls.MPButton(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.gbGUITextTotal = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.gbOtherSettings = new MediaPortal.UserInterface.Controls.MPGroupBox(); + this.gbDrives.SuspendLayout(); + this.gbGUIText.SuspendLayout(); + this.gbGUITextTotal.SuspendLayout(); + this.gbOtherSettings.SuspendLayout(); + this.SuspendLayout(); + // + // gbDrives + // + this.gbDrives.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.gbDrives.Controls.Add(this.treeViewRecursiveChecked); + this.gbDrives.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbDrives.Location = new System.Drawing.Point(3, 1); + this.gbDrives.Name = "gbDrives"; + this.gbDrives.Size = new System.Drawing.Size(738, 242); + this.gbDrives.TabIndex = 1; + this.gbDrives.TabStop = false; + this.gbDrives.Text = "Select drives"; + // + // treeViewRecursiveChecked + // + this.treeViewRecursiveChecked.DataSource = null; + this.treeViewRecursiveChecked.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeViewRecursiveChecked.HideSelection = false; + this.treeViewRecursiveChecked.Location = new System.Drawing.Point(3, 16); + this.treeViewRecursiveChecked.Name = "treeViewRecursiveChecked"; + this.treeViewRecursiveChecked.SelectedDirectories = ((System.Collections.Specialized.StringCollection)(resources.GetObject("treeViewRecursiveChecked.SelectedDirectories"))); + this.treeViewRecursiveChecked.ShowLines = false; + this.treeViewRecursiveChecked.ShowPlusMinus = false; + this.treeViewRecursiveChecked.Size = new System.Drawing.Size(732, 223); + this.treeViewRecursiveChecked.TabIndex = 1; + // + // mpButton1 + // + this.mpButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.mpButton1.Location = new System.Drawing.Point(662, 503); + this.mpButton1.Name = "mpButton1"; + this.mpButton1.Size = new System.Drawing.Size(75, 23); + this.mpButton1.TabIndex = 2; + this.mpButton1.Text = "&OK"; + this.mpButton1.UseVisualStyleBackColor = true; + this.mpButton1.Click += new System.EventHandler(this.mpButton1_Click); + // + // comboBox1 + // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "GB", + "MB", + "KB"}); + this.comboBox1.Location = new System.Drawing.Point(140, 18); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(76, 21); + this.comboBox1.TabIndex = 4; + this.comboBox1.Tag = ""; + // + // toolTip1 + // + this.toolTip1.AutoPopDelay = 0; + this.toolTip1.InitialDelay = 500; + this.toolTip1.IsBalloon = true; + this.toolTip1.ReshowDelay = 100; + this.toolTip1.ToolTipTitle = "Variables"; + // + // tbGUIText + // + this.tbGUIText.AcceptsReturn = true; + this.tbGUIText.Location = new System.Drawing.Point(6, 16); + this.tbGUIText.Multiline = true; + this.tbGUIText.Name = "tbGUIText"; + this.tbGUIText.Size = new System.Drawing.Size(239, 68); + this.tbGUIText.TabIndex = 4; + this.tbGUIText.Text = "%drive% (%label%)\r\n%freespace%/%totalspace% %unit%\r\n"; + this.toolTip1.SetToolTip(this.tbGUIText, resources.GetString("tbGUIText.ToolTip")); + this.tbGUIText.WordWrap = false; + // + // tbGUITextTotal + // + this.tbGUITextTotal.AcceptsReturn = true; + this.tbGUITextTotal.Location = new System.Drawing.Point(6, 16); + this.tbGUITextTotal.Multiline = true; + this.tbGUITextTotal.Name = "tbGUITextTotal"; + this.tbGUITextTotal.Size = new System.Drawing.Size(239, 68); + this.tbGUITextTotal.TabIndex = 4; + this.tbGUITextTotal.Text = "%freespace%/%totalspace% %unit%"; + this.toolTip1.SetToolTip(this.tbGUITextTotal, resources.GetString("tbGUITextTotal.ToolTip")); + this.tbGUITextTotal.WordWrap = false; + // + // gbGUIText + // + this.gbGUIText.Controls.Add(this.tbGUIText); + this.gbGUIText.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbGUIText.Location = new System.Drawing.Point(3, 249); + this.gbGUIText.Name = "gbGUIText"; + this.gbGUIText.Size = new System.Drawing.Size(252, 91); + this.gbGUIText.TabIndex = 5; + this.gbGUIText.TabStop = false; + this.gbGUIText.Text = "GUI Text"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(140, 41); + this.textBox2.MaxLength = 3; + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(76, 20); + this.textBox2.TabIndex = 6; + this.textBox2.WordWrap = false; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(8, 21); + this.label1.Margin = new System.Windows.Forms.Padding(5); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(29, 13); + this.label1.TabIndex = 7; + this.label1.Text = "Unit:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(8, 44); + this.label2.Margin = new System.Windows.Forms.Padding(5); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(126, 13); + this.label2.TabIndex = 8; + this.label2.Text = "GUI refresh interval (min):"; + // + // mpButton2 + // + this.mpButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.mpButton2.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.mpButton2.Location = new System.Drawing.Point(581, 503); + this.mpButton2.Name = "mpButton2"; + this.mpButton2.Size = new System.Drawing.Size(75, 23); + this.mpButton2.TabIndex = 9; + this.mpButton2.Text = "&Cancel"; + this.mpButton2.UseVisualStyleBackColor = true; + this.mpButton2.Click += new System.EventHandler(this.mpButton2_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 343); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(391, 182); + this.label3.TabIndex = 10; + this.label3.Text = resources.GetString("label3.Text"); + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(58, 64); + this.textBox3.MaxLength = 5; + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(76, 20); + this.textBox3.TabIndex = 11; + this.textBox3.WordWrap = false; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(8, 67); + this.label4.Margin = new System.Windows.Forms.Padding(5); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(40, 13); + this.label4.TabIndex = 12; + this.label4.Text = "Bitrate:"; + // + // comboBox2 + // + this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Items.AddRange(new object[] { + "kbit/s", + "Mbit/s"}); + this.comboBox2.Location = new System.Drawing.Point(140, 64); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(76, 21); + this.comboBox2.TabIndex = 13; + this.comboBox2.Tag = ""; + // + // gbGUITextTotal + // + this.gbGUITextTotal.Controls.Add(this.tbGUITextTotal); + this.gbGUITextTotal.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbGUITextTotal.Location = new System.Drawing.Point(261, 249); + this.gbGUITextTotal.Name = "gbGUITextTotal"; + this.gbGUITextTotal.Size = new System.Drawing.Size(252, 91); + this.gbGUITextTotal.TabIndex = 14; + this.gbGUITextTotal.TabStop = false; + this.gbGUITextTotal.Text = "GUI Text (total for all enabled drives)"; + // + // gbOtherSettings + // + this.gbOtherSettings.Controls.Add(this.comboBox1); + this.gbOtherSettings.Controls.Add(this.textBox2); + this.gbOtherSettings.Controls.Add(this.comboBox2); + this.gbOtherSettings.Controls.Add(this.label1); + this.gbOtherSettings.Controls.Add(this.label4); + this.gbOtherSettings.Controls.Add(this.label2); + this.gbOtherSettings.Controls.Add(this.textBox3); + this.gbOtherSettings.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.gbOtherSettings.Location = new System.Drawing.Point(519, 249); + this.gbOtherSettings.Name = "gbOtherSettings"; + this.gbOtherSettings.Size = new System.Drawing.Size(222, 91); + this.gbOtherSettings.TabIndex = 15; + this.gbOtherSettings.TabStop = false; + this.gbOtherSettings.Text = "Other settings"; + // + // DriveFreeSpaceSettings + // + this.AcceptButton = this.mpButton1; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.mpButton2; + this.ClientSize = new System.Drawing.Size(744, 538); + this.Controls.Add(this.gbOtherSettings); + this.Controls.Add(this.gbGUITextTotal); + this.Controls.Add(this.label3); + this.Controls.Add(this.mpButton2); + this.Controls.Add(this.gbGUIText); + this.Controls.Add(this.mpButton1); + this.Controls.Add(this.gbDrives); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "DriveFreeSpaceSettings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Drive Free Space - Settings"; + this.gbDrives.ResumeLayout(false); + this.gbGUIText.ResumeLayout(false); + this.gbGUIText.PerformLayout(); + this.gbGUITextTotal.ResumeLayout(false); + this.gbGUITextTotal.PerformLayout(); + this.gbOtherSettings.ResumeLayout(false); + this.gbOtherSettings.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private MediaPortal.UserInterface.Controls.MPGroupBox gbDrives; + private MediaPortal.UserInterface.Controls.MPButton mpButton1; + private Raccoom.Windows.Forms.TreeViewFolderBrowser treeViewRecursiveChecked; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.ToolTip toolTip1; + private MediaPortal.UserInterface.Controls.MPGroupBox gbGUIText; + private System.Windows.Forms.TextBox tbGUIText; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private MediaPortal.UserInterface.Controls.MPButton mpButton2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.ComboBox comboBox2; + private MediaPortal.UserInterface.Controls.MPGroupBox gbGUITextTotal; + private System.Windows.Forms.TextBox tbGUITextTotal; + private MediaPortal.UserInterface.Controls.MPGroupBox gbOtherSettings; + + } +} \ No newline at end of file Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.cs =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.cs (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.cs 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,135 @@ +using System; +using System.Reflection; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Text.RegularExpressions; +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; +using Raccoom.Windows.Forms; + +namespace DriveFreeSpacePlugin +{ + public partial class DriveFreeSpaceSettings : Form + { + private string _configSection = String.Empty; + private const string _configSectionDefault = "DriveFreeSpace"; + + public DriveFreeSpaceSettings() + { + InitializeComponent(); + + try + { + _configSection = System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location); + _configSection = Regex.Replace(_configSection, @"\W*", ""); + } + catch + { + _configSection = _configSectionDefault; + } + if (String.IsNullOrEmpty(_configSection)) + _configSection = _configSectionDefault; + + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + int cbUnit = xmlreader.GetValueAsInt(_configSection, "unit", 0); + if (cbUnit > 2) cbUnit = 2; + else if (cbUnit < 0) cbUnit = 0; + comboBox1.SelectedIndex = cbUnit; + + int cbBRUnit = xmlreader.GetValueAsInt(_configSection, "bitrateunit", 0); + if (cbBRUnit > 1) cbBRUnit = 1; + else if (cbBRUnit < 0) cbBRUnit = 0; + comboBox2.SelectedIndex = cbBRUnit; + + tbGUIText.Text = xmlreader.GetValueAsString(_configSection, "drivestext", "%drive% (%label%)\n%freespace%/%totalspace% %unit%\n\n").Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine); + + tbGUITextTotal.Text = xmlreader.GetValueAsString(_configSection, "drivestexttotal", "%freespace%/%totalspace% %unit%").Replace(Environment.NewLine, "\n").Replace("\n", Environment.NewLine); + + textBox2.Text = xmlreader.GetValueAsString(_configSection, "refresh", "30"); + + textBox3.Text = xmlreader.GetValueAsString(_configSection, "bitrate", "4086"); + + string drives = xmlreader.GetValueAsString(_configSection, "SelectedDirectories", ""); + string[] selectedDrivesArray = drives.Split(','); + Array.Sort(selectedDrivesArray); + foreach (string s in selectedDrivesArray) + if (!String.IsNullOrEmpty(s)) + this.treeViewRecursiveChecked.SelectedDirectories.Add(s); + } + + this.treeViewRecursiveChecked.DataSource = new Raccoom.Windows.Forms.TreeViewFolderBrowserDataProvider(); + this.treeViewRecursiveChecked.RootFolder = System.Environment.SpecialFolder.MyComputer; + this.treeViewRecursiveChecked.Populate(System.Environment.SpecialFolder.MyComputer); + } + + private void mpButton1_Click(object sender, EventArgs e) + { + SaveSettings(); + this.Close(); + } + + private void SaveSettings() + { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + string drives = String.Empty; + + foreach (string s in this.treeViewRecursiveChecked.SelectedDirectories) + if (!String.IsNullOrEmpty(s)) + drives += s + ","; + + if (!String.IsNullOrEmpty(drives)) + drives = drives.Remove(drives.Length - 1); + + string[] selectedDrivesArray = drives.Split(','); + Array.Sort(selectedDrivesArray); + + drives = String.Empty; + foreach (string s in selectedDrivesArray) + if (!String.IsNullOrEmpty(s)) + drives += s + ","; + + if (!String.IsNullOrEmpty(drives)) + drives = drives.Remove(drives.Length - 1); + + xmlwriter.SetValue(_configSection, "SelectedDirectories", drives); + + xmlwriter.SetValue(_configSection, "unit", comboBox1.SelectedIndex); + + xmlwriter.SetValue(_configSection, "bitrateunit", comboBox2.SelectedIndex); + + xmlwriter.SetValue(_configSection, "drivestext", tbGUIText.Text); + + xmlwriter.SetValue(_configSection, "drivestexttotal", tbGUITextTotal.Text); + + try + { + xmlwriter.SetValue(_configSection, "refresh", Convert.ToInt32(textBox2.Text).ToString()); + } + catch + { + xmlwriter.SetValue(_configSection, "refresh", "30"); + } + + try + { + xmlwriter.SetValue(_configSection, "bitrate", Convert.ToInt32(textBox3.Text).ToString()); + } + catch + { + xmlwriter.SetValue(_configSection, "bitrate", "4086"); + } + } + } + + private void mpButton2_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} \ No newline at end of file Added: trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.resx =================================================================== --- trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.resx (rev 0) +++ trunk/plugins/DriveFreeSpace/Source/DriveFreeSpaceSettings.resx 2010-08-09 10:48:49 UTC (rev 3704) @@ -0,0 +1,177 @@ +<?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 +... [truncated message content] |