Skip to content

Commit

Permalink
Merge pull request #416 from wbonbon/master
Browse files Browse the repository at this point in the history
version up
  • Loading branch information
wbonbon authored Aug 18, 2024
2 parents d0a4b7f + 12f2a13 commit 3b2850b
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 9 deletions.
2 changes: 1 addition & 1 deletion source/@MasterVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.3.8
v10.3.9
5 changes: 5 additions & 0 deletions source/ACT.Hojoring.Common/ACT.Hojoring.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<None Include="split.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
Expand Down
4 changes: 2 additions & 2 deletions source/ACT.Hojoring.Common/Version.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;

[assembly: AssemblyVersion("10.3.0.8")]
[assembly: AssemblyFileVersion("10.3.0.8")]
[assembly: AssemblyVersion("10.3.0.9")]
[assembly: AssemblyFileVersion("10.3.0.9")]
63 changes: 63 additions & 0 deletions source/ACT.Hojoring.Common/split.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
param (
[string]$inputFile
)

try {
# 入力ファイルの内容を読み込み
$content = Get-Content -Path $inputFile

# フラグの初期化
$copying = $false
$outputFile = ""

# 行ごとに処理
foreach ($line in $content) {
if ($line -match "00:0039::戦闘開始!") {
$copying = $true

$fileName = $inputFile.Substring(10, 10) + "_" + $line.Substring(1, 2) + $line.Substring(4, 2) + $line.Substring(7, 2) + ".log"
$outputFile = ".\" + $fileName

Write-Host $outputFile
Write-Host $line

if (Test-Path -Path $outputFile) {
Clear-Content -Path $outputFile
}
}
if ($copying -and -not ($line -match "\[DEBUG\]$")) {
Add-Content -Path $outputFile -Value $line
}
if ($copying -and $line -match "00:0038::Hojoring>WIPEOUT") {
$copying = $false
$newFileName = $outputFile.Replace(".log", "_false_.log")
Rename-Item -Path $outputFile -NewName $newFileName
}
if ($copying -and $line -match "ブラックキャットを倒した。") {
$copying = $false
$newFileName = $outputFile.Replace(".log", "_true_.log")
Rename-Item -Path $outputFile -NewName $newFileName
}
if ($copying -and $line -match "ハニー・B・ラブリーを倒した。") {
$copying = $false
$newFileName = $outputFile.Replace(".log", "_true_.log")
Rename-Item -Path $outputFile -NewName $newFileName
}
if ($copying -and $line -match "ブルートボンバーを倒した。") {
$copying = $false
$newFileName = $outputFile.Replace(".log", "_true_.log")
Rename-Item -Path $outputFile -NewName $newFileName
}
if ($copying -and $line -match "ウィケッドサンダーを倒した。") {
$copying = $false
$newFileName = $outputFile.Replace(".log", "_true_.log")
Rename-Item -Path $outputFile -NewName $newFileName
}
}
} catch {
Write-Error "エラーが発生しました: $_"
Pause
exit 1
}

Pause
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Button Content="Open" Command="{Binding OpenTimelineFolderCommand, Mode=OneWay}" />
<Button Margin="10 0 0 0" Content="Reload" Command="{Binding ReloadTimelineFolderCommand, Mode=OneWay}" />
<Button Margin="10 0 0 0" Content="Split" Command="{Binding SplitParsedLogCommand, Mode=OneWay}" />
</StackPanel>
<Button
Grid.Column="1"
Expand Down Expand Up @@ -345,6 +346,13 @@
Padding="5 0 5 0"
Content="{DynamicResource Timeline_TestTimeline}"
Command="{Binding TestTimelineCommand, Mode=OneWay}" />
<Button
HorizontalAlignment="Left"
Margin="0 10 0 0"
Padding="5 0 5 0"
Content="{DynamicResource Timeline_TestTimeline2}"
Command="{Binding TestTimelineCommand2, Mode=OneWay}" />

</StackPanel>
</Grid>
</Border>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -209,6 +212,56 @@ private async void LoadTimelineModels()
this.reloadTimelineFolderCommand ?? (this.reloadTimelineFolderCommand = new DelegateCommand(() =>
this.LoadTimelineModels()));

private static readonly string SplitScriptUrl = "https://raw.githubusercontent.com/anoyetta/ACT.Hojoring/master/source/ACT.Hojoring.Common/resources/split.ps1";

private ICommand splitParsedLogCommand;
public ICommand SplitParsedLogCommand =>
this.splitParsedLogCommand ?? (this.splitParsedLogCommand = new DelegateCommand(async () =>
{
var result = this.openFileDialog.ShowDialog(ActGlobals.oFormActMain);
if (result != System.Windows.Forms.DialogResult.OK)
{
return;
}
await AsyncSplitParsedLog(openFileDialog.FileName);
}));

private async Task AsyncSplitParsedLog(string parsedlog)
{
var cd = DirectoryHelper.GetPluginRootDirectoryDelegate?.Invoke();
if (string.IsNullOrEmpty(cd))
{
cd = Path.Combine(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
"..");

cd = Path.GetFullPath(cd);
}

var script = Path.Combine(cd, "split.ps1");

using (var web = new WebClient())
{
var temp = Path.GetTempFileName();
File.Delete(temp);

await web.DownloadFileTaskAsync(
SplitScriptUrl,
temp);

Thread.Sleep(10);
File.Copy(temp, script, true);
}

if (File.Exists(script))
{
var args = $"-NoLogo -NoProfile -ExecutionPolicy Unrestricted -File \"{script}\" {parsedlog}";

Process.Start(EnvironmentHelper.Pwsh, args);
}
}


