Commit 6f0d3cbd authored by mercury233's avatar mercury233

update KF_replay support full file path

parent ae99e3b5
...@@ -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)
{ {
try string filename = name;
if (!File.Exists(filename))
{ {
if (File.Exists("replay/" + name + ".yrp3d")) 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
{
if (yrp3d)
{ {
if (god) if (god)
{ {
...@@ -351,21 +362,18 @@ public class selectReplay : WindowServantSP ...@@ -351,21 +362,18 @@ 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")
if (File.Exists("replay/" + name))
{ {
RMSshow_none(InterString.Get("您正在观看旧版的录像(上帝视角),不保证稳定性。")); RMSshow_none(InterString.Get("您正在观看旧版的录像(上帝视角),不保证稳定性。"));
if (precy != null) if (precy != null)
...@@ -373,11 +381,10 @@ public class selectReplay : WindowServantSP ...@@ -373,11 +381,10 @@ public class selectReplay : WindowServantSP
precy = new PrecyOcg(); precy = new PrecyOcg();
var collections = var collections =
TcpHelper.getPackages( TcpHelper.getPackages(
precy.ygopro.getYRP3dBuffer(getYRP(File.ReadAllBytes("replay/" + name)))); precy.ygopro.getYRP3dBuffer(getYRP(File.ReadAllBytes(filename))));
pushCollection(collections); pushCollection(collections);
} }
} }
}
catch (Exception) catch (Exception)
{ {
RMSshow_none(InterString.Get("录像没有录制完整。")); RMSshow_none(InterString.Get("录像没有录制完整。"));
......
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