From e8dfafa17a492bdba99151379d5d4926c267dde5 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 Feb 2017 09:05:25 -0500 Subject: [PATCH] ugh more debugging --- ModLauncher/App.config | 2 +- ShiftOS.MFSProfiler/App.config | 2 +- .../App.config | 2 +- ShiftOS.Modding.VirtualMachine/App.config | 2 +- ShiftOS.Objects/ShiftOS.Objects.csproj | 4 +- ShiftOS.Objects/packages.config | 2 +- .../ShiftOS.Server.WebAdmin.csproj | 4 +- ShiftOS.Server.WebAdmin/packages.config | 2 +- ShiftOS.Server/ShiftOS.Server.csproj | 4 +- ShiftOS.Server/packages.config | 2 +- ShiftOS.Wpf/App.config | 14 - ShiftOS.Wpf/App.xaml | 60 --- ShiftOS.Wpf/App.xaml.cs | 83 ---- ShiftOS.Wpf/Applications/FileDialog.xaml | 29 -- ShiftOS.Wpf/Applications/FileDialog.xaml.cs | 309 -------------- ShiftOS.Wpf/Applications/FileSkimmer.xaml | 20 - ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs | 324 -------------- ShiftOS.Wpf/Applications/Infobox.xaml | 13 - ShiftOS.Wpf/Applications/Infobox.xaml.cs | 87 ---- ShiftOS.Wpf/Applications/MainWindow.xaml | 10 - ShiftOS.Wpf/Applications/MainWindow.xaml.cs | 203 --------- .../Applications/ShiftoriumFrontend.xaml | 24 -- .../Applications/ShiftoriumFrontend.xaml.cs | 164 ------- ShiftOS.Wpf/Applications/SkinLoader.xaml | 75 ---- ShiftOS.Wpf/Applications/SkinLoader.xaml.cs | 200 --------- ShiftOS.Wpf/Applications/TextPad.xaml | 17 - ShiftOS.Wpf/Applications/TextPad.xaml.cs | 114 ----- ShiftOS.Wpf/Desktop.xaml | 29 -- ShiftOS.Wpf/Desktop.xaml.cs | 225 ---------- ShiftOS.Wpf/OOBE.xaml | 58 --- ShiftOS.Wpf/OOBE.xaml.cs | 300 ------------- ShiftOS.Wpf/Properties/AssemblyInfo.cs | 79 ---- ShiftOS.Wpf/Properties/Resources.Designer.cs | 95 ----- ShiftOS.Wpf/Properties/Resources.resx | 117 ----- ShiftOS.Wpf/Properties/Settings.Designer.cs | 54 --- ShiftOS.Wpf/Properties/Settings.settings | 7 - ShiftOS.Wpf/ShiftOS.Wpf.csproj | 192 --------- ShiftOS.Wpf/SkinFrontend.cs | 57 --- ShiftOS.Wpf/Startup.cs | 351 --------------- ShiftOS.Wpf/WpfInfoboxFrontend.cs | 42 -- ShiftOS.Wpf/WpfWindowBorder.xaml | 77 ---- ShiftOS.Wpf/WpfWindowBorder.xaml.cs | 399 ------------------ ShiftOS.Wpf/WpfWindowManager.cs | 87 ---- ShiftOS.Wpf/chats.json | 1 - ShiftOS.Wpf/engineconfig.json | 5 - ShiftOS.Wpf/packages.config | 4 - 46 files changed, 13 insertions(+), 3938 deletions(-) delete mode 100644 ShiftOS.Wpf/App.config delete mode 100644 ShiftOS.Wpf/App.xaml delete mode 100644 ShiftOS.Wpf/App.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/FileDialog.xaml delete mode 100644 ShiftOS.Wpf/Applications/FileDialog.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/FileSkimmer.xaml delete mode 100644 ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/Infobox.xaml delete mode 100644 ShiftOS.Wpf/Applications/Infobox.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/MainWindow.xaml delete mode 100644 ShiftOS.Wpf/Applications/MainWindow.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml delete mode 100644 ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/SkinLoader.xaml delete mode 100644 ShiftOS.Wpf/Applications/SkinLoader.xaml.cs delete mode 100644 ShiftOS.Wpf/Applications/TextPad.xaml delete mode 100644 ShiftOS.Wpf/Applications/TextPad.xaml.cs delete mode 100644 ShiftOS.Wpf/Desktop.xaml delete mode 100644 ShiftOS.Wpf/Desktop.xaml.cs delete mode 100644 ShiftOS.Wpf/OOBE.xaml delete mode 100644 ShiftOS.Wpf/OOBE.xaml.cs delete mode 100644 ShiftOS.Wpf/Properties/AssemblyInfo.cs delete mode 100644 ShiftOS.Wpf/Properties/Resources.Designer.cs delete mode 100644 ShiftOS.Wpf/Properties/Resources.resx delete mode 100644 ShiftOS.Wpf/Properties/Settings.Designer.cs delete mode 100644 ShiftOS.Wpf/Properties/Settings.settings delete mode 100644 ShiftOS.Wpf/ShiftOS.Wpf.csproj delete mode 100644 ShiftOS.Wpf/SkinFrontend.cs delete mode 100644 ShiftOS.Wpf/Startup.cs delete mode 100644 ShiftOS.Wpf/WpfInfoboxFrontend.cs delete mode 100644 ShiftOS.Wpf/WpfWindowBorder.xaml delete mode 100644 ShiftOS.Wpf/WpfWindowBorder.xaml.cs delete mode 100644 ShiftOS.Wpf/WpfWindowManager.cs delete mode 100644 ShiftOS.Wpf/chats.json delete mode 100644 ShiftOS.Wpf/engineconfig.json delete mode 100644 ShiftOS.Wpf/packages.config diff --git a/ModLauncher/App.config b/ModLauncher/App.config index 151cc15..71a06ba 100644 --- a/ModLauncher/App.config +++ b/ModLauncher/App.config @@ -7,7 +7,7 @@ - + diff --git a/ShiftOS.MFSProfiler/App.config b/ShiftOS.MFSProfiler/App.config index 5ce46cf..efb416e 100644 --- a/ShiftOS.MFSProfiler/App.config +++ b/ShiftOS.MFSProfiler/App.config @@ -8,7 +8,7 @@ - + diff --git a/ShiftOS.Modding.VB.LegacySkinConverter/App.config b/ShiftOS.Modding.VB.LegacySkinConverter/App.config index 151cc15..71a06ba 100644 --- a/ShiftOS.Modding.VB.LegacySkinConverter/App.config +++ b/ShiftOS.Modding.VB.LegacySkinConverter/App.config @@ -7,7 +7,7 @@ - + diff --git a/ShiftOS.Modding.VirtualMachine/App.config b/ShiftOS.Modding.VirtualMachine/App.config index 151cc15..71a06ba 100644 --- a/ShiftOS.Modding.VirtualMachine/App.config +++ b/ShiftOS.Modding.VirtualMachine/App.config @@ -7,7 +7,7 @@ - + diff --git a/ShiftOS.Objects/ShiftOS.Objects.csproj b/ShiftOS.Objects/ShiftOS.Objects.csproj index 5166829..484f9df 100644 --- a/ShiftOS.Objects/ShiftOS.Objects.csproj +++ b/ShiftOS.Objects/ShiftOS.Objects.csproj @@ -30,8 +30,8 @@ 4 - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/ShiftOS.Objects/packages.config b/ShiftOS.Objects/packages.config index db67311..3e14be6 100644 --- a/ShiftOS.Objects/packages.config +++ b/ShiftOS.Objects/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/ShiftOS.Server.WebAdmin/ShiftOS.Server.WebAdmin.csproj b/ShiftOS.Server.WebAdmin/ShiftOS.Server.WebAdmin.csproj index 9824c43..faec295 100644 --- a/ShiftOS.Server.WebAdmin/ShiftOS.Server.WebAdmin.csproj +++ b/ShiftOS.Server.WebAdmin/ShiftOS.Server.WebAdmin.csproj @@ -49,8 +49,8 @@ ..\packages\Nancy.Hosting.Self.1.4.1\lib\net40\Nancy.Hosting.Self.dll True - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/ShiftOS.Server.WebAdmin/packages.config b/ShiftOS.Server.WebAdmin/packages.config index a6769e8..a403e33 100644 --- a/ShiftOS.Server.WebAdmin/packages.config +++ b/ShiftOS.Server.WebAdmin/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/ShiftOS.Server/ShiftOS.Server.csproj b/ShiftOS.Server/ShiftOS.Server.csproj index 2ee1d88..890d160 100644 --- a/ShiftOS.Server/ShiftOS.Server.csproj +++ b/ShiftOS.Server/ShiftOS.Server.csproj @@ -40,8 +40,8 @@ ..\Libraries\NetSockets.dll - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/ShiftOS.Server/packages.config b/ShiftOS.Server/packages.config index 372ba6c..1bde8a9 100644 --- a/ShiftOS.Server/packages.config +++ b/ShiftOS.Server/packages.config @@ -2,7 +2,7 @@ - + diff --git a/ShiftOS.Wpf/App.config b/ShiftOS.Wpf/App.config deleted file mode 100644 index 71a06ba..0000000 --- a/ShiftOS.Wpf/App.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ShiftOS.Wpf/App.xaml b/ShiftOS.Wpf/App.xaml deleted file mode 100644 index c958acd..0000000 --- a/ShiftOS.Wpf/App.xaml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - 24 - Bottom - - - - - - - - - - - - - - - - - - - - diff --git a/ShiftOS.Wpf/App.xaml.cs b/ShiftOS.Wpf/App.xaml.cs deleted file mode 100644 index 8c8ad26..0000000 --- a/ShiftOS.Wpf/App.xaml.cs +++ /dev/null @@ -1,83 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - private void Application_Exit(object sender, ExitEventArgs e) - { - global::ShiftOS.Wpf.Startup.DestroyShiftOSEngine(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - SkinEngine.SkinLoaded += () => - { - Resources["desktoppanelbg"] = SkinEngine.LoadedSkin.DesktopPanelColor.CreateBrush(); - Resources["desktoppanelheight"] = (double)SkinEngine.LoadedSkin.DesktopPanelHeight; - switch (SkinEngine.LoadedSkin.DesktopPanelPosition) - { - case 0: - Resources["desktoppanelpos"] = VerticalAlignment.Top; - break; - case 1: - Resources["desktoppanelpos"] = VerticalAlignment.Bottom; - break; - } - - Resources["MenuBG"] = SkinEngine.LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush(); - - Resources["MenuItem"] = SkinEngine.LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush(); - Resources["MenuItemText"] = SkinEngine.LoadedSkin.Menu_TextColor.CreateBrush(); - - Resources["MenuItemPressed"] = SkinEngine.LoadedSkin.Menu_MenuItemPressedGradientBegin.CreateBrush(); - Resources["MenuItemPressedText"] = SkinEngine.LoadedSkin.Menu_SelectedTextColor.CreateBrush(); - - Resources["MenuItemHover"] = SkinEngine.LoadedSkin.Menu_MenuItemSelectedGradientBegin.CreateBrush(); - Resources["MenuItemHoverText"] = SkinEngine.LoadedSkin.Menu_SelectedTextColor.CreateBrush(); - - - Resources["MainBackColor"] = SkinEngine.LoadedSkin.ControlColor.CreateBrush(); - Resources["MainForeColor"] = SkinEngine.LoadedSkin.ControlTextColor.CreateBrush(); - Resources["TerminalBG"] = SkinEngine.LoadedSkin.TerminalBackColor.CreateBrush(); - Resources["TerminalFG"] = SkinEngine.LoadedSkin.TerminalForeColor.CreateBrush(); - - }; - } - } -} diff --git a/ShiftOS.Wpf/Applications/FileDialog.xaml b/ShiftOS.Wpf/Applications/FileDialog.xaml deleted file mode 100644 index bdf3253..0000000 --- a/ShiftOS.Wpf/Applications/FileDialog.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - Filename: - - - - - - - - - - - - - - diff --git a/ShiftOS.Wpf/Applications/FileDialog.xaml.cs b/ShiftOS.Wpf/Applications/FileDialog.xaml.cs deleted file mode 100644 index edeff65..0000000 --- a/ShiftOS.Wpf/Applications/FileDialog.xaml.cs +++ /dev/null @@ -1,309 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// - /// Interaction logic for FileDialog.xaml - /// - public partial class FileDialog : UserControl, IShiftOSWindow - { - public FileDialog(string[] filters, FileOpenerStyle style, Action callback) - { - InitializeComponent(); - Filters = filters; - OpenerStyle = style; - Callback = callback; - } - - public string[] Filters { get; set; } - public FileOpenerStyle OpenerStyle { get; set; } - public Action Callback { get; set; } - - private string currentFolder = "0:"; - - public void OnLoad() - { - Reset(); - foreach(var f in Filters) - { - filter.Items.Add(f); - } - filter.SelectedIndex = 0; - } - - public string GetParent(string path) - { - string[] pathlist = path.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); - if (pathlist.Length > 1) - { - if (path.EndsWith("/")) - { - path = path.Remove(path.Length - 1, 1); - } - path = path.Remove(path.LastIndexOf('/'), path.Length - path.LastIndexOf('/')); - return path; - } - else - { - return "__system"; - } - } - - public void Reset() - { - if (currentFolder != "__system") - this.SetTitle("File Skimmer - " + currentFolder); - else - this.SetTitle("File Skimmer"); - - lbfiles.Children.Clear(); - if (currentFolder == "__system") - { - foreach (var dir in Utils.Mounts) - { - var sp = new StackPanel(); - sp.Width = 50; - sp.Margin = new Thickness(5); - var label = new TextBlock(); - label.Text = dir.Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(Utils.Mounts.IndexOf(dir) + ":").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(Utils.Mounts.IndexOf(dir) + ":"); - } - }; - - lbfiles.Children.Add(sp); - - } - } - else - { - var __up = CreateUpOneDirectory(); - lbfiles.Children.Add(__up); - - foreach (var dir in Utils.GetDirectories(currentFolder)) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetDirectoryInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(dir); - } - }; - - lbfiles.Children.Add(sp); - - } - - foreach (var dir in Utils.GetFiles(currentFolder)) - { - if (dir.EndsWith(filter.SelectedItem.ToString())) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetFileInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - if(OpenerStyle == FileOpenerStyle.Open) - { - Callback?.Invoke(dir); - AppearanceManager.Close(this); - } - } - else - { - txtfilename.Text = Utils.GetFileInfo(dir).Name; - } - }; - - lbfiles.Children.Add(sp); - } - } - } - } - - public void ChangeDirectory(string path) - { - currentFolder = path; - Reset(); - } - - private StackPanel CreateUpOneDirectory() - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = "Up one directory"; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage("__upone").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - GoUp(); - } - }; - - return sp; - } - - public void GoUp() - { - if (currentFolder.EndsWith(":")) - { - currentFolder = "__system"; - Reset(); - } - else - { - currentFolder = GetParent(currentFolder); - Reset(); - } - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - - } - - - private void btnconfirm_Click(object sender, RoutedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(txtfilename.Text)) - { - if (!txtfilename.Text.EndsWith(filter.SelectedItem.ToString())) - txtfilename.Text += filter.SelectedItem.ToString(); - - switch (OpenerStyle) - { - case FileOpenerStyle.Open: - if(Utils.FileExists(currentFolder + "/" + txtfilename.Text)) - { - Callback?.Invoke(currentFolder + "/" + txtfilename.Text); - AppearanceManager.Close(this); - } - else - { - Infobox.Show("File not found", $"The file {currentFolder}/{txtfilename.Text} was not found."); - } - break; - case FileOpenerStyle.Save: - Callback?.Invoke(currentFolder + "/" + txtfilename.Text); - AppearanceManager.Close(this); - break; - } - } - else - { - Infobox.Show("File Skimmer", "Please provide a filename."); - } - } - - private void filter_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - Reset(); - } - } -} diff --git a/ShiftOS.Wpf/Applications/FileSkimmer.xaml b/ShiftOS.Wpf/Applications/FileSkimmer.xaml deleted file mode 100644 index ae4f435..0000000 --- a/ShiftOS.Wpf/Applications/FileSkimmer.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - diff --git a/ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs b/ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs deleted file mode 100644 index 51021c0..0000000 --- a/ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs +++ /dev/null @@ -1,324 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// - /// Interaction logic for FileSkimmer.xaml - /// - [Launcher("File Skimmer", true, "al_file_skimmer")] - [RequiresUpgrade("file_skimmer")] - public partial class FileSkimmer : UserControl, IShiftOSWindow - { - public FileSkimmer() - { - InitializeComponent(); - } - - private string currentFolder = "0:"; - - static FileSkimmer() - { - FileSkimmerBackend.Init(new WpfFSFrontend()); - } - - public void OnLoad() - { - Reset(); - } - - public string GetParent(string path) - { - string[] pathlist = path.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); - if (pathlist.Length > 1) - { - if (path.EndsWith("/")) - { - path = path.Remove(path.Length - 1, 1); - } - path = path.Remove(path.LastIndexOf('/'), path.Length - path.LastIndexOf('/')); - return path; - } - else - { - return "__system"; - } - } - - public void Reset() - { - if (currentFolder != "__system") - this.SetTitle("File Skimmer - " + currentFolder); - else - this.SetTitle("File Skimmer"); - - lbfiles.Children.Clear(); - if (currentFolder == "__system") - { - foreach(var dir in Utils.Mounts) - { - var sp = new StackPanel(); - sp.Width = 50; - sp.Margin = new Thickness(5); - var label = new TextBlock(); - label.Text = dir.Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(Utils.Mounts.IndexOf(dir) + ":").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(Utils.Mounts.IndexOf(dir) + ":"); - } - }; - - lbfiles.Children.Add(sp); - - } - } - else - { - var __up = CreateUpOneDirectory(); - lbfiles.Children.Add(__up); - - foreach(var dir in Utils.GetDirectories(currentFolder)) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetDirectoryInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(dir); - } - }; - - lbfiles.Children.Add(sp); - - } - - foreach(var dir in Utils.GetFiles(currentFolder)) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetFileInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - FileSkimmerBackend.OpenFile(dir); - } - }; - - lbfiles.Children.Add(sp); - - } - } - } - - public void ChangeDirectory(string path) - { - currentFolder = path; - Reset(); - } - - private StackPanel CreateUpOneDirectory() - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = "Up one directory"; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage("__upone").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if(a.ClickCount == 2) - { - GoUp(); - } - }; - - return sp; - } - - public void GoUp() - { - if (currentFolder.EndsWith(":")) - { - currentFolder = "__system"; - Reset(); - } - else - { - currentFolder = GetParent(currentFolder); - Reset(); - } - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - - } - } - - public class WpfFSFrontend : IFileSkimmer - { - public void GetPath(string[] filetypes, FileOpenerStyle style, Action callback) - { - AppearanceManager.SetupDialog(new FileDialog(filetypes, style, callback)); - } - - public void OpenDirectory(string path) - { - var fs = new FileSkimmer(); - fs.ChangeDirectory(path); - AppearanceManager.SetupWindow(fs); - } - - public void OpenFile(string path) - { - bool opened = true; - - string ext = path.Split('.')[path.Split('.').Length - 1]; - switch(ext) - { - case "txt": - if (Shiftorium.UpgradeInstalled("textpad_open")) - { - var txt = new TextPad(); - txt.LoadFile(path); - AppearanceManager.SetupWindow(txt); - } - else - { - opened = false; - } - break; - case "pic": - case "png": - case "jpg": - case "bmp": - - break; - case "wav": - case "mp3": - - break; - case "lua": - - break; - case "py": - - break; - case "skn": - - break; - case "mfs": - Utils.MountPersistent(path); - string mount = (Utils.Mounts.Count - 1).ToString() + ":"; - OpenDirectory(mount); - break; - default: - opened = false; - break; - } - if(opened == false) - { - Infobox.Show("File Skimmer - Can't open file", "File Skimmer can't find an application to open this file!"); - } - } - } -} diff --git a/ShiftOS.Wpf/Applications/Infobox.xaml b/ShiftOS.Wpf/Applications/Infobox.xaml deleted file mode 100644 index e2ad454..0000000 --- a/ShiftOS.Wpf/Applications/Infobox.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - Message goes here. - - - diff --git a/ShiftOS.Wpf/Applications/Infobox.xaml.cs b/ShiftOS.Wpf/Applications/Infobox.xaml.cs deleted file mode 100644 index 1786f6e..0000000 --- a/ShiftOS.Wpf/Applications/Infobox.xaml.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// - /// Interaction logic for Infobox.xaml - /// - public partial class Infobox : UserControl, IShiftOSWindow - { - public Infobox(string title, string msg) - { - InitializeComponent(); - Title = title; - Message = msg; - } - - public static void Show(string title, string msg) - { - ShiftOS.Engine.Infobox.Show(title, msg); - } - - public string Title { get; set; } - public string Message { get; set; } - - public void OnLoad() - { - this.SetTitle(Title); - txtmessage.Text = Message; - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - private void btnokay_Click(object sender, RoutedEventArgs e) - { - AppearanceManager.Close(this); - } - } -} diff --git a/ShiftOS.Wpf/Applications/MainWindow.xaml b/ShiftOS.Wpf/Applications/MainWindow.xaml deleted file mode 100644 index 22b992f..0000000 --- a/ShiftOS.Wpf/Applications/MainWindow.xaml +++ /dev/null @@ -1,10 +0,0 @@ - - - \ No newline at end of file diff --git a/ShiftOS.Wpf/Applications/MainWindow.xaml.cs b/ShiftOS.Wpf/Applications/MainWindow.xaml.cs deleted file mode 100644 index c76acec..0000000 --- a/ShiftOS.Wpf/Applications/MainWindow.xaml.cs +++ /dev/null @@ -1,203 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Engine; -using backend = ShiftOS.Engine.TerminalBackend; - -namespace ShiftOS.Wpf -{ - /// - /// Interaction logic for MainWindow.xaml - /// - [Launcher("Terminal", false)] - public partial class Terminal : UserControl, IShiftOSWindow - { - public Terminal() - { - InitializeComponent(); - Startup.ConsoleOut = this.txtterm; - - if (SaveSystem.CurrentSave == null) - { - Startup.InitiateEngine(new WpfTerminalTextWriter()); - SaveSystem.GameReady += () => - { - try - { - Dispatcher.Invoke(new Action(() => - { - txtterm.Text = ""; - backend.PrefixEnabled = true; - backend.InStory = false; - if (SaveSystem.CurrentSave.StoryPosition != 8) - { - Story.RunFromInternalResource("sys_shiftoriumstory"); - SaveSystem.CurrentSave.StoryPosition = 8; - } - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); - txtterm.Background = SkinEngine.LoadedSkin.TerminalBackColor.CreateBrush(); - txtterm.Foreground = SkinEngine.LoadedSkin.TerminalForeColor.CreateBrush(); - txtterm.SetFont(SkinEngine.LoadedSkin.TerminalFont); - })); - } - catch { } - }; - } - else - { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); - } - txtterm.Background = SkinEngine.LoadedSkin.TerminalBackColor.CreateBrush(); - txtterm.Foreground = SkinEngine.LoadedSkin.TerminalForeColor.CreateBrush(); - - txtterm.GotFocus += (o, a) => - { - Startup.ConsoleOut = txtterm; - }; - - txtterm.Focus(); - - } - - public void OnLoad() - { - this.SetTitle("Terminal"); - } - - public void OnSkinLoad() - { - txtterm.SetFont(SkinEngine.LoadedSkin.TerminalFont); - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - public void txtterm_KeyDown(object o, KeyEventArgs a) { - if (a.Key == Key.Enter) - { - try - { - a.Handled = true; - var text2 = txtterm.GetLineText(txtterm.LineCount - 1); - Console.WriteLine(""); - var text3 = ""; - var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); - - if (backend.PrefixEnabled) - { - text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); - } - backend.LastCommand = text3; - if (backend.InStory == false) - { - backend.InvokeCommand(text3); - } - if (backend.PrefixEnabled) - { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); - } - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - else if (a.Key == Key.Back) - { - var tostring3 = txtterm.GetLineText(txtterm.LineCount - 1); - var tostringlen = tostring3.Length + 1; - var workaround = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var derp = workaround.Length + 1; - if (tostringlen != derp) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.Handled = true; - } - } - else if (a.Key == Key.Left) - { - var getstring = txtterm.GetLineText(txtterm.LineCount - 1); - var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var headerlen = header.Length + 1; - var selstart = txtterm.SelectionStart; - var remstrlen = txtterm.Text.Length - stringlen; - var finalnum = selstart - remstrlen; - - if (finalnum != headerlen) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.Handled = true; - } - } - //( ͡° ͜ʖ ͡° ) You found the lennyface without looking at the commit message. Message Michael in the #shiftos channel on Discord saying "ladouceur" somewhere in your message if you see this. - else if (a.Key == Key.Up) - { - var tostring3 = txtterm.GetLineText(txtterm.LineCount - 1); - if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") - Console.Write(backend.LastCommand); - a.Handled = true; - - } - else - { - - AppearanceManager.CurrentPosition++; - } - - } - - private void txtterm_GotFocus(object sender, RoutedEventArgs e) - { - Startup.ConsoleOut = txtterm; - } - } -} diff --git a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml b/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml deleted file mode 100644 index f2d0df1..0000000 --- a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Upgrades - Codepoints: 0 - - - - - - - Cost: {Binding Cost} CP - - {Binding Description} - - - diff --git a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs b/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs deleted file mode 100644 index 8effa7c..0000000 --- a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs +++ /dev/null @@ -1,164 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Timers; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// - /// Interaction logic for ShiftoriumFrontend.xaml - /// - [Launcher("Shiftorium", true, "al_shiftorium")] - [RequiresUpgrade("shiftorium_gui")] - public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow - { - public ShiftoriumFrontend() - { - InitializeComponent(); - this.DataContextChanged += (o, a) => - { - if (this.DataContext is ShiftoriumUpgrade) - { - var upg = this.DataContext as ShiftoriumUpgrade; - title.Text = upg.Name; - this.SetTitle("Shiftorium - " + upg.Name); - description.Text = upg.Description; - cost.Text = upg.Cost.ToString(); - } - }; - this.DataContext = new ShiftoriumUpgrade - { - Name = "Welcome to the Shiftorium", - Description = @"The Shiftorium is an application that lets you buy upgrades for ShiftOS using Codepoints. - -Upgrades can be anything from new apps, to games, to system enhancements, to eyecandy, to anything else. Just be careful! The best thing to do is to buy new ways of earning Codepoints otherwise you'll find yourself unable to earn Codepoints later on.", - Cost = 0, - Dependencies = null - }; - } - - public void Setup() - { - lbupgrades.Items.Clear(); - - foreach(var itm in Shiftorium.GetAvailable()) - { - lbupgrades.Items.Add(itm.Name); - } - } - - public void OnLoad() - { - this.SetTitle("Shiftorium"); - var t = new Timer(); - t.Interval = 500; - t.Elapsed += (o,a) => - { - try - { - currentcodepoints.Text = SaveSystem.CurrentSave.Codepoints.ToString(); - } - catch { t.Stop(); } - - }; - t.Start(); - - lbupgrades.SelectionChanged += (o, a) => - { - try - { - btnbuy.Visibility = Visibility.Visible; - this.DataContext = GetUpgradeFromName(lbupgrades.SelectedItem.ToString()); - } - catch - { - - } - }; - - btnbuy.Visibility = Visibility.Collapsed; - Setup(); - } - - public ShiftoriumUpgrade GetUpgradeFromName(string upg) - { - foreach(var upgrade in Shiftorium.GetDefaults()) - { - if (upgrade.Name == upg) - return upgrade; - } - return null; - } - - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - codepointDisplay.Upgrade("shiftorium_gui_cp_display"); - } - - private void lbupgrades_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - - } - - private void btnbuy_Click_1(object sender, RoutedEventArgs e) - { - var upg = this.DataContext as ShiftoriumUpgrade; - Shiftorium.Silent = true; - if(Shiftorium.Buy(upg.ID, upg.Cost) == true) - { - btnbuy.Visibility = Visibility.Collapsed; - Setup(); - } - else - { - Infobox.Show("Shiftorium", $"You do not have enough Codepoints to buy this upgrade. You need {upg.Cost - SaveSystem.CurrentSave.Codepoints} more."); - } - } - } -} diff --git a/ShiftOS.Wpf/Applications/SkinLoader.xaml b/ShiftOS.Wpf/Applications/SkinLoader.xaml deleted file mode 100644 index 48b0f6d..0000000 --- a/ShiftOS.Wpf/Applications/SkinLoader.xaml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Template - - - - - - - - diff --git a/ShiftOS.Wpf/Applications/TextPad.xaml.cs b/ShiftOS.Wpf/Applications/TextPad.xaml.cs deleted file mode 100644 index 3438906..0000000 --- a/ShiftOS.Wpf/Applications/TextPad.xaml.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// - /// Interaction logic for TextPad.xaml - /// - [Launcher("TextPad", true, "al_textpad")] - [RequiresUpgrade("textpad")] - public partial class TextPad : UserControl, IShiftOSWindow - { - public TextPad() - { - InitializeComponent(); - } - - private void btnnew_Click(object sender, RoutedEventArgs e) - { - txtbody.Text = ""; - } - - private void btnsave_Click(object sender, RoutedEventArgs e) - { - string filters = ".txt"; - if (Shiftorium.UpgradeInstalled("textpad_lua_support")) - filters += ";.lua"; - if (Shiftorium.UpgradeInstalled("textpad_python_support")) - filters += ";.py"; - - FileSkimmerBackend.GetFile(filters.Split(';'), FileOpenerStyle.Save, new Action((file) => SaveFile(file))); - } - - private void btnopen_Click(object sender, RoutedEventArgs e) - { - string filters = ".txt"; - if (Shiftorium.UpgradeInstalled("textpad_lua_support")) - filters += ";.lua"; - if (Shiftorium.UpgradeInstalled("textpad_python_support")) - filters += ";.py"; - - FileSkimmerBackend.GetFile(filters.Split(';'), FileOpenerStyle.Open, new Action((file) => LoadFile(file))); - - } - - public void LoadFile(string path) - { - txtbody.Text = Utils.ReadAllText(path); - } - - public void SaveFile(string path) - { - Utils.WriteAllText(path, txtbody.Text); - } - - public void OnLoad() - { - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { -/* btnnew.Upgrade("textpad_new"); - btnopen.Upgrade("textpad_open"); - btnsave.Upgrade("textpad_save"); -*/ } - } -} diff --git a/ShiftOS.Wpf/Desktop.xaml b/ShiftOS.Wpf/Desktop.xaml deleted file mode 100644 index 119d9df..0000000 --- a/ShiftOS.Wpf/Desktop.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ShiftOS.Wpf/Desktop.xaml.cs b/ShiftOS.Wpf/Desktop.xaml.cs deleted file mode 100644 index a4fc1a9..0000000 --- a/ShiftOS.Wpf/Desktop.xaml.cs +++ /dev/null @@ -1,225 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using ShiftOS.Engine; -using static ShiftOS.Engine.SkinEngine; -namespace ShiftOS.Wpf -{ - /// - /// Interaction logic for Desktop.xaml - /// - public partial class Desktop : Window - { - public Desktop() - { - InitializeComponent(); - SetupUpgradeable(); - Shiftorium.Installed += () => SetupUpgradeable(); - SaveSystem.GameReady += () => - { - Dispatcher.Invoke(() => - { - SetupDesktop(); - }); - }; - } - - public void SetupUpgradeable() - { - desktoppanel.Upgrade("desktop"); - apps.Upgrade("app_launcher"); - } - - public void SetupDesktop() - { - windowlayer.Background = LoadedSkin.DesktopColor.CreateBrush(); - try - { - windowlayer.Background = new ImageBrush(LoadedSkin.DesktopBackgroundImage.ToBitmapImage()); - } - catch - { - - } - - - desktoppanel.Background = LoadedSkin.DesktopPanelColor.CreateBrush(); - try - { - desktoppanel.Background = new ImageBrush(LoadedSkin.DesktopPanelBackground.ToBitmapImage()); - } - catch { } - - apps.Background = LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush(); - apps.Content = LoadedSkin.AppLauncherText; - apps.Foreground = LoadedSkin.Menu_TextColor.CreateBrush(); - - PopulateAppLauncher(); - - SetupUpgradeable(); - } - - private static event Action onWindowShow; - private static event Action onWindowClose; - - public static void ShowWindow(WpfWindowBorder brdr) - { - - onWindowShow?.Invoke(brdr); - } - - private void Window_Loaded(object sender, RoutedEventArgs e) - { - SaveSystem.GameReady += () => Dispatcher.Invoke(() => PopulateAppLauncher()); - Shiftorium.Installed += () => Dispatcher.Invoke(() => PopulateAppLauncher()); - SkinEngine.SkinLoaded += () => Dispatcher.Invoke(() => PopulateAppLauncher()); - - - onWindowShow += (brdr) => - { - brdr.Measure(windowlayer.DesiredSize); - brdr.SetValue(System.Windows.Controls.Canvas.LeftProperty, (windowlayer.ActualWidth - brdr.Width) / 2); - brdr.SetValue(System.Windows.Controls.Canvas.TopProperty, (windowlayer.ActualHeight - brdr.ActualActualHeight) / 2); - windowlayer.Children.Add(brdr); - brdr.PreviewMouseDown += (o, a) => - { - brdr.BringToFront(windowlayer); - }; - }; - onWindowClose += (brdr) => - { - if (windowlayer.Children.Contains(brdr)) - { - windowlayer.Children.Remove(brdr); - brdr.ParentWindow.OnUnload(); - brdr = null; - } - }; - AppearanceManager.SetupWindow(new Terminal()); - } - - - public static void RemoveWindow(WpfWindowBorder brdr) - { - onWindowClose?.Invoke(brdr); - } - - public void PopulateAppLauncher() - { - appsmenu.Children.Clear(); - - double biggestWidth = 0; - - appsmenu.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush(); - - foreach (var kv in AppLauncherDaemon.Available()) - { - var item = new Button(); - if (kv.LaunchType.BaseType == typeof(System.Windows.Forms.UserControl)) - item.Content = kv.DisplayData.Name + " (Legacy)"; - else - item.Content = kv.DisplayData.Name; - item.Margin = new Thickness(2); - double measure = item.Content.ToString().Measure(LoadedSkin.MainFont); - if (measure > biggestWidth) - biggestWidth = measure; - item.Click += (o, a) => - { - AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow); - appsmenu.Visibility = Visibility.Hidden; - }; - item.HorizontalAlignment = HorizontalAlignment.Stretch; - appsmenu.Children.Add(item); - } - - if (Shiftorium.UpgradeInstalled("al_shutdown")) - { - var item = new Button(); - item.Content = ShiftOS.Engine.Localization.Parse("{SHUTDOWN}"); - item.Margin = new Thickness(2); - double measure = item.Content.ToString().Measure(LoadedSkin.MainFont); - if (measure > biggestWidth) - biggestWidth = measure; - - - item.Click += (o, a) => - { - TerminalBackend.InvokeCommand("sos.shutdown"); - }; - appsmenu.Children.Add(item); - - } - - appsmenu.Width = biggestWidth + 50; - - SkinAppLauncher(); - } - - public void SkinAppLauncher() - { - apps.Background = LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush(); - apps.Foreground = LoadedSkin.Menu_TextColor.CreateBrush(); - apps.BorderThickness = new Thickness(0.0); - - appsmenu.Height = 0; - - foreach (Control app in appsmenu.Children) - { - app.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush(); - app.Foreground = LoadedSkin.Menu_TextColor.CreateBrush(); - app.BorderThickness = new Thickness(0.0); - app.HorizontalContentAlignment = HorizontalAlignment.Left; - app.SetMouseOverStyle("menuitem"); - appsmenu.Height += app.Height; - } - } - - private void apps_Click(object sender, RoutedEventArgs e) - { - if (appsmenu.Visibility == Visibility.Hidden) - { - appsmenu.Visibility = Visibility.Visible; - } - else - { - appsmenu.Visibility = Visibility.Hidden; - } - - } - } -} diff --git a/ShiftOS.Wpf/OOBE.xaml b/ShiftOS.Wpf/OOBE.xaml deleted file mode 100644 index b081637..0000000 --- a/ShiftOS.Wpf/OOBE.xaml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Welcome to ShiftOS. - - You have been selected to be part of the testing and development of an experimental operating system named ShiftOS. - - - This wizard will guide you through the process of setting up ShiftOS. - - - First: Select your language. - - - - - - Next: System Information - - - Username: - - - - Password: - - - - System name: - - - - - - - - - - - - - - Header - - This is some text. - - - - - diff --git a/ShiftOS.Wpf/OOBE.xaml.cs b/ShiftOS.Wpf/OOBE.xaml.cs deleted file mode 100644 index 45c3f56..0000000 --- a/ShiftOS.Wpf/OOBE.xaml.cs +++ /dev/null @@ -1,300 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ShiftOS.Objects; -using ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf -{ - /// - /// Interaction logic for OOBE.xaml - /// - public partial class OOBE : UserControl, IOobe, IShiftOSWindow - { - public OOBE() - { - InitializeComponent(); - } - - private Save MySave = null; - - public void StartShowing(Save save) - { - MySave = save; - AppearanceManager.SetupWindow(this); - SetupLanguages(); - SaveSystem.GameReady += () => - { - Dispatcher.Invoke(() => - { - AppearanceManager.Close(this); - }); - }; - } - - public void SetupLanguages() - { - lblanguages.Items.Clear(); - - foreach(var lang in AppearanceManager.GetLanguages()) - { - lblanguages.Items.Add(lang); - } - } - - public void OnLoad() - { - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - private void lblanguages_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - try - { - MySave.Language = lblanguages.SelectedItem.ToString(); - userInfo.Visibility = Visibility.Visible; - } - catch { } - } - - private void txtusername_TextChanged(object sender, TextChangedEventArgs e) - { - string usr = MySave.Username; - - MySave.Username = txtusername.Text; - - if(string.IsNullOrWhiteSpace(txtsysname.Text) || txtsysname.Text == usr + "-PC") - { - txtsysname.Text = MySave.Username + "-PC"; - } - nextLabel.Visibility = Visibility.Visible; - } - - public void moveforward_Click(object s, RoutedEventArgs a) - { - tabControl.SelectedItem = tabControl.Items[1]; - StartInstall(); - } - - public void StartInstall() - { - Startup.ConsoleOut = txtterm; - pgprogress.Value = 0; - - StartOOBESlideshow(); - - } - - public void StartOOBESlideshow() - { - var t = new System.Timers.Timer(10000); - - int currentslide = 0; - - t.Elapsed += (o, a) => - { - Dispatcher.Invoke(() => - { - switch (currentslide) - { - case 0: - oobehead.Text = "Introduction"; - oobedesc.Text = @"Welcome to ShiftOS. - -You have successfully registered to take part in the testing and development of ShiftOS. We are currently installing the system's core components. - -This may take a while. There is a progress indicator at the bottom of this window. You can also see a log of everything that's happening in the terminal on the right. - -While you wait, we'll take the time to tell you about what you'll be doing."; - break; - case 1: - oobehead.Text = "About the project"; - oobedesc.Text = @"You may wanna know what exactly we're working on here. Basically, we want to make ShiftOS one of the most powerful, customizable, user-friendly operating systems in the world. Not just ONE of the most, we want to make it THE most. - -We'll do whatever we can to do this - and having you onboard is just the beginning. At ShiftOS, we strive to make things user-friendly, and versatile. We want to put a barebones operating system on your computer and see what you do with it, what you make, so we can use that data to make ShiftOS awesome."; - break; - case 2: - oobehead.Text = "The Humble Beginnings"; - oobedesc.Text = @"It may look complicated but we're really just wasting your time installing a blank desktop with a terminal. Seriously, that's all ShiftOS is right now. It's not about that, though. - -It's about what you do in this blank desktop with just a terminal. We want to see what you make of it. It's a build-your-own-system type deal - one of the best in the world, in fact."; - break; - case 3: - oobehead.Text = "Stay connected."; - oobedesc.Text = @"With ShiftOS, you're always connected to something. Like literally. Even if you turn off your home router, unplug the computer or smash it you're still connected to ShiftOS's multi-user domain. There's just no escape. - -Uhhhhhhh whoops.... I meant to make that not sound fishy."; - - break; - case 4: - oobehead.Text = "Now it's too late to go back."; - oobedesc.Text = @"I guess you weren't paying attention to that terminal seeings as you're reading this. Now, it's too late for you to go back to your old system. You're enrolled as a tester for the ShiftOS project and all your files have been deleted. - -There's no turning back. And now that you can't leave.... I don't have to keep inticing you."; - break; - case 5: - oobehead.Text = "Thanks for not choosing ShiftOS!"; - oobedesc.Text = @"By now it's definitely too late. We really value our users to the point where they can never uninstall ShiftOS. ShiftOS will haunt you in your sleep and take over your entire network. It will spread to all your friends, your family, your coworkers and even other worlds. - -We hope you enjoy your.... eternal stay."; - break; - } - }); - - if (currentslide == 5) - currentslide = 0; - else - currentslide++; - }; - - t.Start(); - - var th = new System.Threading.Thread(new ThreadStart(() => - { - Console.WriteLine("Loading useless out-of-box-experience stuff..."); - Thread.Sleep(10000); - Console.WriteLine("Introducing ShiftOS to the user..."); - Thread.Sleep(1000); - Console.Write("Formatting drive 0:/ with ShiftFS 2.0..."); - Thread.Sleep(100); - Console.WriteLine(" done"); - Thread.Sleep(500); - Console.WriteLine("Pirating programming music..."); - Thread.Sleep(250); - Console.Write("Deafening the user... "); - for (int i = 0; i < 100; i++) - { - var th2 = new Thread(new ThreadStart(() => - { - Console.Beep(1024, 1000); - })); - th2.Start(); - - } - Console.WriteLine("failed, whatever"); - - Thread.Sleep(750); - Console.WriteLine("Writing directories to the system..."); - foreach(var path in Paths.GetAllWithoutKey()) - { - Thread.Sleep(50); - if(path.StartsWith("0") && Utils.DirectoryExists(path)) - Console.WriteLine(path); - } - Thread.Sleep(500); - Console.WriteLine("Procrastinating..."); - Thread.Sleep(2000); - Console.WriteLine("Making it look like we're doing things..."); - - var rand = new Random(); - - for (int i = 0; i < 100; i++) - { - try - { - Thread.Sleep(1000 / i); - Console.WriteLine(rand.Next(int.MaxValue - 1000000000, Int32.MaxValue)); - } - catch (DivideByZeroException e) - { - Console.WriteLine($"Attempting to divide by zero.... but getting {e.GetType().Name}s..."); - Thread.Sleep(1000); - } - } - Console.WriteLine("Still procrastinating..."); - - Thread.Sleep(5000); - Console.Write("Enabling all the upgrades for free..."); - foreach(var upg in Shiftorium.GetDefaults()) - { - Shiftorium.Silent = true; - Thread.Sleep(100); - Dispatcher.Invoke(() => - { - Shiftorium.Buy(upg.ID, 0); - }); - } - Shiftorium.Silent = false; - foreach(var upg in Shiftorium.GetDefaults()) - { - SaveSystem.CurrentSave.Upgrades[upg.ID] = false; - } - Console.WriteLine(" ...and disabling them because we can."); - Dispatcher.Invoke(() => Shiftorium.InvokeUpgradeInstalled()); - - Console.WriteLine("Showing more useless stuff..."); - - while(currentslide != 0) - { - - } - Console.WriteLine("Done installing."); - - SaveSystem.CurrentSave = this.MySave; - SaveSystem.CurrentSave.StoryPosition = 5; - SaveSystem.SaveGame(); - })); - th.IsBackground = true; - th.Start(); - } - - private void txtpassword_PasswordChanged(object sender, RoutedEventArgs e) - { - MySave.Password = txtpassword.Password; - } - - private void txtsysname_TextChanged(object sender, TextChangedEventArgs e) - { - MySave.SystemName = txtsysname.Text; - } - } -} diff --git a/ShiftOS.Wpf/Properties/AssemblyInfo.cs b/ShiftOS.Wpf/Properties/AssemblyInfo.cs deleted file mode 100644 index 374638c..0000000 --- a/ShiftOS.Wpf/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,79 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// 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("ShiftOS.Wpf")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ShiftOS.Wpf")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[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)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// 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 Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ShiftOS.Wpf/Properties/Resources.Designer.cs b/ShiftOS.Wpf/Properties/Resources.Designer.cs deleted file mode 100644 index ab64e40..0000000 --- a/ShiftOS.Wpf/Properties/Resources.Designer.cs +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ShiftOS.Wpf.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.Wpf.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/ShiftOS.Wpf/Properties/Resources.resx b/ShiftOS.Wpf/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/ShiftOS.Wpf/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/ShiftOS.Wpf/Properties/Settings.Designer.cs b/ShiftOS.Wpf/Properties/Settings.Designer.cs deleted file mode 100644 index fa6bf36..0000000 --- a/ShiftOS.Wpf/Properties/Settings.Designer.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ShiftOS.Wpf.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/ShiftOS.Wpf/Properties/Settings.settings b/ShiftOS.Wpf/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/ShiftOS.Wpf/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ShiftOS.Wpf/ShiftOS.Wpf.csproj b/ShiftOS.Wpf/ShiftOS.Wpf.csproj deleted file mode 100644 index cf3b712..0000000 --- a/ShiftOS.Wpf/ShiftOS.Wpf.csproj +++ /dev/null @@ -1,192 +0,0 @@ - - - - - Debug - AnyCPU - {A589969D-227A-48AF-A176-81022CF01E62} - WinExe - Properties - ShiftOS.Wpf - ShiftOS.Wpf - v4.5.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - 4.0 - - - - - - - - - - MSBuild:Compile - Designer - - - FileDialog.xaml - - - FileSkimmer.xaml - - - Infobox.xaml - - - ShiftoriumFrontend.xaml - - - SkinLoader.xaml - - - TextPad.xaml - - - Desktop.xaml - - - OOBE.xaml - - - - - - WpfWindowBorder.xaml - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - {A069089A-8962-4607-B2B2-4CF4A371066E} - ShiftOS.Objects - - - {7c979b07-0585-4033-a110-e5555b9d6651} - ShiftOS.Engine - - - - - \ No newline at end of file diff --git a/ShiftOS.Wpf/SkinFrontend.cs b/ShiftOS.Wpf/SkinFrontend.cs deleted file mode 100644 index 5bc02bf..0000000 --- a/ShiftOS.Wpf/SkinFrontend.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media; -using ShiftOS.Engine; -using static ShiftOS.Engine.SkinEngine; -namespace ShiftOS.Wpf -{ - public class SkinFrontend : FrameworkElement - { - public Brush GetDesktopBrush() - { - try - { - return new ImageBrush(LoadedSkin.DesktopBackgroundImage.ToBitmapImage()); - } - catch - { - if (LoadedSkin != null) - { - return LoadedSkin.DesktopColor.CreateBrush(); - } - else - { - return new Skin().DesktopColor.CreateBrush(); - } - } - } - } -} diff --git a/ShiftOS.Wpf/Startup.cs b/ShiftOS.Wpf/Startup.cs deleted file mode 100644 index a4e8bbc..0000000 --- a/ShiftOS.Wpf/Startup.cs +++ /dev/null @@ -1,351 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Threading; -using ShiftOS.Engine; -using static ShiftOS.Engine.SkinEngine; - -namespace ShiftOS.Wpf -{ - public static class ShiftOSSkin - { - public static Brush GetAppButtonHoverBrush(DependencyObject obj) - { - return (Brush)obj.GetValue(AppButtonHoverBrushProperty); - } - - public static void SetAppButtonHoverBrush(DependencyObject obj, Brush value) - { - obj.SetValue(AppButtonHoverBrushProperty, value); - } - - public static readonly DependencyProperty AppButtonHoverBrushProperty = - DependencyProperty.RegisterAttached( - "AppButtonHoverBrush", - typeof(Brush), - typeof(ShiftOSSkin), - new FrameworkPropertyMetadata(LoadedSkin.Menu_MenuItemSelected.CreateBrush())); - } - - public static class Startup - { - private static Visibility getVisibility(string upg) - { - if (Shiftorium.UpgradeInstalled(upg)) - { - return Visibility.Visible; - } - else - { - return Visibility.Collapsed; - - } - } - - - public static void Upgrade(this Control ctrl, string upg) - { - ctrl.Visibility = getVisibility(upg); - - } - - public static void Upgrade(this UIElement ctrl, string upg) - { - ctrl.Visibility = getVisibility(upg); - - } - - static public void BringToFront(this UserControl pToMove, Canvas pParent) - { - int currentIndex = Canvas.GetZIndex(pToMove); - int zIndex = 0; - int maxZ = 0; - UserControl child; - for (int i = 0; i < pParent.Children.Count; i++) - { - if (pParent.Children[i] is UserControl && - pParent.Children[i] != pToMove) - { - child = pParent.Children[i] as UserControl; - zIndex = Canvas.GetZIndex(child); - maxZ = Math.Max(maxZ, zIndex); - if (zIndex > currentIndex) - { - Canvas.SetZIndex(child, zIndex - 1); - } - } - } - Canvas.SetZIndex(pToMove, maxZ); - - } - - public static void SetTitle(this IShiftOSWindow win, string title) - { - foreach(var frm in AppearanceManager.OpenForms) - { - if(frm.ParentWindow == win) - { - frm.Text = title; - } - } - } - - public static void InitiateEngine(System.IO.TextWriter writer) - { - OutOfBoxExperience.Init(new OOBE()); - AppearanceManager.Initiate(new WpfWindowManager()); - Infobox.Init(new WpfInfoboxFrontend()); - FileSkimmerBackend.Init(new Applications.WpfFSFrontend()); - if (writer != null) - { - Console.SetOut(writer); - } - SaveSystem.Begin(false); - AppearanceManager.OnExit += () => - { - Environment.Exit(0); - }; - } - - public static void SetMouseOverStyle(this Control button, string style = "") - { - var bg = button.Background; - var fg = button.Foreground; - var border = button.BorderThickness; - var borderfg = button.BorderBrush; - - button.MouseEnter += (o, a) => - { - try - { - switch (style) - { - case "menuitem": - button.Background = LoadedSkin.Menu_MenuItemSelected.CreateBrush(); - button.Foreground = LoadedSkin.Menu_SelectedTextColor.CreateBrush(); - button.BorderBrush = LoadedSkin.Menu_MenuItemBorder.CreateBrush(); - break; - } - } - catch { } - }; - button.MouseLeave += (o, a) => - { - try - { - button.Background = bg; - button.Foreground = fg; - button.BorderThickness = border; - button.BorderBrush = borderfg; - } - catch - { - - } - }; - - - } - - public static void DestroyShiftOSEngine() - { - ServerManager.Disconnect(); - } - - public static TextBox ConsoleOut { get; set; } - - public static SolidColorBrush CreateBrush(this System.Drawing.Color color) - { - return new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, color.B)); - } - - public struct Font - { - public FontFamily FontFamily { get; set; } - public double FontSize { get; set; } - public FontStyle FontStyle { get; set; } - public FontWeight FontWeight { get; set; } - } - - private static Font createFont(System.Drawing.Font f) - { - var font = new Font(); - font.FontFamily = new FontFamily(f.Name); - font.FontSize = f.Size; - switch (f.Style) - { - case System.Drawing.FontStyle.Bold: - font.FontWeight = FontWeights.Bold; - break; - case System.Drawing.FontStyle.Italic: - font.FontStyle = FontStyles.Oblique; - break; - default: - case System.Drawing.FontStyle.Regular: - font.FontStyle = FontStyles.Normal; - break; - - - } - return font; - } - - public static void SetFont(this Control ctrl, System.Drawing.Font f) - { - var font = createFont(f); - ctrl.FontFamily = font.FontFamily; - ctrl.FontSize = PointsToPixels(font.FontSize); - ctrl.FontStyle = font.FontStyle; - ctrl.FontWeight = font.FontWeight; - } - - private static double PointsToPixels(double points) - { - return points * (96.0 / 72.0); - } - - public static void SetFont(this TextBlock ui, System.Drawing.Font f) - { - var font = createFont(f); - ui.FontFamily = font.FontFamily; - ui.FontSize = PointsToPixels(font.FontSize); - ui.FontStyle = font.FontStyle; - ui.FontWeight = font.FontWeight; - } - - public static BitmapImage ToBitmapImage(this System.Drawing.Image img) - { - using(var str = new MemoryStream()) - { - img.Save(str, System.Drawing.Imaging.ImageFormat.Png); - return ToBitmapImage(str.ToArray()); - } - } - - public static BitmapImage ToBitmapImage(this byte[] imgSource) - { - using(MemoryStream ms = new MemoryStream(imgSource)) - { - var img = new BitmapImage(); - img.BeginInit(); - img.StreamSource = ms; - img.CacheOption = BitmapCacheOption.OnLoad; - img.EndInit(); - return img; - } - } - } - - public class WpfTerminalTextWriter : TextWriter - { - public override Encoding Encoding - { - get - { - return Encoding.Unicode; - } - } - - public TextBox UnderlyingControl - { - get - { - return Startup.ConsoleOut; - } - } - - public void select() - { - try - { - UnderlyingControl.Select(UnderlyingControl.Text.Length, 0); - UnderlyingControl.ScrollToEnd(); - UnderlyingControl.Focus(); - AppearanceManager.CurrentPosition = 1; - AppearanceManager.LastLength = UnderlyingControl.Text.Length - 1; - } - catch { } - } - - public override void Write(char value) - { - try - { - UnderlyingControl.Dispatcher.Invoke(new Action(() => - { - UnderlyingControl.AppendText(value.ToString()); - select(); - })); - } - catch { } - } - - public override void WriteLine(string value) - { - try - { - UnderlyingControl.Dispatcher.Invoke(new Action(() => - { - UnderlyingControl.AppendText(ShiftOS.Engine.Localization.Parse(value) + Environment.NewLine); - select(); - })); - } - catch { } - } - - public void SetLastText() - { - if (SaveSystem.CurrentSave != null) - { - if (!Shiftorium.UpgradeInstalled("window_manager")) - AppearanceManager.LastTerminalText = UnderlyingControl.Text; - } - } - - public override void Write(string value) - { - try - { - UnderlyingControl.Dispatcher.Invoke(new Action(() => - { - UnderlyingControl.AppendText(ShiftOS.Engine.Localization.Parse(value)); - select(); - })); - } - catch { } - } - - - } -} diff --git a/ShiftOS.Wpf/WpfInfoboxFrontend.cs b/ShiftOS.Wpf/WpfInfoboxFrontend.cs deleted file mode 100644 index a1d9098..0000000 --- a/ShiftOS.Wpf/WpfInfoboxFrontend.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf -{ - class WpfInfoboxFrontend : IInfobox - { - public void Open(string title, string msg) - { - var inf = new Applications.Infobox(title, msg); - AppearanceManager.SetupDialog(inf); - } - } -} diff --git a/ShiftOS.Wpf/WpfWindowBorder.xaml b/ShiftOS.Wpf/WpfWindowBorder.xaml deleted file mode 100644 index 49de84d..0000000 --- a/ShiftOS.Wpf/WpfWindowBorder.xaml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - This is a title. - -