mirror of
https://github.com/ShiftOS-Rewind/ShiftOS.git
synced 2025-01-22 03:11:47 -05:00
Added a half-complete ShiftFS and did some code cleanup
This commit is contained in:
parent
019da5b9eb
commit
a10440a45c
39 changed files with 904 additions and 1570 deletions
Binary file not shown.
50
ShiftOS.Engine/Misc/IniFile.cs
Normal file
50
ShiftOS.Engine/Misc/IniFile.cs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ShiftOS.Engine.Misc
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create a New INI file to store or load data
|
||||||
|
/// </summary>
|
||||||
|
public class IniFile
|
||||||
|
{
|
||||||
|
readonly string _path;
|
||||||
|
|
||||||
|
public IniFile(string iniPath) => _path = iniPath;
|
||||||
|
|
||||||
|
[DllImport("kernel32")]
|
||||||
|
static extern long WritePrivateProfileString(
|
||||||
|
string section,
|
||||||
|
string key,
|
||||||
|
string val,
|
||||||
|
string filePath);
|
||||||
|
|
||||||
|
[DllImport("kernel32")]
|
||||||
|
static extern int GetPrivateProfileString(
|
||||||
|
string section,
|
||||||
|
string key,
|
||||||
|
string def,
|
||||||
|
StringBuilder retVal,
|
||||||
|
int size,
|
||||||
|
string filePath);
|
||||||
|
|
||||||
|
public void WriteValue(string section, string key, string value)
|
||||||
|
{
|
||||||
|
WritePrivateProfileString(section, key, value, _path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ReadValue(string section, string key)
|
||||||
|
{
|
||||||
|
var temp = new StringBuilder(255);
|
||||||
|
GetPrivateProfileString(
|
||||||
|
section,
|
||||||
|
key,
|
||||||
|
"",
|
||||||
|
temp,
|
||||||
|
255,
|
||||||
|
_path);
|
||||||
|
|
||||||
|
return temp.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,26 +1,24 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace ShiftOS.Engine
|
namespace ShiftOS.Engine.Misc
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Random class full of unassorted [but also uncategorizable] tools.
|
/// Random class full of unassorted [but also uncategorizable] tools.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Tools
|
public static class Tools
|
||||||
{
|
{
|
||||||
public static Random Rnd = new Random();
|
public static Random Rnd = new Random();
|
||||||
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
public extern static bool DestroyIcon(IntPtr handle);
|
public static extern bool DestroyIcon(IntPtr handle);
|
||||||
|
|
||||||
public static Icon ToIcon(this Bitmap bm)
|
public static Icon ToIcon(this Bitmap bm)
|
||||||
{
|
{
|
||||||
Icon tempicon = Icon.FromHandle(bm.GetHicon());
|
var tempicon = Icon.FromHandle(bm.GetHicon());
|
||||||
|
|
||||||
Icon newIcon = tempicon.Clone() as Icon;
|
var newIcon = tempicon.Clone() as Icon;
|
||||||
|
|
||||||
//for some reason this exists
|
//for some reason this exists
|
||||||
DestroyIcon(tempicon.Handle);
|
DestroyIcon(tempicon.Handle);
|
||||||
|
@ -28,4 +26,4 @@ namespace ShiftOS.Engine
|
||||||
return newIcon;
|
return newIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -33,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
50
ShiftOS.Engine/ShiftFS/ShiftDirectory.cs
Normal file
50
ShiftOS.Engine/ShiftFS/ShiftDirectory.cs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace ShiftOS.Engine.ShiftFS
|
||||||
|
{
|
||||||
|
public class ShiftDirectory : ShiftFsObject
|
||||||
|
{
|
||||||
|
public ShiftDirectory(string path) : base(path)
|
||||||
|
{
|
||||||
|
path = path.Replace(ShiftFs.SavePath, "");
|
||||||
|
var dir = new DirectoryInfo(Path.Combine(ShiftFs.SavePath, path));
|
||||||
|
Name = dir.Name;
|
||||||
|
FullDiskName = dir.FullName;
|
||||||
|
FullName = path;
|
||||||
|
|
||||||
|
Children.CollectionChanged += (sender, e) => { };
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShiftFsObject this[string name] => Children.First(f => f.Name == name);
|
||||||
|
public ShiftFsObject this[int index] => Children[index];
|
||||||
|
|
||||||
|
public new ShiftDirectory Parent => new ShiftDirectory(new DirectoryInfo(FullDiskName).Parent.FullName);
|
||||||
|
|
||||||
|
public ObservableCollection<ShiftFsObject> Children
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var collection = new ObservableCollection<ShiftFsObject>();
|
||||||
|
|
||||||
|
foreach (var dir in new DirectoryInfo(Path.Combine(ShiftFs.SavePath, FullName)).EnumerateDirectories())
|
||||||
|
{
|
||||||
|
collection.Add(new ShiftDirectory(dir.FullName));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var file in new DirectoryInfo(Path.Combine(ShiftFs.SavePath, FullName)).EnumerateFiles())
|
||||||
|
{
|
||||||
|
collection.Add(new ShiftFile(file.FullName.Replace(ShiftFs.SavePath, "")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<ShiftFile> Files => new ObservableCollection<ShiftFile>(Children.OfType<ShiftFile>());
|
||||||
|
|
||||||
|
public ObservableCollection<ShiftDirectory> Directories
|
||||||
|
=> new ObservableCollection<ShiftDirectory>(Children.OfType<ShiftDirectory>());
|
||||||
|
}
|
||||||
|
}
|
20
ShiftOS.Engine/ShiftFS/ShiftDrive.cs
Normal file
20
ShiftOS.Engine/ShiftFS/ShiftDrive.cs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
using System.IO;
|
||||||
|
using ShiftOS.Engine.Misc;
|
||||||
|
|
||||||
|
namespace ShiftOS.Engine.ShiftFS
|
||||||
|
{
|
||||||
|
public class ShiftDrive
|
||||||
|
{
|
||||||
|
internal ShiftDrive(DirectoryInfo dir)
|
||||||
|
{
|
||||||
|
Label = dir.Name;
|
||||||
|
var file = new IniFile(Path.Combine(dir.FullName, "driveinfo.ini"));
|
||||||
|
Letter = char.TryParse(file.ReadValue("", "DriveLetter"), out var letter) ? letter : '?';
|
||||||
|
Contents = new ShiftDirectory(dir.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Label { get; }
|
||||||
|
public char Letter { get; }
|
||||||
|
public ShiftDirectory Contents { get; }
|
||||||
|
}
|
||||||
|
}
|
34
ShiftOS.Engine/ShiftFS/ShiftFS.cs
Normal file
34
ShiftOS.Engine/ShiftFS/ShiftFS.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace ShiftOS.Engine.ShiftFS
|
||||||
|
{
|
||||||
|
public static class ShiftFs
|
||||||
|
{
|
||||||
|
internal static readonly string SavePath = Path.Combine(Environment.CurrentDirectory, "Save") + "\\";
|
||||||
|
|
||||||
|
public static ObservableCollection<ShiftDrive> Drives = new ObservableCollection<ShiftDrive>();
|
||||||
|
|
||||||
|
static ShiftFs()
|
||||||
|
{
|
||||||
|
if (Directory.Exists(SavePath))
|
||||||
|
{
|
||||||
|
var info = new DirectoryInfo(SavePath);
|
||||||
|
foreach (var dir in info.EnumerateDirectories())
|
||||||
|
{
|
||||||
|
Drives.Add(new ShiftDrive(dir));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreateSaveFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateSaveFile()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
ShiftOS.Engine/ShiftFS/ShiftFSObject.cs
Normal file
25
ShiftOS.Engine/ShiftFS/ShiftFSObject.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace ShiftOS.Engine.ShiftFS
|
||||||
|
{
|
||||||
|
public abstract class ShiftFsObject
|
||||||
|
{
|
||||||
|
protected ShiftFsObject(string path)
|
||||||
|
{
|
||||||
|
if (!File.Exists(Path.Combine(ShiftFs.SavePath, path)) && !Directory.Exists(Path.Combine(ShiftFs.SavePath, path)))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public ShiftDirectory Parent { get; protected set; }
|
||||||
|
public string FullName { get; set; }
|
||||||
|
protected string FullDiskName { get; set; }
|
||||||
|
|
||||||
|
public void Delete()
|
||||||
|
{
|
||||||
|
File.Delete(FullDiskName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
ShiftOS.Engine/ShiftFS/ShiftFile.cs
Normal file
48
ShiftOS.Engine/ShiftFS/ShiftFile.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
|
||||||
|
namespace ShiftOS.Engine.ShiftFS
|
||||||
|
{
|
||||||
|
public class ShiftFile : ShiftFsObject
|
||||||
|
{
|
||||||
|
public ShiftFile(string path) : base(path)
|
||||||
|
{
|
||||||
|
path = path.Replace(ShiftFs.SavePath, "");
|
||||||
|
|
||||||
|
using (var fs = new FileStream(Path.Combine(ShiftFs.SavePath, path), FileMode.Open))
|
||||||
|
{
|
||||||
|
Bytes = new MemoryStream();
|
||||||
|
fs.CopyTo(Bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
var file = new FileInfo(Path.Combine(ShiftFs.SavePath, path));
|
||||||
|
|
||||||
|
Name = file.Name;
|
||||||
|
FullDiskName = file.FullName;
|
||||||
|
FullName = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public new ShiftDirectory Parent => new ShiftDirectory(new FileInfo(FullDiskName).Directory.FullName);
|
||||||
|
|
||||||
|
public MemoryStream Bytes { get; set; }
|
||||||
|
public long Length => Bytes.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ShiftFile<T> : ShiftFile // please C# gods let us constrain to attributes
|
||||||
|
{
|
||||||
|
public ShiftFile(string path) : base(path)
|
||||||
|
{
|
||||||
|
if (!typeof(T).IsSerializable)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Non-serializable types are not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Object
|
||||||
|
{
|
||||||
|
get => (T) new BinaryFormatter().Deserialize(Bytes);
|
||||||
|
set => new BinaryFormatter().Serialize(Bytes, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,16 +46,22 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Misc\IniFile.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ShiftFS\ShiftDirectory.cs" />
|
||||||
|
<Compile Include="ShiftFS\ShiftDrive.cs" />
|
||||||
|
<Compile Include="ShiftFS\ShiftFile.cs" />
|
||||||
|
<Compile Include="ShiftFS\ShiftFS.cs" />
|
||||||
|
<Compile Include="ShiftFS\ShiftFSObject.cs" />
|
||||||
<Compile Include="Terminal\Commands\Hello.cs" />
|
<Compile Include="Terminal\Commands\Hello.cs" />
|
||||||
<Compile Include="Terminal\TerminalBackend.cs" />
|
<Compile Include="Terminal\TerminalBackend.cs" />
|
||||||
<Compile Include="Terminal\TerminalCommand.cs" />
|
<Compile Include="Terminal\TerminalCommand.cs" />
|
||||||
<Compile Include="Tools.cs" />
|
<Compile Include="Misc\Tools.cs" />
|
||||||
<Compile Include="WindowManager\InfoboxTemplate.cs">
|
<Compile Include="WindowManager\InfoboxTemplate.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -1,21 +1,9 @@
|
||||||
using System;
|
namespace ShiftOS.Engine.Terminal.Commands
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ShiftOS.Engine.Terminal.Commands
|
|
||||||
{
|
{
|
||||||
public class Hello : TerminalCommand
|
public class Hello : TerminalCommand
|
||||||
{
|
{
|
||||||
public override string GetName()
|
public override string GetName() => "Hello";
|
||||||
{
|
|
||||||
return "Hello";
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string Run(params string[] parameters)
|
public override string Run(params string[] parameters) => "Oh, HELLO, " + string.Join(" ", parameters);
|
||||||
{
|
}
|
||||||
return "Oh, HELLO, " + String.Join(" ", parameters);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,45 +2,46 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ShiftOS.Engine.Terminal
|
namespace ShiftOS.Engine.Terminal
|
||||||
{
|
{
|
||||||
public static class TerminalBackend
|
public static class TerminalBackend
|
||||||
{
|
{
|
||||||
// The line below gets all the terminal commands in... well... the entire ShiftOS.Engine
|
// The line below gets all the terminal commands in... well... the entire ShiftOS.Engine
|
||||||
public static IEnumerable<TerminalCommand> instances = from t in Assembly.GetExecutingAssembly().GetTypes()
|
static readonly IEnumerable<TerminalCommand> Instances = from t in Assembly.GetExecutingAssembly().GetTypes()
|
||||||
where t.IsSubclassOf(typeof(TerminalCommand))
|
where t.IsSubclassOf(typeof(TerminalCommand)) &&
|
||||||
&& t.GetConstructor(Type.EmptyTypes) != null
|
t.GetConstructor(Type.EmptyTypes) != null
|
||||||
select Activator.CreateInstance(t) as TerminalCommand;
|
select (TerminalCommand) Activator.CreateInstance(t);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs a terminal command.
|
/// Runs a terminal command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns>Returns all the output from that command.</returns>
|
/// <returns>Returns all the output from that command.</returns>
|
||||||
public static string RunCommand(string command)
|
public static string RunCommand(string command)
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
try { name = command.Split(' ')[0]; } catch { name = command; }
|
try
|
||||||
|
{
|
||||||
|
name = command.Split(' ')[0];
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
name = command;
|
||||||
|
}
|
||||||
|
|
||||||
var theParams = new string[command.Split(' ').Length - 1];
|
var theParams = new string[command.Split(' ').Length - 1];
|
||||||
Array.Copy(command.Split(' '), 1, theParams, 0, command.Split(' ').Length - 1);
|
Array.Copy(command.Split(' '), 1, theParams, 0, command.Split(' ').Length - 1);
|
||||||
|
|
||||||
foreach (TerminalCommand instance in instances)
|
foreach (var instance in Instances)
|
||||||
{
|
{
|
||||||
if (instance.GetName() == name)
|
if (instance.GetName() == name)
|
||||||
return instance.Run(theParams);
|
{
|
||||||
}
|
return instance.Run(theParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return "The command cannot be found.";
|
return "The command cannot be found.";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// An extra function ;)
|
}
|
||||||
private static Type[] GetTypesInNamespace(Assembly assembly, string nameSpace)
|
|
||||||
{
|
|
||||||
return assembly.GetTypes().Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal)).ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +1,9 @@
|
||||||
using System;
|
namespace ShiftOS.Engine.Terminal
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ShiftOS.Engine.Terminal
|
|
||||||
{
|
{
|
||||||
public abstract class TerminalCommand
|
public abstract class TerminalCommand
|
||||||
{
|
{
|
||||||
public abstract string GetName();
|
public abstract string GetName();
|
||||||
|
|
||||||
public abstract string Run(params string[] parameters);
|
public abstract string Run(params string[] parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,94 +1,94 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Media;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Media;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using ShiftOS.Engine.Properties;
|
||||||
|
|
||||||
namespace ShiftOS.Engine.WindowManager
|
namespace ShiftOS.Engine.WindowManager
|
||||||
{
|
{
|
||||||
public partial class InfoboxTemplate : UserControl
|
public partial class InfoboxTemplate : UserControl
|
||||||
{
|
{
|
||||||
Stream _str;
|
public enum ButtonType
|
||||||
private int _buttonChoice;
|
{
|
||||||
private int _buttonSelected;
|
YesNo,
|
||||||
public InfoboxTemplate(ButtonType type)
|
OkCancel,
|
||||||
{
|
Ok
|
||||||
InitializeComponent();
|
}
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case ButtonType.Ok:
|
|
||||||
btnOpt1.Text = "OK";
|
|
||||||
btnOpt2.Hide();
|
|
||||||
btnOpt1.Location = new Point(109, 134);
|
|
||||||
_buttonChoice = 1;
|
|
||||||
break;
|
|
||||||
case ButtonType.OkCancel:
|
|
||||||
btnOpt1.Text = "OK";
|
|
||||||
btnOpt2.Text = "Cancel";
|
|
||||||
_buttonChoice = 2;
|
|
||||||
break;
|
|
||||||
case ButtonType.YesNo:
|
|
||||||
btnOpt1.Text = "Yes";
|
|
||||||
btnOpt2.Text = "No";
|
|
||||||
_buttonChoice = 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ButtonType
|
public enum DialogResult
|
||||||
{
|
{
|
||||||
YesNo,
|
Yes,
|
||||||
OkCancel,
|
No,
|
||||||
Ok
|
Cancel,
|
||||||
}
|
Ok
|
||||||
|
}
|
||||||
|
|
||||||
public enum DialogResult
|
int _buttonChoice;
|
||||||
{
|
int _buttonSelected;
|
||||||
Yes,
|
Stream _str;
|
||||||
No,
|
|
||||||
Cancel,
|
|
||||||
Ok
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnOpt1_Click(object sender, EventArgs e)
|
public InfoboxTemplate(ButtonType type)
|
||||||
{
|
{
|
||||||
switch (btnOpt1.Text)
|
InitializeComponent();
|
||||||
{
|
|
||||||
case "OK":
|
|
||||||
ParentForm?.Close();
|
|
||||||
break;
|
|
||||||
case "Yes":
|
|
||||||
_buttonSelected = 2;
|
|
||||||
ParentForm?.Close();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnOpt2_Click(object sender, EventArgs e)
|
switch (type)
|
||||||
{
|
{
|
||||||
switch (btnOpt2.Text)
|
case ButtonType.Ok:
|
||||||
{
|
btnOpt1.Text = "OK";
|
||||||
case "No":
|
btnOpt2.Hide();
|
||||||
_buttonSelected = 3;
|
btnOpt1.Location = new Point(109, 134);
|
||||||
break;
|
_buttonChoice = 1;
|
||||||
case "Cancel":
|
break;
|
||||||
_buttonSelected = 4;
|
case ButtonType.OkCancel:
|
||||||
break;
|
btnOpt1.Text = "OK";
|
||||||
}
|
btnOpt2.Text = "Cancel";
|
||||||
}
|
_buttonChoice = 2;
|
||||||
|
break;
|
||||||
|
case ButtonType.YesNo:
|
||||||
|
btnOpt1.Text = "Yes";
|
||||||
|
btnOpt2.Text = "No";
|
||||||
|
_buttonChoice = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Play()
|
void btnOpt1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_str = Properties.Resources.infobox;
|
switch (btnOpt1.Text)
|
||||||
SoundPlayer sp = new SoundPlayer(_str);
|
{
|
||||||
sp.Play();
|
case "OK":
|
||||||
sp.Stream.Position = 0;
|
ParentForm?.Close();
|
||||||
}
|
break;
|
||||||
|
case "Yes":
|
||||||
|
_buttonSelected = 2;
|
||||||
|
ParentForm?.Close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void InfoboxTemplate_Load(object sender, EventArgs e)
|
void btnOpt2_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
switch (btnOpt2.Text)
|
||||||
|
{
|
||||||
|
case "No":
|
||||||
|
_buttonSelected = 3;
|
||||||
|
break;
|
||||||
|
case "Cancel":
|
||||||
|
_buttonSelected = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Play()
|
||||||
|
{
|
||||||
|
_str = Resources.infobox;
|
||||||
|
var sp = new SoundPlayer(_str);
|
||||||
|
sp.Play();
|
||||||
|
sp.Stream.Position = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoboxTemplate_Load(object sender, EventArgs e)
|
||||||
=> Play();
|
=> Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,22 +2,23 @@
|
||||||
|
|
||||||
namespace ShiftOS.Engine.WindowManager
|
namespace ShiftOS.Engine.WindowManager
|
||||||
{
|
{
|
||||||
public abstract class ShiftSkinData
|
public abstract class ShiftSkinData
|
||||||
{
|
{
|
||||||
// ColorData
|
// ColorData
|
||||||
public static Color leftTopCornerColor = Color.Empty;
|
public static Color LeftTopCornerColor = Color.Empty;
|
||||||
public static Color titleBarColor = Color.Empty;
|
|
||||||
public static Color rightTopCornerColor = Color.Empty;
|
public static Color TitleBarColor = Color.Empty;
|
||||||
public static Color btnCloseColor = Color.Empty;
|
public static Color RightTopCornerColor = Color.Empty;
|
||||||
public static Color btnMaxColor = Color.Empty;
|
public static Color BtnCloseColor = Color.Empty;
|
||||||
public static Color btnMinColor = Color.Empty;
|
public static Color BtnMaxColor = Color.Empty;
|
||||||
public static Color btnCloseHoverColor = Color.Empty;
|
public static Color BtnMinColor = Color.Empty;
|
||||||
public static Color btnMaxHoverColor = Color.Empty;
|
public static Color BtnCloseHoverColor = Color.Empty;
|
||||||
public static Color btnMinHoverColor = Color.Empty;
|
public static Color BtnMaxHoverColor = Color.Empty;
|
||||||
public static Color leftSideColor = Color.Empty;
|
public static Color BtnMinHoverColor = Color.Empty;
|
||||||
public static Color rightSideColor = Color.Empty;
|
public static Color LeftSideColor = Color.Empty;
|
||||||
public static Color leftBottomCornerColor = Color.Empty;
|
public static Color RightSideColor = Color.Empty;
|
||||||
public static Color bottomSideColor = Color.Empty;
|
public static Color LeftBottomCornerColor = Color.Empty;
|
||||||
public static Color rightBottomCornerColor = Color.Empty;
|
public static Color BottomSideColor = Color.Empty;
|
||||||
}
|
public static Color RightBottomCornerColor = Color.Empty;
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,126 +1,129 @@
|
||||||
using System;
|
using System.Collections.ObjectModel;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using ShiftOS.Engine.Misc;
|
||||||
|
using ShiftOS.Engine.Properties;
|
||||||
using static ShiftOS.Engine.WindowManager.InfoboxTemplate;
|
using static ShiftOS.Engine.WindowManager.InfoboxTemplate;
|
||||||
|
|
||||||
namespace ShiftOS.Engine.WindowManager
|
namespace ShiftOS.Engine.WindowManager
|
||||||
{
|
{
|
||||||
public static class ShiftWM
|
public static class ShiftWm
|
||||||
{
|
{
|
||||||
public static ObservableCollection<ShiftWindow> Windows { get; } = new ObservableCollection<ShiftWindow>();
|
public static ObservableCollection<ShiftWindow> Windows { get; } = new ObservableCollection<ShiftWindow>();
|
||||||
|
|
||||||
public static ShiftWindow GetShiftWindow(this UserControl control)
|
public static ShiftWindow GetShiftWindow(this UserControl control)
|
||||||
{
|
{
|
||||||
return Windows.First(p => (uint) control.Tag == p.Id);
|
return Windows.First(p => (uint) control.Tag == p.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows a new ShiftWindow based on a UserControl.
|
/// Shows a new ShiftWindow based on a UserControl.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="content">The UserControl to use</param>
|
/// <param name="content">The UserControl to use</param>
|
||||||
/// <param name="title">The program's title</param>
|
/// <param name="title">The program's title</param>
|
||||||
/// <param name="icon">The icon to show</param>
|
/// <param name="icon">The icon to show</param>
|
||||||
/// <param name="showAsInfobox">Checks if this is an infobox</param>
|
/// <param name="showAsInfobox">Checks if this is an infobox</param>
|
||||||
/// <param name="resize">Enables or disables resizing</param>
|
/// <param name="resize">Enables or disables resizing</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ShiftWindow Init(UserControl content, string title, Icon icon, bool showAsInfobox = false, bool resize = true)
|
public static ShiftWindow Init(
|
||||||
{
|
UserControl content,
|
||||||
// Setup Window
|
string title,
|
||||||
ShiftWindow app = new ShiftWindow
|
Icon icon,
|
||||||
{
|
bool showAsInfobox = false,
|
||||||
Text = title,
|
bool resize = true)
|
||||||
Title = {Text = title}
|
{
|
||||||
};
|
// Setup Window
|
||||||
|
var app = new ShiftWindow
|
||||||
|
{
|
||||||
|
Text = title,
|
||||||
|
Title = { Text = title }
|
||||||
|
};
|
||||||
|
|
||||||
app.Width = content.Width + app.leftSide.Width + app.rightSide.Width;
|
app.Width = content.Width + app.leftSide.Width + app.rightSide.Width;
|
||||||
app.Height = content.Height + app.bottomSide.Height + app.titleBar.Height;
|
app.Height = content.Height + app.bottomSide.Height + app.titleBar.Height;
|
||||||
|
|
||||||
if (ShiftSkinData.titleBarColor == Color.Empty)
|
if (ShiftSkinData.TitleBarColor == Color.Empty)
|
||||||
{
|
{
|
||||||
Color borderColor = Color.FromArgb(64, 64, 64);
|
var borderColor = Color.FromArgb(64, 64, 64);
|
||||||
ShiftSkinData.btnCloseColor = Color.Black;
|
ShiftSkinData.BtnCloseColor = Color.Black;
|
||||||
ShiftSkinData.btnMaxColor = Color.Black;
|
ShiftSkinData.BtnMaxColor = Color.Black;
|
||||||
ShiftSkinData.btnMinColor = Color.Black;
|
ShiftSkinData.BtnMinColor = Color.Black;
|
||||||
ShiftSkinData.leftTopCornerColor = borderColor;
|
ShiftSkinData.LeftTopCornerColor = borderColor;
|
||||||
ShiftSkinData.titleBarColor = borderColor;
|
ShiftSkinData.TitleBarColor = borderColor;
|
||||||
ShiftSkinData.rightTopCornerColor = borderColor;
|
ShiftSkinData.RightTopCornerColor = borderColor;
|
||||||
ShiftSkinData.leftSideColor = borderColor;
|
ShiftSkinData.LeftSideColor = borderColor;
|
||||||
ShiftSkinData.rightSideColor = borderColor;
|
ShiftSkinData.RightSideColor = borderColor;
|
||||||
ShiftSkinData.leftBottomCornerColor = borderColor;
|
ShiftSkinData.LeftBottomCornerColor = borderColor;
|
||||||
ShiftSkinData.bottomSideColor = borderColor;
|
ShiftSkinData.BottomSideColor = borderColor;
|
||||||
ShiftSkinData.rightBottomCornerColor = borderColor;
|
ShiftSkinData.RightBottomCornerColor = borderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.btnClose.BackColor = ShiftSkinData.btnCloseColor;
|
app.btnClose.BackColor = ShiftSkinData.BtnCloseColor;
|
||||||
app.btnMax.BackColor = ShiftSkinData.btnMaxColor;
|
app.btnMax.BackColor = ShiftSkinData.BtnMaxColor;
|
||||||
app.btnMin.BackColor = ShiftSkinData.btnMinColor;
|
app.btnMin.BackColor = ShiftSkinData.BtnMinColor;
|
||||||
app.leftTopCorner.BackColor = ShiftSkinData.leftTopCornerColor;
|
app.leftTopCorner.BackColor = ShiftSkinData.LeftTopCornerColor;
|
||||||
app.titleBar.BackColor = ShiftSkinData.titleBarColor;
|
app.titleBar.BackColor = ShiftSkinData.TitleBarColor;
|
||||||
app.rightTopCorner.BackColor = ShiftSkinData.rightTopCornerColor;
|
app.rightTopCorner.BackColor = ShiftSkinData.RightTopCornerColor;
|
||||||
app.leftSide.BackColor = ShiftSkinData.leftSideColor;
|
app.leftSide.BackColor = ShiftSkinData.LeftSideColor;
|
||||||
app.rightSide.BackColor = ShiftSkinData.rightSideColor;
|
app.rightSide.BackColor = ShiftSkinData.RightSideColor;
|
||||||
app.leftBottomCorner.BackColor = ShiftSkinData.leftBottomCornerColor;
|
app.leftBottomCorner.BackColor = ShiftSkinData.LeftBottomCornerColor;
|
||||||
app.bottomSide.BackColor = ShiftSkinData.bottomSideColor;
|
app.bottomSide.BackColor = ShiftSkinData.BottomSideColor;
|
||||||
app.rightBottomCorner.BackColor = ShiftSkinData.rightBottomCornerColor;
|
app.rightBottomCorner.BackColor = ShiftSkinData.RightBottomCornerColor;
|
||||||
|
|
||||||
|
|
||||||
// Icon Setup
|
|
||||||
if (icon == null)
|
|
||||||
{
|
|
||||||
app.programIcon.Hide();
|
|
||||||
app.programIcon.Image = Properties.Resources.nullIcon;
|
|
||||||
app.Title.Location = new Point(2, 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
// Icon Setup
|
||||||
{
|
if (icon == null)
|
||||||
app.programIcon.Image = icon.ToBitmap();
|
{
|
||||||
app.Icon = icon;
|
app.programIcon.Hide();
|
||||||
}
|
app.programIcon.Image = Resources.nullIcon;
|
||||||
|
app.Title.Location = new Point(2, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.programIcon.Image = icon.ToBitmap();
|
||||||
|
app.Icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup UC
|
// Setup UC
|
||||||
content.Parent = app.programContent;
|
content.Parent = app.programContent;
|
||||||
content.BringToFront();
|
content.BringToFront();
|
||||||
content.Dock = DockStyle.Fill;
|
content.Dock = DockStyle.Fill;
|
||||||
app.Show();
|
app.Show();
|
||||||
|
|
||||||
content.Tag = app.SetId();
|
content.Tag = app.SetId();
|
||||||
|
|
||||||
Debug.WriteLine($"usercontrol: {content.Tag} window: {app.Id}");
|
Debug.WriteLine($"usercontrol: {content.Tag} window: {app.Id}");
|
||||||
|
|
||||||
app.Closed += (sender, args) =>
|
app.Closed += (sender, args) => { Windows.Remove((ShiftWindow) sender); };
|
||||||
{
|
|
||||||
Windows.Remove((ShiftWindow) sender);
|
|
||||||
};
|
|
||||||
|
|
||||||
Windows.Add(app);
|
Windows.Add(app);
|
||||||
|
|
||||||
if (content is IShiftWindowExtensions extensions)
|
if (content is IShiftWindowExtensions extensions)
|
||||||
{
|
{
|
||||||
extensions.OnLoaded(app);
|
extensions.OnLoaded(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows a new infobox.
|
/// Shows a new infobox.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="title">The title of the infobox.</param>
|
/// <param name="title">The title of the infobox.</param>
|
||||||
/// <param name="body">The infobox's content.</param>
|
/// <param name="body">The infobox's content.</param>
|
||||||
/// <param name="type">The ButtonType used for the infobox.</param>
|
/// <param name="type">The ButtonType used for the infobox.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static InfoboxTemplate StartInfoboxSession(string title, string body, ButtonType type)
|
public static InfoboxTemplate StartInfoboxSession(string title, string body, ButtonType type)
|
||||||
{
|
{
|
||||||
InfoboxTemplate info = new InfoboxTemplate(type)
|
var info = new InfoboxTemplate(type)
|
||||||
{
|
{
|
||||||
label1 = { Text = body }
|
label1 = { Text = body }
|
||||||
};
|
};
|
||||||
Init(info, title, Properties.Resources.iconInfoBox_fw.ToIcon(), true, false);
|
Init(info, title, Resources.iconInfoBox_fw.ToIcon(), true, false);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,74 +1,76 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using ShiftOS.Engine.Misc;
|
||||||
|
|
||||||
namespace ShiftOS.Engine.WindowManager
|
namespace ShiftOS.Engine.WindowManager
|
||||||
{
|
{
|
||||||
public partial class ShiftWindow : Form
|
public partial class ShiftWindow : Form
|
||||||
{
|
{
|
||||||
|
const int WmNclbuttondown = 0xA1;
|
||||||
|
const int HtCaption = 0x2;
|
||||||
|
|
||||||
|
public ShiftWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
public uint Id { get; private set; }
|
public uint Id { get; private set; }
|
||||||
|
|
||||||
public UserControl ChildControl { get; set; }
|
public UserControl ChildControl { get; set; }
|
||||||
|
|
||||||
public ShiftWindow()
|
public uint SetId()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint SetId()
|
|
||||||
{
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Id = (uint)Tools.Rnd.Next(100000, 999999);
|
Id = (uint) Tools.Rnd.Next(100000, 999999);
|
||||||
}
|
} while (ShiftWm.Windows.FirstOrDefault(w => w.Id == Id) != null);
|
||||||
while (ShiftWM.Windows.FirstOrDefault(w => w.Id == Id) != null);
|
|
||||||
|
|
||||||
return Id;
|
return Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private const int WM_NCLBUTTONDOWN = 0xA1;
|
[DllImport("user32.dll")]
|
||||||
private const int HT_CAPTION = 0x2;
|
static extern int SendMessage(
|
||||||
|
IntPtr hWnd,
|
||||||
|
int msg,
|
||||||
|
int wParam,
|
||||||
|
int lParam);
|
||||||
|
|
||||||
[DllImportAttribute("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern int SendMessage(IntPtr hWnd,
|
static extern bool ReleaseCapture();
|
||||||
int Msg, int wParam, int lParam);
|
|
||||||
|
|
||||||
[DllImportAttribute("user32.dll")]
|
void Programtopbar_drag(object sender, MouseEventArgs e)
|
||||||
private static extern bool ReleaseCapture();
|
{
|
||||||
|
if (e.Button != MouseButtons.Left) return;
|
||||||
|
|
||||||
private void Programtopbar_drag(object sender, MouseEventArgs e)
|
ReleaseCapture();
|
||||||
{
|
SendMessage(Handle, WmNclbuttondown, HtCaption, 0);
|
||||||
if (e.Button != MouseButtons.Left) return;
|
}
|
||||||
|
|
||||||
ReleaseCapture();
|
void closebutton_Click(object sender, EventArgs e)
|
||||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
=> Close();
|
||||||
}
|
|
||||||
|
|
||||||
private void closebutton_Click(object sender, EventArgs e)
|
void closebutton_MouseEnter(object sender, EventArgs e)
|
||||||
=> this.Close();
|
=> btnClose.BackColor = ShiftSkinData.BtnCloseHoverColor;
|
||||||
|
|
||||||
private void closebutton_MouseEnter(object sender, EventArgs e)
|
void closebutton_MouseLeave(object sender, EventArgs e)
|
||||||
=> btnClose.BackColor = ShiftSkinData.btnCloseHoverColor;
|
=> btnClose.BackColor = ShiftSkinData.BtnCloseColor;
|
||||||
|
|
||||||
private void closebutton_MouseLeave(object sender, EventArgs e)
|
void maximizebutton_MouseEnter(object sender, EventArgs e)
|
||||||
=> btnClose.BackColor = ShiftSkinData.btnCloseColor;
|
=> btnMax.BackColor = ShiftSkinData.BtnMaxHoverColor;
|
||||||
|
|
||||||
private void maximizebutton_MouseEnter(object sender, EventArgs e)
|
void maximizebutton_MouseLeave(object sender, EventArgs e)
|
||||||
=> btnMax.BackColor = ShiftSkinData.btnMaxHoverColor;
|
=> btnMax.BackColor = ShiftSkinData.BtnMaxColor;
|
||||||
|
|
||||||
private void maximizebutton_MouseLeave(object sender, EventArgs e)
|
void minimizebutton_MouseEnter(object sender, EventArgs e)
|
||||||
=> btnMax.BackColor = ShiftSkinData.btnMaxColor;
|
=> btnMin.BackColor = ShiftSkinData.BtnMinHoverColor;
|
||||||
|
|
||||||
private void minimizebutton_MouseEnter(object sender, EventArgs e)
|
|
||||||
=> btnMin.BackColor = ShiftSkinData.btnMinHoverColor;
|
|
||||||
|
|
||||||
|
|
||||||
private void minimizebutton_MouseLeave(object sender, EventArgs e)
|
void minimizebutton_MouseLeave(object sender, EventArgs e)
|
||||||
=> btnMin.BackColor = ShiftSkinData.btnMinColor;
|
=> btnMin.BackColor = ShiftSkinData.BtnMinColor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private void closebutton_MouseDown(object sender, MouseEventArgs e)
|
private void closebutton_MouseDown(object sender, MouseEventArgs e)
|
||||||
=> btnClose.BackColor = Color.Black;
|
=> btnClose.BackColor = Color.Black;
|
||||||
|
|
||||||
|
@ -77,12 +79,11 @@ namespace ShiftOS.Engine.WindowManager
|
||||||
|
|
||||||
private void minimizebutton_MouseDown(object sender, MouseEventArgs e)
|
private void minimizebutton_MouseDown(object sender, MouseEventArgs e)
|
||||||
=> btnMin.BackColor = Color.Black;
|
=> btnMin.BackColor = Color.Black;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IShiftWindowExtensions
|
public interface IShiftWindowExtensions
|
||||||
{
|
{
|
||||||
void OnLoaded(ShiftWindow window);
|
void OnLoaded(ShiftWindow window);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||||
</startup>
|
</startup>
|
||||||
</configuration>
|
</configuration>
|
105
ShiftOS.Main/HijackScreen.Designer.cs
generated
105
ShiftOS.Main/HijackScreen.Designer.cs
generated
|
@ -1,105 +0,0 @@
|
||||||
namespace ShiftOS.Main
|
|
||||||
{
|
|
||||||
partial class HijackScreen
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
|
||||||
this.conversationtimer = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.hackeffecttimer = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.lblHijack = new System.Windows.Forms.Label();
|
|
||||||
this.textgen = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.lblhackwords = new System.Windows.Forms.Label();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// conversationtimer
|
|
||||||
//
|
|
||||||
this.conversationtimer.Tick += new System.EventHandler(this.conversationtimer_Tick);
|
|
||||||
//
|
|
||||||
// hackeffecttimer
|
|
||||||
//
|
|
||||||
this.hackeffecttimer.Interval = 50;
|
|
||||||
this.hackeffecttimer.Tick += new System.EventHandler(this.hackeffecttimer_Tick);
|
|
||||||
//
|
|
||||||
// lblHijack
|
|
||||||
//
|
|
||||||
this.lblHijack.Anchor = System.Windows.Forms.AnchorStyles.None;
|
|
||||||
this.lblHijack.AutoSize = true;
|
|
||||||
this.lblHijack.BackColor = System.Drawing.Color.WhiteSmoke;
|
|
||||||
this.lblHijack.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F);
|
|
||||||
this.lblHijack.ForeColor = System.Drawing.Color.DimGray;
|
|
||||||
this.lblHijack.Location = new System.Drawing.Point(143, 193);
|
|
||||||
this.lblHijack.Name = "lblHijack";
|
|
||||||
this.lblHijack.Size = new System.Drawing.Size(18, 25);
|
|
||||||
this.lblHijack.TabIndex = 0;
|
|
||||||
this.lblHijack.Text = "\\";
|
|
||||||
//
|
|
||||||
// textgen
|
|
||||||
//
|
|
||||||
this.textgen.Interval = 20;
|
|
||||||
this.textgen.Tick += new System.EventHandler(this.textgen_Tick);
|
|
||||||
//
|
|
||||||
// lblhackwords
|
|
||||||
//
|
|
||||||
this.lblhackwords.AutoSize = true;
|
|
||||||
this.lblhackwords.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.lblhackwords.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.lblhackwords.ForeColor = System.Drawing.SystemColors.ButtonFace;
|
|
||||||
this.lblhackwords.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.lblhackwords.Name = "lblhackwords";
|
|
||||||
this.lblhackwords.Size = new System.Drawing.Size(127, 18);
|
|
||||||
this.lblhackwords.TabIndex = 1;
|
|
||||||
this.lblhackwords.Text = "Hijack in progress";
|
|
||||||
//
|
|
||||||
// HijackScreen
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.BackColor = System.Drawing.Color.Silver;
|
|
||||||
this.ClientSize = new System.Drawing.Size(636, 418);
|
|
||||||
this.Controls.Add(this.lblhackwords);
|
|
||||||
this.Controls.Add(this.lblHijack);
|
|
||||||
this.Name = "HijackScreen";
|
|
||||||
this.Text = "ShiftOS";
|
|
||||||
this.TransparencyKey = System.Drawing.Color.White;
|
|
||||||
this.Load += new System.EventHandler(this.HijackScreen_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
|
||||||
private System.Windows.Forms.Timer conversationtimer;
|
|
||||||
private System.Windows.Forms.Timer hackeffecttimer;
|
|
||||||
private System.Windows.Forms.Label lblHijack;
|
|
||||||
private System.Windows.Forms.Timer textgen;
|
|
||||||
private System.Windows.Forms.Label lblhackwords;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,612 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.IO;
|
|
||||||
using System.Media;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace ShiftOS.Main
|
|
||||||
{
|
|
||||||
public partial class HijackScreen : Form
|
|
||||||
{
|
|
||||||
public string actualshiftversion = "0.0.1.1";
|
|
||||||
string rtext;
|
|
||||||
string gtexttotype;
|
|
||||||
int charcount;
|
|
||||||
int currentletter;
|
|
||||||
int slashcount;
|
|
||||||
int conversationcount = 0;
|
|
||||||
Label textgeninput;
|
|
||||||
bool needtoclose = false;
|
|
||||||
string oldversion;
|
|
||||||
public bool upgraded = false;
|
|
||||||
SoundPlayer player = new SoundPlayer();
|
|
||||||
|
|
||||||
FileStream fs;
|
|
||||||
int hackeffect;
|
|
||||||
int percentcount;
|
|
||||||
|
|
||||||
static DriveInfo[] cdrives = DriveInfo.GetDrives();
|
|
||||||
DriveInfo cdrive = Array.Find(cdrives, c => "C:\\" == "C:\\");
|
|
||||||
public HijackScreen()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private void PlaySound(Stream path)
|
|
||||||
{
|
|
||||||
player.Stream = path;
|
|
||||||
player.Play();
|
|
||||||
player.Stream.Position = 0;
|
|
||||||
}
|
|
||||||
private void HijackScreen_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//extractdlls();
|
|
||||||
Control.CheckForIllegalCrossThreadCalls = false;
|
|
||||||
|
|
||||||
this.FormBorderStyle = FormBorderStyle.None;
|
|
||||||
this.WindowState = FormWindowState.Maximized;
|
|
||||||
if (Directory.Exists("C:\\ShiftOS-Rewind"))
|
|
||||||
{
|
|
||||||
if (File.ReadAllText("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft") == actualshiftversion)
|
|
||||||
{
|
|
||||||
//ShiftOSDesktop.Show();
|
|
||||||
conversationtimer.Start();
|
|
||||||
needtoclose = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Your save file is not currently compatible with this version of ShiftOS. Would you like to upgrade your save file so you can continue to play the latest version of ShiftOS without losing your progress? If so click yes below. If you would like to start a new game and wipe all your progress please click no", "Warning: Update your save file", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
this.Hide();
|
|
||||||
//ShiftOS_Save_File_Converter.Show();
|
|
||||||
// ShiftOS_Save_File_Converter.BringToFront();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oldversion = System.IO.File.ReadAllText("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft");
|
|
||||||
upgraded = true;
|
|
||||||
System.IO.Directory.Delete("C:/ShiftOS-Rewind/", true);
|
|
||||||
backgroundWorker1.RunWorkerAsync();
|
|
||||||
conversationtimer.Start();
|
|
||||||
hackeffecttimer.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
backgroundWorker1.RunWorkerAsync();
|
|
||||||
conversationtimer.Start();
|
|
||||||
hackeffecttimer.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextType(string texttotype)
|
|
||||||
{
|
|
||||||
conversationtimer.Stop();
|
|
||||||
charcount = texttotype.Length;
|
|
||||||
gtexttotype = texttotype;
|
|
||||||
currentletter = 0;
|
|
||||||
slashcount = 1;
|
|
||||||
textgen.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void textgen_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
switch (slashcount)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
if (currentletter < gtexttotype.Length)
|
|
||||||
{
|
|
||||||
textgeninput.Text = rtext + "\\";
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (currentletter < gtexttotype.Length)
|
|
||||||
{
|
|
||||||
textgeninput.Text = rtext + "|";
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (currentletter < gtexttotype.Length)
|
|
||||||
{
|
|
||||||
textgeninput.Text = rtext + "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if (currentletter < gtexttotype.Length)
|
|
||||||
{
|
|
||||||
rtext = rtext + Regex.Split(gtexttotype, string.Empty)[currentletter];
|
|
||||||
currentletter = currentletter + 1;
|
|
||||||
textgeninput.Text = rtext;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
slashcount = slashcount + 1;
|
|
||||||
|
|
||||||
if (slashcount == 5)
|
|
||||||
slashcount = 1;
|
|
||||||
if (currentletter == gtexttotype.Length)
|
|
||||||
{
|
|
||||||
gtexttotype = "";
|
|
||||||
PlaySound(Properties.Resources.typesound);
|
|
||||||
conversationtimer.Start();
|
|
||||||
textgen.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void conversationtimer_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
switch (conversationcount)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
if (needtoclose == true)
|
|
||||||
this.Close();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
|
|
||||||
textgeninput = lblHijack;
|
|
||||||
TextType("Your computer is now being Hijacked ");
|
|
||||||
conversationtimer.Interval = 1000;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
textgeninput = lblhackwords;
|
|
||||||
textgen.Interval = 10;
|
|
||||||
rtext = "";
|
|
||||||
TextType("Congratulations, " + Environment.UserName + "you have been involuntarily selected to be an Alpha Tester for ShiftOS!" + Environment.NewLine + Environment.NewLine);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
TextType("At this time, I do not wish to reveal any of my intentions and idenity." + Environment.NewLine + Environment.NewLine);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
TextType("I just need to use you and your computer as an external test bed to evolve my experimental operating system." + Environment.NewLine + Environment.NewLine);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
TextType("I need to expand the name of ShiftOS, so I'll work on it, and you'll have the chance to use ShiftOS!" + Environment.NewLine + Environment.NewLine);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS." + Environment.NewLine + Environment.NewLine);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
TextType("Starting Format.");
|
|
||||||
conversationtimer.Interval = 500;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
case 12:
|
|
||||||
case 13:
|
|
||||||
case 14:
|
|
||||||
case 15:
|
|
||||||
case 16:
|
|
||||||
case 17:
|
|
||||||
case 18:
|
|
||||||
TextType(".");
|
|
||||||
break;
|
|
||||||
case 19:
|
|
||||||
rtext = "";
|
|
||||||
break;
|
|
||||||
case 20:
|
|
||||||
TextType("Scanning Drive C:\\...");
|
|
||||||
break;
|
|
||||||
case 21:
|
|
||||||
|
|
||||||
TextType(Environment.NewLine + Environment.NewLine + "Drive Label: " + cdrive.VolumeLabel);
|
|
||||||
break;
|
|
||||||
case 22:
|
|
||||||
TextType(Environment.NewLine + "Total Drive Size: " + String.Format((cdrive.TotalSize / 1024 / 1024 / 1024).ToString(), "0.00") + "GB. ");
|
|
||||||
break;
|
|
||||||
case 23:
|
|
||||||
TextType(Environment.NewLine + "Old File System: " + cdrive.DriveFormat + ". ");
|
|
||||||
break;
|
|
||||||
case 24:
|
|
||||||
TextType(Environment.NewLine + "New File System: ShiftFS. ");
|
|
||||||
break;
|
|
||||||
case 25:
|
|
||||||
TextType(Environment.NewLine + Environment.NewLine + "Formatting C:\\... - ");
|
|
||||||
conversationtimer.Interval = 100;
|
|
||||||
break;
|
|
||||||
case 26: // TODO: to 126
|
|
||||||
textgeninput.Text = rtext + percentcount + "%";
|
|
||||||
if (percentcount < 101)
|
|
||||||
{
|
|
||||||
percentcount = percentcount + 1;
|
|
||||||
PlaySound(Main.Properties.Resources.writesound);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 127:
|
|
||||||
rtext = rtext + "100%";
|
|
||||||
conversationtimer.Interval = 1000;
|
|
||||||
break;
|
|
||||||
case 128:
|
|
||||||
TextType(Environment.NewLine + "Format Complete");
|
|
||||||
break;
|
|
||||||
case 129:
|
|
||||||
rtext = "";
|
|
||||||
percentcount = 0;
|
|
||||||
TextType("Installing ShiftOS Beta 0.0.1 - ");
|
|
||||||
conversationtimer.Interval = 200;
|
|
||||||
break;
|
|
||||||
case 130: // TODO: to 230
|
|
||||||
textgeninput.Text = rtext + percentcount + "%" + Environment.NewLine + Environment.NewLine;
|
|
||||||
if (percentcount < 101)
|
|
||||||
{
|
|
||||||
percentcount = percentcount + 1;
|
|
||||||
PlaySound(Properties.Resources.writesound);
|
|
||||||
}
|
|
||||||
switch (percentcount)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Home";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Home/Documents";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home/Documents")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home/Documents");
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
case 9:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Home/Documents/ShiftOSInfo.txt";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Home/Documents/ShiftOSInfo.txt");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
case 12:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Home/Music";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home/Music")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home/Music");
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
case 14:
|
|
||||||
case 15:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Home/Pictures";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Home/Pictures")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Home/Pictures");
|
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
case 17:
|
|
||||||
case 18:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Shiftum42")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Shiftum42");
|
|
||||||
break;
|
|
||||||
case 19:
|
|
||||||
case 20:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Shiftum42/Drivers")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Shiftum42/Drivers");
|
|
||||||
break;
|
|
||||||
case 21:
|
|
||||||
case 22:
|
|
||||||
case 23:
|
|
||||||
case 24:
|
|
||||||
case 25:
|
|
||||||
case 26:
|
|
||||||
case 27:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/HDD.dri";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/HDD.dri");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 28:
|
|
||||||
case 29:
|
|
||||||
case 30:
|
|
||||||
case 31:
|
|
||||||
case 32:
|
|
||||||
case 33:
|
|
||||||
case 34:
|
|
||||||
case 35:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Keyboard.dri";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Keyboard.dri");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 36:
|
|
||||||
case 37:
|
|
||||||
case 38:
|
|
||||||
case 39:
|
|
||||||
case 40:
|
|
||||||
case 41:
|
|
||||||
case 42:
|
|
||||||
case 43:
|
|
||||||
case 44:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Monitor.dri";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Monitor.dri");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 45:
|
|
||||||
case 46:
|
|
||||||
case 47:
|
|
||||||
case 48:
|
|
||||||
case 49:
|
|
||||||
case 50:
|
|
||||||
case 51:
|
|
||||||
case 52:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Mouse.dri";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Mouse.dri");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 53:
|
|
||||||
case 54:
|
|
||||||
case 55:
|
|
||||||
case 56:
|
|
||||||
case 57:
|
|
||||||
case 58:
|
|
||||||
case 59:
|
|
||||||
case 60:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Drivers/Printer.dri";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Drivers/Printer.dri");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 61:
|
|
||||||
case 62:
|
|
||||||
case 63:
|
|
||||||
case 64:
|
|
||||||
case 65:
|
|
||||||
case 66:
|
|
||||||
case 67:
|
|
||||||
case 68:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Languages/";
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/Shiftum42/Languages/")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/Shiftum42/Languages/");
|
|
||||||
break;
|
|
||||||
case 69:
|
|
||||||
case 70:
|
|
||||||
case 71:
|
|
||||||
case 72:
|
|
||||||
case 73:
|
|
||||||
case 74:
|
|
||||||
case 75:
|
|
||||||
case 76:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/Languages/English.lang";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/Languages/English.lang");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 77:
|
|
||||||
case 78:
|
|
||||||
case 79:
|
|
||||||
case 80:
|
|
||||||
case 81:
|
|
||||||
case 82:
|
|
||||||
case 83:
|
|
||||||
case 84:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/HDAccess.sft";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft");
|
|
||||||
fs.Close();
|
|
||||||
System.IO.StreamWriter objWriter = new System.IO.StreamWriter("C:/ShiftOS-Rewind/Shiftum42/HDAccess.sft", false);
|
|
||||||
objWriter.Write(actualshiftversion);
|
|
||||||
objWriter.Close();
|
|
||||||
break;
|
|
||||||
case 85:
|
|
||||||
case 86:
|
|
||||||
case 87:
|
|
||||||
case 88:
|
|
||||||
case 89:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/ShiftGUI.sft";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/ShiftGUI.sft");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
case 91:
|
|
||||||
case 92:
|
|
||||||
case 93:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/SKernal.sft";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/SKernal.sft");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 94:
|
|
||||||
case 95:
|
|
||||||
case 96:
|
|
||||||
case 97:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/SRead.sft";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/SRead.sft");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 98:
|
|
||||||
case 99:
|
|
||||||
case 100:
|
|
||||||
case 101:
|
|
||||||
textgeninput.Text = textgeninput.Text + "C:/Shiftum42/SWrite.sft";
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/Shiftum42/SWrite.sft");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 231:
|
|
||||||
textgeninput.Text = rtext + "100%" + Environment.NewLine + Environment.NewLine + "C:/Shiftum42/SWrite.sft";
|
|
||||||
conversationtimer.Interval = 1000;
|
|
||||||
PlaySound(Properties.Resources.writesound);
|
|
||||||
break;
|
|
||||||
case 232:
|
|
||||||
textgeninput.Text = rtext + "100%" + Environment.NewLine + Environment.NewLine + "ShiftOS Installation Complete!";
|
|
||||||
PlaySound(Properties.Resources.typesound);
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/SoftwareData/")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/SoftwareData/");
|
|
||||||
if ((!System.IO.Directory.Exists("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput")))
|
|
||||||
System.IO.Directory.CreateDirectory("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput");
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput/Animals.lst");
|
|
||||||
fs.Close();
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput/Fruits.lst");
|
|
||||||
fs.Close();
|
|
||||||
fs = File.Create("C:/ShiftOS-Rewind/SoftwareData/KnowledgeInput/Countries.lst");
|
|
||||||
fs.Close();
|
|
||||||
break;
|
|
||||||
case 234:
|
|
||||||
//ShiftOSDesktop.newgame = true;
|
|
||||||
//ShiftOSDesktop.Show();
|
|
||||||
//Terminal.Show();
|
|
||||||
//Terminal.tmrfirstrun.Start();
|
|
||||||
//this.Close();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
conversationcount = conversationcount + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hackeffecttimer_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (hackeffect < 101)
|
|
||||||
{
|
|
||||||
switch (hackeffect)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 3:
|
|
||||||
case 5:
|
|
||||||
case 7:
|
|
||||||
case 9:
|
|
||||||
case 11:
|
|
||||||
case 13:
|
|
||||||
case 15:
|
|
||||||
case 17:
|
|
||||||
case 19:
|
|
||||||
case 21:
|
|
||||||
case 23:
|
|
||||||
case 25:
|
|
||||||
case 27:
|
|
||||||
case 29:
|
|
||||||
case 31:
|
|
||||||
case 33:
|
|
||||||
case 35:
|
|
||||||
case 37:
|
|
||||||
case 39:
|
|
||||||
case 41:
|
|
||||||
case 43:
|
|
||||||
case 45:
|
|
||||||
case 47:
|
|
||||||
case 49:
|
|
||||||
case 51:
|
|
||||||
case 53:
|
|
||||||
case 55:
|
|
||||||
case 57:
|
|
||||||
case 59:
|
|
||||||
case 61:
|
|
||||||
case 63:
|
|
||||||
case 65:
|
|
||||||
case 67:
|
|
||||||
case 69:
|
|
||||||
case 71:
|
|
||||||
case 73:
|
|
||||||
case 75:
|
|
||||||
case 77:
|
|
||||||
case 79:
|
|
||||||
case 81:
|
|
||||||
case 83:
|
|
||||||
case 85:
|
|
||||||
case 87:
|
|
||||||
case 89:
|
|
||||||
case 91:
|
|
||||||
case 93:
|
|
||||||
case 95:
|
|
||||||
this.BackColor = Color.Black;
|
|
||||||
PlaySound(Properties.Resources.writesound);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
case 4:
|
|
||||||
case 6:
|
|
||||||
case 8:
|
|
||||||
case 10:
|
|
||||||
case 12:
|
|
||||||
case 14:
|
|
||||||
case 16:
|
|
||||||
case 18:
|
|
||||||
case 20:
|
|
||||||
case 22:
|
|
||||||
case 24:
|
|
||||||
case 26:
|
|
||||||
case 28:
|
|
||||||
this.BackColor = Color.White;
|
|
||||||
PlaySound(Properties.Resources.typesound);
|
|
||||||
break;
|
|
||||||
case 30:
|
|
||||||
case 32:
|
|
||||||
case 34:
|
|
||||||
case 36:
|
|
||||||
case 38:
|
|
||||||
case 40:
|
|
||||||
case 42:
|
|
||||||
case 44:
|
|
||||||
case 46:
|
|
||||||
case 48:
|
|
||||||
case 50:
|
|
||||||
this.BackColor = Color.Gainsboro;
|
|
||||||
PlaySound(Properties.Resources.typesound);
|
|
||||||
break;
|
|
||||||
case 52:
|
|
||||||
case 54:
|
|
||||||
case 56:
|
|
||||||
case 58:
|
|
||||||
case 60:
|
|
||||||
case 62:
|
|
||||||
case 64:
|
|
||||||
case 66:
|
|
||||||
case 68:
|
|
||||||
case 70:
|
|
||||||
case 72:
|
|
||||||
case 74:
|
|
||||||
case 76:
|
|
||||||
this.BackColor = Color.Silver;
|
|
||||||
PlaySound(Properties.Resources.typesound);
|
|
||||||
break;
|
|
||||||
case 78:
|
|
||||||
case 80:
|
|
||||||
case 82:
|
|
||||||
case 84:
|
|
||||||
case 86:
|
|
||||||
case 88:
|
|
||||||
case 90:
|
|
||||||
case 92:
|
|
||||||
case 94:
|
|
||||||
this.BackColor = Color.DimGray;
|
|
||||||
PlaySound(Properties.Resources.typesound);
|
|
||||||
break;
|
|
||||||
case 96:
|
|
||||||
lblHijack.BackColor = Color.LightGray;
|
|
||||||
break;
|
|
||||||
case 97:
|
|
||||||
lblHijack.BackColor = Color.DarkGray;
|
|
||||||
break;
|
|
||||||
case 98:
|
|
||||||
lblHijack.BackColor = Color.DimGray;
|
|
||||||
break;
|
|
||||||
case 99:
|
|
||||||
lblHijack.BackColor = Color.Black;
|
|
||||||
lblHijack.ForeColor = Color.DimGray;
|
|
||||||
break;
|
|
||||||
case 100:
|
|
||||||
lblHijack.Hide();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hackeffecttimer.Stop();
|
|
||||||
}
|
|
||||||
hackeffect = hackeffect + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="conversationtimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>181, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="hackeffecttimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>331, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="textgen.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>467, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
|
@ -2,23 +2,24 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ShiftOS.Main.ShiftOS;
|
using ShiftOS.Main.ShiftOS;
|
||||||
|
using ShiftOS.Main.ShiftOS.Apps;
|
||||||
|
|
||||||
namespace ShiftOS.Main
|
namespace ShiftOS.Main
|
||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
Parallel.Invoke(
|
Parallel.Invoke(
|
||||||
() => Application.Run(new TestForm()),
|
() => Application.Run(new TestForm()),
|
||||||
() => Application.Run(new Desktop()));
|
() => Application.Run(new Desktop()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -33,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,7 +1,8 @@
|
||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
<Profiles>
|
<Profiles>
|
||||||
<Profile Name="(Default)" />
|
<Profile Name="(Default)" />
|
||||||
</Profiles>
|
</Profiles>
|
||||||
<Settings />
|
<Settings />
|
||||||
</SettingsFile>
|
</SettingsFile>
|
|
@ -1,22 +1,23 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<grammar version="1.0" xml:lang="en-US"
|
<grammar version="1.0" xml:lang="en-US"
|
||||||
xmlns="http://www.w3.org/2001/06/grammar"
|
xmlns="http://www.w3.org/2001/06/grammar"
|
||||||
tag-format="semantics/1.0" root="Main">
|
tag-format="semantics/1.0" root="Main">
|
||||||
|
|
||||||
<!-- Catalyst Grammar File
|
<!-- Catalyst Grammar File
|
||||||
|
|
||||||
This file gives Catalyst the ability to recognize
|
This file gives Catalyst the ability to recognize
|
||||||
audio input and give a proper response.
|
audio input and give a proper response.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<rule id="Main">
|
<rule id="Main">
|
||||||
<item>
|
<item>
|
||||||
How much Code Points do I have?
|
How much Code Points do I have?
|
||||||
</item>
|
</item>
|
||||||
<item>Can you run <ruleref uri="#programs"/>?</item>
|
<item>Can you run <ruleref uri="#programs" />?</item>
|
||||||
<item>Can you minimize <ruleref uri="#programs"/>?</item>
|
<item>Can you minimize <ruleref uri="#programs" />?</item>
|
||||||
<item>Can you close <ruleref uri="#programs"/>?</item>
|
<item>Can you close <ruleref uri="#programs" />?</item>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule id="programs" scope="public">
|
<rule id="programs" scope="public">
|
||||||
|
|
|
@ -47,12 +47,6 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="HijackScreen.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="HijackScreen.Designer.cs">
|
|
||||||
<DependentUpon>HijackScreen.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ShiftOS\Apps\ShifterStuff\SelectColor.cs">
|
<Compile Include="ShiftOS\Apps\ShifterStuff\SelectColor.cs">
|
||||||
|
@ -97,9 +91,6 @@
|
||||||
<Compile Include="ShiftOS\Desktop.Designer.cs">
|
<Compile Include="ShiftOS\Desktop.Designer.cs">
|
||||||
<DependentUpon>Desktop.cs</DependentUpon>
|
<DependentUpon>Desktop.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<EmbeddedResource Include="HijackScreen.resx">
|
|
||||||
<DependentUpon>HijackScreen.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
|
2
ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs
generated
2
ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs
generated
|
@ -1,4 +1,4 @@
|
||||||
namespace ShiftOS.Main
|
namespace ShiftOS.Main.ShiftOS.Apps
|
||||||
{
|
{
|
||||||
partial class ShiftDemo
|
partial class ShiftDemo
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,26 +1,18 @@
|
||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using ShiftOS.Engine.WindowManager;
|
using ShiftOS.Engine.WindowManager;
|
||||||
|
|
||||||
namespace ShiftOS.Main
|
namespace ShiftOS.Main.ShiftOS.Apps
|
||||||
{
|
{
|
||||||
public partial class ShiftDemo : UserControl, IShiftWindowExtensions
|
public partial class ShiftDemo : UserControl, IShiftWindowExtensions
|
||||||
{
|
{
|
||||||
public ShiftDemo()
|
public ShiftDemo()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnLoaded(ShiftWindow window)
|
public void OnLoaded(ShiftWindow window)
|
||||||
{
|
{
|
||||||
icon.Image = this.GetShiftWindow().Icon.ToBitmap();
|
icon.Image = this.GetShiftWindow().Icon.ToBitmap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ShiftOS.Main.ShiftOS.Apps
|
namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
|
||||||
{
|
{
|
||||||
partial class SelectColor
|
partial class SelectColor
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,50 +1,54 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Globalization;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ShiftOS.Engine.WindowManager;
|
using ShiftOS.Engine.WindowManager;
|
||||||
|
|
||||||
namespace ShiftOS.Main.ShiftOS.Apps
|
namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
|
||||||
{
|
{
|
||||||
public partial class SelectColor : UserControl
|
public partial class SelectColor : UserControl
|
||||||
{
|
{
|
||||||
Color _finalColor;
|
int _colorType1;
|
||||||
int _colorType1;
|
int _colorType2;
|
||||||
int _colorType2;
|
int _colorType3;
|
||||||
int _colorType3;
|
Color _finalColor;
|
||||||
public SelectColor()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
}
|
public SelectColor()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
private Color setColor()
|
Color SetColor()
|
||||||
{
|
{
|
||||||
_colorType1 = Int32.Parse(redUpDown.Value.ToString());
|
_colorType1 = int.Parse(redUpDown.Value.ToString(CultureInfo.InvariantCulture));
|
||||||
_colorType2 = Int32.Parse(greenUpDown.Value.ToString());
|
_colorType2 = int.Parse(greenUpDown.Value.ToString(CultureInfo.InvariantCulture));
|
||||||
_colorType3 = Int32.Parse(blueUpDown.Value.ToString());
|
_colorType3 = int.Parse(blueUpDown.Value.ToString(CultureInfo.InvariantCulture));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);
|
_finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);
|
||||||
|
|
||||||
|
|
||||||
foreach (var window in ShiftWM.Windows)
|
|
||||||
{
|
|
||||||
window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ShiftWM.StartInfoboxSession("Success!", $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", InfoboxTemplate.ButtonType.Ok);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok);
|
|
||||||
}
|
|
||||||
return _finalColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnSetColor_Click(object sender, EventArgs e)
|
|
||||||
{
|
foreach (var window in ShiftWm.Windows)
|
||||||
setColor();
|
{
|
||||||
}
|
window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
ShiftWm.StartInfoboxSession(
|
||||||
|
"Success!",
|
||||||
|
$"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.",
|
||||||
|
InfoboxTemplate.ButtonType.Ok);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
ShiftWm.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok);
|
||||||
|
}
|
||||||
|
return _finalColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void btnSetColor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SetColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ShiftOS.Main.ShiftOS.Apps
|
namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
|
||||||
{
|
{
|
||||||
partial class Shifter
|
partial class Shifter
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
this.button4.TabIndex = 4;
|
this.button4.TabIndex = 4;
|
||||||
this.button4.Text = "Set Random Skin";
|
this.button4.Text = "Set Random Skin";
|
||||||
this.button4.UseVisualStyleBackColor = true;
|
this.button4.UseVisualStyleBackColor = true;
|
||||||
this.button4.Click += new System.EventHandler(this.setRandomSkin);
|
this.button4.Click += new System.EventHandler(this.SetRandomSkin);
|
||||||
//
|
//
|
||||||
// button3
|
// button3
|
||||||
//
|
//
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
this.button3.TabIndex = 3;
|
this.button3.TabIndex = 3;
|
||||||
this.button3.Text = "Set Default Skin";
|
this.button3.Text = "Set Default Skin";
|
||||||
this.button3.UseVisualStyleBackColor = true;
|
this.button3.UseVisualStyleBackColor = true;
|
||||||
this.button3.Click += new System.EventHandler(this.setDefaultSkin);
|
this.button3.Click += new System.EventHandler(this.SetDefaultSkin);
|
||||||
//
|
//
|
||||||
// button2
|
// button2
|
||||||
//
|
//
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
this.button2.TabIndex = 2;
|
this.button2.TabIndex = 2;
|
||||||
this.button2.Text = "Set Colorful Skin";
|
this.button2.Text = "Set Colorful Skin";
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
this.button2.UseVisualStyleBackColor = true;
|
||||||
this.button2.Click += new System.EventHandler(this.setColorSkin);
|
this.button2.Click += new System.EventHandler(this.SetColorSkin);
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,113 +1,116 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
|
||||||
using ShiftOS.Engine;
|
|
||||||
using ShiftOS.Engine.WindowManager;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using ShiftOS.Engine.Misc;
|
||||||
|
using ShiftOS.Engine.WindowManager;
|
||||||
|
using ShiftOS.Main.Properties;
|
||||||
|
|
||||||
namespace ShiftOS.Main.ShiftOS.Apps
|
namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
|
||||||
{
|
{
|
||||||
public partial class Shifter : UserControl
|
public partial class Shifter : UserControl
|
||||||
{
|
{
|
||||||
public int colorType; //This is a check to see what option was chosen.
|
public int ColorType; //This is a check to see what option was chosen.
|
||||||
public Shifter()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
public Shifter()
|
||||||
{
|
{
|
||||||
colorType = 1;
|
InitializeComponent();
|
||||||
ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setDefaultSkin(object sender, EventArgs e)
|
void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
setBorderColor(Color.FromArgb(64, 64, 64));
|
ColorType = 1;
|
||||||
ShiftSkinData.btnCloseColor = Color.Black;
|
ShiftWm.Init(new SelectColor(), "Select a color", Resources.iconColourPicker_fw.ToIcon());
|
||||||
ShiftSkinData.btnMaxColor = Color.Black;
|
}
|
||||||
ShiftSkinData.btnMinColor = Color.Black;
|
|
||||||
button5_Click(sender, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setColorSkin(object sender, EventArgs e)
|
void SetDefaultSkin(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
setBorderColor(Color.Blue);
|
SetBorderColor(Color.FromArgb(64, 64, 64));
|
||||||
ShiftSkinData.btnCloseColor = Color.Red;
|
ShiftSkinData.BtnCloseColor = Color.Black;
|
||||||
ShiftSkinData.btnMaxColor = Color.Yellow;
|
ShiftSkinData.BtnMaxColor = Color.Black;
|
||||||
ShiftSkinData.btnMinColor = Color.Green;
|
ShiftSkinData.BtnMinColor = Color.Black;
|
||||||
ShiftSkinData.btnCloseHoverColor = Color.FromArgb(255, 102, 102);
|
button5_Click(sender, e);
|
||||||
ShiftSkinData.btnMaxHoverColor = Color.FromArgb(255, 255, 153);
|
}
|
||||||
ShiftSkinData.btnMinColor = Color.FromArgb(102, 255, 102);
|
|
||||||
button5_Click(sender, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setRandomSkin(object sender, EventArgs e)
|
void SetColorSkin(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new Random();
|
SetBorderColor(Color.Blue);
|
||||||
setBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
|
ShiftSkinData.BtnCloseColor = Color.Red;
|
||||||
ShiftSkinData.btnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
ShiftSkinData.BtnMaxColor = Color.Yellow;
|
||||||
ShiftSkinData.btnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
ShiftSkinData.BtnMinColor = Color.Green;
|
||||||
ShiftSkinData.btnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(255, 102, 102);
|
||||||
ShiftSkinData.btnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(255, 255, 153);
|
||||||
ShiftSkinData.btnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
ShiftSkinData.BtnMinColor = Color.FromArgb(102, 255, 102);
|
||||||
ShiftSkinData.btnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
button5_Click(sender, e);
|
||||||
button5_Click(sender, e);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// SetBorderColor
|
void SetRandomSkin(object sender, EventArgs e)
|
||||||
public void setBorderColor(Color borderColor)
|
{
|
||||||
{
|
var rnd = new Random();
|
||||||
ShiftSkinData.leftTopCornerColor = borderColor;
|
SetBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
|
||||||
ShiftSkinData.titleBarColor = borderColor;
|
ShiftSkinData.BtnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
||||||
ShiftSkinData.rightTopCornerColor = borderColor;
|
ShiftSkinData.BtnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
||||||
ShiftSkinData.leftSideColor = borderColor;
|
ShiftSkinData.BtnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
||||||
ShiftSkinData.rightSideColor = borderColor;
|
ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
||||||
ShiftSkinData.leftBottomCornerColor = borderColor;
|
ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
||||||
ShiftSkinData.bottomSideColor = borderColor;
|
ShiftSkinData.BtnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
|
||||||
ShiftSkinData.rightBottomCornerColor = borderColor;
|
button5_Click(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button5_Click(object sender, EventArgs e)
|
// SetBorderColor
|
||||||
{
|
public void SetBorderColor(Color borderColor)
|
||||||
|
{
|
||||||
|
ShiftSkinData.LeftTopCornerColor = borderColor;
|
||||||
|
ShiftSkinData.TitleBarColor = borderColor;
|
||||||
|
ShiftSkinData.RightTopCornerColor = borderColor;
|
||||||
|
ShiftSkinData.LeftSideColor = borderColor;
|
||||||
|
ShiftSkinData.RightSideColor = borderColor;
|
||||||
|
ShiftSkinData.LeftBottomCornerColor = borderColor;
|
||||||
|
ShiftSkinData.BottomSideColor = borderColor;
|
||||||
|
ShiftSkinData.RightBottomCornerColor = borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var window in ShiftWM.Windows)
|
void button5_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.titleBarColor));
|
foreach (var window in ShiftWm.Windows)
|
||||||
window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.leftTopCornerColor));
|
{
|
||||||
window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.rightTopCornerColor));
|
window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.TitleBarColor));
|
||||||
window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.leftSideColor));
|
window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.LeftTopCornerColor));
|
||||||
window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.rightSideColor));
|
window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.RightTopCornerColor));
|
||||||
window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.leftBottomCornerColor));
|
window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.LeftSideColor));
|
||||||
window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.bottomSideColor));
|
window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.RightSideColor));
|
||||||
window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.rightBottomCornerColor));
|
window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.LeftBottomCornerColor));
|
||||||
window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.btnCloseColor));
|
window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.BottomSideColor));
|
||||||
window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.btnMaxColor));
|
window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.RightBottomCornerColor));
|
||||||
window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.btnMinColor));
|
window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.BtnCloseColor));
|
||||||
|
window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.BtnMaxColor));
|
||||||
}
|
window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.BtnMinColor));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void btnSave_Click(object sender, EventArgs e)
|
void btnSave_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Color[] shiftColors = new Color[14];
|
var shiftColors = new Color[14];
|
||||||
shiftColors[0] = ShiftSkinData.leftTopCornerColor;
|
shiftColors[0] = ShiftSkinData.LeftTopCornerColor;
|
||||||
shiftColors[1] = ShiftSkinData.titleBarColor;
|
shiftColors[1] = ShiftSkinData.TitleBarColor;
|
||||||
shiftColors[2] = ShiftSkinData.rightTopCornerColor;
|
shiftColors[2] = ShiftSkinData.RightTopCornerColor;
|
||||||
shiftColors[3] = ShiftSkinData.leftSideColor;
|
shiftColors[3] = ShiftSkinData.LeftSideColor;
|
||||||
shiftColors[4] = ShiftSkinData.rightSideColor;
|
shiftColors[4] = ShiftSkinData.RightSideColor;
|
||||||
shiftColors[5] = ShiftSkinData.leftBottomCornerColor;
|
shiftColors[5] = ShiftSkinData.LeftBottomCornerColor;
|
||||||
shiftColors[6] = ShiftSkinData.bottomSideColor;
|
shiftColors[6] = ShiftSkinData.BottomSideColor;
|
||||||
shiftColors[7] = ShiftSkinData.rightBottomCornerColor;
|
shiftColors[7] = ShiftSkinData.RightBottomCornerColor;
|
||||||
shiftColors[8] = ShiftSkinData.btnCloseColor;
|
shiftColors[8] = ShiftSkinData.BtnCloseColor;
|
||||||
shiftColors[9] = ShiftSkinData.btnMaxColor;
|
shiftColors[9] = ShiftSkinData.BtnMaxColor;
|
||||||
shiftColors[10] = ShiftSkinData.btnMinColor;
|
shiftColors[10] = ShiftSkinData.BtnMinColor;
|
||||||
shiftColors[11] = ShiftSkinData.btnCloseHoverColor;
|
shiftColors[11] = ShiftSkinData.BtnCloseHoverColor;
|
||||||
shiftColors[12] = ShiftSkinData.btnMaxHoverColor;
|
shiftColors[12] = ShiftSkinData.BtnMaxHoverColor;
|
||||||
shiftColors[13] = ShiftSkinData.btnMinHoverColor;
|
shiftColors[13] = ShiftSkinData.BtnMinHoverColor;
|
||||||
File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors));
|
File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors));
|
||||||
ShiftWM.StartInfoboxSession("Saved Skin", "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json", InfoboxTemplate.ButtonType.Ok);
|
ShiftWm.StartInfoboxSession(
|
||||||
}
|
"Saved Skin",
|
||||||
}
|
"Saved Skin to C:\\Users\\Public\\Documents\\Skin.json",
|
||||||
}
|
InfoboxTemplate.ButtonType.Ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,95 +1,80 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ShiftOS.Engine;
|
|
||||||
using ShiftOS.Engine.Terminal;
|
using ShiftOS.Engine.Terminal;
|
||||||
|
|
||||||
namespace ShiftOS.Main.ShiftOS.Apps
|
namespace ShiftOS.Main.ShiftOS.Apps
|
||||||
{
|
{
|
||||||
public partial class Terminal : UserControl
|
public partial class Terminal : UserControl
|
||||||
{
|
{
|
||||||
public string defaulttextBefore = "user> ";
|
public string DefaulttextBefore = "user> ";
|
||||||
public string defaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!!
|
string DefaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!!
|
||||||
public bool doClear = false;
|
bool DoClear = false;
|
||||||
|
|
||||||
// The below variables makes the terminal... a terminal!
|
// The below variables makes the terminal... a terminal!
|
||||||
public string OldText = "";
|
string OldText = "";
|
||||||
public int TrackingPosition = 0;
|
|
||||||
|
|
||||||
public Terminal()
|
int TrackingPosition;
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
|
public Terminal()
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
public void Print(string text)
|
termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
|
||||||
{
|
}
|
||||||
termmain.AppendText($"\n {text} \n {defaulttextResult}");
|
|
||||||
TrackingPosition = termmain.Text.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void termmain_KeyDown(object sender, KeyEventArgs e)
|
void Print(string text)
|
||||||
{
|
{
|
||||||
// The below code disables the ability to paste anything other then text...
|
termmain.AppendText($"\n {text} \n {DefaulttextResult}");
|
||||||
|
TrackingPosition = termmain.Text.Length;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Control && e.KeyCode == Keys.V)
|
void termmain_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
//if (Clipboard.ContainsText())
|
// The below code disables the ability to paste anything other then text...
|
||||||
// termmain.Paste(DataFormats.GetFormat(DataFormats.Text));
|
|
||||||
e.Handled = true;
|
|
||||||
} else if (e.KeyCode == Keys.Enter) {
|
|
||||||
Print(TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application!
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void termmain_TextChanged(object sender, EventArgs e)
|
if (e.Control && e.KeyCode == Keys.V)
|
||||||
{
|
{
|
||||||
if (termmain.SelectionStart < TrackingPosition)
|
//if (Clipboard.ContainsText())
|
||||||
{
|
// termmain.Paste(DataFormats.GetFormat(DataFormats.Text));
|
||||||
if (doClear == false) // If it's not clearing the terminal
|
e.Handled = true;
|
||||||
{
|
}
|
||||||
termmain.Text = OldText;
|
else if (e.KeyCode == Keys.Enter)
|
||||||
termmain.Select(termmain.Text.Length, 0);
|
{
|
||||||
}
|
Print(
|
||||||
}
|
TerminalBackend.RunCommand(
|
||||||
else
|
termmain.Text.Substring(
|
||||||
{
|
TrackingPosition,
|
||||||
OldText = termmain.Text;
|
termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application!
|
||||||
}
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void termmain_SelectionChanged(object sender, EventArgs e)
|
void termmain_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (termmain.SelectionStart < TrackingPosition)
|
if (termmain.SelectionStart < TrackingPosition)
|
||||||
{
|
{
|
||||||
termmain.Text = OldText;
|
if (DoClear) return;
|
||||||
termmain.Select(termmain.Text.Length, 0);
|
|
||||||
}
|
termmain.Text = OldText;
|
||||||
}
|
termmain.Select(termmain.Text.Length, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OldText = termmain.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Terminal_Load(object sender, EventArgs e)
|
void termmain_SelectionChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Print("\n");
|
if (termmain.SelectionStart >= TrackingPosition) return;
|
||||||
}
|
|
||||||
|
termmain.Text = OldText;
|
||||||
|
termmain.Select(termmain.Text.Length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public string RunCommand(string command)
|
void Terminal_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string ToReturn = "";
|
Print("\n");
|
||||||
|
}
|
||||||
if (command == "hi")
|
}
|
||||||
{
|
}
|
||||||
ToReturn = $"{ToReturn} \n Hi!";
|
|
||||||
MessageBox.Show("HI!");
|
|
||||||
}
|
|
||||||
return ToReturn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
2
ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs
generated
2
ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs
generated
|
@ -1,4 +1,4 @@
|
||||||
namespace ShiftOS.Main
|
namespace ShiftOS.Main.ShiftOS.Apps
|
||||||
{
|
{
|
||||||
partial class TestForm
|
partial class TestForm
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ShiftOS.Engine;
|
using ShiftOS.Engine.Misc;
|
||||||
using ShiftOS.Engine.WindowManager;
|
using ShiftOS.Engine.WindowManager;
|
||||||
using ShiftOS.Main.ShiftOS.Apps;
|
using ShiftOS.Main.Properties;
|
||||||
|
using ShiftOS.Main.ShiftOS.Apps.ShifterStuff;
|
||||||
|
|
||||||
namespace ShiftOS.Main
|
namespace ShiftOS.Main.ShiftOS.Apps
|
||||||
{
|
{
|
||||||
public partial class TestForm : Form
|
public partial class TestForm : Form
|
||||||
{
|
{
|
||||||
public TestForm()
|
public TestForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button1_Click(object sender, EventArgs e)
|
void Button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ShiftDemo demo = new ShiftDemo();
|
var demo = new ShiftDemo();
|
||||||
ShiftWM.Init(demo, textBox1.Text, null);
|
ShiftWm.Init(demo, textBox1.Text, null);
|
||||||
ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok);
|
ShiftWm.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
void button2_Click(object sender, EventArgs e)
|
||||||
=> ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon());
|
=> ShiftWm.Init(new Shifter(), "Shifter", Resources.iconShifter.ToIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,54 +1,36 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using ShiftOS.Engine;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace ShiftOS.Main.ShiftOS.Apps
|
namespace ShiftOS.Main.ShiftOS.Apps
|
||||||
{
|
{
|
||||||
public partial class TextPad : UserControl
|
public partial class TextPad : UserControl
|
||||||
{
|
{
|
||||||
string editedText;
|
readonly string _editedText;
|
||||||
public TextPad()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
editedText = textBox.Text;
|
|
||||||
}
|
|
||||||
private bool isEdited(string editedString)
|
|
||||||
{
|
|
||||||
editedString = editedText;
|
|
||||||
if(editedString != textBox.Text)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
public TextPad()
|
||||||
{
|
{
|
||||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
InitializeComponent();
|
||||||
{
|
_editedText = textBox.Text;
|
||||||
var sr = new StreamReader(openFileDialog1.FileName);
|
}
|
||||||
textBox.Text = sr.ReadToEnd();
|
|
||||||
sr.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void newToolStripMenuItem_Click(object sender, EventArgs e)
|
bool IsEdited() => _editedText != textBox.Text;
|
||||||
{
|
|
||||||
if (isEdited(textBox.Text))
|
void openToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("yay it works");
|
if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
|
||||||
}
|
|
||||||
}
|
var sr = new StreamReader(openFileDialog1.FileName);
|
||||||
}
|
textBox.Text = sr.ReadToEnd();
|
||||||
}
|
sr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void newToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (IsEdited())
|
||||||
|
{
|
||||||
|
MessageBox.Show("yay it works");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using ShiftOS.Engine.Misc;
|
||||||
using ShiftOS.Engine.WindowManager;
|
using ShiftOS.Engine.WindowManager;
|
||||||
using ShiftOS.Engine;
|
using ShiftOS.Main.Properties;
|
||||||
|
using ShiftOS.Main.ShiftOS.Apps;
|
||||||
|
|
||||||
namespace ShiftOS.Main.ShiftOS
|
namespace ShiftOS.Main.ShiftOS
|
||||||
{
|
{
|
||||||
|
@ -20,56 +16,64 @@ namespace ShiftOS.Main.ShiftOS
|
||||||
|
|
||||||
timer1.Start();
|
timer1.Start();
|
||||||
|
|
||||||
this.Closed += (sender, args) =>
|
Closed += (sender, args) => { Application.Exit(); };
|
||||||
{
|
|
||||||
Application.Exit();
|
|
||||||
};
|
|
||||||
|
|
||||||
#region Disgusting taskbar code
|
#region Disgusting taskbar code
|
||||||
|
|
||||||
ShiftWM.Windows.CollectionChanged += (sender, args) =>
|
ShiftWm.Windows.CollectionChanged += (sender, args) =>
|
||||||
{
|
{
|
||||||
args.NewItems?.OfType<ShiftWindow>().ToList().ForEach(window =>
|
args.NewItems?.OfType<ShiftWindow>()
|
||||||
{
|
.ToList()
|
||||||
taskbar.Invoke(new Action(() =>
|
.ForEach(
|
||||||
{
|
window =>
|
||||||
taskbar.Items.Add(new ToolStripButton
|
{
|
||||||
{
|
taskbar.Invoke(
|
||||||
Text = window.Title.Text,
|
new Action(
|
||||||
Image = window.Icon.ToBitmap(),
|
() =>
|
||||||
Tag = window.Id
|
{
|
||||||
});
|
taskbar.Items.Add(
|
||||||
}));
|
new ToolStripButton
|
||||||
});
|
{
|
||||||
|
Text = window.Title.Text,
|
||||||
args.OldItems?.OfType<ShiftWindow>().ToList().ForEach(window =>
|
Image = window.Icon.ToBitmap(),
|
||||||
{
|
Tag = window.Id
|
||||||
taskbar.Invoke(new Action(() =>
|
});
|
||||||
{
|
}));
|
||||||
var tbRemovalList = taskbar.Items.OfType<ToolStripItem>().Where(i => (uint) i.Tag == window.Id);
|
});
|
||||||
|
|
||||||
tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p));
|
args.OldItems?.OfType<ShiftWindow>()
|
||||||
}));
|
.ToList()
|
||||||
});
|
.ForEach(
|
||||||
|
window =>
|
||||||
|
{
|
||||||
|
taskbar.Invoke(
|
||||||
|
new Action(
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
var tbRemovalList = taskbar.Items.OfType<ToolStripItem>().Where(i => (uint) i.Tag == window.Id);
|
||||||
|
|
||||||
|
tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p));
|
||||||
|
}));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
private void timer1_Tick(object sender, EventArgs e) =>
|
void timer1_Tick(object sender, EventArgs e) =>
|
||||||
taskbarClock.Text = $"{DateTime.Now:t}";
|
taskbarClock.Text = $"{DateTime.Now:t}";
|
||||||
|
|
||||||
private void terminalToolStripMenuItem_Click(object sender, EventArgs e)
|
void terminalToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Apps.Terminal trm = new Apps.Terminal();
|
var trm = new Terminal();
|
||||||
|
|
||||||
ShiftWM.Init(trm, "Terminal", null, false, true);
|
ShiftWm.Init(trm, "Terminal", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textPadToolStripMenuItem_Click(object sender, EventArgs e)
|
void textPadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var tp = new Apps.TextPad();
|
var tp = new TextPad();
|
||||||
ShiftWM.Init(tp, "TextPad", Properties.Resources.iconTextPad.ToIcon());
|
ShiftWm.Init(tp, "TextPad", Resources.iconTextPad.ToIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in a new issue