Commit 6f0d3cbd authored by mercury233's avatar mercury233

update KF_replay support full file path

parent ae99e3b5
Pipeline #17154 passed with stages
in 69 minutes and 41 seconds
...@@ -341,9 +341,20 @@ public class selectReplay : WindowServantSP ...@@ -341,9 +341,20 @@ public class selectReplay : WindowServantSP
public void KF_replay(string name, bool god = false) public void KF_replay(string name, bool god = false)
{ {
string filename = name;
if (!File.Exists(filename))
{
if (File.Exists("replay/" + name + ".yrp3d"))
filename = "replay/" + name + ".yrp3d";
if (name.Length > 4 && name.ToLower().Substring(name.Length - 4, 4) == ".yrp")
filename = "replay/" + name;
if (!File.Exists(filename))
return;
}
bool yrp3d = filename.Length > 6 && filename.ToLower().Substring(filename.Length - 6, 6) == ".yrp3d";
try try
{ {
if (File.Exists("replay/" + name + ".yrp3d")) if (yrp3d)
{ {
if (god) if (god)
{ {
...@@ -351,31 +362,27 @@ public class selectReplay : WindowServantSP ...@@ -351,31 +362,27 @@ public class selectReplay : WindowServantSP
if (precy != null) if (precy != null)
precy.dispose(); precy.dispose();
precy = new PrecyOcg(); precy = new PrecyOcg();
var replays = getYRPbuffer("replay/" + name + ".yrp3d"); var replays = getYRPbuffer(filename);
var collections = var collections =
TcpHelper.getPackages(precy.ygopro.getYRP3dBuffer(getYRP(replays[replays.Count - 1]))); TcpHelper.getPackages(precy.ygopro.getYRP3dBuffer(getYRP(replays[replays.Count - 1])));
pushCollection(collections); pushCollection(collections);
} }
else else
{ {
var collection = TcpHelper.readPackagesInRecord("replay/" + name + ".yrp3d"); var collection = TcpHelper.readPackagesInRecord(filename);
pushCollection(collection); pushCollection(collection);
} }
} }
else else
{ {
if (name.Length > 4 && name.Substring(name.Length - 4, 4) == ".yrp") RMSshow_none(InterString.Get("您正在观看旧版的录像(上帝视角),不保证稳定性。"));
if (File.Exists("replay/" + name)) if (precy != null)
{ precy.dispose();
RMSshow_none(InterString.Get("您正在观看旧版的录像(上帝视角),不保证稳定性。")); precy = new PrecyOcg();
if (precy != null) var collections =
precy.dispose(); TcpHelper.getPackages(
precy = new PrecyOcg(); precy.ygopro.getYRP3dBuffer(getYRP(File.ReadAllBytes(filename))));
var collections = pushCollection(collections);
TcpHelper.getPackages(
precy.ygopro.getYRP3dBuffer(getYRP(File.ReadAllBytes("replay/" + name))));
pushCollection(collections);
}
} }
} }
catch (Exception) catch (Exception)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment