Migrate sources of old Worms.NET CodePlex project
29
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer.sln
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WormsNET.ImgViewer", "WormsNET.ImgViewer\WormsNET.ImgViewer.csproj", "{D007CB58-9BB0-45C7-88C1-FA5945AB8EB9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 2
|
||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs32
|
||||
SccProjectUniqueName0 = WormsNET.ImgViewer\\WormsNET.ImgViewer.csproj
|
||||
SccProjectName0 = WormsNET.ImgViewer
|
||||
SccLocalPath0 = WormsNET.ImgViewer
|
||||
SccLocalPath1 = .
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D007CB58-9BB0-45C7-88C1-FA5945AB8EB9}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{D007CB58-9BB0-45C7-88C1-FA5945AB8EB9}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{D007CB58-9BB0-45C7-88C1-FA5945AB8EB9}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{D007CB58-9BB0-45C7-88C1-FA5945AB8EB9}.Release|Any CPU.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -0,0 +1,375 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WormsNET.ImgViewer
|
||||
{
|
||||
#region #### ExtendedListView #########################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Zeigt eine Auflistung von Elementen in einer von fünf verschiedenen Ansichten an.
|
||||
/// </summary>
|
||||
[ToolboxBitmap(typeof(ListView))]
|
||||
public class ExtendedListView : ListView
|
||||
{
|
||||
#region ---- DELEGATES ----------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
delegate void CallBackSetGroupState(ListViewGroup group, ListViewGroupState state);
|
||||
delegate void CallbackSetGroupString(ListViewGroup group, string value);
|
||||
|
||||
#region ---- MEMBERVARIABLEN ----------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
int? _fillColumnIndex; // Index der Spalte, die den restlichen Platz einnimmt
|
||||
bool _codeColumnWidthChange; // Wurden die Spaltenbreiten vom Code geändert?
|
||||
bool _enableAdditionalHotKeys; // Zusätzliche Tastenkombinationen erlauben?
|
||||
bool _hoverSelectionDelay; // Delay vor kompletter Auswahl bei HotTracking?
|
||||
bool _visualStylesEnabled; // Gibt an, ob visuelle Stile verwendet werden
|
||||
|
||||
#region ---- KONSTRUKTOREN & DESTRUKTOR -----------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Erstellt eine neue Instanz der ExtendedListView-Klasse.
|
||||
/// </summary>
|
||||
public ExtendedListView()
|
||||
{
|
||||
// Flimmern verhindern durch Doppelpufferung (aktiviert auch blaues Auswahlrechteck)
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer,
|
||||
true);
|
||||
|
||||
// Eigenschaften setzen
|
||||
_enableAdditionalHotKeys = true;
|
||||
_fillColumnIndex = null;
|
||||
_hoverSelectionDelay = false;
|
||||
_visualStylesEnabled = true;
|
||||
}
|
||||
|
||||
#region ---- EIGENSCHAFTEN ------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gibt an oder legt fest, ob zusätzliche Tastenkombinationen wie z.B. Strg+A zur Auswahl
|
||||
/// aller Items unterstützt werden sollen.
|
||||
/// </summary>
|
||||
[Browsable(true)]
|
||||
[Category("Behavior")]
|
||||
[DefaultValue(true)]
|
||||
[Description("Determines wether additional shortcuts like Ctrl+A for selecting all items "
|
||||
+ "are supported.")]
|
||||
public bool EnableAdditionalHotKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enableAdditionalHotKeys;
|
||||
}
|
||||
set
|
||||
{
|
||||
_enableAdditionalHotKeys = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt den Index der Spalte an, die den restlichen nicht von anderen in der ListView
|
||||
/// vorhandenen Spalten verbrauchten Platz einnimmt oder legt diesen fest.
|
||||
/// </summary>
|
||||
[Browsable(true)]
|
||||
[Category("Layout")]
|
||||
[DefaultValue(null)]
|
||||
[Description("Determines the index of the column which automatically fits into the "
|
||||
+ "remaining space of the list view which is not used by all the other columns.")]
|
||||
public int? FillColumnIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fillColumnIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
// Nur setzen, wenn sich der Wert vom bisherigen unterscheidet
|
||||
if (!_fillColumnIndex.Equals(value))
|
||||
{
|
||||
_fillColumnIndex = value;
|
||||
if (_fillColumnIndex.HasValue)
|
||||
{
|
||||
LayoutColumns();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Horizontale Bildlaufleiste ermöglichen
|
||||
NativeMethods.ShowScrollBar(Handle, NativeMethods.SB_HORZ, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt an oder legt fest ob ein kleiner Delay vor kompletter Auswahl eines überfahrenen
|
||||
/// Items stattfinden soll wenn HoverSelection aktiviert ist.
|
||||
/// </summary>
|
||||
[Browsable(true)]
|
||||
[Category("Behavior")]
|
||||
[DefaultValue(false)]
|
||||
[Description("Determines if there should be a small delay before hovered items are fully "
|
||||
+ "selected if HoverSelection is enabled.")]
|
||||
public bool HoverSelectionDelay
|
||||
{
|
||||
get
|
||||
{
|
||||
return _hoverSelectionDelay;
|
||||
}
|
||||
set
|
||||
{
|
||||
_hoverSelectionDelay = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt an oder legt fest ob diese ListView zur Darstellung visuelle Stile verwendet.
|
||||
/// </summary>
|
||||
[Browsable(true)]
|
||||
[Category("Appearance")]
|
||||
[DefaultValue(true)]
|
||||
[Description("Determines if the listview uses visual styles to display its content.")]
|
||||
public bool VisualStylesEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _visualStylesEnabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
_visualStylesEnabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PUBLIC) --------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Passt die Breiten der Spalten gemäß der Füllspalte an.
|
||||
/// </summary>
|
||||
public void LayoutColumns()
|
||||
{
|
||||
if (_fillColumnIndex.HasValue && Columns.Count > _fillColumnIndex)
|
||||
{
|
||||
// Benötigten Platz der restlichen Spalten herausfinden
|
||||
int usedSpace = 0;
|
||||
foreach (ColumnHeader column in Columns)
|
||||
{
|
||||
if (column.Index != _fillColumnIndex.Value)
|
||||
{
|
||||
usedSpace += column.Width;
|
||||
}
|
||||
}
|
||||
|
||||
// Breite der Füllspalte anpassen
|
||||
_codeColumnWidthChange = true;
|
||||
Columns[_fillColumnIndex.Value].Width = ClientSize.Width - usedSpace;
|
||||
_codeColumnWidthChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGroupCollapse(ListViewGroupState state)
|
||||
{
|
||||
for (int i = 0; i <= Groups.Count; i++)
|
||||
{
|
||||
NativeMethods.LVGROUP group = new NativeMethods.LVGROUP();
|
||||
group.cbSize = Marshal.SizeOf(group);
|
||||
group.state = (int)state;
|
||||
group.mask = NativeMethods.LVGF_STATE;
|
||||
group.iGroupId = i;
|
||||
|
||||
IntPtr ip = IntPtr.Zero;
|
||||
ip = Marshal.AllocHGlobal(group.cbSize);
|
||||
Marshal.StructureToPtr(group, ip, false);
|
||||
NativeMethods.SendMessage(Handle, NativeMethods.LVM_SETGROUPINFO, i, ip);
|
||||
|
||||
if (ip != null)
|
||||
{
|
||||
Marshal.FreeHGlobal(ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PROTECTED) -----------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
switch (m.Msg)
|
||||
{
|
||||
case NativeMethods.WM_LBUTTONUP:
|
||||
try
|
||||
{
|
||||
base.DefWndProc(ref m);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
break;
|
||||
default:
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
// Windowsstyles anwenden und gepunktete Linien entfernen
|
||||
if (VisualStylesEnabled)
|
||||
{
|
||||
NativeMethods.SetWindowTheme(Handle, "explorer", null);
|
||||
}
|
||||
NativeMethods.MakeFocusInvisible(Handle);
|
||||
|
||||
// Breiten der Spalten berechnen bezüglich Füllspalte
|
||||
LayoutColumns();
|
||||
|
||||
base.OnHandleCreated(e);
|
||||
}
|
||||
|
||||
protected override void OnColumnWidthChanged(ColumnWidthChangedEventArgs e)
|
||||
{
|
||||
if (_fillColumnIndex.HasValue)
|
||||
{
|
||||
// Horizontale Bildlaufleiste deaktivieren
|
||||
NativeMethods.ShowScrollBar(Handle, NativeMethods.SB_HORZ, 0);
|
||||
}
|
||||
|
||||
base.OnColumnWidthChanged(e);
|
||||
}
|
||||
|
||||
protected override void OnColumnWidthChanging(ColumnWidthChangingEventArgs e)
|
||||
{
|
||||
if (e != null && e.ColumnIndex.Equals(_fillColumnIndex) && !_codeColumnWidthChange)
|
||||
{
|
||||
// Ändern der Breite der Füllspalte verhindern
|
||||
e.Cancel = true;
|
||||
e.NewWidth = Columns[e.ColumnIndex].Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bei Größenänderungen die anderen Spaltenbreiten anpassen
|
||||
LayoutColumns();
|
||||
}
|
||||
|
||||
base.OnColumnWidthChanging(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
if (HoverSelection && !HoverSelectionDelay && e != null)
|
||||
{
|
||||
ListViewItem hoveredItem = GetItemAt(e.X, e.Y);
|
||||
if (hoveredItem != null && !hoveredItem.Selected)
|
||||
{
|
||||
foreach (ListViewItem item in Items)
|
||||
{
|
||||
item.Selected = false;
|
||||
}
|
||||
hoveredItem.Selected = true;
|
||||
}
|
||||
else if (hoveredItem == null && !MultiSelect)
|
||||
{
|
||||
foreach (ListViewItem item in Items)
|
||||
{
|
||||
item.Selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
// Zusätzliche Tastenkombinationen
|
||||
if (_enableAdditionalHotKeys)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
// Alle Items markieren
|
||||
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A)
|
||||
{
|
||||
foreach (ListViewItem item in Items)
|
||||
{
|
||||
item.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Item umbenennen
|
||||
if (LabelEdit && SelectedItems.Count == 1
|
||||
&& e.Modifiers == Keys.None && e.KeyCode == Keys.F2)
|
||||
{
|
||||
SelectedItems[0].BeginEdit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
// Spaltenbreiten bezüglich Füllspalte berechnen
|
||||
LayoutColumns();
|
||||
|
||||
base.OnSizeChanged(e);
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PRIVATE) -------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private static int? GetGroupId(ListViewGroup group)
|
||||
{
|
||||
int? id = null;
|
||||
Type groupType = group.GetType();
|
||||
if (groupType != null)
|
||||
{
|
||||
PropertyInfo pi = groupType.GetProperty("ID", BindingFlags.NonPublic
|
||||
| BindingFlags.Instance);
|
||||
if (pi != null)
|
||||
{
|
||||
object temp = pi.GetValue(group, null);
|
||||
if (temp != null)
|
||||
{
|
||||
id = temp as int?;
|
||||
}
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
} // #### ExtendedListView ####################################################################
|
||||
|
||||
public enum ListViewGroupMask
|
||||
{
|
||||
None = 0x00000,
|
||||
Header = 0x00001,
|
||||
Footer = 0x00002,
|
||||
State = 0x00004,
|
||||
Align = 0x00008,
|
||||
GroupId = 0x00010,
|
||||
SubTitle = 0x00100,
|
||||
Task = 0x00200,
|
||||
DescriptionTop = 0x00400,
|
||||
DescriptionBottom = 0x00800,
|
||||
TitleImage = 0x01000,
|
||||
ExtendedImage = 0x02000,
|
||||
Items = 0x04000,
|
||||
Subset = 0x08000,
|
||||
SubsetItems = 0x10000
|
||||
}
|
||||
|
||||
public enum ListViewGroupState
|
||||
{
|
||||
Expanded = 0,
|
||||
Collapsed = 1,
|
||||
Collapsible = 8
|
||||
}
|
||||
}
|
517
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,517 @@
|
||||
namespace WormsNET.ImgViewer
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <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 Windows Form-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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
this._ofdOpen = new System.Windows.Forms.OpenFileDialog();
|
||||
this._pbImage = new System.Windows.Forms.PictureBox();
|
||||
this._pnImage = new System.Windows.Forms.Panel();
|
||||
this._lbError = new System.Windows.Forms.Label();
|
||||
this._msMain = new System.Windows.Forms.MenuStrip();
|
||||
this._tsmiFile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiOpen = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiSaveAs = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiClose = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tssFile1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this._tsmiExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiView = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiDetails = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tssView1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this._tsmiBlack = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiFitToWindow = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiHelp = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiAbout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._sfdSave = new System.Windows.Forms.SaveFileDialog();
|
||||
this._scDetailsPreview = new System.Windows.Forms.SplitContainer();
|
||||
this._pnDetails = new System.Windows.Forms.Panel();
|
||||
this._gbGeneral = new System.Windows.Forms.GroupBox();
|
||||
this._cbHeader = new System.Windows.Forms.CheckBox();
|
||||
this._cbCompressed = new System.Windows.Forms.CheckBox();
|
||||
this._lbLength = new System.Windows.Forms.Label();
|
||||
this._tbSizeBpp = new System.Windows.Forms.TextBox();
|
||||
this._lbDescription = new System.Windows.Forms.Label();
|
||||
this._lbSizeBpp = new System.Windows.Forms.Label();
|
||||
this._tbLength = new System.Windows.Forms.TextBox();
|
||||
this._tbDescription = new System.Windows.Forms.TextBox();
|
||||
this._gbPalette = new System.Windows.Forms.GroupBox();
|
||||
this._lvColors = new WormsNET.ImgViewer.ExtendedListView();
|
||||
this._colColors = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this._cbPalette = new System.Windows.Forms.CheckBox();
|
||||
this._lbFilename = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this._pbImage)).BeginInit();
|
||||
this._pnImage.SuspendLayout();
|
||||
this._msMain.SuspendLayout();
|
||||
this._scDetailsPreview.Panel1.SuspendLayout();
|
||||
this._scDetailsPreview.Panel2.SuspendLayout();
|
||||
this._scDetailsPreview.SuspendLayout();
|
||||
this._pnDetails.SuspendLayout();
|
||||
this._gbGeneral.SuspendLayout();
|
||||
this._gbPalette.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// _ofdOpen
|
||||
//
|
||||
this._ofdOpen.Filter = "IMG files|*.img|All files|*.*";
|
||||
this._ofdOpen.Title = "Browse for IMG file";
|
||||
//
|
||||
// _pbImage
|
||||
//
|
||||
this._pbImage.BackColor = System.Drawing.Color.Black;
|
||||
this._pbImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this._pbImage.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._pbImage.Location = new System.Drawing.Point(0, 0);
|
||||
this._pbImage.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._pbImage.Name = "_pbImage";
|
||||
this._pbImage.Size = new System.Drawing.Size(578, 536);
|
||||
this._pbImage.TabIndex = 2;
|
||||
this._pbImage.TabStop = false;
|
||||
//
|
||||
// _pnImage
|
||||
//
|
||||
this._pnImage.AutoScroll = true;
|
||||
this._pnImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this._pnImage.Controls.Add(this._lbError);
|
||||
this._pnImage.Controls.Add(this._pbImage);
|
||||
this._pnImage.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._pnImage.Location = new System.Drawing.Point(0, 0);
|
||||
this._pnImage.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this._pnImage.Name = "_pnImage";
|
||||
this._pnImage.Size = new System.Drawing.Size(580, 538);
|
||||
this._pnImage.TabIndex = 1;
|
||||
//
|
||||
// _lbError
|
||||
//
|
||||
this._lbError.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._lbError.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._lbError.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this._lbError.Location = new System.Drawing.Point(0, 0);
|
||||
this._lbError.Name = "_lbError";
|
||||
this._lbError.Size = new System.Drawing.Size(578, 536);
|
||||
this._lbError.TabIndex = 0;
|
||||
this._lbError.Text = "No image loaded.";
|
||||
this._lbError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// _msMain
|
||||
//
|
||||
this._msMain.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._msMain.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this._msMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this._tsmiFile,
|
||||
this._tsmiView,
|
||||
this._tsmiHelp});
|
||||
this._msMain.Location = new System.Drawing.Point(0, 0);
|
||||
this._msMain.Name = "_msMain";
|
||||
this._msMain.Padding = new System.Windows.Forms.Padding(2);
|
||||
this._msMain.Size = new System.Drawing.Size(784, 24);
|
||||
this._msMain.TabIndex = 0;
|
||||
//
|
||||
// _tsmiFile
|
||||
//
|
||||
this._tsmiFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this._tsmiOpen,
|
||||
this._tsmiSaveAs,
|
||||
this._tsmiClose,
|
||||
this._tssFile1,
|
||||
this._tsmiExit});
|
||||
this._tsmiFile.Name = "_tsmiFile";
|
||||
this._tsmiFile.Size = new System.Drawing.Size(37, 20);
|
||||
this._tsmiFile.Text = "File";
|
||||
//
|
||||
// _tsmiOpen
|
||||
//
|
||||
this._tsmiOpen.Image = ((System.Drawing.Image)(resources.GetObject("_tsmiOpen.Image")));
|
||||
this._tsmiOpen.Name = "_tsmiOpen";
|
||||
this._tsmiOpen.Size = new System.Drawing.Size(121, 22);
|
||||
this._tsmiOpen.Text = "Open...";
|
||||
this._tsmiOpen.Click += new System.EventHandler(this._tsmiOpen_Click);
|
||||
//
|
||||
// _tsmiSaveAs
|
||||
//
|
||||
this._tsmiSaveAs.Enabled = false;
|
||||
this._tsmiSaveAs.Image = ((System.Drawing.Image)(resources.GetObject("_tsmiSaveAs.Image")));
|
||||
this._tsmiSaveAs.Name = "_tsmiSaveAs";
|
||||
this._tsmiSaveAs.Size = new System.Drawing.Size(121, 22);
|
||||
this._tsmiSaveAs.Text = "Save as...";
|
||||
this._tsmiSaveAs.Click += new System.EventHandler(this._tsmiSaveAs_Click);
|
||||
//
|
||||
// _tsmiClose
|
||||
//
|
||||
this._tsmiClose.Enabled = false;
|
||||
this._tsmiClose.Image = ((System.Drawing.Image)(resources.GetObject("_tsmiClose.Image")));
|
||||
this._tsmiClose.Name = "_tsmiClose";
|
||||
this._tsmiClose.Size = new System.Drawing.Size(121, 22);
|
||||
this._tsmiClose.Text = "Close";
|
||||
this._tsmiClose.Click += new System.EventHandler(this._tsmiClose_Click);
|
||||
//
|
||||
// _tssFile1
|
||||
//
|
||||
this._tssFile1.Name = "_tssFile1";
|
||||
this._tssFile1.Size = new System.Drawing.Size(118, 6);
|
||||
//
|
||||
// _tsmiExit
|
||||
//
|
||||
this._tsmiExit.Image = ((System.Drawing.Image)(resources.GetObject("_tsmiExit.Image")));
|
||||
this._tsmiExit.Name = "_tsmiExit";
|
||||
this._tsmiExit.Size = new System.Drawing.Size(121, 22);
|
||||
this._tsmiExit.Text = "Exit";
|
||||
this._tsmiExit.Click += new System.EventHandler(this._tsmiExit_Click);
|
||||
//
|
||||
// _tsmiView
|
||||
//
|
||||
this._tsmiView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this._tsmiDetails,
|
||||
this._tssView1,
|
||||
this._tsmiBlack,
|
||||
this._tsmiFitToWindow});
|
||||
this._tsmiView.Name = "_tsmiView";
|
||||
this._tsmiView.Size = new System.Drawing.Size(44, 20);
|
||||
this._tsmiView.Text = "View";
|
||||
//
|
||||
// _tsmiDetails
|
||||
//
|
||||
this._tsmiDetails.Checked = true;
|
||||
this._tsmiDetails.CheckOnClick = true;
|
||||
this._tsmiDetails.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this._tsmiDetails.Name = "_tsmiDetails";
|
||||
this._tsmiDetails.Size = new System.Drawing.Size(204, 22);
|
||||
this._tsmiDetails.Text = "Show details pane";
|
||||
this._tsmiDetails.Click += new System.EventHandler(this._tsmiDetails_Click);
|
||||
//
|
||||
// _tssView1
|
||||
//
|
||||
this._tssView1.Name = "_tssView1";
|
||||
this._tssView1.Size = new System.Drawing.Size(201, 6);
|
||||
//
|
||||
// _tsmiBlack
|
||||
//
|
||||
this._tsmiBlack.Checked = true;
|
||||
this._tsmiBlack.CheckOnClick = true;
|
||||
this._tsmiBlack.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this._tsmiBlack.Name = "_tsmiBlack";
|
||||
this._tsmiBlack.Size = new System.Drawing.Size(204, 22);
|
||||
this._tsmiBlack.Text = "Show black pixels";
|
||||
this._tsmiBlack.Click += new System.EventHandler(this._tsmiBlack_Click);
|
||||
//
|
||||
// _tsmiFitToWindow
|
||||
//
|
||||
this._tsmiFitToWindow.Checked = true;
|
||||
this._tsmiFitToWindow.CheckOnClick = true;
|
||||
this._tsmiFitToWindow.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this._tsmiFitToWindow.Name = "_tsmiFitToWindow";
|
||||
this._tsmiFitToWindow.Size = new System.Drawing.Size(204, 22);
|
||||
this._tsmiFitToWindow.Text = "Fit image to window size";
|
||||
this._tsmiFitToWindow.Click += new System.EventHandler(this._tsmiFitToWindow_Click);
|
||||
//
|
||||
// _tsmiHelp
|
||||
//
|
||||
this._tsmiHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this._tsmiAbout});
|
||||
this._tsmiHelp.Name = "_tsmiHelp";
|
||||
this._tsmiHelp.Size = new System.Drawing.Size(44, 20);
|
||||
this._tsmiHelp.Text = "Help";
|
||||
//
|
||||
// _tsmiAbout
|
||||
//
|
||||
this._tsmiAbout.Image = ((System.Drawing.Image)(resources.GetObject("_tsmiAbout.Image")));
|
||||
this._tsmiAbout.Name = "_tsmiAbout";
|
||||
this._tsmiAbout.Size = new System.Drawing.Size(116, 22);
|
||||
this._tsmiAbout.Text = "About...";
|
||||
this._tsmiAbout.Click += new System.EventHandler(this._tsmiAbout_Click);
|
||||
//
|
||||
// _sfdSave
|
||||
//
|
||||
this._sfdSave.Filter = "Bitmap|*.bmp|PNG image|*.png|JPEG image|*.jpg";
|
||||
this._sfdSave.FilterIndex = 2;
|
||||
this._sfdSave.Title = "Save IMG file as...";
|
||||
//
|
||||
// _scDetailsPreview
|
||||
//
|
||||
this._scDetailsPreview.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._scDetailsPreview.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this._scDetailsPreview.IsSplitterFixed = true;
|
||||
this._scDetailsPreview.Location = new System.Drawing.Point(0, 24);
|
||||
this._scDetailsPreview.Name = "_scDetailsPreview";
|
||||
//
|
||||
// _scDetailsPreview.Panel1
|
||||
//
|
||||
this._scDetailsPreview.Panel1.Controls.Add(this._pnDetails);
|
||||
//
|
||||
// _scDetailsPreview.Panel2
|
||||
//
|
||||
this._scDetailsPreview.Panel2.Controls.Add(this._pnImage);
|
||||
this._scDetailsPreview.Size = new System.Drawing.Size(784, 538);
|
||||
this._scDetailsPreview.SplitterDistance = 200;
|
||||
this._scDetailsPreview.TabIndex = 2;
|
||||
//
|
||||
// _pnDetails
|
||||
//
|
||||
this._pnDetails.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._pnDetails.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this._pnDetails.Controls.Add(this._gbGeneral);
|
||||
this._pnDetails.Controls.Add(this._gbPalette);
|
||||
this._pnDetails.Controls.Add(this._lbFilename);
|
||||
this._pnDetails.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._pnDetails.Location = new System.Drawing.Point(0, 0);
|
||||
this._pnDetails.Name = "_pnDetails";
|
||||
this._pnDetails.Padding = new System.Windows.Forms.Padding(0, 8, 8, 0);
|
||||
this._pnDetails.Size = new System.Drawing.Size(200, 538);
|
||||
this._pnDetails.TabIndex = 0;
|
||||
//
|
||||
// _gbGeneral
|
||||
//
|
||||
this._gbGeneral.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._gbGeneral.Controls.Add(this._cbHeader);
|
||||
this._gbGeneral.Controls.Add(this._cbCompressed);
|
||||
this._gbGeneral.Controls.Add(this._lbLength);
|
||||
this._gbGeneral.Controls.Add(this._tbSizeBpp);
|
||||
this._gbGeneral.Controls.Add(this._lbDescription);
|
||||
this._gbGeneral.Controls.Add(this._lbSizeBpp);
|
||||
this._gbGeneral.Controls.Add(this._tbLength);
|
||||
this._gbGeneral.Controls.Add(this._tbDescription);
|
||||
this._gbGeneral.Location = new System.Drawing.Point(3, 32);
|
||||
this._gbGeneral.Name = "_gbGeneral";
|
||||
this._gbGeneral.Size = new System.Drawing.Size(193, 162);
|
||||
this._gbGeneral.TabIndex = 1;
|
||||
this._gbGeneral.TabStop = false;
|
||||
this._gbGeneral.Text = "General information";
|
||||
//
|
||||
// _cbHeader
|
||||
//
|
||||
this._cbHeader.AutoCheck = false;
|
||||
this._cbHeader.AutoSize = true;
|
||||
this._cbHeader.Location = new System.Drawing.Point(8, 22);
|
||||
this._cbHeader.Name = "_cbHeader";
|
||||
this._cbHeader.Size = new System.Drawing.Size(97, 17);
|
||||
this._cbHeader.TabIndex = 0;
|
||||
this._cbHeader.Text = "Header correct";
|
||||
this._cbHeader.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// _cbCompressed
|
||||
//
|
||||
this._cbCompressed.AutoCheck = false;
|
||||
this._cbCompressed.AutoSize = true;
|
||||
this._cbCompressed.Location = new System.Drawing.Point(8, 47);
|
||||
this._cbCompressed.Name = "_cbCompressed";
|
||||
this._cbCompressed.Size = new System.Drawing.Size(84, 17);
|
||||
this._cbCompressed.TabIndex = 1;
|
||||
this._cbCompressed.Text = "Compressed";
|
||||
this._cbCompressed.ThreeState = true;
|
||||
this._cbCompressed.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// _lbLength
|
||||
//
|
||||
this._lbLength.AutoSize = true;
|
||||
this._lbLength.Location = new System.Drawing.Point(5, 75);
|
||||
this._lbLength.Name = "_lbLength";
|
||||
this._lbLength.Size = new System.Drawing.Size(62, 15);
|
||||
this._lbLength.TabIndex = 2;
|
||||
this._lbLength.Text = "Length (b)";
|
||||
//
|
||||
// _tbSizeBpp
|
||||
//
|
||||
this._tbSizeBpp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._tbSizeBpp.Location = new System.Drawing.Point(78, 130);
|
||||
this._tbSizeBpp.Name = "_tbSizeBpp";
|
||||
this._tbSizeBpp.ReadOnly = true;
|
||||
this._tbSizeBpp.Size = new System.Drawing.Size(106, 23);
|
||||
this._tbSizeBpp.TabIndex = 7;
|
||||
this._tbSizeBpp.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// _lbDescription
|
||||
//
|
||||
this._lbDescription.AutoSize = true;
|
||||
this._lbDescription.Location = new System.Drawing.Point(5, 104);
|
||||
this._lbDescription.Name = "_lbDescription";
|
||||
this._lbDescription.Size = new System.Drawing.Size(67, 15);
|
||||
this._lbDescription.TabIndex = 4;
|
||||
this._lbDescription.Text = "Description";
|
||||
//
|
||||
// _lbSizeBpp
|
||||
//
|
||||
this._lbSizeBpp.AutoSize = true;
|
||||
this._lbSizeBpp.Location = new System.Drawing.Point(5, 133);
|
||||
this._lbSizeBpp.Name = "_lbSizeBpp";
|
||||
this._lbSizeBpp.Size = new System.Drawing.Size(64, 15);
|
||||
this._lbSizeBpp.TabIndex = 6;
|
||||
this._lbSizeBpp.Text = "Size && Bpp";
|
||||
//
|
||||
// _tbLength
|
||||
//
|
||||
this._tbLength.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._tbLength.Location = new System.Drawing.Point(78, 72);
|
||||
this._tbLength.Name = "_tbLength";
|
||||
this._tbLength.ReadOnly = true;
|
||||
this._tbLength.Size = new System.Drawing.Size(106, 23);
|
||||
this._tbLength.TabIndex = 3;
|
||||
this._tbLength.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// _tbDescription
|
||||
//
|
||||
this._tbDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._tbDescription.Location = new System.Drawing.Point(78, 101);
|
||||
this._tbDescription.Name = "_tbDescription";
|
||||
this._tbDescription.ReadOnly = true;
|
||||
this._tbDescription.Size = new System.Drawing.Size(106, 23);
|
||||
this._tbDescription.TabIndex = 5;
|
||||
//
|
||||
// _gbPalette
|
||||
//
|
||||
this._gbPalette.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._gbPalette.Controls.Add(this._lvColors);
|
||||
this._gbPalette.Controls.Add(this._cbPalette);
|
||||
this._gbPalette.Location = new System.Drawing.Point(3, 200);
|
||||
this._gbPalette.Name = "_gbPalette";
|
||||
this._gbPalette.Size = new System.Drawing.Size(193, 334);
|
||||
this._gbPalette.TabIndex = 2;
|
||||
this._gbPalette.TabStop = false;
|
||||
this._gbPalette.Text = " ";
|
||||
//
|
||||
// _lvColors
|
||||
//
|
||||
this._lvColors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this._colColors});
|
||||
this._lvColors.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._lvColors.FillColumnIndex = 0;
|
||||
this._lvColors.FullRowSelect = true;
|
||||
this._lvColors.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this._lvColors.Location = new System.Drawing.Point(3, 16);
|
||||
this._lvColors.MultiSelect = false;
|
||||
this._lvColors.Name = "_lvColors";
|
||||
this._lvColors.Size = new System.Drawing.Size(187, 315);
|
||||
this._lvColors.TabIndex = 1;
|
||||
this._lvColors.UseCompatibleStateImageBehavior = false;
|
||||
this._lvColors.View = System.Windows.Forms.View.Details;
|
||||
this._lvColors.SelectedIndexChanged += new System.EventHandler(this._lvColors_SelectedIndexChanged);
|
||||
//
|
||||
// _colColors
|
||||
//
|
||||
this._colColors.Text = "Colors";
|
||||
this._colColors.Width = 183;
|
||||
//
|
||||
// _cbPalette
|
||||
//
|
||||
this._cbPalette.AutoCheck = false;
|
||||
this._cbPalette.AutoSize = true;
|
||||
this._cbPalette.Location = new System.Drawing.Point(14, -1);
|
||||
this._cbPalette.Name = "_cbPalette";
|
||||
this._cbPalette.Size = new System.Drawing.Size(59, 17);
|
||||
this._cbPalette.TabIndex = 0;
|
||||
this._cbPalette.Text = "Palette";
|
||||
this._cbPalette.ThreeState = true;
|
||||
this._cbPalette.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// _lbFilename
|
||||
//
|
||||
this._lbFilename.AutoSize = true;
|
||||
this._lbFilename.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this._lbFilename.Location = new System.Drawing.Point(8, 11);
|
||||
this._lbFilename.Margin = new System.Windows.Forms.Padding(3);
|
||||
this._lbFilename.Name = "_lbFilename";
|
||||
this._lbFilename.Size = new System.Drawing.Size(103, 15);
|
||||
this._lbFilename.TabIndex = 0;
|
||||
this._lbFilename.Text = "No image loaded.";
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(784, 562);
|
||||
this.Controls.Add(this._scDetailsPreview);
|
||||
this.Controls.Add(this._msMain);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this._msMain;
|
||||
this.MinimumSize = new System.Drawing.Size(216, 261);
|
||||
this.Name = "FormMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "IMG Viewer";
|
||||
((System.ComponentModel.ISupportInitialize)(this._pbImage)).EndInit();
|
||||
this._pnImage.ResumeLayout(false);
|
||||
this._msMain.ResumeLayout(false);
|
||||
this._msMain.PerformLayout();
|
||||
this._scDetailsPreview.Panel1.ResumeLayout(false);
|
||||
this._scDetailsPreview.Panel2.ResumeLayout(false);
|
||||
this._scDetailsPreview.ResumeLayout(false);
|
||||
this._pnDetails.ResumeLayout(false);
|
||||
this._pnDetails.PerformLayout();
|
||||
this._gbGeneral.ResumeLayout(false);
|
||||
this._gbGeneral.PerformLayout();
|
||||
this._gbPalette.ResumeLayout(false);
|
||||
this._gbPalette.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.OpenFileDialog _ofdOpen;
|
||||
private System.Windows.Forms.PictureBox _pbImage;
|
||||
private System.Windows.Forms.Panel _pnImage;
|
||||
private System.Windows.Forms.MenuStrip _msMain;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiFile;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiOpen;
|
||||
private System.Windows.Forms.ToolStripSeparator _tssFile1;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiExit;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiHelp;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiAbout;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiSaveAs;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiClose;
|
||||
private System.Windows.Forms.SaveFileDialog _sfdSave;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiView;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiFitToWindow;
|
||||
private System.Windows.Forms.SplitContainer _scDetailsPreview;
|
||||
private System.Windows.Forms.Panel _pnDetails;
|
||||
private System.Windows.Forms.Label _lbFilename;
|
||||
private System.Windows.Forms.CheckBox _cbHeader;
|
||||
private System.Windows.Forms.Label _lbLength;
|
||||
private System.Windows.Forms.TextBox _tbLength;
|
||||
private System.Windows.Forms.Label _lbDescription;
|
||||
private System.Windows.Forms.TextBox _tbDescription;
|
||||
private System.Windows.Forms.TextBox _tbSizeBpp;
|
||||
private System.Windows.Forms.Label _lbSizeBpp;
|
||||
private System.Windows.Forms.CheckBox _cbCompressed;
|
||||
private System.Windows.Forms.CheckBox _cbPalette;
|
||||
private System.Windows.Forms.GroupBox _gbGeneral;
|
||||
private System.Windows.Forms.GroupBox _gbPalette;
|
||||
private WormsNET.ImgViewer.ExtendedListView _lvColors;
|
||||
private System.Windows.Forms.ColumnHeader _colColors;
|
||||
private System.Windows.Forms.Label _lbError;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiDetails;
|
||||
private System.Windows.Forms.ToolStripSeparator _tssView1;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiBlack;
|
||||
}
|
||||
}
|
||||
|
434
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/FormMain.cs
Normal file
@ -0,0 +1,434 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace WormsNET.ImgViewer
|
||||
{
|
||||
#region #### FormMain ##################################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Hauptform der Anwendung.
|
||||
/// </summary>
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
#region ---- MEMBERVARIABLEN -----------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
byte[,] _palette = new byte[1, 3];
|
||||
|
||||
#region ---- KONSTRUKTOR ---------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Standardkonstruktor.
|
||||
/// </summary>
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
if (args.Length > 1 && File.Exists(args[1]))
|
||||
{
|
||||
if (ReadIMG(args[1]))
|
||||
{
|
||||
Text = Application.ProductName + " - " + args[1];
|
||||
string directoryOfFile = Path.GetDirectoryName(args[1]);
|
||||
_ofdOpen.InitialDirectory = directoryOfFile;
|
||||
_sfdSave.InitialDirectory = directoryOfFile;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
RegistryKey regKey = Registry.CurrentUser
|
||||
.OpenSubKey(@"Software\Team17SoftwareLTD\WormsArmageddon", true);
|
||||
String gamePath = regKey.GetValue("PATH", String.Empty).ToString();
|
||||
_ofdOpen.InitialDirectory = gamePath;
|
||||
_sfdSave.InitialDirectory = gamePath;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PRIVATE) --------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private bool ReadIMG(string path)
|
||||
{
|
||||
string description = "";
|
||||
bool isCompressed = false;
|
||||
bool hasPalette = false;
|
||||
short width, height;
|
||||
short numberOfColors = 1;
|
||||
byte[] imageData;
|
||||
|
||||
ResetGUI();
|
||||
|
||||
FileStream fr = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fr);
|
||||
|
||||
// Header überprüfen
|
||||
byte[] header = br.ReadBytes(4);
|
||||
byte[] correctHeader = { 0x49, 0x4D, 0x47, 0x1A };
|
||||
if (!CompareArrays(header, correctHeader))
|
||||
{
|
||||
_cbHeader.Checked = false;
|
||||
SetErrorLabel("Invalid header.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Dateilänge auslesen
|
||||
byte[] fileLengthArray = br.ReadBytes(4);
|
||||
|
||||
// Ggf. Bildbeschreibung auslesen
|
||||
byte bitsPerPixel = br.ReadByte();
|
||||
if (bitsPerPixel > 48)
|
||||
{
|
||||
br.BaseStream.Seek(-1, SeekOrigin.Current);
|
||||
while (true)
|
||||
{
|
||||
byte[] b = br.ReadBytes(1);
|
||||
if (b[0] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
description += (char)b[0];
|
||||
}
|
||||
}
|
||||
bitsPerPixel = br.ReadByte();
|
||||
}
|
||||
|
||||
// Imageflags auslesen
|
||||
byte flags = br.ReadByte();
|
||||
switch (flags)
|
||||
{
|
||||
case 0x00:
|
||||
break;
|
||||
case 0x40:
|
||||
isCompressed = true;
|
||||
break;
|
||||
case 0x80:
|
||||
hasPalette = true;
|
||||
break;
|
||||
case 0xC0:
|
||||
isCompressed = true;
|
||||
hasPalette = true;
|
||||
break;
|
||||
default:
|
||||
_cbPalette.CheckState = CheckState.Indeterminate;
|
||||
_cbCompressed.CheckState = CheckState.Indeterminate;
|
||||
SetErrorLabel("Invalid image flags.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ggf. Palette auslesen
|
||||
if (hasPalette)
|
||||
{
|
||||
numberOfColors = BitConverter.ToInt16(br.ReadBytes(2), 0);
|
||||
numberOfColors++;
|
||||
_palette = new byte[numberOfColors, 3];
|
||||
for (int i = 0; i < numberOfColors; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
_palette[i, j] = br.ReadByte();
|
||||
}
|
||||
}
|
||||
ListViewItem newItem = _lvColors.Items.Add("R=" + _palette[i, 0]
|
||||
+ " G=" + _palette[i, 1] + " B=" + _palette[i, 2]);
|
||||
newItem.BackColor = Color.FromArgb(_palette[i, 0], _palette[i, 1],
|
||||
_palette[i, 2]);
|
||||
newItem.ForeColor = GetForeColor(newItem.BackColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Größe des Bildes
|
||||
width = BitConverter.ToInt16(br.ReadBytes(2), 0);
|
||||
height = BitConverter.ToInt16(br.ReadBytes(2), 0);
|
||||
_pbImage.Size = new Size(width, height);
|
||||
|
||||
// Dekomprimierung durchführen, wenn nötig
|
||||
if (isCompressed)
|
||||
{
|
||||
imageData = new byte[width * height];
|
||||
Decompress(br, ref imageData);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageData = br.ReadBytes(width * height);
|
||||
}
|
||||
|
||||
// Bild zeichnen
|
||||
DrawIMG(width, height, imageData);
|
||||
|
||||
// Datei und Ressourcen freigeben
|
||||
br.Close();
|
||||
fr.Close();
|
||||
|
||||
// Informationen anzeigen
|
||||
_tsmiSaveAs.Enabled = true;
|
||||
_tsmiClose.Enabled = true;
|
||||
_lbFilename.Text = Path.GetFileNameWithoutExtension(path);
|
||||
_cbHeader.Checked = true;
|
||||
_cbCompressed.Checked = isCompressed;
|
||||
_tbLength.Text = BitConverter.ToInt32(fileLengthArray, 0).ToString();
|
||||
_tbDescription.Text = description;
|
||||
_tbSizeBpp.Text = width.ToString() + "×" + height.ToString()
|
||||
+ "×" + bitsPerPixel.ToString();
|
||||
_cbPalette.Checked = hasPalette;
|
||||
_colColors.Text = "Colors (" + numberOfColors.ToString() + ")";
|
||||
SetErrorLabel("");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CompareArrays(byte[] a, byte[] b)
|
||||
{
|
||||
if (a.Length == b.Length)
|
||||
{
|
||||
for (int i = 0; i < a.Length; i++)
|
||||
{
|
||||
if (a[i] != b[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool Decompress(BinaryReader b, ref byte[] dStream)
|
||||
{
|
||||
int cmd;
|
||||
int output = 0; // Offset of next write
|
||||
while ((cmd = b.ReadByte()) != -1)
|
||||
{ // Read a byte
|
||||
if ((cmd & 0x80) == 0)
|
||||
{ // Command: 1 byte (color)
|
||||
dStream[output++] = (byte)cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
int arg1 = (cmd >> 3) & 0xF; // Arg1 = bits 2-5
|
||||
int arg2 = b.ReadByte();
|
||||
if (arg2 == -1)
|
||||
return false;
|
||||
arg2 = ((cmd << 8) | arg2) & 0x7FF; // Arg2 = bits 6-16
|
||||
if (arg1 == 0)
|
||||
{
|
||||
if (arg2 == 0) // Command: 0x80 0x00
|
||||
return false;
|
||||
int arg3 = b.ReadByte();
|
||||
if (arg3 == -1)
|
||||
return false;
|
||||
// Command: 3 bytes
|
||||
output = CopyData(output, arg2, arg3 + 18, ref dStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Command: 2 bytes
|
||||
output = CopyData(output, arg2 + 1, arg1 + 2, ref dStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int CopyData(int dOffset, int cOffset, int Repeat, ref byte[] dStream)
|
||||
{
|
||||
for (; Repeat > 0; Repeat--)
|
||||
{
|
||||
dStream[dOffset] = dStream[dOffset++ - cOffset];
|
||||
}
|
||||
return dOffset;
|
||||
}
|
||||
|
||||
private unsafe void DrawIMG(short width, short height, byte[] imageData)
|
||||
{
|
||||
Bitmap bm = new Bitmap(width, height);
|
||||
BitmapData bmData = bm.LockBits(new Rectangle(0, 0, width, height),
|
||||
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
int pixelSize = 4;
|
||||
|
||||
for (int y = 0; y < bmData.Height; y++)
|
||||
{
|
||||
byte* row = (byte*)bmData.Scan0 + (y * bmData.Stride);
|
||||
for (int x = 0; x < bmData.Width; x++)
|
||||
{
|
||||
byte paletteEntry = imageData[y * width + x];
|
||||
byte r = _palette[paletteEntry, 0];
|
||||
byte g = _palette[paletteEntry, 1];
|
||||
byte b = _palette[paletteEntry, 2];
|
||||
if (r != 0 || b != 0 || g != 0)
|
||||
{
|
||||
row[x * pixelSize] = b;
|
||||
row[x * pixelSize + 1] = g;
|
||||
row[x * pixelSize + 2] = r;
|
||||
row[x * pixelSize + 3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
bm.UnlockBits(bmData);
|
||||
_pbImage.BackgroundImage = bm;
|
||||
}
|
||||
|
||||
private Color GetForeColor(Color color)
|
||||
{
|
||||
if (color.GetBrightness() < 0.5)
|
||||
{
|
||||
return Color.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.Black;
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetGUI()
|
||||
{
|
||||
Text = Application.ProductName;
|
||||
_tsmiSaveAs.Enabled = false;
|
||||
_tsmiClose.Enabled = false;
|
||||
_lbError.Visible = true;
|
||||
_lbError.Text = "No image loaded.";
|
||||
_lbFilename.Text = "No image loaded.";
|
||||
_cbHeader.Checked = false;
|
||||
_cbCompressed.Checked = false;
|
||||
_tbLength.Text = String.Empty;
|
||||
_tbDescription.Text = String.Empty;
|
||||
_tbSizeBpp.Text = String.Empty;
|
||||
_cbPalette.Checked = false;
|
||||
_colColors.Text = "Colors";
|
||||
_lvColors.Items.Clear();
|
||||
}
|
||||
|
||||
private void SetErrorLabel(string text)
|
||||
{
|
||||
if (text.Length > 0)
|
||||
{
|
||||
_lbError.Visible = true;
|
||||
_lbError.Text = text;
|
||||
_pbImage.Size = new Size(0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_lbError.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
#region ---- EVENTHANDLER --------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private void _tsmiOpen_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_ofdOpen.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ReadIMG(_ofdOpen.FileName))
|
||||
{
|
||||
Text = Application.ProductName + " - " + _ofdOpen.FileName;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_lbError.Visible = true;
|
||||
_lbError.Text = "Unknown error occured. "
|
||||
+ "Please send a screenshot of this information to the developers:"
|
||||
+ Environment.NewLine + ex.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiSaveAs_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_sfdSave.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
switch (_sfdSave.FilterIndex)
|
||||
{
|
||||
case 1:
|
||||
_pbImage.BackgroundImage.Save(_sfdSave.FileName, ImageFormat.Bmp);
|
||||
break;
|
||||
case 2:
|
||||
_pbImage.BackgroundImage.Save(_sfdSave.FileName, ImageFormat.Png);
|
||||
break;
|
||||
case 3:
|
||||
_pbImage.BackgroundImage.Save(_sfdSave.FileName, ImageFormat.Jpeg);
|
||||
break;
|
||||
}
|
||||
_sfdSave.InitialDirectory = Path.GetDirectoryName(_sfdSave.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Text = Application.ProductName;
|
||||
_tsmiSaveAs.Enabled = false;
|
||||
_tsmiClose.Enabled = false;
|
||||
ResetGUI();
|
||||
_pbImage.BackgroundImage = null;
|
||||
_pbImage.Size = new Size(0, 0);
|
||||
}
|
||||
|
||||
private void _tsmiExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void _tsmiDetails_Click(object sender, EventArgs e)
|
||||
{
|
||||
_scDetailsPreview.Panel1Collapsed = !_tsmiDetails.Checked;
|
||||
}
|
||||
|
||||
private void _tsmiFitToWindow_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_tsmiFitToWindow.Checked)
|
||||
{
|
||||
_pbImage.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
_pbImage.Dock = DockStyle.Fill;
|
||||
}
|
||||
else
|
||||
{
|
||||
_pbImage.BackgroundImageLayout = ImageLayout.None;
|
||||
_pbImage.Dock = DockStyle.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiAbout_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(Application.ProductName + " " + Application.ProductVersion.ToString()
|
||||
+ Environment.NewLine + "The Worms.NET Team" + Environment.NewLine
|
||||
+ "Licensed under Ms-PL" + Environment.NewLine
|
||||
+ "Decompression algorithm by Pisto.", "About", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void _lvColors_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ListViewItem foundItem in _lvColors.Items)
|
||||
{
|
||||
foundItem.Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiBlack_Click(object sender, EventArgs e)
|
||||
{
|
||||
_pbImage.BackColor = (_tsmiBlack.Checked ? Color.Black : SystemColors.Control);
|
||||
}
|
||||
|
||||
} // #### FormMain #############################################################################
|
||||
}
|
1138
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/FormMain.resx
Normal file
BIN
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/Icon.ico
Normal file
After Width: | Height: | Size: 54 KiB |
102
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/NativeMethods.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace WormsNET.ImgViewer
|
||||
{
|
||||
#region #### NativeMethods ############################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Static method and structure collection for native / WinAPI stuff.
|
||||
/// </summary>
|
||||
internal class NativeMethods
|
||||
{
|
||||
#region ---- STRUCTURES ---------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct LVGROUP
|
||||
{
|
||||
public int cbSize;
|
||||
public int mask;
|
||||
[MarshalAs(UnmanagedType.LPTStr)]
|
||||
public string pszHeader;
|
||||
public int cchHeader;
|
||||
[MarshalAs(UnmanagedType.LPTStr)]
|
||||
public string pszFooter;
|
||||
public int cchFooter;
|
||||
public int iGroupId;
|
||||
public int stateMask;
|
||||
public int state;
|
||||
public int uAlign;
|
||||
}
|
||||
|
||||
#region ---- CONSTANTS ----------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
internal const int LVM_FIRST = 0x00001000;
|
||||
internal const int LVM_SETGROUPINFO = LVM_FIRST + 147;
|
||||
internal const int LVGF_STATE = 0x00000004;
|
||||
|
||||
internal const int SB_HORZ = 0;
|
||||
internal const int SB_VERT = 1;
|
||||
internal const int SB_CTL = 2;
|
||||
internal const int SB_BOTH = 3;
|
||||
|
||||
internal const int UIS_HIDEFOCUS = 0x00000001;
|
||||
internal const int UIS_SET = 1;
|
||||
|
||||
internal const int WM_CHANGEUISTATE = 0x00000127;
|
||||
internal const int WM_LBUTTONUP = 0x00000202;
|
||||
|
||||
#region ---- METHODS (INTERNAL) -------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
internal static void MakeFocusInvisible(IntPtr handle)
|
||||
{
|
||||
SendMessage(handle, WM_CHANGEUISTATE, MAKELONG(UIS_SET, UIS_HIDEFOCUS), 0);
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int SendMessage(IntPtr hWnd, int message, int wParam, int lParam);
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int SendMessage(IntPtr hWnd, int message, int wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
|
||||
internal static extern int SetWindowTheme(IntPtr hwnd,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszSubAppName, string pszSubIdList);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int ShowScrollBar(IntPtr hWnd, int wBar, int bShow);
|
||||
|
||||
#region ---- METHODS (PRIVATE) --------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private static int MAKELONG(int wLow, int wHigh)
|
||||
{
|
||||
int low = (int)LOWORD(wLow);
|
||||
short high = LOWORD(wHigh);
|
||||
int product = 0x00010000 * (int)high;
|
||||
int makeLong = (int)(low | product);
|
||||
return makeLong;
|
||||
}
|
||||
|
||||
private static short LOWORD(int dw)
|
||||
{
|
||||
short loWord = 0;
|
||||
ushort andResult = (ushort)(dw & 0x00007FFF);
|
||||
ushort mask = 0x8000;
|
||||
if ((dw & 0x8000) != 0)
|
||||
{
|
||||
loWord = (short)(mask | andResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
loWord = (short)andResult;
|
||||
}
|
||||
return loWord;
|
||||
}
|
||||
}
|
||||
}
|
20
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/Program.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WormsNET.ImgViewer
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("Worms.NET IMG Viewer")]
|
||||
[assembly: AssemblyDescription("Worms.NET IMG Viewer")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Worms.NET Team")]
|
||||
[assembly: AssemblyProduct("Worms.NET PAL Editor")]
|
||||
[assembly: AssemblyCopyright("Licensed under Ms-PL")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("11f9709d-7766-4fa8-9ca4-3f68acd23e16")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.0")]
|
63
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WormsNET.ImgViewer.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("WormsNET.ImgViewer.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
26
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WormsNET.ImgViewer.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
BIN
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/Resources/Icon.ico
Normal file
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 985 B |
After Width: | Height: | Size: 558 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 707 B |
After Width: | Height: | Size: 739 B |
After Width: | Height: | Size: 544 B |
After Width: | Height: | Size: 707 B |
After Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 535 B |
@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D007CB58-9BB0-45C7-88C1-FA5945AB8EB9}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WormsNET.ImgViewer</RootNamespace>
|
||||
<AssemblyName>WormsNET.ImgViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Debug\IMG Viewer.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Release\IMG Viewer.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ExtendedListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.Designer.cs">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FormMain.resx">
|
||||
<DependentUpon>FormMain.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>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<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>
|
||||
<Content Include="Icon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- 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>
|
3
src_old/WormsNET.ImgViewer/WormsNET.ImgViewer/app.config
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
29
src_old/WormsNET.PalEditor/WormsNET.PalEditor.sln
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WormsNET.PalEditor", "WormsNET.PalEditor\WormsNET.PalEditor.csproj", "{7DC25DDF-EFEE-4060-B4EC-7B78A363EE28}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 2
|
||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs32
|
||||
SccProjectUniqueName0 = WormsNET.PalEditor\\WormsNET.PalEditor.csproj
|
||||
SccProjectName0 = WormsNET.PalEditor
|
||||
SccLocalPath0 = WormsNET.PalEditor
|
||||
SccLocalPath1 = .
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7DC25DDF-EFEE-4060-B4EC-7B78A363EE28}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{7DC25DDF-EFEE-4060-B4EC-7B78A363EE28}.Debug|x86.Build.0 = Debug|x86
|
||||
{7DC25DDF-EFEE-4060-B4EC-7B78A363EE28}.Release|x86.ActiveCfg = Release|x86
|
||||
{7DC25DDF-EFEE-4060-B4EC-7B78A363EE28}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
102
src_old/WormsNET.PalEditor/WormsNET.PalEditor/BinaryReaderEx.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
#region #### BinaryReaderEx ###########################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Extension class for System.IO.BinaryReader.
|
||||
/// </summary>
|
||||
public static class BinaryReaderEx
|
||||
{
|
||||
#region ---- METHODS (PUBLIC) ---------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Reads a string from the current stream. The string is available in the specified
|
||||
/// binary format.
|
||||
/// </summary>
|
||||
/// <param name="br">The extended BinaryReader.</param>
|
||||
/// <param name="format">The binary format, in which the string should be read.</param>
|
||||
/// <returns>The string being read.</returns>
|
||||
public static string ReadString(this BinaryReader br, BinaryStringFormat format)
|
||||
{
|
||||
return ReadString(br, format, new ASCIIEncoding());
|
||||
}
|
||||
/// <summary>
|
||||
/// Reads a string from the current stream. The string is available in the specified
|
||||
/// binary format and encoding.
|
||||
/// </summary>
|
||||
/// <param name="br">The extended BinaryReader.</param>
|
||||
/// <param name="format">The binary format, in which the string should be read.</param>
|
||||
/// <param name="encoding">The encoding used for converting the string. This is not
|
||||
/// relevant for the VariableLengthPrefix binary format.</param>
|
||||
/// <returns>The string being read.</returns>
|
||||
public static string ReadString(this BinaryReader br, BinaryStringFormat format,
|
||||
Encoding encoding)
|
||||
{
|
||||
if (format == BinaryStringFormat.VariableLengthPrefix)
|
||||
{
|
||||
return br.ReadString();
|
||||
}
|
||||
else if (format == BinaryStringFormat.WordLengthPrefix)
|
||||
{
|
||||
int length = br.ReadInt32();
|
||||
return encoding.GetString(br.ReadBytes(length));
|
||||
}
|
||||
else if (format == BinaryStringFormat.ZeroTerminated)
|
||||
{
|
||||
// Read single bytes
|
||||
List<byte> bytes = new List<byte>();
|
||||
byte readByte = br.ReadByte();
|
||||
while (readByte != 0)
|
||||
{
|
||||
bytes.Add(readByte);
|
||||
readByte = br.ReadByte();
|
||||
}
|
||||
|
||||
// Convert to string
|
||||
return encoding.GetString(bytes.ToArray());
|
||||
}
|
||||
else if (format == BinaryStringFormat.NoPrefixOrTermination)
|
||||
{
|
||||
throw new ArgumentException("NoPrefixOrTermination cannot be used for read "
|
||||
+ "operations. Specify the length of the string instead to read strings with "
|
||||
+ "no prefix or terminator.");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("The specified binary string format is "
|
||||
+ "invalid.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a string from the current stream. The string has neither a prefix or postfix, the
|
||||
/// length has to be specified manually.
|
||||
/// </summary>
|
||||
/// <param name="br">The extended BinaryReader.</param>
|
||||
/// <param name="length">The length of the string.</param>
|
||||
/// <returns>The string being read.</returns>
|
||||
public static string ReadString(this BinaryReader br, int length)
|
||||
{
|
||||
return ReadString(br, length, new ASCIIEncoding());
|
||||
}
|
||||
/// <summary>
|
||||
/// Reads a string from the current stream. The string has neither a prefix or postfix, the
|
||||
/// length has to be specified manually. The string is available in the specified encoding.
|
||||
/// </summary>
|
||||
/// <param name="br">The extended BinaryReader.</param>
|
||||
/// <param name="length">The length of the string.</param>
|
||||
/// <param name="encoding">The encoding to use for reading the string.</param>
|
||||
/// <returns>The string being read.</returns>
|
||||
public static string ReadString(this BinaryReader br, int length, Encoding encoding)
|
||||
{
|
||||
return encoding.GetString(br.ReadBytes(length));
|
||||
}
|
||||
|
||||
} // #### BinaryReaderEx ######################################################################
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
#region #### BinaryStringFormat #######################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Eine Auflistung, die gängige binäre Codierungstypen für Zeichenketten enthält.
|
||||
/// </summary>
|
||||
public enum BinaryStringFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// The string has a prefix of variable length determining the length of the string and no
|
||||
/// postfix (.NET Framework default).
|
||||
/// </summary>
|
||||
VariableLengthPrefix,
|
||||
|
||||
/// <summary>
|
||||
/// The string has a prefix of 4 bytes determining the length of the string and no postfix.
|
||||
/// </summary>
|
||||
WordLengthPrefix,
|
||||
|
||||
/// <summary>
|
||||
/// The string has no prefix and is terminated with a byte of the value 0.
|
||||
/// </summary>
|
||||
ZeroTerminated,
|
||||
|
||||
/// <summary>
|
||||
/// The string has neither prefix nor postfix. This format is only valid for writing
|
||||
/// strings. For reading strings, the length has to be specified manually.
|
||||
/// </summary>
|
||||
NoPrefixOrTermination
|
||||
|
||||
} // #### BinaryStringFormat ##################################################################
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
#region #### BinaryWriterEx ###########################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Extension class for System.IO.BinaryWriter.
|
||||
/// </summary>
|
||||
public static class BinaryWriterEx
|
||||
{
|
||||
#region ---- METHODS (PUBLIC) ---------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Writes a string in the specified binary format to this stream and advances the current
|
||||
/// position of the stream in accordance with the binary format and the specific characters
|
||||
/// being written to the stream.
|
||||
/// </summary>
|
||||
/// <param name="bw">The extended BinaryWriter.</param>
|
||||
/// <param name="value">The value to write.</param>
|
||||
/// <param name="format">The binary string format used for converting the string.</param>
|
||||
public static void Write(this BinaryWriter bw, string value, BinaryStringFormat format)
|
||||
{
|
||||
Write(bw, value, format, new ASCIIEncoding());
|
||||
}
|
||||
/// <summary>
|
||||
/// Writes a string in the specified binary format to this stream in the specified encoding
|
||||
/// and advances the current position of the stream in accordance with the encoding used,
|
||||
/// the binary format and the specific characters being written to the stream.
|
||||
/// </summary>
|
||||
/// <param name="bw">The extended BinaryWriter.</param>
|
||||
/// <param name="value">The value to write.</param>
|
||||
/// <param name="format">The binary string format used for converting the string.</param>
|
||||
/// <param name="encoding">The encoding used for converting the string.</param>
|
||||
public static void Write(this BinaryWriter bw, string value, BinaryStringFormat format,
|
||||
Encoding encoding)
|
||||
{
|
||||
if (format == BinaryStringFormat.VariableLengthPrefix)
|
||||
{
|
||||
bw.Write(value);
|
||||
}
|
||||
else if (format == BinaryStringFormat.WordLengthPrefix)
|
||||
{
|
||||
bw.Write(value.Length);
|
||||
bw.Write(encoding.GetBytes(value));
|
||||
}
|
||||
else if (format == BinaryStringFormat.ZeroTerminated)
|
||||
{
|
||||
bw.Write(encoding.GetBytes(value));
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else if (format == BinaryStringFormat.NoPrefixOrTermination)
|
||||
{
|
||||
bw.Write(encoding.GetBytes(value));
|
||||
}
|
||||
}
|
||||
|
||||
} // #### BinaryWriterEx ######################################################################
|
||||
}
|
28
src_old/WormsNET.PalEditor/WormsNET.PalEditor/ColorEx.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
#region #### ColorEx ###################################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Statische Erweiterungsklasse für Color.
|
||||
/// </summary>
|
||||
public static class ColorEx
|
||||
{
|
||||
#region ---- METHODEN (PUBLIC) ---------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gibt eine erhellte oder verdunkelte Farbe zurück. Werte kleiner als 1.0 entsprechen
|
||||
/// dabei einer Verdunklung, Werte größer als 1.0 einer Erhellung der Ausgangsfarbe.
|
||||
/// </summary>
|
||||
/// <param name="color">Die erweiterte Farbe.</param>
|
||||
/// <param name="brightness">Der neue Helligkeitswert der Farbe.</param>
|
||||
public static Color Brighten(this Color color, float brightness)
|
||||
{
|
||||
return Color.FromArgb((byte)(color.R * brightness), (byte)(color.G * brightness),
|
||||
(byte)(color.B * brightness));
|
||||
}
|
||||
|
||||
} // #### ColorEx ##############################################################################
|
||||
}
|
168
src_old/WormsNET.PalEditor/WormsNET.PalEditor/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,168 @@
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <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 Windows Form-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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
this._btLoad = new System.Windows.Forms.Button();
|
||||
this._btSave = new System.Windows.Forms.Button();
|
||||
this._ofd = new System.Windows.Forms.OpenFileDialog();
|
||||
this._sfd = new System.Windows.Forms.SaveFileDialog();
|
||||
this._tkZoom = new System.Windows.Forms.TrackBar();
|
||||
this._lbZoom = new System.Windows.Forms.Label();
|
||||
this._paButtons = new System.Windows.Forms.Panel();
|
||||
this._palEditor = new WormsNET.PalEditor.PaletteEditor();
|
||||
((System.ComponentModel.ISupportInitialize)(this._tkZoom)).BeginInit();
|
||||
this._paButtons.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// _btLoad
|
||||
//
|
||||
this._btLoad.FlatAppearance.BorderColor = System.Drawing.Color.White;
|
||||
this._btLoad.FlatAppearance.BorderSize = 2;
|
||||
this._btLoad.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this._btLoad.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
|
||||
this._btLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this._btLoad.Location = new System.Drawing.Point(12, 12);
|
||||
this._btLoad.Name = "_btLoad";
|
||||
this._btLoad.Size = new System.Drawing.Size(75, 26);
|
||||
this._btLoad.TabIndex = 0;
|
||||
this._btLoad.Text = "Load";
|
||||
this._btLoad.UseVisualStyleBackColor = true;
|
||||
this._btLoad.Click += new System.EventHandler(this._btLoad_Click);
|
||||
//
|
||||
// _btSave
|
||||
//
|
||||
this._btSave.FlatAppearance.BorderColor = System.Drawing.Color.White;
|
||||
this._btSave.FlatAppearance.BorderSize = 2;
|
||||
this._btSave.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this._btSave.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
|
||||
this._btSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this._btSave.Location = new System.Drawing.Point(93, 12);
|
||||
this._btSave.Name = "_btSave";
|
||||
this._btSave.Size = new System.Drawing.Size(75, 26);
|
||||
this._btSave.TabIndex = 1;
|
||||
this._btSave.Text = "Save";
|
||||
this._btSave.UseVisualStyleBackColor = true;
|
||||
this._btSave.Click += new System.EventHandler(this._btSave_Click);
|
||||
//
|
||||
// _ofd
|
||||
//
|
||||
this._ofd.Filter = "Palette Files|*.pal|All Files|*.*";
|
||||
this._ofd.Title = "Open Worms Palette File";
|
||||
//
|
||||
// _sfd
|
||||
//
|
||||
this._sfd.Filter = "Palette Files|*.pal|All Files|*.*";
|
||||
this._sfd.Title = "Save Worms Palette File";
|
||||
//
|
||||
// _tkZoom
|
||||
//
|
||||
this._tkZoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._tkZoom.AutoSize = false;
|
||||
this._tkZoom.LargeChange = 10;
|
||||
this._tkZoom.Location = new System.Drawing.Point(400, 15);
|
||||
this._tkZoom.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
|
||||
this._tkZoom.Maximum = 50;
|
||||
this._tkZoom.Minimum = 10;
|
||||
this._tkZoom.Name = "_tkZoom";
|
||||
this._tkZoom.Size = new System.Drawing.Size(100, 23);
|
||||
this._tkZoom.TabIndex = 3;
|
||||
this._tkZoom.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this._tkZoom.Value = 30;
|
||||
this._tkZoom.Scroll += new System.EventHandler(this._tkZoom_Scroll);
|
||||
//
|
||||
// _lbZoom
|
||||
//
|
||||
this._lbZoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._lbZoom.AutoSize = true;
|
||||
this._lbZoom.Location = new System.Drawing.Point(355, 18);
|
||||
this._lbZoom.Name = "_lbZoom";
|
||||
this._lbZoom.Size = new System.Drawing.Size(39, 15);
|
||||
this._lbZoom.TabIndex = 2;
|
||||
this._lbZoom.Text = "Zoom";
|
||||
//
|
||||
// _paButtons
|
||||
//
|
||||
this._paButtons.Controls.Add(this._btLoad);
|
||||
this._paButtons.Controls.Add(this._btSave);
|
||||
this._paButtons.Controls.Add(this._lbZoom);
|
||||
this._paButtons.Controls.Add(this._tkZoom);
|
||||
this._paButtons.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this._paButtons.Location = new System.Drawing.Point(0, 0);
|
||||
this._paButtons.Name = "_paButtons";
|
||||
this._paButtons.Size = new System.Drawing.Size(512, 49);
|
||||
this._paButtons.TabIndex = 0;
|
||||
this._paButtons.Click += new System.EventHandler(this._paButtons_Click);
|
||||
//
|
||||
// _palEditor
|
||||
//
|
||||
this._palEditor.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this._palEditor.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this._palEditor.Location = new System.Drawing.Point(0, 49);
|
||||
this._palEditor.Name = "_palEditor";
|
||||
this._palEditor.Size = new System.Drawing.Size(512, 512);
|
||||
this._palEditor.TabIndex = 1;
|
||||
this._palEditor.TileSize = new System.Drawing.Size(32, 32);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Navy;
|
||||
this.ClientSize = new System.Drawing.Size(512, 561);
|
||||
this.Controls.Add(this._palEditor);
|
||||
this.Controls.Add(this._paButtons);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(464, 151);
|
||||
this.Name = "FormMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Worms.NET PAL Editor";
|
||||
this.Shown += new System.EventHandler(this.FormMain_Shown);
|
||||
((System.ComponentModel.ISupportInitialize)(this._tkZoom)).EndInit();
|
||||
this._paButtons.ResumeLayout(false);
|
||||
this._paButtons.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button _btLoad;
|
||||
private System.Windows.Forms.Button _btSave;
|
||||
private System.Windows.Forms.OpenFileDialog _ofd;
|
||||
private System.Windows.Forms.SaveFileDialog _sfd;
|
||||
private System.Windows.Forms.TrackBar _tkZoom;
|
||||
private System.Windows.Forms.Label _lbZoom;
|
||||
private System.Windows.Forms.Panel _paButtons;
|
||||
private PaletteEditor _palEditor;
|
||||
}
|
||||
}
|
||||
|
196
src_old/WormsNET.PalEditor/WormsNET.PalEditor/FormMain.cs
Normal file
@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
#region #### FormMain ##################################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Hauptfenster der Anwendung.
|
||||
/// </summary>
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
#region ---- KONSTANTEN ----------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
const short _palVersion = 0x0300;
|
||||
|
||||
#region ---- KONSTRUKTOREN -------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Standardkonstruktor.
|
||||
/// </summary>
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
RandomizeBackColor();
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PRIVATE) --------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private void RandomizeBackColor()
|
||||
{
|
||||
Random rand = new Random();
|
||||
int colorPart = rand.Next(0, 4);
|
||||
int colorValue = rand.Next(50, 90);
|
||||
Color color = Color.Black;
|
||||
switch (colorPart)
|
||||
{
|
||||
case 0:
|
||||
color = Color.FromArgb(colorValue, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
color = Color.FromArgb(0, colorValue, 0);
|
||||
break;
|
||||
case 2:
|
||||
color = Color.FromArgb(0, 0, colorValue);
|
||||
break;
|
||||
case 3:
|
||||
color = Color.FromArgb(colorValue, colorValue, 0);
|
||||
break;
|
||||
}
|
||||
BackColor = color;
|
||||
Color lighterColor = color.Brighten(1.5f);
|
||||
Color lightColor = color.Brighten(1.8f);
|
||||
_btLoad.FlatAppearance.MouseOverBackColor = lightColor;
|
||||
_btSave.FlatAppearance.MouseOverBackColor = lightColor;
|
||||
_btLoad.FlatAppearance.MouseDownBackColor = lighterColor;
|
||||
_btSave.FlatAppearance.MouseDownBackColor = lighterColor;
|
||||
}
|
||||
|
||||
private void ShowOpenFileDialog(bool closeAtAbort)
|
||||
{
|
||||
if (_ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadPal(_ofd.FileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowSaveFileDialog()
|
||||
{
|
||||
if (_sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
SavePal(_sfd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadPal(string filename)
|
||||
{
|
||||
FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read,
|
||||
FileShare.Read);
|
||||
using (BinaryReader reader = new BinaryReader(stream))
|
||||
{
|
||||
// RIFF Header
|
||||
string riff = reader.ReadString(4); // RIFF
|
||||
int dataSize = reader.ReadInt32();
|
||||
string type = reader.ReadString(4); // PAL
|
||||
|
||||
// Data Chunk
|
||||
string chunkType = reader.ReadString(4); // data
|
||||
int chunkSize = reader.ReadInt32();
|
||||
short palVersion = reader.ReadInt16();
|
||||
short palEntries = reader.ReadInt16();
|
||||
|
||||
_palEditor.Clear();
|
||||
for (int i = 0; i < palEntries; i++)
|
||||
{
|
||||
byte red = reader.ReadByte();
|
||||
byte green = reader.ReadByte();
|
||||
byte blue = reader.ReadByte();
|
||||
byte flags = reader.ReadByte();
|
||||
_palEditor.Add(Color.FromArgb(red, green, blue));
|
||||
}
|
||||
}
|
||||
|
||||
string shortFilename = Path.GetFileName(filename);
|
||||
_ofd.FileName = shortFilename;
|
||||
_sfd.InitialDirectory = _ofd.InitialDirectory;
|
||||
_sfd.FileName = shortFilename;
|
||||
Text = Application.ProductName + " - " + shortFilename;
|
||||
}
|
||||
|
||||
private void SavePal(string filename)
|
||||
{
|
||||
// Länge berechnen
|
||||
int length = 4 + 4 + 4 + 4 + 2 + 2 + _palEditor.Count * 4;
|
||||
|
||||
FileStream stream = new FileStream(filename, FileMode.Create, FileAccess.Write,
|
||||
FileShare.None);
|
||||
using (BinaryWriter bw = new BinaryWriter(stream))
|
||||
{
|
||||
// RIFF Header
|
||||
bw.Write("RIFF", BinaryStringFormat.NoPrefixOrTermination);
|
||||
bw.Write(length);
|
||||
bw.Write("PAL ", BinaryStringFormat.NoPrefixOrTermination);
|
||||
|
||||
// Data Chunk
|
||||
bw.Write("data", BinaryStringFormat.NoPrefixOrTermination);
|
||||
bw.Write(_palEditor.Count * 4 + 4);
|
||||
bw.Write(_palVersion);
|
||||
bw.Write((short)_palEditor.Count);
|
||||
|
||||
foreach (Color color in _palEditor.Colors)
|
||||
{
|
||||
bw.Write((byte)color.R);
|
||||
bw.Write((byte)color.G);
|
||||
bw.Write((byte)color.B);
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
}
|
||||
|
||||
string shortFilename = Path.GetFileName(filename);
|
||||
Text = Application.ProductName + " - " + shortFilename;
|
||||
_ofd.InitialDirectory = _sfd.InitialDirectory;
|
||||
_ofd.FileName = shortFilename;
|
||||
_sfd.FileName = shortFilename;
|
||||
}
|
||||
|
||||
#region ---- EVENTHANDLER --------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private void FormMain_Shown(object sender, EventArgs e)
|
||||
{
|
||||
if (Environment.GetCommandLineArgs().Length == 2)
|
||||
{
|
||||
string filename = Environment.GetCommandLineArgs()[1];
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
LoadPal(filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowOpenFileDialog(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void _paButtons_Click(object sender, EventArgs e)
|
||||
{
|
||||
RandomizeBackColor();
|
||||
}
|
||||
|
||||
private void _btLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowOpenFileDialog(false);
|
||||
}
|
||||
|
||||
private void _btSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowSaveFileDialog();
|
||||
}
|
||||
|
||||
private void _tkZoom_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
_palEditor.TileSize = new Size(_tkZoom.Value, _tkZoom.Value);
|
||||
}
|
||||
|
||||
} // #### FormMain #############################################################################
|
||||
}
|
1049
src_old/WormsNET.PalEditor/WormsNET.PalEditor/FormMain.resx
Normal file
BIN
src_old/WormsNET.PalEditor/WormsNET.PalEditor/Icon.ico
Normal file
After Width: | Height: | Size: 54 KiB |
195
src_old/WormsNET.PalEditor/WormsNET.PalEditor/PaletteEditor.Designer.cs
generated
Normal file
@ -0,0 +1,195 @@
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
partial class PaletteEditor
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
this._cmColor = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this._tstbColor = new System.Windows.Forms.ToolStripTextBox();
|
||||
this._tsmiColorDialog = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this._tsmiBrighten = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiDarken = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiInverse = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiColorChannel = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiBgr = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiBRG = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiGBR = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiGRB = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._tsmiRBG = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._cd = new System.Windows.Forms.ColorDialog();
|
||||
this._tsmiDesaturate = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this._cmColor.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// _cmColor
|
||||
//
|
||||
this._cmColor.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this._tstbColor,
|
||||
this._tsmiColorDialog,
|
||||
this._tsmiSeparator1,
|
||||
this._tsmiBrighten,
|
||||
this._tsmiDarken,
|
||||
this._tsmiInverse,
|
||||
this._tsmiDesaturate,
|
||||
this._tsmiColorChannel});
|
||||
this._cmColor.Name = "_cmColor";
|
||||
this._cmColor.Size = new System.Drawing.Size(161, 189);
|
||||
//
|
||||
// _tstbColor
|
||||
//
|
||||
this._tstbColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this._tstbColor.Name = "_tstbColor";
|
||||
this._tstbColor.Size = new System.Drawing.Size(100, 23);
|
||||
this._tstbColor.TextChanged += new System.EventHandler(this._tstbColor_TextChanged);
|
||||
//
|
||||
// _tsmiColorDialog
|
||||
//
|
||||
this._tsmiColorDialog.Name = "_tsmiColorDialog";
|
||||
this._tsmiColorDialog.Size = new System.Drawing.Size(160, 22);
|
||||
this._tsmiColorDialog.Text = "Color Dialog...";
|
||||
this._tsmiColorDialog.Click += new System.EventHandler(this._tsmiColorDialog_Click);
|
||||
//
|
||||
// _tsmiSeparator1
|
||||
//
|
||||
this._tsmiSeparator1.Name = "_tsmiSeparator1";
|
||||
this._tsmiSeparator1.Size = new System.Drawing.Size(157, 6);
|
||||
//
|
||||
// _tsmiBrighten
|
||||
//
|
||||
this._tsmiBrighten.Name = "_tsmiBrighten";
|
||||
this._tsmiBrighten.Size = new System.Drawing.Size(160, 22);
|
||||
this._tsmiBrighten.Text = "Brighten";
|
||||
this._tsmiBrighten.Click += new System.EventHandler(this._tsmiBrighten_Click);
|
||||
//
|
||||
// _tsmiDarken
|
||||
//
|
||||
this._tsmiDarken.Name = "_tsmiDarken";
|
||||
this._tsmiDarken.Size = new System.Drawing.Size(160, 22);
|
||||
this._tsmiDarken.Text = "Darken";
|
||||
this._tsmiDarken.Click += new System.EventHandler(this._tsmiDarken_Click);
|
||||
//
|
||||
// _tsmiInverse
|
||||
//
|
||||
this._tsmiInverse.Name = "_tsmiInverse";
|
||||
this._tsmiInverse.Size = new System.Drawing.Size(160, 22);
|
||||
this._tsmiInverse.Text = "Inverse";
|
||||
this._tsmiInverse.Click += new System.EventHandler(this._tsmiInverse_Click);
|
||||
//
|
||||
// _tsmiColorChannel
|
||||
//
|
||||
this._tsmiColorChannel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this._tsmiBgr,
|
||||
this._tsmiBRG,
|
||||
this._tsmiGBR,
|
||||
this._tsmiGRB,
|
||||
this._tsmiRBG});
|
||||
this._tsmiColorChannel.Name = "_tsmiColorChannel";
|
||||
this._tsmiColorChannel.Size = new System.Drawing.Size(160, 22);
|
||||
this._tsmiColorChannel.Text = "Color Channel";
|
||||
//
|
||||
// _tsmiBgr
|
||||
//
|
||||
this._tsmiBgr.Name = "_tsmiBgr";
|
||||
this._tsmiBgr.Size = new System.Drawing.Size(96, 22);
|
||||
this._tsmiBgr.Text = "BGR";
|
||||
this._tsmiBgr.Click += new System.EventHandler(this._tsmiBgr_Click);
|
||||
//
|
||||
// _tsmiBRG
|
||||
//
|
||||
this._tsmiBRG.Name = "_tsmiBRG";
|
||||
this._tsmiBRG.Size = new System.Drawing.Size(96, 22);
|
||||
this._tsmiBRG.Text = "BRG";
|
||||
this._tsmiBRG.Click += new System.EventHandler(this._tsmiBRG_Click);
|
||||
//
|
||||
// _tsmiGBR
|
||||
//
|
||||
this._tsmiGBR.Name = "_tsmiGBR";
|
||||
this._tsmiGBR.Size = new System.Drawing.Size(96, 22);
|
||||
this._tsmiGBR.Text = "GBR";
|
||||
this._tsmiGBR.Click += new System.EventHandler(this._tsmiGBR_Click);
|
||||
//
|
||||
// _tsmiGRB
|
||||
//
|
||||
this._tsmiGRB.Name = "_tsmiGRB";
|
||||
this._tsmiGRB.Size = new System.Drawing.Size(96, 22);
|
||||
this._tsmiGRB.Text = "GRB";
|
||||
this._tsmiGRB.Click += new System.EventHandler(this._tsmiGRB_Click);
|
||||
//
|
||||
// _tsmiRBG
|
||||
//
|
||||
this._tsmiRBG.Name = "_tsmiRBG";
|
||||
this._tsmiRBG.Size = new System.Drawing.Size(96, 22);
|
||||
this._tsmiRBG.Text = "RBG";
|
||||
this._tsmiRBG.Click += new System.EventHandler(this._tsmiRBG_Click);
|
||||
//
|
||||
// _cd
|
||||
//
|
||||
this._cd.AnyColor = true;
|
||||
this._cd.FullOpen = true;
|
||||
this._cd.SolidColorOnly = true;
|
||||
//
|
||||
// _tsmiDesaturate
|
||||
//
|
||||
this._tsmiDesaturate.Name = "_tsmiDesaturate";
|
||||
this._tsmiDesaturate.Size = new System.Drawing.Size(160, 22);
|
||||
this._tsmiDesaturate.Text = "Desaturate";
|
||||
this._tsmiDesaturate.Click += new System.EventHandler(this._tsmiDesaturate_Click);
|
||||
//
|
||||
// PaletteEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Name = "PaletteEditor";
|
||||
this.Size = new System.Drawing.Size(175, 173);
|
||||
this._cmColor.ResumeLayout(false);
|
||||
this._cmColor.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ContextMenuStrip _cmColor;
|
||||
private System.Windows.Forms.ToolStripTextBox _tstbColor;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiColorDialog;
|
||||
private System.Windows.Forms.ToolStripSeparator _tsmiSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiBrighten;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiDarken;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiInverse;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiColorChannel;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiBgr;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiBRG;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiGBR;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiGRB;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiRBG;
|
||||
private System.Windows.Forms.ColorDialog _cd;
|
||||
private System.Windows.Forms.ToolStripMenuItem _tsmiDesaturate;
|
||||
}
|
||||
}
|
451
src_old/WormsNET.PalEditor/WormsNET.PalEditor/PaletteEditor.cs
Normal file
@ -0,0 +1,451 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
#region #### PaletteEditor #############################################################################
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Zeigt eine Farbpalette an und erlaubt deren Bearbeitung.
|
||||
/// </summary>
|
||||
[ToolboxBitmap(typeof(Panel))]
|
||||
public partial class PaletteEditor : UserControl
|
||||
{
|
||||
#region ---- MEMBERVARIABLEN -----------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
List<Color> _colors;
|
||||
int? _hoveredIndex;
|
||||
int? _lastSelectedIndex;
|
||||
List<int> _selectedIndizes;
|
||||
|
||||
Size _tileCount;
|
||||
Size _tileSize;
|
||||
|
||||
Pen _selectPen1;
|
||||
Pen _selectPen2;
|
||||
Pen _hoverPen1;
|
||||
Pen _hoverPen2;
|
||||
|
||||
#region ---- KONSTRUKTOREN -------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Standardkonstruktor.
|
||||
/// </summary>
|
||||
public PaletteEditor()
|
||||
{
|
||||
// Doublebuffering und Resizeredraw einschalten
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer
|
||||
| ControlStyles.ResizeRedraw, true);
|
||||
|
||||
// Membervariablen initialisieren
|
||||
_colors = new List<Color>();
|
||||
_selectedIndizes = new List<int>();
|
||||
_tileSize = new Size(32, 32);
|
||||
|
||||
// Grafikobjekte erstellen
|
||||
_selectPen1 = new Pen(Color.Black);
|
||||
_selectPen2 = new Pen(Color.White);
|
||||
_hoverPen1 = new Pen(Color.FromArgb(128, Color.Black));
|
||||
_hoverPen2 = new Pen(Color.FromArgb(128, Color.White));
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region ---- EIGENSCHAFTEN -------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die Größe eines Farbeintrags an oder legt sie fest.
|
||||
/// </summary>
|
||||
public Size TileSize
|
||||
{
|
||||
get { return _tileSize; }
|
||||
set
|
||||
{
|
||||
_tileSize = value;
|
||||
CalculateSizes();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PUBLIC) ---------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die Liste der angezeigten Farben an.
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<Color> Colors
|
||||
{
|
||||
get { return _colors.AsReadOnly(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fügt die übergebene Farbe hinzu.
|
||||
/// </summary>
|
||||
/// <param name="color">Die hinzuzufügende Farbe.</param>
|
||||
public void Add(Color color)
|
||||
{
|
||||
_colors.Add(color);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Löscht alle Farben.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
_colors = new List<Color>();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die Anzahl der angezeigten Farben an.
|
||||
/// </summary>
|
||||
public int Count
|
||||
{
|
||||
get { return _colors.Count; }
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PROTECTED) ------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A)
|
||||
{
|
||||
int selectedCount = _selectedIndizes.Count;
|
||||
_selectedIndizes.Clear();
|
||||
if (selectedCount < _colors.Count / 2)
|
||||
{
|
||||
// Minderheit der Indizes waren ausgewählt, alle auswählen
|
||||
for (int i = 0; i < _colors.Count; i++)
|
||||
{
|
||||
_selectedIndizes.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Invalidate();
|
||||
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseClick(MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (_selectedIndizes.Contains(_hoveredIndex.Value))
|
||||
{
|
||||
if (_selectedIndizes.Count > 1)
|
||||
{
|
||||
// Mehrere Farben ausgewählt
|
||||
ShowContextMenuMultiColor(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Eine Farbe ausgewählt
|
||||
ShowContextMenuSingleColor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nicht ausgewähltes Farbfeld angeklickt, die Farbe auswählen
|
||||
_selectedIndizes.Clear();
|
||||
_selectedIndizes.Add(_hoveredIndex.Value);
|
||||
Invalidate();
|
||||
ShowContextMenuSingleColor();
|
||||
}
|
||||
}
|
||||
|
||||
base.OnMouseClick(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
// Maus muss sich innerhalb des Controls befinden
|
||||
if (!ClientRectangle.IntersectsWith(new Rectangle(e.Location, new Size(1, 1))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_hoveredIndex = e.Location.Y / _tileSize.Height * _tileCount.Width + e.Location.X
|
||||
/ _tileSize.Width;
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (Control.ModifierKeys == Keys.Control)
|
||||
{
|
||||
if (_lastSelectedIndex == null
|
||||
|| _lastSelectedIndex.Value != _hoveredIndex.Value)
|
||||
{
|
||||
if (_selectedIndizes.Contains(_hoveredIndex.Value))
|
||||
{
|
||||
_selectedIndizes.Remove(_hoveredIndex.Value);
|
||||
_lastSelectedIndex = _hoveredIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedIndizes.Add(_hoveredIndex.Value);
|
||||
_lastSelectedIndex = _hoveredIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Control.ModifierKeys == Keys.None)
|
||||
{
|
||||
_selectedIndizes.Clear();
|
||||
_selectedIndizes.Add(_hoveredIndex.Value);
|
||||
}
|
||||
}
|
||||
Invalidate();
|
||||
|
||||
base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
if (!_hoveredIndex.HasValue || e.Button != MouseButtons.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Control.ModifierKeys == Keys.Control)
|
||||
{
|
||||
if (_selectedIndizes.Contains(_hoveredIndex.Value))
|
||||
{
|
||||
_selectedIndizes.Remove(_hoveredIndex.Value);
|
||||
_lastSelectedIndex = _hoveredIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedIndizes.Add(_hoveredIndex.Value);
|
||||
_lastSelectedIndex = _hoveredIndex;
|
||||
}
|
||||
}
|
||||
else if (Control.ModifierKeys == Keys.None)
|
||||
{
|
||||
_selectedIndizes.Clear();
|
||||
_selectedIndizes.Add(_hoveredIndex.Value);
|
||||
}
|
||||
Invalidate();
|
||||
|
||||
base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
_lastSelectedIndex = null;
|
||||
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
_hoveredIndex = null;
|
||||
Invalidate();
|
||||
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.Clear(BackColor);
|
||||
|
||||
for (int i = 0; i < _colors.Count; i++)
|
||||
{
|
||||
// Position des Tiles berechnen
|
||||
Point tileLocation = GetColorLocation(i);
|
||||
|
||||
// Hintergrund zeichnen
|
||||
using (SolidBrush br = new SolidBrush(_colors[i]))
|
||||
{
|
||||
e.Graphics.FillRectangle(br, new Rectangle(tileLocation, _tileSize));
|
||||
}
|
||||
|
||||
// Rahmenbereiche berechnen
|
||||
Rectangle borderRect1 = new Rectangle(tileLocation.X, tileLocation.Y,
|
||||
_tileSize.Width - 1, _tileSize.Height - 1);
|
||||
Rectangle borderRect2 = borderRect1;
|
||||
borderRect2.Inflate(-1, -1);
|
||||
// Stati darstellen
|
||||
if (_selectedIndizes.Contains(i))
|
||||
{
|
||||
// Ausgewähltes Item
|
||||
e.Graphics.DrawRectangle(_selectPen1, borderRect1);
|
||||
e.Graphics.DrawRectangle(_selectPen2, borderRect2);
|
||||
}
|
||||
if (_hoveredIndex.HasValue && _hoveredIndex == i)
|
||||
{
|
||||
// Gehovertes Item
|
||||
e.Graphics.DrawRectangle(_hoverPen1, borderRect1);
|
||||
e.Graphics.DrawRectangle(_hoverPen2, borderRect2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
CalculateSizes();
|
||||
base.OnSizeChanged(e);
|
||||
}
|
||||
|
||||
#region ---- METHODEN (PRIVATE) --------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private void CalculateSizes()
|
||||
{
|
||||
_tileCount = new Size(ClientSize.Width / _tileSize.Width,
|
||||
ClientSize.Height / _tileSize.Height);
|
||||
}
|
||||
|
||||
private Point GetColorLocation(int index)
|
||||
{
|
||||
return new Point((index % _tileCount.Width) * _tileSize.Width,
|
||||
(index / _tileCount.Width) * _tileSize.Height);
|
||||
}
|
||||
|
||||
private void ShowContextMenuSingleColor()
|
||||
{
|
||||
|
||||
_tstbColor.Text = ColorTranslator.ToHtml(_colors[_hoveredIndex.Value]);
|
||||
_cd.Color = _colors[_hoveredIndex.Value];
|
||||
Point screenPosition = PointToScreen(GetColorLocation(_hoveredIndex.Value));
|
||||
screenPosition.Y += _tileSize.Height;
|
||||
_cmColor.Show(screenPosition);
|
||||
}
|
||||
|
||||
private void ShowContextMenuMultiColor(MouseEventArgs e)
|
||||
{
|
||||
_tstbColor.Text = "(multiple)";
|
||||
_cd.Color = Color.Black;
|
||||
_cmColor.Show(PointToScreen(e.Location));
|
||||
}
|
||||
|
||||
private int ClampColor(float value)
|
||||
{
|
||||
return Math.Max(0, Math.Min((int)value, 255));
|
||||
}
|
||||
|
||||
#region ---- EVENTHANDLER --------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
private void _tstbColor_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color color = ColorTranslator.FromHtml(_tstbColor.Text);
|
||||
if (color.A == 255)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
_colors[selectIndex] = color;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
_cd.Color = color;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiColorDialog_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_cd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_tstbColor.Text = ColorTranslator.ToHtml(_cd.Color);
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
_colors[selectIndex] = _cd.Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiBrighten_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(ClampColor(color.R * 1.1f),
|
||||
ClampColor(color.G * 1.1f), ClampColor(color.B * 1.1f));
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiDarken_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(ClampColor((float)color.R * 0.9f),
|
||||
ClampColor((float)color.G * 0.9f), ClampColor((float)color.B * 0.9f));
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiInverse_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(255 - color.R, 255 - color.G, 255 - color.B);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiDesaturate_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
int brightness = (int)(_colors[selectIndex].GetBrightness() * 255.0f);
|
||||
_colors[selectIndex] = Color.FromArgb(brightness, brightness, brightness);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiBgr_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(color.B, color.G, color.R);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiBRG_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(color.B, color.R, color.G);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiGBR_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(color.G, color.B, color.R);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiGRB_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(color.G, color.R, color.B);
|
||||
}
|
||||
}
|
||||
|
||||
private void _tsmiRBG_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (int selectIndex in _selectedIndizes)
|
||||
{
|
||||
Color color = _colors[selectIndex];
|
||||
_colors[selectIndex] = Color.FromArgb(color.R, color.B, color.G);
|
||||
}
|
||||
}
|
||||
|
||||
} // #### PaletteEditor ########################################################################
|
||||
}
|
126
src_old/WormsNET.PalEditor/WormsNET.PalEditor/PaletteEditor.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=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>
|
||||
<metadata name="_cmColor.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="_cd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>119, 17</value>
|
||||
</metadata>
|
||||
</root>
|
21
src_old/WormsNET.PalEditor/WormsNET.PalEditor/Program.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WormsNET.PalEditor
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("Worms.NET PAL Editor")]
|
||||
[assembly: AssemblyDescription("Worms.NET PAL Editor")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Worms.NET Team")]
|
||||
[assembly: AssemblyProduct("Worms.NET PAL Editor")]
|
||||
[assembly: AssemblyCopyright("Licensed under Ms-PL")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("d39300a8-54e8-45a8-ab6e-d95df12e3c74")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.0")]
|
63
src_old/WormsNET.PalEditor/WormsNET.PalEditor/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WormsNET.PALEditor.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("WormsNET.PALEditor.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
26
src_old/WormsNET.PalEditor/WormsNET.PalEditor/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WormsNET.PALEditor.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
BIN
src_old/WormsNET.PalEditor/WormsNET.PalEditor/Resources/Icon.ico
Normal file
After Width: | Height: | Size: 54 KiB |
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{7DC25DDF-EFEE-4060-B4EC-7B78A363EE28}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WormsNET.PALEditor</RootNamespace>
|
||||
<AssemblyName>WormsNET.PALEditor</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</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|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BinaryReaderEx.cs" />
|
||||
<Compile Include="BinaryStringFormat.cs" />
|
||||
<Compile Include="BinaryWriterEx.cs" />
|
||||
<Compile Include="ColorEx.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.Designer.cs">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PaletteEditor.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PaletteEditor.Designer.cs">
|
||||
<DependentUpon>PaletteEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FormMain.resx">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PaletteEditor.resx">
|
||||
<DependentUpon>PaletteEditor.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>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<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>
|
||||
<Content Include="Icon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- 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>
|
3
src_old/WormsNET.PalEditor/WormsNET.PalEditor/app.config
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|