mirror of
https://github.com/HistacomUnity/Histacom2-old.git
synced 2025-01-22 09:02:01 -05:00
Merge pull request #154 from Alex-TIMEHACK/master
New resizing system + Save troubleshooter fix
This commit is contained in:
commit
d4d94f85a6
14 changed files with 508 additions and 140 deletions
|
@ -54,6 +54,12 @@
|
|||
<Compile Include="Paintbrush.cs" />
|
||||
<Compile Include="SaveSystem.cs" />
|
||||
<Compile Include="TaskBarController.cs" />
|
||||
<Compile Include="Template\ResizeOverlay.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Template\ResizeOverlay.Designer.cs">
|
||||
<DependentUpon>ResizeOverlay.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Template\Win9XBSOD.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -102,6 +108,9 @@
|
|||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Template\ResizeOverlay.resx">
|
||||
<DependentUpon>ResizeOverlay.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Template\Win9XBSOD.resx">
|
||||
<DependentUpon>Win9XBSOD.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -28,6 +28,13 @@ public static class SaveSystem
|
|||
|
||||
public static Theme currentTheme { get; set; }
|
||||
|
||||
public static bool IsBinarySave =
|
||||
#if BINARY_SAVE
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
#if BINARY_SAVE
|
||||
private static readonly byte[] magic = Encoding.UTF8.GetBytes("THSv");
|
||||
private static readonly IOrderedEnumerable<System.Reflection.PropertyInfo> properties = typeof(Save).GetProperties().OrderBy(p => (p.GetCustomAttributes(typeof(OrderAttribute), false).SingleOrDefault() as OrderAttribute).Order);
|
||||
|
|
78
Histacom2.Engine/Template/ResizeOverlay.Designer.cs
generated
Normal file
78
Histacom2.Engine/Template/ResizeOverlay.Designer.cs
generated
Normal file
|
@ -0,0 +1,78 @@
|
|||
namespace Histacom2.Engine.Template
|
||||
{
|
||||
partial class ResizeOverlay
|
||||
{
|
||||
/// <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.outline = new System.Windows.Forms.PictureBox();
|
||||
this.tmrMove = new System.Windows.Forms.Timer(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.outline)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// outline
|
||||
//
|
||||
this.outline.BackColor = System.Drawing.Color.Transparent;
|
||||
this.outline.Location = new System.Drawing.Point(194, 158);
|
||||
this.outline.Name = "outline";
|
||||
this.outline.Size = new System.Drawing.Size(300, 158);
|
||||
this.outline.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.outline.TabIndex = 0;
|
||||
this.outline.TabStop = false;
|
||||
this.outline.Paint += new System.Windows.Forms.PaintEventHandler(this.outline_Paint);
|
||||
//
|
||||
// tmrMove
|
||||
//
|
||||
this.tmrMove.Interval = 20;
|
||||
this.tmrMove.Tick += new System.EventHandler(this.tmrMove_Tick);
|
||||
//
|
||||
// ResizeOverlay
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1)))));
|
||||
this.ClientSize = new System.Drawing.Size(800, 600);
|
||||
this.Controls.Add(this.outline);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "ResizeOverlay";
|
||||
this.Tag = "ignoreFormOnTaskbar";
|
||||
this.Text = "ResizeOverlay";
|
||||
this.TopMost = true;
|
||||
this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1)))));
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
((System.ComponentModel.ISupportInitialize)(this.outline)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox outline;
|
||||
public System.Windows.Forms.Timer tmrMove;
|
||||
}
|
||||
}
|
35
Histacom2.Engine/Template/ResizeOverlay.cs
Normal file
35
Histacom2.Engine/Template/ResizeOverlay.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
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;
|
||||
|
||||
namespace Histacom2.Engine.Template
|
||||
{
|
||||
public partial class ResizeOverlay : Form
|
||||
{
|
||||
public Rectangle ToDraw = new Rectangle();
|
||||
|
||||
public ResizeOverlay()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void tmrMove_Tick(object sender, EventArgs e)
|
||||
{
|
||||
outline.Bounds = ToDraw; // Pens.Gray, ToDraw);
|
||||
}
|
||||
|
||||
private void outline_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.FillRectangle(Brushes.Gray, 0, 0, outline.Width, 4); // Top border
|
||||
e.Graphics.FillRectangle(Brushes.Gray, 0, outline.Height - 4, outline.Width, 4); // Bottom border
|
||||
e.Graphics.FillRectangle(Brushes.Gray, 0, 0, 4, outline.Height); // Left border
|
||||
e.Graphics.FillRectangle(Brushes.Gray, outline.Width - 4, 0, 4, outline.Height); // Right border
|
||||
}
|
||||
}
|
||||
}
|
123
Histacom2.Engine/Template/ResizeOverlay.resx
Normal file
123
Histacom2.Engine/Template/ResizeOverlay.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="tmrMove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
10
Histacom2.Engine/Template/WinClassic.Designer.cs
generated
10
Histacom2.Engine/Template/WinClassic.Designer.cs
generated
|
@ -162,6 +162,7 @@ private void InitializeComponent()
|
|||
this.toprightcorner.TabIndex = 6;
|
||||
this.toprightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.toprightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.toprightcorner_MouseMove);
|
||||
this.toprightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// bottomrightcorner
|
||||
//
|
||||
|
@ -174,6 +175,7 @@ private void InitializeComponent()
|
|||
this.bottomrightcorner.TabIndex = 4;
|
||||
this.bottomrightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.bottomrightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomrightcorner_MouseMove);
|
||||
this.bottomrightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// bottomleftcorner
|
||||
//
|
||||
|
@ -186,6 +188,7 @@ private void InitializeComponent()
|
|||
this.bottomleftcorner.TabIndex = 2;
|
||||
this.bottomleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.bottomleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomleftcorner_MouseMove);
|
||||
this.bottomleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// topleftcorner
|
||||
//
|
||||
|
@ -197,6 +200,7 @@ private void InitializeComponent()
|
|||
this.topleftcorner.TabIndex = 1;
|
||||
this.topleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.topleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.topleftcorner_MouseMove);
|
||||
this.topleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// left
|
||||
//
|
||||
|
@ -209,6 +213,7 @@ private void InitializeComponent()
|
|||
this.left.TabIndex = 3;
|
||||
this.left.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.left.MouseMove += new System.Windows.Forms.MouseEventHandler(this.left_MouseMove);
|
||||
this.left.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// bottom
|
||||
//
|
||||
|
@ -222,6 +227,7 @@ private void InitializeComponent()
|
|||
this.bottom.TabIndex = 5;
|
||||
this.bottom.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.bottom.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottom_MouseMove);
|
||||
this.bottom.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// right
|
||||
//
|
||||
|
@ -234,6 +240,7 @@ private void InitializeComponent()
|
|||
this.right.TabIndex = 7;
|
||||
this.right.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.right.MouseMove += new System.Windows.Forms.MouseEventHandler(this.right_MouseMove);
|
||||
this.right.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// top
|
||||
//
|
||||
|
@ -247,6 +254,7 @@ private void InitializeComponent()
|
|||
this.top.TabIndex = 8;
|
||||
this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.top.MouseMove += new System.Windows.Forms.MouseEventHandler(this.top_MouseMove);
|
||||
this.top.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// WinClassic
|
||||
//
|
||||
|
@ -254,11 +262,13 @@ private void InitializeComponent()
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(300, 300);
|
||||
this.Controls.Add(this.program);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "WinClassic";
|
||||
this.Text = "WinClassic";
|
||||
this.Activated += new System.EventHandler(this.WinClassic_Activated);
|
||||
this.Deactivate += new System.EventHandler(this.WinClassic_Deactivate);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.WinClassic_Paint);
|
||||
this.program.ResumeLayout(false);
|
||||
this.programtopbar.ResumeLayout(false);
|
||||
this.programtopbar.PerformLayout();
|
||||
|
|
|
@ -14,11 +14,13 @@ public WinClassic()
|
|||
}
|
||||
|
||||
public Font fnt;
|
||||
public ResizeOverlay resizer = new ResizeOverlay();
|
||||
|
||||
public bool resizable = true;
|
||||
public bool closeDisabled = false;
|
||||
public bool isActive = true;
|
||||
|
||||
public bool Resizing = false;
|
||||
public Bitmap ResizingBmp = null;
|
||||
public const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
public const int WM_SYSCOMMAND = 0x0112;
|
||||
public const int HT_CAPTION = 0x2;
|
||||
|
@ -72,7 +74,9 @@ private void right_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, this.Size.Height);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = MousePosition.X - this.Location.X;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,8 +84,10 @@ private void left_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable)this.Location = new Point(Cursor.Position.X, this.Location.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +95,10 @@ private void bottom_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Size = new Size(this.Size.Width, MousePosition.Y - this.Location.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Y = this.Location.Y;
|
||||
if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +106,10 @@ private void bottomrightcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, MousePosition.Y - this.Location.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = MousePosition.X - this.Location.X;
|
||||
if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,9 +117,11 @@ private void bottomleftcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) this.Height = (Cursor.Position.Y - this.Location.Y);
|
||||
if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = ((toDraw.Width + toDraw.Location.X) - Cursor.Position.X);
|
||||
if (resizable) toDraw.Height = Cursor.Position.Y - this.Location.Y;
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,10 +129,12 @@ private void topleftcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y);
|
||||
if (resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y);
|
||||
if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
if (resizable) toDraw.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y);
|
||||
if (resizable) toDraw.Y = Cursor.Position.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,8 +142,10 @@ private void top_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if(e.Button == MouseButtons.Left)
|
||||
{
|
||||
if(resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y);
|
||||
if(resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y);
|
||||
if (resizable) toDraw.Y = Cursor.Position.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,12 +153,58 @@ private void toprightcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = (Cursor.Position.X - this.Location.X);
|
||||
if (resizable) this.Height = ((this.Location.Y - Cursor.Position.Y) + this.Height);
|
||||
if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y);
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = MousePosition.X - this.Location.X;
|
||||
if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y);
|
||||
if (resizable) toDraw.Y = Cursor.Position.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
private void WinClassic_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (Resizing)
|
||||
{
|
||||
MessageBox.Show("HIT IT");
|
||||
e.Graphics.DrawImage(ResizingBmp, 0, 0, this.Width, this.Height);
|
||||
}
|
||||
}
|
||||
|
||||
private void border_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Bounds = resizer.ToDraw;
|
||||
resizer.tmrMove.Stop();
|
||||
resizer.Close();
|
||||
|
||||
resizer = new ResizeOverlay();
|
||||
}
|
||||
|
||||
private void border_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
var cursor = this.PointToClient(Cursor.Position);
|
||||
|
||||
if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0);
|
||||
else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0);
|
||||
else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0);
|
||||
else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0);
|
||||
|
||||
else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0);
|
||||
else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0);
|
||||
else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0);
|
||||
else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0);
|
||||
|
||||
// Now we need to fix this weird artificating!
|
||||
|
||||
resizer.tmrMove.Start();
|
||||
resizer.Show();
|
||||
|
||||
resizer.ToDraw = this.Bounds;
|
||||
|
||||
// However this defocuses the window which we don't want
|
||||
|
||||
WinClassic_Activated(null, null);
|
||||
}
|
||||
|
||||
public bool max = false;
|
||||
|
||||
private void maximizebutton_Click(object sender, EventArgs e)
|
||||
|
@ -216,20 +280,5 @@ private void button_MouseLeave(object sender, EventArgs e)
|
|||
var c = (Button)sender;
|
||||
c.UseVisualStyleBackColor = true;
|
||||
}
|
||||
|
||||
private void border_MouseDown(object sender, EventArgs e)
|
||||
{
|
||||
var cursor = this.PointToClient(Cursor.Position);
|
||||
|
||||
if (topleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF004, 0);
|
||||
else if (toprightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF005, 0);
|
||||
else if (bottomleftcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF007, 0);
|
||||
else if (bottomrightcorner.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF008, 0);
|
||||
|
||||
else if (top.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF003, 0);
|
||||
else if (left.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF001, 0);
|
||||
else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0);
|
||||
else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,30 +118,6 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD
|
||||
PwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA
|
||||
SUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R
|
||||
DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD
|
||||
TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toprightcorner.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
|
@ -196,6 +172,30 @@
|
|||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAIAAADAusJtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAAVSURBVBhXYzh8
|
||||
/DTD////wfTh46cBUSgJ/bC/izUAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD
|
||||
PwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA
|
||||
SUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R
|
||||
DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD
|
||||
TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
|
@ -67,7 +67,6 @@ private void InitializeComponent()
|
|||
// program
|
||||
//
|
||||
this.program.BackColor = System.Drawing.Color.Silver;
|
||||
this.program.Controls.Add(this.pnlSave);
|
||||
this.program.Controls.Add(this.mainView);
|
||||
this.program.Controls.Add(this.diskView);
|
||||
this.program.Controls.Add(this.MenuStrip1);
|
||||
|
@ -75,6 +74,7 @@ private void InitializeComponent()
|
|||
this.program.Controls.Add(this.bottomrightcorner);
|
||||
this.program.Controls.Add(this.bottomleftcorner);
|
||||
this.program.Controls.Add(this.topleftcorner);
|
||||
this.program.Controls.Add(this.pnlSave);
|
||||
this.program.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.program.Location = new System.Drawing.Point(0, 0);
|
||||
this.program.Name = "program";
|
||||
|
@ -86,9 +86,10 @@ private void InitializeComponent()
|
|||
this.pnlSave.Controls.Add(this.Button1);
|
||||
this.pnlSave.Controls.Add(this.Label1);
|
||||
this.pnlSave.Controls.Add(this.txtSave);
|
||||
this.pnlSave.Location = new System.Drawing.Point(3, 474);
|
||||
this.pnlSave.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pnlSave.Location = new System.Drawing.Point(0, 482);
|
||||
this.pnlSave.Name = "pnlSave";
|
||||
this.pnlSave.Size = new System.Drawing.Size(850, 35);
|
||||
this.pnlSave.Size = new System.Drawing.Size(704, 35);
|
||||
this.pnlSave.TabIndex = 18;
|
||||
this.pnlSave.Visible = false;
|
||||
//
|
||||
|
@ -96,7 +97,7 @@ private void InitializeComponent()
|
|||
//
|
||||
this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.Button1.Location = new System.Drawing.Point(608, 1);
|
||||
this.Button1.Location = new System.Drawing.Point(629, 1);
|
||||
this.Button1.Name = "Button1";
|
||||
this.Button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.Button1.TabIndex = 17;
|
||||
|
@ -119,17 +120,15 @@ private void InitializeComponent()
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtSave.Location = new System.Drawing.Point(60, 3);
|
||||
this.txtSave.Name = "txtSave";
|
||||
this.txtSave.Size = new System.Drawing.Size(542, 20);
|
||||
this.txtSave.Size = new System.Drawing.Size(563, 20);
|
||||
this.txtSave.TabIndex = 15;
|
||||
//
|
||||
// mainView
|
||||
//
|
||||
this.mainView.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.mainView.Location = new System.Drawing.Point(215, 27);
|
||||
this.mainView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.mainView.Location = new System.Drawing.Point(213, 24);
|
||||
this.mainView.Name = "mainView";
|
||||
this.mainView.Size = new System.Drawing.Size(486, 444);
|
||||
this.mainView.Size = new System.Drawing.Size(491, 458);
|
||||
this.mainView.TabIndex = 10;
|
||||
this.mainView.UseCompatibleStateImageBehavior = false;
|
||||
this.mainView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.mainView_AfterLabelEdit);
|
||||
|
@ -137,12 +136,10 @@ private void InitializeComponent()
|
|||
//
|
||||
// diskView
|
||||
//
|
||||
this.diskView.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.diskView.Location = new System.Drawing.Point(3, 27);
|
||||
this.diskView.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.diskView.Location = new System.Drawing.Point(0, 24);
|
||||
this.diskView.Name = "diskView";
|
||||
this.diskView.Size = new System.Drawing.Size(213, 444);
|
||||
this.diskView.Size = new System.Drawing.Size(213, 458);
|
||||
this.diskView.TabIndex = 13;
|
||||
this.diskView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.diskView_AfterSelect);
|
||||
//
|
||||
|
|
|
@ -337,7 +337,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// Button1
|
||||
//
|
||||
this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.Button1.Location = new System.Drawing.Point(626, 3);
|
||||
this.Button1.Name = "Button1";
|
||||
|
|
|
@ -30,9 +30,9 @@ private void InitializeComponent()
|
|||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.pnlResolved = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.pnlResolved.SuspendLayout();
|
||||
|
@ -59,10 +59,32 @@ private void InitializeComponent()
|
|||
this.pnlResolved.Controls.Add(this.label2);
|
||||
this.pnlResolved.Location = new System.Drawing.Point(12, 38);
|
||||
this.pnlResolved.Name = "pnlResolved";
|
||||
this.pnlResolved.Size = new System.Drawing.Size(589, 146);
|
||||
this.pnlResolved.Size = new System.Drawing.Size(589, 275);
|
||||
this.pnlResolved.TabIndex = 1;
|
||||
this.pnlResolved.Visible = false;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.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.textBox1.Location = new System.Drawing.Point(10, 55);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.ReadOnly = true;
|
||||
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBox1.Size = new System.Drawing.Size(567, 208);
|
||||
this.textBox1.TabIndex = 3;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(9, 31);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(24, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "log:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
|
@ -73,33 +95,12 @@ private void InitializeComponent()
|
|||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "The issue has been resolved";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(9, 31);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(24, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "log:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.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.textBox1.Location = new System.Drawing.Point(10, 55);
|
||||
this.textBox1.Multiline = true;
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.ReadOnly = true;
|
||||
this.textBox1.Size = new System.Drawing.Size(567, 79);
|
||||
this.textBox1.TabIndex = 3;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
||||
this.panel2.Controls.Add(this.btnClose);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 217);
|
||||
this.panel2.Location = new System.Drawing.Point(0, 315);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(612, 30);
|
||||
this.panel2.TabIndex = 2;
|
||||
|
@ -119,7 +120,7 @@ private void InitializeComponent()
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(612, 247);
|
||||
this.ClientSize = new System.Drawing.Size(612, 345);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.pnlResolved);
|
||||
this.Controls.Add(this.label1);
|
||||
|
|
|
@ -43,6 +43,7 @@ void BeginScan()
|
|||
// Check if the main.save file exists
|
||||
|
||||
string savefile = Path.Combine(SaveSystem.ProfileDirectory, "main.save");
|
||||
string oldsavefile = Path.Combine(SaveSystem.ProfileDirectory, "oldmain.save");
|
||||
|
||||
if (!File.Exists(savefile))
|
||||
{
|
||||
|
@ -58,54 +59,111 @@ void BeginScan()
|
|||
return;
|
||||
} else {
|
||||
WriteToLog("File main.save does exist - checking contents");
|
||||
bool readable = false;
|
||||
|
||||
try
|
||||
{
|
||||
savedata = SaveSystem.ReadSave(savefile);
|
||||
|
||||
readable = true;
|
||||
} catch
|
||||
{
|
||||
WriteToLog("ISSUE FOUND! File main.save is unreadable");
|
||||
WriteToLog("Save file cannot be read - scanning each line and examining them...");
|
||||
// Take a little look at the file?
|
||||
|
||||
WriteToLog("Sorry, there is no repairing it easily, your data will be lost");
|
||||
// But first let's just create a measure of how the JSON SHOULD look
|
||||
if (!SaveSystem.IsBinarySave)
|
||||
{
|
||||
if (File.Exists(oldsavefile)) File.Delete(oldsavefile);
|
||||
File.Copy(savefile, oldsavefile);
|
||||
|
||||
string backupfile = Path.Combine(SaveSystem.ProfileDirectory, "main.backup");
|
||||
SaveSystem.NewGame();
|
||||
string[] fileLines = File.ReadAllText(oldsavefile).Split('\n');
|
||||
string[] shouldBeLines = File.ReadAllText(savefile).Split('\n');
|
||||
int i = 0;
|
||||
|
||||
if (Directory.Exists(backupfile)) Directory.Delete(backupfile);
|
||||
string newJson = "";
|
||||
|
||||
File.Copy(savefile, backupfile);
|
||||
SaveSystem.NewGame();
|
||||
foreach (string element in fileLines)
|
||||
{
|
||||
element.Replace("\n", "").Replace("\r", "");
|
||||
}
|
||||
|
||||
// Make sure the username is set
|
||||
foreach (string line in fileLines)
|
||||
{
|
||||
if (!line.StartsWith("{"))
|
||||
{
|
||||
if (!line.StartsWith("}"))
|
||||
{
|
||||
try {
|
||||
// We will attempt to deserialize this line
|
||||
|
||||
SaveSystem.CurrentSave.Username = SaveSystem.ProfileName;
|
||||
Newtonsoft.Json.JsonConvert.DeserializeObject("{" + $"{Environment.NewLine}{line}{Environment.NewLine}" + "}");
|
||||
|
||||
WriteToLog($"The corrupt file has been stored in {backupfile}");
|
||||
// It worked! This line is not the problem!
|
||||
|
||||
EndScan(true);
|
||||
}
|
||||
|
||||
newJson += $"{Environment.NewLine}{fileLines[i]}";
|
||||
|
||||
// Check the values
|
||||
WriteToLog($"The line {fileLines[i]} is fine!");
|
||||
} catch {
|
||||
// If it failed to read this line the this is the line that's causing problems!
|
||||
|
||||
if (savedata.CurrentOS == null || savedata.CurrentOS == "")
|
||||
{
|
||||
WriteToLog("ISSUE FOUND! Data for CurrentOS is null! Giving default value...");
|
||||
savedata.CurrentOS = "95";
|
||||
EndScan(true);
|
||||
try { newJson += $"{Environment.NewLine}{shouldBeLines[i]}";
|
||||
WriteToLog($"ISSUE FOUND! The line {fileLines[i]} was corrupt - it has been reset to default settings!");
|
||||
} catch { WriteToLog($"ISSUE FOUND! A line was unneeded - it has been removed as it should!"); } // The reason I'm catching that is in case someone adds a line at the end of the file or something
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// After all that let's see if we fixed the file - but first, add the "{" and "}" in!
|
||||
|
||||
newJson = "{" + $"{Environment.NewLine}{newJson}{Environment.NewLine}" + "}";
|
||||
|
||||
// Now let's test it
|
||||
|
||||
try
|
||||
{
|
||||
savedata = Newtonsoft.Json.JsonConvert.DeserializeObject<Save>(newJson);
|
||||
|
||||
WriteToLog("Save file successfully recovered!");
|
||||
|
||||
File.WriteAllText(savefile, newJson);
|
||||
readable = true;
|
||||
|
||||
if (File.Exists(oldsavefile)) File.Delete(oldsavefile);
|
||||
EndScan(true);
|
||||
} catch {
|
||||
// It's unusable...
|
||||
|
||||
WriteToLog("ISSUE FOUND! File main.save is unreadable");
|
||||
|
||||
WriteToLog("Sorry, there is no repairing it easily, your data will be lost");
|
||||
|
||||
string backupfile = Path.Combine(SaveSystem.ProfileDirectory, "main.backup");
|
||||
|
||||
if (Directory.Exists(backupfile)) Directory.Delete(backupfile);
|
||||
|
||||
File.Copy(savefile, backupfile);
|
||||
SaveSystem.NewGame();
|
||||
|
||||
// Make sure the username is set
|
||||
|
||||
SaveSystem.CurrentSave.Username = SaveSystem.ProfileName;
|
||||
SaveSystem.SaveGame();
|
||||
|
||||
WriteToLog($"The corrupt file has been stored in {backupfile}");
|
||||
|
||||
EndScan(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (savedata.ExperiencedStories == null)
|
||||
{
|
||||
WriteToLog("ISSUE FOUND! Data for ExperiencedStories is null! Giving default value...");
|
||||
savedata.ExperiencedStories = new List<string>();
|
||||
}
|
||||
|
||||
if (savedata.ThemeName == null || savedata.ThemeName == "")
|
||||
{
|
||||
WriteToLog("ISSUE FOUND! Data for ThemeName is null! Giving default value...");
|
||||
savedata.ThemeName = "95normal";
|
||||
}
|
||||
// Check the values if it was readable
|
||||
|
||||
if (readable) CheckValues();
|
||||
|
||||
}
|
||||
|
||||
string folderspath = Path.Combine(SaveSystem.ProfileDirectory, "folders");
|
||||
|
@ -117,26 +175,29 @@ void BeginScan()
|
|||
SaveSystem.CheckFiles();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CheckValues()
|
||||
{
|
||||
foreach (var field in typeof(Save).GetFields())
|
||||
{
|
||||
if (field.GetValue(savedata) is string) if (field.GetValue(savedata).ToString() == null) { field.SetValue(savedata, ""); continue; }
|
||||
if (field.GetValue(savedata) is Theme) if (field.GetValue(savedata) == null) { field.SetValue(savedata, new Default95Theme()); continue; }
|
||||
if (field.GetValue(savedata) is List<string>) if (field.GetValue(savedata) == null) { field.SetValue(savedata, new List<string>()); }
|
||||
}
|
||||
}
|
||||
|
||||
void EndScan(bool successful)
|
||||
{
|
||||
pnlResolved.Visible = true;
|
||||
label1.Hide();
|
||||
if (successful == true)
|
||||
{
|
||||
label2.Text = "The issue has been resolved.";
|
||||
// Set CurrentSave to the resolved one
|
||||
|
||||
SaveSystem.CurrentSave = savedata;
|
||||
|
||||
// Set the main.save file to the resolved one
|
||||
|
||||
SaveSystem.WriteSave(Path.Combine(SaveSystem.ProfileDirectory, "main.save"), savedata);
|
||||
|
||||
textBox1.Text = log;
|
||||
} else {
|
||||
label2.Text = "The issue has not been resolved, sorry";
|
||||
label2.Text = "The issue has not been resolved, sorry.";
|
||||
textBox1.Text = log;
|
||||
}
|
||||
}
|
||||
|
|
2
Histacom2/TitleScreen.Designer.cs
generated
2
Histacom2/TitleScreen.Designer.cs
generated
|
@ -244,7 +244,7 @@ private void InitializeComponent()
|
|||
this.startmenuitems.Name = "startmenuitems";
|
||||
this.startmenuitems.Padding = new System.Windows.Forms.Padding(1, 2, 0, 0);
|
||||
this.startmenuitems.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.startmenuitems.Size = new System.Drawing.Size(140, 220);
|
||||
this.startmenuitems.Size = new System.Drawing.Size(140, 239);
|
||||
this.startmenuitems.TabIndex = 0;
|
||||
this.startmenuitems.Text = "StartMenu";
|
||||
//
|
||||
|
|
|
@ -207,8 +207,6 @@ public void BSODRewind(object sender, EventArgs e)
|
|||
} catch {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If VM Mode is not enabled
|
||||
if (vm_mode.Checked != true)
|
||||
|
|
Loading…
Reference in a new issue