From 79e3d0075428ba4cac24ac79687647dd304822c1 Mon Sep 17 00:00:00 2001 From: seto Date: Sat, 7 Oct 2023 14:58:22 +0900 Subject: [PATCH] update --- .../Crystallography.Controls.csproj | 4 +- .../ScalablePictureBox.cs | 11 ++--- Crystallography/Crystallography.csproj | 4 +- Crystallography/PointD.cs | 41 ++++++++----------- PDIndexer/FormMain.cs | 4 +- PDIndexer/PDIndexer.csproj | 4 +- PDIndexer/Version.cs | 14 +------ 7 files changed, 29 insertions(+), 53 deletions(-) diff --git a/Crystallography.Controls/Crystallography.Controls.csproj b/Crystallography.Controls/Crystallography.Controls.csproj index 2fa7ce8..5365e74 100644 --- a/Crystallography.Controls/Crystallography.Controls.csproj +++ b/Crystallography.Controls/Crystallography.Controls.csproj @@ -4,8 +4,8 @@ Library net7.0-windows true - 2023.10.7.0542 - 2023.10.7.0542 + 2023.10.7.0557 + 2023.10.7.0557 PerMonitorV2 true true diff --git a/Crystallography.Controls/ScalablePictureBox.cs b/Crystallography.Controls/ScalablePictureBox.cs index 90faa44..2198028 100644 --- a/Crystallography.Controls/ScalablePictureBox.cs +++ b/Crystallography.Controls/ScalablePictureBox.cs @@ -167,7 +167,7 @@ public ScalablePictureBox() public bool VerticalFlip { set { PseudoBitmap.VerticalFlip = value; drawPictureBox(); } - get { return PseudoBitmap.VerticalFlip; } + get => PseudoBitmap.VerticalFlip; } private bool horizontalFlip = false; @@ -178,7 +178,7 @@ public bool VerticalFlip public bool HorizontalFlip { set { PseudoBitmap.HorizontalFlip = value; drawPictureBox(); } - get { return PseudoBitmap.HorizontalFlip; } + get => PseudoBitmap.HorizontalFlip; } private double minZoom = 0.1f; @@ -235,9 +235,6 @@ public PointD Center get => _Center.IsNaN ? new PointD(0, 0) : _Center; } - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - private Vector3DBase zoomAndCenter = new(1, 0, 0); - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public (double Zoom, PointD Center) ZoomAndCenter { @@ -307,7 +304,7 @@ public bool ShowAreaRectangle } [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - private RectangleD areaRentagle = new RectangleD(); + private RectangleD areaRentagle = new(); [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public RectangleD AreaRectangle { @@ -331,7 +328,7 @@ public RectangleD AreaRectangle [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Color TextColor { get => label.ForeColor; set => label.ForeColor = value; } - private PseudoBitmap _pseudoBitmap = new PseudoBitmap(); + private PseudoBitmap _pseudoBitmap = new(); [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public PseudoBitmap PseudoBitmap diff --git a/Crystallography/Crystallography.csproj b/Crystallography/Crystallography.csproj index 3ebbd0e..eb8d163 100644 --- a/Crystallography/Crystallography.csproj +++ b/Crystallography/Crystallography.csproj @@ -4,8 +4,8 @@ Library net7.0-windows true - 2023.10.7.0542 - 2023.10.7.0542 + 2023.10.7.0557 + 2023.10.7.0557 diff --git a/Crystallography/PointD.cs b/Crystallography/PointD.cs index 4819ab6..ed8a3fb 100644 --- a/Crystallography/PointD.cs +++ b/Crystallography/PointD.cs @@ -15,13 +15,10 @@ public struct RectangleD public double Width { set; get; } public double Height { set; get; } - public double UpperX { get { return X + Width; } } - public double UpperY { get { return Y + Height; } } + public readonly double UpperX => X + Width; + public readonly double UpperY => Y + Height; - public readonly bool IsInsde(PointD p) - { - return p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height; - } + public readonly bool IsInsde(PointD p) => p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height; public RectangleD(double x, double y, double width, double height) : this() { @@ -63,16 +60,16 @@ public RectangleD(PointD pt1, PointD pt2) : this() Height = Math.Abs(pt2.Y - pt1.Y); } - public readonly RectangleF ToRectangleF() => new RectangleF((float)X, (float)Y, (float)Width, (float)Height); + public readonly RectangleF ToRectangleF() => new((float)X, (float)Y, (float)Width, (float)Height); - public readonly SizeD ToSizeD() => new SizeD(Width, Height); - public readonly SizeF ToSizeF() => new SizeF((float)Width, (float)Height); + public readonly SizeD ToSizeD() => new(Width, Height); + public readonly SizeF ToSizeF() => new((float)Width, (float)Height); /// /// 四捨五入して整数サイズに変換 /// /// - public readonly Size ToSize() => new Size((int)(Width + 0.5), (int)(Height + 0.5)); + public readonly Size ToSize() => new((int)(Width + 0.5), (int)(Height + 0.5)); } @@ -108,27 +105,21 @@ public SizeD(Size size) : this() Height = size.Height; } - public readonly SizeF ToSizeF() - { - return new SizeF((float)Width, (float)Height); - } + public readonly SizeF ToSizeF() => new((float)Width, (float)Height); #region 演算子のオーバーロード - public override int GetHashCode() - { - return HashCode.Combine(Width, Height); - } + public override readonly int GetHashCode() => HashCode.Combine(Width, Height); - public override bool Equals(object obj) => obj is SizeD d && Equals(d); + public override readonly bool Equals(object obj) => obj is SizeD d && Equals(d); - public bool Equals(in SizeD other) => Width == other.Width && Height == other.Height; + public readonly bool Equals(in SizeD other) => Width == other.Width && Height == other.Height; public static SizeD operator +(in SizeD p1, in SizeD p2) => new(p1.Width + p2.Width, p1.Height + p2.Height); public static SizeD operator -(in SizeD p1, in SizeD p2) => new(p1.Width - p2.Width, p1.Height - p2.Height); - public static SizeD operator -(in SizeD p) => new SizeD(-p.Width, -p.Height); + public static SizeD operator -(in SizeD p) => new(-p.Width, -p.Height); public static SizeD operator *(in double d, in SizeD p) => new(d * p.Width, d * p.Height); @@ -177,7 +168,7 @@ public PointD(in PointD pt) public readonly PointF ToPointF() => new((float)X, (float)Y); - public int CompareTo(object obj) + public readonly int CompareTo(object obj) { int value = X.CompareTo(((PointD)obj).X); if (value != 0) @@ -191,11 +182,11 @@ public int CompareTo(object obj) /// public override readonly string ToString() => string.Format("({0}, {1})", this.X, this.Y); - public override bool Equals(object obj) => obj is PointD d && Equals(d); + public override readonly bool Equals(object obj) => obj is PointD d && Equals(d); - public bool Equals(PointD other) => X == other.X && Y == other.Y; + public readonly bool Equals(PointD other) => X == other.X && Y == other.Y; - public override int GetHashCode() => HashCode.Combine(X, Y); + public override readonly int GetHashCode() => HashCode.Combine(X, Y); #region 演算子のオーバーロード diff --git a/PDIndexer/FormMain.cs b/PDIndexer/FormMain.cs index 4292429..0752d82 100644 --- a/PDIndexer/FormMain.cs +++ b/PDIndexer/FormMain.cs @@ -737,7 +737,7 @@ private void FormMain_FormClosed(object sender, FormClosedEventArgs e) #region 繝ャ繧ク繧ケ繝医Μ謫堺ス - private void ClearRegistry() + private static void ClearRegistry() { try { Microsoft.Win32.Registry.CurrentUser.DeleteSubKey("Software\\Crystallography\\PDIndexer"); } catch { } @@ -1551,7 +1551,7 @@ private void DrawGradiation() var pen = new Pen(colorControlScaleLine.Color, 1); gMain.DrawLine(pen, OriginPos.X, pictureBoxMain.Height - OriginPos.Y, pictureBoxMain.Width, pictureBoxMain.Height - OriginPos.Y); - Font strFont = new Font(new FontFamily("tahoma"), 8); + using Font strFont = new(new FontFamily("tahoma"), 8); for (int i = (int)(LowerX / AngleGradiation) + 1; i < UpperX / AngleGradiation; i++) { pen = new Pen(colorControlScaleLine.Color, 1); diff --git a/PDIndexer/PDIndexer.csproj b/PDIndexer/PDIndexer.csproj index 42c3d25..c52bc68 100644 --- a/PDIndexer/PDIndexer.csproj +++ b/PDIndexer/PDIndexer.csproj @@ -4,8 +4,8 @@ WinExe net7.0-windows true - 2023.10.7.0542 - 2023.10.7.0542 + 2023.10.7.0557 + 2023.10.7.0557 App.ico diff --git a/PDIndexer/Version.cs b/PDIndexer/Version.cs index d32d87f..26de9dd 100644 --- a/PDIndexer/Version.cs +++ b/PDIndexer/Version.cs @@ -6,24 +6,12 @@ static class Version { public const string Software = "PDIndexer"; - static public string RecentHistory - { - get - { - var list = History.Remove(0, 10).Split(new string[] { "\r\n " }, StringSplitOptions.RemoveEmptyEntries); - var str = ""; - for (int i = 0; i < 5; i++) - str += list[i] + "
\r\n"; - return str; - } - } - /// /// 譖エ譁ー螻・豁エ /// public const string History = "History" + - "\r\n ver4.441(2023/10/07) Fixed minor bugs." + + "\r\n ver4.442(2023/10/07) Update crystal database. Fixed minor bugs." + "\r\n ver4.441(2023/07/01) Fixed a bug on loading *.pdi2 format files." + "\r\n ver4.440(2023/05/24) Improved registry read/write.The registry is cleared the first time this version is launched." + "\r\n ver4.439(2023/05/23) Fixed bugs on loading txt-format profiles." +