diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3ae2271 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# WFO1000: プロパティ コンテンツのコード シリアル化構成がありません +dotnet_diagnostic.WFO1000.severity = silent diff --git a/Crystallography.Controls/Crystallography.Controls.csproj b/Crystallography.Controls/Crystallography.Controls.csproj index 8a6d12f..a4e0bfc 100644 --- a/Crystallography.Controls/Crystallography.Controls.csproj +++ b/Crystallography.Controls/Crystallography.Controls.csproj @@ -4,8 +4,8 @@ Library net9.0-windows10.0.26100.0 true - 2024.11.25.0729 - 2024.11.25.0729 + 2024.12.2.0541 + 2024.12.2.0541 PerMonitorV2 true true diff --git a/Crystallography/Crystal/ConvertCrystalData.cs b/Crystallography/Crystal/ConvertCrystalData.cs index 16c43e4..bebd5c2 100644 --- a/Crystallography/Crystal/ConvertCrystalData.cs +++ b/Crystallography/Crystal/ConvertCrystalData.cs @@ -555,16 +555,16 @@ private static (Crystal2, string) CellParamForAmc(string str) for (int i = 0; i < 6; i++) if (s[i].EndsWith(',')) s[i] = s[i].TrimEnd(','); //Ō','ĂƂ͍폜 - if (Miscellaneous.IsDecimalPointComma) - for (int i = 0; i < 6; i++) s[i] = s[i].Replace('.', ','); - else - for (int i = 0; i < 6; i++) s[i] = s[i].Replace(',', '.'); - A = Convert.ToDouble(s[0]); - B = Convert.ToDouble(s[1]); - C = Convert.ToDouble(s[2]); - Alpha = Convert.ToDouble(s[3]); - Beta = Convert.ToDouble(s[4]); - Gamma = Convert.ToDouble(s[5]); + //if (Miscellaneous.IsDecimalPointComma) + // for (int i = 0; i < 6; i++) s[i] = s[i].Replace('.', ','); + //else + // for (int i = 0; i < 6; i++) s[i] = s[i].Replace(',', '.'); + A = s[0].ToDouble(); + B = s[1].ToDouble(); + C = s[2].ToDouble(); + Alpha = s[3].ToDouble(); + Beta = s[4].ToDouble(); + Gamma = s[5].ToDouble(); } catch { return (null, null); } string SgName = s[6]; diff --git a/Crystallography/Crystallography.csproj b/Crystallography/Crystallography.csproj index d06624b..6074b1e 100644 --- a/Crystallography/Crystallography.csproj +++ b/Crystallography/Crystallography.csproj @@ -4,8 +4,8 @@ Library net9.0-windows10.0.26100.0 true - 2024.11.25.0729 - 2024.11.25.0729 + 2024.12.2.0541 + 2024.12.2.0541 7.0 AnyCPU;x64 diff --git a/Crystallography/ExtensionMethods.cs b/Crystallography/ExtensionMethods.cs index a44a302..2c8aad5 100644 --- a/Crystallography/ExtensionMethods.cs +++ b/Crystallography/ExtensionMethods.cs @@ -265,6 +265,8 @@ public static (int H, int K, int L) Cross(ref this (int H, int K, int L) x, (int #region Stringの拡張 public static class StringEx { + public static System.Globalization.CultureInfo InvCul = System.Globalization.CultureInfo.InvariantCulture; + /// /// 拡張メソッド. 指定したseparatorで文字を区切り、文字の配列を返す. /// @@ -297,7 +299,21 @@ public static string[] Split(this string s, bool removeEmptyEntries = true) /// /// /// - public static double ToDouble(this string s) => !s.Contains('/') ? Convert.ToDouble(s) : s.Split("/", true)[0].ToDouble() / s.Split("/", true)[1].ToDouble(); + public static double ToDouble(this string s) + { + + if(s.Contains('/')) + { + var index = s.LastIndexOf('/'); + return s[0..index].ToDouble() / s[(index+1)..].ToDouble(); + } + else + { + s = s.Replace(',', '.'); + return Convert.ToDouble(s,InvCul); + } + //return !s.Contains('/') ? Convert.ToDouble(s) : s.Split("/", true)[0].ToDouble() / s.Split("/", true)[1].ToDouble(); + } /// /// 拡張メソッド. ConvertToInt32を拡張メソッドとして呼び出す. 変換できない場合は例外発生 @@ -334,10 +350,11 @@ public static class DoubleEx public static double Min(this double[][] d) => d.Min(e => e.Min()); public static double Max(this double[][][] d) => d.Max(e => e.Max()); public static double Min(this double[][][] d) => d.Min(e => e.Min()); - } #endregion + + #region Graphicsクラス /// /// Graphics クラスの描画関数にdoubleを受けられるにようにした拡張メソッド diff --git a/Crystallography/Miscellaneous.cs b/Crystallography/Miscellaneous.cs index 29c5749..c8aabc1 100644 --- a/Crystallography/Miscellaneous.cs +++ b/Crystallography/Miscellaneous.cs @@ -116,6 +116,7 @@ public static bool IsDecimalPointComma /// public static bool isFileExistsAndLocked(string path) { + if (File.Exists(path)) { FileStream stream = null; diff --git a/Crystallography/PdiFile.cs b/Crystallography/PdiFile.cs index 1f055dd..cc7213e 100644 --- a/Crystallography/PdiFile.cs +++ b/Crystallography/PdiFile.cs @@ -143,9 +143,11 @@ public static DiffractionProfile2[] ReadPdi2File(string fileName, int version = if (strList[0].Contains("Wave Length", StringComparison.Ordinal)) { if (strList[0].Contains("(nm)", StringComparison.Ordinal)) - diffProf.SrcProperty.WaveLength = Convert.ToDouble((strList[0].Split(':', true))[1]); + //diffProf.SrcProperty.WaveLength = Convert.ToDouble((strList[0].Split(':', true))[1]); + diffProf.SrcProperty.WaveLength = (strList[0].Split(':', true))[1].ToDouble(); else if (strList[0].Contains("(0.1nm)", StringComparison.Ordinal)) - diffProf.SrcProperty.WaveLength = Convert.ToDouble((strList[0].Split(':', true))[1]) / 10.0; + //diffProf.SrcProperty.WaveLength = Convert.ToDouble((strList[0].Split(':', true))[1]) / 10.0; + diffProf.SrcProperty.WaveLength = (strList[0].Split(':', true))[1].ToDouble() / 10.0; } if ((strList[4].Split(':', true))[1] == "Angle") @@ -160,7 +162,8 @@ public static DiffractionProfile2[] ReadPdi2File(string fileName, int version = for (int i = 5; i < strList.Count; i++) { string[] str = strList[i].Split(',', true); - diffProf.SourceProfile.Pt.Add(new PointD(Convert.ToDouble(str[0]), Convert.ToDouble(str[1]))); + //diffProf.SourceProfile.Pt.Add(new PointD(Convert.ToDouble(str[0]), Convert.ToDouble(str[1]))); + diffProf.SourceProfile.Pt.Add(new PointD(str[0].ToDouble(), str[1].ToDouble())); } diffProf.Name = fileName.Remove(0, fileName.LastIndexOf('\\') + 1); return new DiffractionProfile2[] { diffProf }; @@ -179,7 +182,7 @@ public static DiffractionProfile2[] ReadRasFile(string fileName) strArray.Add(tempstr); reader.Close(); if (strArray.Count <= 3) - return Array.Empty(); + return []; var dp = new List(); @@ -194,8 +197,10 @@ public static DiffractionProfile2[] ReadRasFile(string fileName) if (strArray[i] != "*RAS_INT_END") { string[] tempStr = strArray[i].Split(new[] { ' ' }); - double x = Convert.ToDouble(tempStr[0]); - double y = Convert.ToDouble(tempStr[1]); + //double x = Convert.ToDouble(tempStr[0]); + //double y = Convert.ToDouble(tempStr[1]); + double x = tempStr[0].ToDouble(); + double y = tempStr[1].ToDouble(); dp[^1].SourceProfile.Pt.Add(new PointD(x, y)); } else @@ -208,8 +213,8 @@ public static DiffractionProfile2[] ReadRasFile(string fileName) dp[i].Name = $"{Path.GetFileName(fileName)}{(dp.Count > 1 ? $" -{i}" : "")}"; if (dp.Count > 0) - return dp.ToArray(); - else return Array.Empty(); + return [.. dp]; + else return []; } /// @@ -235,11 +240,11 @@ public static DiffractionProfile2[] ReadCSVFile(string fileName) try { - var title = strArray[0].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - var axis = strArray[1].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - var value = strArray[2].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var title = strArray[0].Split([','], StringSplitOptions.RemoveEmptyEntries); + var axis = strArray[1].Split([','], StringSplitOptions.RemoveEmptyEntries); + var value = strArray[2].Split([','], StringSplitOptions.RemoveEmptyEntries); if (title.Length * 2 != axis.Length || axis.Length != value.Length) - return Array.Empty(); + return []; var dp = new DiffractionProfile2[title.Length]; for (int i = 0; i < dp.Length; i++) @@ -252,8 +257,10 @@ public static DiffractionProfile2[] ReadCSVFile(string fileName) value = strArray[i].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int j = 0; j < value.Length / 2; j++) { - double x = Convert.ToDouble(value[j * 2]); - double y = Convert.ToDouble(value[j * 2 + 1]); + //double x = Convert.ToDouble(value[j * 2]); + //double y = Convert.ToDouble(value[j * 2 + 1]); + var x = value[j * 2].ToDouble(); + var y = value[j * 2 + 1].ToDouble(); dp[j].SourceProfile.Pt.Add(new PointD(x, y)); } } @@ -295,7 +302,7 @@ public static DiffractionProfile2 ConvertUnknownFileToProfileData(string fileNam var stringList = new List(); //まず指定されたセパレータで全てを区切る for (int i = 0; i < strArray.Count; i++) - stringList.Add(strArray[i].Split(new char[] { separater }, StringSplitOptions.RemoveEmptyEntries)); + stringList.Add(strArray[i].Split([separater], StringSplitOptions.RemoveEmptyEntries)); //その全てを数値に変換する var doubleList = new List(); for (int i = 0; i < stringList.Count; i++) @@ -303,11 +310,12 @@ public static DiffractionProfile2 ConvertUnknownFileToProfileData(string fileNam var doubleTemp = new List(); for (int j = 0; j < stringList[i].Length; j++) { - var str = Miscellaneous.IsDecimalPointComma ? stringList[i][j].Replace('.', ',') : stringList[i][j].Replace(',', '.'); - if (double.TryParse(str, out double result)) - doubleTemp.Add(result); + //var str = Miscellaneous.IsDecimalPointComma ? stringList[i][j].Replace('.', ',') : stringList[i][j].Replace(',', '.'); + //if (double.TryParse(str, out double result)) + // doubleTemp.Add(result); + doubleTemp.Add(stringList[i][j].ToDouble()); } - doubleList.Add(doubleTemp.ToArray()); + doubleList.Add([.. doubleTemp]); } int count = 1; int beforeLength = 0; diff --git a/PDIndexer.sln b/PDIndexer.sln index 2e89b72..3fd64a4 100644 --- a/PDIndexer.sln +++ b/PDIndexer.sln @@ -11,6 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crystallography.Controls", EndProject Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "PDindexerSetup", "PDindexerSetup\PDindexerSetup.vdproj", "{80EF52B7-7757-4980-A47A-0772A37AB289}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{965242BA-7668-45BD-AB8B-C1F8CD894B2D}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/PDIndexer/DataConverter/EDXControl.cs b/PDIndexer/DataConverter/EDXControl.cs index 64683d3..0f3c6a1 100644 --- a/PDIndexer/DataConverter/EDXControl.cs +++ b/PDIndexer/DataConverter/EDXControl.cs @@ -1,18 +1,12 @@ -using System; -using System.Collections.Generic; +using System.Windows.Forms; using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; namespace PDIndexer { public partial class EDXControl : UserControl { + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public double[] EGC { get => new[] { numericBoxEGC0.Value, numericBoxEGC1.Value, numericBoxEGC2.Value }; @@ -27,10 +21,13 @@ public double[] EGC } } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool Valid { get => checkBox1.Checked; set => checkBox1.Checked = value; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string DetectorName { get => checkBox1.Text; set => checkBox1.Text = value; } + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool CheckBoxVisible { get => checkBox1.Visible; set => checkBox1.Visible = value; } public EDXControl() diff --git a/PDIndexer/FormFitting.cs b/PDIndexer/FormFitting.cs index b4fe7a5..5b58a5f 100644 --- a/PDIndexer/FormFitting.cs +++ b/PDIndexer/FormFitting.cs @@ -164,7 +164,7 @@ private void ButtonSaveTableAsCSV_Click(object sender, EventArgs e) { var dlg = new SaveFileDialog { Filter = "*.csv|*.csv" }; if (dlg.ShowDialog() == DialogResult.OK) - using (StreamWriter sw = new StreamWriter(dlg.FileName, false)) + using (StreamWriter sw = new(dlg.FileName, false)) sw.Write(text.Replace("\t", ",")); } } @@ -181,41 +181,39 @@ private void FormFitting_DragDrop(object sender, DragEventArgs e) string[] fileName = (string[])e.Data.GetData(DataFormats.FileDrop, false); if (fileName.Length == 1 && fileName[0].ToLower().EndsWith("csv")) { - using (var sr = new StreamReader(fileName[0])) + using var sr = new StreamReader(fileName[0]); + if (sr.ReadLine().StartsWith("Checked,hkl")) { - if (sr.ReadLine().StartsWith("Checked,hkl")) + int n = 0; + while (sr.Peek() > -1) { - int n = 0; - while (sr.Peek() > -1) + var line = sr.ReadLine().Split(new[] { ',' }, StringSplitOptions.None); + if (line.Length > 2 && n < dataSet.DataTablePeakFitting.Rows.Count) { - var line = sr.ReadLine().Split(new[] { ',' }, StringSplitOptions.None); - if (line.Length > 2 && n < dataSet.DataTablePeakFitting.Rows.Count) + var dr = dataSet.DataTablePeakFitting.Rows[n] as DataSet.DataTablePeakFittingRow; + dr.Check = line[0] == "True"; + dr.Function = line[3]; + dr.X = Convert.ToDouble(line[4]); + dr.XErr = Convert.ToDouble(line[5]); + dr.FWHM = Convert.ToDouble(line[6]); + dr.Intensity = Convert.ToDouble(line[7]); + dr.R = Convert.ToDouble(line[8]); + if (n < TargetCrystal.Plane.Count) { - var dr = dataSet.DataTablePeakFitting.Rows[n] as DataSet.DataTablePeakFittingRow; - dr.Check = line[0] == "True"; - dr.Function = line[3]; - dr.X = Convert.ToDouble(line[4]); - dr.XErr = Convert.ToDouble(line[5]); - dr.FWHM = Convert.ToDouble(line[6]); - dr.Intensity = Convert.ToDouble(line[7]); - dr.R = Convert.ToDouble(line[8]); - if (n < TargetCrystal.Plane.Count) + TargetCrystal.Plane[n].IsFittingChecked = line[0] == "True"; + TargetCrystal.Plane[n].peakFunction.Option = line[3] switch { - TargetCrystal.Plane[n].IsFittingChecked = line[0] == "True"; - TargetCrystal.Plane[n].peakFunction.Option = line[3] switch - { - "Simple" => PeakFunctionForm.Simple, - "Sym PV" => PeakFunctionForm.PseudoVoigt, - "Sym Pea" => PeakFunctionForm.Peason, - "Spl PV" => PeakFunctionForm.SplitPseudoVoigt, - "Spl Pea" => PeakFunctionForm.SplitPseudoVoigt, - _ => PeakFunctionForm.PseudoVoigt - }; - - } + "Simple" => PeakFunctionForm.Simple, + "Sym PV" => PeakFunctionForm.PseudoVoigt, + "Sym Pea" => PeakFunctionForm.Peason, + "Spl PV" => PeakFunctionForm.SplitPseudoVoigt, + "Spl Pea" => PeakFunctionForm.SplitPseudoVoigt, + _ => PeakFunctionForm.PseudoVoigt + }; + } - n++; } + n++; } } } @@ -253,12 +251,14 @@ public void Fitting() p.XObs = 0; p.observedIntensity = 0; p.DecompositionGroup = -1; - p.peakFunction = new PeakFunction(); - p.peakFunction.X = p.XCalc; - p.peakFunction.range = p.SerchRange * SerchRangeFactor; ; - p.peakFunction.Hk = p.FWHM * SerchRangeFactor; - p.peakFunction.Option = p.SerchOption; - p.peakFunction.Color = Color.FromArgb(c.Argb); + p.peakFunction = new PeakFunction + { + X = p.XCalc, + range = p.SerchRange * SerchRangeFactor, + Hk = p.FWHM * SerchRangeFactor, + Option = p.SerchOption, + Color = Color.FromArgb(c.Argb) + }; if (p.SerchOption == PeakFunctionForm.Simple) //Simple[ǂ̂Ƃ͂ŏ { @@ -804,7 +804,7 @@ public void FittingDiffraction() case "triclinic": #region triclinic - var constants = CrystalGeometry.GetErrorTriclinic(p.ToArray()); + var constants = CrystalGeometry.GetErrorTriclinic([.. p]); if (constants.Length != 0) { a = constants[0]; diff --git a/PDIndexer/FormMain.cs b/PDIndexer/FormMain.cs index 06fe510..cf0e990 100644 --- a/PDIndexer/FormMain.cs +++ b/PDIndexer/FormMain.cs @@ -22,8 +22,6 @@ using System.Net; using System.Threading.Tasks; using MemoryPack; -using System.CodeDom; - #endregion namespace PDIndexer; @@ -67,7 +65,7 @@ public enum FileType #region プロパティ - public FileProperty[] FileProperties { get; set; } = new FileProperty[Enum.GetValues(typeof(FileType)).Length]; + public FormCrystal formCrystal; public FormEOS formEOS; @@ -82,6 +80,9 @@ public enum FileType Crystallography.Controls.CommonDialog initialDialog; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public FileProperty[] FileProperties { get; set; } = new FileProperty[Enum.GetValues(typeof(FileType)).Length]; + public bool BackGroundPointSelectMode { get; set; } = false; public int[] SelectedMaskingBoundaryIndex { set; get; } = [-1, -1]; @@ -475,6 +476,8 @@ void watcher_Created(object sender, System.IO.FileSystemEventArgs e) #region コンストラクタ、ロード、クローズ public FormMain() { + var x = "10,25/5,5/9".ToDouble(); + //カルチャーを決めるため、レジストリ読込 if (!DesignMode) { @@ -2712,12 +2715,13 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool { var str1 = str[1]; var str3 = str[3]; - if (Miscellaneous.IsDecimalPointComma) - { - str1 = str1.Replace('.', ','); - str3 = str3.Replace('.', ','); - } - diffProf.SourceProfile.Pt.Add(new PointD(Convert.ToDouble(str1), Convert.ToDouble(str3))); + //if (Miscellaneous.IsDecimalPointComma) + //{ + // str1 = str1.Replace('.', ','); + // str3 = str3.Replace('.', ','); + //} + //diffProf.SourceProfile.Pt.Add(new PointD(Convert.ToDouble(str1), Convert.ToDouble(str3))); + diffProf.SourceProfile.Pt.Add(new PointD(str1.ToDouble(), str3.ToDouble())); } else break; @@ -2807,12 +2811,15 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool //TakeoffAngle formDataConverter.TakeoffAngleText = strList[^4].Split(',', true)[0]; - formDataConverter.ExposureTime = Convert.ToDouble(strList[^5].Split(' ', true)[1]); + //formDataConverter.ExposureTime = Convert.ToDouble(strList[^5].Split(' ', true)[1]); + formDataConverter.ExposureTime = strList[^5].Split(' ', true)[1].ToDouble(); formDataConverter.EDXDetectorNumber = 1; double[][] egc = [[0.0, 0.0, 0.0]]; - egc[0][0] = Convert.ToDouble(strList[^1].Split(',', true)[0]); - egc[0][1] = Convert.ToDouble(strList[^1].Split(',', true)[1]); + //egc[0][0] = Convert.ToDouble(strList[^1].Split(',', true)[0]); + //egc[0][1] = Convert.ToDouble(strList[^1].Split(',', true)[1]); + egc[0][0] = strList[^1].Split(',', true)[0].ToDouble(); + egc[0][1] = strList[^1].Split(',', true)[1].ToDouble(); formDataConverter.EGC = egc; if (!showFormDataConverter || formDataConverter.ShowDialog() == DialogResult.OK) @@ -2827,7 +2834,8 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool double x = (formDataConverter.EGC[0][0] + formDataConverter.EGC[0][1] * n) * 1000; n++; if (!formDataConverter.LowEnergyCutoff || x > formDataConverter.LowEnergyCutoffValue / 1000) - diffProf.SourceProfile.Pt.Add(new PointD(x, Convert.ToDouble(str[j]))); + //diffProf.SourceProfile.Pt.Add(new PointD(x, Convert.ToDouble(str[j]))); + diffProf.SourceProfile.Pt.Add(new PointD(x, str[j].ToDouble())); } } } @@ -2872,8 +2880,10 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool for (int j = i + 2; j < i + 2 + length; j++) { - var x = Convert.ToDouble(strList[j].Split(',', true)[1]) * 1000; - var y = Convert.ToDouble(strList[j].Split(',', true)[2]); + //var x = Convert.ToDouble(strList[j].Split(',', true)[1]) * 1000; + //var y = Convert.ToDouble(strList[j].Split(',', true)[2]); + var x = strList[j].Split(',', true)[1].ToDouble() * 1000; + var y = strList[j].Split(',', true)[2].ToDouble(); if (!formDataConverter.LowEnergyCutoff || x > formDataConverter.LowEnergyCutoffValue / 1000) diffProf.SourceProfile.Pt.Add(new PointD(x, y)); } @@ -2905,9 +2915,12 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool for (int j = i + 1; j < strList.Count - 1; j++) { var str = strList[j].Split(" ", true); - var x = Convert.ToDouble(str[0]); - var y = Convert.ToDouble(str[1]); - var err = Convert.ToDouble(str[2]); + //var x = Convert.ToDouble(str[0]); + //var y = Convert.ToDouble(str[1]); + //var err = Convert.ToDouble(str[2]); + var x = str[0].ToDouble(); + var y = str[1].ToDouble(); + var err = str[2].ToDouble(); diffProf.SourceProfile.Pt.Add(new PointD(x, y)); diffProf.SourceProfile.Err.Add(new PointD(x, err)); } @@ -2939,8 +2952,11 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool #region xy形式 else if (ext == "xy" && strList[0] == "# == pyFAI calibration ==") { - if (double.TryParse(strList[15].Split(" ")[2], out var wave)) + //if (double.TryParse(strList[15].Split(" ")[2], out var wave)) + try { + double wave = strList[15].Split(" ")[2].ToDouble(); + formDataConverter.SetProperty(FileProperties[(int)FileType.XY]); formDataConverter.WaveSource = WaveSource.Xray; @@ -2955,12 +2971,13 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool var str = strList[i].Split(' ', true); if (str.Length == 2) { - if (Miscellaneous.IsDecimalPointComma) - { - str[0] = str[0].Replace('.', ','); - str[1] = str[1].Replace('.', ','); - } - diffProf.SourceProfile.Pt.Add(new PointD(Convert.ToDouble(str[0]), Convert.ToDouble(str[1]))); + //if (Miscellaneous.IsDecimalPointComma) + //{ + // str[0] = str[0].Replace('.', ','); + // str[1] = str[1].Replace('.', ','); + //} + + diffProf.SourceProfile.Pt.Add(new PointD(str[0].ToDouble(), str[1].ToDouble())); } else break; @@ -2968,6 +2985,7 @@ public void readProfile(string fileName, bool showFormDataConverter = true, bool } else return; } + catch { return; } } #endregion diff --git a/PDIndexer/PDIndexer.csproj b/PDIndexer/PDIndexer.csproj index e6ae8a4..7c5ae68 100644 --- a/PDIndexer/PDIndexer.csproj +++ b/PDIndexer/PDIndexer.csproj @@ -4,8 +4,8 @@ WinExe net9.0-windows10.0.26100.0 true - 2024.11.13.0422 - 2024.11.13.0422 + 2024.12.2.0541 + 2024.12.2.0541 App.ico 7.0 PerMonitorV2 diff --git a/PDIndexer/UserControlIonicRadius.cs b/PDIndexer/UserControlIonicRadius.cs index 5797659..5f8e679 100644 --- a/PDIndexer/UserControlIonicRadius.cs +++ b/PDIndexer/UserControlIonicRadius.cs @@ -1,52 +1,33 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace PDIndexer +using System.Windows.Forms; + +namespace PDIndexer; + +public partial class UserControlIonicRadius : UserControl { - public partial class UserControlIonicRadius : UserControl + public UserControlIonicRadius() { - public UserControlIonicRadius() - { - InitializeComponent(); - } + InitializeComponent(); + } - public double Radius + public double Radius + { + set { - set - { - if ((decimal)value * 10 > numericUpDownRadius.Maximum) - numericUpDownRadius.Value = numericUpDownRadius.Maximum; - else if ((decimal)value * 10 < numericUpDownRadius.Minimum) - numericUpDownRadius.Value = numericUpDownRadius.Minimum; - else - numericUpDownRadius.Value = (decimal)value * 10; - } - get - { - return (double)numericUpDownRadius.Value /10; - } + if ((decimal)value * 10 > numericUpDownRadius.Maximum) + numericUpDownRadius.Value = numericUpDownRadius.Maximum; + else if ((decimal)value * 10 < numericUpDownRadius.Minimum) + numericUpDownRadius.Value = numericUpDownRadius.Minimum; + else + numericUpDownRadius.Value = (decimal)value * 10; } + get => (double)numericUpDownRadius.Value / 10; + } - public string Element - { - set { labelElement.Text = value; } - get { return labelElement.Text; } - } + public string Element { set => labelElement.Text = value; get => labelElement.Text; } + + private int atomicNumber = 0; + public int AtomicNumber { set => atomicNumber = value; get => atomicNumber; } - private int atomicNumber=0; - public int AtomicNumber - { - set { atomicNumber = value; } - get { return atomicNumber; } - } - - } }