From cac784c95ac8692302548cd5363bba80f90f4d50 Mon Sep 17 00:00:00 2001
From: Kemo431 <38379517+kemo14331@users.noreply.github.com>
Date: Sat, 10 Oct 2020 21:43:46 +0900
Subject: [PATCH 1/9] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 0b809dd..c3454be 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# Particle Converter
+![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/kemo14331/Particle-Converter) [![GitHub license](https://img.shields.io/github/license/kemo14331/Particle-Converter)](https://github.com/kemo14331/Particle-Converter/blob/main/LICENSE)
画像ファイルをmcfunctionに変換するツール
## ScreenShot
From ab7cd23f9794d6c1577d845ce7e8424c245a7152 Mon Sep 17 00:00:00 2001
From: Kemo431 <38379517+kemo14331@users.noreply.github.com>
Date: Sat, 10 Oct 2020 21:54:16 +0900
Subject: [PATCH 2/9] Create README_EN.md
---
README_EN.md | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 README_EN.md
diff --git a/README_EN.md b/README_EN.md
new file mode 100644
index 0000000..77afef3
--- /dev/null
+++ b/README_EN.md
@@ -0,0 +1,43 @@
+# Particle Converter
+![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/kemo14331/Particle-Converter) [![GitHub license](https://img.shields.io/github/license/kemo14331/Particle-Converter)](https://github.com/kemo14331/Particle-Converter/blob/main/LICENSE)
+Particle Converter is an application to convert image files into particle commands.
+
+## ScreenShot
+ ![screenshot0](https://imgur.com/HvnhBgF.jpg,"screenshot")
+
+ and more
+
+
+
+
+## Feature
+* Convert the image file (.jpg|.png) into a particle command that can be displayed in Minecraft and output as a mcfunction format
+* Correspond to world relative coordinates(~) and local relative coordinates(^).
+* Real-time preview of parameter changes.
+* Display size can be specified by block.
+* Support for changing resolution.
+* Supports the color specification of dust.
+* Compatible with particles other than dust.
+* Multi-language support for the app.
+
+Translated with www.DeepL.com/Translator (free version)
+
+## Downloads
+ [Particle-Converter/Release](https://github.com/kemo14331/Particle-Converter/releases/latest)
+
+## Requirement
+
+ * .NETCore 3.1
+
+## Library
+ * [Material Design In Xaml](http://materialdesigninxaml.net/)
+ * [OpenCVSharp4](https://github.com/shimat/opencvsharp)
+ * [HelixToolkit.SharpDX.Core.Wpf](https://github.com/helix-toolkit/helix-toolkit)
+
+## Author
+
+* Kemo431
+* Twitter: [@newkemo431](https://twitter.com/newkemo431)
+
+## License
+This app is under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
From c37d6677ecfe3e5b80afc72eb113713c9cec7e35 Mon Sep 17 00:00:00 2001
From: Kemo431 <38379517+kemo14331@users.noreply.github.com>
Date: Sat, 10 Oct 2020 21:56:18 +0900
Subject: [PATCH 3/9] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index c3454be..dfd5094 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+**日本語** / [English](https://github.com/kemo14331/Particle-Converter/blob/main/README_EN.md)
# Particle Converter
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/kemo14331/Particle-Converter) [![GitHub license](https://img.shields.io/github/license/kemo14331/Particle-Converter)](https://github.com/kemo14331/Particle-Converter/blob/main/LICENSE)
画像ファイルをmcfunctionに変換するツール
From 30e1e4912d71991ac15c3d562049be9292ef7d95 Mon Sep 17 00:00:00 2001
From: kemo431
Date: Sun, 11 Oct 2020 18:24:04 +0900
Subject: [PATCH 4/9] =?UTF-8?q?=E3=83=A9=E3=83=B3=E3=82=BF=E3=82=A4?=
=?UTF-8?q?=E3=83=A0=E7=B3=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ParticleConverter/App.xaml | 1 +
ParticleConverter/App.xaml.cs | 5 +++++
ParticleConverter/MainWindow.xaml.cs | 1 +
ParticleConverter/ParticleConverter.csproj | 9 +++++----
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ParticleConverter/App.xaml b/ParticleConverter/App.xaml
index 3a87de1..e4ad33c 100644
--- a/ParticleConverter/App.xaml
+++ b/ParticleConverter/App.xaml
@@ -5,6 +5,7 @@
xmlns:local="clr-namespace:ParticleConverter"
xmlns:local1="clr-namespace:ParticleConverter.util"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ DispatcherUnhandledException="App_DispatcherUnhandledException"
StartupUri="MainWindow.xaml">
diff --git a/ParticleConverter/App.xaml.cs b/ParticleConverter/App.xaml.cs
index 102f6af..486ee14 100644
--- a/ParticleConverter/App.xaml.cs
+++ b/ParticleConverter/App.xaml.cs
@@ -1,4 +1,5 @@
using System.Windows;
+using System.Windows.Threading;
namespace ParticleConverter
{
@@ -7,5 +8,9 @@ namespace ParticleConverter
///
public partial class App : Application
{
+ void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(e.Exception.ToString());
+ }
}
}
diff --git a/ParticleConverter/MainWindow.xaml.cs b/ParticleConverter/MainWindow.xaml.cs
index c352087..f80dcdb 100644
--- a/ParticleConverter/MainWindow.xaml.cs
+++ b/ParticleConverter/MainWindow.xaml.cs
@@ -19,6 +19,7 @@
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
+using System.Windows.Threading;
using Color = System.Windows.Media.Color;
using ColorConverter = System.Windows.Media.ColorConverter;
using Particle = ParticleConverter.util.Particle;
diff --git a/ParticleConverter/ParticleConverter.csproj b/ParticleConverter/ParticleConverter.csproj
index 42cf6f0..dd4bf11 100644
--- a/ParticleConverter/ParticleConverter.csproj
+++ b/ParticleConverter/ParticleConverter.csproj
@@ -15,6 +15,8 @@
https://github.com/kemo14331/Particle-Converter
icon.png
icon.ico
+ 1.0.1.0
+ 1.0.1
@@ -26,11 +28,10 @@
-
-
+
-
-
+
+
From ec35255911e7bb49b01aa3f7b008a140db2eda51 Mon Sep 17 00:00:00 2001
From: kemo431
Date: Sun, 18 Oct 2020 01:15:17 +0900
Subject: [PATCH 5/9] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=AD?=
=?UTF-8?q?=E3=82=B0=E5=87=BA=E5=8A=9B=E3=81=AE=E5=AE=9F=E8=A3=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ParticleConverter/App.xaml.cs | 11 +-
ParticleConverter/MainWindow.xaml.cs | 183 +++++++++++----------
ParticleConverter/ParticleConverter.csproj | 8 +-
ParticleConverter/dialogs/About.xaml.cs | 6 +-
ParticleConverter/lang/en-US.xaml | 2 +-
ParticleConverter/util/Logger.cs | 30 ++++
6 files changed, 151 insertions(+), 89 deletions(-)
create mode 100644 ParticleConverter/util/Logger.cs
diff --git a/ParticleConverter/App.xaml.cs b/ParticleConverter/App.xaml.cs
index 486ee14..57ab2e1 100644
--- a/ParticleConverter/App.xaml.cs
+++ b/ParticleConverter/App.xaml.cs
@@ -1,4 +1,7 @@
-using System.Windows;
+using ParticleConverter.util;
+using System;
+using System.IO;
+using System.Windows;
using System.Windows.Threading;
namespace ParticleConverter
@@ -8,9 +11,15 @@ namespace ParticleConverter
///
public partial class App : Application
{
+
+ public App()
+ {
+ }
+
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.ToString());
+ Logger.WriteExceptionLog(e.Exception);
}
}
}
diff --git a/ParticleConverter/MainWindow.xaml.cs b/ParticleConverter/MainWindow.xaml.cs
index f80dcdb..debbca2 100644
--- a/ParticleConverter/MainWindow.xaml.cs
+++ b/ParticleConverter/MainWindow.xaml.cs
@@ -71,12 +71,13 @@ private void Load_Langugae()
index++;
}
}
- catch
+ catch (Exception e)
{
MessageBox.Show("言語ファイルの読み込みに失敗しました\nFailed to load language files.",
"エラー/Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
+ Logger.WriteExceptionLog(e);
this.Close();
}
}
@@ -181,92 +182,104 @@ private void Combobox_Selection_Changed(object sender, RoutedEventArgs e)
private void Update_Preview()
{
- if (ImageConverter.IsLoaded && UsePreviewBox.IsChecked.Value)
+ try
{
- int coord = int.Parse(((ComboBoxItem)CoordinateAxis.SelectedItem).Tag.ToString());
- int verAlig = int.Parse(((ComboBoxItem)VerticalAlignmentBox.SelectedItem).Tag.ToString());
- int horAlig = int.Parse(((ComboBoxItem)HorizontalAlignmentBox.SelectedItem).Tag.ToString());
- //Mat smat = ImageConverter.GetModifiedImage();
- //System.Windows.Size size = ImageConverter.GetBlocks();
- //Bitmap bitmap = smat.ToBitmap();
- //var mb = new MeshBuilder(false, true);
-
- //IList pnts = new List
- //{
- // new Point3D(0, 0, 0),
- // new Point3D(size.Width, 0, 0),
- // new Point3D(size.Width, size.Height, 0),
- // new Point3D(0, size.Height, 0)
- //};
-
- //mb.AddPolygon(pnts);
-
- //var mesh = mb.ToMesh(false);
-
- //PointCollection pntCol = new PointCollection
- //{
- // new System.Windows.Point(0, 0),
- // new System.Windows.Point(bitmap.Size.Width, 0),
- // new System.Windows.Point(bitmap.Size.Width, bitmap.Size.Height),
- // new System.Windows.Point(0, bitmap.Size.Height)
- //};
- //mesh.TextureCoordinates = pntCol;
-
- //ImageBrush brush = new ImageBrush();
-
- //using (Stream stream = new MemoryStream())
- //{
- // bitmap.Save(stream, ImageFormat.Png);
- // stream.Seek(0, SeekOrigin.Begin);
- // BitmapImage img = new BitmapImage();
- // img.BeginInit();
- // img.CacheOption = BitmapCacheOption.OnLoad;
- // img.StreamSource = stream;
- // img.EndInit();
- // brush.ImageSource = img;
- //}
-
- //brush.TileMode = TileMode.Tile;
- //brush.ViewportUnits = BrushMappingMode.Absolute;
- //brush.ViewboxUnits = BrushMappingMode.Absolute;
- //brush.Stretch = Stretch.None;
- //brush.AlignmentX = AlignmentX.Left;
- //brush.AlignmentY = AlignmentY.Top;
- //brush.Viewport = new System.Windows.Rect(0, 0, brush.ImageSource.Width, brush.ImageSource.Height);
- //DiffuseMaterial mat = new DiffuseMaterial(brush);
-
- //GeometryModel3D gModel3D = new GeometryModel3D { Geometry = mesh, Material = mat, BackMaterial = mat };
-
- //PreviewModel.Content = gModel3D;
- Particle[] particles = ImageConverter.GetParticles(coord, verAlig, horAlig);
- //ParticleModel.Children.Clear();
- var points = new PointGeometry3D();
- var vectors = new Vector3Collection();
- var colors = new Color4Collection();
- var ptIdx = new IntCollection();
- int i = 0;
- foreach (Particle particle in particles)
+ if (ImageConverter.IsLoaded && UsePreviewBox.IsChecked.Value)
{
- vectors.Add(new Vector3((float)particle.x, (float)particle.y, (float)particle.z));
- if (UseStaticDustColor.IsChecked.Value)
- {
- Color c = (Color)ColorConverter.ConvertFromString(ColorCodeBox.Text);
- colors.Add(new Color4(c.R / 255f, c.G / 255f, c.B / 255f, 1.0f));
- }
- else
+ int coord = int.Parse(((ComboBoxItem)CoordinateAxis.SelectedItem).Tag.ToString());
+ int verAlig = int.Parse(((ComboBoxItem)VerticalAlignmentBox.SelectedItem).Tag.ToString());
+ int horAlig = int.Parse(((ComboBoxItem)HorizontalAlignmentBox.SelectedItem).Tag.ToString());
+ //Mat smat = ImageConverter.GetModifiedImage();
+ //System.Windows.Size size = ImageConverter.GetBlocks();
+ //Bitmap bitmap = smat.ToBitmap();
+ //var mb = new MeshBuilder(false, true);
+
+ //IList pnts = new List
+ //{
+ // new Point3D(0, 0, 0),
+ // new Point3D(size.Width, 0, 0),
+ // new Point3D(size.Width, size.Height, 0),
+ // new Point3D(0, size.Height, 0)
+ //};
+
+ //mb.AddPolygon(pnts);
+
+ //var mesh = mb.ToMesh(false);
+
+ //PointCollection pntCol = new PointCollection
+ //{
+ // new System.Windows.Point(0, 0),
+ // new System.Windows.Point(bitmap.Size.Width, 0),
+ // new System.Windows.Point(bitmap.Size.Width, bitmap.Size.Height),
+ // new System.Windows.Point(0, bitmap.Size.Height)
+ //};
+ //mesh.TextureCoordinates = pntCol;
+
+ //ImageBrush brush = new ImageBrush();
+
+ //using (Stream stream = new MemoryStream())
+ //{
+ // bitmap.Save(stream, ImageFormat.Png);
+ // stream.Seek(0, SeekOrigin.Begin);
+ // BitmapImage img = new BitmapImage();
+ // img.BeginInit();
+ // img.CacheOption = BitmapCacheOption.OnLoad;
+ // img.StreamSource = stream;
+ // img.EndInit();
+ // brush.ImageSource = img;
+ //}
+
+ //brush.TileMode = TileMode.Tile;
+ //brush.ViewportUnits = BrushMappingMode.Absolute;
+ //brush.ViewboxUnits = BrushMappingMode.Absolute;
+ //brush.Stretch = Stretch.None;
+ //brush.AlignmentX = AlignmentX.Left;
+ //brush.AlignmentY = AlignmentY.Top;
+ //brush.Viewport = new System.Windows.Rect(0, 0, brush.ImageSource.Width, brush.ImageSource.Height);
+ //DiffuseMaterial mat = new DiffuseMaterial(brush);
+
+ //GeometryModel3D gModel3D = new GeometryModel3D { Geometry = mesh, Material = mat, BackMaterial = mat };
+
+ //PreviewModel.Content = gModel3D;
+ Particle[] particles = ImageConverter.GetParticles(coord, verAlig, horAlig);
+ //ParticleModel.Children.Clear();
+ var points = new PointGeometry3D();
+ var vectors = new Vector3Collection();
+ var colors = new Color4Collection();
+ var ptIdx = new IntCollection();
+ int i = 0;
+ foreach (Particle particle in particles)
{
- colors.Add(new Color4(particle.r / 255f, particle.g / 255f, particle.b / 255f, 1.0f));
+ vectors.Add(new Vector3((float)particle.x, (float)particle.y, (float)particle.z));
+ if (UseStaticDustColor.IsChecked.Value)
+ {
+ Color c = (Color)ColorConverter.ConvertFromString(ColorCodeBox.Text);
+ colors.Add(new Color4(c.R / 255f, c.G / 255f, c.B / 255f, 1.0f));
+ }
+ else
+ {
+ colors.Add(new Color4(particle.r / 255f, particle.g / 255f, particle.b / 255f, 1.0f));
+ }
+ ptIdx.Add(i);
+ i++;
}
- ptIdx.Add(i);
- i++;
+ points.Positions = vectors;
+ points.Colors = colors;
+ points.Indices = ptIdx;
+ ParticleModel.Geometry = points;
+ double size = double.Parse(ParticleSizeBox.Text);
+ ParticleModel.Size = new System.Windows.Size(3 * Math.Sqrt(size), 3 * Math.Sqrt(size));
+ ParticleCounter.Text = $"Particles: {particles.Length}";
}
- points.Positions = vectors;
- points.Colors = colors;
- points.Indices = ptIdx;
- ParticleModel.Geometry = points;
- double size = double.Parse(ParticleSizeBox.Text);
- ParticleModel.Size = new System.Windows.Size(3 * Math.Sqrt(size), 3 * Math.Sqrt(size));
- ParticleCounter.Text = $"Particles: {particles.Length}";
+ }
+ catch (Exception e)
+ {
+ Logger.WriteExceptionLog(e);
+ MessageBox.Show("プレビューの更新に失敗しました\nFailed to update preview.",
+ "エラー/Error",
+ MessageBoxButton.OK,
+ MessageBoxImage.Error);
+ this.Close();
}
}
@@ -379,12 +392,13 @@ private void ImageFileLoad()
UsePreviewBox.IsChecked = true;
}
}
- catch
+ catch (Exception e)
{
MessageBox.Show("画像ファイルの読み込みに失敗しました\nFailed to load an image file",
"エラー/Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
+ Logger.WriteExceptionLog(e);
this.Close();
}
}
@@ -626,12 +640,13 @@ private async void ExportButton_Click(object sender, RoutedEventArgs e)
ButtonProgressAssist.SetValue(ExportButton, 20 + 1 + i);
}
}
- catch
+ catch (Exception exc)
{
MessageBox.Show("ファイルの書き込みに失敗しました\nFailed to export a file.",
"エラー/Error",
MessageBoxButton.OK,
MessageBoxImage.Error);
+ Logger.WriteExceptionLog(exc);
}
finally
{
diff --git a/ParticleConverter/ParticleConverter.csproj b/ParticleConverter/ParticleConverter.csproj
index dd4bf11..7595bcd 100644
--- a/ParticleConverter/ParticleConverter.csproj
+++ b/ParticleConverter/ParticleConverter.csproj
@@ -12,15 +12,19 @@
false
Kemo431
LICENSE
+ false
https://github.com/kemo14331/Particle-Converter
icon.png
icon.ico
- 1.0.1.0
- 1.0.1
+ 1.0.2.*
+ 1.0.2
+ 1.0.2
true
+ none
+ false
diff --git a/ParticleConverter/dialogs/About.xaml.cs b/ParticleConverter/dialogs/About.xaml.cs
index fb88e79..06f8d37 100644
--- a/ParticleConverter/dialogs/About.xaml.cs
+++ b/ParticleConverter/dialogs/About.xaml.cs
@@ -1,4 +1,6 @@
using System.Diagnostics;
+using System.Reflection;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -12,9 +14,11 @@ public partial class About : UserControl
public About()
{
InitializeComponent();
+ Assembly assembly = Assembly.GetExecutingAssembly();
+
var fullname = typeof(App).Assembly.Location;
var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(fullname);
- var ver = info.FileVersion;
+ var ver = assembly.GetName().Version.ToString();
Version.Text = ver;
}
diff --git a/ParticleConverter/lang/en-US.xaml b/ParticleConverter/lang/en-US.xaml
index 43ee99f..8480b3a 100644
--- a/ParticleConverter/lang/en-US.xaml
+++ b/ParticleConverter/lang/en-US.xaml
@@ -8,7 +8,7 @@
Bug Report
About
- Converting Settings
+ Convertion Settings
ImageFile
Brows
diff --git a/ParticleConverter/util/Logger.cs b/ParticleConverter/util/Logger.cs
new file mode 100644
index 0000000..ba521fb
--- /dev/null
+++ b/ParticleConverter/util/Logger.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace ParticleConverter.util
+{
+ public static class Logger
+ {
+ public static void WriteExceptionLog(Exception e)
+ {
+ DateTime dt = DateTime.Now;
+ string result = dt.ToString("yyyy-MM-dd_HH.mm.ss");
+ StreamWriter streamWriter = null;
+ try
+ {
+ Directory.CreateDirectory(@".\exceptionLog");
+ string path = $@".\exceptionLog\{result}.txt";
+ streamWriter = new StreamWriter(path);
+ streamWriter.WriteLine("Member:" + e.TargetSite.Name);
+ streamWriter.WriteLine(e.Message);
+ streamWriter.WriteLine(e.StackTrace);
+ }
+ finally
+ {
+ if (streamWriter != null) streamWriter.Close();
+ }
+ }
+ }
+}
From 343ad66188554df97408be66da313b056400a0ff Mon Sep 17 00:00:00 2001
From: kemo431
Date: Mon, 19 Oct 2020 17:53:49 +0900
Subject: [PATCH 6/9] =?UTF-8?q?=E5=87=BA=E5=8A=9B=E6=99=82=E5=BA=A7?=
=?UTF-8?q?=E6=A8=99=E3=81=8C=E6=8C=87=E6=95=B0=E8=A1=A8=E8=A8=98=E3=81=AB?=
=?UTF-8?q?=E3=81=AA=E3=82=8B=E4=B8=8D=E5=85=B7=E5=90=88=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ParticleConverter/MainWindow.xaml | 2 +-
ParticleConverter/MainWindow.xaml.cs | 8 ++++----
ParticleConverter/util/Logger.cs | 5 ++---
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/ParticleConverter/MainWindow.xaml b/ParticleConverter/MainWindow.xaml
index a149de3..448ec87 100644
--- a/ParticleConverter/MainWindow.xaml
+++ b/ParticleConverter/MainWindow.xaml
@@ -287,7 +287,7 @@
Content="0˚"
IsSelected="True"
Tag="0" />
-
+
diff --git a/ParticleConverter/MainWindow.xaml.cs b/ParticleConverter/MainWindow.xaml.cs
index debbca2..1e7dc73 100644
--- a/ParticleConverter/MainWindow.xaml.cs
+++ b/ParticleConverter/MainWindow.xaml.cs
@@ -186,9 +186,9 @@ private void Update_Preview()
{
if (ImageConverter.IsLoaded && UsePreviewBox.IsChecked.Value)
{
- int coord = int.Parse(((ComboBoxItem)CoordinateAxis.SelectedItem).Tag.ToString());
- int verAlig = int.Parse(((ComboBoxItem)VerticalAlignmentBox.SelectedItem).Tag.ToString());
- int horAlig = int.Parse(((ComboBoxItem)HorizontalAlignmentBox.SelectedItem).Tag.ToString());
+ int coord = CoordinateAxis.SelectedIndex;
+ int verAlig = VerticalAlignmentBox.SelectedIndex;
+ int horAlig = HorizontalAlignmentBox.SelectedIndex;
//Mat smat = ImageConverter.GetModifiedImage();
//System.Windows.Size size = ImageConverter.GetBlocks();
//Bitmap bitmap = smat.ToBitmap();
@@ -618,7 +618,7 @@ private async void ExportButton_Click(object sender, RoutedEventArgs e)
for (int i = 0; i < particles.Length; i++)
{
var p = particles[i];
- string axis = $"{cs}{p.x} {cs}{p.y} {cs}{p.z}";
+ string axis = $"{cs}{Math.Round(p.x, 5)} {cs}{Math.Round(p.y, 5)} {cs}{Math.Round(p.z, 5)}";
string particle = "minecraft:" + ParticleTypeBox.Text;
if (ParticleTypeBox.SelectedValue.Equals("dust"))
{
diff --git a/ParticleConverter/util/Logger.cs b/ParticleConverter/util/Logger.cs
index ba521fb..5006e9c 100644
--- a/ParticleConverter/util/Logger.cs
+++ b/ParticleConverter/util/Logger.cs
@@ -17,9 +17,8 @@ public static void WriteExceptionLog(Exception e)
Directory.CreateDirectory(@".\exceptionLog");
string path = $@".\exceptionLog\{result}.txt";
streamWriter = new StreamWriter(path);
- streamWriter.WriteLine("Member:" + e.TargetSite.Name);
- streamWriter.WriteLine(e.Message);
- streamWriter.WriteLine(e.StackTrace);
+ streamWriter.WriteLine(e.Data);
+ streamWriter.WriteLine(e.ToString());
}
finally
{
From 38aa7b480ceb529dc8726d6a8ad3bdb80ea7020b Mon Sep 17 00:00:00 2001
From: kemo431
Date: Tue, 20 Oct 2020 01:06:30 +0900
Subject: [PATCH 7/9] =?UTF-8?q?=E8=AD=A6=E5=91=8A=E3=81=AE=E5=AE=9F?=
=?UTF-8?q?=E8=A3=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ParticleConverter/MainWindow.xaml | 26 ++++++++++++++++++++++----
ParticleConverter/MainWindow.xaml.cs | 20 +++++++++++++++-----
ParticleConverter/lang/en-US.xaml | 9 +++++++++
ParticleConverter/lang/ja-JP.xaml | 9 +++++++++
ParticleConverter/util/UpdateUtil.cs | 14 ++++++++++++++
5 files changed, 69 insertions(+), 9 deletions(-)
create mode 100644 ParticleConverter/util/UpdateUtil.cs
diff --git a/ParticleConverter/MainWindow.xaml b/ParticleConverter/MainWindow.xaml
index 448ec87..66987a4 100644
--- a/ParticleConverter/MainWindow.xaml
+++ b/ParticleConverter/MainWindow.xaml
@@ -287,7 +287,7 @@
Content="0˚"
IsSelected="True"
Tag="0" />
-
+
@@ -597,14 +597,32 @@
Margin="5,0"
Checked="UsePreviewBox_Checked"
Content="{DynamicResource UsePreview}" />
-
+ Orientation="Horizontal">
+
+
+
= 2000)
+ {
+ ParticleCounter.Foreground = new SolidColorBrush(Colors.Red);
+ CounterAlert.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ ParticleCounter.Foreground = new SolidColorBrush(Colors.Snow);
+ CounterAlert.Visibility = Visibility.Hidden;
+ }
}
}
catch (Exception e)
@@ -575,9 +585,9 @@ private async void ExportButton_Click(object sender, RoutedEventArgs e)
BrowsImageButton.IsEnabled = false;
BrowsFolderButton.IsEnabled = false;
ButtonProgressAssist.SetValue(ExportButton, 0);
- int coord = int.Parse(((ComboBoxItem)CoordinateAxis.SelectedItem).Tag.ToString());
- int verAlig = int.Parse(((ComboBoxItem)VerticalAlignmentBox.SelectedItem).Tag.ToString());
- int horAlig = int.Parse(((ComboBoxItem)HorizontalAlignmentBox.SelectedItem).Tag.ToString());
+ int coord = CoordinateAxis.SelectedIndex;
+ int verAlig = VerticalAlignmentBox.SelectedIndex;
+ int horAlig = HorizontalAlignmentBox.SelectedIndex;
Particle[] particles = ImageConverter.GetParticles(coord, verAlig, horAlig);
ButtonProgressAssist.SetMaximum(ExportButton, particles.Length + 20);
ButtonProgressAssist.SetValue(ExportButton, 20);
@@ -618,7 +628,7 @@ private async void ExportButton_Click(object sender, RoutedEventArgs e)
for (int i = 0; i < particles.Length; i++)
{
var p = particles[i];
- string axis = $"{cs}{Math.Round(p.x, 5)} {cs}{Math.Round(p.y, 5)} {cs}{Math.Round(p.z, 5)}";
+ string axis = $"{cs}{Math.Round(p.x, 7)} {cs}{Math.Round(p.y, 7)} {cs}{Math.Round(p.z, 7)}";
string particle = "minecraft:" + ParticleTypeBox.Text;
if (ParticleTypeBox.SelectedValue.Equals("dust"))
{
@@ -686,7 +696,7 @@ private void Show_BugReport(object sender, RoutedEventArgs e)
}
private async void Show_About(object sender, RoutedEventArgs e)
{
- var dialog = new About();
+ var dialog = new dialogs.About();
var result = await DialogHost.ShowDialog(dialog);
}
diff --git a/ParticleConverter/lang/en-US.xaml b/ParticleConverter/lang/en-US.xaml
index 8480b3a..d9e93fe 100644
--- a/ParticleConverter/lang/en-US.xaml
+++ b/ParticleConverter/lang/en-US.xaml
@@ -61,4 +61,13 @@
Export Settings
ExportFolder
Export!!
+
+
+ There are too many particles.
+ It may not be displayed normally depending on the performance of the computer.
+ Consider changing the resolution.
+
+
+ Update Notification
+ A new version is available. \ n Do you want to download it?
\ No newline at end of file
diff --git a/ParticleConverter/lang/ja-JP.xaml b/ParticleConverter/lang/ja-JP.xaml
index 4eeca8a..95fe062 100644
--- a/ParticleConverter/lang/ja-JP.xaml
+++ b/ParticleConverter/lang/ja-JP.xaml
@@ -61,4 +61,13 @@
出力設定
出力先フォルダ
出力!
+
+
+ パーティクルの量が多すぎます。
+ コンピュータの性能によっては正常に表示できない可能性があります。
+ 解像度の変更を検討してください。
+
+
+ アップデート通知
+ 新しいバージョンが公開されています。\nダウンロードしますか?
\ No newline at end of file
diff --git a/ParticleConverter/util/UpdateUtil.cs b/ParticleConverter/util/UpdateUtil.cs
new file mode 100644
index 0000000..7ff2c5b
--- /dev/null
+++ b/ParticleConverter/util/UpdateUtil.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ParticleConverter.util
+{
+ public static class UpdateUtil
+ {
+ static void CheckUpdate(string url)
+ {
+
+ }
+ }
+}
From 909a78076645b7a67c43fef33351e84223f4ee78 Mon Sep 17 00:00:00 2001
From: kemo14331
Date: Wed, 3 Feb 2021 02:45:35 +0900
Subject: [PATCH 8/9] =?UTF-8?q?=E3=82=AB=E3=83=AB=E3=83=81=E3=83=A3?=
=?UTF-8?q?=E7=B3=BB=E3=82=92=E8=A8=AD=E5=AE=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ParticleConverter/MainWindow.xaml.cs | 32 ++++++++++++++--------
ParticleConverter/ParticleConverter.csproj | 10 +++++--
2 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/ParticleConverter/MainWindow.xaml.cs b/ParticleConverter/MainWindow.xaml.cs
index 188fc6e..b93b570 100644
--- a/ParticleConverter/MainWindow.xaml.cs
+++ b/ParticleConverter/MainWindow.xaml.cs
@@ -2,7 +2,6 @@
using MaterialDesignThemes.Wpf;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs;
-using ParticleConverter.dialogs;
using ParticleConverter.util;
using SharpDX;
using System;
@@ -19,7 +18,7 @@
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
-using System.Windows.Threading;
+using System.Globalization;
using Color = System.Windows.Media.Color;
using ColorConverter = System.Windows.Media.ColorConverter;
using Particle = ParticleConverter.util.Particle;
@@ -33,9 +32,18 @@ public partial class MainWindow : System.Windows.Window
{
private readonly Dictionary oldValues = new Dictionary();
private readonly util.ImageConverter ImageConverter = new util.ImageConverter();
+
+ // CultureInfo.InvariantCultureでen-USの書式を取得
+ private readonly NumberFormatInfo format = CultureInfo.InvariantCulture.NumberFormat;
+
public MainWindow()
{
InitializeComponent();
+ //カルチャ変更
+ if (!CultureInfo.CurrentCulture.Name.Equals("ja-JP"))
+ {
+ CultureInfo.CurrentCulture = new CultureInfo("en-US", false);
+ }
Load_Langugae();
ColorCodeBox_TextChanged(ColorCodeBox, null);
FolderPathBox.Text = Settings.Default.FolderPath;
@@ -366,8 +374,8 @@ private void BrowsImageButton_Click(object sender, RoutedEventArgs e)
private void Sync_SizeBoxes()
{
System.Windows.Size size = ImageConverter.GetBlocks();
- Update_FilterTextBox(SizeWBox, size.Width.ToString());
- Update_FilterTextBox(SizeHBox, size.Height.ToString());
+ Update_FilterTextBox(SizeWBox, size.Width.ToString("R",format));
+ Update_FilterTextBox(SizeHBox, size.Height.ToString("R", format));
}
private void Sync_ResolutionBoxes()
@@ -513,15 +521,15 @@ private void SizeBox_LostFocus(object sender, RoutedEventArgs e)
if (sender.Equals(SizeWBox))
{
double reheight = ImageConverter.ResizedHeight / (ImageConverter.ResizedWidth / double.Parse(sb.Text));
- Update_FilterTextBox(SizeHBox, reheight.ToString());
- Update_FilterTextBox(ParticleDensityBox, (ImageConverter.ResizedWidth / double.Parse(sb.Text)).ToString());
+ Update_FilterTextBox(SizeHBox, reheight.ToString("R", format));
+ Update_FilterTextBox(ParticleDensityBox, (ImageConverter.ResizedWidth / double.Parse(sb.Text)).ToString("R",format));
ImageConverter.Density = ImageConverter.ResizedWidth / double.Parse(sb.Text);
}
if (sender.Equals(SizeHBox))
{
double rewidth = ImageConverter.ResizedWidth / (ImageConverter.ResizedHeight / double.Parse(sb.Text));
- Update_FilterTextBox(SizeWBox, rewidth.ToString());
- Update_FilterTextBox(ParticleDensityBox, (ImageConverter.ResizedHeight / double.Parse(sb.Text)).ToString());
+ Update_FilterTextBox(SizeWBox, rewidth.ToString("R", format));
+ Update_FilterTextBox(ParticleDensityBox, (ImageConverter.ResizedHeight / double.Parse(sb.Text)).ToString("R", format));
ImageConverter.Density = ImageConverter.ResizedWidth / double.Parse(sb.Text);
}
}
@@ -593,7 +601,7 @@ private async void ExportButton_Click(object sender, RoutedEventArgs e)
ButtonProgressAssist.SetValue(ExportButton, 20);
ExportButton.UpdateLayout();
string fileName = System.IO.Path.GetFileNameWithoutExtension(FilePathBox.Text);
- string filePath = FolderPathBox.Text + "\\" + fileName + ".mcfunction";
+ string filePath = FolderPathBox.Text + "\\" + fileName.ToLower() + ".mcfunction";
Encoding enc = new System.Text.UTF8Encoding(); ;
StreamWriter writer = null;
try
@@ -628,18 +636,18 @@ private async void ExportButton_Click(object sender, RoutedEventArgs e)
for (int i = 0; i < particles.Length; i++)
{
var p = particles[i];
- string axis = $"{cs}{Math.Round(p.x, 7)} {cs}{Math.Round(p.y, 7)} {cs}{Math.Round(p.z, 7)}";
+ string axis = $"{cs}{Math.Round(p.x, 7).ToString("R", format)} {cs}{Math.Round(p.y, 7).ToString("R", format)} {cs}{Math.Round(p.z, 7).ToString("R", format)}";
string particle = "minecraft:" + ParticleTypeBox.Text;
if (ParticleTypeBox.SelectedValue.Equals("dust"))
{
if (UseStaticDustColor.IsChecked.Value)
{
Color color = (Color)ColorConverter.ConvertFromString(ColorCodeBox.Text);
- particle += $" {Math.Round(color.R / 255.0d, 2)} {Math.Round(color.G / 255.0d, 2)} {Math.Round(color.B / 255.0d, 2)} {ParticleSizeBox.Text}";
+ particle += $" {Math.Round(color.R / 255.0d, 2).ToString("R", format)} {Math.Round(color.G / 255.0d, 2).ToString("R", format)} {Math.Round(color.B / 255.0d, 2).ToString("R", format)} {double.Parse(ParticleSizeBox.Text).ToString("R", format)}";
}
else
{
- particle += $" {Math.Round(p.r / 255.0d, 2)} {Math.Round(p.g / 255.0d, 2)} {Math.Round(p.b / 255.0d, 2)} {ParticleSizeBox.Text}";
+ particle += $" {Math.Round(p.r / 255.0d, 2).ToString("R", format)} {Math.Round(p.g / 255.0d, 2).ToString("R", format)} {Math.Round(p.b / 255.0d, 2).ToString("R", format)} {double.Parse(ParticleSizeBox.Text).ToString("R", format)}";
}
}
string particleString = $"particle {particle} {axis} 0 0 0 0 1 {((ComboBoxItem)DisplayModeBox.SelectedItem).Tag} {ParticleViewerBox.Text}";
diff --git a/ParticleConverter/ParticleConverter.csproj b/ParticleConverter/ParticleConverter.csproj
index 7595bcd..6f985ec 100644
--- a/ParticleConverter/ParticleConverter.csproj
+++ b/ParticleConverter/ParticleConverter.csproj
@@ -6,7 +6,7 @@
true
ParticleConverter.App
true
- Kemo431.pfx
+ kemo14331.pfx
false
Kemo431
false
@@ -16,8 +16,8 @@
https://github.com/kemo14331/Particle-Converter
icon.png
icon.ico
- 1.0.2.*
- 1.0.2
+ 1.0.3.*
+ 1.0.3
1.0.2
@@ -76,4 +76,8 @@
+
+
+
+
\ No newline at end of file
From 6df08f680058228414eab0d87311d8f5f5f83fa6 Mon Sep 17 00:00:00 2001
From: kemo14331
Date: Wed, 3 Feb 2021 03:26:57 +0900
Subject: [PATCH 9/9] =?UTF-8?q?=E6=A7=8B=E6=88=90=E3=83=95=E3=82=A1?=
=?UTF-8?q?=E3=82=A4=E3=83=AB=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ParticleConverter.sln | 2 ++
ParticleConverter/ParticleConverter.csproj | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/ParticleConverter.sln b/ParticleConverter.sln
index 1d9809c..411f929 100644
--- a/ParticleConverter.sln
+++ b/ParticleConverter.sln
@@ -14,11 +14,13 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Publish|Any CPU = Publish|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B5006587-6179-4CBD-80E0-DD423E9690AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5006587-6179-4CBD-80E0-DD423E9690AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B5006587-6179-4CBD-80E0-DD423E9690AE}.Publish|Any CPU.ActiveCfg = Release|Any CPU
{B5006587-6179-4CBD-80E0-DD423E9690AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5006587-6179-4CBD-80E0-DD423E9690AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
diff --git a/ParticleConverter/ParticleConverter.csproj b/ParticleConverter/ParticleConverter.csproj
index 6f985ec..112982f 100644
--- a/ParticleConverter/ParticleConverter.csproj
+++ b/ParticleConverter/ParticleConverter.csproj
@@ -19,6 +19,7 @@
1.0.3.*
1.0.3
1.0.2
+ Debug;Release
@@ -35,7 +36,6 @@
-