Add replacing of images
This commit is contained in:
Родитель
bc5a6778ec
Коммит
c017332a7a
|
@ -39,6 +39,7 @@
|
|||
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripDropDownButton3 = new System.Windows.Forms.ToolStripDropDownButton();
|
||||
this.whatIsThisToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -116,7 +117,8 @@
|
|||
this.toolStripDropDownButton2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.cutToolStripMenuItem,
|
||||
this.copyToolStripMenuItem,
|
||||
this.pasteToolStripMenuItem});
|
||||
this.pasteToolStripMenuItem,
|
||||
this.replaceToolStripMenuItem});
|
||||
this.toolStripDropDownButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripDropDownButton2.Name = "toolStripDropDownButton2";
|
||||
this.toolStripDropDownButton2.Size = new System.Drawing.Size(40, 22);
|
||||
|
@ -127,7 +129,7 @@
|
|||
this.cutToolStripMenuItem.Enabled = false;
|
||||
this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image")));
|
||||
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
|
||||
this.cutToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
|
||||
this.cutToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.cutToolStripMenuItem.Text = "Cut";
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
|
@ -135,7 +137,7 @@
|
|||
this.copyToolStripMenuItem.Enabled = false;
|
||||
this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image")));
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy";
|
||||
//
|
||||
// pasteToolStripMenuItem
|
||||
|
@ -143,9 +145,17 @@
|
|||
this.pasteToolStripMenuItem.Enabled = false;
|
||||
this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image")));
|
||||
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
|
||||
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
|
||||
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.pasteToolStripMenuItem.Text = "Paste";
|
||||
//
|
||||
// replaceToolStripMenuItem
|
||||
//
|
||||
this.replaceToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("replaceToolStripMenuItem.Image")));
|
||||
this.replaceToolStripMenuItem.Name = "replaceToolStripMenuItem";
|
||||
this.replaceToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.replaceToolStripMenuItem.Text = "Replace";
|
||||
this.replaceToolStripMenuItem.Click += new System.EventHandler(this.replaceToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripDropDownButton3
|
||||
//
|
||||
this.toolStripDropDownButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
|
@ -251,6 +261,7 @@
|
|||
private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton3;
|
||||
private System.Windows.Forms.ToolStripMenuItem whatIsThisToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
}
|
||||
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -22,37 +23,37 @@ namespace osu_BackgroundChanger
|
|||
var ofd = new OpenFileDialog();
|
||||
ofd.Filter = "osu!seasonal.dll|osu!seasonal.dll";
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK) {
|
||||
if (ofd.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
#if !DEBUG
|
||||
try
|
||||
try
|
||||
#endif
|
||||
{
|
||||
//prepare
|
||||
Images = new Dictionary<string, Image>();
|
||||
{
|
||||
//prepare
|
||||
Images = new Dictionary<string, Image>();
|
||||
|
||||
//read file and save it in a variable
|
||||
Seasonal = new OsuSeasonal(ofd.FileName);
|
||||
//read file and save it in a variable
|
||||
Seasonal = new OsuSeasonal(ofd.FileName);
|
||||
|
||||
//enable controls again
|
||||
splitContainer1.Enabled = true;
|
||||
//enable controls again
|
||||
splitContainer1.Enabled = true;
|
||||
|
||||
//loop through resources
|
||||
foreach (var element in Seasonal.ResourceSet.ResourceElements) {
|
||||
if (!(element.ResourceData is BinaryResourceData)) continue;
|
||||
//loop through resources
|
||||
foreach (var element in Seasonal.ResourceSet.ResourceElements) {
|
||||
if (!(element.ResourceData is BinaryResourceData)) continue;
|
||||
|
||||
var rs = (BinaryResourceData)element.ResourceData;
|
||||
var bm = await Helpers.DeserializeBitmapAsync(rs.Data); //takes about 50ms
|
||||
var rs = (BinaryResourceData)element.ResourceData;
|
||||
var bm = await Helpers.DeserializeBitmapAsync(rs.Data); //takes about 50ms
|
||||
|
||||
Images.Add(element.Name, bm);
|
||||
listView1.Items.Add(element.Name, element.Name);
|
||||
}
|
||||
Images.Add(element.Name, bm);
|
||||
listView1.Items.Add(element.Name, element.Name);
|
||||
}
|
||||
#if !DEBUG
|
||||
catch (Exception ex) {
|
||||
MessageBox.Show("An exception occured while trying to load the assembly:\n\n" + ex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if !DEBUG
|
||||
catch (Exception ex) {
|
||||
MessageBox.Show("An exception occured while trying to load the assembly:\n\n" + ex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
@ -62,5 +63,22 @@ namespace osu_BackgroundChanger
|
|||
? Images[listView1.SelectedItems[0].ImageKey]
|
||||
: null;
|
||||
}
|
||||
|
||||
private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Jpeg files|*.jpg;*.jpeg";
|
||||
|
||||
if (ofd.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
var img = Image.FromFile(ofd.FileName);
|
||||
|
||||
foreach (ListViewItem i in listView1.SelectedItems) {
|
||||
Images[i.ImageKey] = img;
|
||||
}
|
||||
|
||||
//force update
|
||||
listView1_SelectedIndexChanged(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,6 +224,24 @@
|
|||
NQYMWQF8V017Rjp9D1XdF7lq2AJo2hNSqTucnh3j4CAucjy4mQ/Rn4BZ/xgYfb9pmjXxn2maHzVzVfUA
|
||||
B8316xHN906oB/M0ztO+yV/aCvbWtLfQBm/1LvCgF4Ug4jbaEfUzMtNtlKRP22VbqnvAtLQAAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="replaceToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
|
||||
dHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALHSURBVDhPbZNdSFNhGMctEiqzhG4q8qpuqtt0anYR
|
||||
EV1kH2BRIFFdqJsfUFKpERZlJFFpmJSUpLGdzdScZY7h1xTLZrpqU5ypS3SbzTmx5tlqbufp/548Q6SL
|
||||
H7zv8/F//+9z3hNBRGH2pitjkxTqF0lZalt8psqXqFA7sG5DPBVErqgtBDHhQFy68kSCnPPJywyBUq2F
|
||||
NN3fSdNlo/KmQTp3V78gy1TNo+GMWJuhzMCawCZJbVeiguPvN1ioqn2MajrGqfmTgzotLuofn6OhyXnq
|
||||
NE/TkfxGHs4MBy/V+SESRN9GUQBWnynKDKG8p+8pOVtDSBKsB8/e0XlrWkcEq/0njTp/0fgPL5WoTaGP
|
||||
1hmW/wOBaFEA1r0HLtZRck6tgASPxBWwFRxKUHADF0r0/MComybdPDnnfCKoCyAfJd2fNS7KH/VW4a5O
|
||||
JHawuAT255mr3mEXfbC6aWqWhwDHBNZLBcGUwrdFV6s+7zl9u3Uz9quXNa+Bw57S+i+BaZzMrvLPAbeI
|
||||
3DqpKFpqWAly1YAOX274nZLf6BcpaPSzGFgrFbGBCEuEAJswO0EPYsGW/7Cd9UoCQYeHJ4fHR3bc77lu
|
||||
OCSTcxOIx0hOJIqUQ9vyKgcSWQ/YIAbZN2X36hl2k3FkhlljTrKWN2IfFZehcuVUGB+k3tB1Y8/qIsUk
|
||||
Jh9iAmy6djjpMjvpaKGWxyfsQ1H8kkBWcnat5/j1FvYJBZlcFWBxUQBTDrHHUvFmUJhwLYgPpn/MQ6UN
|
||||
ZiGlQMvj5EW8VALC/txaQoyJaMICcCCkFev8eKaDx641LTT3TZHx2yy1fZ0mrXGKqjtsVFJnplsqEz18
|
||||
bSEcyB7b7rAAuw+ay5fWJ2WZ3Nypm++8xZyJnrRYqVI/SvfqLZT7uDvIfjjMLI3VLhd4CVZJQawjQSps
|
||||
dmAOLjQEsLbvy1a/QnynVEdEEX8BQVqGDn9sKuMAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="whatIsThisToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
|
|
Загрузка…
Ссылка в новой задаче