Resuming WIP

This commit is contained in:
N00MKRAD
2021-02-02 21:48:18 +01:00
parent 630b22dd2c
commit 66a05a4bdb
6 changed files with 72 additions and 14 deletions

View File

@@ -8,13 +8,37 @@ namespace Flowframes.Data
{
public struct ResumeState
{
bool autoEncode;
int lastInterpolatedInputFrame;
public bool autoEncode;
public int interpolatedInputFrames;
public ResumeState (bool autoEncArg, int lastInterpInFrameArg)
{
autoEncode = autoEncArg;
lastInterpolatedInputFrame = lastInterpInFrameArg;
interpolatedInputFrames = lastInterpInFrameArg;
}
public ResumeState(string serializedData)
{
autoEncode = false;
interpolatedInputFrames = 0;
Dictionary<string, string> entries = new Dictionary<string, string>();
foreach (string line in serializedData.SplitIntoLines())
{
if (line.Length < 3) continue;
string[] keyValuePair = line.Split('|');
entries.Add(keyValuePair[0], keyValuePair[1]);
}
foreach (KeyValuePair<string, string> entry in entries)
{
switch (entry.Key)
{
case "AUTOENC": autoEncode = bool.Parse(entry.Value); break;
case "INTERPOLATEDINPUTFRAMES": interpolatedInputFrames = entry.Value.GetInt(); break;
}
}
}
public override string ToString ()
@@ -23,7 +47,7 @@ namespace Flowframes.Data
if (!autoEncode)
{
s += $"LASTINPUTFRAME|{lastInterpolatedInputFrame}";
s += $"INTERPOLATEDINPUTFRAMES|{interpolatedInputFrames}";
}
return s;