Skip to content

Commit

Permalink
Merge pull request #18 from hiroxpepe/develop
Browse files Browse the repository at this point in the history
refactor: #5 keeping codes clean.
  • Loading branch information
hiroxpepe authored Feb 12, 2022
2 parents 95225f4 + 5e52a17 commit 2f8f204
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 568 deletions.
6 changes: 0 additions & 6 deletions MetaseqPoseToBpy/App.config

This file was deleted.

48 changes: 35 additions & 13 deletions MetaseqPoseToBpy/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,74 @@

namespace MetaseqPoseToBpy {
/// <summary>
/// @author h.adachi
/// The main form class.
/// </summary>
/// <author>Hiroyuki Adachi</author>
public partial class FormMain : Form {

///////////////////////////////////////////////////////////////////////////////////////////////
// Fields

Context context;
/// <summary>
/// The context object to processing the xml files.
/// </summary>
Context _context;

///////////////////////////////////////////////////////////////////////////////////////////////
// Constructor

/// <summary>
/// Default constructor.
/// </summary>
public FormMain() {
context = new Context();
_context = new();

InitializeComponent();
}

///////////////////////////////////////////////////////////////////////////////////////////////
// Event handler

/// <summary>
/// An event handler where files are dragged and dropped.
/// </summary>
/// <param name="sender">The event publisher is provided.</param>
/// <param name="e">The event parameters are provided.</param>
private async void buttonFileDrop_DragDrop(object sender, DragEventArgs e) {
if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy
if ((e.AllowedEffect & DragDropEffects.Copy) is DragDropEffects.Copy
&& e.Data.GetDataPresent(DataFormats.FileDrop, true)) {
var _data = e.Data.GetData(DataFormats.FileDrop, true) as string[];
if (_data != null) {
foreach (string _filePath in _data) {
await Task.Run(() => context.Read(_filePath));
var data = e.Data.GetData(DataFormats.FileDrop, true) as string[];
if (data is not null) {
foreach (string _filePath in data) {
await Task.Run(() => _context.Read(_filePath));
}
await Task.Run(() => context.Write());
await Task.Run(() => _context.Write());
}
}
}

/// <summary>
/// An event handler where files are dragged and entered.
/// </summary>
/// <param name="sender">The event publisher is provided.</param>
/// <param name="e">The event parameters are provided.</param>
private void buttonFileDrop_DragEnter(object sender, DragEventArgs e) {
if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy
&& e.Data.GetDataPresent(DataFormats.FileDrop)) { // FIXME: バリデーター
if ((e.AllowedEffect & DragDropEffects.Copy) is DragDropEffects.Copy
&& e.Data.GetDataPresent(DataFormats.FileDrop)) { // FIXME: to add a validator.
e.Effect = DragDropEffects.Copy;
} else {
e.Effect = DragDropEffects.None;
}
}

/// <summary>
/// An event handler where files are dragged and overd.
/// </summary>
/// <param name="sender">The event publisher is provided.</param>
/// <param name="e">The event parameters are provided.</param>
private void buttonFileDrop_DragOver(object sender, DragEventArgs e) {
if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy
&& e.Data.GetDataPresent(DataFormats.FileDrop)) { // FIXME: バリデーター
if ((e.AllowedEffect & DragDropEffects.Copy) is DragDropEffects.Copy
&& e.Data.GetDataPresent(DataFormats.FileDrop)) { // FIXME: to add a validator.
e.Effect = DragDropEffects.Copy;
} else {
e.Effect = DragDropEffects.None;
Expand Down
91 changes: 7 additions & 84 deletions MetaseqPoseToBpy/MetaseqPoseToBpy.csproj
Original file line number Diff line number Diff line change
@@ -1,90 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BA446163-509F-4B30-9F0D-201C2A293EC4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>MetaseqPoseToBpy</RootNamespace>
<AssemblyName>MetaseqPoseToBpy</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormMain.Designer.cs">
<DependentUpon>FormMain.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MetaseqPoseToBpyLib\MetaseqPoseToBpyLib.csproj">
<Project>{c723947d-4a99-4d31-a3cf-cf2e618cb1ad}</Project>
<Name>MetaseqPoseToBpyLib</Name>
</ProjectReference>
<ProjectReference Include="..\MetaseqPoseToBpyLib\MetaseqPoseToBpyLib.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

</Project>
5 changes: 3 additions & 2 deletions MetaseqPoseToBpy/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -7,10 +7,11 @@
namespace MetaseqPoseToBpy {
static class Program {
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
Expand Down
36 changes: 0 additions & 36 deletions MetaseqPoseToBpy/Properties/AssemblyInfo.cs

This file was deleted.

63 changes: 0 additions & 63 deletions MetaseqPoseToBpy/Properties/Resources.Designer.cs

This file was deleted.

Loading

0 comments on commit 2f8f204

Please # to comment.