diff --git a/RainmeterStudio.Core/RainmeterStudio.Core.csproj b/RainmeterStudio.Core/RainmeterStudio.Core.csproj index b57220d8..aa876854 100644 --- a/RainmeterStudio.Core/RainmeterStudio.Core.csproj +++ b/RainmeterStudio.Core/RainmeterStudio.Core.csproj @@ -67,6 +67,7 @@ + diff --git a/RainmeterStudio.Core/Utils/LinqExtension.cs b/RainmeterStudio.Core/Utils/LinqExtension.cs index b0dda7bb..5538c31d 100644 --- a/RainmeterStudio.Core/Utils/LinqExtension.cs +++ b/RainmeterStudio.Core/Utils/LinqExtension.cs @@ -21,5 +21,19 @@ namespace RainmeterStudio.Core.Utils foreach (var obj in container) action(obj); } + + /// + /// Appends an item at the end of the container + /// + /// Enumerable type + /// Container + /// Item to append + public static IEnumerable Append (this IEnumerable container, T item) + { + foreach (var i in container) + yield return i; + + yield return item; + } } } diff --git a/RainmeterStudio.Core/Utils/PathHelper.cs b/RainmeterStudio.Core/Utils/PathHelper.cs new file mode 100644 index 00000000..0323365a --- /dev/null +++ b/RainmeterStudio.Core/Utils/PathHelper.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace RainmeterStudio.Core.Utils +{ + public static class PathHelper + { + /// + /// Validates a path + /// + /// The path + /// True if the path is valid + public static bool IsPathValid(string path) + { + // Check for invalid characters + if (Path.GetInvalidPathChars().Intersect(path).Any()) + return false; + + return true; + } + } +} diff --git a/RainmeterStudio/Properties/Settings.Designer.cs b/RainmeterStudio/Properties/Settings.Designer.cs index d8922d43..8586ff67 100644 --- a/RainmeterStudio/Properties/Settings.Designer.cs +++ b/RainmeterStudio/Properties/Settings.Designer.cs @@ -147,5 +147,41 @@ namespace RainmeterStudio.Properties { this["MainWindow_Top"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string CreateProjectDialog_RecentLocations { + get { + return ((string)(this["CreateProjectDialog_RecentLocations"])); + } + set { + this["CreateProjectDialog_RecentLocations"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string CreateProjectDialog_SavedLocation { + get { + return ((string)(this["CreateProjectDialog_SavedLocation"])); + } + set { + this["CreateProjectDialog_SavedLocation"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool CreateProjectDialog_CreateDirectoryCheckbox { + get { + return ((bool)(this["CreateProjectDialog_CreateDirectoryCheckbox"])); + } + set { + this["CreateProjectDialog_CreateDirectoryCheckbox"] = value; + } + } } } diff --git a/RainmeterStudio/Properties/Settings.settings b/RainmeterStudio/Properties/Settings.settings index 2e4c6840..af3b6bf2 100644 --- a/RainmeterStudio/Properties/Settings.settings +++ b/RainmeterStudio/Properties/Settings.settings @@ -32,5 +32,14 @@ 10 + + + + + + + + True + \ No newline at end of file diff --git a/RainmeterStudio/UI/Controller/ProjectController.cs b/RainmeterStudio/UI/Controller/ProjectController.cs index 6b2ce95e..d1577fde 100644 --- a/RainmeterStudio/UI/Controller/ProjectController.cs +++ b/RainmeterStudio/UI/Controller/ProjectController.cs @@ -107,8 +107,7 @@ namespace RainmeterStudio.UI.Controller // Create dialog var dialog = new CreateProjectDialog(this); dialog.Owner = OwnerWindow; - dialog.SelectedLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Rainmeter Studio Projects"); - + if (name != null) dialog.Name = name; diff --git a/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml b/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml index abe8c19d..27efe9ff 100644 --- a/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml +++ b/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml @@ -2,9 +2,11 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:r="clr-namespace:RainmeterStudio.Resources" - Title="{x:Static r:Strings.CreateProjectDialog_Title}" Height="320" Width="480" + xmlns:p="clr-namespace:RainmeterStudio.Properties" + Title="{x:Static r:Strings.CreateProjectDialog_Title}" Width="600" Height="400" WindowStartupLocation="CenterOwner" - WindowStyle="ToolWindow" ShowInTaskbar="False"> + WindowStyle="ToolWindow" ShowInTaskbar="False" + Closed="Window_Closed"> @@ -53,8 +55,10 @@ + +