#include "カスタム駆動関数.h"
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Diagnostics;
ref class GlobalSpriteProcess {
private:
static Dictionary<String^, Process^>^ hashSpriteProcess = gcnew Dictionary<String^, Process^>();
static HWND hTenshouWnd;
public:
// プロセスの開始
static Process^ StartProcess(String^ strProcessHashKey, String^ strImageFileName, int timeFadeIn, int timeFadeKeep, int timeFadeOut) {
if (!hTenshouWnd) {
hTenshouWnd = FindWindow("Tenshouki95", NULL);
}
UpdateProcessList();
try {
ProcessStartInfo^ psi = gcnew ProcessStartInfo();
psi->FileName = "SpriteWPFTS95.exe";
psi->Arguments = String::Format("{0} {1} {2} {3} {4} {5}", (Int64)hTenshouWnd, strImageFileName, "png", timeFadeIn, timeFadeKeep, timeFadeOut);
psi->UseShellExecute = false;
auto p = gcnew Process;
hashSpriteProcess[strProcessHashKey] = p;
p->Start(psi);
return p;
}
catch (Exception^) {
}
return nullptr;
}
// プロセスを明示的に終了
static void CloseProcess(String^ strProcessHashKey) {
try {
auto p = hashSpriteProcess[strProcessHashKey];
if (p != nullptr && !p->HasExited) {
p->Close();
}
hashSpriteProcess[strProcessHashKey] = nullptr;
}
catch (Exception^ e) {
}
}
private:
static void UpdateProcessList() {
for each (auto kvp in hashSpriteProcess) {
try {
auto p = kvp.Value;
// もし該当プロセスがすでに実行を終了してるならば、辞書からは削除しておく。
if (p->HasExited) {
hashSpriteProcess->Remove(kvp.Key);
}
}
catch (Exception^) {
}
}
}
};
カスタム::カスタム() {
// 各メソッドの具体的な解説は「http://天翔記.jp/?page=nobu_mod_the_snmod_methodref_index」にて記述されています。
}
// ・・・