mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Very early version of FormatEditor
This commit is contained in:
parent
4e52b93912
commit
4989356d67
7 changed files with 718 additions and 5 deletions
210
ShiftOS.WinForms/Applications/FormatEditor.Designer.cs
generated
Normal file
210
ShiftOS.WinForms/Applications/FormatEditor.Designer.cs
generated
Normal file
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class FormatEditor
|
||||
{
|
||||
/// <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.panelEditor = new System.Windows.Forms.Panel();
|
||||
this.btnAddText = new System.Windows.Forms.Button();
|
||||
this.btnAddOptionalText = new System.Windows.Forms.Button();
|
||||
this.btnAddRegexText = new System.Windows.Forms.Button();
|
||||
this.btnAddCommand = new System.Windows.Forms.Button();
|
||||
this.lblExampleCommand = new System.Windows.Forms.Label();
|
||||
this.btnAddColor = new System.Windows.Forms.Button();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.btnTest = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panelEditor
|
||||
//
|
||||
this.panelEditor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelEditor.AutoScroll = true;
|
||||
this.panelEditor.Location = new System.Drawing.Point(4, 4);
|
||||
this.panelEditor.Name = "panelEditor";
|
||||
this.panelEditor.Size = new System.Drawing.Size(589, 46);
|
||||
this.panelEditor.TabIndex = 1;
|
||||
//
|
||||
// btnAddText
|
||||
//
|
||||
this.btnAddText.Location = new System.Drawing.Point(4, 56);
|
||||
this.btnAddText.Name = "btnAddText";
|
||||
this.btnAddText.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAddText.TabIndex = 2;
|
||||
this.btnAddText.Text = "Add Text";
|
||||
this.btnAddText.UseVisualStyleBackColor = true;
|
||||
this.btnAddText.Click += new System.EventHandler(this.btnAddText_Click);
|
||||
//
|
||||
// btnAddOptionalText
|
||||
//
|
||||
this.btnAddOptionalText.Location = new System.Drawing.Point(85, 56);
|
||||
this.btnAddOptionalText.Name = "btnAddOptionalText";
|
||||
this.btnAddOptionalText.Size = new System.Drawing.Size(107, 23);
|
||||
this.btnAddOptionalText.TabIndex = 3;
|
||||
this.btnAddOptionalText.Text = "Add Optional Text";
|
||||
this.btnAddOptionalText.UseVisualStyleBackColor = true;
|
||||
this.btnAddOptionalText.Click += new System.EventHandler(this.btnAddOptionalText_Click);
|
||||
//
|
||||
// btnAddRegexText
|
||||
//
|
||||
this.btnAddRegexText.Location = new System.Drawing.Point(198, 56);
|
||||
this.btnAddRegexText.Name = "btnAddRegexText";
|
||||
this.btnAddRegexText.Size = new System.Drawing.Size(107, 23);
|
||||
this.btnAddRegexText.TabIndex = 4;
|
||||
this.btnAddRegexText.Text = "Add Regex Text";
|
||||
this.btnAddRegexText.UseVisualStyleBackColor = true;
|
||||
this.btnAddRegexText.Click += new System.EventHandler(this.btnAddRegexText_Click);
|
||||
//
|
||||
// btnAddCommand
|
||||
//
|
||||
this.btnAddCommand.Location = new System.Drawing.Point(4, 85);
|
||||
this.btnAddCommand.Name = "btnAddCommand";
|
||||
this.btnAddCommand.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAddCommand.TabIndex = 5;
|
||||
this.btnAddCommand.Text = "+ Command";
|
||||
this.btnAddCommand.UseVisualStyleBackColor = true;
|
||||
this.btnAddCommand.Click += new System.EventHandler(this.btnAddCommand_Click);
|
||||
//
|
||||
// lblExampleCommand
|
||||
//
|
||||
this.lblExampleCommand.AutoSize = true;
|
||||
this.lblExampleCommand.Location = new System.Drawing.Point(4, 115);
|
||||
this.lblExampleCommand.Name = "lblExampleCommand";
|
||||
this.lblExampleCommand.Size = new System.Drawing.Size(290, 13);
|
||||
this.lblExampleCommand.TabIndex = 8;
|
||||
this.lblExampleCommand.Text = "Create a command and an example usage will show up here";
|
||||
//
|
||||
// btnAddColor
|
||||
//
|
||||
this.btnAddColor.Location = new System.Drawing.Point(311, 56);
|
||||
this.btnAddColor.Name = "btnAddColor";
|
||||
this.btnAddColor.Size = new System.Drawing.Size(64, 23);
|
||||
this.btnAddColor.TabIndex = 9;
|
||||
this.btnAddColor.Text = "Add Color";
|
||||
this.btnAddColor.UseVisualStyleBackColor = true;
|
||||
this.btnAddColor.Click += new System.EventHandler(this.btnAddColor_Click);
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.Location = new System.Drawing.Point(7, 132);
|
||||
this.richTextBox1.Multiline = false;
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(476, 23);
|
||||
this.richTextBox1.TabIndex = 10;
|
||||
this.richTextBox1.Text = "";
|
||||
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
|
||||
//
|
||||
// btnTest
|
||||
//
|
||||
this.btnTest.Location = new System.Drawing.Point(490, 132);
|
||||
this.btnTest.Name = "btnTest";
|
||||
this.btnTest.Size = new System.Drawing.Size(47, 23);
|
||||
this.btnTest.TabIndex = 11;
|
||||
this.btnTest.Text = "Test";
|
||||
this.btnTest.UseVisualStyleBackColor = true;
|
||||
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(7, 161);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(47, 23);
|
||||
this.button1.TabIndex = 12;
|
||||
this.button1.Text = "Apply";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(60, 161);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(47, 23);
|
||||
this.button2.TabIndex = 13;
|
||||
this.button2.Text = "Save";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormatEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.btnTest);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Controls.Add(this.btnAddColor);
|
||||
this.Controls.Add(this.lblExampleCommand);
|
||||
this.Controls.Add(this.btnAddText);
|
||||
this.Controls.Add(this.btnAddOptionalText);
|
||||
this.Controls.Add(this.btnAddRegexText);
|
||||
this.Controls.Add(this.btnAddCommand);
|
||||
this.Controls.Add(this.panelEditor);
|
||||
this.Name = "FormatEditor";
|
||||
this.Size = new System.Drawing.Size(596, 426);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Panel panelEditor;
|
||||
private System.Windows.Forms.Button btnAddText;
|
||||
private System.Windows.Forms.Button btnAddOptionalText;
|
||||
private System.Windows.Forms.Button btnAddRegexText;
|
||||
private System.Windows.Forms.Button btnAddCommand;
|
||||
private System.Windows.Forms.Label lblExampleCommand;
|
||||
private System.Windows.Forms.Button btnAddColor;
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Button btnTest;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
343
ShiftOS.WinForms/Applications/FormatEditor.cs
Normal file
343
ShiftOS.WinForms/Applications/FormatEditor.cs
Normal file
|
@ -0,0 +1,343 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications {
|
||||
[Launcher("FormatEditor", true, "al_format_editor", "Games")]
|
||||
[RequiresUpgrade("format_editor")]
|
||||
[WinOpen("formateditor")]
|
||||
[DefaultIcon("iconFormatEditor")]
|
||||
|
||||
public partial class FormatEditor : UserControl, IShiftOSWindow {
|
||||
|
||||
IList<CommandFormat> parts = new List<CommandFormat>();
|
||||
IList<Panel> editorBoxes = new List<Panel>();
|
||||
|
||||
string commandMode = "command";
|
||||
int avcount = 0;
|
||||
|
||||
public FormatEditor() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void OnLoad() {
|
||||
OnUpgrade();
|
||||
}
|
||||
|
||||
public void OnSkinLoad() { }
|
||||
|
||||
public bool OnUnload() { return true; }
|
||||
|
||||
public void OnUpgrade() {
|
||||
btnAddOptionalText.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_optional_text");
|
||||
btnAddRegexText.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_regex");
|
||||
btnAddColor.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_syntax_highlighting");
|
||||
}
|
||||
|
||||
private void addPart(CommandFormat part) {
|
||||
parts.Add(part);
|
||||
Panel container = new Panel();
|
||||
|
||||
Control drawnPart = part.Draw();
|
||||
container.Size = drawnPart.Size;
|
||||
container.Controls.Add(drawnPart);
|
||||
|
||||
int woffset = 0;
|
||||
if (editorBoxes.Count > 0) {
|
||||
woffset = editorBoxes.Last().Width + editorBoxes.Last().Location.X;
|
||||
} else {
|
||||
woffset = 0;
|
||||
}
|
||||
|
||||
container.Location = new Point(woffset, 0);
|
||||
editorBoxes.Add(container);
|
||||
panelEditor.Controls.Add(container);
|
||||
}
|
||||
|
||||
private void btnAddText_Click(object sender, EventArgs e) {
|
||||
addPart(new CommandFormatText());
|
||||
}
|
||||
|
||||
private void btnAddOptionalText_Click(object sender, EventArgs e) {
|
||||
addPart(new CommandFormatOptionalText());
|
||||
}
|
||||
|
||||
private void btnAddRegexText_Click(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void btnAddColor_Click(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void btnAddCommand_Click(object sender, EventArgs e) {
|
||||
switch (commandMode) {
|
||||
case "command":
|
||||
addPart(new CommandFormatCommand());
|
||||
commandMode = "argument";
|
||||
btnAddCommand.Text = "+ Argument";
|
||||
break;
|
||||
case "argument":
|
||||
addPart(new CommandFormatArgument());
|
||||
commandMode = "value";
|
||||
btnAddCommand.Text = "+ \"Value\"";
|
||||
break;
|
||||
case "value":
|
||||
addPart(new CommandFormatValue());
|
||||
avcount++;
|
||||
if (avcount >= 2) {
|
||||
commandMode = "";
|
||||
btnAddCommand.Text = "";
|
||||
btnAddCommand.Enabled = false;
|
||||
}else {
|
||||
commandMode = "argument";
|
||||
btnAddCommand.Text = "+ Argument";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void richTextBox1_TextChanged(object sender, EventArgs e) {
|
||||
string command = "";
|
||||
Dictionary<string,string> arguments = new Dictionary<string, string>();
|
||||
|
||||
string text = richTextBox1.Text;
|
||||
int position = 0;
|
||||
|
||||
int commandPos;
|
||||
int firstValuePos = -1;
|
||||
int lastValuePos = -1;
|
||||
|
||||
for(int ii = 0; ii < parts.Count; ii++) {
|
||||
CommandFormat part = parts[ii];
|
||||
if (part is CommandFormatMarker) {
|
||||
if (part is CommandFormatCommand) {
|
||||
commandPos = ii;
|
||||
} else if (part is CommandFormatValue) {
|
||||
if (firstValuePos > -1)
|
||||
lastValuePos = ii;
|
||||
else
|
||||
firstValuePos = ii;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
string currentArgument = "";
|
||||
int help = -1;
|
||||
|
||||
while (position < text.Length) {
|
||||
|
||||
if (i >= parts.Count) {
|
||||
position = text.Length;
|
||||
command = "+FALSE+";
|
||||
i = 0;
|
||||
}
|
||||
|
||||
CommandFormat part = parts[i];
|
||||
string res = part.CheckValidity(text.Substring(position));
|
||||
|
||||
// ok so:
|
||||
|
||||
// example
|
||||
// COMMAND text[ --] ARGUMENT VALUE text[ --] ARGUMENT VALUE
|
||||
// COMMAND text[{] ARGUMENT text[=] VALUE text[, ] ARGUMENT text[=] VALUE text[}]
|
||||
|
||||
if (part is CommandFormatMarker) {
|
||||
if (part is CommandFormatCommand) {
|
||||
command = res;
|
||||
help = -1;
|
||||
} else if (part is CommandFormatArgument) {
|
||||
currentArgument = res;
|
||||
help = -1;
|
||||
} else if (part is CommandFormatValue) {
|
||||
arguments[currentArgument] = res;
|
||||
|
||||
if(i == firstValuePos)
|
||||
help = lastValuePos;
|
||||
if (i == lastValuePos)
|
||||
help = firstValuePos;
|
||||
}
|
||||
}
|
||||
|
||||
if(res == "+FALSE+") {
|
||||
if(help > -1) {
|
||||
i = help;
|
||||
if(i >= parts.Count) {
|
||||
position = text.Length;
|
||||
command = "+FALSE+";
|
||||
}
|
||||
}else {
|
||||
position = text.Length;
|
||||
command = "+FALSE+";
|
||||
}
|
||||
help = -1;
|
||||
}else {
|
||||
position += res.Length;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (command == "+FALSE+") {
|
||||
lblExampleCommand.Text = "Syntax Error";
|
||||
} else {
|
||||
string argvs = "{";
|
||||
|
||||
foreach (KeyValuePair<string, string> entry in arguments) {
|
||||
argvs += entry.Key + "=" + entry.Value + ", ";
|
||||
}
|
||||
|
||||
argvs += "}";
|
||||
|
||||
lblExampleCommand.Text = command + argvs;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnTest_Click(object sender, EventArgs e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface CommandFormat {
|
||||
string CheckValidity(string check);
|
||||
Control Draw();
|
||||
}
|
||||
class CommandFormatText : CommandFormat {
|
||||
protected string str;
|
||||
TextBox textBox;
|
||||
|
||||
public CommandFormatText() {
|
||||
}
|
||||
|
||||
public virtual string CheckValidity(string check) {
|
||||
return check.StartsWith(str) ? str : "+FALSE+";
|
||||
}
|
||||
|
||||
public Control Draw() {
|
||||
textBox = new TextBox();
|
||||
textBox.TextChanged += new EventHandler(TextChanged);
|
||||
textBox.Location = new Point(0,0);
|
||||
|
||||
return textBox;
|
||||
}
|
||||
|
||||
void TextChanged(object sender, EventArgs e) {
|
||||
str = textBox.Text;
|
||||
}
|
||||
}
|
||||
|
||||
class CommandFormatOptionalText : CommandFormatText {
|
||||
public override string CheckValidity(string check) {
|
||||
return check.StartsWith(str) ? str : "";
|
||||
}
|
||||
}
|
||||
|
||||
class CommandFormatMarker : CommandFormat {
|
||||
protected string str;
|
||||
Button button;
|
||||
|
||||
public CommandFormatMarker() {
|
||||
}
|
||||
|
||||
public virtual string CheckValidity(string check) {
|
||||
string res = string.Empty;
|
||||
string alphanumeric = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890"; // not using regex for performance reasons
|
||||
|
||||
foreach (char c in check) {
|
||||
if (alphanumeric.IndexOf(c) > -1) {
|
||||
res += c;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public virtual Control Draw() {
|
||||
button = new Button();
|
||||
button.Location = new Point(0, 0);
|
||||
button.Text = "Marker";
|
||||
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
||||
class CommandFormatCommand : CommandFormatMarker {
|
||||
public override Control Draw() {
|
||||
Button draw = (Button)base.Draw();
|
||||
draw.Text = "Command";
|
||||
return draw;
|
||||
}
|
||||
}
|
||||
|
||||
class CommandFormatArgument : CommandFormatMarker {
|
||||
public override Control Draw() {
|
||||
Button draw = (Button)base.Draw();
|
||||
draw.Text = "Argument";
|
||||
return draw;
|
||||
}
|
||||
}
|
||||
|
||||
class CommandFormatValue : CommandFormatMarker {
|
||||
public override string CheckValidity(string cd) {
|
||||
string res = string.Empty;
|
||||
var check = "";
|
||||
|
||||
if (cd.StartsWith("\""))
|
||||
check = cd.Substring(1);
|
||||
bool done = false;
|
||||
|
||||
foreach (char c in check) {
|
||||
Console.WriteLine(check);
|
||||
if (c != '"') {
|
||||
res += c;
|
||||
} else {
|
||||
done = true;
|
||||
res += "\"";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return done ? "\""+res : "+FALSE+";
|
||||
}
|
||||
|
||||
public override Control Draw() {
|
||||
Button draw = (Button)base.Draw();
|
||||
draw.Text = "\"Value\"";
|
||||
return draw;
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/Applications/FormatEditor.resx
Normal file
120
ShiftOS.WinForms/Applications/FormatEditor.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>
|
|
@ -87,15 +87,14 @@ namespace ShiftOS.WinForms.Applications {
|
|||
}
|
||||
|
||||
public void OnLoad() {
|
||||
buttonEasy.Visible = true;
|
||||
buttonMedium.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_medium");
|
||||
buttonHard.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_hard");
|
||||
OnUpgrade();
|
||||
|
||||
ticking.Interval = 1000;
|
||||
ticking.Tick += Ticking_Tick;
|
||||
}
|
||||
|
||||
public void OnSkinLoad() {
|
||||
|
||||
}
|
||||
|
||||
public bool OnUnload() {
|
||||
|
@ -103,7 +102,9 @@ namespace ShiftOS.WinForms.Applications {
|
|||
}
|
||||
|
||||
public void OnUpgrade() {
|
||||
|
||||
buttonEasy.Visible = true;
|
||||
buttonMedium.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_medium");
|
||||
buttonHard.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_hard");
|
||||
}
|
||||
|
||||
public void startGame(int w, int h, int b) {
|
||||
|
|
|
@ -251,6 +251,36 @@
|
|||
Description: "Add a launcher item for the MUD cracker.",
|
||||
Dependencies: "mud_cracker;app_launcher"
|
||||
},
|
||||
{
|
||||
Name: "Format Editor",
|
||||
Cost: 6000,
|
||||
Description: "Allows you to change the format of commands.",
|
||||
Dependencies: "shifter;name_changer"
|
||||
},
|
||||
{
|
||||
Name: "Format Editor Optional Text",
|
||||
Cost: 150,
|
||||
Description: "Allows you to add an optional text to commands",
|
||||
Dependencies: "format_editor"
|
||||
},
|
||||
{
|
||||
Name: "Format Editor Regex",
|
||||
Cost: 150,
|
||||
Description: "Allows you to customize your commands with regexes.",
|
||||
Dependencies: "format_editor_optional_text"
|
||||
},
|
||||
{
|
||||
Name: "Format Editor Syntax Highligting",
|
||||
Cost: 150,
|
||||
Description: "Allows you to give color to commands as the user types them.",
|
||||
Dependencies: "format_editor_regex"
|
||||
},
|
||||
{
|
||||
Name: "AL Format Editor",
|
||||
Cost: 150,
|
||||
Description: "Add a launcher item for the Format Editor.",
|
||||
Dependencies: "format_editor;app_launcher"
|
||||
},
|
||||
{
|
||||
Name: "Textpad",
|
||||
Cost: 2500,
|
||||
|
|
|
@ -178,6 +178,12 @@
|
|||
<Compile Include="Applications\ShiftoriumFrontend.Designer.cs">
|
||||
<DependentUpon>ShiftoriumFrontend.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\FormatEditor.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Applications\FormatEditor.Designer.cs">
|
||||
<DependentUpon>FormatEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\ShiftSweeper.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -334,6 +340,9 @@
|
|||
<EmbeddedResource Include="Applications\ShiftoriumFrontend.resx">
|
||||
<DependentUpon>ShiftoriumFrontend.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\FormatEditor.resx">
|
||||
<DependentUpon>FormatEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\ShiftSweeper.resx">
|
||||
<DependentUpon>ShiftSweeper.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
int track = rnd.Next(0, _provider.Count);
|
||||
byte[] mp3 = _provider.GetTrack(track);
|
||||
System.IO.File.WriteAllBytes("temp.mp3", mp3);
|
||||
System.IO.File.WriteAllBytes("temp.mp3", mp3);
|
||||
_reader = new AudioFileReader("temp.mp3");
|
||||
_out = new WaveOut();
|
||||
_out.Init(_reader);
|
||||
|
|
Loading…
Reference in a new issue