Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Apr 6, 2024
1 parent 66d0ff8 commit 949c181
Show file tree
Hide file tree
Showing 9 changed files with 1,435 additions and 1,150 deletions.
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.3.17.1417</AssemblyVersion>
<FileVersion>2024.3.17.1417</FileVersion>
<AssemblyVersion>2024.4.6.0155</AssemblyVersion>
<FileVersion>2024.4.6.0155</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.OpenGL/Crystallography.OpenGL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.3.17.1417</AssemblyVersion>
<FileVersion>2024.3.17.1417</FileVersion>
<AssemblyVersion>2024.4.6.0155</AssemblyVersion>
<FileVersion>2024.4.6.0155</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.3.17.1417</AssemblyVersion>
<FileVersion>2024.3.17.1417</FileVersion>
<AssemblyVersion>2024.4.6.0155</AssemblyVersion>
<FileVersion>2024.4.6.0155</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

Expand All @@ -25,7 +25,7 @@
<ItemGroup>
<PackageReference Include="HDF.PInvoke.1.10" Version="1.10.612" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="MemoryPack" Version="1.20.5" />
<PackageReference Include="MemoryPack" Version="1.21.0" />
<PackageReference Include="OpenTK" Version="3.3.3" />
<PackageReference Include="SimdLinq" Version="1.3.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.10" />
Expand Down
51 changes: 25 additions & 26 deletions Crystallography/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,34 @@
using System.Threading;
using System.Windows.Forms;

namespace Crystallography
{
public enum Languages { English, Japanese };
namespace Crystallography;

public enum Languages { English, Japanese };

public static class Language
public static class Language
{
public static void Change(object obj, ComponentResourceManager resources = null)
{
public static void Change(object obj, ComponentResourceManager resources = null)
if (obj is Form form)
{
var form_resources = new ComponentResourceManager(form.GetType());
form_resources.ApplyResources(form, "$this", Thread.CurrentThread.CurrentUICulture);
foreach (var fm in form.OwnedForms) { Change(fm, form_resources); }
foreach (var fm in form.MdiChildren) { Change(fm, form_resources); }
foreach (var c in form.Controls) { Change(c, form_resources); }
}
else if (obj is ToolStripItem item)
{
resources.ApplyResources(item, item.Name, Thread.CurrentThread.CurrentUICulture);
if (item is ToolStripDropDownItem dditem)
foreach (ToolStripItem tsi in dditem.DropDownItems) { Change(tsi, resources); }
}
else if (obj is Control ctrl)
{
if (obj is Form form)
{
var form_resources = new ComponentResourceManager(form.GetType());
form_resources.ApplyResources(form, "$this", Thread.CurrentThread.CurrentUICulture);
foreach (var fm in form.OwnedForms) { Change(fm, form_resources); }
foreach (var fm in form.MdiChildren) { Change(fm, form_resources); }
foreach (var c in form.Controls) { Change(c, form_resources); }
}
else if (obj is ToolStripItem item)
{
resources.ApplyResources(item, item.Name, Thread.CurrentThread.CurrentUICulture);
if (item is ToolStripDropDownItem dditem)
foreach (ToolStripItem tsi in dditem.DropDownItems) { Change(tsi, resources); }
}
else if (obj is Control ctrl)
{
resources.ApplyResources(ctrl, ctrl.Name, Thread.CurrentThread.CurrentUICulture);
foreach (Control c in ctrl.Controls) { Change(c, resources); }
if (ctrl is ToolStrip ts)
foreach (ToolStripItem tsi in ts.Items) { Change(tsi, resources); }
}
resources.ApplyResources(ctrl, ctrl.Name, Thread.CurrentThread.CurrentUICulture);
foreach (Control c in ctrl.Controls) { Change(c, resources); }
if (ctrl is ToolStrip ts)
foreach (ToolStripItem tsi in ts.Items) { Change(tsi, resources); }
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions ReciPro/DiffractionSimulator/FormDiffractionSimulatorCBED.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
#endregion
Expand All @@ -31,13 +32,19 @@ public int DivisionNumber
{
int count = 0;
double radius = Division / 2.0;
for (int h = 0; h < Division; h++)
if (radius > 3000)
return -1;
double radius2 = radius * radius;
Parallel.For(0, Division, h =>
{
double pY = h - radius + 0.5, pY2 = pY * pY;
for (int w = 0; w < Division; w++)
{
double pX = w - radius + 0.5, pY = h - radius + 0.5;
if (pX * pX + pY * pY <= radius * radius)
count++;
double pX = w - radius + 0.5;
if (pX * pX + pY2 <= radius2)
Interlocked.Increment(ref count);
}
});
return count;
}
}
Expand Down
Loading

0 comments on commit 949c181

Please sign in to comment.