protected override FeelMeScript GetScriptContent(string content) { Match bestMatch = null; var matches = _regex.Matches(content); foreach (Match match in matches) { if (bestMatch == null || match.Value.Length > bestMatch.Value.Length) { bestMatch = match; } } if (bestMatch == null) { return(null); } FeelMeScript result = new FeelMeScript(); result.String = bestMatch.Value; result.PairSeparator = bestMatch.Groups["s2"].Captures[0].Value[0]; result.ValueSeparator = bestMatch.Groups["s1"].Captures[0].Value[0]; return(result); }
protected override FeelMeScript GetScriptContent(string content) { var file = JToken.Parse(content); var scriptNode = GetScriptNode(file); string script = scriptNode.ToString(); return(FeelMeScript.Json(script)); }
protected override FeelMeScript GetScriptContent(string content) { IniFile file = IniFile.FromString(content); string script = file["Kiiroo"]?["onyx"]?.Value ?? file["Kiiroo"]?["pearl"]?.Value; if (string.IsNullOrWhiteSpace(script)) { return(null); } return(FeelMeScript.Ini(script)); }
public override List <ScriptAction> Load(Stream stream) { using (StreamReader reader = new StreamReader(stream, new UTF8Encoding(false))) { string content = reader.ReadToEnd(); FeelMeScript script = GetScriptContent(content); string scriptContent = TrimNonNumberCharacters(script.String); var kiirooScript = KiirooScriptConverter.Parse(scriptContent, script.PairSeparator, script.ValueSeparator); var rawScript = KiirooScriptConverter.Convert(kiirooScript); var funscript = RawScriptConverter.Convert(rawScript); return(funscript.Cast <ScriptAction>().ToList()); } }
protected override FeelMeScript GetScriptContent(string inputString) { FeelMeScript bestResult = null; List <char> possibleSeparators = new List <char>(); for (int i = 0; i < inputString.Length - 1; i++) { possibleSeparators.Clear(); if (inputString[i] > '9' || inputString[i] < '0') { continue; } int j; for (j = i; j < inputString.Length; j++) { if (inputString[j] >= '0' && inputString[j] <= '9') { continue; } if (inputString[j] == '.' || char.IsWhiteSpace(inputString[j])) { continue; } if (possibleSeparators.Contains(inputString[j])) { continue; } if (possibleSeparators.Count < 2) { possibleSeparators.Add(inputString[j]); continue; } break; } if (possibleSeparators.Count != 2) { continue; } FeelMeScript result = new FeelMeScript { PairSeparator = possibleSeparators[1], ValueSeparator = possibleSeparators[0], String = inputString.Substring(i, j - i) }; i = j; if (bestResult == null || bestResult.String.Length < result.String.Length) { bestResult = result; } } return(bestResult); }