private ICommand getMoreSampleCommand;

public ICommand GetMoreSampleCommand =>
Expand Down Expand Up @@ -253,12 +306,18 @@ private async void LoadTimelineModels()
}));

private ICommand testTimelineCommand;
private ICommand testTimelineCommand2;

public ICommand TestTimelineCommand =>
this.testTimelineCommand ?? (this.testTimelineCommand = new DelegateCommand(() =>
{
this.TestTimeline();
}));
public ICommand TestTimelineCommand2 =>
this.testTimelineCommand2 ?? (this.testTimelineCommand2 = new DelegateCommand(() =>
{
this.TestTimeline2();
}));

private System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog()
{
Expand All @@ -280,10 +339,23 @@ private void TestTimeline()
return;
}

var view = new TimelineTesterView(this.openFileDialog.FileName);
var view = new TimelineTesterView(this.openFileDialog.FileName, false);
view.Show();
}
/// <summary>
/// タイムラインをテストする
/// </summary>
private void TestTimeline2()
{
var result = this.openFileDialog.ShowDialog(ActGlobals.oFormActMain);
if (result != System.Windows.Forms.DialogResult.OK)
{
return;
}

var view = new TimelineTesterView(this.openFileDialog.FileName, true);
view.Show();
}
#endregion Commands 左側ペイン

#region Commands 右側ペイン
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public partial class TimelineTesterView :
INotifyPropertyChanged
{
public TimelineTesterView(
string logFile)
string logFile, bool isReal = false)
{
this.LogFile = logFile;

Expand All @@ -41,7 +41,10 @@ public TimelineTesterView(
#endif

// Simulationモードにする
TimelineManager.Instance.InSimulation = true;
if (!isReal)
{
TimelineManager.Instance.InSimulation = true;
}

// ウィンドウのスタート位置を決める
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
Expand All @@ -51,7 +54,10 @@ public TimelineTesterView(
this.Closed += async (x, y) =>
{
// Simulationモードを解除する
TimelineManager.Instance.InSimulation = false;
if (!isReal)
{
TimelineManager.Instance.InSimulation = false;
}

await Dispatcher.InvokeAsync(() => TimelineController.CurrentController?.Load());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ This trigger is enabled when "HEALER1" contains "me (player)".</system:String>
<system:String x:Key="Timeline_Styles">Activity style</system:String>
<system:String x:Key="Timeline_StyleName">Style name</system:String>
<system:String x:Key="Timeline_CircleStyle">Circle style</system:String>
<system:String x:Key="Timeline_TestTimeline">Test timeline</system:String>
<system:String x:Key="Timeline_TestTimeline">Test timeline by Autolog</system:String>
<system:String x:Key="Timeline_TestTimeline2">Test timeline by ParsedLog</system:String>
<system:String x:Key="Timeline_TimelineTester">Timeline Tester</system:String>
<system:String x:Key="Timeline_ShowActivitiesCount">Number of activities to show</system:String>
<system:String x:Key="Timeline_Header">Header</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ HEALER1 に me(自分)が含まれる場合にこのトリガが有効にな
<system:String x:Key="Timeline_Styles">アクティビティの表示スタイル</system:String>
<system:String x:Key="Timeline_StyleName">スタイルの名前</system:String>
<system:String x:Key="Timeline_CircleStyle">サークルスタイル</system:String>
<system:String x:Key="Timeline_TestTimeline">過去の戦闘ログを使用して スペスペたいむ™ をシミュレーションする</system:String>
<system:String x:Key="Timeline_TestTimeline">Autologで スペスペたいむ™ をシミュレーションする</system:String>
<system:String x:Key="Timeline_TestTimeline2">ParsedLogで スペスペたいむ™ をシミュレーションする</system:String>
<system:String x:Key="Timeline_TimelineTester">スペスペたいむ™ シミュレータ</system:String>
<system:String x:Key="Timeline_ShowActivitiesCount">表示するアクティビティの数</system:String>
<system:String x:Key="Timeline_Header">ヘッダ</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<system:String x:Key="Timeline_CircleStyle">원형 스타일</system:String>
<system:String x:Key="Timeline_TestTimeline">타임라인 테스트</system:String>
<system:String x:Key="Timeline_TimelineTester">타임라인 테스터</system:String>
<system:String x:Key="Timeline_TestTimeline2">Test timeline by ParsedLog</system:String>
<system:String x:Key="Timeline_ShowActivitiesCount">표시할 액티비티 수</system:String>
<system:String x:Key="Timeline_Header">헤더</system:String>
<system:String x:Key="Timeline_ShowHeader">헤더 표시</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<system:String x:Key="Timeline_CircleStyle">圆形样式</system:String>
<system:String x:Key="Timeline_TestTimeline">测试时间轴</system:String>
<system:String x:Key="Timeline_TimelineTester">时间轴测试器</system:String>
<system:String x:Key="Timeline_TestTimeline2">Test timeline by ParsedLog</system:String>
<system:String x:Key="Timeline_ShowActivitiesCount">显示数量</system:String>
<system:String x:Key="Timeline_Header">标题</system:String>
<system:String x:Key="Timeline_ShowHeader">显示标题</system:String>
Expand Down

0 comments on commit 3b2850b

Please sign in to comment.