Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto committed Nov 1, 2024
1 parent 33aad92 commit b68cb86
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageReference Include="MemoryPack" Version="1.21.3" />
<PackageReference Include="OpenTK" Version="3.3.3" />
<PackageReference Include="SimdLinq" Version="1.3.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.7" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.8" />
</ItemGroup>

<ItemGroup>
Expand Down
48 changes: 48 additions & 0 deletions Crystallography/Miscellaneous.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
Expand Down Expand Up @@ -108,6 +109,53 @@ public static bool IsDecimalPointComma

public static (int Division, int Modulus) DivMod(int n, int m) => (n / m, n % m);

/// <summary>
/// ファイルが使用中かどうかをチェック
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static bool isFileExistsAndLocked(string path)
{
if (File.Exists(path))
{
FileStream stream = null;

try
{
stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
}
catch (DirectoryNotFoundException e)
{
return false;
}
catch (FileNotFoundException e)
{
return false;
}
catch (IOException e)
{
if (File.Exists(path))
{
return true;
}
}
catch (Exception e)
{
return false;
}
finally
{
if (stream != null)
{
stream.Close();
}
}

return false;
}

return false;
}
}


Expand Down
2 changes: 1 addition & 1 deletion ReciPro/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal static class Version

public const string History =
"History" +
"\r\n ver4.893(2024/11/01) Fixed bugs on the 'Diffraction Simulator' and 'HRTEM/STEM simulator' (thanks to lukmuk-san and Nakamura-san!)." +
"\r\n ver4.894(2024/11/01) Fixed bugs on the 'Diffraction Simulator' and 'HRTEM/STEM simulator' (thanks to lukmuk-san and Nakamura-san!)." +
"\r\n ver4.892(2024/10/04) Added several 'Macro' functions." +
"\r\n ver4.891(2024/09/06) Added the function to simulate electron trajectories based on the Monte Carlo method." +
"\r\n ver4.890(2024/08/10) Improved 'Macro' functions." +
Expand Down

0 comments on commit b68cb86

Please sign in to comment.