mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 09:52:15 +00:00
Initial upload
This commit is contained in:
parent
69dfad5472
commit
f30dcf5ef4
258 changed files with 42274 additions and 1 deletions
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 shiftos-game
|
||||
Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
BIN
Libraries/Discoursistency.Base.dll
Normal file
BIN
Libraries/Discoursistency.Base.dll
Normal file
Binary file not shown.
BIN
Libraries/Discoursistency.HTTP.dll
Normal file
BIN
Libraries/Discoursistency.HTTP.dll
Normal file
Binary file not shown.
BIN
Libraries/Discoursistency.Util.dll
Normal file
BIN
Libraries/Discoursistency.Util.dll
Normal file
Binary file not shown.
BIN
Libraries/IronPython.Modules.dll
Normal file
BIN
Libraries/IronPython.Modules.dll
Normal file
Binary file not shown.
BIN
Libraries/NetSockets.dll
Normal file
BIN
Libraries/NetSockets.dll
Normal file
Binary file not shown.
6
ShiftOS.MFSProfiler/App.config
Normal file
6
ShiftOS.MFSProfiler/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
248
ShiftOS.MFSProfiler/Form1.Designer.cs
generated
Normal file
248
ShiftOS.MFSProfiler/Form1.Designer.cs
generated
Normal file
|
@ -0,0 +1,248 @@
|
|||
namespace ShiftOS.MFSProfiler
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tvfiles = new System.Windows.Forms.TreeView();
|
||||
this.pnlfileinfo = new System.Windows.Forms.Panel();
|
||||
this.pnldirectorylisting = new System.Windows.Forms.Panel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.txtbinary = new System.Windows.Forms.TextBox();
|
||||
this.txtascii = new System.Windows.Forms.TextBox();
|
||||
this.lbfileinfo = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.pnlfileinfo.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tvfiles);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.panel1);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.pnlfileinfo);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.pnldirectorylisting);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(739, 466);
|
||||
this.splitContainer1.SplitterDistance = 246;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// tvfiles
|
||||
//
|
||||
this.tvfiles.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tvfiles.Location = new System.Drawing.Point(0, 30);
|
||||
this.tvfiles.Name = "tvfiles";
|
||||
this.tvfiles.Size = new System.Drawing.Size(246, 436);
|
||||
this.tvfiles.TabIndex = 0;
|
||||
this.tvfiles.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvfiles_AfterSelect);
|
||||
//
|
||||
// pnlfileinfo
|
||||
//
|
||||
this.pnlfileinfo.Controls.Add(this.groupBox2);
|
||||
this.pnlfileinfo.Controls.Add(this.groupBox1);
|
||||
this.pnlfileinfo.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlfileinfo.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlfileinfo.Name = "pnlfileinfo";
|
||||
this.pnlfileinfo.Size = new System.Drawing.Size(489, 466);
|
||||
this.pnlfileinfo.TabIndex = 0;
|
||||
//
|
||||
// pnldirectorylisting
|
||||
//
|
||||
this.pnldirectorylisting.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnldirectorylisting.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnldirectorylisting.Name = "pnldirectorylisting";
|
||||
this.pnldirectorylisting.Size = new System.Drawing.Size(489, 466);
|
||||
this.pnldirectorylisting.TabIndex = 1;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.button1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(246, 30);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(4, 4);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Mount file";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.lbfileinfo);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(489, 164);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "File record information";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.tabControl1);
|
||||
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox2.Location = new System.Drawing.Point(0, 164);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(489, 302);
|
||||
this.groupBox2.TabIndex = 1;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Contents";
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Location = new System.Drawing.Point(3, 16);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(483, 283);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.txtascii);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(475, 257);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "ASCII";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.txtbinary);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(475, 257);
|
||||
this.tabPage1.TabIndex = 2;
|
||||
this.tabPage1.Text = "Binary";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtbinary
|
||||
//
|
||||
this.txtbinary.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtbinary.Location = new System.Drawing.Point(3, 3);
|
||||
this.txtbinary.Multiline = true;
|
||||
this.txtbinary.Name = "txtbinary";
|
||||
this.txtbinary.Size = new System.Drawing.Size(469, 251);
|
||||
this.txtbinary.TabIndex = 0;
|
||||
//
|
||||
// txtascii
|
||||
//
|
||||
this.txtascii.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtascii.Location = new System.Drawing.Point(3, 3);
|
||||
this.txtascii.Multiline = true;
|
||||
this.txtascii.Name = "txtascii";
|
||||
this.txtascii.Size = new System.Drawing.Size(469, 251);
|
||||
this.txtascii.TabIndex = 0;
|
||||
//
|
||||
// lbfileinfo
|
||||
//
|
||||
this.lbfileinfo.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbfileinfo.Location = new System.Drawing.Point(3, 16);
|
||||
this.lbfileinfo.Name = "lbfileinfo";
|
||||
this.lbfileinfo.Size = new System.Drawing.Size(483, 145);
|
||||
this.lbfileinfo.TabIndex = 0;
|
||||
this.lbfileinfo.Text = "label1";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(739, 466);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.pnlfileinfo.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TreeView tvfiles;
|
||||
private System.Windows.Forms.Panel pnldirectorylisting;
|
||||
private System.Windows.Forms.Panel pnlfileinfo;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TextBox txtascii;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TextBox txtbinary;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label lbfileinfo;
|
||||
}
|
||||
}
|
||||
|
111
ShiftOS.MFSProfiler/Form1.cs
Normal file
111
ShiftOS.MFSProfiler/Form1.cs
Normal file
|
@ -0,0 +1,111 @@
|
|||
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 static ShiftOS.Objects.ShiftFS.Utils;
|
||||
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.Objects.ShiftFS;
|
||||
using System.Threading;
|
||||
|
||||
namespace ShiftOS.MFSProfiler
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetupTree();
|
||||
}
|
||||
|
||||
public void SetupTree()
|
||||
{
|
||||
tvfiles.Nodes.Clear();
|
||||
|
||||
foreach(var dir in Mounts)
|
||||
{
|
||||
var mountNode = new TreeNode();
|
||||
mountNode.Text = dir.Name;
|
||||
mountNode.Tag = Mounts.IndexOf(dir).ToString() + ":";
|
||||
|
||||
RecursiveDirectoryAdd(mountNode);
|
||||
|
||||
tvfiles.Nodes.Add(mountNode);
|
||||
}
|
||||
}
|
||||
|
||||
public void RecursiveDirectoryAdd(TreeNode node)
|
||||
{
|
||||
foreach (var dir in GetDirectories(node.Tag.ToString()))
|
||||
{
|
||||
var dirInf = GetDirectoryInfo(dir);
|
||||
var child = new TreeNode();
|
||||
child.Text = dirInf.Name;
|
||||
child.Tag = dir;
|
||||
RecursiveDirectoryAdd(child);
|
||||
node.Nodes.Add(child);
|
||||
node.Expand();
|
||||
}
|
||||
foreach (var dir in GetFiles(node.Tag.ToString()))
|
||||
{
|
||||
var dirInf = GetFileInfo(dir);
|
||||
var child = new TreeNode();
|
||||
child.Text = dirInf.Name;
|
||||
child.Tag = dir;
|
||||
node.Nodes.Add(child);
|
||||
node.Expand();
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var opener = new OpenFileDialog();
|
||||
opener.Filter = "Mini Filesystem|*.mfs";
|
||||
opener.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
opener.Title = "Mount filesystem";
|
||||
if(opener.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Mount(System.IO.File.ReadAllText(opener.FileName));
|
||||
SetupTree();
|
||||
}
|
||||
}
|
||||
|
||||
private void tvfiles_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (FileExists(tvfiles.SelectedNode.Tag.ToString()))
|
||||
{
|
||||
pnlfileinfo.BringToFront();
|
||||
|
||||
txtascii.Text = ReadAllText(tvfiles.SelectedNode.Tag.ToString());
|
||||
txtbinary.Text = "";
|
||||
var finf = GetFileInfo(tvfiles.SelectedNode.Tag.ToString());
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
foreach (var b in finf.Data)
|
||||
{
|
||||
txtbinary.Invoke(new Action(() =>
|
||||
{
|
||||
txtbinary.Text += b.ToString() + " ";
|
||||
}));
|
||||
}
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
|
||||
|
||||
lbfileinfo.Text = $@"Name: {finf.Name}
|
||||
Permissions: {finf.permissions}
|
||||
Size: {finf.Data.Length}
|
||||
System path: {tvfiles.SelectedNode.Tag.ToString()}";
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.MFSProfiler/Form1.resx
Normal file
120
ShiftOS.MFSProfiler/Form1.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
22
ShiftOS.MFSProfiler/Program.cs
Normal file
22
ShiftOS.MFSProfiler/Program.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShiftOS.MFSProfiler
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
36
ShiftOS.MFSProfiler/Properties/AssemblyInfo.cs
Normal file
36
ShiftOS.MFSProfiler/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ShiftOS.MFSProfiler")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ShiftOS.MFSProfiler")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("af587f3f-ca85-4183-beeb-acf527b1fff3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
ShiftOS.MFSProfiler/Properties/Resources.Designer.cs
generated
Normal file
71
ShiftOS.MFSProfiler/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,71 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ShiftOS.MFSProfiler.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.MFSProfiler.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
ShiftOS.MFSProfiler/Properties/Resources.resx
Normal file
117
ShiftOS.MFSProfiler/Properties/Resources.resx
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?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.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: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" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</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" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
ShiftOS.MFSProfiler/Properties/Settings.Designer.cs
generated
Normal file
30
ShiftOS.MFSProfiler/Properties/Settings.Designer.cs
generated
Normal file
|
@ -0,0 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ShiftOS.MFSProfiler.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
ShiftOS.MFSProfiler/Properties/Settings.settings
Normal file
7
ShiftOS.MFSProfiler/Properties/Settings.settings
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
100
ShiftOS.MFSProfiler/ShiftOS.MFSProfiler.csproj
Normal file
100
ShiftOS.MFSProfiler/ShiftOS.MFSProfiler.csproj
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AF587F3F-CA85-4183-BEEB-ACF527B1FFF3}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ShiftOS.MFSProfiler</RootNamespace>
|
||||
<AssemblyName>ShiftOS.MFSProfiler</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ShiftOS.Objects\ShiftOS.Objects.csproj">
|
||||
<Project>{a069089a-8962-4607-b2b2-4cf4a371066e}</Project>
|
||||
<Name>ShiftOS.Objects</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ShiftOS_TheReturn\ShiftOS.Engine.csproj">
|
||||
<Project>{7c979b07-0585-4033-a110-e5555b9d6651}</Project>
|
||||
<Name>ShiftOS.Engine</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
18
ShiftOS.Objects/DiscourseUser.cs
Normal file
18
ShiftOS.Objects/DiscourseUser.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using Discoursistency.HTTP.Client;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discoursistency.HTTP.Client.Models;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public class ShiftOSAuthAgent : Discoursistency.Base.Authentication.DiscourseAuthenticationService
|
||||
{
|
||||
public ShiftOSAuthAgent(IClient client) : base(client)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
76
ShiftOS.Objects/Hack.cs
Normal file
76
ShiftOS.Objects/Hack.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public abstract class Exploit
|
||||
{
|
||||
public void BeginExploit(string remote_user, bool isMud)
|
||||
{
|
||||
var ctx = new ExploitContext();
|
||||
SendToMUD(remote_user, "hack_getcontext");
|
||||
MessageReceived += (u, c, j) =>
|
||||
{
|
||||
|
||||
};
|
||||
ThisContext = ctx;
|
||||
}
|
||||
|
||||
public ExploitContext ThisContext { get; internal set; }
|
||||
|
||||
public virtual void SendToMUD(string target_user, string command, string json = "")
|
||||
{
|
||||
ThisContext.IsMUDHack = false;
|
||||
if (command == "hack_getcontext")
|
||||
{
|
||||
MessageReceived?.Invoke(target_user, "context_info", ExploitContext.CreateRandom());
|
||||
}
|
||||
}
|
||||
|
||||
public event MUDMessageEventHandler MessageReceived;
|
||||
|
||||
|
||||
public abstract void OnRun(ExploitContext ctx);
|
||||
}
|
||||
|
||||
public delegate void MUDMessageEventHandler(string target_user, string command, string json);
|
||||
|
||||
public class ExploitContext
|
||||
{
|
||||
public static string CreateRandom()
|
||||
{
|
||||
//We can't use JSON.NET. We must construct the JSON ourselves.
|
||||
StringBuilder jBuilder = new StringBuilder();
|
||||
jBuilder.AppendLine("{");
|
||||
jBuilder.Append("\tIsMUDHack: \"false\",");
|
||||
|
||||
jBuilder.AppendLine("}");
|
||||
return jBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether or not this exploit context belongs to a MUD hack session.
|
||||
/// </summary>
|
||||
public bool IsMUDHack { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target username for this exploit context. Used for talking with the MUD about it.
|
||||
/// </summary>
|
||||
public string TargetUsername { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target's locks.
|
||||
/// </summary>
|
||||
public List<Lock> TargetLocks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public abstract class Lock
|
||||
{
|
||||
public abstract bool Unlocked { get; }
|
||||
public abstract void Unlock();
|
||||
}
|
||||
}
|
141
ShiftOS.Objects/Objects.cs
Normal file
141
ShiftOS.Objects/Objects.cs
Normal file
|
@ -0,0 +1,141 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public enum LegionRole
|
||||
{
|
||||
Admin,
|
||||
Manager,
|
||||
Committed,
|
||||
Trainee,
|
||||
AwaitingInvite
|
||||
}
|
||||
|
||||
public enum LegionPublicity
|
||||
{
|
||||
Public, //Will display on the 'Join Legion' page, anyone can join
|
||||
PublicInviteOnly, //Will display on the 'Join Legion' page but you must be invited
|
||||
Unlisted, //Won't display on 'Join Legion', but anyone can join
|
||||
UnlistedInviteOnly //Won't display in 'Join Legion', and admin/manager invitation is required.
|
||||
}
|
||||
|
||||
public class Legion
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public LegionPublicity Publicity { get; set; }
|
||||
public ConsoleColor BannerColor { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
|
||||
public Dictionary<string, LegionRole> Roles { get; set; }
|
||||
public Dictionary<LegionRole, string> RoleNames { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class MUDMemo
|
||||
{
|
||||
public string UserFrom { get; set; }
|
||||
public string UserTo { get; set; }
|
||||
public MemoType Type { get; set; }
|
||||
public string Body { get; set; }
|
||||
public string Subject { get; set; }
|
||||
}
|
||||
|
||||
public class ClientSave
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public enum MemoType
|
||||
{
|
||||
Regular,
|
||||
Job,
|
||||
LegionInvite,
|
||||
}
|
||||
|
||||
|
||||
public class PongHighscore
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public int HighestLevel { get; set; }
|
||||
public int HighestCodepoints { get; set; }
|
||||
}
|
||||
|
||||
public class GUIDRequest
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string guid { get; set; }
|
||||
}
|
||||
|
||||
public class OnlineUser
|
||||
{
|
||||
public string Guid { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string OnlineChat { get; set; }
|
||||
}
|
||||
|
||||
public class Channel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string Topic { get; set; }
|
||||
public int MaxUsers { get; set; } //0 for unlimited users (or the MUD maximum)
|
||||
public List<Save> Users = new List<Save>();
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class ServerMessage
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Contents { get; set; }
|
||||
public string GUID { get; set; }
|
||||
}
|
||||
|
||||
//Better to store this stuff server-side so we can do some neat stuff with hacking...
|
||||
public class Save
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public int Codepoints { get; set; }
|
||||
public Dictionary<string, bool> Upgrades { get; set; }
|
||||
public int StoryPosition { get; set; }
|
||||
public string Language { get; set; }
|
||||
|
||||
public List<string> CurrentLegions { get; set; }
|
||||
|
||||
public int MajorVersion { get; set; }
|
||||
public int MinorVersion { get; set; }
|
||||
public int Revision { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
public string SystemName { get; set; }
|
||||
|
||||
public string DiscourseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the user has entered their Discourse account into ShiftOS, this is the password they gave.
|
||||
///
|
||||
/// ANY developer caught abusing this property will have their dev status revoked and their account PERMANENTLY SUSPENDED. - Michael
|
||||
/// </summary>
|
||||
public string DiscoursePass { get; set; }
|
||||
|
||||
|
||||
public int CountUpgrades()
|
||||
{
|
||||
int count = 0;
|
||||
foreach (var upg in Upgrades)
|
||||
{
|
||||
if (upg.Value == true)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
36
ShiftOS.Objects/Properties/AssemblyInfo.cs
Normal file
36
ShiftOS.Objects/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ShiftOS.Objects")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ShiftOS.Objects")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a069089a-8962-4607-b2b2-4cf4a371066e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
374
ShiftOS.Objects/ShiftFS.cs
Normal file
374
ShiftOS.Objects/ShiftFS.cs
Normal file
|
@ -0,0 +1,374 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using static ShiftOS.Objects.ShiftFS.Utils;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace ShiftOS.Objects.ShiftFS
|
||||
{
|
||||
|
||||
public enum Permissions
|
||||
{
|
||||
User,
|
||||
Administrator,
|
||||
Superuser,
|
||||
All
|
||||
}
|
||||
public class File
|
||||
{
|
||||
public string Name;
|
||||
public byte[] Data;
|
||||
public bool ReadAccessToLowUsers;
|
||||
public Permissions permissions;
|
||||
public System.IO.Stream GetStream()
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
return new System.IO.MemoryStream(Data);
|
||||
}
|
||||
else if (ReadAccessToLowUsers == true)
|
||||
{
|
||||
return new System.IO.MemoryStream(Data, false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public File(string name, byte[] data, bool ReadAccess_to_low_users, Permissions perm)
|
||||
{
|
||||
Name = name;
|
||||
Data = data;
|
||||
permissions = perm;
|
||||
ReadAccessToLowUsers = ReadAccess_to_low_users;
|
||||
}
|
||||
}
|
||||
public class Directory
|
||||
{
|
||||
public string Name;
|
||||
public List<File> Files = new List<File>();
|
||||
public List<Directory> Subdirectories = new List<Directory>();
|
||||
public bool ReadAccessToLowUsers;
|
||||
public Permissions permissions;
|
||||
public void AddFile(File file)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
Files.Add(file);
|
||||
}
|
||||
}
|
||||
public void RemoveFile(string name)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
Files.Remove(Files.Find(x => x.Name == name));
|
||||
}
|
||||
}
|
||||
public void RemoveFile(File file)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
Files.Remove(file);
|
||||
}
|
||||
}
|
||||
public File FindFileByName(string name)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
return Files.Find(x => x.Name == name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void AddDirectory(Directory dir)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
Subdirectories.Add(dir);
|
||||
}
|
||||
}
|
||||
public void RemoveDirectory(string name)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
Subdirectories.Remove(Subdirectories.Find(x => x.Name == name));
|
||||
}
|
||||
}
|
||||
public void RemoveDirectory(Directory dir)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
Subdirectories.Remove(dir);
|
||||
}
|
||||
}
|
||||
public Directory FindDirectoryByName(string name)
|
||||
{
|
||||
if ((int)CurrentUser >= (int)permissions || permissions == Permissions.All)
|
||||
{
|
||||
return Subdirectories.Find(x => x.Name == name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Utils
|
||||
{
|
||||
public static Permissions CurrentUser { get; set; }
|
||||
|
||||
public static List<Directory> Mounts { get; set; }
|
||||
|
||||
static Utils()
|
||||
{
|
||||
if (Mounts == null)
|
||||
Mounts = new List<Directory>();
|
||||
|
||||
}
|
||||
|
||||
public static void Mount(string json)
|
||||
{
|
||||
var dir = JsonConvert.DeserializeObject<Directory>(json);
|
||||
Mounts.Add(dir);
|
||||
}
|
||||
|
||||
public static void MountPersistent(string mfsFile)
|
||||
{
|
||||
var dir = JsonConvert.DeserializeObject<Directory>(ReadAllText(mfsFile));
|
||||
Mounts.Add(dir);
|
||||
string oldJson = JsonConvert.SerializeObject(dir);
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
while (Mounts != null)
|
||||
{
|
||||
if (oldJson != JsonConvert.SerializeObject(dir))
|
||||
{
|
||||
oldJson = JsonConvert.SerializeObject(dir);
|
||||
WriteAllText(mfsFile, oldJson);
|
||||
}
|
||||
}
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
|
||||
public static void CreateDirectory(string path)
|
||||
{
|
||||
if (!DirectoryExists(path))
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
dir.AddDirectory(new Directory
|
||||
{
|
||||
Name = pathlist[pathlist.Length - 1],
|
||||
permissions = CurrentUser,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("The directory \"" + path + "\" already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] ReadAllBytes(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
var file = dir.FindFileByName(pathlist[pathlist.Length - 1]);
|
||||
|
||||
return file.Data;
|
||||
|
||||
}
|
||||
|
||||
public static void WriteAllText(string path, string contents)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
|
||||
if (!FileExists(path))
|
||||
{
|
||||
dir.AddFile(new File(pathlist[pathlist.Length - 1], Encoding.UTF8.GetBytes(contents), false, Permissions.All));
|
||||
}
|
||||
else
|
||||
{
|
||||
var f = dir.FindFileByName(pathlist[pathlist.Length - 1]);
|
||||
f.Data = Encoding.UTF8.GetBytes(contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void Delete(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
|
||||
if (FileExists(path))
|
||||
{
|
||||
dir.RemoveFile(pathlist[pathlist.Length - 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
dir.RemoveDirectory(pathlist[pathlist.Length - 1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void WriteAllBytes(string path, byte[] contents)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
|
||||
if (!FileExists(path))
|
||||
{
|
||||
dir.AddFile(new File(pathlist[pathlist.Length - 1], contents, false, Permissions.All));
|
||||
}
|
||||
else
|
||||
{
|
||||
var f = dir.FindFileByName(pathlist[pathlist.Length - 1]);
|
||||
f.Data = contents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string ExportMount(int index)
|
||||
{
|
||||
var dir = Mounts[index];
|
||||
return JsonConvert.SerializeObject(dir, Formatting.Indented);
|
||||
}
|
||||
|
||||
public static bool DirectoryExists(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 1; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
return dir != null;
|
||||
|
||||
}
|
||||
|
||||
public static bool FileExists(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
return dir.FindFileByName(pathlist[pathlist.Length - 1]) != null;
|
||||
|
||||
}
|
||||
|
||||
public static Directory GetDirectoryInfo(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 1; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
if (path.EndsWith("/"))
|
||||
path = path.Remove(path.Length - 1, 1);
|
||||
return dir;
|
||||
}
|
||||
|
||||
public static string ReadAllText(string path)
|
||||
{
|
||||
return Encoding.UTF8.GetString(ReadAllBytes(path));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static File GetFileInfo(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 2; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
return dir.FindFileByName(pathlist[pathlist.Length - 1]);
|
||||
|
||||
}
|
||||
|
||||
public static string[] GetDirectories(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for(int i = 1; i <= pathlist.Length - 1; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
if (path.EndsWith("/"))
|
||||
path = path.Remove(path.Length - 1, 1);
|
||||
|
||||
List<string> paths = new List<string>();
|
||||
|
||||
foreach(var subdir in dir.Subdirectories)
|
||||
{
|
||||
paths.Add(path + "/" + subdir.Name);
|
||||
}
|
||||
paths.Sort();
|
||||
return paths.ToArray();
|
||||
}
|
||||
|
||||
public static string[] GetFiles(string path)
|
||||
{
|
||||
string[] pathlist = path.Split('/');
|
||||
int vol = Convert.ToInt32(pathlist[0].Replace(":", ""));
|
||||
var dir = Mounts[vol];
|
||||
for (int i = 1; i <= pathlist.Length - 1; i++)
|
||||
{
|
||||
dir = dir.FindDirectoryByName(pathlist[i]);
|
||||
}
|
||||
if (path.EndsWith("/"))
|
||||
path = path.Remove(path.Length - 1, 1);
|
||||
|
||||
List<string> paths = new List<string>();
|
||||
|
||||
foreach (var subdir in dir.Files)
|
||||
{
|
||||
paths.Add(path + "/" + subdir.Name);
|
||||
}
|
||||
paths.Sort();
|
||||
return paths.ToArray();
|
||||
}
|
||||
|
||||
public static void WriteAllText(string v, object p)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
75
ShiftOS.Objects/ShiftOS.Objects.csproj
Normal file
75
ShiftOS.Objects/ShiftOS.Objects.csproj
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A069089A-8962-4607-B2B2-4CF4A371066E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ShiftOS.Objects</RootNamespace>
|
||||
<AssemblyName>ShiftOS.Objects</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Discoursistency.Base">
|
||||
<HintPath>..\Libraries\Discoursistency.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Discoursistency.HTTP">
|
||||
<HintPath>..\Libraries\Discoursistency.HTTP.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Discoursistency.Util">
|
||||
<HintPath>..\Libraries\Discoursistency.Util.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DiscourseUser.cs" />
|
||||
<Compile Include="Hack.cs" />
|
||||
<Compile Include="Objects.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ShiftFS.cs" />
|
||||
<Compile Include="ShiftOSMenuRenderer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
27
ShiftOS.Objects/ShiftOSMenuRenderer.cs
Normal file
27
ShiftOS.Objects/ShiftOSMenuRenderer.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
class ShiftOSMenuRenderer : ToolStripProfessionalRenderer
|
||||
{
|
||||
public ShiftOSMenuRenderer() : base(new ShiftOSColorTable())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ShiftOSColorTable : ProfessionalColorTable
|
||||
{
|
||||
|
||||
}
|
||||
}
|
4
ShiftOS.Objects/packages.config
Normal file
4
ShiftOS.Objects/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
</packages>
|
6
ShiftOS.Server/App.config
Normal file
6
ShiftOS.Server/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
964
ShiftOS.Server/Program.cs
Normal file
964
ShiftOS.Server/Program.cs
Normal file
|
@ -0,0 +1,964 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShiftOS.Objects;
|
||||
using NetSockets;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using Nancy.Hosting.Self;
|
||||
using Nancy;
|
||||
using Nancy.Authentication.Basic;
|
||||
using Nancy.Security;
|
||||
using Nancy.TinyIoc;
|
||||
using Nancy.Bootstrapper;
|
||||
|
||||
namespace ShiftOS.Server
|
||||
{
|
||||
public interface IUserMapper
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the real username from an identifier
|
||||
/// </summary>
|
||||
/// <param name="identifier">User identifier</param>
|
||||
/// <param name="context">The current NancyFx context</param>
|
||||
/// <returns>Matching populated IUserIdentity object, or empty</returns>
|
||||
IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context);
|
||||
}
|
||||
|
||||
public class MUDUserValidator : IUserValidator
|
||||
{
|
||||
public IUserIdentity Validate(string username, string password)
|
||||
{
|
||||
if(username == Program.AdminUsername && password == Program.AdminPassword)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MUDUserIdentity : IUserIdentity
|
||||
{
|
||||
public IEnumerable<string> Claims
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
return uname;
|
||||
}
|
||||
}
|
||||
|
||||
public string uname = "";
|
||||
|
||||
public MUDUserIdentity(string username)
|
||||
{
|
||||
uname = username;
|
||||
}
|
||||
}
|
||||
|
||||
public class AuthenticationBootstrapper : DefaultNancyBootstrapper
|
||||
{
|
||||
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
||||
{
|
||||
base.ApplicationStartup(container, pipelines);
|
||||
|
||||
pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
|
||||
container.Resolve<MUDUserValidator>(),
|
||||
"MUD", UserPromptBehaviour.NonAjax));
|
||||
}
|
||||
}
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static string AdminUsername = "admin";
|
||||
public static string AdminPassword = "admin";
|
||||
|
||||
|
||||
|
||||
public static NetObjectServer server;
|
||||
|
||||
public delegate void StringEventHandler(string str);
|
||||
|
||||
public static event StringEventHandler ServerStarted;
|
||||
|
||||
public static void SaveChats()
|
||||
{
|
||||
List<Channel> saved = new List<Channel>();
|
||||
foreach(var chat in chats)
|
||||
{
|
||||
saved.Add(new Channel
|
||||
{
|
||||
ID = chat.ID,
|
||||
Name = chat.Name,
|
||||
MaxUsers = chat.MaxUsers,
|
||||
Topic = chat.Topic,
|
||||
Users = new List<Save>()
|
||||
});
|
||||
}
|
||||
File.WriteAllText("chats.json", JsonConvert.SerializeObject(saved));
|
||||
}
|
||||
|
||||
public static void LoadChats()
|
||||
{
|
||||
chats = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Channel>>(File.ReadAllText("chats.json"));
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if (!Directory.Exists("saves"))
|
||||
{
|
||||
Directory.CreateDirectory("saves");
|
||||
}
|
||||
|
||||
if(!File.Exists("chats.json"))
|
||||
{
|
||||
SaveChats();
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadChats();
|
||||
}
|
||||
|
||||
if(!Directory.Exists("scripts"))
|
||||
{
|
||||
Console.WriteLine("Creating scripts directory...");
|
||||
Directory.CreateDirectory("scripts");
|
||||
Console.WriteLine("NOTE: This MUD is not just gonna generate scripts for you. You're going to need to write them. YOU are DevX.");
|
||||
}
|
||||
|
||||
Console.WriteLine("Starting server...");
|
||||
server = new NetObjectServer();
|
||||
|
||||
server.OnStarted += (o, a) =>
|
||||
{
|
||||
Console.WriteLine($"Server started on address {server.Address}, port {server.Port}.");
|
||||
ServerStarted?.Invoke(server.Address.MapToIPv4().ToString());
|
||||
};
|
||||
|
||||
server.OnStopped += (o, a) =>
|
||||
{
|
||||
Console.WriteLine("WARNING! Server stopped.");
|
||||
};
|
||||
|
||||
server.OnError += (o, a) =>
|
||||
{
|
||||
Console.WriteLine("ERROR: " + a.Exception.Message);
|
||||
};
|
||||
|
||||
server.OnClientAccepted += (o, a) =>
|
||||
{
|
||||
Console.WriteLine("Client connected.");
|
||||
server.DispatchTo(a.Guid, new NetObject("welcome", new ServerMessage { Name = "Welcome", Contents = a.Guid.ToString(), GUID = "Server" }));
|
||||
};
|
||||
|
||||
server.OnReceived += (o, a) =>
|
||||
{
|
||||
var obj = a.Data.Object;
|
||||
|
||||
var msg = obj as ServerMessage;
|
||||
|
||||
if(msg != null)
|
||||
{
|
||||
Interpret(msg);
|
||||
}
|
||||
};
|
||||
|
||||
IPAddress defaultAddress = null;
|
||||
|
||||
var host = Dns.GetHostEntry(Dns.GetHostName());
|
||||
foreach (var ip in host.AddressList)
|
||||
{
|
||||
if (ip.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
defaultAddress = ip;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
server.Start(defaultAddress, 13370);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("So we tried to bind the server to your IP address automatically, but your operating system or the .NET environment you are in (possibly Mono on Linux) is preventing us from doing so. We'll try to bind to the loopback IP address (127.0.0.1) and if that doesn't work, the multi-user domain software may not be compatible with this OS or .NET environment.");
|
||||
server.Stop();
|
||||
server.Start(IPAddress.Loopback, 13370);
|
||||
|
||||
}
|
||||
|
||||
var hConf = new HostConfiguration();
|
||||
hConf.UrlReservations.CreateAutomatically = true;
|
||||
|
||||
var nancy = new NancyHost(hConf, new Uri("http://localhost:13371/"));
|
||||
|
||||
server.OnStopped += (o, a) =>
|
||||
{
|
||||
nancy.Stop();
|
||||
};
|
||||
|
||||
nancy.Start();
|
||||
}
|
||||
|
||||
public static bool UserInChat(Channel chan, Save user)
|
||||
{
|
||||
foreach(var usr in chan.Users)
|
||||
{
|
||||
if(usr.Username == user.Username)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void Interpret(ServerMessage msg)
|
||||
{
|
||||
Dictionary<string, object> args = null;
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine($@"Message received from {msg.GUID}: {msg.Name}
|
||||
|
||||
Contents:
|
||||
{msg.Contents}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(msg.Contents))
|
||||
{
|
||||
try
|
||||
{
|
||||
//It's gotta be JSON.
|
||||
if (msg.Contents.StartsWith("{"))
|
||||
{
|
||||
args = JsonConvert.DeserializeObject<Dictionary<string, object>>(msg.Contents);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Damnit, we were wrong.
|
||||
args = null;
|
||||
}
|
||||
}
|
||||
|
||||
switch (msg.Name)
|
||||
{
|
||||
case "mud_login":
|
||||
if (args["username"] != null && args["password"] != null)
|
||||
{
|
||||
foreach(var savefile in Directory.GetFiles("saves"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var save = JsonConvert.DeserializeObject<Save>(File.ReadAllText(savefile));
|
||||
|
||||
if(save.Username == args["username"].ToString() && save.Password == args["password"].ToString())
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mud_savefile", new ServerMessage
|
||||
{
|
||||
Name = "mud_savefile",
|
||||
GUID = "server",
|
||||
Contents = File.ReadAllText(savefile)
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_login_denied",
|
||||
GUID = "server"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_login_denied",
|
||||
GUID = "server"
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case "legion_create":
|
||||
List<Legion> legions = new List<Legion>();
|
||||
if (File.Exists("legions.json"))
|
||||
legions = JsonConvert.DeserializeObject<List<Legion>>(File.ReadAllText("legions.json"));
|
||||
|
||||
var l = JsonConvert.DeserializeObject<Legion>(msg.Contents);
|
||||
|
||||
legions.Add(l);
|
||||
|
||||
File.WriteAllText("legions.json", JsonConvert.SerializeObject(legions, Formatting.Indented));
|
||||
break;
|
||||
case "legion_get_all":
|
||||
List<Legion> allLegions = new List<Legion>();
|
||||
|
||||
if (File.Exists("legions.json"))
|
||||
allLegions = JsonConvert.DeserializeObject<List<Legion>>(File.ReadAllText("legions.json"));
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("alllegions", new ServerMessage
|
||||
{
|
||||
Name = "legion_all",
|
||||
GUID = "server",
|
||||
Contents = JsonConvert.SerializeObject(allLegions)
|
||||
}));
|
||||
break;
|
||||
case "legion_get_users":
|
||||
var lgn = JsonConvert.DeserializeObject<Legion>(msg.Contents);
|
||||
|
||||
List<string> userIDs = new List<string>();
|
||||
|
||||
foreach (var savfile in Directory.GetFiles("saves"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var savefilecontents = JsonConvert.DeserializeObject<Save>(File.ReadAllText(savfile));
|
||||
if (savefilecontents.CurrentLegions.Contains(lgn.ShortName))
|
||||
{
|
||||
userIDs.Add($"{savefilecontents.Username}@{savefilecontents.SystemName}");
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("userlist", new ServerMessage
|
||||
{
|
||||
Name = "legion_users_found",
|
||||
GUID = "server",
|
||||
Contents = JsonConvert.SerializeObject(userIDs)
|
||||
}));
|
||||
break;
|
||||
case "user_get_legion":
|
||||
var userSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
|
||||
if (File.Exists("legions.json"))
|
||||
{
|
||||
var legionList = JsonConvert.DeserializeObject<List<Legion>>(File.ReadAllText("legions.json"));
|
||||
foreach (var legion in legionList)
|
||||
{
|
||||
if (userSave.CurrentLegions.Contains(legion.ShortName))
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("reply", new ServerMessage
|
||||
{
|
||||
Name = "user_legion",
|
||||
GUID = "server",
|
||||
Contents = JsonConvert.SerializeObject(legion)
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("fuck", new ServerMessage
|
||||
{
|
||||
Name = "user_not_found_in_legion",
|
||||
GUID = "server"
|
||||
}));
|
||||
|
||||
break;
|
||||
case "mud_save":
|
||||
var sav = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
File.WriteAllText("saves/" + sav.Username + ".save", JsonConvert.SerializeObject(sav, Formatting.Indented));
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_saved",
|
||||
GUID = "server"
|
||||
}));
|
||||
|
||||
break;
|
||||
case "mud_checkuserexists":
|
||||
if (args["username"] != null && args["password"] != null)
|
||||
{
|
||||
foreach (var savefile in Directory.GetFiles("saves"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var save = JsonConvert.DeserializeObject<Save>(File.ReadAllText(savefile));
|
||||
|
||||
if (save.Username == args["username"].ToString() && save.Password == args["password"].ToString())
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mud_savefile", new ServerMessage
|
||||
{
|
||||
Name = "mud_found",
|
||||
GUID = "server",
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_notfound",
|
||||
GUID = "server"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_notfound",
|
||||
GUID = "server"
|
||||
}));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case "pong_gethighscores":
|
||||
if (File.Exists("pong_highscores.json"))
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("pongstuff", new ServerMessage
|
||||
{
|
||||
Name = "pong_highscores",
|
||||
GUID = "server",
|
||||
Contents = File.ReadAllText("pong_highscores.json")
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case "get_memos_for_user":
|
||||
if(args["username"] != null)
|
||||
{
|
||||
string usrname = args["username"].ToString();
|
||||
|
||||
List<MUDMemo> mmos = new List<MUDMemo>();
|
||||
|
||||
if (File.Exists("memos.json"))
|
||||
{
|
||||
foreach(var mmo in JsonConvert.DeserializeObject<MUDMemo[]>(File.ReadAllText("memos.json")))
|
||||
{
|
||||
if(mmo.UserTo == usrname)
|
||||
{
|
||||
mmos.Add(mmo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mud_memos", new ServerMessage
|
||||
{
|
||||
Name = "mud_usermemos",
|
||||
GUID = "server",
|
||||
Contents = JsonConvert.SerializeObject(mmos)
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case "mud_post_memo":
|
||||
MUDMemo memo = JsonConvert.DeserializeObject<MUDMemo>(msg.Contents);
|
||||
List<MUDMemo> memos = new List<MUDMemo>();
|
||||
|
||||
if (File.Exists("memos.json"))
|
||||
memos = JsonConvert.DeserializeObject<List<MUDMemo>>(File.ReadAllText("memos.json"));
|
||||
|
||||
memos.Add(memo);
|
||||
File.WriteAllText("memos.txt", JsonConvert.SerializeObject(memos));
|
||||
|
||||
|
||||
break;
|
||||
case "pong_sethighscore":
|
||||
var hs = new List<PongHighscore>();
|
||||
if (File.Exists("pong_highscores.json"))
|
||||
hs = JsonConvert.DeserializeObject<List<PongHighscore>>(File.ReadAllText("ponghighscores.json"));
|
||||
|
||||
var newHS = JsonConvert.DeserializeObject<PongHighscore>(msg.Contents);
|
||||
for (int i = 0; i <= hs.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (hs[i].UserName == newHS.UserName)
|
||||
{
|
||||
if (newHS.HighestLevel > hs[i].HighestLevel)
|
||||
hs[i].HighestLevel = newHS.HighestLevel;
|
||||
if (newHS.HighestCodepoints > hs[i].HighestCodepoints)
|
||||
hs[i].HighestCodepoints = newHS.HighestCodepoints;
|
||||
File.WriteAllText("pong_highscores.json", JsonConvert.SerializeObject(hs));
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
hs.Add(newHS);
|
||||
File.WriteAllText("pong_highscores.json", JsonConvert.SerializeObject(hs));
|
||||
return;
|
||||
case "getvirusdb":
|
||||
if (!File.Exists("virus.db"))
|
||||
File.WriteAllText("virus.db", "{}");
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("vdb", new ServerMessage
|
||||
{
|
||||
Name = "virusdb",
|
||||
GUID = "server",
|
||||
Contents = File.ReadAllText("virus.db")
|
||||
}));
|
||||
break;
|
||||
case "getvirus":
|
||||
Dictionary<string, string> virusDB = new Dictionary<string, string>();
|
||||
|
||||
if (File.Exists("virus.db"))
|
||||
virusDB = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText("virus.db"));
|
||||
|
||||
foreach (var kv in virusDB)
|
||||
{
|
||||
if (kv.Key == msg.Contents)
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("response", new ServerMessage
|
||||
{
|
||||
Name = "mud_virus",
|
||||
GUID = "server",
|
||||
Contents = kv.Value,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case "mud_scanvirus":
|
||||
Dictionary<string, string> _virusDB = new Dictionary<string, string>();
|
||||
|
||||
bool addIfNotFound = true;
|
||||
|
||||
if (msg.Contents.Contains("||scanonly"))
|
||||
addIfNotFound = false;
|
||||
|
||||
msg.Contents = msg.Contents.Replace("||scanonly", "");
|
||||
|
||||
if(File.Exists("virus.db"))
|
||||
_virusDB = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText("virus.db"));
|
||||
|
||||
foreach(var kv in _virusDB)
|
||||
{
|
||||
if(kv.Value == msg.Contents)
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("response", new ServerMessage
|
||||
{
|
||||
Name = "mud_virus_signature",
|
||||
GUID = "server",
|
||||
Contents = kv.Key,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (addIfNotFound == true)
|
||||
{
|
||||
string newguid = Guid.NewGuid().ToString();
|
||||
_virusDB.Add(newguid, msg.Contents);
|
||||
File.WriteAllText("virus.db", JsonConvert.SerializeObject(_virusDB, Formatting.Indented));
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("response", new ServerMessage
|
||||
{
|
||||
Name = "mud_virus_signature",
|
||||
GUID = "server",
|
||||
Contents = newguid,
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("response", new ServerMessage
|
||||
{
|
||||
Name = "mud_virus_signature",
|
||||
GUID = "server",
|
||||
Contents = "unknown",
|
||||
}));
|
||||
}
|
||||
return;
|
||||
|
||||
case "chat_join":
|
||||
if (args.ContainsKey("id"))
|
||||
{
|
||||
var cuser = new Save();
|
||||
if (args.ContainsKey("user"))
|
||||
{
|
||||
cuser = JsonConvert.DeserializeObject<Save>(JsonConvert.SerializeObject(args["user"]));
|
||||
|
||||
|
||||
}
|
||||
int index = -1;
|
||||
string chat_id = args["id"] as string;
|
||||
foreach(var chat in chats)
|
||||
{
|
||||
if(chat.ID == chat_id)
|
||||
{
|
||||
if(chat.Users.Count < chat.MaxUsers || chat.MaxUsers == 0)
|
||||
{
|
||||
//user can join chat.
|
||||
if(cuser != null)
|
||||
{
|
||||
index = chats.IndexOf(chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(index > -1)
|
||||
{
|
||||
chats[index].Users.Add(cuser);
|
||||
server.DispatchAll(new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{chat_id}: {cuser.Username} {{CHAT_HAS_JOINED}}"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{chat_id}: {{CHAT_NOT_FOUND_OR_TOO_MANY_MEMBERS}}"
|
||||
}));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "chat":
|
||||
if (args.ContainsKey("id"))
|
||||
{
|
||||
var cuser = new Save();
|
||||
if (args.ContainsKey("user"))
|
||||
{
|
||||
cuser = JsonConvert.DeserializeObject<Save>(JsonConvert.SerializeObject(args["user"]));
|
||||
|
||||
|
||||
}
|
||||
string message = "";
|
||||
if (args.ContainsKey("msg"))
|
||||
message = args["msg"] as string;
|
||||
|
||||
int index = -1;
|
||||
string chat_id = args["id"] as string;
|
||||
foreach (var chat in chats)
|
||||
{
|
||||
if (chat.ID == chat_id)
|
||||
{
|
||||
if (cuser != null && !string.IsNullOrWhiteSpace(message) && UserInChat(chat, cuser))
|
||||
{
|
||||
index = chats.IndexOf(chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index > -1)
|
||||
{
|
||||
server.DispatchAll(new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{chat_id}/{cuser.Username}: {message}"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{chats[index].ID}: {{CHAT_NOT_FOUND_OR_NOT_IN_CHAT}}"
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "chat_leave":
|
||||
if (args.ContainsKey("id"))
|
||||
{
|
||||
var cuser = new Save();
|
||||
if (args.ContainsKey("user"))
|
||||
{
|
||||
cuser = JsonConvert.DeserializeObject<Save>(JsonConvert.SerializeObject(args["user"]));
|
||||
|
||||
|
||||
}
|
||||
int index = -1;
|
||||
string chat_id = args["id"] as string;
|
||||
foreach (var chat in chats)
|
||||
{
|
||||
if (chat.ID == chat_id)
|
||||
{
|
||||
if (cuser != null && UserInChat(chat, cuser))
|
||||
{
|
||||
index = chats.IndexOf(chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index > -1)
|
||||
{
|
||||
server.DispatchAll(new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{chats[index].ID}: {cuser.Username} {{HAS_LEFT_CHAT}}"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{chat_id}: {{CHAT_NOT_FOUND_OR_NOT_IN_CHAT}}"
|
||||
}));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "chat_create":
|
||||
string id = "";
|
||||
string topic = "";
|
||||
string name = "";
|
||||
int max_users = 0;
|
||||
|
||||
if (args.ContainsKey("id"))
|
||||
id = args["id"] as string;
|
||||
if (args.ContainsKey("topic"))
|
||||
name = args["topic"] as string;
|
||||
if (args.ContainsKey("name"))
|
||||
topic = args["name"] as string;
|
||||
if (args.ContainsKey("max_users"))
|
||||
max_users = Convert.ToInt32(args["max_users"].ToString());
|
||||
|
||||
bool id_taken = false;
|
||||
|
||||
foreach(var chat in chats)
|
||||
{
|
||||
if (chat.ID == id)
|
||||
id_taken = true;
|
||||
}
|
||||
|
||||
if (id_taken == false)
|
||||
{
|
||||
chats.Add(new Channel
|
||||
{
|
||||
ID = id,
|
||||
Name = name,
|
||||
Topic = topic,
|
||||
MaxUsers = max_users,
|
||||
Users = new List<Save>()
|
||||
});
|
||||
SaveChats();
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{id}: {{SUCCESSFULLY_CREATED_CHAT}}"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("broadcast", new ServerMessage
|
||||
{
|
||||
Name = "cbroadcast",
|
||||
GUID = "server",
|
||||
Contents = $"{id}: {{ID_TAKEN}}"
|
||||
}));
|
||||
}
|
||||
|
||||
break;
|
||||
case "broadcast":
|
||||
string text = msg.Contents;
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("runme", new ServerMessage
|
||||
{
|
||||
Name = "broadcast",
|
||||
GUID = "Server",
|
||||
Contents = text
|
||||
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case "lua_up":
|
||||
string lua = msg.Contents;
|
||||
string firstLine = lua.Split(new[] { Environment.NewLine }, StringSplitOptions.None)[0];
|
||||
firstLine = firstLine.Remove(0, 3); //delete the comment
|
||||
string[] a = firstLine.Split('.');
|
||||
if(!Directory.Exists("scripts/" + a[0]))
|
||||
{
|
||||
Directory.CreateDirectory($"scripts/{a[0]}");
|
||||
}
|
||||
File.WriteAllText($"scripts/{a[0]}/{a[1]}.lua", lua);
|
||||
break;
|
||||
case "mudhack_init":
|
||||
if (MUDHackPasswords.ContainsKey(msg.GUID))
|
||||
MUDHackPasswords.Remove(msg.GUID);
|
||||
|
||||
MUDHackPasswords.Add(msg.GUID, GenerateRandomPassword());
|
||||
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mudhack_init", new ServerMessage
|
||||
{
|
||||
Name = "mudhack_init",
|
||||
GUID = "SERVER",
|
||||
Contents = MUDHackPasswords[msg.GUID],
|
||||
}));
|
||||
|
||||
break;
|
||||
case "mudhack_verify":
|
||||
if (!MUDHackPasswords.ContainsKey(msg.GUID))
|
||||
{
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mudhack_init", new ServerMessage
|
||||
{
|
||||
Name = "server_error",
|
||||
GUID = "SERVER",
|
||||
Contents = "{SRV_HACK_NOT_INITIATED}",
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
string pass = "";
|
||||
if (args.ContainsKey("pass"))
|
||||
pass = args["pass"] as string;
|
||||
|
||||
if(pass == MUDHackPasswords[msg.GUID])
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mudhack_init", new ServerMessage
|
||||
{
|
||||
Name = "mudhack_granted",
|
||||
GUID = "SERVER",
|
||||
}));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mudhack_init", new ServerMessage
|
||||
{
|
||||
Name = "mudhack_denied",
|
||||
GUID = "SERVER",
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case "mudhack_killpass":
|
||||
if (MUDHackPasswords.ContainsKey(msg.GUID))
|
||||
MUDHackPasswords.Remove(msg.GUID);
|
||||
break;
|
||||
case "mudhack_getallusers":
|
||||
List<OnlineUser> users = new List<OnlineUser>();
|
||||
|
||||
foreach (var chat in chats)
|
||||
{
|
||||
foreach(var usr in chat.Users)
|
||||
{
|
||||
var ousr = new OnlineUser();
|
||||
ousr.Username = usr.Username;
|
||||
ousr.OnlineChat = chat.ID;
|
||||
users.Add(ousr);
|
||||
}
|
||||
}
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("mudhack_users", new ServerMessage
|
||||
{
|
||||
Name = "mudhack_users",
|
||||
GUID = "SERVER",
|
||||
Contents = JsonConvert.SerializeObject(users),
|
||||
}));
|
||||
break;
|
||||
case "getguid_reply":
|
||||
msg.GUID = "server";
|
||||
//The message's GUID was manipulated by the client to send to another client.
|
||||
//So we can just bounce back the message to the other client.
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("bounce", msg));
|
||||
break;
|
||||
case "getguid_send":
|
||||
string username = msg.Contents;
|
||||
string guid = msg.GUID;
|
||||
server.DispatchAll(new NetObject("are_you_this_guy", new ServerMessage
|
||||
{
|
||||
Name = "getguid_fromserver",
|
||||
GUID = guid,
|
||||
Contents = username,
|
||||
}));
|
||||
break;
|
||||
case "script":
|
||||
string user = "";
|
||||
string script = "";
|
||||
string sArgs = "";
|
||||
|
||||
if (!args.ContainsKey("user"))
|
||||
throw new Exception("No 'user' arg specified in message to server");
|
||||
|
||||
if (!args.ContainsKey("script"))
|
||||
throw new Exception("No 'script' arg specified in message to server");
|
||||
|
||||
if (!args.ContainsKey("args"))
|
||||
throw new Exception("No 'args' arg specified in message to server");
|
||||
|
||||
user = args["user"] as string;
|
||||
script = args["script"] as string;
|
||||
sArgs = args["args"] as string;
|
||||
|
||||
if(File.Exists($"scripts/{user}/{script}.lua"))
|
||||
{
|
||||
var script_arguments = JsonConvert.DeserializeObject<Dictionary<string, object>>(sArgs);
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("runme", new ServerMessage {
|
||||
Name="run",
|
||||
GUID="Server",
|
||||
Contents = $@"{{
|
||||
script:""{File.ReadAllText($"scripts/{user}/{script}.lua").Replace("\"", "\\\"")}"",
|
||||
args:""{sArgs}""
|
||||
}}"
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"{user}.{script}: Script not found.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Exception($"Server couldn't decipher this message:\n\n{JsonConvert.SerializeObject(msg)}");
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("An error occurred with that one.");
|
||||
Console.WriteLine(ex);
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("error", new ServerMessage { Name = "Error", GUID = "Server", Contents = JsonConvert.SerializeObject(ex) }));
|
||||
}
|
||||
}
|
||||
|
||||
public static string GenerateRandomPassword()
|
||||
{
|
||||
return Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> MUDHackPasswords = new Dictionary<string, string>();
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (server.IsOnline)
|
||||
{
|
||||
try
|
||||
{
|
||||
server.Stop();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
server = null;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static List<Channel> chats = new List<Channel>();
|
||||
}
|
||||
}
|
36
ShiftOS.Server/Properties/AssemblyInfo.cs
Normal file
36
ShiftOS.Server/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ShiftOS.Server")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ShiftOS.Server")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("226c63b4-e60d-4949-b4e7-7a2ddbb96776")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
97
ShiftOS.Server/Properties/Resources.Designer.cs
generated
Normal file
97
ShiftOS.Server/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,97 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ShiftOS.Server.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.Server.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <html>
|
||||
/// <head>
|
||||
/// <title>ShiftOS Multi-User Domain &bull; Admin Panel</title>
|
||||
/// </head>
|
||||
/// <body>
|
||||
/// <h1>Welcome.</h1>
|
||||
/// <p>There's nothing here, but hey, it works!</p>
|
||||
/// </body>
|
||||
///</html>.
|
||||
/// </summary>
|
||||
internal static string Home {
|
||||
get {
|
||||
return ResourceManager.GetString("Home", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <html>
|
||||
/// <head>
|
||||
/// <title>Multi-User Domain &bull; Administration Panel - Page not found.</title>
|
||||
/// </head>
|
||||
/// <body>
|
||||
/// <h1>This page wasn't found.</h1>
|
||||
/// <p>We couldn't find this page...</p>
|
||||
/// </body>
|
||||
///</html>.
|
||||
/// </summary>
|
||||
internal static string NotFound {
|
||||
get {
|
||||
return ResourceManager.GetString("NotFound", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
ShiftOS.Server/Properties/Resources.resx
Normal file
127
ShiftOS.Server/Properties/Resources.resx
Normal file
|
@ -0,0 +1,127 @@
|
|||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Home" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Home.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
<data name="NotFound" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NotFound.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
31
ShiftOS.Server/Resources/Home.txt
Normal file
31
ShiftOS.Server/Resources/Home.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>ShiftOS Multi-User Domain • Admin Panel</title>
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
|
||||
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/">MUD Admin Panel</a>
|
||||
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/chats">Chat manager</a></li>
|
||||
<li><a href="/status" class="active">System status</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
|
||||
{BODY}
|
||||
|
||||
<footer>
|
||||
<p>MUD server on {IP_ADDR}:{PORT}</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
9
ShiftOS.Server/Resources/NotFound.txt
Normal file
9
ShiftOS.Server/Resources/NotFound.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Multi-User Domain • Administration Panel - Page not found.</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>This page wasn't found.</h1>
|
||||
<p>We couldn't find this page...</p>
|
||||
</body>
|
||||
</html>
|
108
ShiftOS.Server/ShiftOS.Server.csproj
Normal file
108
ShiftOS.Server/ShiftOS.Server.csproj
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{226C63B4-E60D-4949-B4E7-7A2DDBB96776}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ShiftOS.Server</RootNamespace>
|
||||
<AssemblyName>ShiftOS.Server</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DynamicLua, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DynamicLua.1.1.2.0\lib\net40-Client\DynamicLua.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nancy, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Nancy.1.4.1\lib\net40\Nancy.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nancy.Authentication.Basic, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Nancy.Authentication.Basic.1.4.1\lib\net40\Nancy.Authentication.Basic.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nancy.Hosting.Self, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Nancy.Hosting.Self.1.4.1\lib\net40\Nancy.Hosting.Self.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NetSockets">
|
||||
<HintPath>..\Libraries\NetSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebAdmin.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ShiftOS.Objects\ShiftOS.Objects.csproj">
|
||||
<Project>{a069089a-8962-4607-b2b2-4cf4a371066e}</Project>
|
||||
<Name>ShiftOS.Objects</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\NotFound.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Home.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
91
ShiftOS.Server/WebAdmin.cs
Normal file
91
ShiftOS.Server/WebAdmin.cs
Normal file
|
@ -0,0 +1,91 @@
|
|||
using Nancy;
|
||||
using Nancy.Security;
|
||||
using NetSockets;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Server
|
||||
{
|
||||
public class WebAdmin : NancyModule
|
||||
{
|
||||
private Guid thisGuid { get; set; }
|
||||
|
||||
public WebAdmin()
|
||||
{
|
||||
this.RequiresAuthentication();
|
||||
|
||||
|
||||
client = new NetObjectClient();
|
||||
|
||||
client.OnReceived += (o, a) =>
|
||||
{
|
||||
var msg = a.Data.Object as ServerMessage;
|
||||
if (msg.Name == "Welcome")
|
||||
{
|
||||
thisGuid = new Guid(msg.Contents);
|
||||
}
|
||||
};
|
||||
|
||||
client.Connect(Program.server.Address.MapToIPv4().ToString(), 13370);
|
||||
|
||||
string template = Properties.Resources.Home;
|
||||
|
||||
Get["/"] = _ => { return GetPage(template, "index.html"); };
|
||||
Get["/{page}"] = parameters =>
|
||||
{
|
||||
return GetPage(template, parameters.page);
|
||||
};
|
||||
}
|
||||
|
||||
public NetObjectClient client = new NetObjectClient();
|
||||
|
||||
public string GetPage(string template, string page)
|
||||
{
|
||||
string pageContents = File.ReadAllText("adm/" + page);
|
||||
|
||||
string page_text = template.Replace("{BODY}", pageContents);
|
||||
|
||||
page_text = page_text.Replace("{IP_ADDR}", client.RemoteHost.ToString());
|
||||
page_text = page_text.Replace("{PORT}", client.RemotePort.ToString());
|
||||
|
||||
return page_text;
|
||||
}
|
||||
|
||||
public string GrabResource(string page)
|
||||
{
|
||||
var type = this.GetType();
|
||||
foreach(var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
foreach(var attr in property.GetCustomAttributes(false))
|
||||
{
|
||||
if(attr is PageAttribute)
|
||||
{
|
||||
if(page == (attr as PageAttribute).Name)
|
||||
{
|
||||
return property.GetGetMethod().Invoke(this, null) as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Properties.Resources.NotFound;
|
||||
}
|
||||
}
|
||||
|
||||
public class PageAttribute :Attribute
|
||||
{
|
||||
public PageAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
8
ShiftOS.Server/packages.config
Normal file
8
ShiftOS.Server/packages.config
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DynamicLua" version="1.1.2.0" targetFramework="net452" />
|
||||
<package id="Nancy" version="1.4.1" targetFramework="net452" />
|
||||
<package id="Nancy.Authentication.Basic" version="1.4.1" targetFramework="net452" />
|
||||
<package id="Nancy.Hosting.Self" version="1.4.1" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
</packages>
|
14
ShiftOS.Sites/information.txt
Normal file
14
ShiftOS.Sites/information.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
The ShiftOS Site repo was moved to automate deployment.
|
||||
|
||||
However, this also comes at a toll to the rest of you developers:
|
||||
|
||||
To help protect the automated deployment system from griefing, trolling etc. from other developers - nobody will have access to this other repo.
|
||||
|
||||
There are only two people who are allowed access to the website repository:
|
||||
|
||||
- Me (NarodGaming): I own and run the website itself, i even own the hardware it runs on.
|
||||
- Michael: He owns the damn project, and is trustworthy.
|
||||
|
||||
If you believe that you should have access, just PM me on Discord on the forums, and I'll give it a think.
|
||||
|
||||
Sorry for any inconvinience caused - but I hope you understand.
|
14
ShiftOS.WinForms/App.config
Normal file
14
ShiftOS.WinForms/App.config
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
3552
ShiftOS.WinForms/Applications/Artpad.Designer.cs
generated
Normal file
3552
ShiftOS.WinForms/Applications/Artpad.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
1853
ShiftOS.WinForms/Applications/Artpad.cs
Normal file
1853
ShiftOS.WinForms/Applications/Artpad.cs
Normal file
File diff suppressed because it is too large
Load diff
138
ShiftOS.WinForms/Applications/Artpad.resx
Normal file
138
ShiftOS.WinForms/Applications/Artpad.resx
Normal file
|
@ -0,0 +1,138 @@
|
|||
<?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="tmrcodepointcooldown.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tmrshowearnedcodepoints.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>197, 17</value>
|
||||
</metadata>
|
||||
<metadata name="pullbs.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>394, 17</value>
|
||||
</metadata>
|
||||
<metadata name="pullbottom.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>478, 17</value>
|
||||
</metadata>
|
||||
<metadata name="pullside.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>591, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tmrsetupui.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>685, 17</value>
|
||||
</metadata>
|
||||
</root>
|
86
ShiftOS.WinForms/Applications/Chat.Designer.cs
generated
Normal file
86
ShiftOS.WinForms/Applications/Chat.Designer.cs
generated
Normal file
|
@ -0,0 +1,86 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class Chat
|
||||
{
|
||||
/// <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 Component 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.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtuserinput = new System.Windows.Forms.TextBox();
|
||||
this.rtbchat = new System.Windows.Forms.RichTextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.rtbchat);
|
||||
this.panel1.Controls.Add(this.txtuserinput);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(633, 318);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// txtuserinput
|
||||
//
|
||||
this.txtuserinput.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.txtuserinput.Location = new System.Drawing.Point(0, 298);
|
||||
this.txtuserinput.Name = "txtuserinput";
|
||||
this.txtuserinput.Size = new System.Drawing.Size(633, 20);
|
||||
this.txtuserinput.TabIndex = 0;
|
||||
this.txtuserinput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtuserinput_KeyDown);
|
||||
//
|
||||
// rtbchat
|
||||
//
|
||||
this.rtbchat.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.rtbchat.Location = new System.Drawing.Point(0, 0);
|
||||
this.rtbchat.Name = "rtbchat";
|
||||
this.rtbchat.Size = new System.Drawing.Size(633, 298);
|
||||
this.rtbchat.TabIndex = 1;
|
||||
this.rtbchat.Text = "";
|
||||
this.rtbchat.KeyDown += new System.Windows.Forms.KeyEventHandler(this.richTextBox1_KeyDown);
|
||||
//
|
||||
// Chat
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "Chat";
|
||||
this.Text = "Chat";
|
||||
this.Size = new System.Drawing.Size(633, 318);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.RichTextBox rtbchat;
|
||||
private System.Windows.Forms.TextBox txtuserinput;
|
||||
}
|
||||
}
|
93
ShiftOS.WinForms/Applications/Chat.cs
Normal file
93
ShiftOS.WinForms/Applications/Chat.cs
Normal file
|
@ -0,0 +1,93 @@
|
|||
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 Newtonsoft.Json;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[MultiplayerOnly]
|
||||
[Launcher("MUD Chat", true, "al_mud_chat")]
|
||||
[RequiresUpgrade("mud_fundamentals")]
|
||||
[WinOpen("chat")]
|
||||
public partial class Chat : UserControl, IShiftOSWindow
|
||||
{
|
||||
public Chat(string chatId)
|
||||
{
|
||||
InitializeComponent();
|
||||
id = chatId;
|
||||
ServerManager.MessageReceived += (msg) =>
|
||||
{
|
||||
if (msg.Name == "cbroadcast")
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
rtbchat.Text += msg.Contents + Environment.NewLine;
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private string id = "";
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
var save = SaveSystem.CurrentSave;
|
||||
ServerManager.SendMessage("chat_join", $@"{{
|
||||
id: ""{id}"",
|
||||
user: {JsonConvert.SerializeObject(save)}
|
||||
}}");
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
var save = SaveSystem.CurrentSave;
|
||||
ServerManager.SendMessage("chat_leave", $@"{{
|
||||
id: ""{id}"",
|
||||
user: {JsonConvert.SerializeObject(save)}
|
||||
}}");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
private void txtuserinput_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode == Keys.Enter)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
|
||||
var save = SaveSystem.CurrentSave;
|
||||
|
||||
ServerManager.SendMessage("chat", $@"{{
|
||||
id: ""{id}"",
|
||||
user: {JsonConvert.SerializeObject(save)},
|
||||
msg: ""{txtuserinput.Text}""
|
||||
}}");
|
||||
txtuserinput.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/Chat.resx
Normal file
120
ShiftOS.WinForms/Applications/Chat.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
37
ShiftOS.WinForms/Applications/CoherenceOverlay.Designer.cs
generated
Normal file
37
ShiftOS.WinForms/Applications/CoherenceOverlay.Designer.cs
generated
Normal file
|
@ -0,0 +1,37 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class CoherenceOverlay
|
||||
{
|
||||
/// <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 Component 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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
99
ShiftOS.WinForms/Applications/CoherenceOverlay.cs
Normal file
99
ShiftOS.WinForms/Applications/CoherenceOverlay.cs
Normal file
|
@ -0,0 +1,99 @@
|
|||
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 ShiftOS.Engine;
|
||||
using System.Threading;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
public partial class CoherenceOverlay : UserControl, IShiftOSWindow
|
||||
{
|
||||
public CoherenceOverlay(IntPtr handle, CoherenceCommands.RECT rect)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Load += (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
int left = this.ParentForm.Left;
|
||||
int top = this.ParentForm.Top;
|
||||
int oldwidth = this.ParentForm.Width;
|
||||
int oldheight = this.ParentForm.Height;
|
||||
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
while (CoherenceCommands.GetWindowRect(handle, ref rect))
|
||||
{
|
||||
|
||||
if (left != rect.Left - SkinEngine.LoadedSkin.LeftBorderWidth)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.ParentForm.Left = rect.Left - SkinEngine.LoadedSkin.LeftBorderWidth;
|
||||
left = rect.Left - SkinEngine.LoadedSkin.LeftBorderWidth;
|
||||
}));
|
||||
}
|
||||
if (top != rect.Top - SkinEngine.LoadedSkin.TitlebarHeight)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
|
||||
this.ParentForm.Top = rect.Top - SkinEngine.LoadedSkin.TitlebarHeight;
|
||||
top = rect.Top - SkinEngine.LoadedSkin.TitlebarHeight;
|
||||
}));
|
||||
}
|
||||
int width = (rect.Right - rect.Left) + 1;
|
||||
int height = (rect.Bottom - rect.Top) + 1;
|
||||
|
||||
if (oldheight != SkinEngine.LoadedSkin.TitlebarHeight + height + SkinEngine.LoadedSkin.BottomBorderWidth)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.ParentForm.Height = SkinEngine.LoadedSkin.TitlebarHeight + height + SkinEngine.LoadedSkin.BottomBorderWidth;
|
||||
oldheight = SkinEngine.LoadedSkin.TitlebarHeight + height + SkinEngine.LoadedSkin.BottomBorderWidth;
|
||||
}));
|
||||
}
|
||||
if (oldwidth != SkinEngine.LoadedSkin.LeftBorderWidth + width + SkinEngine.LoadedSkin.RightBorderWidth)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.ParentForm.Width = SkinEngine.LoadedSkin.LeftBorderWidth + width + SkinEngine.LoadedSkin.RightBorderWidth;
|
||||
oldwidth = SkinEngine.LoadedSkin.LeftBorderWidth + width + SkinEngine.LoadedSkin.RightBorderWidth;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
3570
ShiftOS.WinForms/Applications/ColorPicker.Designer.cs
generated
Normal file
3570
ShiftOS.WinForms/Applications/ColorPicker.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
2358
ShiftOS.WinForms/Applications/ColorPicker.cs
Normal file
2358
ShiftOS.WinForms/Applications/ColorPicker.cs
Normal file
File diff suppressed because it is too large
Load diff
120
ShiftOS.WinForms/Applications/ColorPicker.resx
Normal file
120
ShiftOS.WinForms/Applications/ColorPicker.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
38
ShiftOS.WinForms/Applications/Dialog.Designer.cs
generated
Normal file
38
ShiftOS.WinForms/Applications/Dialog.Designer.cs
generated
Normal file
|
@ -0,0 +1,38 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class Dialog
|
||||
{
|
||||
/// <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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Text = "Dialog";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
38
ShiftOS.WinForms/Applications/Dialog.cs
Normal file
38
ShiftOS.WinForms/Applications/Dialog.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
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 ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
public partial class Dialog : UserControl, IShiftOSWindow
|
||||
{
|
||||
public Dialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
147
ShiftOS.WinForms/Applications/FileDialog.Designer.cs
generated
Normal file
147
ShiftOS.WinForms/Applications/FileDialog.Designer.cs
generated
Normal file
|
@ -0,0 +1,147 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class FileDialog
|
||||
{
|
||||
/// <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.lbcurrentfolder = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.pnlfiletype = new System.Windows.Forms.Panel();
|
||||
this.btnok = new System.Windows.Forms.Button();
|
||||
this.cbfiletypes = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtfilename = new System.Windows.Forms.TextBox();
|
||||
this.lvitems = new System.Windows.Forms.ListView();
|
||||
this.panel1.SuspendLayout();
|
||||
this.pnlfiletype.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbcurrentfolder
|
||||
//
|
||||
this.lbcurrentfolder.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.lbcurrentfolder.Location = new System.Drawing.Point(0, 356);
|
||||
this.lbcurrentfolder.Name = "lbcurrentfolder";
|
||||
this.lbcurrentfolder.Size = new System.Drawing.Size(634, 13);
|
||||
this.lbcurrentfolder.TabIndex = 1;
|
||||
this.lbcurrentfolder.Text = "label1";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.pnlfiletype);
|
||||
this.panel1.Controls.Add(this.lvitems);
|
||||
this.panel1.Controls.Add(this.lbcurrentfolder);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(634, 369);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// pnlfiletype
|
||||
//
|
||||
this.pnlfiletype.Controls.Add(this.btnok);
|
||||
this.pnlfiletype.Controls.Add(this.cbfiletypes);
|
||||
this.pnlfiletype.Controls.Add(this.label1);
|
||||
this.pnlfiletype.Controls.Add(this.txtfilename);
|
||||
this.pnlfiletype.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pnlfiletype.Location = new System.Drawing.Point(0, 330);
|
||||
this.pnlfiletype.Name = "pnlfiletype";
|
||||
this.pnlfiletype.Size = new System.Drawing.Size(634, 26);
|
||||
this.pnlfiletype.TabIndex = 2;
|
||||
//
|
||||
// btnok
|
||||
//
|
||||
this.btnok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnok.Location = new System.Drawing.Point(551, 2);
|
||||
this.btnok.Name = "btnok";
|
||||
this.btnok.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnok.TabIndex = 3;
|
||||
this.btnok.Text = "Open";
|
||||
this.btnok.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbfiletypes
|
||||
//
|
||||
this.cbfiletypes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbfiletypes.FormattingEnabled = true;
|
||||
this.cbfiletypes.Location = new System.Drawing.Point(424, 2);
|
||||
this.cbfiletypes.Name = "cbfiletypes";
|
||||
this.cbfiletypes.Size = new System.Drawing.Size(121, 21);
|
||||
this.cbfiletypes.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(38, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Name:";
|
||||
//
|
||||
// txtfilename
|
||||
//
|
||||
this.txtfilename.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtfilename.Location = new System.Drawing.Point(47, 3);
|
||||
this.txtfilename.Name = "txtfilename";
|
||||
this.txtfilename.Size = new System.Drawing.Size(371, 20);
|
||||
this.txtfilename.TabIndex = 0;
|
||||
//
|
||||
// lvitems
|
||||
//
|
||||
this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvitems.Location = new System.Drawing.Point(0, 0);
|
||||
this.lvitems.Name = "lvitems";
|
||||
this.lvitems.Size = new System.Drawing.Size(634, 356);
|
||||
this.lvitems.TabIndex = 0;
|
||||
this.lvitems.UseCompatibleStateImageBehavior = false;
|
||||
//
|
||||
// FileDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(634, 369);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "FileDialog";
|
||||
this.Text = "File Dialog";
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.pnlfiletype.ResumeLayout(false);
|
||||
this.pnlfiletype.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lbcurrentfolder;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.ListView lvitems;
|
||||
private System.Windows.Forms.Panel pnlfiletype;
|
||||
private System.Windows.Forms.Button btnok;
|
||||
private System.Windows.Forms.ComboBox cbfiletypes;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtfilename;
|
||||
}
|
||||
}
|
256
ShiftOS.WinForms/Applications/FileDialog.cs
Normal file
256
ShiftOS.WinForms/Applications/FileDialog.cs
Normal file
|
@ -0,0 +1,256 @@
|
|||
using ShiftOS.Objects.ShiftFS;
|
||||
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 static ShiftOS.Objects.ShiftFS.Utils;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public partial class FileDialog : UserControl, IShiftOSWindow
|
||||
{
|
||||
public FileDialog(string[] filetypes, FileOpenerStyle style, Action<string> _callback)
|
||||
{
|
||||
callback = _callback;
|
||||
InitializeComponent();
|
||||
foreach(var itm in filetypes)
|
||||
{
|
||||
cbfiletypes.Items.Add(itm);
|
||||
}
|
||||
cbfiletypes.SelectedIndex = 0;
|
||||
cbfiletypes.SelectedIndexChanged += (o, a) => { ResetList(); };
|
||||
this.lvitems.SelectedIndexChanged += (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var itm = lvitems.SelectedItems[0];
|
||||
if (FileExists(currentdir + "/" + itm.Text))
|
||||
{
|
||||
txtfilename.Text = itm.Text;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
};
|
||||
btnok.Click += (o, a) =>
|
||||
{
|
||||
string fname = "";
|
||||
fname = (!string.IsNullOrWhiteSpace(txtfilename.Text)) ? txtfilename.Text : "";
|
||||
fname = (!fname.EndsWith(cbfiletypes.SelectedItem.ToString())) ? fname + cbfiletypes.SelectedItem.ToString() : fname;
|
||||
fname = (fname == cbfiletypes.SelectedItem.ToString()) ? "" : fname;
|
||||
|
||||
switch (style)
|
||||
{
|
||||
|
||||
case FileOpenerStyle.Open:
|
||||
|
||||
|
||||
if(FileExists(currentdir + "/" + fname))
|
||||
{
|
||||
callback?.Invoke(currentdir + "/" + fname);
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}");
|
||||
}
|
||||
break;
|
||||
case FileOpenerStyle.Save:
|
||||
if (!string.IsNullOrWhiteSpace(fname))
|
||||
{
|
||||
callback?.Invoke(currentdir + "/" + fname);
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Infobox.Show("{ENTER_FILENAME}", "{ENTER_FILENAME_EXP}");
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
btnok.Text = style.ToString();
|
||||
this.Text = style.ToString() + " File";
|
||||
this.lvitems.DoubleClick += new EventHandler(this.lvitems_DoubleClick);
|
||||
this.Load += (o, a) =>
|
||||
{
|
||||
ChangeDirectory(Paths.GetPath("root"));
|
||||
};
|
||||
}
|
||||
|
||||
private void lvitems_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (lvitems.SelectedItems.Count <= 0)
|
||||
return;
|
||||
|
||||
var item = lvitems.SelectedItems[0];
|
||||
var path = item.Tag as string;
|
||||
if (currentdir == "__system")
|
||||
{
|
||||
ChangeDirectory(path);
|
||||
}
|
||||
else if (DirectoryExists(currentdir + "/" + path))
|
||||
{
|
||||
ChangeDirectory(currentdir + "/" + path);
|
||||
}
|
||||
else if (FileExists(currentdir + "/" + path))
|
||||
{
|
||||
callback?.Invoke(currentdir + "/" + txtfilename.Text);
|
||||
this.Close();
|
||||
}
|
||||
else if (path == "__..")
|
||||
{
|
||||
ChangeToParent();
|
||||
}
|
||||
}
|
||||
|
||||
Action<string> callback;
|
||||
|
||||
string currentdrive = "0:";
|
||||
|
||||
public void ChangeToParent()
|
||||
{
|
||||
if (currentdir == currentdrive)
|
||||
{
|
||||
ChangeDirectory("__system");
|
||||
}
|
||||
|
||||
ChangeDirectory(GetParent(currentdir));
|
||||
}
|
||||
|
||||
public string GetParent(string path)
|
||||
{
|
||||
string[] pathlist = path.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (pathlist.Length > 1)
|
||||
{
|
||||
if (path.EndsWith("/"))
|
||||
{
|
||||
path = path.Remove(path.Length - 1, 1);
|
||||
}
|
||||
path = path.Remove(path.LastIndexOf('/'), path.Length - path.LastIndexOf('/'));
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "__system";
|
||||
}
|
||||
}
|
||||
|
||||
private string currentdir = "";
|
||||
|
||||
public void ChangeDirectory(string path)
|
||||
{
|
||||
currentdir = path;
|
||||
lbcurrentfolder.Text = currentdir;
|
||||
ResetList();
|
||||
}
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
if (lvitems.LargeImageList == null)
|
||||
{
|
||||
lvitems.LargeImageList = new ImageList();
|
||||
lvitems.LargeImageList.TransparentColor = SkinEngine.LoadedSkin.ControlColor;
|
||||
lvitems.LargeImageList.ImageSize = new Size(42, 42);
|
||||
FileSkimmer.GetAllTypes(lvitems.LargeImageList);
|
||||
}
|
||||
|
||||
|
||||
lvitems.Items.Clear();
|
||||
|
||||
if (currentdir == "__system")
|
||||
{
|
||||
//List all drives
|
||||
foreach (var dir in Mounts)
|
||||
{
|
||||
var item = FileSkimmer.ConstructItemAsMount(dir);
|
||||
item.ImageKey = "Mount";
|
||||
lvitems.Items.Add(item);
|
||||
}
|
||||
}
|
||||
else if (DirectoryExists(currentdir))
|
||||
{
|
||||
var up = new ListViewItem();
|
||||
up.ImageKey = "UpOne";
|
||||
up.Text = "Up one";
|
||||
up.Tag = "__..";
|
||||
lvitems.Items.Add(up);
|
||||
|
||||
|
||||
foreach (var dir in GetDirectories(currentdir))
|
||||
{
|
||||
var item = FileSkimmer.ConstructItem(GetDirectoryInfo(dir));
|
||||
item.ImageKey = "Directory";
|
||||
lvitems.Items.Add(item);
|
||||
}
|
||||
|
||||
foreach (var dir in GetFiles(currentdir))
|
||||
{
|
||||
if (dir.EndsWith(cbfiletypes.SelectedItem as string))
|
||||
{
|
||||
var item = FileSkimmer.ConstructItem(GetFileInfo(dir));
|
||||
item.ImageKey = FileSkimmerBackend.GetFileType(dir).ToString();
|
||||
lvitems.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use the relevant static method within File Skimmer instead.")]
|
||||
public static ListViewItem ConstructItemAsMount(Directory dir)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.Text = dir.Name + "(" + Mounts.IndexOf(dir).ToString() + ":/)";
|
||||
item.Tag = Mounts.IndexOf(dir).ToString() + ":";
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
[Obsolete("Use the relevant static method within File Skimmer instead.")]
|
||||
public static ListViewItem ConstructItem(Directory dir)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.Text = dir.Name;
|
||||
item.Tag = item.Text;
|
||||
return item;
|
||||
}
|
||||
|
||||
[Obsolete("Use the relevant static method within File Skimmer instead.")]
|
||||
public static ListViewItem ConstructItem(File dir)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.Text = dir.Name;
|
||||
item.Tag = item.Text;
|
||||
return item;
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
120
ShiftOS.WinForms/Applications/FileDialog.resx
Normal file
120
ShiftOS.WinForms/Applications/FileDialog.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
86
ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
generated
Normal file
86
ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
generated
Normal file
|
@ -0,0 +1,86 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class FileSkimmer
|
||||
{
|
||||
/// <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.lvitems = new System.Windows.Forms.ListView();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.lbcurrentfolder = new System.Windows.Forms.Label();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lvitems
|
||||
//
|
||||
this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvitems.Location = new System.Drawing.Point(0, 0);
|
||||
this.lvitems.Name = "lvitems";
|
||||
this.lvitems.Size = new System.Drawing.Size(634, 356);
|
||||
this.lvitems.TabIndex = 0;
|
||||
this.lvitems.UseCompatibleStateImageBehavior = false;
|
||||
this.lvitems.DoubleClick += new System.EventHandler(this.lvitems_DoubleClick);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.lvitems);
|
||||
this.panel1.Controls.Add(this.lbcurrentfolder);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(634, 369);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// lbcurrentfolder
|
||||
//
|
||||
this.lbcurrentfolder.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.lbcurrentfolder.Location = new System.Drawing.Point(0, 356);
|
||||
this.lbcurrentfolder.Name = "lbcurrentfolder";
|
||||
this.lbcurrentfolder.Size = new System.Drawing.Size(634, 13);
|
||||
this.lbcurrentfolder.TabIndex = 1;
|
||||
this.lbcurrentfolder.Text = "label1";
|
||||
//
|
||||
// FileSkimmer
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(634, 369);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "FileSkimmer";
|
||||
this.Text = "File Skimmer";
|
||||
this.Load += new System.EventHandler(this.FileSkimmer_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView lvitems;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label lbcurrentfolder;
|
||||
}
|
||||
}
|
238
ShiftOS.WinForms/Applications/FileSkimmer.cs
Normal file
238
ShiftOS.WinForms/Applications/FileSkimmer.cs
Normal file
|
@ -0,0 +1,238 @@
|
|||
using ShiftOS.Objects.ShiftFS;
|
||||
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 static ShiftOS.Objects.ShiftFS.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("File Skimmer", true, "al_file_skimmer")]
|
||||
[RequiresUpgrade("file_skimmer")]
|
||||
[WinOpen("file_skimmer")]
|
||||
public partial class FileSkimmer : UserControl, IShiftOSWindow
|
||||
{
|
||||
public FileSkimmer()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Load += (o, a) =>
|
||||
{
|
||||
ChangeDirectory(Paths.GetPath("root"));
|
||||
};
|
||||
}
|
||||
|
||||
private void lvitems_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (lvitems.SelectedItems.Count <= 0)
|
||||
return;
|
||||
|
||||
var item = lvitems.SelectedItems[0];
|
||||
var path = item.Tag as string;
|
||||
|
||||
if(currentdir == "__system")
|
||||
{
|
||||
ChangeDirectory(path);
|
||||
}
|
||||
else if(DirectoryExists(currentdir + "/" + path))
|
||||
{
|
||||
ChangeDirectory(currentdir + "/" + path);
|
||||
}
|
||||
else if(FileExists(currentdir + "/" + path))
|
||||
{
|
||||
FileSkimmerBackend.OpenFile(currentdir + "/" + path);
|
||||
}
|
||||
else if(path == "__..")
|
||||
{
|
||||
ChangeToParent();
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This just forwards over to FileSkimmerBackend.OpenFile().")]
|
||||
public void Open(string path)
|
||||
{
|
||||
FileSkimmerBackend.OpenFile(path);
|
||||
}
|
||||
|
||||
[Obsolete("Forwarded to FileSkimmerBackend.GetFileType().")]
|
||||
public static FileType GetFileType(string path)
|
||||
{
|
||||
return FileSkimmerBackend.GetFileType(path);
|
||||
}
|
||||
|
||||
string currentdrive = "0:";
|
||||
|
||||
public void ChangeToParent()
|
||||
{
|
||||
if(currentdir == currentdrive)
|
||||
{
|
||||
ChangeDirectory("__system");
|
||||
}
|
||||
|
||||
ChangeDirectory(GetParent(currentdir));
|
||||
}
|
||||
|
||||
public string GetParent(string path)
|
||||
{
|
||||
string[] pathlist = path.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathlist.Length > 1)
|
||||
{
|
||||
if(path.EndsWith("/"))
|
||||
{
|
||||
path = path.Remove(path.Length - 1, 1);
|
||||
}
|
||||
path = path.Remove(path.LastIndexOf('/'), path.Length - path.LastIndexOf('/'));
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "__system";
|
||||
}
|
||||
}
|
||||
|
||||
private string currentdir = "";
|
||||
|
||||
public void ChangeDirectory(string path)
|
||||
{
|
||||
currentdir = path;
|
||||
lbcurrentfolder.Text = currentdir;
|
||||
ResetList();
|
||||
}
|
||||
|
||||
|
||||
public static void GetAllTypes(ImageList list)
|
||||
{
|
||||
list.Images.Add("Directory", Properties.Resources.fileicon0);
|
||||
list.Images.Add("UpOne", Properties.Resources.fileicon5);
|
||||
list.Images.Add("Mount", Properties.Resources.FloppyDriveIcon);
|
||||
|
||||
foreach (FileType value in Enum.GetValues(typeof(FileType)))
|
||||
{
|
||||
list.Images.Add(value.ToString(), GetImage(value));
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
if(lvitems.LargeImageList == null)
|
||||
{
|
||||
lvitems.LargeImageList = new ImageList();
|
||||
lvitems.LargeImageList.TransparentColor = SkinEngine.LoadedSkin.ControlColor;
|
||||
lvitems.LargeImageList.ImageSize = new Size(42, 42);
|
||||
GetAllTypes(lvitems.LargeImageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
lvitems.Items.Clear();
|
||||
if (currentdir == "__system")
|
||||
{
|
||||
//List all drives
|
||||
foreach (var dir in Mounts)
|
||||
{
|
||||
var item = ConstructItemAsMount(dir);
|
||||
item.ImageKey = "Mount";
|
||||
lvitems.Items.Add(item);
|
||||
}
|
||||
}
|
||||
else if (DirectoryExists(currentdir))
|
||||
{
|
||||
var up = new ListViewItem();
|
||||
up.Text = "Up one";
|
||||
up.ImageKey = "UpOne";
|
||||
up.Tag = "__..";
|
||||
lvitems.Items.Add(up);
|
||||
|
||||
|
||||
foreach(var dir in GetDirectories(currentdir))
|
||||
{
|
||||
var item = ConstructItem(GetDirectoryInfo(dir));
|
||||
item.ImageKey = "Directory";
|
||||
lvitems.Items.Add(item);
|
||||
}
|
||||
|
||||
foreach (var dir in GetFiles(currentdir))
|
||||
{
|
||||
var item = ConstructItem(GetFileInfo(dir));
|
||||
item.ImageKey = FileSkimmerBackend.GetFileType(dir).ToString();
|
||||
lvitems.Items.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ListViewItem ConstructItemAsMount(Directory dir)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.Text = dir.Name + "(" + Mounts.IndexOf(dir).ToString() + ":/)";
|
||||
item.Tag = Mounts.IndexOf(dir).ToString() + ":";
|
||||
return item;
|
||||
}
|
||||
|
||||
public static ListViewItem ConstructItem(Directory dir)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.Text = dir.Name;
|
||||
item.Tag = item.Text;
|
||||
return item;
|
||||
}
|
||||
public static ListViewItem ConstructItem(File dir)
|
||||
{
|
||||
var item = new ListViewItem();
|
||||
item.Text = dir.Name;
|
||||
item.ImageKey = "Directory";
|
||||
item.Tag = item.Text;
|
||||
return item;
|
||||
}
|
||||
|
||||
public static Image GetImage(FileType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case FileType.Executable:
|
||||
case FileType.Lua:
|
||||
case FileType.Python:
|
||||
return Properties.Resources.fileiconsaa;
|
||||
case FileType.Image:
|
||||
return Properties.Resources.fileicon3;
|
||||
case FileType.Skin:
|
||||
return Properties.Resources.fileicon10;
|
||||
case FileType.TextFile:
|
||||
return Properties.Resources.fileicon2;
|
||||
default:
|
||||
return Properties.Resources.fileicon1;
|
||||
}
|
||||
}
|
||||
|
||||
private void FileSkimmer_Load(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
120
ShiftOS.WinForms/Applications/FileSkimmer.resx
Normal file
120
ShiftOS.WinForms/Applications/FileSkimmer.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
257
ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs
generated
Normal file
257
ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs
generated
Normal file
|
@ -0,0 +1,257 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class GraphicPicker
|
||||
{
|
||||
/// <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);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pgcontents = new System.Windows.Forms.Panel();
|
||||
this.btncancel = new System.Windows.Forms.Button();
|
||||
this.btnreset = new System.Windows.Forms.Button();
|
||||
this.btnapply = new System.Windows.Forms.Button();
|
||||
this.Label2 = new System.Windows.Forms.Label();
|
||||
this.btnidlebrowse = new System.Windows.Forms.Button();
|
||||
this.txtidlefile = new System.Windows.Forms.TextBox();
|
||||
this.picidle = new System.Windows.Forms.PictureBox();
|
||||
this.btnzoom = new System.Windows.Forms.Button();
|
||||
this.btnstretch = new System.Windows.Forms.Button();
|
||||
this.btncentre = new System.Windows.Forms.Button();
|
||||
this.btntile = new System.Windows.Forms.Button();
|
||||
this.pnlgraphicholder = new System.Windows.Forms.Panel();
|
||||
this.picgraphic = new System.Windows.Forms.PictureBox();
|
||||
this.lblobjecttoskin = new System.Windows.Forms.Label();
|
||||
this.pgcontents.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picidle)).BeginInit();
|
||||
this.pnlgraphicholder.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picgraphic)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pgcontents
|
||||
//
|
||||
this.pgcontents.BackColor = System.Drawing.Color.White;
|
||||
this.pgcontents.Controls.Add(this.btncancel);
|
||||
this.pgcontents.Controls.Add(this.btnreset);
|
||||
this.pgcontents.Controls.Add(this.btnapply);
|
||||
this.pgcontents.Controls.Add(this.Label2);
|
||||
this.pgcontents.Controls.Add(this.btnidlebrowse);
|
||||
this.pgcontents.Controls.Add(this.txtidlefile);
|
||||
this.pgcontents.Controls.Add(this.picidle);
|
||||
this.pgcontents.Controls.Add(this.btnzoom);
|
||||
this.pgcontents.Controls.Add(this.btnstretch);
|
||||
this.pgcontents.Controls.Add(this.btncentre);
|
||||
this.pgcontents.Controls.Add(this.btntile);
|
||||
this.pgcontents.Controls.Add(this.pnlgraphicholder);
|
||||
this.pgcontents.Controls.Add(this.lblobjecttoskin);
|
||||
this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pgcontents.Location = new System.Drawing.Point(0, 0);
|
||||
this.pgcontents.Name = "pgcontents";
|
||||
this.pgcontents.Size = new System.Drawing.Size(390, 383);
|
||||
this.pgcontents.TabIndex = 20;
|
||||
//
|
||||
// btncancel
|
||||
//
|
||||
this.btncancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
||||
this.btncancel.Location = new System.Drawing.Point(21, 335);
|
||||
this.btncancel.Name = "btncancel";
|
||||
this.btncancel.Size = new System.Drawing.Size(109, 32);
|
||||
this.btncancel.TabIndex = 23;
|
||||
this.btncancel.Text = "Cancel";
|
||||
this.btncancel.UseVisualStyleBackColor = true;
|
||||
this.btncancel.Click += new System.EventHandler(this.btncancel_Click);
|
||||
//
|
||||
// btnreset
|
||||
//
|
||||
this.btnreset.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
||||
this.btnreset.Location = new System.Drawing.Point(136, 335);
|
||||
this.btnreset.Name = "btnreset";
|
||||
this.btnreset.Size = new System.Drawing.Size(109, 32);
|
||||
this.btnreset.TabIndex = 22;
|
||||
this.btnreset.Text = "Reset";
|
||||
this.btnreset.UseVisualStyleBackColor = true;
|
||||
this.btnreset.Click += new System.EventHandler(this.btnreset_Click);
|
||||
//
|
||||
// btnapply
|
||||
//
|
||||
this.btnapply.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
||||
this.btnapply.Location = new System.Drawing.Point(251, 335);
|
||||
this.btnapply.Name = "btnapply";
|
||||
this.btnapply.Size = new System.Drawing.Size(118, 32);
|
||||
this.btnapply.TabIndex = 21;
|
||||
this.btnapply.Text = "Apply";
|
||||
this.btnapply.UseVisualStyleBackColor = true;
|
||||
this.btnapply.Click += new System.EventHandler(this.btnapply_Click);
|
||||
//
|
||||
// Label2
|
||||
//
|
||||
this.Label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.Label2.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label2.Location = new System.Drawing.Point(125, 260);
|
||||
this.Label2.Name = "Label2";
|
||||
this.Label2.Size = new System.Drawing.Size(163, 28);
|
||||
this.Label2.TabIndex = 12;
|
||||
this.Label2.Text = "Idle";
|
||||
this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btnidlebrowse
|
||||
//
|
||||
this.btnidlebrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnidlebrowse.Location = new System.Drawing.Point(295, 260);
|
||||
this.btnidlebrowse.Name = "btnidlebrowse";
|
||||
this.btnidlebrowse.Size = new System.Drawing.Size(73, 60);
|
||||
this.btnidlebrowse.TabIndex = 10;
|
||||
this.btnidlebrowse.Text = "Browse";
|
||||
this.btnidlebrowse.UseVisualStyleBackColor = true;
|
||||
this.btnidlebrowse.Click += new System.EventHandler(this.btnidlebrowse_Click);
|
||||
//
|
||||
// txtidlefile
|
||||
//
|
||||
this.txtidlefile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtidlefile.BackColor = System.Drawing.Color.White;
|
||||
this.txtidlefile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtidlefile.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtidlefile.Location = new System.Drawing.Point(125, 291);
|
||||
this.txtidlefile.Multiline = true;
|
||||
this.txtidlefile.Name = "txtidlefile";
|
||||
this.txtidlefile.Size = new System.Drawing.Size(163, 29);
|
||||
this.txtidlefile.TabIndex = 9;
|
||||
this.txtidlefile.Text = "None";
|
||||
this.txtidlefile.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// picidle
|
||||
//
|
||||
this.picidle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.picidle.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.picidle.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.picidle.Location = new System.Drawing.Point(19, 260);
|
||||
this.picidle.Name = "picidle";
|
||||
this.picidle.Size = new System.Drawing.Size(100, 60);
|
||||
this.picidle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.picidle.TabIndex = 8;
|
||||
this.picidle.TabStop = false;
|
||||
//
|
||||
// btnzoom
|
||||
//
|
||||
this.btnzoom.FlatAppearance.BorderColor = System.Drawing.Color.Black;
|
||||
this.btnzoom.FlatAppearance.BorderSize = 0;
|
||||
this.btnzoom.Location = new System.Drawing.Point(286, 144);
|
||||
this.btnzoom.Name = "btnzoom";
|
||||
this.btnzoom.Size = new System.Drawing.Size(82, 65);
|
||||
this.btnzoom.TabIndex = 7;
|
||||
this.btnzoom.Text = "Zoom";
|
||||
this.btnzoom.UseVisualStyleBackColor = true;
|
||||
this.btnzoom.Click += new System.EventHandler(this.btnzoom_Click);
|
||||
//
|
||||
// btnstretch
|
||||
//
|
||||
this.btnstretch.FlatAppearance.BorderColor = System.Drawing.Color.Black;
|
||||
this.btnstretch.FlatAppearance.BorderSize = 0;
|
||||
this.btnstretch.Location = new System.Drawing.Point(197, 144);
|
||||
this.btnstretch.Name = "btnstretch";
|
||||
this.btnstretch.Size = new System.Drawing.Size(82, 65);
|
||||
this.btnstretch.TabIndex = 6;
|
||||
this.btnstretch.Text = "Stretch";
|
||||
this.btnstretch.UseVisualStyleBackColor = true;
|
||||
this.btnstretch.Click += new System.EventHandler(this.btnstretch_Click);
|
||||
//
|
||||
// btncentre
|
||||
//
|
||||
this.btncentre.FlatAppearance.BorderColor = System.Drawing.Color.Black;
|
||||
this.btncentre.FlatAppearance.BorderSize = 0;
|
||||
this.btncentre.Location = new System.Drawing.Point(108, 144);
|
||||
this.btncentre.Name = "btncentre";
|
||||
this.btncentre.Size = new System.Drawing.Size(82, 65);
|
||||
this.btncentre.TabIndex = 5;
|
||||
this.btncentre.Text = "Center";
|
||||
this.btncentre.UseVisualStyleBackColor = true;
|
||||
this.btncentre.Click += new System.EventHandler(this.btncentre_Click);
|
||||
//
|
||||
// btntile
|
||||
//
|
||||
this.btntile.FlatAppearance.BorderColor = System.Drawing.Color.Black;
|
||||
this.btntile.FlatAppearance.BorderSize = 0;
|
||||
this.btntile.Location = new System.Drawing.Point(19, 144);
|
||||
this.btntile.Name = "btntile";
|
||||
this.btntile.Size = new System.Drawing.Size(82, 65);
|
||||
this.btntile.TabIndex = 4;
|
||||
this.btntile.Text = "Tile";
|
||||
this.btntile.UseVisualStyleBackColor = true;
|
||||
this.btntile.Click += new System.EventHandler(this.btntile_Click);
|
||||
//
|
||||
// pnlgraphicholder
|
||||
//
|
||||
this.pnlgraphicholder.Controls.Add(this.picgraphic);
|
||||
this.pnlgraphicholder.Location = new System.Drawing.Point(19, 38);
|
||||
this.pnlgraphicholder.Name = "pnlgraphicholder";
|
||||
this.pnlgraphicholder.Size = new System.Drawing.Size(350, 100);
|
||||
this.pnlgraphicholder.TabIndex = 3;
|
||||
//
|
||||
// picgraphic
|
||||
//
|
||||
this.picgraphic.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.picgraphic.Location = new System.Drawing.Point(0, 0);
|
||||
this.picgraphic.Name = "picgraphic";
|
||||
this.picgraphic.Size = new System.Drawing.Size(350, 100);
|
||||
this.picgraphic.TabIndex = 0;
|
||||
this.picgraphic.TabStop = false;
|
||||
//
|
||||
// lblobjecttoskin
|
||||
//
|
||||
this.lblobjecttoskin.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblobjecttoskin.Location = new System.Drawing.Point(19, 9);
|
||||
this.lblobjecttoskin.Name = "lblobjecttoskin";
|
||||
this.lblobjecttoskin.Size = new System.Drawing.Size(350, 23);
|
||||
this.lblobjecttoskin.TabIndex = 2;
|
||||
this.lblobjecttoskin.Text = "Close Button";
|
||||
this.lblobjecttoskin.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// GraphicPicker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(390, 383);
|
||||
this.Controls.Add(this.pgcontents);
|
||||
this.Name = "GraphicPicker";
|
||||
this.Text = "Graphic Picker";
|
||||
this.Load += new System.EventHandler(this.Graphic_Picker_Load);
|
||||
this.pgcontents.ResumeLayout(false);
|
||||
this.pgcontents.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picidle)).EndInit();
|
||||
this.pnlgraphicholder.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.picgraphic)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
internal System.Windows.Forms.Panel pgcontents;
|
||||
internal System.Windows.Forms.Button btncancel;
|
||||
internal System.Windows.Forms.Button btnreset;
|
||||
internal System.Windows.Forms.Button btnapply;
|
||||
internal System.Windows.Forms.Label Label2;
|
||||
internal System.Windows.Forms.Button btnidlebrowse;
|
||||
internal System.Windows.Forms.TextBox txtidlefile;
|
||||
internal System.Windows.Forms.PictureBox picidle;
|
||||
internal System.Windows.Forms.Button btnzoom;
|
||||
internal System.Windows.Forms.Button btnstretch;
|
||||
internal System.Windows.Forms.Button btncentre;
|
||||
internal System.Windows.Forms.Button btntile;
|
||||
internal System.Windows.Forms.Panel pnlgraphicholder;
|
||||
internal System.Windows.Forms.PictureBox picgraphic;
|
||||
internal System.Windows.Forms.Label lblobjecttoskin;
|
||||
}
|
||||
}
|
116
ShiftOS.WinForms/Applications/GraphicPicker.cs
Normal file
116
ShiftOS.WinForms/Applications/GraphicPicker.cs
Normal file
|
@ -0,0 +1,116 @@
|
|||
using ShiftOS.Objects.ShiftFS;
|
||||
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 ShiftOS.Engine;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
public partial class GraphicPicker : UserControl, IShiftOSWindow
|
||||
{
|
||||
public GraphicPicker(Image old, string name, ImageLayout layout, Action<byte[], Image, ImageLayout> cb)
|
||||
{
|
||||
InitializeComponent();
|
||||
SelectedLayout = layout;
|
||||
Callback = cb;
|
||||
lblobjecttoskin.Text = name;
|
||||
|
||||
}
|
||||
|
||||
public Action<byte[], Image, ImageLayout> Callback;
|
||||
|
||||
public ImageLayout SelectedLayout { get; private set; }
|
||||
|
||||
public void btncancel_Click(object s, EventArgs a)
|
||||
{
|
||||
this.Close(); //don't invoke callback
|
||||
}
|
||||
|
||||
public void btnreset_Click(object s, EventArgs a)
|
||||
{
|
||||
this.ImageAsBinary = null;
|
||||
this.Image = null;
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void btnapply_Click(object s, EventArgs a)
|
||||
{
|
||||
Callback?.Invoke(this.ImageAsBinary, this.Image, this.SelectedLayout);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public byte[] ImageAsBinary { get; set; }
|
||||
public Image Image { get; set; }
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
picidle.BackgroundImage = Image;
|
||||
picidle.BackgroundImageLayout = SelectedLayout;
|
||||
}
|
||||
|
||||
public void btnidlebrowse_Click(object s, EventArgs a)
|
||||
{
|
||||
AppearanceManager.SetupDialog(new FileDialog(new[] { ".png", ".jpg", ".bmp", ".pic" }, FileOpenerStyle.Open, new Action<string>((file) =>
|
||||
{
|
||||
ImageAsBinary = Utils.ReadAllBytes(file);
|
||||
System.IO.File.WriteAllBytes("temp_bin.bmp", ImageAsBinary);
|
||||
Image = SkinEngine.ImageFromBinary(ImageAsBinary);
|
||||
Image.Save("temp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
|
||||
Setup();
|
||||
})));
|
||||
}
|
||||
|
||||
public void btnzoom_Click(object s, EventArgs a)
|
||||
{
|
||||
this.SelectedLayout = ImageLayout.Zoom;
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void btncentre_Click(object s, EventArgs a)
|
||||
{
|
||||
this.SelectedLayout = ImageLayout.Center;
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void btnstretch_Click(object s, EventArgs a)
|
||||
{
|
||||
this.SelectedLayout = ImageLayout.Stretch;
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void btntile_Click(object s, EventArgs a)
|
||||
{
|
||||
this.SelectedLayout = ImageLayout.Tile;
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void Graphic_Picker_Load(object s, EventArgs a)
|
||||
{
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/GraphicPicker.resx
Normal file
120
ShiftOS.WinForms/Applications/GraphicPicker.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
213
ShiftOS.WinForms/Applications/MUDAuthenticator.Designer.cs
generated
Normal file
213
ShiftOS.WinForms/Applications/MUDAuthenticator.Designer.cs
generated
Normal file
|
@ -0,0 +1,213 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class MUDAuthenticator
|
||||
{
|
||||
/// <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.panel1 = new System.Windows.Forms.Panel();
|
||||
this.pnlmain = new System.Windows.Forms.Panel();
|
||||
this.pnlusers = new System.Windows.Forms.GroupBox();
|
||||
this.lbusers = new System.Windows.Forms.ListBox();
|
||||
this.fluserbuttons = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnview = new System.Windows.Forms.Button();
|
||||
this.btnrefreshusers = new System.Windows.Forms.Button();
|
||||
this.pnllogin = new System.Windows.Forms.GroupBox();
|
||||
this.txtpassword = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.btnlogin = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel1.SuspendLayout();
|
||||
this.pnlmain.SuspendLayout();
|
||||
this.pnlusers.SuspendLayout();
|
||||
this.fluserbuttons.SuspendLayout();
|
||||
this.pnllogin.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.pnlmain);
|
||||
this.panel1.Controls.Add(this.pnllogin);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(622, 430);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// pnlmain
|
||||
//
|
||||
this.pnlmain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlmain.Controls.Add(this.pnlusers);
|
||||
this.pnlmain.Location = new System.Drawing.Point(13, 13);
|
||||
this.pnlmain.Name = "pnlmain";
|
||||
this.pnlmain.Size = new System.Drawing.Size(597, 405);
|
||||
this.pnlmain.TabIndex = 1;
|
||||
this.pnlmain.Visible = false;
|
||||
//
|
||||
// pnlusers
|
||||
//
|
||||
this.pnlusers.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlusers.Controls.Add(this.lbusers);
|
||||
this.pnlusers.Controls.Add(this.fluserbuttons);
|
||||
this.pnlusers.Location = new System.Drawing.Point(16, 27);
|
||||
this.pnlusers.Name = "pnlusers";
|
||||
this.pnlusers.Size = new System.Drawing.Size(265, 356);
|
||||
this.pnlusers.TabIndex = 0;
|
||||
this.pnlusers.TabStop = false;
|
||||
this.pnlusers.Text = "groupBox1";
|
||||
//
|
||||
// lbusers
|
||||
//
|
||||
this.lbusers.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbusers.FormattingEnabled = true;
|
||||
this.lbusers.Location = new System.Drawing.Point(3, 16);
|
||||
this.lbusers.Name = "lbusers";
|
||||
this.lbusers.Size = new System.Drawing.Size(259, 308);
|
||||
this.lbusers.TabIndex = 0;
|
||||
//
|
||||
// fluserbuttons
|
||||
//
|
||||
this.fluserbuttons.AutoSize = true;
|
||||
this.fluserbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.fluserbuttons.Controls.Add(this.btnview);
|
||||
this.fluserbuttons.Controls.Add(this.btnrefreshusers);
|
||||
this.fluserbuttons.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.fluserbuttons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.fluserbuttons.Location = new System.Drawing.Point(3, 324);
|
||||
this.fluserbuttons.Name = "fluserbuttons";
|
||||
this.fluserbuttons.Size = new System.Drawing.Size(259, 29);
|
||||
this.fluserbuttons.TabIndex = 1;
|
||||
//
|
||||
// btnview
|
||||
//
|
||||
this.btnview.AutoSize = true;
|
||||
this.btnview.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnview.Location = new System.Drawing.Point(173, 3);
|
||||
this.btnview.Name = "btnview";
|
||||
this.btnview.Size = new System.Drawing.Size(83, 23);
|
||||
this.btnview.TabIndex = 0;
|
||||
this.btnview.Text = "View user info";
|
||||
this.btnview.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnrefreshusers
|
||||
//
|
||||
this.btnrefreshusers.AutoSize = true;
|
||||
this.btnrefreshusers.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnrefreshusers.Location = new System.Drawing.Point(113, 3);
|
||||
this.btnrefreshusers.Name = "btnrefreshusers";
|
||||
this.btnrefreshusers.Size = new System.Drawing.Size(54, 23);
|
||||
this.btnrefreshusers.TabIndex = 1;
|
||||
this.btnrefreshusers.Text = "Refresh";
|
||||
this.btnrefreshusers.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pnllogin
|
||||
//
|
||||
this.pnllogin.Controls.Add(this.txtpassword);
|
||||
this.pnllogin.Controls.Add(this.label2);
|
||||
this.pnllogin.Controls.Add(this.btnlogin);
|
||||
this.pnllogin.Controls.Add(this.label1);
|
||||
this.pnllogin.Location = new System.Drawing.Point(177, 180);
|
||||
this.pnllogin.Name = "pnllogin";
|
||||
this.pnllogin.Size = new System.Drawing.Size(419, 251);
|
||||
this.pnllogin.TabIndex = 0;
|
||||
this.pnllogin.TabStop = false;
|
||||
this.pnllogin.Text = "Log in";
|
||||
//
|
||||
// txtpassword
|
||||
//
|
||||
this.txtpassword.Location = new System.Drawing.Point(13, 137);
|
||||
this.txtpassword.Name = "txtpassword";
|
||||
this.txtpassword.Size = new System.Drawing.Size(387, 20);
|
||||
this.txtpassword.TabIndex = 3;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(10, 100);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(81, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "{PASSWORD}:";
|
||||
//
|
||||
// btnlogin
|
||||
//
|
||||
this.btnlogin.Location = new System.Drawing.Point(325, 209);
|
||||
this.btnlogin.Name = "btnlogin";
|
||||
this.btnlogin.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnlogin.TabIndex = 1;
|
||||
this.btnlogin.Text = "Submit";
|
||||
this.btnlogin.UseVisualStyleBackColor = true;
|
||||
this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(7, 20);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(393, 64);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "{LOGIN_EXP}";
|
||||
//
|
||||
// MUDAuthenticator
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(622, 430);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "MUDAuthenticator";
|
||||
this.Text = "Multi-User Domain Admin Panel";
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.pnlmain.ResumeLayout(false);
|
||||
this.pnlusers.ResumeLayout(false);
|
||||
this.pnlusers.PerformLayout();
|
||||
this.fluserbuttons.ResumeLayout(false);
|
||||
this.fluserbuttons.PerformLayout();
|
||||
this.pnllogin.ResumeLayout(false);
|
||||
this.pnllogin.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.GroupBox pnllogin;
|
||||
private System.Windows.Forms.TextBox txtpassword;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button btnlogin;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Panel pnlmain;
|
||||
private System.Windows.Forms.GroupBox pnlusers;
|
||||
private System.Windows.Forms.ListBox lbusers;
|
||||
private System.Windows.Forms.FlowLayoutPanel fluserbuttons;
|
||||
private System.Windows.Forms.Button btnview;
|
||||
private System.Windows.Forms.Button btnrefreshusers;
|
||||
}
|
||||
}
|
150
ShiftOS.WinForms/Applications/MUDAuthenticator.cs
Normal file
150
ShiftOS.WinForms/Applications/MUDAuthenticator.cs
Normal file
|
@ -0,0 +1,150 @@
|
|||
using ShiftOS.Objects;
|
||||
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 ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[MultiplayerOnly]
|
||||
[Launcher("MUD Administrator", true, "al_mud_cracker")]
|
||||
[RequiresUpgrade("mud_cracker")]
|
||||
[WinOpen("mud_administrator")]
|
||||
public partial class MUDAuthenticator : UserControl, IShiftOSWindow
|
||||
{
|
||||
public MUDAuthenticator()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
ServerManager.ServerAccessGranted += () =>
|
||||
{
|
||||
this.Invoke(new Action(() => { Granted(); }));
|
||||
};
|
||||
ServerManager.ServerAccessDenied += () =>
|
||||
{
|
||||
this.Invoke(new Action(() => { Denied(); }));
|
||||
};
|
||||
ServerManager.GUIDReceived += (guid) =>
|
||||
{
|
||||
this.guid = guid;
|
||||
};
|
||||
ServerManager.UsersReceived += (users) =>
|
||||
{
|
||||
foreach(var user in users)
|
||||
{
|
||||
if (!this.users.ContainsKey(user.Username))
|
||||
{
|
||||
this.users.Add(user.Username, user);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.users[user.Username].OnlineChat += ";" + user.OnlineChat;
|
||||
}
|
||||
}
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
SetupUserList();
|
||||
}));
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
pnllogin.Left = (pnllogin.Parent.Width - pnllogin.Width) / 2;
|
||||
pnllogin.Top = (pnllogin.Parent.Height - pnllogin.Height) / 2;
|
||||
|
||||
pnllogin.Parent.SizeChanged += (o, a) =>
|
||||
{
|
||||
pnllogin.Left = (pnllogin.Parent.Width - pnllogin.Width) / 2;
|
||||
pnllogin.Top = (pnllogin.Parent.Height - pnllogin.Height) / 2;
|
||||
};
|
||||
|
||||
pnlmain.Left = (pnlmain.Parent.Width - pnlmain.Width) / 2;
|
||||
pnlmain.Top = (pnlmain.Parent.Height - pnlmain.Height) / 2;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Granted()
|
||||
{
|
||||
Infobox.Show("{ACCESS_GRANTED}", "{ACCESS_GRANTED_MUDADMIN_EXP}");
|
||||
//This will tell the server to take the granted password off the list of granted passwords
|
||||
//so the user must generate and crack a new one.
|
||||
ServerManager.SendMessage("mudhack_killpass", "");
|
||||
|
||||
SetupAuthUI();
|
||||
}
|
||||
|
||||
public void SetupAuthUI()
|
||||
{
|
||||
pnllogin.Hide();
|
||||
|
||||
pnlmain.Show();
|
||||
|
||||
PopulateUserList();
|
||||
}
|
||||
|
||||
Dictionary<string, OnlineUser> users = new Dictionary<string, OnlineUser>();
|
||||
|
||||
public void PopulateUserList()
|
||||
{
|
||||
users = null;
|
||||
ServerManager.SendMessage("mudhack_getallusers", "");
|
||||
}
|
||||
|
||||
private string guid = null;
|
||||
|
||||
public void SetupUserList()
|
||||
{
|
||||
lbusers.Items.Clear();
|
||||
foreach(var kv in users)
|
||||
{
|
||||
guid = null;
|
||||
ServerManager.SendMessage("getguid_send", kv.Key);
|
||||
while(guid == null)
|
||||
{
|
||||
|
||||
}
|
||||
users[kv.Key].Guid = guid;
|
||||
lbusers.Items.Add(kv.Key);
|
||||
}
|
||||
}
|
||||
|
||||
public void Denied()
|
||||
{
|
||||
Infobox.Show("{ACCESS_DENIED}", "{ACCESS_DENIED_MUDADMIN_EXP}");
|
||||
}
|
||||
|
||||
private void btnlogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
ServerManager.SendMessage("mudhack_verify", "{pass: \"" + txtpassword.Text + "\"}");
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/MUDAuthenticator.resx
Normal file
120
ShiftOS.WinForms/Applications/MUDAuthenticator.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
617
ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs
generated
Normal file
617
ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs
generated
Normal file
|
@ -0,0 +1,617 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class MUDControlCentre
|
||||
{
|
||||
/// <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 Component 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.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.youToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.profileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsMemos = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.disconnectFromMuDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.shopsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.browseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.myShopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tasksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.currentTaskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.browseJobsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.txtappstatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
|
||||
this.you_memos = new System.Windows.Forms.Panel();
|
||||
this.flmemos = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.you_systemstatus = new System.Windows.Forms.Panel();
|
||||
this.lblsysstatus = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.legionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.createLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.joinLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.myLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.lgn_view = new System.Windows.Forms.Panel();
|
||||
this.banner = new System.Windows.Forms.Panel();
|
||||
this.lblegiontitle = new System.Windows.Forms.Label();
|
||||
this.btnleavelegion = new System.Windows.Forms.Button();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnjoinlegion = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.lbdescription = new System.Windows.Forms.Label();
|
||||
this.pnllgnusers = new System.Windows.Forms.Panel();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.lvusers = new System.Windows.Forms.ListView();
|
||||
this.lgn_join = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.fllegionlist = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.SuspendLayout();
|
||||
this.you_memos.SuspendLayout();
|
||||
this.you_systemstatus.SuspendLayout();
|
||||
this.lgn_view.SuspendLayout();
|
||||
this.banner.SuspendLayout();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.pnllgnusers.SuspendLayout();
|
||||
this.lgn_join.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.flowLayoutPanel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.youToolStripMenuItem,
|
||||
this.shopsToolStripMenuItem,
|
||||
this.tasksToolStripMenuItem,
|
||||
this.legionsToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(756, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// youToolStripMenuItem
|
||||
//
|
||||
this.youToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.profileToolStripMenuItem,
|
||||
this.tsMemos,
|
||||
this.disconnectFromMuDToolStripMenuItem});
|
||||
this.youToolStripMenuItem.Name = "youToolStripMenuItem";
|
||||
this.youToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||
this.youToolStripMenuItem.Text = "You";
|
||||
//
|
||||
// profileToolStripMenuItem
|
||||
//
|
||||
this.profileToolStripMenuItem.Name = "profileToolStripMenuItem";
|
||||
this.profileToolStripMenuItem.Size = new System.Drawing.Size(192, 22);
|
||||
this.profileToolStripMenuItem.Text = "System status";
|
||||
this.profileToolStripMenuItem.Click += new System.EventHandler(this.profileToolStripMenuItem_Click);
|
||||
//
|
||||
// tsMemos
|
||||
//
|
||||
this.tsMemos.Name = "tsMemos";
|
||||
this.tsMemos.Size = new System.Drawing.Size(192, 22);
|
||||
this.tsMemos.Text = "Memos";
|
||||
this.tsMemos.Click += new System.EventHandler(this.tsMemos_Click);
|
||||
//
|
||||
// disconnectFromMuDToolStripMenuItem
|
||||
//
|
||||
this.disconnectFromMuDToolStripMenuItem.Name = "disconnectFromMuDToolStripMenuItem";
|
||||
this.disconnectFromMuDToolStripMenuItem.Size = new System.Drawing.Size(192, 22);
|
||||
this.disconnectFromMuDToolStripMenuItem.Text = "Disconnect from MUD";
|
||||
this.disconnectFromMuDToolStripMenuItem.Click += new System.EventHandler(this.disconnectFromMuDToolStripMenuItem_Click);
|
||||
//
|
||||
// shopsToolStripMenuItem
|
||||
//
|
||||
this.shopsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.browseToolStripMenuItem,
|
||||
this.myShopToolStripMenuItem});
|
||||
this.shopsToolStripMenuItem.Name = "shopsToolStripMenuItem";
|
||||
this.shopsToolStripMenuItem.Size = new System.Drawing.Size(51, 20);
|
||||
this.shopsToolStripMenuItem.Text = "Shops";
|
||||
//
|
||||
// browseToolStripMenuItem
|
||||
//
|
||||
this.browseToolStripMenuItem.Name = "browseToolStripMenuItem";
|
||||
this.browseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.browseToolStripMenuItem.Text = "Browse";
|
||||
//
|
||||
// myShopToolStripMenuItem
|
||||
//
|
||||
this.myShopToolStripMenuItem.Name = "myShopToolStripMenuItem";
|
||||
this.myShopToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.myShopToolStripMenuItem.Text = "My Shop";
|
||||
//
|
||||
// tasksToolStripMenuItem
|
||||
//
|
||||
this.tasksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.currentTaskToolStripMenuItem,
|
||||
this.browseJobsToolStripMenuItem});
|
||||
this.tasksToolStripMenuItem.Name = "tasksToolStripMenuItem";
|
||||
this.tasksToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
|
||||
this.tasksToolStripMenuItem.Text = "Tasks";
|
||||
//
|
||||
// currentTaskToolStripMenuItem
|
||||
//
|
||||
this.currentTaskToolStripMenuItem.Name = "currentTaskToolStripMenuItem";
|
||||
this.currentTaskToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
||||
this.currentTaskToolStripMenuItem.Text = "Current task";
|
||||
//
|
||||
// browseJobsToolStripMenuItem
|
||||
//
|
||||
this.browseJobsToolStripMenuItem.Name = "browseJobsToolStripMenuItem";
|
||||
this.browseJobsToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
||||
this.browseJobsToolStripMenuItem.Text = "Browse Jobs";
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.txtappstatus});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(756, 22);
|
||||
this.statusStrip1.TabIndex = 1;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// txtappstatus
|
||||
//
|
||||
this.txtappstatus.Name = "txtappstatus";
|
||||
this.txtappstatus.Size = new System.Drawing.Size(118, 17);
|
||||
this.txtappstatus.Text = "toolStripStatusLabel1";
|
||||
//
|
||||
// toolStripContainer1
|
||||
//
|
||||
//
|
||||
// toolStripContainer1.BottomToolStripPanel
|
||||
//
|
||||
this.toolStripContainer1.BottomToolStripPanel.Controls.Add(this.statusStrip1);
|
||||
//
|
||||
// toolStripContainer1.ContentPanel
|
||||
//
|
||||
this.toolStripContainer1.ContentPanel.Controls.Add(this.lgn_view);
|
||||
this.toolStripContainer1.ContentPanel.Controls.Add(this.lgn_join);
|
||||
this.toolStripContainer1.ContentPanel.Controls.Add(this.you_memos);
|
||||
this.toolStripContainer1.ContentPanel.Controls.Add(this.you_systemstatus);
|
||||
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(756, 442);
|
||||
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer1.Name = "toolStripContainer1";
|
||||
this.toolStripContainer1.Size = new System.Drawing.Size(756, 488);
|
||||
this.toolStripContainer1.TabIndex = 2;
|
||||
this.toolStripContainer1.Text = "toolStripContainer1";
|
||||
//
|
||||
// toolStripContainer1.TopToolStripPanel
|
||||
//
|
||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
|
||||
//
|
||||
// you_memos
|
||||
//
|
||||
this.you_memos.Controls.Add(this.flmemos);
|
||||
this.you_memos.Controls.Add(this.label3);
|
||||
this.you_memos.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.you_memos.Location = new System.Drawing.Point(0, 0);
|
||||
this.you_memos.Name = "you_memos";
|
||||
this.you_memos.Size = new System.Drawing.Size(756, 442);
|
||||
this.you_memos.TabIndex = 1;
|
||||
//
|
||||
// flmemos
|
||||
//
|
||||
this.flmemos.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flmemos.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flmemos.Location = new System.Drawing.Point(0, 43);
|
||||
this.flmemos.Name = "flmemos";
|
||||
this.flmemos.Padding = new System.Windows.Forms.Padding(15);
|
||||
this.flmemos.Size = new System.Drawing.Size(756, 399);
|
||||
this.flmemos.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label3.Location = new System.Drawing.Point(0, 0);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(15);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Padding = new System.Windows.Forms.Padding(15);
|
||||
this.label3.Size = new System.Drawing.Size(71, 43);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Tag = "header1";
|
||||
this.label3.Text = "Memos";
|
||||
//
|
||||
// you_systemstatus
|
||||
//
|
||||
this.you_systemstatus.Controls.Add(this.lblsysstatus);
|
||||
this.you_systemstatus.Controls.Add(this.label1);
|
||||
this.you_systemstatus.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.you_systemstatus.Location = new System.Drawing.Point(0, 0);
|
||||
this.you_systemstatus.Name = "you_systemstatus";
|
||||
this.you_systemstatus.Size = new System.Drawing.Size(756, 442);
|
||||
this.you_systemstatus.TabIndex = 0;
|
||||
//
|
||||
// lblsysstatus
|
||||
//
|
||||
this.lblsysstatus.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblsysstatus.Location = new System.Drawing.Point(0, 43);
|
||||
this.lblsysstatus.Name = "lblsysstatus";
|
||||
this.lblsysstatus.Padding = new System.Windows.Forms.Padding(15);
|
||||
this.lblsysstatus.Size = new System.Drawing.Size(756, 399);
|
||||
this.lblsysstatus.TabIndex = 1;
|
||||
this.lblsysstatus.Text = "Username: {username}\r\nSystem name: {sysname}\r\n\r\nCodepoints: {cp}\r\nUpgrades: {boug" +
|
||||
"ht}/{available}\r\n\r\nSystem version: {sysver}\r\n\r\nShared scripts: {scripts}\r\n\r\nCurr" +
|
||||
"ent legion: {legionname}\r\nRole: {role}";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Padding = new System.Windows.Forms.Padding(15);
|
||||
this.label1.Size = new System.Drawing.Size(56, 43);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Tag = "header1";
|
||||
this.label1.Text = "You";
|
||||
//
|
||||
// legionsToolStripMenuItem
|
||||
//
|
||||
this.legionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.createLegionToolStripMenuItem,
|
||||
this.joinLegionToolStripMenuItem,
|
||||
this.myLegionToolStripMenuItem});
|
||||
this.legionsToolStripMenuItem.Name = "legionsToolStripMenuItem";
|
||||
this.legionsToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
|
||||
this.legionsToolStripMenuItem.Text = "Legions";
|
||||
//
|
||||
// createLegionToolStripMenuItem
|
||||
//
|
||||
this.createLegionToolStripMenuItem.Name = "createLegionToolStripMenuItem";
|
||||
this.createLegionToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.createLegionToolStripMenuItem.Text = "Create Legion";
|
||||
//
|
||||
// joinLegionToolStripMenuItem
|
||||
//
|
||||
this.joinLegionToolStripMenuItem.Name = "joinLegionToolStripMenuItem";
|
||||
this.joinLegionToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.joinLegionToolStripMenuItem.Text = "Join Legion";
|
||||
this.joinLegionToolStripMenuItem.Click += new System.EventHandler(this.joinLegionToolStripMenuItem_Click);
|
||||
//
|
||||
// myLegionToolStripMenuItem
|
||||
//
|
||||
this.myLegionToolStripMenuItem.Name = "myLegionToolStripMenuItem";
|
||||
this.myLegionToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.myLegionToolStripMenuItem.Text = "My Legion";
|
||||
this.myLegionToolStripMenuItem.Click += new System.EventHandler(this.myLegionToolStripMenuItem_Click);
|
||||
//
|
||||
// lgn_view
|
||||
//
|
||||
this.lgn_view.Controls.Add(this.pnllgnusers);
|
||||
this.lgn_view.Controls.Add(this.lbdescription);
|
||||
this.lgn_view.Controls.Add(this.label2);
|
||||
this.lgn_view.Controls.Add(this.banner);
|
||||
this.lgn_view.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lgn_view.Location = new System.Drawing.Point(0, 0);
|
||||
this.lgn_view.Name = "lgn_view";
|
||||
this.lgn_view.Size = new System.Drawing.Size(756, 442);
|
||||
this.lgn_view.TabIndex = 2;
|
||||
//
|
||||
// banner
|
||||
//
|
||||
this.banner.BackColor = System.Drawing.Color.Blue;
|
||||
this.banner.Controls.Add(this.flowLayoutPanel1);
|
||||
this.banner.Controls.Add(this.lblegiontitle);
|
||||
this.banner.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.banner.Location = new System.Drawing.Point(0, 0);
|
||||
this.banner.Name = "banner";
|
||||
this.banner.Size = new System.Drawing.Size(756, 100);
|
||||
this.banner.TabIndex = 0;
|
||||
this.banner.Tag = "keepbg";
|
||||
//
|
||||
// lblegiontitle
|
||||
//
|
||||
this.lblegiontitle.AutoSize = true;
|
||||
this.lblegiontitle.Location = new System.Drawing.Point(18, 30);
|
||||
this.lblegiontitle.Name = "lblegiontitle";
|
||||
this.lblegiontitle.Size = new System.Drawing.Size(62, 13);
|
||||
this.lblegiontitle.TabIndex = 0;
|
||||
this.lblegiontitle.Tag = "header1 keepbg";
|
||||
this.lblegiontitle.Text = "Legion Title";
|
||||
//
|
||||
// btnleavelegion
|
||||
//
|
||||
this.btnleavelegion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnleavelegion.AutoSize = true;
|
||||
this.btnleavelegion.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnleavelegion.Location = new System.Drawing.Point(99, 3);
|
||||
this.btnleavelegion.Name = "btnleavelegion";
|
||||
this.btnleavelegion.Size = new System.Drawing.Size(101, 23);
|
||||
this.btnleavelegion.TabIndex = 1;
|
||||
this.btnleavelegion.Tag = "keepbg";
|
||||
this.btnleavelegion.Text = "Leave this Legion";
|
||||
this.btnleavelegion.UseVisualStyleBackColor = true;
|
||||
this.btnleavelegion.Click += new System.EventHandler(this.btnleavelegion_Click);
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowLayoutPanel1.AutoSize = true;
|
||||
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnleavelegion);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnjoinlegion);
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(550, 68);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(203, 29);
|
||||
this.flowLayoutPanel1.TabIndex = 2;
|
||||
this.flowLayoutPanel1.Tag = "keepbg";
|
||||
//
|
||||
// btnjoinlegion
|
||||
//
|
||||
this.btnjoinlegion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnjoinlegion.AutoSize = true;
|
||||
this.btnjoinlegion.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnjoinlegion.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnjoinlegion.Name = "btnjoinlegion";
|
||||
this.btnjoinlegion.Size = new System.Drawing.Size(90, 23);
|
||||
this.btnjoinlegion.TabIndex = 2;
|
||||
this.btnjoinlegion.Tag = "keepbg";
|
||||
this.btnjoinlegion.Text = "Join this Legion";
|
||||
this.btnjoinlegion.UseVisualStyleBackColor = true;
|
||||
this.btnjoinlegion.Click += new System.EventHandler(this.btnjoinlegion_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(21, 130);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(60, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Tag = "header2";
|
||||
this.label2.Text = "Description";
|
||||
//
|
||||
// lbdescription
|
||||
//
|
||||
this.lbdescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbdescription.Location = new System.Drawing.Point(24, 185);
|
||||
this.lbdescription.Name = "lbdescription";
|
||||
this.lbdescription.Size = new System.Drawing.Size(354, 231);
|
||||
this.lbdescription.TabIndex = 2;
|
||||
this.lbdescription.Text = "This is the description of this multi-user domain legion. Keep it descriptive.";
|
||||
//
|
||||
// pnllgnusers
|
||||
//
|
||||
this.pnllgnusers.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnllgnusers.Controls.Add(this.lvusers);
|
||||
this.pnllgnusers.Controls.Add(this.label4);
|
||||
this.pnllgnusers.Location = new System.Drawing.Point(413, 130);
|
||||
this.pnllgnusers.Name = "pnllgnusers";
|
||||
this.pnllgnusers.Size = new System.Drawing.Size(337, 286);
|
||||
this.pnllgnusers.TabIndex = 3;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label4.Location = new System.Drawing.Point(0, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(34, 13);
|
||||
this.label4.TabIndex = 2;
|
||||
this.label4.Tag = "header2";
|
||||
this.label4.Text = "Users";
|
||||
//
|
||||
// lvusers
|
||||
//
|
||||
this.lvusers.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvusers.FullRowSelect = true;
|
||||
this.lvusers.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.lvusers.HideSelection = false;
|
||||
this.lvusers.Location = new System.Drawing.Point(0, 13);
|
||||
this.lvusers.Name = "lvusers";
|
||||
this.lvusers.Size = new System.Drawing.Size(337, 273);
|
||||
this.lvusers.TabIndex = 3;
|
||||
this.lvusers.UseCompatibleStateImageBehavior = false;
|
||||
this.lvusers.View = System.Windows.Forms.View.SmallIcon;
|
||||
//
|
||||
// lgn_join
|
||||
//
|
||||
this.lgn_join.Controls.Add(this.fllegionlist);
|
||||
this.lgn_join.Controls.Add(this.panel3);
|
||||
this.lgn_join.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lgn_join.Location = new System.Drawing.Point(0, 0);
|
||||
this.lgn_join.Name = "lgn_join";
|
||||
this.lgn_join.Size = new System.Drawing.Size(756, 442);
|
||||
this.lgn_join.TabIndex = 3;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.BackColor = System.Drawing.Color.Blue;
|
||||
this.panel3.Controls.Add(this.flowLayoutPanel2);
|
||||
this.panel3.Controls.Add(this.label8);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel3.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(756, 100);
|
||||
this.panel3.TabIndex = 0;
|
||||
this.panel3.Tag = "";
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
//
|
||||
this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowLayoutPanel2.AutoSize = true;
|
||||
this.flowLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flowLayoutPanel2.Controls.Add(this.button1);
|
||||
this.flowLayoutPanel2.Controls.Add(this.button2);
|
||||
this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(547, 3);
|
||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(209, 29);
|
||||
this.flowLayoutPanel2.TabIndex = 2;
|
||||
this.flowLayoutPanel2.Tag = "keepbg";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.AutoSize = true;
|
||||
this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.button1.Location = new System.Drawing.Point(100, 3);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(106, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Tag = "keepbg";
|
||||
this.button1.Text = "Create new Legion";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button2.AutoSize = true;
|
||||
this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.button2.Location = new System.Drawing.Point(3, 3);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(91, 23);
|
||||
this.button2.TabIndex = 2;
|
||||
this.button2.Tag = "keepbg";
|
||||
this.button2.Text = "Use invite code";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(18, 17);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(70, 13);
|
||||
this.label8.TabIndex = 0;
|
||||
this.label8.Tag = "header1 keepbg";
|
||||
this.label8.Text = "Join a Legion";
|
||||
//
|
||||
// fllegionlist
|
||||
//
|
||||
this.fllegionlist.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.fllegionlist.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.fllegionlist.Location = new System.Drawing.Point(0, 100);
|
||||
this.fllegionlist.Name = "fllegionlist";
|
||||
this.fllegionlist.Size = new System.Drawing.Size(756, 342);
|
||||
this.fllegionlist.TabIndex = 1;
|
||||
//
|
||||
// MUDControlCentre
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.Controls.Add(this.toolStripContainer1);
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Name = "MUDControlCentre";
|
||||
this.Text = "MUD Control Centre";
|
||||
this.Size = new System.Drawing.Size(756, 488);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.toolStripContainer1.BottomToolStripPanel.ResumeLayout(false);
|
||||
this.toolStripContainer1.BottomToolStripPanel.PerformLayout();
|
||||
this.toolStripContainer1.ContentPanel.ResumeLayout(false);
|
||||
this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
|
||||
this.toolStripContainer1.TopToolStripPanel.PerformLayout();
|
||||
this.toolStripContainer1.ResumeLayout(false);
|
||||
this.toolStripContainer1.PerformLayout();
|
||||
this.you_memos.ResumeLayout(false);
|
||||
this.you_memos.PerformLayout();
|
||||
this.you_systemstatus.ResumeLayout(false);
|
||||
this.you_systemstatus.PerformLayout();
|
||||
this.lgn_view.ResumeLayout(false);
|
||||
this.lgn_view.PerformLayout();
|
||||
this.banner.ResumeLayout(false);
|
||||
this.banner.PerformLayout();
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.flowLayoutPanel1.PerformLayout();
|
||||
this.pnllgnusers.ResumeLayout(false);
|
||||
this.pnllgnusers.PerformLayout();
|
||||
this.lgn_join.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel3.PerformLayout();
|
||||
this.flowLayoutPanel2.ResumeLayout(false);
|
||||
this.flowLayoutPanel2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem youToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem profileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsMemos;
|
||||
private System.Windows.Forms.ToolStripMenuItem disconnectFromMuDToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem shopsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem browseToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem myShopToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem tasksToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem currentTaskToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem browseJobsToolStripMenuItem;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel txtappstatus;
|
||||
private System.Windows.Forms.ToolStripContainer toolStripContainer1;
|
||||
private System.Windows.Forms.Panel you_systemstatus;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label lblsysstatus;
|
||||
private System.Windows.Forms.Panel you_memos;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.FlowLayoutPanel flmemos;
|
||||
private System.Windows.Forms.ToolStripMenuItem legionsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem createLegionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem joinLegionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem myLegionToolStripMenuItem;
|
||||
private System.Windows.Forms.Panel lgn_view;
|
||||
private System.Windows.Forms.Panel banner;
|
||||
private System.Windows.Forms.Label lblegiontitle;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.Button btnleavelegion;
|
||||
private System.Windows.Forms.Button btnjoinlegion;
|
||||
private System.Windows.Forms.Panel pnllgnusers;
|
||||
private System.Windows.Forms.ListView lvusers;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label lbdescription;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Panel lgn_join;
|
||||
private System.Windows.Forms.FlowLayoutPanel fllegionlist;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Label label8;
|
||||
}
|
||||
}
|
314
ShiftOS.WinForms/Applications/MUDControlCentre.cs
Normal file
314
ShiftOS.WinForms/Applications/MUDControlCentre.cs
Normal file
|
@ -0,0 +1,314 @@
|
|||
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 ShiftOS.Engine;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Objects;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[RequiresUpgrade("mud_fundamentals")]
|
||||
[Launcher("MUD Control Centre", true, "al_mud_control_centre")]
|
||||
[WinOpen("mud_control_centre")]
|
||||
public partial class MUDControlCentre : UserControl, IShiftOSWindow
|
||||
{
|
||||
public MUDControlCentre()
|
||||
{
|
||||
if (SaveSystem.CurrentSave.CurrentLegions == null)
|
||||
SaveSystem.CurrentSave.CurrentLegions = new List<string>();
|
||||
InitializeComponent();
|
||||
ServerManager.MessageReceived += (msg) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
if (msg.Name == "user_not_found_in_legion")
|
||||
{
|
||||
|
||||
ShowLegionInfo(new Legion
|
||||
{
|
||||
Name = "No legion",
|
||||
ShortName = "NONE",
|
||||
Description = "You are not currently in any legions! You can go to 'Join Legion' and look for a legion to join, however, or create your own.",
|
||||
Publicity = LegionPublicity.UnlistedInviteOnly,
|
||||
BannerColor = ConsoleColor.DarkRed
|
||||
});
|
||||
}
|
||||
else if(msg.Name == "legion_users_found")
|
||||
{
|
||||
lvusers.Items.Clear();
|
||||
foreach(var usr in JsonConvert.DeserializeObject<string[]>(msg.Contents))
|
||||
{
|
||||
lvusers.Items.Add(usr);
|
||||
}
|
||||
}
|
||||
else if (msg.Name == "user_legion")
|
||||
{
|
||||
ShowLegionInfo(JsonConvert.DeserializeObject<Legion>(msg.Contents));
|
||||
}
|
||||
else if(msg.Name == "legion_all")
|
||||
{
|
||||
PopulateJoinLegion(JsonConvert.DeserializeObject<List<Legion>>(msg.Contents));
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
}
|
||||
|
||||
public void PopulateJoinLegion(List<Legion> legions)
|
||||
{
|
||||
lgn_join.BringToFront();
|
||||
|
||||
fllegionlist.Controls.Clear();
|
||||
|
||||
foreach(var lgn in legions)
|
||||
{
|
||||
var bnr = new Panel();
|
||||
bnr.Height = 100;
|
||||
bnr.Tag = "keepbg";
|
||||
bnr.BackColor = GetColor(lgn.BannerColor);
|
||||
|
||||
bnr.Width = fllegionlist.Width;
|
||||
|
||||
var lTitle = new Label();
|
||||
lTitle.AutoSize = true;
|
||||
lTitle.Tag = "keepbg header2";
|
||||
lTitle.Text = $"[{lgn.ShortName}] {lgn.Name}";
|
||||
lTitle.Location = new Point(18, 17);
|
||||
bnr.Controls.Add(lTitle);
|
||||
lTitle.Show();
|
||||
|
||||
|
||||
var flButtons = new FlowLayoutPanel();
|
||||
flButtons.AutoSize = true;
|
||||
flButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
flButtons.Tag = "keepbg";
|
||||
flButtons.FlowDirection = FlowDirection.RightToLeft;
|
||||
flButtons.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
flButtons.Top = 2;
|
||||
flButtons.Left = bnr.Width - flButtons.Width - 2;
|
||||
bnr.Controls.Add(flButtons);
|
||||
flButtons.Show();
|
||||
|
||||
var btn = new Button();
|
||||
btn.Text = "More info";
|
||||
btn.Click += (o, a) =>
|
||||
{
|
||||
ShowLegionInfo(lgn);
|
||||
};
|
||||
flButtons.Controls.Add(btn);
|
||||
btn.Show();
|
||||
|
||||
fllegionlist.Controls.Add(bnr);
|
||||
bnr.Show();
|
||||
ControlManager.SetupControls(bnr);
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetColor(ConsoleColor color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case ConsoleColor.Black:
|
||||
return Color.Black;
|
||||
case ConsoleColor.Gray:
|
||||
return Color.Gray;
|
||||
case ConsoleColor.DarkGray:
|
||||
return Color.DarkGray;
|
||||
case ConsoleColor.Blue:
|
||||
return Color.Blue;
|
||||
case ConsoleColor.Cyan:
|
||||
return Color.Cyan;
|
||||
case ConsoleColor.DarkBlue:
|
||||
return Color.DarkBlue;
|
||||
case ConsoleColor.DarkCyan:
|
||||
return Color.DarkCyan;
|
||||
case ConsoleColor.DarkGreen:
|
||||
return Color.DarkGreen;
|
||||
case ConsoleColor.DarkMagenta:
|
||||
return Color.DarkMagenta;
|
||||
case ConsoleColor.DarkRed:
|
||||
return Color.DarkRed;
|
||||
case ConsoleColor.DarkYellow:
|
||||
case ConsoleColor.Yellow:
|
||||
return Color.Yellow;
|
||||
case ConsoleColor.Green:
|
||||
return Color.Green;
|
||||
case ConsoleColor.Magenta:
|
||||
return Color.Magenta;
|
||||
case ConsoleColor.Red:
|
||||
return Color.Red;
|
||||
case ConsoleColor.White:
|
||||
return Color.White;
|
||||
default:
|
||||
return Color.Black;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
ServerManager.MessageReceived += (msg) =>
|
||||
{
|
||||
if(msg.Name == "mud_usermemos")
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var memo in JsonConvert.DeserializeObject<MUDMemo[]>(msg.Contents))
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
var lbtitle = new Label();
|
||||
lbtitle.Text = memo.Subject;
|
||||
lbtitle.Tag = "header3";
|
||||
ControlManager.SetupControls(lbtitle);
|
||||
flmemos.Controls.Add(lbtitle);
|
||||
|
||||
var lbsubject = new Label();
|
||||
lbsubject.Text = "From " + memo.UserFrom;
|
||||
flmemos.Controls.Add(lbsubject);
|
||||
|
||||
var lbbody = new Label();
|
||||
lbbody.Margin = new Padding(0, 15, 0, 15);
|
||||
lbbody.Text = memo.Body;
|
||||
flmemos.Controls.Add(lbbody);
|
||||
|
||||
lbtitle.Show();
|
||||
lbsubject.Show();
|
||||
lbbody.Show();
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
};
|
||||
|
||||
SetupSystemStatus();
|
||||
}
|
||||
|
||||
public void SetupSystemStatus()
|
||||
{
|
||||
int scripts = 0;
|
||||
string legionname = "";
|
||||
|
||||
foreach(var lgn in SaveSystem.CurrentSave.CurrentLegions)
|
||||
{
|
||||
legionname += Environment.NewLine + " - " + lgn;
|
||||
}
|
||||
|
||||
you_systemstatus.BringToFront();
|
||||
|
||||
lblsysstatus.Text = $@"Username: {SaveSystem.CurrentSave.Username}
|
||||
System name: {SaveSystem.CurrentSave.SystemName}
|
||||
|
||||
Codepoints: {SaveSystem.CurrentSave.Codepoints}
|
||||
Upgrades: {SaveSystem.CurrentSave.CountUpgrades()}/{Shiftorium.GetDefaults().Count}
|
||||
|
||||
System version: {SaveSystem.CurrentSave.MajorVersion}.{SaveSystem.CurrentSave.MinorVersion}.{SaveSystem.CurrentSave.Revision}
|
||||
|
||||
Shared scripts: {scripts}
|
||||
|
||||
Current legions: {legionname}";
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void tsMemos_Click(object sender, EventArgs e)
|
||||
{
|
||||
ServerManager.SendMessage("get_memos_for_user", $@"{{
|
||||
username: ""{SaveSystem.CurrentSave.Username}""
|
||||
}}");
|
||||
you_memos.BringToFront();
|
||||
}
|
||||
|
||||
private void profileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetupSystemStatus();
|
||||
}
|
||||
|
||||
private void disconnectFromMuDToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ShowLegionInfo(Legion lgn)
|
||||
{
|
||||
lgn_view.BringToFront();
|
||||
|
||||
lblegiontitle.Text = $"[{lgn.ShortName}] {lgn.Name}";
|
||||
lbdescription.Text = lgn.Description;
|
||||
if(lgn.Publicity == LegionPublicity.PublicInviteOnly || lgn.Publicity == LegionPublicity.UnlistedInviteOnly)
|
||||
{
|
||||
btnjoinlegion.Hide();
|
||||
}
|
||||
|
||||
banner.BackColor = GetColor(lgn.BannerColor);
|
||||
|
||||
ServerManager.SendMessage("legion_get_users", JsonConvert.SerializeObject(lgn));
|
||||
|
||||
btnleavelegion.Hide();
|
||||
|
||||
if(SaveSystem.CurrentSave.CurrentLegions.Contains(lgn.ShortName))
|
||||
{
|
||||
btnjoinlegion.Hide();
|
||||
btnleavelegion.Show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void myLegionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
|
||||
}
|
||||
|
||||
private void joinLegionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ServerManager.SendMessage("legion_get_all", "");
|
||||
}
|
||||
|
||||
private void btnjoinlegion_Click(object sender, EventArgs e)
|
||||
{
|
||||
string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1);
|
||||
|
||||
SaveSystem.CurrentSave.CurrentLegions.Add(shortname);
|
||||
|
||||
SaveSystem.SaveGame();
|
||||
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
|
||||
}
|
||||
|
||||
private void btnleavelegion_Click(object sender, EventArgs e)
|
||||
{
|
||||
string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1);
|
||||
|
||||
SaveSystem.CurrentSave.CurrentLegions.Remove(shortname);
|
||||
|
||||
SaveSystem.SaveGame();
|
||||
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
126
ShiftOS.WinForms/Applications/MUDControlCentre.resx
Normal file
126
ShiftOS.WinForms/Applications/MUDControlCentre.resx
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
</root>
|
102
ShiftOS.WinForms/Applications/MUDPasswordCracker.Designer.cs
generated
Normal file
102
ShiftOS.WinForms/Applications/MUDPasswordCracker.Designer.cs
generated
Normal file
|
@ -0,0 +1,102 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class MUDPasswordCracker
|
||||
{
|
||||
/// <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.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtpassword = new System.Windows.Forms.TextBox();
|
||||
this.lblpassword = new System.Windows.Forms.Label();
|
||||
this.btncrack = new System.Windows.Forms.Button();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.txtpassword);
|
||||
this.panel1.Controls.Add(this.lblpassword);
|
||||
this.panel1.Controls.Add(this.btncrack);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(439, 131);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// txtpassword
|
||||
//
|
||||
this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtpassword.Location = new System.Drawing.Point(13, 53);
|
||||
this.txtpassword.Name = "txtpassword";
|
||||
this.txtpassword.Size = new System.Drawing.Size(414, 20);
|
||||
this.txtpassword.TabIndex = 2;
|
||||
//
|
||||
// lblpassword
|
||||
//
|
||||
this.lblpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblpassword.Location = new System.Drawing.Point(13, 13);
|
||||
this.lblpassword.Name = "lblpassword";
|
||||
this.lblpassword.Size = new System.Drawing.Size(414, 36);
|
||||
this.lblpassword.TabIndex = 1;
|
||||
this.lblpassword.Text = "{PASSWORD}:";
|
||||
this.lblpassword.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// btncrack
|
||||
//
|
||||
this.btncrack.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btncrack.Location = new System.Drawing.Point(12, 96);
|
||||
this.btncrack.Name = "btncrack";
|
||||
this.btncrack.Size = new System.Drawing.Size(415, 23);
|
||||
this.btncrack.TabIndex = 0;
|
||||
this.btncrack.Text = "{CRACK}";
|
||||
this.btncrack.UseVisualStyleBackColor = true;
|
||||
this.btncrack.Click += new System.EventHandler(this.btncrack_Click);
|
||||
//
|
||||
// MUDPasswordCracker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(439, 131);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "MUDPasswordCracker";
|
||||
this.Text = "Multi-User Domain Password Cracker v1.0";
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TextBox txtpassword;
|
||||
private System.Windows.Forms.Label lblpassword;
|
||||
private System.Windows.Forms.Button btncrack;
|
||||
}
|
||||
}
|
105
ShiftOS.WinForms/Applications/MUDPasswordCracker.cs
Normal file
105
ShiftOS.WinForms/Applications/MUDPasswordCracker.cs
Normal file
|
@ -0,0 +1,105 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[MultiplayerOnly]
|
||||
[Launcher("MUD cracker 1.0", true, "al_mud_cracker")]
|
||||
[RequiresUpgrade("mud_cracker")]
|
||||
[WinOpen("mud_cracker")]
|
||||
public partial class MUDPasswordCracker : UserControl, IShiftOSWindow
|
||||
{
|
||||
public MUDPasswordCracker()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private string PasswordToCrack { get; set; }
|
||||
private string Password { get; set; }
|
||||
|
||||
|
||||
private void btncrack_Click(object sender, EventArgs e)
|
||||
{
|
||||
ServerManager.ServerPasswordGenerated += (pass) =>
|
||||
{
|
||||
PasswordToCrack = pass;
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
BeginCrack();
|
||||
}));
|
||||
};
|
||||
ServerManager.InitiateMUDHack();
|
||||
}
|
||||
|
||||
public void BeginCrack()
|
||||
{
|
||||
btncrack.Enabled = false;
|
||||
btncrack.Text = "Starting crack...";
|
||||
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
int secondsleft = 30;
|
||||
while(secondsleft > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
btncrack.Text = $"Cracking... step {secondsleft}.";
|
||||
}));
|
||||
|
||||
|
||||
|
||||
secondsleft -= 1;
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
this.Invoke(new Action(() => EndCrack()));
|
||||
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public void EndCrack()
|
||||
{
|
||||
lblpassword.Show();
|
||||
txtpassword.Show();
|
||||
txtpassword.ReadOnly = true;
|
||||
txtpassword.Text = PasswordToCrack;
|
||||
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/MUDPasswordCracker.resx
Normal file
120
ShiftOS.WinForms/Applications/MUDPasswordCracker.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
55
ShiftOS.WinForms/Applications/NameChanger.Designer.cs
generated
Normal file
55
ShiftOS.WinForms/Applications/NameChanger.Designer.cs
generated
Normal file
|
@ -0,0 +1,55 @@
|
|||
namespace ShiftOS.WinForms.Applications {
|
||||
partial class NameChanger {
|
||||
/// <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.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(138, 342);
|
||||
this.listBox1.TabIndex = 0;
|
||||
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
|
||||
//
|
||||
// NameChanger
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.Name = "NameChanger";
|
||||
this.Text = "Name Changer";
|
||||
this.Size = new System.Drawing.Size(459, 406);
|
||||
this.Load += new System.EventHandler(this.NameChanger_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
}
|
||||
}
|
48
ShiftOS.WinForms/Applications/NameChanger.cs
Normal file
48
ShiftOS.WinForms/Applications/NameChanger.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
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 ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications {
|
||||
|
||||
[Launcher("Name Changer", true, "al_name_changer")]
|
||||
[RequiresUpgrade("name_changer")]
|
||||
[WinOpen("name_changer")]
|
||||
public partial class NameChanger : UserControl, IShiftOSWindow {
|
||||
public NameChanger() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void NameChanger_Load(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/NameChanger.resx
Normal file
120
ShiftOS.WinForms/Applications/NameChanger.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
706
ShiftOS.WinForms/Applications/Pong.Designer.cs
generated
Normal file
706
ShiftOS.WinForms/Applications/Pong.Designer.cs
generated
Normal file
|
@ -0,0 +1,706 @@
|
|||
using ShiftOS.WinForms.Controls;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class Pong
|
||||
{
|
||||
/// <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);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.gameTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.counter = new System.Windows.Forms.Timer(this.components);
|
||||
this.tmrcountdown = new System.Windows.Forms.Timer(this.components);
|
||||
this.tmrstoryline = new System.Windows.Forms.Timer(this.components);
|
||||
this.pgcontents = new ShiftOS.WinForms.Controls.Canvas();
|
||||
this.pnlgamestats = new System.Windows.Forms.Panel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.lblnextstats = new System.Windows.Forms.Label();
|
||||
this.Label7 = new System.Windows.Forms.Label();
|
||||
this.lblpreviousstats = new System.Windows.Forms.Label();
|
||||
this.Label4 = new System.Windows.Forms.Label();
|
||||
this.btnplayon = new System.Windows.Forms.Button();
|
||||
this.Label3 = new System.Windows.Forms.Label();
|
||||
this.btncashout = new System.Windows.Forms.Button();
|
||||
this.Label2 = new System.Windows.Forms.Label();
|
||||
this.lbllevelreached = new System.Windows.Forms.Label();
|
||||
this.pnlhighscore = new System.Windows.Forms.Panel();
|
||||
this.lbhighscore = new System.Windows.Forms.ListBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.pnlfinalstats = new System.Windows.Forms.Panel();
|
||||
this.btnplayagain = new System.Windows.Forms.Button();
|
||||
this.lblfinalcodepoints = new System.Windows.Forms.Label();
|
||||
this.Label11 = new System.Windows.Forms.Label();
|
||||
this.lblfinalcomputerreward = new System.Windows.Forms.Label();
|
||||
this.Label9 = new System.Windows.Forms.Label();
|
||||
this.lblfinallevelreward = new System.Windows.Forms.Label();
|
||||
this.lblfinallevelreached = new System.Windows.Forms.Label();
|
||||
this.lblfinalcodepointswithtext = new System.Windows.Forms.Label();
|
||||
this.pnllose = new System.Windows.Forms.Panel();
|
||||
this.lblmissedout = new System.Windows.Forms.Label();
|
||||
this.lblbutyougained = new System.Windows.Forms.Label();
|
||||
this.btnlosetryagain = new System.Windows.Forms.Button();
|
||||
this.Label5 = new System.Windows.Forms.Label();
|
||||
this.Label1 = new System.Windows.Forms.Label();
|
||||
this.pnlintro = new System.Windows.Forms.Panel();
|
||||
this.Label6 = new System.Windows.Forms.Label();
|
||||
this.btnstartgame = new System.Windows.Forms.Button();
|
||||
this.Label8 = new System.Windows.Forms.Label();
|
||||
this.lblbeatai = new System.Windows.Forms.Label();
|
||||
this.lblcountdown = new System.Windows.Forms.Label();
|
||||
this.ball = new ShiftOS.WinForms.Controls.Canvas();
|
||||
this.paddleHuman = new System.Windows.Forms.PictureBox();
|
||||
this.paddleComputer = new System.Windows.Forms.Panel();
|
||||
this.lbllevelandtime = new System.Windows.Forms.Label();
|
||||
this.lblstatscodepoints = new System.Windows.Forms.Label();
|
||||
this.lblstatsY = new System.Windows.Forms.Label();
|
||||
this.lblstatsX = new System.Windows.Forms.Label();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.pgcontents.SuspendLayout();
|
||||
this.pnlgamestats.SuspendLayout();
|
||||
this.pnlhighscore.SuspendLayout();
|
||||
this.pnlfinalstats.SuspendLayout();
|
||||
this.pnllose.SuspendLayout();
|
||||
this.pnlintro.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).BeginInit();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// gameTimer
|
||||
//
|
||||
this.gameTimer.Interval = 30;
|
||||
this.gameTimer.Tick += new System.EventHandler(this.gameTimer_Tick);
|
||||
//
|
||||
// counter
|
||||
//
|
||||
this.counter.Interval = 1000;
|
||||
this.counter.Tick += new System.EventHandler(this.counter_Tick);
|
||||
//
|
||||
// tmrcountdown
|
||||
//
|
||||
this.tmrcountdown.Interval = 1000;
|
||||
this.tmrcountdown.Tick += new System.EventHandler(this.countdown_Tick);
|
||||
//
|
||||
// tmrstoryline
|
||||
//
|
||||
this.tmrstoryline.Interval = 1000;
|
||||
this.tmrstoryline.Tick += new System.EventHandler(this.tmrstoryline_Tick);
|
||||
//
|
||||
// pgcontents
|
||||
//
|
||||
this.pgcontents.BackColor = System.Drawing.Color.White;
|
||||
this.pgcontents.Controls.Add(this.pnlhighscore);
|
||||
this.pgcontents.Controls.Add(this.pnlgamestats);
|
||||
this.pgcontents.Controls.Add(this.pnlfinalstats);
|
||||
this.pgcontents.Controls.Add(this.pnllose);
|
||||
this.pgcontents.Controls.Add(this.pnlintro);
|
||||
this.pgcontents.Controls.Add(this.lblbeatai);
|
||||
this.pgcontents.Controls.Add(this.lblcountdown);
|
||||
this.pgcontents.Controls.Add(this.ball);
|
||||
this.pgcontents.Controls.Add(this.paddleHuman);
|
||||
this.pgcontents.Controls.Add(this.paddleComputer);
|
||||
this.pgcontents.Controls.Add(this.lbllevelandtime);
|
||||
this.pgcontents.Controls.Add(this.lblstatscodepoints);
|
||||
this.pgcontents.Controls.Add(this.lblstatsY);
|
||||
this.pgcontents.Controls.Add(this.lblstatsX);
|
||||
this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pgcontents.Location = new System.Drawing.Point(0, 0);
|
||||
this.pgcontents.Name = "pgcontents";
|
||||
this.pgcontents.Size = new System.Drawing.Size(700, 400);
|
||||
this.pgcontents.TabIndex = 20;
|
||||
this.pgcontents.Paint += new System.Windows.Forms.PaintEventHandler(this.pgcontents_Paint);
|
||||
this.pgcontents.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove);
|
||||
//
|
||||
// pnlgamestats
|
||||
//
|
||||
this.pnlgamestats.Controls.Add(this.button1);
|
||||
this.pnlgamestats.Controls.Add(this.label12);
|
||||
this.pnlgamestats.Controls.Add(this.lblnextstats);
|
||||
this.pnlgamestats.Controls.Add(this.Label7);
|
||||
this.pnlgamestats.Controls.Add(this.lblpreviousstats);
|
||||
this.pnlgamestats.Controls.Add(this.Label4);
|
||||
this.pnlgamestats.Controls.Add(this.btnplayon);
|
||||
this.pnlgamestats.Controls.Add(this.Label3);
|
||||
this.pnlgamestats.Controls.Add(this.btncashout);
|
||||
this.pnlgamestats.Controls.Add(this.Label2);
|
||||
this.pnlgamestats.Controls.Add(this.lbllevelreached);
|
||||
this.pnlgamestats.Location = new System.Drawing.Point(56, 76);
|
||||
this.pnlgamestats.Name = "pnlgamestats";
|
||||
this.pnlgamestats.Size = new System.Drawing.Size(466, 284);
|
||||
this.pnlgamestats.TabIndex = 6;
|
||||
this.pnlgamestats.Visible = false;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button1.Location = new System.Drawing.Point(32, 223);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(191, 35);
|
||||
this.button1.TabIndex = 10;
|
||||
this.button1.Text = "{PONG_VIEW_HIGHSCORES}";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.btnhighscore_Click);
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label12.Location = new System.Drawing.Point(8, 187);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(245, 33);
|
||||
this.label12.TabIndex = 9;
|
||||
this.label12.Text = "{PONG_HIGHSCORE_EXP}";
|
||||
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblnextstats
|
||||
//
|
||||
this.lblnextstats.AutoSize = true;
|
||||
this.lblnextstats.Location = new System.Drawing.Point(278, 136);
|
||||
this.lblnextstats.Name = "lblnextstats";
|
||||
this.lblnextstats.Size = new System.Drawing.Size(0, 13);
|
||||
this.lblnextstats.TabIndex = 8;
|
||||
//
|
||||
// Label7
|
||||
//
|
||||
this.Label7.AutoSize = true;
|
||||
this.Label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label7.Location = new System.Drawing.Point(278, 119);
|
||||
this.Label7.Name = "Label7";
|
||||
this.Label7.Size = new System.Drawing.Size(124, 16);
|
||||
this.Label7.TabIndex = 7;
|
||||
this.Label7.Text = "Next Level Stats:";
|
||||
//
|
||||
// lblpreviousstats
|
||||
//
|
||||
this.lblpreviousstats.AutoSize = true;
|
||||
this.lblpreviousstats.Location = new System.Drawing.Point(278, 54);
|
||||
this.lblpreviousstats.Name = "lblpreviousstats";
|
||||
this.lblpreviousstats.Size = new System.Drawing.Size(0, 13);
|
||||
this.lblpreviousstats.TabIndex = 6;
|
||||
//
|
||||
// Label4
|
||||
//
|
||||
this.Label4.AutoSize = true;
|
||||
this.Label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label4.Location = new System.Drawing.Point(278, 37);
|
||||
this.Label4.Name = "Label4";
|
||||
this.Label4.Size = new System.Drawing.Size(154, 16);
|
||||
this.Label4.TabIndex = 5;
|
||||
this.Label4.Text = "Previous Level Stats:";
|
||||
//
|
||||
// btnplayon
|
||||
//
|
||||
this.btnplayon.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnplayon.Location = new System.Drawing.Point(32, 147);
|
||||
this.btnplayon.Name = "btnplayon";
|
||||
this.btnplayon.Size = new System.Drawing.Size(191, 35);
|
||||
this.btnplayon.TabIndex = 4;
|
||||
this.btnplayon.Text = "Play on for 3 codepoints!";
|
||||
this.btnplayon.UseVisualStyleBackColor = true;
|
||||
this.btnplayon.Click += new System.EventHandler(this.btnplayon_Click);
|
||||
//
|
||||
// Label3
|
||||
//
|
||||
this.Label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label3.Location = new System.Drawing.Point(8, 111);
|
||||
this.Label3.Name = "Label3";
|
||||
this.Label3.Size = new System.Drawing.Size(245, 33);
|
||||
this.Label3.TabIndex = 3;
|
||||
this.Label3.Text = "{PONG_PLAYON_DESC}";
|
||||
this.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btncashout
|
||||
//
|
||||
this.btncashout.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btncashout.Location = new System.Drawing.Point(32, 73);
|
||||
this.btncashout.Name = "btncashout";
|
||||
this.btncashout.Size = new System.Drawing.Size(191, 35);
|
||||
this.btncashout.TabIndex = 2;
|
||||
this.btncashout.Text = "Cash out with 1 codepoint!";
|
||||
this.btncashout.UseVisualStyleBackColor = true;
|
||||
this.btncashout.Click += new System.EventHandler(this.btncashout_Click);
|
||||
//
|
||||
// Label2
|
||||
//
|
||||
this.Label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label2.Location = new System.Drawing.Point(8, 37);
|
||||
this.Label2.Name = "Label2";
|
||||
this.Label2.Size = new System.Drawing.Size(245, 33);
|
||||
this.Label2.TabIndex = 1;
|
||||
this.Label2.Text = "{PONG_CASHOUT_DESC}";
|
||||
this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lbllevelreached
|
||||
//
|
||||
this.lbllevelreached.AutoSize = true;
|
||||
this.lbllevelreached.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbllevelreached.Location = new System.Drawing.Point(149, 6);
|
||||
this.lbllevelreached.Name = "lbllevelreached";
|
||||
this.lbllevelreached.Size = new System.Drawing.Size(185, 20);
|
||||
this.lbllevelreached.TabIndex = 0;
|
||||
this.lbllevelreached.Text = "You Reached Level 2!";
|
||||
//
|
||||
// pnlhighscore
|
||||
//
|
||||
this.pnlhighscore.Controls.Add(this.lbhighscore);
|
||||
this.pnlhighscore.Controls.Add(this.flowLayoutPanel1);
|
||||
this.pnlhighscore.Controls.Add(this.label10);
|
||||
this.pnlhighscore.Location = new System.Drawing.Point(67, 29);
|
||||
this.pnlhighscore.Name = "pnlhighscore";
|
||||
this.pnlhighscore.Size = new System.Drawing.Size(539, 311);
|
||||
this.pnlhighscore.TabIndex = 14;
|
||||
this.pnlhighscore.Visible = false;
|
||||
//
|
||||
// lbhighscore
|
||||
//
|
||||
this.lbhighscore.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbhighscore.FormattingEnabled = true;
|
||||
this.lbhighscore.Location = new System.Drawing.Point(0, 36);
|
||||
this.lbhighscore.MultiColumn = true;
|
||||
this.lbhighscore.Name = "lbhighscore";
|
||||
this.lbhighscore.SelectionMode = System.Windows.Forms.SelectionMode.None;
|
||||
this.lbhighscore.Size = new System.Drawing.Size(539, 246);
|
||||
this.lbhighscore.TabIndex = 1;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.label10.Location = new System.Drawing.Point(0, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(539, 36);
|
||||
this.label10.TabIndex = 0;
|
||||
this.label10.Text = "{HIGH_SCORES}";
|
||||
this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// pnlfinalstats
|
||||
//
|
||||
this.pnlfinalstats.Controls.Add(this.btnplayagain);
|
||||
this.pnlfinalstats.Controls.Add(this.lblfinalcodepoints);
|
||||
this.pnlfinalstats.Controls.Add(this.Label11);
|
||||
this.pnlfinalstats.Controls.Add(this.lblfinalcomputerreward);
|
||||
this.pnlfinalstats.Controls.Add(this.Label9);
|
||||
this.pnlfinalstats.Controls.Add(this.lblfinallevelreward);
|
||||
this.pnlfinalstats.Controls.Add(this.lblfinallevelreached);
|
||||
this.pnlfinalstats.Controls.Add(this.lblfinalcodepointswithtext);
|
||||
this.pnlfinalstats.Location = new System.Drawing.Point(172, 74);
|
||||
this.pnlfinalstats.Name = "pnlfinalstats";
|
||||
this.pnlfinalstats.Size = new System.Drawing.Size(362, 226);
|
||||
this.pnlfinalstats.TabIndex = 9;
|
||||
this.pnlfinalstats.Visible = false;
|
||||
//
|
||||
// btnplayagain
|
||||
//
|
||||
this.btnplayagain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnplayagain.Location = new System.Drawing.Point(5, 194);
|
||||
this.btnplayagain.Name = "btnplayagain";
|
||||
this.btnplayagain.Size = new System.Drawing.Size(352, 29);
|
||||
this.btnplayagain.TabIndex = 16;
|
||||
this.btnplayagain.Text = "{PLAY}";
|
||||
this.btnplayagain.UseVisualStyleBackColor = true;
|
||||
this.btnplayagain.Click += new System.EventHandler(this.btnplayagain_Click);
|
||||
//
|
||||
// lblfinalcodepoints
|
||||
//
|
||||
this.lblfinalcodepoints.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblfinalcodepoints.Location = new System.Drawing.Point(3, 124);
|
||||
this.lblfinalcodepoints.Name = "lblfinalcodepoints";
|
||||
this.lblfinalcodepoints.Size = new System.Drawing.Size(356, 73);
|
||||
this.lblfinalcodepoints.TabIndex = 15;
|
||||
this.lblfinalcodepoints.Text = "134 CP";
|
||||
this.lblfinalcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// Label11
|
||||
//
|
||||
this.Label11.AutoSize = true;
|
||||
this.Label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label11.Location = new System.Drawing.Point(162, 82);
|
||||
this.Label11.Name = "Label11";
|
||||
this.Label11.Size = new System.Drawing.Size(33, 33);
|
||||
this.Label11.TabIndex = 14;
|
||||
this.Label11.Text = "+";
|
||||
this.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblfinalcomputerreward
|
||||
//
|
||||
this.lblfinalcomputerreward.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblfinalcomputerreward.Location = new System.Drawing.Point(193, 72);
|
||||
this.lblfinalcomputerreward.Name = "lblfinalcomputerreward";
|
||||
this.lblfinalcomputerreward.Size = new System.Drawing.Size(151, 52);
|
||||
this.lblfinalcomputerreward.TabIndex = 12;
|
||||
this.lblfinalcomputerreward.Text = "34";
|
||||
this.lblfinalcomputerreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// Label9
|
||||
//
|
||||
this.Label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label9.Location = new System.Drawing.Point(179, 31);
|
||||
this.Label9.Name = "Label9";
|
||||
this.Label9.Size = new System.Drawing.Size(180, 49);
|
||||
this.Label9.TabIndex = 11;
|
||||
this.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblfinallevelreward
|
||||
//
|
||||
this.lblfinallevelreward.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblfinallevelreward.Location = new System.Drawing.Point(12, 72);
|
||||
this.lblfinallevelreward.Name = "lblfinallevelreward";
|
||||
this.lblfinallevelreward.Size = new System.Drawing.Size(151, 52);
|
||||
this.lblfinallevelreward.TabIndex = 10;
|
||||
this.lblfinallevelreward.Text = "100";
|
||||
this.lblfinallevelreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblfinallevelreached
|
||||
//
|
||||
this.lblfinallevelreached.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblfinallevelreached.Location = new System.Drawing.Point(3, 31);
|
||||
this.lblfinallevelreached.Name = "lblfinallevelreached";
|
||||
this.lblfinallevelreached.Size = new System.Drawing.Size(170, 49);
|
||||
this.lblfinallevelreached.TabIndex = 9;
|
||||
this.lblfinallevelreached.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblfinalcodepointswithtext
|
||||
//
|
||||
this.lblfinalcodepointswithtext.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblfinalcodepointswithtext.Location = new System.Drawing.Point(3, 2);
|
||||
this.lblfinalcodepointswithtext.Name = "lblfinalcodepointswithtext";
|
||||
this.lblfinalcodepointswithtext.Size = new System.Drawing.Size(356, 26);
|
||||
this.lblfinalcodepointswithtext.TabIndex = 1;
|
||||
this.lblfinalcodepointswithtext.Text = "You cashed out with 134 codepoints!";
|
||||
this.lblfinalcodepointswithtext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// pnllose
|
||||
//
|
||||
this.pnllose.Controls.Add(this.lblmissedout);
|
||||
this.pnllose.Controls.Add(this.lblbutyougained);
|
||||
this.pnllose.Controls.Add(this.btnlosetryagain);
|
||||
this.pnllose.Controls.Add(this.Label5);
|
||||
this.pnllose.Controls.Add(this.Label1);
|
||||
this.pnllose.Location = new System.Drawing.Point(209, 71);
|
||||
this.pnllose.Name = "pnllose";
|
||||
this.pnllose.Size = new System.Drawing.Size(266, 214);
|
||||
this.pnllose.TabIndex = 10;
|
||||
this.pnllose.Visible = false;
|
||||
//
|
||||
// lblmissedout
|
||||
//
|
||||
this.lblmissedout.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblmissedout.Location = new System.Drawing.Point(3, 175);
|
||||
this.lblmissedout.Name = "lblmissedout";
|
||||
this.lblmissedout.Size = new System.Drawing.Size(146, 35);
|
||||
this.lblmissedout.TabIndex = 3;
|
||||
this.lblmissedout.Text = "You Missed Out On: 500 Codepoints";
|
||||
this.lblmissedout.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblbutyougained
|
||||
//
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2"))
|
||||
{
|
||||
this.lblbutyougained.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblbutyougained.Location = new System.Drawing.Point(3, 125);
|
||||
this.lblbutyougained.Name = "lblbutyougained";
|
||||
this.lblbutyougained.Size = new System.Drawing.Size(146, 35);
|
||||
this.lblbutyougained.TabIndex = 3;
|
||||
this.lblbutyougained.Text = "But you gained 5 Codepoints";
|
||||
this.lblbutyougained.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
} else
|
||||
{
|
||||
this.lblbutyougained.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblbutyougained.Location = new System.Drawing.Point(3, 125);
|
||||
this.lblbutyougained.Name = "lblbutyougained";
|
||||
this.lblbutyougained.Size = new System.Drawing.Size(0, 0);
|
||||
this.lblbutyougained.TabIndex = 3;
|
||||
this.lblbutyougained.Text = "But you gained 5 Codepoints";
|
||||
this.lblbutyougained.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
}
|
||||
//
|
||||
// btnlosetryagain
|
||||
//
|
||||
this.btnlosetryagain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnlosetryagain.Location = new System.Drawing.Point(155, 176);
|
||||
this.btnlosetryagain.Name = "btnlosetryagain";
|
||||
this.btnlosetryagain.Size = new System.Drawing.Size(106, 35);
|
||||
this.btnlosetryagain.TabIndex = 2;
|
||||
this.btnlosetryagain.Text = "Try Again";
|
||||
this.btnlosetryagain.UseVisualStyleBackColor = true;
|
||||
this.btnlosetryagain.Click += new System.EventHandler(this.btnlosetryagain_Click);
|
||||
//
|
||||
// Label5
|
||||
//
|
||||
this.Label5.Location = new System.Drawing.Point(7, 26);
|
||||
this.Label5.Name = "Label5";
|
||||
this.Label5.Size = new System.Drawing.Size(260, 163);
|
||||
this.Label5.TabIndex = 1;
|
||||
//
|
||||
// Label1
|
||||
//
|
||||
this.Label1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.Label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label1.Location = new System.Drawing.Point(0, 0);
|
||||
this.Label1.Name = "Label1";
|
||||
this.Label1.Size = new System.Drawing.Size(266, 16);
|
||||
this.Label1.TabIndex = 0;
|
||||
this.Label1.Text = "You lose!";
|
||||
this.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// pnlintro
|
||||
//
|
||||
this.pnlintro.Controls.Add(this.Label6);
|
||||
this.pnlintro.Controls.Add(this.btnstartgame);
|
||||
this.pnlintro.Controls.Add(this.Label8);
|
||||
this.pnlintro.Location = new System.Drawing.Point(52, 29);
|
||||
this.pnlintro.Name = "pnlintro";
|
||||
this.pnlintro.Size = new System.Drawing.Size(595, 303);
|
||||
this.pnlintro.TabIndex = 13;
|
||||
//
|
||||
// Label6
|
||||
//
|
||||
this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label6.Location = new System.Drawing.Point(3, 39);
|
||||
this.Label6.Name = "Label6";
|
||||
this.Label6.Size = new System.Drawing.Size(589, 227);
|
||||
this.Label6.TabIndex = 15;
|
||||
this.Label6.Text = "{PONG_DESC}";
|
||||
this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.Label6.Click += new System.EventHandler(this.Label6_Click);
|
||||
//
|
||||
// btnstartgame
|
||||
//
|
||||
this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnstartgame.Location = new System.Drawing.Point(186, 273);
|
||||
this.btnstartgame.Name = "btnstartgame";
|
||||
this.btnstartgame.Size = new System.Drawing.Size(242, 28);
|
||||
this.btnstartgame.TabIndex = 15;
|
||||
this.btnstartgame.Text = "{PLAY}";
|
||||
this.btnstartgame.UseVisualStyleBackColor = true;
|
||||
this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click);
|
||||
//
|
||||
// Label8
|
||||
//
|
||||
this.Label8.AutoSize = true;
|
||||
this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Label8.ForeColor = System.Drawing.Color.Black;
|
||||
this.Label8.Location = new System.Drawing.Point(250, 5);
|
||||
this.Label8.Name = "Label8";
|
||||
this.Label8.Size = new System.Drawing.Size(280, 31);
|
||||
this.Label8.TabIndex = 14;
|
||||
this.Label8.Text = "{PONG_WELCOME}";
|
||||
this.Label8.Click += new System.EventHandler(this.Label8_Click);
|
||||
//
|
||||
// lblbeatai
|
||||
//
|
||||
this.lblbeatai.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblbeatai.Location = new System.Drawing.Point(47, 41);
|
||||
this.lblbeatai.Name = "lblbeatai";
|
||||
this.lblbeatai.Size = new System.Drawing.Size(600, 30);
|
||||
this.lblbeatai.TabIndex = 8;
|
||||
this.lblbeatai.Text = "You got 2 codepoints for beating the Computer!";
|
||||
this.lblbeatai.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblbeatai.Visible = false;
|
||||
//
|
||||
// lblcountdown
|
||||
//
|
||||
this.lblcountdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblcountdown.Location = new System.Drawing.Point(182, 152);
|
||||
this.lblcountdown.Name = "lblcountdown";
|
||||
this.lblcountdown.Size = new System.Drawing.Size(315, 49);
|
||||
this.lblcountdown.TabIndex = 7;
|
||||
this.lblcountdown.Text = "3";
|
||||
this.lblcountdown.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblcountdown.Visible = false;
|
||||
//
|
||||
// ball
|
||||
//
|
||||
this.ball.BackColor = System.Drawing.Color.Black;
|
||||
this.ball.Location = new System.Drawing.Point(300, 152);
|
||||
this.ball.Name = "ball";
|
||||
this.ball.Size = new System.Drawing.Size(20, 20);
|
||||
this.ball.TabIndex = 2;
|
||||
this.ball.MouseEnter += new System.EventHandler(this.ball_MouseEnter);
|
||||
this.ball.MouseLeave += new System.EventHandler(this.ball_MouseLeave);
|
||||
//
|
||||
// paddleHuman
|
||||
//
|
||||
this.paddleHuman.BackColor = System.Drawing.Color.Black;
|
||||
this.paddleHuman.Location = new System.Drawing.Point(10, 134);
|
||||
this.paddleHuman.Name = "paddleHuman";
|
||||
this.paddleHuman.Size = new System.Drawing.Size(20, 100);
|
||||
this.paddleHuman.TabIndex = 3;
|
||||
this.paddleHuman.TabStop = false;
|
||||
//
|
||||
// paddleComputer
|
||||
//
|
||||
this.paddleComputer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.paddleComputer.BackColor = System.Drawing.Color.Black;
|
||||
this.paddleComputer.Location = new System.Drawing.Point(666, 134);
|
||||
this.paddleComputer.MaximumSize = new System.Drawing.Size(20, 100);
|
||||
this.paddleComputer.Name = "paddleComputer";
|
||||
this.paddleComputer.Size = new System.Drawing.Size(20, 100);
|
||||
this.paddleComputer.TabIndex = 1;
|
||||
//
|
||||
// lbllevelandtime
|
||||
//
|
||||
this.lbllevelandtime.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.lbllevelandtime.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbllevelandtime.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbllevelandtime.Name = "lbllevelandtime";
|
||||
this.lbllevelandtime.Size = new System.Drawing.Size(700, 22);
|
||||
this.lbllevelandtime.TabIndex = 4;
|
||||
this.lbllevelandtime.Text = "Level: 1 - 58 Seconds Left";
|
||||
this.lbllevelandtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblstatscodepoints
|
||||
//
|
||||
this.lblstatscodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblstatscodepoints.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblstatscodepoints.Location = new System.Drawing.Point(239, 356);
|
||||
this.lblstatscodepoints.Name = "lblstatscodepoints";
|
||||
this.lblstatscodepoints.Size = new System.Drawing.Size(219, 35);
|
||||
this.lblstatscodepoints.TabIndex = 12;
|
||||
this.lblstatscodepoints.Text = "Codepoints: ";
|
||||
this.lblstatscodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblstatsY
|
||||
//
|
||||
this.lblstatsY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblstatsY.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblstatsY.Location = new System.Drawing.Point(542, 356);
|
||||
this.lblstatsY.Name = "lblstatsY";
|
||||
this.lblstatsY.Size = new System.Drawing.Size(144, 35);
|
||||
this.lblstatsY.TabIndex = 11;
|
||||
this.lblstatsY.Text = "Yspeed:";
|
||||
this.lblstatsY.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblstatsX
|
||||
//
|
||||
this.lblstatsX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblstatsX.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblstatsX.Location = new System.Drawing.Point(3, 356);
|
||||
this.lblstatsX.Name = "lblstatsX";
|
||||
this.lblstatsX.Size = new System.Drawing.Size(144, 35);
|
||||
this.lblstatsX.TabIndex = 5;
|
||||
this.lblstatsX.Text = "Xspeed: ";
|
||||
this.lblstatsX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.AutoSize = true;
|
||||
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flowLayoutPanel1.Controls.Add(this.button2);
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 282);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(539, 29);
|
||||
this.flowLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.AutoSize = true;
|
||||
this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.button2.Location = new System.Drawing.Point(476, 3);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(60, 23);
|
||||
this.button2.TabIndex = 0;
|
||||
this.button2.Text = "{CLOSE}";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// Pong
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.pgcontents);
|
||||
this.DoubleBuffered = true;
|
||||
this.Name = "Pong";
|
||||
this.Text = "{PONG_NAME}";
|
||||
this.Size = new System.Drawing.Size(820, 500);
|
||||
this.Load += new System.EventHandler(this.Pong_Load);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove);
|
||||
this.pgcontents.ResumeLayout(false);
|
||||
this.pnlgamestats.ResumeLayout(false);
|
||||
this.pnlgamestats.PerformLayout();
|
||||
this.pnlhighscore.ResumeLayout(false);
|
||||
this.pnlhighscore.PerformLayout();
|
||||
this.pnlfinalstats.ResumeLayout(false);
|
||||
this.pnlfinalstats.PerformLayout();
|
||||
this.pnllose.ResumeLayout(false);
|
||||
this.pnlintro.ResumeLayout(false);
|
||||
this.pnlintro.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).EndInit();
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.flowLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
internal System.Windows.Forms.Panel paddleComputer;
|
||||
internal System.Windows.Forms.Timer gameTimer;
|
||||
internal System.Windows.Forms.PictureBox paddleHuman;
|
||||
internal System.Windows.Forms.Label lbllevelandtime;
|
||||
internal System.Windows.Forms.Label lblstatsX;
|
||||
internal System.Windows.Forms.Timer counter;
|
||||
internal System.Windows.Forms.Panel pnlgamestats;
|
||||
internal System.Windows.Forms.Label lblnextstats;
|
||||
internal System.Windows.Forms.Label Label7;
|
||||
internal System.Windows.Forms.Label lblpreviousstats;
|
||||
internal System.Windows.Forms.Label Label4;
|
||||
internal System.Windows.Forms.Button btnplayon;
|
||||
internal System.Windows.Forms.Label Label3;
|
||||
internal System.Windows.Forms.Button btncashout;
|
||||
internal System.Windows.Forms.Label Label2;
|
||||
internal System.Windows.Forms.Label lbllevelreached;
|
||||
internal System.Windows.Forms.Label lblcountdown;
|
||||
internal System.Windows.Forms.Timer tmrcountdown;
|
||||
internal System.Windows.Forms.Label lblbeatai;
|
||||
internal System.Windows.Forms.Panel pnlfinalstats;
|
||||
internal System.Windows.Forms.Button btnplayagain;
|
||||
internal System.Windows.Forms.Label lblfinalcodepoints;
|
||||
internal System.Windows.Forms.Label Label11;
|
||||
internal System.Windows.Forms.Label lblfinalcomputerreward;
|
||||
internal System.Windows.Forms.Label Label9;
|
||||
internal System.Windows.Forms.Label lblfinallevelreward;
|
||||
internal System.Windows.Forms.Label lblfinallevelreached;
|
||||
internal System.Windows.Forms.Label lblfinalcodepointswithtext;
|
||||
internal System.Windows.Forms.Panel pnllose;
|
||||
internal System.Windows.Forms.Label lblmissedout;
|
||||
internal System.Windows.Forms.Label lblbutyougained;
|
||||
internal System.Windows.Forms.Button btnlosetryagain;
|
||||
internal System.Windows.Forms.Label Label5;
|
||||
internal System.Windows.Forms.Label Label1;
|
||||
internal System.Windows.Forms.Label lblstatscodepoints;
|
||||
internal System.Windows.Forms.Label lblstatsY;
|
||||
internal System.Windows.Forms.Panel pnlintro;
|
||||
internal System.Windows.Forms.Label Label6;
|
||||
internal System.Windows.Forms.Button btnstartgame;
|
||||
internal System.Windows.Forms.Label Label8;
|
||||
internal System.Windows.Forms.Timer tmrstoryline;
|
||||
private System.Windows.Forms.Panel pnlhighscore;
|
||||
private System.Windows.Forms.ListBox lbhighscore;
|
||||
private System.Windows.Forms.Label label10;
|
||||
internal Canvas pgcontents;
|
||||
internal Canvas ball;
|
||||
internal System.Windows.Forms.Button button1;
|
||||
internal System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
631
ShiftOS.WinForms/Applications/Pong.cs
Normal file
631
ShiftOS.WinForms/Applications/Pong.cs
Normal file
|
@ -0,0 +1,631 @@
|
|||
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 Newtonsoft.Json;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.Objects;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Pong", true, "al_pong")]
|
||||
[WinOpen("pong")]
|
||||
public partial class Pong : UserControl, IShiftOSWindow
|
||||
{
|
||||
int xVel = 7;
|
||||
int yVel = 8;
|
||||
int computerspeed = 8;
|
||||
int level = 1;
|
||||
int secondsleft = 60;
|
||||
int casualposition;
|
||||
double xveldec = 3.0;
|
||||
double yveldec = 3.0;
|
||||
double incrementx = 0.4;
|
||||
double incrementy = 0.2;
|
||||
int levelxspeed = 3;
|
||||
int levelyspeed = 3;
|
||||
int beatairewardtotal;
|
||||
int beataireward = 1;
|
||||
int[] levelrewards = new int[50];
|
||||
int totalreward;
|
||||
int countdown = 3;
|
||||
|
||||
bool aiShouldIsbeEnabled = true;
|
||||
|
||||
public Pong()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Pong_Load(object sender, EventArgs e)
|
||||
{
|
||||
setuplevelrewards();
|
||||
}
|
||||
|
||||
// Move the paddle according to the mouse position.
|
||||
private void pongMain_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var loc = this.PointToClient(MousePosition);
|
||||
paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2));
|
||||
}
|
||||
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void gameTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Left < Screen.PrimaryScreen.Bounds.Width)
|
||||
{
|
||||
ball.BackColor = SkinEngine.LoadedSkin.ControlTextColor;
|
||||
paddleComputer.BackColor = SkinEngine.LoadedSkin.ControlTextColor;
|
||||
paddleHuman.BackColor = SkinEngine.LoadedSkin.ControlTextColor;
|
||||
|
||||
|
||||
|
||||
//Set the computer player to move according to the ball's position.
|
||||
if(aiShouldIsbeEnabled)
|
||||
if (ball.Location.X > 500 - xVel * 10 && xVel > 0)
|
||||
{
|
||||
if (ball.Location.Y > paddleComputer.Location.Y + 50)
|
||||
{
|
||||
paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed);
|
||||
}
|
||||
if (ball.Location.Y < paddleComputer.Location.Y + 50)
|
||||
{
|
||||
paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed);
|
||||
}
|
||||
casualposition = rand.Next(-150, 201);
|
||||
}
|
||||
else
|
||||
{
|
||||
//used to be me.location.y
|
||||
if (paddleComputer.Location.Y > this.Size.Height / 2 - paddleComputer.Height + casualposition)
|
||||
{
|
||||
paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed);
|
||||
}
|
||||
//used to be me.location.y
|
||||
if (paddleComputer.Location.Y < this.Size.Height / 2 - paddleComputer.Height + casualposition)
|
||||
{
|
||||
paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed);
|
||||
}
|
||||
}
|
||||
|
||||
//Set Xvel and Yvel speeds from decimal
|
||||
if (xVel > 0)
|
||||
xVel = (int)Math.Round(xveldec);
|
||||
if (xVel < 0)
|
||||
xVel = (int)-Math.Round(xveldec);
|
||||
if (yVel > 0)
|
||||
yVel = (int)Math.Round(yveldec);
|
||||
if (yVel < 0)
|
||||
yVel = (int)-Math.Round(yveldec);
|
||||
|
||||
// Move the game ball.
|
||||
ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel);
|
||||
|
||||
// Check for top wall.
|
||||
if (ball.Location.Y < 0)
|
||||
{
|
||||
ball.Location = new Point(ball.Location.X, 0);
|
||||
yVel = -yVel;
|
||||
}
|
||||
|
||||
// Check for bottom wall.
|
||||
if (ball.Location.Y > pgcontents.Height - ball.Height)
|
||||
{
|
||||
ball.Location = new Point(ball.Location.X, pgcontents.Height - ball.Size.Height);
|
||||
yVel = -yVel;
|
||||
}
|
||||
|
||||
// Check for player paddle.
|
||||
if (ball.Bounds.IntersectsWith(paddleHuman.Bounds))
|
||||
{
|
||||
ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width, ball.Location.Y);
|
||||
//randomly increase x or y speed of ball
|
||||
switch (rand.Next(1, 3))
|
||||
{
|
||||
case 1:
|
||||
xveldec = xveldec + incrementx;
|
||||
break;
|
||||
case 2:
|
||||
if (yveldec > 0)
|
||||
yveldec = yveldec + incrementy;
|
||||
if (yveldec < 0)
|
||||
yveldec = yveldec - incrementy;
|
||||
break;
|
||||
}
|
||||
xVel = -xVel;
|
||||
}
|
||||
|
||||
// Check for computer paddle.
|
||||
if (ball.Bounds.IntersectsWith(paddleComputer.Bounds))
|
||||
{
|
||||
ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width + 1, ball.Location.Y);
|
||||
xveldec = xveldec + incrementx;
|
||||
xVel = -xVel;
|
||||
}
|
||||
|
||||
// Check for left wall.
|
||||
if (ball.Location.X < -100)
|
||||
{
|
||||
ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
|
||||
paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y);
|
||||
if (xVel > 0)
|
||||
xVel = -xVel;
|
||||
pnllose.Show();
|
||||
gameTimer.Stop();
|
||||
counter.Stop();
|
||||
lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}");
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2"))
|
||||
{
|
||||
totalreward = levelrewards[level - 1] + beatairewardtotal;
|
||||
double onePercent = (totalreward / 100);
|
||||
lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}"));
|
||||
SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100));
|
||||
}
|
||||
}
|
||||
|
||||
// Check for right wall.
|
||||
if (ball.Location.X > this.Width - ball.Size.Width - paddleComputer.Width + 100)
|
||||
{
|
||||
ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
|
||||
paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y);
|
||||
if (xVel > 0)
|
||||
xVel = -xVel;
|
||||
beatairewardtotal = beatairewardtotal + beataireward;
|
||||
lblbeatai.Show();
|
||||
lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD_SECONDARY}}: {beataireward}");
|
||||
tmrcountdown.Start();
|
||||
gameTimer.Stop();
|
||||
counter.Stop();
|
||||
}
|
||||
|
||||
//lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy
|
||||
lblstatsX.Text = Localization.Parse("{H_VEL}: ") + xveldec;
|
||||
lblstatsY.Text = Localization.Parse("{V_VEL}: ") + yveldec;
|
||||
lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString();
|
||||
lbllevelandtime.Text = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}");
|
||||
|
||||
if (xVel > 20 || xVel < -20)
|
||||
{
|
||||
paddleHuman.Width = Math.Abs(xVel);
|
||||
paddleComputer.Width = Math.Abs(xVel);
|
||||
}
|
||||
else
|
||||
{
|
||||
paddleHuman.Width = 20;
|
||||
paddleComputer.Width = 20;
|
||||
}
|
||||
|
||||
computerspeed = Math.Abs(yVel);
|
||||
|
||||
// pgcontents.Refresh()
|
||||
// pgcontents.CreateGraphics.FillRectangle(Brushes.Black, ball.Location.X, ball.Location.Y, ball.Width, ball.Height)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void counter_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Left < Screen.PrimaryScreen.Bounds.Width)
|
||||
{
|
||||
secondsleft = secondsleft - 1;
|
||||
if (secondsleft == -1)
|
||||
{
|
||||
secondsleft = 60;
|
||||
level = level + 1;
|
||||
generatenextlevel();
|
||||
pnlgamestats.Show();
|
||||
pnlgamestats.BringToFront();
|
||||
pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2));
|
||||
|
||||
counter.Stop();
|
||||
gameTimer.Stop();
|
||||
SendHighscores();
|
||||
}
|
||||
lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void SendHighscores()
|
||||
{
|
||||
var highscore = new PongHighscore
|
||||
{
|
||||
UserName = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}",
|
||||
HighestLevel = level,
|
||||
HighestCodepoints = totalreward
|
||||
};
|
||||
ServerManager.SendMessage("pong_sethighscore", JsonConvert.SerializeObject(highscore));
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void btnplayon_Click(object sender, EventArgs e)
|
||||
{
|
||||
xveldec = levelxspeed;
|
||||
yveldec = levelyspeed;
|
||||
|
||||
secondsleft = 60;
|
||||
|
||||
tmrcountdown.Start();
|
||||
lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD}}: {beataireward}");
|
||||
pnlgamestats.Hide();
|
||||
lblbeatai.Show();
|
||||
ball.Location = new Point(paddleHuman.Location.X + paddleHuman.Width + 50, paddleHuman.Location.Y + paddleHuman.Height / 2);
|
||||
if (xVel < 0)
|
||||
xVel = Math.Abs(xVel);
|
||||
lbllevelandtime.Text = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}");
|
||||
}
|
||||
|
||||
//Increase the ball speed stats for the next level
|
||||
private void generatenextlevel()
|
||||
{
|
||||
lbllevelreached.Text = Localization.Parse("{YOU_REACHED_LEVEL} " + level + "!");
|
||||
|
||||
lblpreviousstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy);
|
||||
|
||||
switch (rand.Next(1, 3))
|
||||
{
|
||||
case 1:
|
||||
levelxspeed = levelxspeed + 1;
|
||||
break;
|
||||
case 2:
|
||||
levelxspeed = levelxspeed + 2;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rand.Next(1, 3))
|
||||
{
|
||||
case 1:
|
||||
levelyspeed = levelyspeed + 1;
|
||||
break;
|
||||
case 2:
|
||||
levelyspeed = levelyspeed + 2;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rand.Next(1, 6))
|
||||
{
|
||||
case 1:
|
||||
incrementx = incrementx + 0.1;
|
||||
break;
|
||||
case 2:
|
||||
incrementx = incrementx + 0.2;
|
||||
break;
|
||||
case 3:
|
||||
incrementy = incrementy + 0.1;
|
||||
break;
|
||||
case 4:
|
||||
incrementy = incrementy + 0.2;
|
||||
break;
|
||||
case 5:
|
||||
incrementy = incrementy + 0.3;
|
||||
break;
|
||||
}
|
||||
|
||||
lblnextstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy);
|
||||
|
||||
if (level < 15)
|
||||
{
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade"))
|
||||
{
|
||||
beataireward = level * 10;
|
||||
} else
|
||||
{
|
||||
beataireward = level * 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade"))
|
||||
{
|
||||
double br = levelrewards[level - 1] / 10;
|
||||
beataireward = (int)Math.Round(br) * 10;
|
||||
} else
|
||||
{
|
||||
double br = levelrewards[level - 1] / 10;
|
||||
beataireward = (int)Math.Round(br) * 5;
|
||||
}
|
||||
}
|
||||
|
||||
totalreward = levelrewards[level - 1] + beatairewardtotal;
|
||||
|
||||
btncashout.Text = Localization.Parse("{CASH_OUT_WITH_CODEPOINTS}");
|
||||
btnplayon.Text = Localization.Parse("{PONG_PLAY_ON_FOR_MORE}");
|
||||
}
|
||||
|
||||
private void setuplevelrewards()
|
||||
{
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade"))
|
||||
{
|
||||
levelrewards[0] = 0;
|
||||
levelrewards[1] = 40;
|
||||
levelrewards[2] = 120;
|
||||
levelrewards[3] = 280;
|
||||
levelrewards[4] = 580;
|
||||
levelrewards[5] = 800;
|
||||
levelrewards[6] = 1200;
|
||||
levelrewards[7] = 1800;
|
||||
levelrewards[8] = 2400;
|
||||
levelrewards[9] = 3200;
|
||||
levelrewards[10] = 4000;
|
||||
levelrewards[11] = 5000;
|
||||
levelrewards[12] = 6000;
|
||||
levelrewards[13] = 8000;
|
||||
levelrewards[14] = 10000;
|
||||
levelrewards[15] = 12000;
|
||||
levelrewards[16] = 16000;
|
||||
levelrewards[17] = 20000;
|
||||
levelrewards[18] = 26000;
|
||||
levelrewards[19] = 32000;
|
||||
levelrewards[20] = 40000;
|
||||
levelrewards[21] = 50000;
|
||||
levelrewards[22] = 64000;
|
||||
levelrewards[23] = 80000;
|
||||
levelrewards[24] = 100000;
|
||||
levelrewards[25] = 120000;
|
||||
levelrewards[26] = 150000;
|
||||
levelrewards[27] = 180000;
|
||||
levelrewards[28] = 220000;
|
||||
levelrewards[29] = 280000;
|
||||
levelrewards[30] = 360000;
|
||||
levelrewards[31] = 440000;
|
||||
levelrewards[32] = 540000;
|
||||
levelrewards[33] = 640000;
|
||||
levelrewards[34] = 800000;
|
||||
levelrewards[35] = 1000000;
|
||||
levelrewards[36] = 1280000;
|
||||
levelrewards[37] = 1600000;
|
||||
levelrewards[38] = 2000000;
|
||||
levelrewards[39] = 3000000;
|
||||
levelrewards[40] = 4000000;
|
||||
} else
|
||||
{
|
||||
levelrewards[0] = 0;
|
||||
levelrewards[1] = 20;
|
||||
levelrewards[2] = 60;
|
||||
levelrewards[3] = 140;
|
||||
levelrewards[4] = 290;
|
||||
levelrewards[5] = 400;
|
||||
levelrewards[6] = 600;
|
||||
levelrewards[7] = 900;
|
||||
levelrewards[8] = 1200;
|
||||
levelrewards[9] = 1600;
|
||||
levelrewards[10] = 2000;
|
||||
levelrewards[11] = 2500;
|
||||
levelrewards[12] = 3000;
|
||||
levelrewards[13] = 4000;
|
||||
levelrewards[14] = 5000;
|
||||
levelrewards[15] = 6000;
|
||||
levelrewards[16] = 8000;
|
||||
levelrewards[17] = 10000;
|
||||
levelrewards[18] = 13000;
|
||||
levelrewards[19] = 16000;
|
||||
levelrewards[20] = 20000;
|
||||
levelrewards[21] = 25000;
|
||||
levelrewards[22] = 32000;
|
||||
levelrewards[23] = 40000;
|
||||
levelrewards[24] = 50000;
|
||||
levelrewards[25] = 60000;
|
||||
levelrewards[26] = 75000;
|
||||
levelrewards[27] = 90000;
|
||||
levelrewards[28] = 110000;
|
||||
levelrewards[29] = 140000;
|
||||
levelrewards[30] = 180000;
|
||||
levelrewards[31] = 220000;
|
||||
levelrewards[32] = 270000;
|
||||
levelrewards[33] = 320000;
|
||||
levelrewards[34] = 400000;
|
||||
levelrewards[35] = 500000;
|
||||
levelrewards[36] = 640000;
|
||||
levelrewards[37] = 800000;
|
||||
levelrewards[38] = 1000000;
|
||||
levelrewards[39] = 1500000;
|
||||
levelrewards[40] = 2000000;
|
||||
}
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void countdown_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Left < Screen.PrimaryScreen.Bounds.Width)
|
||||
{
|
||||
switch (countdown)
|
||||
{
|
||||
case 0:
|
||||
countdown = 3;
|
||||
lblcountdown.Hide();
|
||||
lblbeatai.Hide();
|
||||
gameTimer.Start();
|
||||
counter.Start();
|
||||
tmrcountdown.Stop();
|
||||
break;
|
||||
case 1:
|
||||
lblcountdown.Text = "1";
|
||||
countdown = countdown - 1;
|
||||
break;
|
||||
case 2:
|
||||
lblcountdown.Text = "2";
|
||||
countdown = countdown - 1;
|
||||
break;
|
||||
case 3:
|
||||
lblcountdown.Text = "3";
|
||||
countdown = countdown - 1;
|
||||
lblcountdown.Show();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void btncashout_Click(object sender, EventArgs e)
|
||||
{
|
||||
pnlgamestats.Hide();
|
||||
pnlfinalstats.Show();
|
||||
lblfinalcodepointswithtext.Text = Localization.Parse("{YOU_WON} " + totalreward + " {CODEPOINTS}!");
|
||||
lblfinallevelreached.Text = Localization.Parse("{CODEPOINTS_FOR_BEATING_LEVEL}: ") + (level - 1).ToString();
|
||||
lblfinallevelreward.Text = levelrewards[level - 1].ToString();
|
||||
lblfinalcomputerreward.Text = beatairewardtotal.ToString();
|
||||
lblfinalcodepoints.Text = totalreward + Localization.Parse(" {CODEPOINTS_SHORT}");
|
||||
SaveSystem.TransferCodepointsFrom("pong", totalreward);
|
||||
}
|
||||
|
||||
private void newgame()
|
||||
{
|
||||
pnlfinalstats.Hide();
|
||||
pnllose.Hide();
|
||||
pnlintro.Hide();
|
||||
|
||||
level = 1;
|
||||
totalreward = 0;
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade"))
|
||||
{
|
||||
beataireward = 10;
|
||||
} else
|
||||
{
|
||||
beataireward = 5;
|
||||
}
|
||||
beatairewardtotal = 0;
|
||||
secondsleft = 60;
|
||||
lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ");
|
||||
//reset stats text
|
||||
lblstatsX.Text = Localization.Parse("{H_VEL}: ");
|
||||
lblstatsY.Text = Localization.Parse("{V_VEL}: ");
|
||||
|
||||
levelxspeed = 3;
|
||||
levelyspeed = 3;
|
||||
|
||||
incrementx = 0.4;
|
||||
incrementy = 0.2;
|
||||
|
||||
xveldec = levelxspeed;
|
||||
yveldec = levelyspeed;
|
||||
|
||||
tmrcountdown.Start();
|
||||
lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD}}: {beataireward}");
|
||||
pnlgamestats.Hide();
|
||||
lblbeatai.Show();
|
||||
ball.Location = new Point(paddleHuman.Location.X + paddleHuman.Width + 50, (paddleHuman.Location.Y + paddleHuman.Height) / 2);
|
||||
if (xVel < 0)
|
||||
xVel = Math.Abs(xVel);
|
||||
lbllevelandtime.Text = Localization.Parse("{{LEVEL}}: " + level + " - " + secondsleft + " {SECONDS_LEFT}");
|
||||
}
|
||||
|
||||
public void btnhighscore_Click(object s, EventArgs a)
|
||||
{
|
||||
pnlhighscore.BringToFront();
|
||||
SetupHighScores();
|
||||
}
|
||||
|
||||
public void SetupHighScores()
|
||||
{
|
||||
lbhighscore.Items.Clear();
|
||||
ServerManager.MessageReceived += (msg) =>
|
||||
{
|
||||
if(msg.Name == "pong_highscores")
|
||||
{
|
||||
var hs = JsonConvert.DeserializeObject<List<PongHighscore>>(msg.Contents);
|
||||
|
||||
var orderedhs = hs.OrderByDescending(i => i.HighestLevel);
|
||||
|
||||
foreach(var score in orderedhs)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
lbhighscore.Items.Add($"{score.UserName}\t\t\t{score.HighestLevel}\t\t{score.HighestCodepoints} CP");
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
ServerManager.SendMessage("pong_gethighscores", null);
|
||||
pnlhighscore.Show();
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void btnplayagain_Click(object sender, EventArgs e)
|
||||
{
|
||||
newgame();
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void btnlosetryagain_Click(object sender, EventArgs e)
|
||||
{
|
||||
newgame();
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void btnstartgame_Click(object sender, EventArgs e)
|
||||
{
|
||||
newgame();
|
||||
}
|
||||
|
||||
Random rand = new Random();
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void tmrstoryline_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Random chance of showing getshiftnet storyline
|
||||
int i = rand.Next(0, 100);
|
||||
|
||||
if (i >= 25 && i <= 50)
|
||||
{
|
||||
tmrstoryline.Stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ERROR: Handles clauses are not supported in C#
|
||||
private void me_closing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
tmrstoryline.Stop();
|
||||
}
|
||||
|
||||
private void Label6_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Label8_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void pgcontents_Paint(object sender, PaintEventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void ball_MouseEnter(object sender, EventArgs e) {
|
||||
aiShouldIsbeEnabled = false;
|
||||
}
|
||||
|
||||
private void ball_MouseLeave(object sender, EventArgs e) {
|
||||
aiShouldIsbeEnabled = true;
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
pnlhighscore.Hide();
|
||||
}
|
||||
}
|
||||
}
|
132
ShiftOS.WinForms/Applications/Pong.resx
Normal file
132
ShiftOS.WinForms/Applications/Pong.resx
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?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="gameTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>227, 17</value>
|
||||
</metadata>
|
||||
<metadata name="counter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>134, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tmrcountdown.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>340, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tmrstoryline.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
164
ShiftOS.WinForms/Applications/Shifter.Designer.cs
generated
Normal file
164
ShiftOS.WinForms/Applications/Shifter.Designer.cs
generated
Normal file
|
@ -0,0 +1,164 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class Shifter
|
||||
{
|
||||
/// <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.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
this.flbody = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flcategory = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.flmeta = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnapply = new System.Windows.Forms.Button();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel4.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.panel4);
|
||||
this.panel1.Controls.Add(this.panel3);
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(893, 539);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// panel4
|
||||
//
|
||||
this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel4.Controls.Add(this.flbody);
|
||||
this.panel4.Controls.Add(this.flcategory);
|
||||
this.panel4.Location = new System.Drawing.Point(154, 283);
|
||||
this.panel4.Name = "panel4";
|
||||
this.panel4.Size = new System.Drawing.Size(734, 253);
|
||||
this.panel4.TabIndex = 2;
|
||||
//
|
||||
// flbody
|
||||
//
|
||||
this.flbody.AutoScroll = true;
|
||||
this.flbody.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flbody.Location = new System.Drawing.Point(126, 0);
|
||||
this.flbody.Name = "flbody";
|
||||
this.flbody.Size = new System.Drawing.Size(608, 253);
|
||||
this.flbody.TabIndex = 3;
|
||||
//
|
||||
// flcategory
|
||||
//
|
||||
this.flcategory.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.flcategory.Location = new System.Drawing.Point(0, 0);
|
||||
this.flcategory.Name = "flcategory";
|
||||
this.flcategory.Size = new System.Drawing.Size(126, 253);
|
||||
this.flcategory.TabIndex = 2;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Controls.Add(this.label1);
|
||||
this.panel3.Location = new System.Drawing.Point(155, 12);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(640, 360);
|
||||
this.panel3.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(640, 360);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Preview not available.";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.panel2.Controls.Add(this.flmeta);
|
||||
this.panel2.Controls.Add(this.btnapply);
|
||||
this.panel2.Location = new System.Drawing.Point(12, 12);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(136, 511);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// flmeta
|
||||
//
|
||||
this.flmeta.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flmeta.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flmeta.Location = new System.Drawing.Point(4, 4);
|
||||
this.flmeta.Name = "flmeta";
|
||||
this.flmeta.Size = new System.Drawing.Size(126, 450);
|
||||
this.flmeta.TabIndex = 1;
|
||||
//
|
||||
// btnapply
|
||||
//
|
||||
this.btnapply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnapply.Location = new System.Drawing.Point(3, 460);
|
||||
this.btnapply.Name = "btnapply";
|
||||
this.btnapply.Size = new System.Drawing.Size(127, 48);
|
||||
this.btnapply.TabIndex = 0;
|
||||
this.btnapply.Text = "Apply";
|
||||
this.btnapply.UseVisualStyleBackColor = true;
|
||||
this.btnapply.Click += new System.EventHandler(this.btnapply_Click);
|
||||
//
|
||||
// Shifter
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "Shifter";
|
||||
this.Text = "Shifter";
|
||||
this.Size = new System.Drawing.Size(893, 539);
|
||||
this.Load += new System.EventHandler(this.Shifter_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel4.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.FlowLayoutPanel flmeta;
|
||||
private System.Windows.Forms.Button btnapply;
|
||||
private System.Windows.Forms.Panel panel4;
|
||||
private System.Windows.Forms.FlowLayoutPanel flbody;
|
||||
private System.Windows.Forms.FlowLayoutPanel flcategory;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
616
ShiftOS.WinForms/Applications/Shifter.cs
Normal file
616
ShiftOS.WinForms/Applications/Shifter.cs
Normal file
|
@ -0,0 +1,616 @@
|
|||
using Newtonsoft.Json;
|
||||
using ShiftOS.Objects.ShiftFS;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Shifter", true, "al_shifter")]
|
||||
[RequiresUpgrade("shifter")]
|
||||
[WinOpen("shifter")]
|
||||
public partial class Shifter : UserControl, IShiftOSWindow
|
||||
{
|
||||
public Shifter()
|
||||
{
|
||||
InitializeComponent();
|
||||
PopulateShifter();
|
||||
}
|
||||
|
||||
public int CodepointValue = 0;
|
||||
public List<ShifterSetting> settings = new List<ShifterSetting>();
|
||||
public Skin LoadedSkin = null;
|
||||
|
||||
public void PopulateShifter()
|
||||
{
|
||||
if (LoadedSkin == null)
|
||||
LoadedSkin = JsonConvert.DeserializeObject<Skin>(JsonConvert.SerializeObject(SkinEngine.LoadedSkin));
|
||||
|
||||
settings.Clear();
|
||||
|
||||
foreach(var field in LoadedSkin.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
if (ShiftoriumFrontend.UpgradeAttributesUnlocked(field))
|
||||
{
|
||||
bool addToShifter = true;
|
||||
ShifterSetting setting = new Applications.ShifterSetting();
|
||||
foreach (var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is ShifterHiddenAttribute)
|
||||
{
|
||||
addToShifter = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (attr is ShifterMetaAttribute)
|
||||
{
|
||||
setting.Category = (attr as ShifterMetaAttribute).Meta;
|
||||
}
|
||||
if (attr is ShifterCategoryAttribute)
|
||||
{
|
||||
setting.SubCategory = (attr as ShifterCategoryAttribute).Category;
|
||||
}
|
||||
if (attr is ShifterNameAttribute)
|
||||
{
|
||||
setting.Name = (attr as ShifterNameAttribute).Name;
|
||||
}
|
||||
if (attr is ShifterDescriptionAttribute)
|
||||
{
|
||||
setting.Description = (attr as ShifterDescriptionAttribute).Description;
|
||||
}
|
||||
|
||||
}
|
||||
if (addToShifter == true)
|
||||
{
|
||||
setting.Field = field;
|
||||
settings.Add(setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PopulateCategories();
|
||||
}
|
||||
|
||||
public void PopulateCategories()
|
||||
{
|
||||
flmeta.Controls.Clear();
|
||||
|
||||
List<string> cats = new List<string>();
|
||||
|
||||
foreach(var c in this.settings)
|
||||
{
|
||||
if (!cats.Contains(c.Category))
|
||||
{
|
||||
cats.Add(c.Category);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var c in cats)
|
||||
{
|
||||
var btn = new Button();
|
||||
btn.Text = c;
|
||||
btn.Width = flmeta.Width - (flmeta.Margin.Left * 2);
|
||||
btn.FlatStyle = FlatStyle.Flat;
|
||||
btn.Click += (o, a) =>
|
||||
{
|
||||
PopulateSubcategories(c);
|
||||
};
|
||||
|
||||
flmeta.Controls.Add(btn);
|
||||
btn.Show();
|
||||
}
|
||||
}
|
||||
|
||||
public void PopulateSubcategories(string cat)
|
||||
{
|
||||
flcategory.Controls.Clear();
|
||||
|
||||
List<string> cats = new List<string>();
|
||||
|
||||
foreach (var c in this.settings)
|
||||
{
|
||||
if (c.Category == cat)
|
||||
{
|
||||
if (!cats.Contains(c.SubCategory))
|
||||
{
|
||||
cats.Add(c.SubCategory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var c in cats)
|
||||
{
|
||||
var btn = new Button();
|
||||
btn.Text = c;
|
||||
btn.Width = flcategory.Width - (flcategory.Margin.Left * 2);
|
||||
btn.FlatStyle = FlatStyle.Flat;
|
||||
btn.Click += (o, a) =>
|
||||
{
|
||||
PopulateBody(cat, c);
|
||||
};
|
||||
|
||||
flcategory.Controls.Add(btn);
|
||||
btn.Show();
|
||||
}
|
||||
}
|
||||
|
||||
public void PopulateBody(string cat, string subcat)
|
||||
{
|
||||
flbody.Controls.Clear();
|
||||
|
||||
List<ShifterSetting> cats = new List<ShifterSetting>();
|
||||
|
||||
foreach (var c in this.settings)
|
||||
{
|
||||
if (c.SubCategory == subcat && c.Category == cat)
|
||||
{
|
||||
if (c.Field.FlagFullfilled(LoadedSkin))
|
||||
{
|
||||
if (!cats.Contains(c))
|
||||
{
|
||||
cats.Add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var c in cats)
|
||||
{
|
||||
var lbl = new Label();
|
||||
int labelHeight = 0;
|
||||
lbl.AutoSize = true;
|
||||
lbl.Text = c.Name + ":";
|
||||
flbody.Controls.Add(lbl);
|
||||
lbl.TextAlign = ContentAlignment.MiddleLeft;
|
||||
lbl.Show();
|
||||
//Cool - label's in.
|
||||
if(c.Field.FieldType == typeof(Point))
|
||||
{
|
||||
var width = new TextBox();
|
||||
var height = new TextBox();
|
||||
labelHeight = width.Height; //irony?
|
||||
width.Width = 30;
|
||||
height.Width = width.Width;
|
||||
width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString();
|
||||
height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString();
|
||||
flbody.SetFlowBreak(height, true);
|
||||
ControlManager.SetupControl(width);
|
||||
ControlManager.SetupControl(height);
|
||||
|
||||
flbody.Controls.Add(width);
|
||||
width.Show();
|
||||
flbody.Controls.Add(height);
|
||||
height.Show();
|
||||
|
||||
EventHandler tc = (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
int x = Convert.ToInt32(width.Text);
|
||||
int y = Convert.ToInt32(height.Text);
|
||||
|
||||
int oldx = ((Point)c.Field.GetValue(this.LoadedSkin)).X;
|
||||
int oldy = ((Point)c.Field.GetValue(this.LoadedSkin)).Y;
|
||||
|
||||
if(x != oldx || y != oldy)
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, new Point(x, y));
|
||||
CodepointValue += 200;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString();
|
||||
height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString();
|
||||
}
|
||||
};
|
||||
|
||||
width.TextChanged += tc;
|
||||
height.TextChanged += tc;
|
||||
|
||||
}
|
||||
else if(c.Field.FieldType == typeof(string))
|
||||
{
|
||||
var str = new TextBox();
|
||||
str.Width = 120;
|
||||
ControlManager.SetupControl(str);
|
||||
labelHeight = str.Height;
|
||||
str.Text = c.Field.GetValue(LoadedSkin).ToString();
|
||||
flbody.SetFlowBreak(str, true);
|
||||
str.TextChanged += (o, a) => { c.Field.SetValue(LoadedSkin, str.Text); CodepointValue += 100; };
|
||||
flbody.Controls.Add(str);
|
||||
str.Show();
|
||||
}
|
||||
else if(c.Field.FieldType == typeof(byte[]))
|
||||
{
|
||||
//We'll assume that this is an image file.
|
||||
var color = new Button();
|
||||
color.Width = 40;
|
||||
labelHeight = color.Height;
|
||||
//just so it's flat like the system.
|
||||
ControlManager.SetupControl(color);
|
||||
flbody.SetFlowBreak(color, true);
|
||||
|
||||
color.BackgroundImage = SkinEngine.ImageFromBinary((byte[])c.Field.GetValue(this.LoadedSkin));
|
||||
color.Click += (o, a) =>
|
||||
{
|
||||
AppearanceManager.SetupDialog(new GraphicPicker(color.BackgroundImage, c.Name, GetLayout(c.Field.GetImageName()), new Action<byte[], Image, ImageLayout>((col, gdiImg, layout) =>
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, col);
|
||||
color.BackgroundImage = SkinEngine.ImageFromBinary(col);
|
||||
color.BackgroundImageLayout = layout;
|
||||
LoadedSkin.SkinImageLayouts[c.Field.GetImageName()] = layout;
|
||||
CodepointValue += 700;
|
||||
})));
|
||||
};
|
||||
flbody.Controls.Add(color);
|
||||
color.Show();
|
||||
}
|
||||
else if (c.Field.FieldType == typeof(Size))
|
||||
{
|
||||
var width = new TextBox();
|
||||
var height = new TextBox();
|
||||
width.Width = 30;
|
||||
height.Width = width.Width;
|
||||
labelHeight = width.Height;
|
||||
flbody.SetFlowBreak(height, true);
|
||||
|
||||
width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString();
|
||||
height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString();
|
||||
ControlManager.SetupControl(width);
|
||||
ControlManager.SetupControl(height);
|
||||
|
||||
flbody.Controls.Add(width);
|
||||
width.Show();
|
||||
flbody.Controls.Add(height);
|
||||
height.Show();
|
||||
|
||||
EventHandler tc = (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
int x = Convert.ToInt32(width.Text);
|
||||
int y = Convert.ToInt32(height.Text);
|
||||
|
||||
int oldx = ((Size)c.Field.GetValue(this.LoadedSkin)).Width;
|
||||
int oldy = ((Size)c.Field.GetValue(this.LoadedSkin)).Height;
|
||||
|
||||
if (x != oldx || y != oldy)
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, new Size(x, y));
|
||||
CodepointValue += 200;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString();
|
||||
height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString();
|
||||
}
|
||||
};
|
||||
|
||||
width.TextChanged += tc;
|
||||
height.TextChanged += tc;
|
||||
|
||||
}
|
||||
else if(c.Field.FieldType == typeof(bool))
|
||||
{
|
||||
var check = new CheckBox();
|
||||
check.Checked = ((bool)c.Field.GetValue(LoadedSkin));
|
||||
labelHeight = check.Height;
|
||||
check.CheckedChanged += (o, a) =>
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, check.Checked);
|
||||
CodepointValue += 50;
|
||||
};
|
||||
flbody.SetFlowBreak(check, true);
|
||||
|
||||
flbody.Controls.Add(check);
|
||||
check.Show();
|
||||
}
|
||||
else if(c.Field.FieldType == typeof(Font))
|
||||
{
|
||||
var name = new ComboBox();
|
||||
var size = new TextBox();
|
||||
var style = new ComboBox();
|
||||
|
||||
name.Width = 120;
|
||||
labelHeight = name.Height;
|
||||
size.Width = 40;
|
||||
style.Width = 80;
|
||||
flbody.SetFlowBreak(style, true);
|
||||
|
||||
ControlManager.SetupControl(name);
|
||||
ControlManager.SetupControl(size);
|
||||
ControlManager.SetupControl(style);
|
||||
|
||||
//populate the font name box
|
||||
foreach(var font in FontFamily.Families)
|
||||
{
|
||||
name.Items.Add(font.Name);
|
||||
}
|
||||
name.Text = ((Font)c.Field.GetValue(LoadedSkin)).Name;
|
||||
|
||||
size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString();
|
||||
|
||||
//populate the style box
|
||||
foreach(var s in (FontStyle[])Enum.GetValues(typeof(FontStyle)))
|
||||
{
|
||||
style.Items.Add(s.ToString());
|
||||
}
|
||||
style.Text = ((Font)c.Field.GetValue(LoadedSkin)).Style.ToString();
|
||||
|
||||
name.SelectedIndexChanged += (o, a) =>
|
||||
{
|
||||
var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
|
||||
|
||||
var f = en[style.SelectedIndex];
|
||||
|
||||
c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToInt32(size.Text), f));
|
||||
CodepointValue += 100;
|
||||
};
|
||||
|
||||
style.SelectedIndexChanged += (o, a) =>
|
||||
{
|
||||
var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
|
||||
|
||||
var f = en[style.SelectedIndex];
|
||||
|
||||
c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToInt32(size.Text), f));
|
||||
CodepointValue += 50;
|
||||
};
|
||||
|
||||
size.TextChanged += (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
|
||||
|
||||
var f = en[style.SelectedIndex];
|
||||
|
||||
c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToInt32(size.Text), f));
|
||||
}
|
||||
catch
|
||||
{
|
||||
size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString();
|
||||
}
|
||||
CodepointValue += 50;
|
||||
};
|
||||
|
||||
flbody.Controls.Add(name);
|
||||
flbody.Controls.Add(size);
|
||||
flbody.Controls.Add(style);
|
||||
|
||||
name.Show();
|
||||
size.Show();
|
||||
style.Show();
|
||||
|
||||
}
|
||||
else if(c.Field.FieldType == typeof(Color))
|
||||
{
|
||||
var color = new Button();
|
||||
color.Width = 40;
|
||||
labelHeight = color.Height;
|
||||
//just so it's flat like the system.
|
||||
ControlManager.SetupControl(color);
|
||||
|
||||
color.BackColor = ((Color)c.Field.GetValue(LoadedSkin));
|
||||
color.BackColorChanged += (o, a) =>
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, color.BackColor);
|
||||
};
|
||||
color.Click += (o, a) =>
|
||||
{
|
||||
AppearanceManager.SetupDialog(new ColorPicker(color.BackColor, c.Name, new Action<Color>((col) =>
|
||||
{
|
||||
color.BackColor = col;
|
||||
CodepointValue += 300;
|
||||
})));
|
||||
};
|
||||
flbody.SetFlowBreak(color, true);
|
||||
|
||||
flbody.Controls.Add(color);
|
||||
color.Show();
|
||||
}
|
||||
else if(c.Field.FieldType == typeof(int))
|
||||
{
|
||||
if (c.Field.HasShifterEnumMask())
|
||||
{
|
||||
var name = new ComboBox();
|
||||
name.Width = 120;
|
||||
ControlManager.SetupControl(name);
|
||||
string[] items = c.Field.GetShifterEnumMask();
|
||||
foreach(var item in items)
|
||||
{
|
||||
name.Items.Add(item);
|
||||
}
|
||||
name.SelectedIndex = (int)c.Field.GetValue(LoadedSkin);
|
||||
name.SelectedIndexChanged += (o, a) =>
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, name.SelectedIndex);
|
||||
CodepointValue += 75;
|
||||
};
|
||||
labelHeight = name.Height;
|
||||
flbody.Controls.Add(name);
|
||||
name.Show();
|
||||
flbody.SetFlowBreak(name, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var width = new TextBox();
|
||||
width.Width = 30;
|
||||
width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString();
|
||||
ControlManager.SetupControl(width);
|
||||
labelHeight = width.Height;
|
||||
flbody.Controls.Add(width);
|
||||
width.Show();
|
||||
|
||||
EventHandler tc = (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
int x = Convert.ToInt32(width.Text);
|
||||
|
||||
int oldx = ((int)c.Field.GetValue(this.LoadedSkin));
|
||||
|
||||
if (x != oldx)
|
||||
{
|
||||
c.Field.SetValue(LoadedSkin, x);
|
||||
CodepointValue += 75;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString();
|
||||
}
|
||||
};
|
||||
|
||||
width.TextChanged += tc;
|
||||
flbody.SetFlowBreak(width, true);
|
||||
|
||||
}
|
||||
}
|
||||
lbl.AutoSize = false;
|
||||
lbl.Width = (int)this.CreateGraphics().MeasureString(lbl.Text, SkinEngine.LoadedSkin.MainFont).Width + 15;
|
||||
lbl.Height = labelHeight;
|
||||
lbl.TextAlign = ContentAlignment.MiddleLeft;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(c.Description))
|
||||
{
|
||||
var desc = new Label();
|
||||
flbody.SetFlowBreak(desc, true);
|
||||
desc.Text = c.Description;
|
||||
desc.AutoSize = true;
|
||||
flbody.Controls.Add(desc);
|
||||
desc.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ImageLayout GetLayout(string name)
|
||||
{
|
||||
if (!LoadedSkin.SkinImageLayouts.ContainsKey(name))
|
||||
{
|
||||
LoadedSkin.SkinImageLayouts.Add(name, ImageLayout.Tile);
|
||||
return ImageLayout.Tile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LoadedSkin.SkinImageLayouts[name];
|
||||
}
|
||||
}
|
||||
|
||||
private void btnapply_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Apply the skin.
|
||||
Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin));
|
||||
SkinEngine.LoadSkin();
|
||||
CodepointValue = CodepointValue / 4;
|
||||
Infobox.Show("{SHIFTER_SKIN_APPLIED}", "{YOU_HAVE_EARNED} " + CodepointValue.ToString() + " {CODEPOINTS}.");
|
||||
ShiftOS.Engine.Shiftorium.Silent = true;
|
||||
SaveSystem.CurrentSave.Codepoints += CodepointValue;
|
||||
SaveSystem.SaveGame();
|
||||
ShiftOS.Engine.Shiftorium.Silent = false;
|
||||
CodepointValue = 0;
|
||||
}
|
||||
|
||||
private void Shifter_Load(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class ShifterSetting
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string SubCategory { get; set; }
|
||||
public FieldInfo Field { get; set; }
|
||||
}
|
||||
|
||||
public static class ShifterReflectionUtilities
|
||||
{
|
||||
public static bool HasShifterEnumMask(this FieldInfo field)
|
||||
{
|
||||
foreach(var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is ShifterEnumMaskAttribute)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool FlagFullfilled(this FieldInfo field, Skin skn)
|
||||
{
|
||||
foreach(var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if(attr is ShifterFlagAttribute)
|
||||
{
|
||||
return (attr as ShifterFlagAttribute).IsTrue(skn);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string GetImageName(this FieldInfo field)
|
||||
{
|
||||
foreach (var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is ImageAttribute)
|
||||
{
|
||||
var eattr = attr as ImageAttribute;
|
||||
return eattr.Name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static string[] GetShifterEnumMask(this FieldInfo field)
|
||||
{
|
||||
if(field.HasShifterEnumMask())
|
||||
{
|
||||
foreach (var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is ShifterEnumMaskAttribute)
|
||||
{
|
||||
var eattr = attr as ShifterEnumMaskAttribute;
|
||||
return eattr.Items;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/Shifter.resx
Normal file
120
ShiftOS.WinForms/Applications/Shifter.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
237
ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
generated
Normal file
237
ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
generated
Normal file
|
@ -0,0 +1,237 @@
|
|||
using ShiftOS.WinForms.Controls;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class ShiftoriumFrontend
|
||||
{
|
||||
/// <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.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.lbupgradedesc = new System.Windows.Forms.Label();
|
||||
this.pnlupgradeactions = new System.Windows.Forms.Panel();
|
||||
this.btnbuy = new System.Windows.Forms.Button();
|
||||
this.lbupgradetitle = new System.Windows.Forms.Label();
|
||||
this.pnllist = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.pgupgradeprogress = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
|
||||
this.lbupgrades = new System.Windows.Forms.ListBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.pnlupgradeactions.SuspendLayout();
|
||||
this.pnllist.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Controls.Add(this.pnllist);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(782, 427);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.lbupgradedesc);
|
||||
this.panel2.Controls.Add(this.pnlupgradeactions);
|
||||
this.panel2.Controls.Add(this.lbupgradetitle);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(406, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(376, 427);
|
||||
this.panel2.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("shiftorium_gui_codepoints_display"))
|
||||
{
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(128, 357);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(135, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "You have: %cp Codepoints";
|
||||
this.label2.Click += new System.EventHandler(this.label2_Click);
|
||||
} else
|
||||
{
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(128, 357);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(1, 1);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "";
|
||||
this.label2.Click += new System.EventHandler(this.label2_Click);
|
||||
}
|
||||
//
|
||||
// lbupgradedesc
|
||||
//
|
||||
this.lbupgradedesc.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbupgradedesc.Location = new System.Drawing.Point(0, 42);
|
||||
this.lbupgradedesc.Name = "lbupgradedesc";
|
||||
this.lbupgradedesc.Size = new System.Drawing.Size(376, 348);
|
||||
this.lbupgradedesc.TabIndex = 2;
|
||||
this.lbupgradedesc.Text = "{SHIFTORIUM_EXP}";
|
||||
this.lbupgradedesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lbupgradedesc.UseCompatibleTextRendering = true;
|
||||
//
|
||||
// pnlupgradeactions
|
||||
//
|
||||
this.pnlupgradeactions.Controls.Add(this.btnbuy);
|
||||
this.pnlupgradeactions.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pnlupgradeactions.Location = new System.Drawing.Point(0, 390);
|
||||
this.pnlupgradeactions.Name = "pnlupgradeactions";
|
||||
this.pnlupgradeactions.Size = new System.Drawing.Size(376, 37);
|
||||
this.pnlupgradeactions.TabIndex = 1;
|
||||
//
|
||||
// btnbuy
|
||||
//
|
||||
this.btnbuy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnbuy.AutoSize = true;
|
||||
this.btnbuy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnbuy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnbuy.Location = new System.Drawing.Point(327, 9);
|
||||
this.btnbuy.Name = "btnbuy";
|
||||
this.btnbuy.Size = new System.Drawing.Size(37, 25);
|
||||
this.btnbuy.TabIndex = 0;
|
||||
this.btnbuy.Text = "Buy";
|
||||
this.btnbuy.UseVisualStyleBackColor = true;
|
||||
this.btnbuy.Visible = false;
|
||||
this.btnbuy.Click += new System.EventHandler(this.btnbuy_Click);
|
||||
//
|
||||
// lbupgradetitle
|
||||
//
|
||||
this.lbupgradetitle.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.lbupgradetitle.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbupgradetitle.Name = "lbupgradetitle";
|
||||
this.lbupgradetitle.Size = new System.Drawing.Size(376, 42);
|
||||
this.lbupgradetitle.TabIndex = 0;
|
||||
this.lbupgradetitle.Text = "{WELCOME_TO_SHIFTORIUM}";
|
||||
this.lbupgradetitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lbupgradetitle.UseCompatibleTextRendering = true;
|
||||
//
|
||||
// pnllist
|
||||
//
|
||||
this.pnllist.Controls.Add(this.label2);
|
||||
this.pnllist.Controls.Add(this.label1);
|
||||
this.pnllist.Controls.Add(this.pgupgradeprogress);
|
||||
this.pnllist.Controls.Add(this.lbupgrades);
|
||||
this.pnllist.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pnllist.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnllist.Name = "pnllist";
|
||||
this.pnllist.Size = new System.Drawing.Size(406, 427);
|
||||
this.pnllist.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 399);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(137, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "{UPGRADE_PROGRESS}:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 399);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(137, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
int upgradepercent = (pgupgradeprogress.Value / 100) * 100;
|
||||
this.label3.Text = upgradepercent.ToString();
|
||||
//
|
||||
// pgupgradeprogress
|
||||
//
|
||||
this.pgupgradeprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pgupgradeprogress.BlockSize = 5;
|
||||
this.pgupgradeprogress.Location = new System.Drawing.Point(146, 390);
|
||||
this.pgupgradeprogress.Maximum = 100;
|
||||
this.pgupgradeprogress.Name = "pgupgradeprogress";
|
||||
this.pgupgradeprogress.Size = new System.Drawing.Size(254, 23);
|
||||
this.pgupgradeprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||
this.pgupgradeprogress.TabIndex = 1;
|
||||
this.pgupgradeprogress.Value = 25;
|
||||
//
|
||||
// lbupgrades
|
||||
//
|
||||
this.lbupgrades.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbupgrades.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.lbupgrades.FormattingEnabled = true;
|
||||
this.lbupgrades.Location = new System.Drawing.Point(3, 66);
|
||||
this.lbupgrades.Name = "lbupgrades";
|
||||
this.lbupgrades.Size = new System.Drawing.Size(397, 277);
|
||||
this.lbupgrades.TabIndex = 0;
|
||||
this.lbupgrades.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lbupgrades_DrawItem);
|
||||
//
|
||||
// ShiftoriumFrontend
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.ForeColor = System.Drawing.Color.LightGreen;
|
||||
this.Name = "ShiftoriumFrontend";
|
||||
this.Text = "{SHIFTORIUM_NAME}";
|
||||
this.Size = new System.Drawing.Size(782, 427);
|
||||
this.Load += new System.EventHandler(this.Shiftorium_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.pnlupgradeactions.ResumeLayout(false);
|
||||
this.pnlupgradeactions.PerformLayout();
|
||||
this.pnllist.ResumeLayout(false);
|
||||
this.pnllist.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Panel pnllist;
|
||||
private System.Windows.Forms.ListBox lbupgrades;
|
||||
private System.Windows.Forms.Label lbupgradedesc;
|
||||
private System.Windows.Forms.Panel pnlupgradeactions;
|
||||
private System.Windows.Forms.Label lbupgradetitle;
|
||||
private System.Windows.Forms.Button btnbuy;
|
||||
private ShiftedProgressBar pgupgradeprogress;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
168
ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
Normal file
168
ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
Normal file
|
@ -0,0 +1,168 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ShiftOS.Engine;
|
||||
using static ShiftOS.Engine.SkinEngine;
|
||||
using backend = ShiftOS.Engine.Shiftorium;
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Shiftorium", true, "al_shiftorium")]
|
||||
[RequiresUpgrade("shiftorium_gui")]
|
||||
[WinOpen("shiftorium")]
|
||||
public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow
|
||||
{
|
||||
|
||||
public static System.Timers.Timer timer100;
|
||||
|
||||
|
||||
public ShiftoriumFrontend()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
PopulateShiftorium();
|
||||
lbupgrades.SelectedIndexChanged += (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
lbupgrades.Refresh();
|
||||
SelectUpgrade(lbupgrades.SelectedItem.ToString());
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
this.pgupgradeprogress.Maximum = backend.GetDefaults().Count;
|
||||
this.pgupgradeprogress.Value = SaveSystem.CurrentSave.CountUpgrades();
|
||||
backend.Installed += () =>
|
||||
{
|
||||
this.pgupgradeprogress.Maximum = backend.GetDefaults().Count;
|
||||
this.pgupgradeprogress.Value = SaveSystem.CurrentSave.CountUpgrades();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public void SelectUpgrade(string name)
|
||||
{
|
||||
btnbuy.Show();
|
||||
var upg = upgrades[name];
|
||||
lbupgradetitle.Text = Localization.Parse(upg.Name);
|
||||
lbupgradedesc.Text = Localization.Parse(upg.Description);
|
||||
}
|
||||
|
||||
Dictionary<string, ShiftoriumUpgrade> upgrades = new Dictionary<string, ShiftoriumUpgrade>();
|
||||
|
||||
public void PopulateShiftorium()
|
||||
{
|
||||
lbupgrades.Items.Clear();
|
||||
upgrades.Clear();
|
||||
Timer();
|
||||
|
||||
foreach (var upg in backend.GetAvailable())
|
||||
{
|
||||
String name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
|
||||
upgrades.Add(name, upg);
|
||||
lbupgrades.Items.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool UpgradeInstalled(string upg)
|
||||
{
|
||||
return backend.UpgradeInstalled(upg);
|
||||
}
|
||||
|
||||
public static bool UpgradeAttributesUnlocked(FieldInfo finf)
|
||||
{
|
||||
return backend.UpgradeAttributesUnlocked(finf);
|
||||
}
|
||||
|
||||
public static bool UpgradeAttributesUnlocked(MethodInfo finf)
|
||||
{
|
||||
return backend.UpgradeAttributesUnlocked(finf);
|
||||
}
|
||||
|
||||
public static bool UpgradeAttributesUnlocked(Type finf)
|
||||
{
|
||||
return backend.UpgradeAttributesUnlocked(finf);
|
||||
}
|
||||
|
||||
public static bool UpgradeAttributesUnlocked(PropertyInfo finf)
|
||||
{
|
||||
return backend.UpgradeAttributesUnlocked(finf);
|
||||
}
|
||||
|
||||
private void lbupgrades_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
var foreground = new SolidBrush(LoadedSkin.ControlTextColor);
|
||||
var background = new SolidBrush(LoadedSkin.ControlColor);
|
||||
|
||||
e.Graphics.FillRectangle(background, e.Bounds);
|
||||
try
|
||||
{
|
||||
if (lbupgrades.GetSelected(e.Index) == true)
|
||||
{
|
||||
e.Graphics.FillRectangle(foreground, e.Bounds);
|
||||
e.Graphics.DrawString(lbupgrades.Items[e.Index].ToString(), e.Font, background, e.Bounds.Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.FillRectangle(background, e.Bounds);
|
||||
e.Graphics.DrawString(lbupgrades.Items[e.Index].ToString(), e.Font, foreground, e.Bounds.Location);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void btnbuy_Click(object sender, EventArgs e)
|
||||
{
|
||||
backend.Silent = true;
|
||||
backend.Buy(upgrades[lbupgrades.SelectedItem.ToString()].ID, upgrades[lbupgrades.SelectedItem.ToString()].Cost);
|
||||
backend.Silent = false;
|
||||
PopulateShiftorium();
|
||||
btnbuy.Hide();
|
||||
}
|
||||
|
||||
private void Shiftorium_Load(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Timer()
|
||||
{
|
||||
timer100 = new System.Timers.Timer();
|
||||
timer100.Interval = 2000;
|
||||
//timer100.Elapsed += ???;
|
||||
timer100.AutoReset = true;
|
||||
timer100.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/ShiftoriumFrontend.resx
Normal file
120
ShiftOS.WinForms/Applications/ShiftoriumFrontend.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
460
ShiftOS.WinForms/Applications/Skin Loader.Designer.cs
generated
Normal file
460
ShiftOS.WinForms/Applications/Skin Loader.Designer.cs
generated
Normal file
|
@ -0,0 +1,460 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class Skin_Loader
|
||||
{
|
||||
/// <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.pnldesktop = new System.Windows.Forms.Panel();
|
||||
this.pnlborder = new System.Windows.Forms.Panel();
|
||||
this.flbuttons = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnclose = new System.Windows.Forms.Button();
|
||||
this.btnloaddefault = new System.Windows.Forms.Button();
|
||||
this.btnexport = new System.Windows.Forms.Button();
|
||||
this.btnimport = new System.Windows.Forms.Button();
|
||||
this.btnapply = new System.Windows.Forms.Button();
|
||||
this.desktoppanel = new System.Windows.Forms.Panel();
|
||||
this.sysmenuholder = new System.Windows.Forms.Panel();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.apps = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.lbtime = new System.Windows.Forms.Label();
|
||||
this.item1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.item2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.item3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.item4ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.pnlcontents = new System.Windows.Forms.Panel();
|
||||
this.pnltitle = new System.Windows.Forms.Panel();
|
||||
this.pnlminimize = new System.Windows.Forms.Panel();
|
||||
this.pnlmaximize = new System.Windows.Forms.Panel();
|
||||
this.pnlclose = new System.Windows.Forms.Panel();
|
||||
this.lbtitletext = new System.Windows.Forms.Label();
|
||||
this.pnlbottom = new System.Windows.Forms.Panel();
|
||||
this.pnlbottomr = new System.Windows.Forms.Panel();
|
||||
this.pnlbottoml = new System.Windows.Forms.Panel();
|
||||
this.pnlright = new System.Windows.Forms.Panel();
|
||||
this.pnlleft = new System.Windows.Forms.Panel();
|
||||
this.pnltitlemaster = new System.Windows.Forms.Panel();
|
||||
this.pnltitleright = new System.Windows.Forms.Panel();
|
||||
this.pnltitleleft = new System.Windows.Forms.Panel();
|
||||
this.pnldesktop.SuspendLayout();
|
||||
this.pnlborder.SuspendLayout();
|
||||
this.flbuttons.SuspendLayout();
|
||||
this.desktoppanel.SuspendLayout();
|
||||
this.sysmenuholder.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.pnltitle.SuspendLayout();
|
||||
this.pnlbottom.SuspendLayout();
|
||||
this.pnltitlemaster.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnldesktop
|
||||
//
|
||||
this.pnldesktop.BackColor = System.Drawing.Color.Black;
|
||||
this.pnldesktop.Controls.Add(this.desktoppanel);
|
||||
this.pnldesktop.Location = new System.Drawing.Point(13, 13);
|
||||
this.pnldesktop.Name = "pnldesktop";
|
||||
this.pnldesktop.Size = new System.Drawing.Size(522, 251);
|
||||
this.pnldesktop.TabIndex = 0;
|
||||
//
|
||||
// pnlborder
|
||||
//
|
||||
this.pnlborder.BackColor = System.Drawing.Color.Black;
|
||||
this.pnlborder.Controls.Add(this.pnlcontents);
|
||||
this.pnlborder.Controls.Add(this.pnlbottom);
|
||||
this.pnlborder.Controls.Add(this.pnlright);
|
||||
this.pnlborder.Controls.Add(this.pnlleft);
|
||||
this.pnlborder.Controls.Add(this.pnltitlemaster);
|
||||
this.pnlborder.Location = new System.Drawing.Point(12, 270);
|
||||
this.pnlborder.Name = "pnlborder";
|
||||
this.pnlborder.Size = new System.Drawing.Size(522, 251);
|
||||
this.pnlborder.TabIndex = 1;
|
||||
//
|
||||
// flbuttons
|
||||
//
|
||||
this.flbuttons.AutoSize = true;
|
||||
this.flbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flbuttons.Controls.Add(this.btnclose);
|
||||
this.flbuttons.Controls.Add(this.btnloaddefault);
|
||||
this.flbuttons.Controls.Add(this.btnexport);
|
||||
this.flbuttons.Controls.Add(this.btnimport);
|
||||
this.flbuttons.Controls.Add(this.btnapply);
|
||||
this.flbuttons.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.flbuttons.Location = new System.Drawing.Point(0, 629);
|
||||
this.flbuttons.Name = "flbuttons";
|
||||
this.flbuttons.Size = new System.Drawing.Size(547, 29);
|
||||
this.flbuttons.TabIndex = 2;
|
||||
//
|
||||
// btnclose
|
||||
//
|
||||
this.btnclose.AutoSize = true;
|
||||
this.btnclose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnclose.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnclose.Name = "btnclose";
|
||||
this.btnclose.Size = new System.Drawing.Size(60, 23);
|
||||
this.btnclose.TabIndex = 0;
|
||||
this.btnclose.Text = "{CLOSE}";
|
||||
this.btnclose.UseVisualStyleBackColor = true;
|
||||
this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
|
||||
//
|
||||
// btnloaddefault
|
||||
//
|
||||
this.btnloaddefault.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
|
||||
this.btnloaddefault.AutoSize = true;
|
||||
this.btnloaddefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnloaddefault.Location = new System.Drawing.Point(69, 3);
|
||||
this.btnloaddefault.Name = "btnloaddefault";
|
||||
this.btnloaddefault.Size = new System.Drawing.Size(109, 23);
|
||||
this.btnloaddefault.TabIndex = 1;
|
||||
this.btnloaddefault.Text = "{LOAD_DEFAULT}";
|
||||
this.btnloaddefault.UseVisualStyleBackColor = true;
|
||||
this.btnloaddefault.Click += new System.EventHandler(this.btnloaddefault_Click);
|
||||
//
|
||||
// btnexport
|
||||
//
|
||||
this.btnexport.AutoSize = true;
|
||||
this.btnexport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnexport.Location = new System.Drawing.Point(184, 3);
|
||||
this.btnexport.Name = "btnexport";
|
||||
this.btnexport.Size = new System.Drawing.Size(69, 23);
|
||||
this.btnexport.TabIndex = 2;
|
||||
this.btnexport.Text = "{EXPORT}";
|
||||
this.btnexport.UseVisualStyleBackColor = true;
|
||||
this.btnexport.Click += new System.EventHandler(this.btnexport_Click);
|
||||
//
|
||||
// btnimport
|
||||
//
|
||||
this.btnimport.AutoSize = true;
|
||||
this.btnimport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnimport.Location = new System.Drawing.Point(259, 3);
|
||||
this.btnimport.Name = "btnimport";
|
||||
this.btnimport.Size = new System.Drawing.Size(67, 23);
|
||||
this.btnimport.TabIndex = 3;
|
||||
this.btnimport.Text = "{IMPORT}";
|
||||
this.btnimport.UseVisualStyleBackColor = true;
|
||||
this.btnimport.Click += new System.EventHandler(this.btnimport_Click);
|
||||
//
|
||||
// btnapply
|
||||
//
|
||||
this.btnapply.AutoSize = true;
|
||||
this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnapply.Location = new System.Drawing.Point(332, 3);
|
||||
this.btnapply.Name = "btnapply";
|
||||
this.btnapply.Size = new System.Drawing.Size(59, 23);
|
||||
this.btnapply.TabIndex = 4;
|
||||
this.btnapply.Text = "{APPLY}";
|
||||
this.btnapply.UseVisualStyleBackColor = true;
|
||||
this.btnapply.Click += new System.EventHandler(this.btnapply_Click);
|
||||
//
|
||||
// desktoppanel
|
||||
//
|
||||
this.desktoppanel.BackColor = System.Drawing.Color.Green;
|
||||
this.desktoppanel.Controls.Add(this.sysmenuholder);
|
||||
this.desktoppanel.Controls.Add(this.lbtime);
|
||||
this.desktoppanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.desktoppanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.desktoppanel.Name = "desktoppanel";
|
||||
this.desktoppanel.Size = new System.Drawing.Size(522, 24);
|
||||
this.desktoppanel.TabIndex = 1;
|
||||
//
|
||||
// sysmenuholder
|
||||
//
|
||||
this.sysmenuholder.Controls.Add(this.menuStrip1);
|
||||
this.sysmenuholder.Location = new System.Drawing.Point(12, 5);
|
||||
this.sysmenuholder.Name = "sysmenuholder";
|
||||
this.sysmenuholder.Size = new System.Drawing.Size(68, 24);
|
||||
this.sysmenuholder.TabIndex = 1;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.apps});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(0);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(68, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// apps
|
||||
//
|
||||
this.apps.AutoSize = false;
|
||||
this.apps.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.item1ToolStripMenuItem,
|
||||
this.item2ToolStripMenuItem,
|
||||
this.item3ToolStripMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
this.item4ToolStripMenuItem});
|
||||
this.apps.Name = "apps";
|
||||
this.apps.Padding = new System.Windows.Forms.Padding(0);
|
||||
this.apps.Size = new System.Drawing.Size(58, 20);
|
||||
this.apps.Text = "ShiftOS";
|
||||
//
|
||||
// lbtime
|
||||
//
|
||||
this.lbtime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbtime.AutoSize = true;
|
||||
this.lbtime.Location = new System.Drawing.Point(445, 5);
|
||||
this.lbtime.Name = "lbtime";
|
||||
this.lbtime.Size = new System.Drawing.Size(35, 13);
|
||||
this.lbtime.TabIndex = 0;
|
||||
this.lbtime.Text = "label1";
|
||||
this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// item1ToolStripMenuItem
|
||||
//
|
||||
this.item1ToolStripMenuItem.Name = "item1ToolStripMenuItem";
|
||||
this.item1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.item1ToolStripMenuItem.Text = "Item 1";
|
||||
//
|
||||
// item2ToolStripMenuItem
|
||||
//
|
||||
this.item2ToolStripMenuItem.Name = "item2ToolStripMenuItem";
|
||||
this.item2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.item2ToolStripMenuItem.Text = "Item 2";
|
||||
//
|
||||
// item3ToolStripMenuItem
|
||||
//
|
||||
this.item3ToolStripMenuItem.Name = "item3ToolStripMenuItem";
|
||||
this.item3ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.item3ToolStripMenuItem.Text = "Item 3";
|
||||
//
|
||||
// item4ToolStripMenuItem
|
||||
//
|
||||
this.item4ToolStripMenuItem.Name = "item4ToolStripMenuItem";
|
||||
this.item4ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.item4ToolStripMenuItem.Text = "Item 4";
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// pnlcontents
|
||||
//
|
||||
this.pnlcontents.BackColor = System.Drawing.Color.Black;
|
||||
this.pnlcontents.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlcontents.ForeColor = System.Drawing.Color.White;
|
||||
this.pnlcontents.Location = new System.Drawing.Point(2, 30);
|
||||
this.pnlcontents.Name = "pnlcontents";
|
||||
this.pnlcontents.Size = new System.Drawing.Size(518, 219);
|
||||
this.pnlcontents.TabIndex = 9;
|
||||
//
|
||||
// pnltitle
|
||||
//
|
||||
this.pnltitle.BackColor = System.Drawing.Color.Black;
|
||||
this.pnltitle.Controls.Add(this.pnlminimize);
|
||||
this.pnltitle.Controls.Add(this.pnlmaximize);
|
||||
this.pnltitle.Controls.Add(this.pnlclose);
|
||||
this.pnltitle.Controls.Add(this.lbtitletext);
|
||||
this.pnltitle.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnltitle.Location = new System.Drawing.Point(2, 0);
|
||||
this.pnltitle.Name = "pnltitle";
|
||||
this.pnltitle.Size = new System.Drawing.Size(518, 30);
|
||||
this.pnltitle.TabIndex = 0;
|
||||
//
|
||||
// pnlminimize
|
||||
//
|
||||
this.pnlminimize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlminimize.BackColor = System.Drawing.Color.Green;
|
||||
this.pnlminimize.Location = new System.Drawing.Point(437, 3);
|
||||
this.pnlminimize.Name = "pnlminimize";
|
||||
this.pnlminimize.Size = new System.Drawing.Size(24, 24);
|
||||
this.pnlminimize.TabIndex = 3;
|
||||
//
|
||||
// pnlmaximize
|
||||
//
|
||||
this.pnlmaximize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlmaximize.BackColor = System.Drawing.Color.Yellow;
|
||||
this.pnlmaximize.Location = new System.Drawing.Point(464, 3);
|
||||
this.pnlmaximize.Name = "pnlmaximize";
|
||||
this.pnlmaximize.Size = new System.Drawing.Size(24, 24);
|
||||
this.pnlmaximize.TabIndex = 2;
|
||||
//
|
||||
// pnlclose
|
||||
//
|
||||
this.pnlclose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlclose.BackColor = System.Drawing.Color.Red;
|
||||
this.pnlclose.Location = new System.Drawing.Point(491, 3);
|
||||
this.pnlclose.Name = "pnlclose";
|
||||
this.pnlclose.Size = new System.Drawing.Size(24, 24);
|
||||
this.pnlclose.TabIndex = 1;
|
||||
//
|
||||
// lbtitletext
|
||||
//
|
||||
this.lbtitletext.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbtitletext.AutoSize = true;
|
||||
this.lbtitletext.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.lbtitletext.ForeColor = System.Drawing.Color.White;
|
||||
this.lbtitletext.Location = new System.Drawing.Point(4, 0);
|
||||
this.lbtitletext.Name = "lbtitletext";
|
||||
this.lbtitletext.Size = new System.Drawing.Size(77, 14);
|
||||
this.lbtitletext.TabIndex = 0;
|
||||
this.lbtitletext.Text = "Title text";
|
||||
this.lbtitletext.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.lbtitletext.UseMnemonic = false;
|
||||
//
|
||||
// pnlbottom
|
||||
//
|
||||
this.pnlbottom.BackColor = System.Drawing.Color.Black;
|
||||
this.pnlbottom.Controls.Add(this.pnlbottomr);
|
||||
this.pnlbottom.Controls.Add(this.pnlbottoml);
|
||||
this.pnlbottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pnlbottom.Location = new System.Drawing.Point(2, 249);
|
||||
this.pnlbottom.Name = "pnlbottom";
|
||||
this.pnlbottom.Size = new System.Drawing.Size(518, 2);
|
||||
this.pnlbottom.TabIndex = 6;
|
||||
//
|
||||
// pnlbottomr
|
||||
//
|
||||
this.pnlbottomr.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.pnlbottomr.Location = new System.Drawing.Point(516, 0);
|
||||
this.pnlbottomr.Name = "pnlbottomr";
|
||||
this.pnlbottomr.Size = new System.Drawing.Size(2, 2);
|
||||
this.pnlbottomr.TabIndex = 3;
|
||||
//
|
||||
// pnlbottoml
|
||||
//
|
||||
this.pnlbottoml.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pnlbottoml.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlbottoml.Name = "pnlbottoml";
|
||||
this.pnlbottoml.Size = new System.Drawing.Size(2, 2);
|
||||
this.pnlbottoml.TabIndex = 2;
|
||||
//
|
||||
// pnlright
|
||||
//
|
||||
this.pnlright.BackColor = System.Drawing.Color.Black;
|
||||
this.pnlright.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.pnlright.Location = new System.Drawing.Point(520, 30);
|
||||
this.pnlright.Name = "pnlright";
|
||||
this.pnlright.Size = new System.Drawing.Size(2, 221);
|
||||
this.pnlright.TabIndex = 8;
|
||||
//
|
||||
// pnlleft
|
||||
//
|
||||
this.pnlleft.BackColor = System.Drawing.Color.Black;
|
||||
this.pnlleft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pnlleft.Location = new System.Drawing.Point(0, 30);
|
||||
this.pnlleft.Name = "pnlleft";
|
||||
this.pnlleft.Size = new System.Drawing.Size(2, 221);
|
||||
this.pnlleft.TabIndex = 7;
|
||||
//
|
||||
// pnltitlemaster
|
||||
//
|
||||
this.pnltitlemaster.Controls.Add(this.pnltitle);
|
||||
this.pnltitlemaster.Controls.Add(this.pnltitleright);
|
||||
this.pnltitlemaster.Controls.Add(this.pnltitleleft);
|
||||
this.pnltitlemaster.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnltitlemaster.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnltitlemaster.Name = "pnltitlemaster";
|
||||
this.pnltitlemaster.Size = new System.Drawing.Size(522, 30);
|
||||
this.pnltitlemaster.TabIndex = 5;
|
||||
//
|
||||
// pnltitleright
|
||||
//
|
||||
this.pnltitleright.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.pnltitleright.Location = new System.Drawing.Point(520, 0);
|
||||
this.pnltitleright.Name = "pnltitleright";
|
||||
this.pnltitleright.Size = new System.Drawing.Size(2, 30);
|
||||
this.pnltitleright.TabIndex = 5;
|
||||
//
|
||||
// pnltitleleft
|
||||
//
|
||||
this.pnltitleleft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pnltitleleft.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnltitleleft.Name = "pnltitleleft";
|
||||
this.pnltitleleft.Size = new System.Drawing.Size(2, 30);
|
||||
this.pnltitleleft.TabIndex = 4;
|
||||
//
|
||||
// Skin_Loader
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(547, 658);
|
||||
this.Controls.Add(this.flbuttons);
|
||||
this.Controls.Add(this.pnlborder);
|
||||
this.Controls.Add(this.pnldesktop);
|
||||
this.Name = "Skin_Loader";
|
||||
this.Text = "Skin Loader";
|
||||
this.pnldesktop.ResumeLayout(false);
|
||||
this.pnlborder.ResumeLayout(false);
|
||||
this.flbuttons.ResumeLayout(false);
|
||||
this.flbuttons.PerformLayout();
|
||||
this.desktoppanel.ResumeLayout(false);
|
||||
this.desktoppanel.PerformLayout();
|
||||
this.sysmenuholder.ResumeLayout(false);
|
||||
this.sysmenuholder.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.pnltitle.ResumeLayout(false);
|
||||
this.pnltitle.PerformLayout();
|
||||
this.pnlbottom.ResumeLayout(false);
|
||||
this.pnltitlemaster.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel pnldesktop;
|
||||
private System.Windows.Forms.Panel pnlborder;
|
||||
private System.Windows.Forms.FlowLayoutPanel flbuttons;
|
||||
private System.Windows.Forms.Button btnclose;
|
||||
private System.Windows.Forms.Button btnloaddefault;
|
||||
private System.Windows.Forms.Button btnexport;
|
||||
private System.Windows.Forms.Button btnimport;
|
||||
private System.Windows.Forms.Button btnapply;
|
||||
private System.Windows.Forms.Panel desktoppanel;
|
||||
private System.Windows.Forms.Panel sysmenuholder;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem apps;
|
||||
private System.Windows.Forms.ToolStripMenuItem item1ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem item2ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem item3ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem item4ToolStripMenuItem;
|
||||
private System.Windows.Forms.Label lbtime;
|
||||
private System.Windows.Forms.Panel pnlcontents;
|
||||
private System.Windows.Forms.Panel pnlbottom;
|
||||
private System.Windows.Forms.Panel pnlbottomr;
|
||||
private System.Windows.Forms.Panel pnlbottoml;
|
||||
private System.Windows.Forms.Panel pnlright;
|
||||
private System.Windows.Forms.Panel pnlleft;
|
||||
private System.Windows.Forms.Panel pnltitlemaster;
|
||||
private System.Windows.Forms.Panel pnltitle;
|
||||
private System.Windows.Forms.Panel pnlminimize;
|
||||
private System.Windows.Forms.Panel pnlmaximize;
|
||||
private System.Windows.Forms.Panel pnlclose;
|
||||
private System.Windows.Forms.Label lbtitletext;
|
||||
private System.Windows.Forms.Panel pnltitleright;
|
||||
private System.Windows.Forms.Panel pnltitleleft;
|
||||
}
|
||||
}
|
306
ShiftOS.WinForms/Applications/Skin Loader.cs
Normal file
306
ShiftOS.WinForms/Applications/Skin Loader.cs
Normal file
|
@ -0,0 +1,306 @@
|
|||
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 Newtonsoft.Json;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Skin Loader", true, "al_skin_loader")]
|
||||
[RequiresUpgrade("skinning")]
|
||||
[WinOpen("skin_loader")]
|
||||
public partial class Skin_Loader : UserControl, IShiftOSWindow
|
||||
{
|
||||
public Skin_Loader()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
LoadedSkin = JsonConvert.DeserializeObject<Skin>(JsonConvert.SerializeObject(SkinEngine.LoadedSkin));
|
||||
this.Load += (o, a) => { SetupUI(); };
|
||||
|
||||
}
|
||||
|
||||
public Skin LoadedSkin { get; set; }
|
||||
|
||||
public void SetupUI()
|
||||
{
|
||||
SetupDesktop();
|
||||
Setup();
|
||||
}
|
||||
|
||||
public void SetupDesktop()
|
||||
{
|
||||
menuStrip1.Renderer = new ShiftOSMenuRenderer();
|
||||
|
||||
this.DoubleBuffered = true;
|
||||
desktoppanel.BackColor = Color.Green;
|
||||
|
||||
//upgrades
|
||||
|
||||
if (SaveSystem.CurrentSave != null)
|
||||
{
|
||||
desktoppanel.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop");
|
||||
lbtime.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop_clock_widget");
|
||||
|
||||
//skinning
|
||||
lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
|
||||
|
||||
sysmenuholder.Visible = ShiftoriumFrontend.UpgradeInstalled("app_launcher");
|
||||
|
||||
//The Color Picker can give us transparent colors - which Windows Forms fucking despises when dealing with form backgrounds.
|
||||
//To compensate, we must recreate the desktop color and make the alpha channel '255'.
|
||||
pnldesktop.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B);
|
||||
//Not doing this will cause an ArgumentException.
|
||||
|
||||
pnldesktop.BackgroundImage = GetImage("desktopbackground");
|
||||
pnldesktop.BackgroundImageLayout = GetImageLayout("desktopbackground");
|
||||
desktoppanel.BackgroundImage = GetImage("desktoppanel");
|
||||
menuStrip1.BackgroundImage = GetImage("applauncher");
|
||||
lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
|
||||
lbtime.Font = LoadedSkin.DesktopPanelClockFont;
|
||||
lbtime.Text = Applications.Terminal.GetTime();
|
||||
lbtime.Left = desktoppanel.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X;
|
||||
lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y;
|
||||
|
||||
if (desktoppanel.BackgroundImage == null)
|
||||
{
|
||||
lbtime.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbtime.BackColor = Color.Transparent;
|
||||
}
|
||||
apps.Text = LoadedSkin.AppLauncherText;
|
||||
sysmenuholder.Location = LoadedSkin.AppLauncherFromLeft;
|
||||
sysmenuholder.Size = LoadedSkin.AppLauncherHolderSize;
|
||||
apps.Size = sysmenuholder.Size;
|
||||
menuStrip1.Renderer = new ShiftOSMenuRenderer(new AppLauncherColorTable());
|
||||
desktoppanel.BackColor = LoadedSkin.DesktopPanelColor;
|
||||
desktoppanel.BackgroundImageLayout = GetImageLayout("desktoppanel");
|
||||
desktoppanel.Height = LoadedSkin.DesktopPanelHeight;
|
||||
if (LoadedSkin.DesktopPanelPosition == 1)
|
||||
{
|
||||
desktoppanel.Dock = DockStyle.Bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
desktoppanel.Dock = DockStyle.Top;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ImageLayout GetImageLayout(string img)
|
||||
{
|
||||
if (LoadedSkin.SkinImageLayouts.ContainsKey(img))
|
||||
{
|
||||
return LoadedSkin.SkinImageLayouts[img];
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadedSkin.SkinImageLayouts.Add(img, ImageLayout.Tile);
|
||||
return ImageLayout.Tile;
|
||||
}
|
||||
}
|
||||
|
||||
public Image GetImage(string img)
|
||||
{
|
||||
var type = typeof(Skin);
|
||||
|
||||
foreach (var field in type.GetFields())
|
||||
{
|
||||
foreach (var attr in field.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is ImageAttribute)
|
||||
{
|
||||
var iattr = attr as ImageAttribute;
|
||||
if (iattr.Name == img)
|
||||
{
|
||||
byte[] image = (byte[])field.GetValue(LoadedSkin);
|
||||
return SkinEngine.ImageFromBinary(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
bool IsDialog = false;
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
pnlcontents.BackColor = LoadedSkin.ControlColor;
|
||||
|
||||
this.lbtitletext.Text = Localization.Parse("{TEMPLATE}");
|
||||
this.Dock = DockStyle.Fill;
|
||||
|
||||
if (SaveSystem.CurrentSave != null)
|
||||
{
|
||||
this.pnltitle.Visible = ShiftoriumFrontend.UpgradeInstalled("wm_titlebar");
|
||||
this.pnlclose.Visible = ShiftoriumFrontend.UpgradeInstalled("close_button");
|
||||
this.pnlminimize.Visible = (IsDialog == false) && ShiftoriumFrontend.UpgradeInstalled("minimize_button");
|
||||
this.pnlmaximize.Visible = (IsDialog == false) && ShiftoriumFrontend.UpgradeInstalled("maximize_button");
|
||||
SetupSkin();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pnltitle.Visible = false;
|
||||
this.pnlclose.Visible = false;
|
||||
this.pnlminimize.Visible = false;
|
||||
this.pnlmaximize.Visible = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupSkin()
|
||||
{
|
||||
pnltitlemaster.Height = LoadedSkin.TitlebarHeight;
|
||||
pnltitle.BackColor = LoadedSkin.TitleBackgroundColor;
|
||||
pnltitle.BackgroundImage = GetImage("titlebar");
|
||||
pnltitleleft.Visible = LoadedSkin.ShowTitleCorners;
|
||||
pnltitleright.Visible = LoadedSkin.ShowTitleCorners;
|
||||
pnltitleleft.BackColor = LoadedSkin.TitleLeftCornerBackground;
|
||||
pnltitleright.BackColor = LoadedSkin.TitleRightCornerBackground;
|
||||
pnltitleleft.Width = LoadedSkin.TitleLeftCornerWidth;
|
||||
pnltitleright.Width = LoadedSkin.TitleRightCornerWidth;
|
||||
pnltitleleft.BackgroundImage = GetImage("titleleft");
|
||||
pnltitleleft.BackgroundImageLayout = GetImageLayout("titleleft");
|
||||
pnltitleright.BackgroundImage = GetImage("titleright");
|
||||
pnltitleright.BackgroundImageLayout = GetImageLayout("titleright");
|
||||
|
||||
|
||||
lbtitletext.BackColor = LoadedSkin.TitleBackgroundColor;
|
||||
lbtitletext.ForeColor = LoadedSkin.TitleTextColor;
|
||||
lbtitletext.Font = LoadedSkin.TitleFont;
|
||||
|
||||
pnlleft.BackColor = LoadedSkin.BorderLeftBackground;
|
||||
pnlleft.BackgroundImage = GetImage("leftborder");
|
||||
pnlleft.BackgroundImageLayout = GetImageLayout("leftborder");
|
||||
pnlleft.Width = LoadedSkin.LeftBorderWidth;
|
||||
pnlright.BackColor = LoadedSkin.BorderRightBackground;
|
||||
pnlright.BackgroundImage = GetImage("rightborder");
|
||||
pnlright.BackgroundImageLayout = GetImageLayout("rightborder");
|
||||
pnlright.Width = LoadedSkin.RightBorderWidth;
|
||||
|
||||
pnlbottom.BackColor = LoadedSkin.BorderBottomBackground;
|
||||
pnlbottom.BackgroundImage = GetImage("bottomborder");
|
||||
pnlbottom.BackgroundImageLayout = GetImageLayout("bottomborder");
|
||||
pnlbottom.Height = LoadedSkin.BottomBorderWidth;
|
||||
|
||||
pnlbottomr.BackColor = LoadedSkin.BorderBottomRightBackground;
|
||||
pnlbottomr.BackgroundImage = GetImage("bottomrborder");
|
||||
pnlbottomr.BackgroundImageLayout = GetImageLayout("bottomrborder");
|
||||
pnlbottoml.BackColor = LoadedSkin.BorderBottomLeftBackground;
|
||||
pnlbottoml.BackgroundImage = GetImage("bottomlborder");
|
||||
pnlbottoml.BackgroundImageLayout = GetImageLayout("bottomlborder");
|
||||
|
||||
lbtitletext.ForeColor = LoadedSkin.TitleTextColor;
|
||||
lbtitletext.Font = LoadedSkin.TitleFont;
|
||||
pnlclose.BackColor = LoadedSkin.CloseButtonColor;
|
||||
pnlclose.BackgroundImage = GetImage("closebutton");
|
||||
pnlclose.BackgroundImageLayout = GetImageLayout("closebutton");
|
||||
pnlminimize.BackColor = LoadedSkin.MinimizeButtonColor;
|
||||
pnlminimize.BackgroundImage = GetImage("minimizebutton");
|
||||
pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebutton");
|
||||
pnlmaximize.BackColor = LoadedSkin.MaximizeButtonColor;
|
||||
pnlmaximize.BackgroundImage = GetImage("maximizebutton");
|
||||
pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebutton");
|
||||
|
||||
pnlclose.Size = LoadedSkin.CloseButtonSize;
|
||||
pnlminimize.Size = LoadedSkin.MinimizeButtonSize;
|
||||
pnlmaximize.Size = LoadedSkin.MaximizeButtonSize;
|
||||
pnlclose.Location = FromRight(LoadedSkin.CloseButtonFromSide);
|
||||
pnlminimize.Location = FromRight(LoadedSkin.MinimizeButtonFromSide);
|
||||
pnlmaximize.Location = FromRight(LoadedSkin.MaximizeButtonFromSide);
|
||||
pnlclose.Left -= pnlclose.Width;
|
||||
pnlmaximize.Left -= pnlmaximize.Width;
|
||||
pnlminimize.Left -= pnlminimize.Width;
|
||||
|
||||
switch (LoadedSkin.TitleTextCentered)
|
||||
{
|
||||
case false:
|
||||
lbtitletext.Location = LoadedSkin.TitleTextLeft;
|
||||
break;
|
||||
default:
|
||||
lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
|
||||
lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Point FromRight(Point input)
|
||||
{
|
||||
return new Point(pnltitle.Width - input.X, input.Y);
|
||||
}
|
||||
|
||||
private void btnapply_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShiftOS.Objects.ShiftFS.Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin));
|
||||
SkinEngine.LoadSkin();
|
||||
}
|
||||
|
||||
private void btnclose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnloaddefault_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.LoadedSkin = new ShiftOS.Engine.Skin();
|
||||
SetupUI();
|
||||
}
|
||||
|
||||
private void btnexport_Click(object sender, EventArgs e)
|
||||
{
|
||||
AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Save, new Action<string>((filename) =>
|
||||
{
|
||||
ShiftOS.Objects.ShiftFS.Utils.WriteAllText(filename, JsonConvert.SerializeObject(LoadedSkin));
|
||||
string fname = filename.Split('/')[filename.Split('/').Length - 1];
|
||||
if(!System.IO.Directory.Exists(Paths.SharedFolder + "\\skins"))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(Paths.SharedFolder + "\\skins");
|
||||
}
|
||||
|
||||
string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentSave.Username + "-" + fname;
|
||||
System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(LoadedSkin));
|
||||
|
||||
})));
|
||||
}
|
||||
|
||||
private void btnimport_Click(object sender, EventArgs e)
|
||||
{
|
||||
AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action<string>((filename) =>
|
||||
{
|
||||
LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename));
|
||||
SetupUI();
|
||||
})));
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
|
||||
SetupUI();
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
126
ShiftOS.WinForms/Applications/Skin Loader.resx
Normal file
126
ShiftOS.WinForms/Applications/Skin Loader.resx
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
65
ShiftOS.WinForms/Applications/Terminal.Designer.cs
generated
Normal file
65
ShiftOS.WinForms/Applications/Terminal.Designer.cs
generated
Normal file
|
@ -0,0 +1,65 @@
|
|||
using System.Windows.Forms;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class Terminal
|
||||
{
|
||||
/// <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.rtbterm = new Controls.TerminalBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// rtbterm
|
||||
//
|
||||
this.rtbterm.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.rtbterm.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.rtbterm.Location = new System.Drawing.Point(0, 0);
|
||||
this.rtbterm.Name = "rtbterm";
|
||||
this.rtbterm.Size = new System.Drawing.Size(493, 295);
|
||||
this.rtbterm.TabIndex = 0;
|
||||
this.rtbterm.Text = "";
|
||||
this.rtbterm.TextChanged += new System.EventHandler(this.rtbterm_TextChanged);
|
||||
//
|
||||
// Terminal
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.rtbterm);
|
||||
this.Name = "Terminal";
|
||||
this.Text = "{TERMINAL_NAME}";
|
||||
this.Size = new System.Drawing.Size(493, 295);
|
||||
this.Tag = "hidden";
|
||||
this.Load += new System.EventHandler(this.Terminal_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Controls.TerminalBox rtbterm = new Controls.TerminalBox();
|
||||
}
|
||||
}
|
306
ShiftOS.WinForms/Applications/Terminal.cs
Normal file
306
ShiftOS.WinForms/Applications/Terminal.cs
Normal file
|
@ -0,0 +1,306 @@
|
|||
//#define TRAILER
|
||||
//#define CRASHONSTART
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using static ShiftOS.Engine.SkinEngine;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications {
|
||||
[Launcher("Terminal", false)]
|
||||
[WinOpen("terminal")]
|
||||
public partial class Terminal : UserControl, IShiftOSWindow {
|
||||
public static Stack<string> ConsoleStack = new Stack<string>();
|
||||
|
||||
public static System.Windows.Forms.Timer ti = new System.Windows.Forms.Timer();
|
||||
|
||||
public static string latestCommmand = "";
|
||||
|
||||
[Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")]
|
||||
public static bool PrefixEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return TerminalBackend.PrefixEnabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
TerminalBackend.PrefixEnabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")]
|
||||
public static bool InStory
|
||||
{
|
||||
get
|
||||
{
|
||||
return TerminalBackend.InStory;
|
||||
}
|
||||
set
|
||||
{
|
||||
TerminalBackend.InStory = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")]
|
||||
public static string LastCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return TerminalBackend.LastCommand;
|
||||
}
|
||||
set
|
||||
{
|
||||
TerminalBackend.LastCommand = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")]
|
||||
public static void InvokeCommand(string text)
|
||||
{
|
||||
TerminalBackend.InvokeCommand(text);
|
||||
}
|
||||
|
||||
public Terminal() {
|
||||
|
||||
InitializeComponent();
|
||||
SaveSystem.GameReady += () => {
|
||||
try {
|
||||
this.Invoke(new Action(() => {
|
||||
ResetAllKeywords();
|
||||
rtbterm.Text = "";
|
||||
TerminalBackend.PrefixEnabled = true;
|
||||
TerminalBackend.InStory = false;
|
||||
Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
|
||||
if (SaveSystem.CurrentSave.StoryPosition == 6) {
|
||||
Infobox.Show("Welcome to ShiftOS.", "Welcome to the ShiftOS multi-user domain. Your goal is to upgrade your system as much as possible, and gain as much wealth as possible. The first step is to get a feel for the environment. Go forth and explore, young Shifter.");
|
||||
SaveSystem.CurrentSave.StoryPosition++;
|
||||
}
|
||||
}));
|
||||
} catch { }
|
||||
};
|
||||
|
||||
|
||||
this.DoubleBuffered = true;
|
||||
|
||||
}
|
||||
|
||||
public void FocusOnTerminal() {
|
||||
rtbterm.Focus();
|
||||
}
|
||||
|
||||
public static string GetTime() {
|
||||
var time = DateTime.Now;
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("full_precision_time")) {
|
||||
return DateTime.Now.ToString("h:mm:ss tt");
|
||||
} else if (ShiftoriumFrontend.UpgradeInstalled("clock_am_and_pm")) {
|
||||
return time.TimeOfDay.TotalHours > 12 ? $"{time.Hour - 12} PM" : $"{time.Hour} AM";
|
||||
} else if (ShiftoriumFrontend.UpgradeInstalled("clock_hours")) {
|
||||
return ((int)time.TimeOfDay.TotalHours).ToString();
|
||||
} else if (ShiftoriumFrontend.UpgradeInstalled("clock_minutes")) {
|
||||
return ((int)time.TimeOfDay.TotalMinutes).ToString();
|
||||
} else if (ShiftoriumFrontend.UpgradeInstalled("clock")) {
|
||||
return ((int)time.TimeOfDay.TotalSeconds).ToString();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static event TextSentEventHandler TextSent;
|
||||
|
||||
public void ResetAllKeywords() {
|
||||
string primary = SaveSystem.CurrentSave.Username + " ";
|
||||
string secondary = "shiftos ";
|
||||
|
||||
|
||||
var asm = Assembly.GetExecutingAssembly();
|
||||
|
||||
var types = asm.GetTypes();
|
||||
|
||||
foreach (var type in types) {
|
||||
foreach (var a in type.GetCustomAttributes(false)) {
|
||||
if (ShiftoriumFrontend.UpgradeAttributesUnlocked(type)) {
|
||||
if (a is Namespace) {
|
||||
var ns = a as Namespace;
|
||||
if (!primary.Contains(ns.name)) {
|
||||
primary += ns.name + " ";
|
||||
}
|
||||
foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) {
|
||||
if (ShiftoriumFrontend.UpgradeAttributesUnlocked(method)) {
|
||||
foreach (var ma in method.GetCustomAttributes(false)) {
|
||||
if (ma is Command) {
|
||||
var cmd = ma as Command;
|
||||
if (!secondary.Contains(cmd.name))
|
||||
secondary += cmd.name + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void MakeWidget(Controls.TerminalBox txt) {
|
||||
AppearanceManager.StartConsoleOut();
|
||||
txt.GotFocus += (o, a) => {
|
||||
AppearanceManager.ConsoleOut = txt;
|
||||
};
|
||||
txt.KeyDown += (o, a) => {
|
||||
if (a.KeyCode == Keys.Enter) {
|
||||
try {
|
||||
a.SuppressKeyPress = true;
|
||||
Console.WriteLine("");
|
||||
var text = txt.Lines.ToArray();
|
||||
var text2 = text[text.Length - 2];
|
||||
var text3 = "";
|
||||
var text4 = Regex.Replace(text2, @"\t|\n|\r", "");
|
||||
|
||||
if (TerminalBackend.PrefixEnabled) {
|
||||
text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
|
||||
}
|
||||
TerminalBackend.LastCommand = text3;
|
||||
TextSent?.Invoke(text4);
|
||||
if (TerminalBackend.InStory == false) {
|
||||
TerminalBackend.InvokeCommand(text3);
|
||||
}
|
||||
if (TerminalBackend.PrefixEnabled) {
|
||||
Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
} else if (a.KeyCode == Keys.Back) {
|
||||
var tostring3 = txt.Lines[txt.Lines.Length - 1];
|
||||
var tostringlen = tostring3.Length + 1;
|
||||
var workaround = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
|
||||
var derp = workaround.Length + 1;
|
||||
if (tostringlen != derp) {
|
||||
AppearanceManager.CurrentPosition--;
|
||||
} else {
|
||||
a.SuppressKeyPress = true;
|
||||
}
|
||||
} else if (a.KeyCode == Keys.Left)
|
||||
{
|
||||
var getstring = txt.Lines[txt.Lines.Length - 1];
|
||||
var stringlen = getstring.Length + 1;
|
||||
var header = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
|
||||
var headerlen = header.Length + 1;
|
||||
var selstart = txt.SelectionStart;
|
||||
var remstrlen = txt.TextLength - stringlen;
|
||||
var finalnum = selstart - remstrlen;
|
||||
|
||||
if (finalnum != headerlen)
|
||||
{
|
||||
AppearanceManager.CurrentPosition--;
|
||||
}
|
||||
else
|
||||
{
|
||||
a.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
//( ͡° ͜ʖ ͡° ) You found the lennyface without looking at the commit message. Message Michael in the #shiftos channel on Discord saying "ladouceur" somewhere in your message if you see this.
|
||||
else if (a.KeyCode == Keys.Up) {
|
||||
var tostring3 = txt.Lines[txt.Lines.Length - 1];
|
||||
if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
|
||||
Console.Write(TerminalBackend.LastCommand);
|
||||
a.SuppressKeyPress = true;
|
||||
|
||||
} else {
|
||||
|
||||
AppearanceManager.CurrentPosition++;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
AppearanceManager.ConsoleOut = txt;
|
||||
|
||||
txt.Focus();
|
||||
|
||||
txt.Font = LoadedSkin.TerminalFont;
|
||||
txt.ForeColor = LoadedSkin.TerminalForeColor;
|
||||
txt.BackColor = LoadedSkin.TerminalBackColor;
|
||||
|
||||
}
|
||||
|
||||
private void Terminal_Load(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void Terminal_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
ti.Stop();
|
||||
}
|
||||
|
||||
public void OnLoad() {
|
||||
MakeWidget(rtbterm);
|
||||
|
||||
if (SaveSystem.CurrentSave != null) {
|
||||
if (!ShiftoriumFrontend.UpgradeInstalled("window_manager")) {
|
||||
rtbterm.Text = AppearanceManager.LastTerminalText;
|
||||
rtbterm.Select(rtbterm.TextLength, 0);
|
||||
}
|
||||
Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OnSkinLoad() {
|
||||
try {
|
||||
rtbterm.Font = LoadedSkin.TerminalFont;
|
||||
rtbterm.ForeColor = LoadedSkin.TerminalForeColor;
|
||||
rtbterm.BackColor = LoadedSkin.TerminalBackColor;
|
||||
} catch {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool OnUnload() {
|
||||
if (SaveSystem.ShuttingDown == false) {
|
||||
if (!ShiftoriumFrontend.UpgradeInstalled("desktop")) {
|
||||
if (AppearanceManager.OpenForms.Count <= 1) {
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("{WIN_CANTCLOSETERMINAL}");
|
||||
try {
|
||||
Console.WriteLine("");
|
||||
|
||||
if (TerminalBackend.PrefixEnabled) {
|
||||
Console.Write($"{SaveSystem.CurrentSave.Username}@shiftos:~$ ");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade() {
|
||||
}
|
||||
|
||||
private void rtbterm_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
12
ShiftOS.WinForms/Applications/Terminal.cs.rej
Normal file
12
ShiftOS.WinForms/Applications/Terminal.cs.rej
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff a/ShiftOS_TheReturn/Applications/Terminal.cs b/ShiftOS_TheReturn/Applications/Terminal.cs (rejected hunks)
|
||||
@@ -228,6 +228,10 @@
|
||||
string args = text.Substring(argStart, text.Length - argStart);
|
||||
text = text.Remove(argStart, text.Length - argStart).Replace(" ", "");
|
||||
|
||||
+ if(string.IsNullOrWhiteSpace(args))
|
||||
+ {
|
||||
+ return new Dictionary<string, object>();
|
||||
+ }
|
||||
return JsonConvert.DeserializeObject<Dictionary<string, object>>(args);
|
||||
}
|
||||
|
120
ShiftOS.WinForms/Applications/Terminal.resx
Normal file
120
ShiftOS.WinForms/Applications/Terminal.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
138
ShiftOS.WinForms/Applications/TextPad.Designer.cs
generated
Normal file
138
ShiftOS.WinForms/Applications/TextPad.Designer.cs
generated
Normal file
|
@ -0,0 +1,138 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class TextPad
|
||||
{
|
||||
/// <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.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
|
||||
this.txtcontents = new System.Windows.Forms.TextBox();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// toolStripContainer1
|
||||
//
|
||||
this.toolStripContainer1.BottomToolStripPanelVisible = false;
|
||||
//
|
||||
// toolStripContainer1.ContentPanel
|
||||
//
|
||||
this.toolStripContainer1.ContentPanel.Controls.Add(this.txtcontents);
|
||||
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(648, 395);
|
||||
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer1.LeftToolStripPanelVisible = false;
|
||||
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer1.Name = "toolStripContainer1";
|
||||
this.toolStripContainer1.RightToolStripPanelVisible = false;
|
||||
this.toolStripContainer1.Size = new System.Drawing.Size(648, 419);
|
||||
this.toolStripContainer1.TabIndex = 0;
|
||||
this.toolStripContainer1.Text = "toolStripContainer1";
|
||||
//
|
||||
// toolStripContainer1.TopToolStripPanel
|
||||
//
|
||||
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
|
||||
//
|
||||
// txtcontents
|
||||
//
|
||||
this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtcontents.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtcontents.Multiline = true;
|
||||
this.txtcontents.Name = "txtcontents";
|
||||
this.txtcontents.Size = new System.Drawing.Size(648, 395);
|
||||
this.txtcontents.TabIndex = 0;
|
||||
this.txtcontents.TabStop = false;
|
||||
this.txtcontents.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtcontents_KeyDown);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.newToolStripMenuItem,
|
||||
this.openToolStripMenuItem,
|
||||
this.saveToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(648, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// newToolStripMenuItem
|
||||
//
|
||||
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||
this.newToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.newToolStripMenuItem.Text = "New";
|
||||
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
//
|
||||
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||
this.openToolStripMenuItem.Text = "Open";
|
||||
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.saveToolStripMenuItem.Text = "Save";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||
//
|
||||
// TextPad
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.toolStripContainer1);
|
||||
this.Name = "TextPad";
|
||||
this.Text = "{TEXTPAD_NAME}";
|
||||
this.Size = new System.Drawing.Size(648, 419);
|
||||
this.toolStripContainer1.ContentPanel.ResumeLayout(false);
|
||||
this.toolStripContainer1.ContentPanel.PerformLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
|
||||
this.toolStripContainer1.TopToolStripPanel.PerformLayout();
|
||||
this.toolStripContainer1.ResumeLayout(false);
|
||||
this.toolStripContainer1.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ToolStripContainer toolStripContainer1;
|
||||
private System.Windows.Forms.TextBox txtcontents;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
}
|
||||
}
|
88
ShiftOS.WinForms/Applications/TextPad.cs
Normal file
88
ShiftOS.WinForms/Applications/TextPad.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
using ShiftOS.Objects.ShiftFS;
|
||||
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 ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("TextPad", true, "al_textpad")]
|
||||
[RequiresUpgrade("textpad")]
|
||||
[WinOpen("textpad")]
|
||||
public partial class TextPad : UserControl, IShiftOSWindow
|
||||
{
|
||||
public TextPad()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void newToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtcontents.Text = "";
|
||||
}
|
||||
|
||||
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var types = new List<string>();
|
||||
types.Add(".txt");
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("textpad_lua_support"))
|
||||
types.Add(".lua");
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("textpad_python_support"))
|
||||
types.Add(".py");
|
||||
|
||||
|
||||
AppearanceManager.SetupDialog(new FileDialog(types.ToArray(), FileOpenerStyle.Open, new Action<string>((file) => this.LoadFile(file))));
|
||||
}
|
||||
|
||||
public void LoadFile(string file)
|
||||
{
|
||||
txtcontents.Text = Utils.ReadAllText(file);
|
||||
}
|
||||
|
||||
public void SaveFile(string file)
|
||||
{
|
||||
Utils.WriteAllText(file, txtcontents.Text);
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var types = new List<string>();
|
||||
types.Add(".txt");
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("textpad_lua_support"))
|
||||
types.Add(".lua");
|
||||
if (ShiftoriumFrontend.UpgradeInstalled("textpad_python_support"))
|
||||
types.Add(".py");
|
||||
|
||||
AppearanceManager.SetupDialog(new FileDialog(types.ToArray(), FileOpenerStyle.Save, new Action<string>((file) => this.SaveFile(file))));
|
||||
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void txtcontents_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
123
ShiftOS.WinForms/Applications/TextPad.resx
Normal file
123
ShiftOS.WinForms/Applications/TextPad.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
202
ShiftOS.WinForms/Applications/VirusScanner.Designer.cs
generated
Normal file
202
ShiftOS.WinForms/Applications/VirusScanner.Designer.cs
generated
Normal file
|
@ -0,0 +1,202 @@
|
|||
using ShiftOS.WinForms.Controls;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class VirusScanner
|
||||
{
|
||||
/// <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.btnfullscan = new System.Windows.Forms.Button();
|
||||
this.btnhomescan = new System.Windows.Forms.Button();
|
||||
this.btnsysscan = new System.Windows.Forms.Button();
|
||||
this.grpresults = new System.Windows.Forms.GroupBox();
|
||||
this.lbviruses = new System.Windows.Forms.ListBox();
|
||||
this.btnremoveviruses = new System.Windows.Forms.Button();
|
||||
this.lblresults = new System.Windows.Forms.Label();
|
||||
this.grpabout = new System.Windows.Forms.GroupBox();
|
||||
this.rtbterm = new TerminalBox();
|
||||
this.lblabout = new System.Windows.Forms.Label();
|
||||
this.pgcontents = new System.Windows.Forms.Panel();
|
||||
this.grpresults.SuspendLayout();
|
||||
this.grpabout.SuspendLayout();
|
||||
this.pgcontents.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnfullscan
|
||||
//
|
||||
this.btnfullscan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnfullscan.Location = new System.Drawing.Point(10, 12);
|
||||
this.btnfullscan.Name = "btnfullscan";
|
||||
this.btnfullscan.Size = new System.Drawing.Size(175, 23);
|
||||
this.btnfullscan.TabIndex = 0;
|
||||
this.btnfullscan.Text = "{START_SYSTEM_SCAN}";
|
||||
this.btnfullscan.UseVisualStyleBackColor = true;
|
||||
this.btnfullscan.Click += new System.EventHandler(this.btnfullscan_Click);
|
||||
//
|
||||
// btnhomescan
|
||||
//
|
||||
this.btnhomescan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnhomescan.Location = new System.Drawing.Point(10, 41);
|
||||
this.btnhomescan.Name = "btnhomescan";
|
||||
this.btnhomescan.Size = new System.Drawing.Size(175, 23);
|
||||
this.btnhomescan.TabIndex = 1;
|
||||
this.btnhomescan.Text = "{SCAN_HOME}";
|
||||
this.btnhomescan.UseVisualStyleBackColor = true;
|
||||
this.btnhomescan.Click += new System.EventHandler(this.btnhomescan_Click);
|
||||
//
|
||||
// btnsysscan
|
||||
//
|
||||
this.btnsysscan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnsysscan.Location = new System.Drawing.Point(10, 70);
|
||||
this.btnsysscan.Name = "btnsysscan";
|
||||
this.btnsysscan.Size = new System.Drawing.Size(175, 23);
|
||||
this.btnsysscan.TabIndex = 2;
|
||||
this.btnsysscan.Text = "{SCAN_SYSTEM}";
|
||||
this.btnsysscan.UseVisualStyleBackColor = true;
|
||||
this.btnsysscan.Click += new System.EventHandler(this.btnsysscan_Click);
|
||||
//
|
||||
// grpresults
|
||||
//
|
||||
this.grpresults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.grpresults.Controls.Add(this.lbviruses);
|
||||
this.grpresults.Controls.Add(this.btnremoveviruses);
|
||||
this.grpresults.Controls.Add(this.lblresults);
|
||||
this.grpresults.Location = new System.Drawing.Point(3, 168);
|
||||
this.grpresults.Name = "grpresults";
|
||||
this.grpresults.Size = new System.Drawing.Size(179, 158);
|
||||
this.grpresults.TabIndex = 3;
|
||||
this.grpresults.TabStop = false;
|
||||
this.grpresults.Text = "{RESULTS}";
|
||||
//
|
||||
// lbviruses
|
||||
//
|
||||
this.lbviruses.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbviruses.FormattingEnabled = true;
|
||||
this.lbviruses.Location = new System.Drawing.Point(3, 16);
|
||||
this.lbviruses.Name = "lbviruses";
|
||||
this.lbviruses.Size = new System.Drawing.Size(173, 116);
|
||||
this.lbviruses.TabIndex = 2;
|
||||
//
|
||||
// btnremoveviruses
|
||||
//
|
||||
this.btnremoveviruses.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.btnremoveviruses.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnremoveviruses.Location = new System.Drawing.Point(3, 132);
|
||||
this.btnremoveviruses.Name = "btnremoveviruses";
|
||||
this.btnremoveviruses.Size = new System.Drawing.Size(173, 23);
|
||||
this.btnremoveviruses.TabIndex = 1;
|
||||
this.btnremoveviruses.Text = "Remove";
|
||||
this.btnremoveviruses.UseVisualStyleBackColor = true;
|
||||
this.btnremoveviruses.Visible = false;
|
||||
this.btnremoveviruses.Click += new System.EventHandler(this.btnremoveviruses_Click);
|
||||
//
|
||||
// lblresults
|
||||
//
|
||||
this.lblresults.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblresults.Location = new System.Drawing.Point(3, 16);
|
||||
this.lblresults.Name = "lblresults";
|
||||
this.lblresults.Size = new System.Drawing.Size(173, 139);
|
||||
this.lblresults.TabIndex = 0;
|
||||
this.lblresults.Text = "{SCAN_NOT_STARTED}";
|
||||
//
|
||||
// grpabout
|
||||
//
|
||||
this.grpabout.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.grpabout.Controls.Add(this.rtbterm);
|
||||
this.grpabout.Controls.Add(this.lblabout);
|
||||
this.grpabout.Location = new System.Drawing.Point(191, 12);
|
||||
this.grpabout.Name = "grpabout";
|
||||
this.grpabout.Size = new System.Drawing.Size(362, 314);
|
||||
this.grpabout.TabIndex = 5;
|
||||
this.grpabout.TabStop = false;
|
||||
this.grpabout.Text = "{ABOUT}";
|
||||
//
|
||||
// rtbterm
|
||||
//
|
||||
this.rtbterm.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.rtbterm.Location = new System.Drawing.Point(3, 16);
|
||||
this.rtbterm.Name = "rtbterm";
|
||||
this.rtbterm.Size = new System.Drawing.Size(356, 295);
|
||||
this.rtbterm.TabIndex = 1;
|
||||
this.rtbterm.Text = "";
|
||||
//
|
||||
// lblabout
|
||||
//
|
||||
this.lblabout.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblabout.Location = new System.Drawing.Point(3, 16);
|
||||
this.lblabout.Name = "lblabout";
|
||||
this.lblabout.Size = new System.Drawing.Size(356, 295);
|
||||
this.lblabout.TabIndex = 0;
|
||||
this.lblabout.Text = "{VIRUSSCANNER_ABOUT}";
|
||||
//
|
||||
// pgcontents
|
||||
//
|
||||
this.pgcontents.BackColor = System.Drawing.Color.White;
|
||||
this.pgcontents.Controls.Add(this.grpabout);
|
||||
this.pgcontents.Controls.Add(this.grpresults);
|
||||
this.pgcontents.Controls.Add(this.btnsysscan);
|
||||
this.pgcontents.Controls.Add(this.btnhomescan);
|
||||
this.pgcontents.Controls.Add(this.btnfullscan);
|
||||
this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pgcontents.Location = new System.Drawing.Point(0, 0);
|
||||
this.pgcontents.Name = "pgcontents";
|
||||
this.pgcontents.Size = new System.Drawing.Size(565, 343);
|
||||
this.pgcontents.TabIndex = 25;
|
||||
//
|
||||
// VirusScanner
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.pgcontents);
|
||||
this.Name = "VirusScanner";
|
||||
this.Text = "Virus Scanner";
|
||||
this.Size = new System.Drawing.Size(565, 343);
|
||||
this.Load += new System.EventHandler(this.VirusScanner_Load);
|
||||
this.grpresults.ResumeLayout(false);
|
||||
this.grpabout.ResumeLayout(false);
|
||||
this.pgcontents.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal System.Windows.Forms.Button btnfullscan;
|
||||
internal System.Windows.Forms.Button btnhomescan;
|
||||
internal System.Windows.Forms.Button btnsysscan;
|
||||
internal System.Windows.Forms.GroupBox grpresults;
|
||||
internal System.Windows.Forms.Button btnremoveviruses;
|
||||
internal System.Windows.Forms.Label lblresults;
|
||||
internal System.Windows.Forms.GroupBox grpabout;
|
||||
internal System.Windows.Forms.Label lblabout;
|
||||
internal System.Windows.Forms.Panel pgcontents;
|
||||
private TerminalBox rtbterm;
|
||||
private System.Windows.Forms.ListBox lbviruses;
|
||||
}
|
||||
}
|
181
ShiftOS.WinForms/Applications/VirusScanner.cs
Normal file
181
ShiftOS.WinForms/Applications/VirusScanner.cs
Normal file
|
@ -0,0 +1,181 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.Objects;
|
||||
using static ShiftOS.Objects.ShiftFS.Utils;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Virus Scanner", true, "al_virus_scanner")]
|
||||
[RequiresUpgrade("virus_scanner")]
|
||||
[WinOpen("virus_scanner")]
|
||||
public partial class VirusScanner : UserControl, IShiftOSWindow
|
||||
{
|
||||
public VirusScanner()
|
||||
{
|
||||
InitializeComponent();
|
||||
Action<ServerMessage> runner = new Action<ServerMessage>((msg) =>
|
||||
{
|
||||
if(msg.Name == "virusdb")
|
||||
{
|
||||
VirusDB = JsonConvert.DeserializeObject<Dictionary<string, string>>(msg.Contents);
|
||||
}
|
||||
});
|
||||
|
||||
ServerManager.MessageReceived += (srv) =>
|
||||
{
|
||||
runner?.Invoke(srv);
|
||||
runner = null;
|
||||
};
|
||||
|
||||
ServerManager.SendMessage("getvirusdb", "");
|
||||
}
|
||||
|
||||
Dictionary<string, string> VirusDB = null;
|
||||
|
||||
private void btnfullscan_Click(object sender, EventArgs e)
|
||||
{
|
||||
lblabout.Hide();
|
||||
lbviruses.Hide();
|
||||
rtbterm.Show();
|
||||
rtbterm.Focus();
|
||||
rtbterm.Text = "";
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
ScanFolder("0:");
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public List<string> infected = new List<string>();
|
||||
|
||||
public void ScanFolder(string path)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
lblresults.Hide();
|
||||
}));
|
||||
foreach (var file in GetFiles(path))
|
||||
{
|
||||
Console.WriteLine(file + " is now being scanned.");
|
||||
string contents = ReadAllText(file);
|
||||
|
||||
foreach(var kv in VirusDB)
|
||||
{
|
||||
if(kv.Value == contents)
|
||||
{
|
||||
if(kv.Key.EndsWith(".0") || kv.Key.EndsWith(".1"))
|
||||
{
|
||||
infected.Add(file);
|
||||
Console.WriteLine($"{file} - Virus detected: {kv.Key}");
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
AddVirusToList(kv.Key);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var dir in GetDirectories(path))
|
||||
{
|
||||
if (dir != null)
|
||||
{
|
||||
ScanFolder(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddVirusToList(string type)
|
||||
{
|
||||
lblresults.Hide();
|
||||
lbviruses.Show();
|
||||
btnremoveviruses.Show();
|
||||
lbviruses.Items.Add(type);
|
||||
}
|
||||
|
||||
private void VirusScanner_Load(object sender, EventArgs e)
|
||||
{
|
||||
Applications.Terminal.MakeWidget(rtbterm);
|
||||
rtbterm.Hide();
|
||||
}
|
||||
|
||||
private void btnhomescan_Click(object sender, EventArgs e)
|
||||
{
|
||||
lblabout.Hide();
|
||||
rtbterm.Show();
|
||||
rtbterm.Focus();
|
||||
rtbterm.Text = "";
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
ScanFolder(Paths.GetPath("home"));
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private void btnsysscan_Click(object sender, EventArgs e)
|
||||
{
|
||||
lblabout.Hide();
|
||||
rtbterm.Show();
|
||||
rtbterm.Focus();
|
||||
rtbterm.Text = "";
|
||||
var t = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
ScanFolder(Paths.GetPath("system"));
|
||||
}));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private void btnremoveviruses_Click(object sender, EventArgs e)
|
||||
{
|
||||
while(infected.Count > 0)
|
||||
{
|
||||
Delete(infected[0]);
|
||||
infected.RemoveAt(0);
|
||||
}
|
||||
|
||||
lbviruses.Items.Clear();
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InfectedFile
|
||||
{
|
||||
public string FilePath { get; set; }
|
||||
public List<string> Viruses { get; set; }
|
||||
|
||||
public InfectedFile(string fpath, string[] viruses)
|
||||
{
|
||||
FilePath = fpath;
|
||||
Viruses = new List<string>(viruses);
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/VirusScanner.resx
Normal file
120
ShiftOS.WinForms/Applications/VirusScanner.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
97
ShiftOS.WinForms/Applications/mp3Player.Designer.cs
generated
Normal file
97
ShiftOS.WinForms/Applications/mp3Player.Designer.cs
generated
Normal file
|
@ -0,0 +1,97 @@
|
|||
namespace ShiftOS.Engine
|
||||
{
|
||||
partial class UserControl1
|
||||
{
|
||||
/// <summary>
|
||||
/// Erforderliche Designervariable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Verwendete Ressourcen bereinigen.
|
||||
/// </summary>
|
||||
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Vom Komponenten-Designer generierter Code
|
||||
|
||||
/// <summary>
|
||||
/// Erforderliche Methode für die Designerunterstützung.
|
||||
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.mp3FilePath = new System.Windows.Forms.TextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.stopMp3 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mp3FilePath
|
||||
//
|
||||
this.mp3FilePath.Location = new System.Drawing.Point(131, 8);
|
||||
this.mp3FilePath.Name = "mp3FilePath";
|
||||
this.mp3FilePath.ReadOnly = true;
|
||||
this.mp3FilePath.Size = new System.Drawing.Size(239, 20);
|
||||
this.mp3FilePath.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(3, 8);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(122, 21);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Choose Song";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// stopMp3
|
||||
//
|
||||
this.stopMp3.Location = new System.Drawing.Point(445, 8);
|
||||
this.stopMp3.Name = "stopMp3";
|
||||
this.stopMp3.Size = new System.Drawing.Size(65, 21);
|
||||
this.stopMp3.TabIndex = 3;
|
||||
this.stopMp3.Text = "Stop";
|
||||
this.stopMp3.UseVisualStyleBackColor = true;
|
||||
this.stopMp3.Click += new System.EventHandler(this.stopMp3_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(376, 8);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(63, 21);
|
||||
this.button2.TabIndex = 4;
|
||||
this.button2.Text = "Play";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// UserControl1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.stopMp3);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.mp3FilePath);
|
||||
this.Name = "UserControl1";
|
||||
this.Text = "{WAV_PLAYER_NAME}";
|
||||
this.Size = new System.Drawing.Size(530, 70);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TextBox mp3FilePath;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button stopMp3;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
67
ShiftOS.WinForms/Applications/mp3Player.cs
Normal file
67
ShiftOS.WinForms/Applications/mp3Player.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
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;
|
||||
|
||||
namespace ShiftOS.Engine
|
||||
{
|
||||
[Launcher("WAV Player", true, "wav_player_al")]
|
||||
[RequiresUpgrade("wav_player")]
|
||||
[WinOpen("wav_player")]
|
||||
public partial class UserControl1 : UserControl, IShiftOSWindow
|
||||
{
|
||||
string path;
|
||||
public UserControl1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "WAV|*.wav";
|
||||
|
||||
if(ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
path = ofd.FileName;
|
||||
mp3FilePath.Text = ofd.FileName;
|
||||
}
|
||||
}
|
||||
|
||||
private void stopMp3_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
|
||||
player.Stop();
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
|
||||
player.SoundLocation = path;
|
||||
player.Load();
|
||||
player.Play();
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/mp3Player.resx
Normal file
120
ShiftOS.WinForms/Applications/mp3Player.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
108
ShiftOS.WinForms/Commands.cs
Normal file
108
ShiftOS.WinForms/Commands.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShiftOS.Engine;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
[Namespace("coherence")]
|
||||
[RequiresUpgrade("kernel_coherence")]
|
||||
public static class CoherenceCommands
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||
|
||||
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
|
||||
const UInt32 SWP_SHOWWINDOW = 0x0040;
|
||||
|
||||
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RECT
|
||||
{
|
||||
public int Left; // x position of upper-left corner
|
||||
public int Top; // y position of upper-left corner
|
||||
public int Right; // x position of lower-right corner
|
||||
public int Bottom; // y position of lower-right corner
|
||||
}
|
||||
|
||||
[Command("launch", "process: \"C:\\path\\to\\process\" - The process path to launch.", "Launch a process inside kernel coherence.")]
|
||||
[RequiresArgument("process")]
|
||||
public static bool LaunchApp(Dictionary<string, object> args)
|
||||
{
|
||||
string process = args["process"].ToString();
|
||||
var prc = Process.Start(process);
|
||||
StartCoherence(prc);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void StartCoherence(Process prc)
|
||||
{
|
||||
RECT rct = new RECT();
|
||||
|
||||
|
||||
while (!GetWindowRect(prc.MainWindowHandle, ref rct))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
AppearanceManager.Invoke(new Action(() =>
|
||||
{
|
||||
IShiftOSWindow coherenceWindow = new Applications.CoherenceOverlay(prc.MainWindowHandle, rct);
|
||||
|
||||
AppearanceManager.SetupWindow(coherenceWindow);
|
||||
SetWindowPos(prc.MainWindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
|
||||
//MakeExternalWindowBorderless(prc.MainWindowHandle);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
const int WS_BORDER = 8388608;
|
||||
const int WS_DLGFRAME = 4194304;
|
||||
const int WS_CAPTION = WS_BORDER | WS_DLGFRAME;
|
||||
const int WS_SYSMENU = 524288;
|
||||
const int WS_THICKFRAME = 262144;
|
||||
const int WS_MINIMIZE = 536870912;
|
||||
const int WS_MAXIMIZEBOX = 65536;
|
||||
const int GWL_STYLE = -16;
|
||||
const int GWL_EXSTYLE = -20;
|
||||
const int WS_EX_DLGMODALFRAME = 0x1;
|
||||
const int SWP_NOMOVE = 0x2;
|
||||
const int SWP_NOSIZE = 0x1;
|
||||
const int SWP_FRAMECHANGED = 0x20;
|
||||
const uint MF_BYPOSITION = 0x400;
|
||||
const uint MF_REMOVE = 0x1000;
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
|
||||
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
|
||||
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
|
||||
public static void MakeExternalWindowBorderless(IntPtr MainWindowHandle)
|
||||
{
|
||||
int Style = 0;
|
||||
Style = GetWindowLong(MainWindowHandle, GWL_STYLE);
|
||||
Style = Style & ~WS_CAPTION;
|
||||
Style = Style & ~WS_SYSMENU;
|
||||
Style = Style & ~WS_THICKFRAME;
|
||||
Style = Style & ~WS_MINIMIZE;
|
||||
Style = Style & ~WS_MAXIMIZEBOX;
|
||||
SetWindowLong(MainWindowHandle, GWL_STYLE, Style);
|
||||
Style = GetWindowLong(MainWindowHandle, GWL_EXSTYLE);
|
||||
SetWindowLong(MainWindowHandle, GWL_EXSTYLE, Style | WS_EX_DLGMODALFRAME);
|
||||
SetWindowPos(MainWindowHandle, new IntPtr(0), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
}
|
69
ShiftOS.WinForms/Controls/ColorControl.Designer.cs
generated
Normal file
69
ShiftOS.WinForms/Controls/ColorControl.Designer.cs
generated
Normal file
|
@ -0,0 +1,69 @@
|
|||
using System.Windows.Forms;
|
||||
|
||||
namespace ShiftOS.WinForms.Controls
|
||||
{
|
||||
partial class ColorControl
|
||||
{
|
||||
/// <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 Component 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.pnlcolorbox = new Canvas();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlcolorbox
|
||||
//
|
||||
this.pnlcolorbox.Location = new System.Drawing.Point(37, 18);
|
||||
this.pnlcolorbox.Name = "pnlcolorbox";
|
||||
this.pnlcolorbox.Size = new System.Drawing.Size(255, 255);
|
||||
this.pnlcolorbox.TabIndex = 0;
|
||||
//
|
||||
// ColorPicker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.Controls.Add(this.pnlcolorbox);
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Name = "ColorPicker";
|
||||
this.Size = new System.Drawing.Size(332, 520);
|
||||
this.Load += new System.EventHandler(this.ColorPicker_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Canvas pnlcolorbox;
|
||||
}
|
||||
|
||||
internal class Canvas : Panel
|
||||
{
|
||||
public Canvas() : base()
|
||||
{
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
}
|
||||
}
|
243
ShiftOS.WinForms/Controls/ColorControl.cs
Normal file
243
ShiftOS.WinForms/Controls/ColorControl.cs
Normal file
|
@ -0,0 +1,243 @@
|
|||
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 ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Controls
|
||||
{
|
||||
public partial class ColorControl : UserControl
|
||||
{
|
||||
public ColorControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DoubleBuffered = true;
|
||||
}
|
||||
|
||||
public Color SelectedForeground = Color.Black;
|
||||
|
||||
public Color GetColorFromCoords(Point pt)
|
||||
{
|
||||
for (int r = 0; r <= 255; r++)
|
||||
{
|
||||
//As we move to the right of the panel things should get more blue...
|
||||
//and as we go down, more red
|
||||
//and as we go down AND to the right, green.
|
||||
for (int b = 0; b <= 255; b++)
|
||||
{
|
||||
int xy = LinearInterpolate(0, 255 * 255, pt.X * pt.Y, 0, 255);
|
||||
int g = LinearInterpolate(0, 255 * 255, r * b, 0, 255);
|
||||
if (pt.X == b && pt.Y == r && g == xy)
|
||||
return Color.FromArgb(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
return Color.Empty;
|
||||
}
|
||||
|
||||
public Color SelectedColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectedForeground;
|
||||
}
|
||||
set
|
||||
{
|
||||
SelectedForeground = value;
|
||||
}
|
||||
}
|
||||
|
||||
int LastX, LastY = 0;
|
||||
|
||||
private void ColorPicker_Load(object sender, EventArgs e)
|
||||
{
|
||||
pnlcolorbox.MouseMove += (o, a) =>
|
||||
{
|
||||
if (a.Button == MouseButtons.Left)
|
||||
{
|
||||
SelectedColor = GetColorFromCoords(a.Location);
|
||||
LastX = a.Location.X;
|
||||
LastY = a.Location.Y;
|
||||
DrawEverything();
|
||||
}
|
||||
|
||||
};
|
||||
pnlcolorbox.Paint += (o, a) =>
|
||||
{
|
||||
|
||||
float selectedX = 0;
|
||||
float selectedY = 0;
|
||||
float width = 5;
|
||||
float height = 5;
|
||||
|
||||
for (int r = 0; r <= 255; r++)
|
||||
{
|
||||
//As we move to the right of the panel things should get more blue...
|
||||
//and as we go down, more red
|
||||
//and as we go down AND to the right, green.
|
||||
for (int b = 0; b <= 255; b++)
|
||||
{
|
||||
int g = LinearInterpolate(0, 255 * 255, r * b, 0, 255);
|
||||
var c = Color.FromArgb(r, g, b);
|
||||
a.Graphics.FillRectangle(new SolidBrush(c), b, r, 1, 1);
|
||||
if (SelectedColor == c)
|
||||
{
|
||||
selectedX = b - 2;
|
||||
selectedY = r - 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int selectedg = LinearInterpolate(0, 255 * 255, (int)(selectedX + 2 * selectedY + 2), 0, 255);
|
||||
var inverted = InvertColor((int)selectedX + 2, selectedg, (int)selectedY + 2);
|
||||
a.Graphics.DrawEllipse(new Pen(new SolidBrush(inverted), 1), selectedX, selectedY, width, height);
|
||||
|
||||
};
|
||||
|
||||
red.Width = 255;
|
||||
red.Left = pnlcolorbox.Left;
|
||||
red.Top = pnlcolorbox.Top + pnlcolorbox.Height + 5;
|
||||
red.Height = 20;
|
||||
red.TextChanged += (o, a) =>
|
||||
{
|
||||
if(red.Text != SelectedColor.R.ToString())
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedColor = Color.FromArgb(SelectedColor.A, Convert.ToInt32(red.Text), SelectedColor.G, SelectedColor.B);
|
||||
DrawEverything();
|
||||
}
|
||||
catch
|
||||
{
|
||||
red.Text = SelectedColor.R.ToString();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.Controls.Add(red);
|
||||
red.Show();
|
||||
|
||||
green.Width = 255;
|
||||
green.Left = pnlcolorbox.Left;
|
||||
green.Top = red.Top + red.Height + 5;
|
||||
green.Height = 20;
|
||||
green.TextChanged += (o, a) =>
|
||||
{
|
||||
if (green.Text != SelectedColor.G.ToString())
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedColor = Color.FromArgb(SelectedColor.A, SelectedColor.R, Convert.ToInt32(green.Text), SelectedColor.B);
|
||||
DrawEverything();
|
||||
}
|
||||
catch
|
||||
{
|
||||
green.Text = SelectedColor.G.ToString();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.Controls.Add(green);
|
||||
green.Show();
|
||||
|
||||
blue.Width = 255;
|
||||
blue.Left = pnlcolorbox.Left;
|
||||
blue.Top = green.Top + red.Height + 5;
|
||||
blue.Height = 20;
|
||||
blue.TextChanged += (o, a) =>
|
||||
{
|
||||
if (blue.Text != SelectedColor.B.ToString())
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedColor = Color.FromArgb(SelectedColor.A, SelectedColor.R, SelectedColor.G, Convert.ToInt32(blue.Text));
|
||||
DrawEverything();
|
||||
}
|
||||
catch
|
||||
{
|
||||
blue.Text = SelectedColor.B.ToString();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.Controls.Add(blue);
|
||||
blue.Show();
|
||||
|
||||
alpha.Width = 255;
|
||||
alpha.Left = pnlcolorbox.Left;
|
||||
alpha.Top = blue.Top + red.Height + 5;
|
||||
alpha.Height = 20;
|
||||
alpha.TextChanged += (o, a) =>
|
||||
{
|
||||
if (alpha.Text != SelectedColor.A.ToString())
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedColor = Color.FromArgb(Convert.ToInt32(alpha.Text), SelectedColor.R, SelectedColor.G, SelectedColor.B);
|
||||
DrawEverything();
|
||||
}
|
||||
catch
|
||||
{
|
||||
alpha.Text = SelectedColor.A.ToString();
|
||||
}
|
||||
}
|
||||
}; this.Controls.Add(alpha);
|
||||
alpha.Show();
|
||||
|
||||
preview.Width = 255;
|
||||
preview.Left = pnlcolorbox.Left;
|
||||
preview.Top = alpha.Top + red.Height + 5;
|
||||
preview.Height = 20;
|
||||
preview.Paint += (o, a) =>
|
||||
{
|
||||
int width = preview.Width / 2;
|
||||
int height = preview.Height;
|
||||
a.Graphics.FillRectangle(new SolidBrush(SelectedForeground), 0, 0, width * 2, height);
|
||||
};
|
||||
this.Controls.Add(preview);
|
||||
preview.Show();
|
||||
|
||||
ControlManager.SetupControl(red);
|
||||
ControlManager.SetupControl(green);
|
||||
ControlManager.SetupControl(blue);
|
||||
ControlManager.SetupControl(alpha);
|
||||
|
||||
|
||||
DrawEverything();
|
||||
}
|
||||
|
||||
|
||||
TextBox red = new TextBox();
|
||||
TextBox green = new TextBox();
|
||||
TextBox blue = new TextBox();
|
||||
TextBox alpha = new TextBox();
|
||||
Panel preview = new Panel();
|
||||
|
||||
|
||||
public Color InvertColor(int r, int g, int b)
|
||||
{
|
||||
return Color.FromArgb(255 - r, 255 - g, 255 - b);
|
||||
}
|
||||
|
||||
public void DrawEverything()
|
||||
{
|
||||
pnlcolorbox.Refresh();
|
||||
red.Text = SelectedColor.R.ToString();
|
||||
green.Text = SelectedColor.G.ToString();
|
||||
blue.Text = SelectedColor.B.ToString();
|
||||
alpha.Text = SelectedColor.A.ToString();
|
||||
preview.Refresh();
|
||||
}
|
||||
|
||||
public int LinearInterpolate(int input_start, int input_end, int input, int output_start, int output_end)
|
||||
{
|
||||
int input_range = input_end - input_start;
|
||||
int output_range = output_end - output_start;
|
||||
|
||||
return (input - input_start) * output_range / input_range + output_start;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue