diff --git a/comeconv/ConvTwitch.cs b/comeconv/ConvTwitch.cs index 8f6488f..fcc0760 100644 --- a/comeconv/ConvTwitch.cs +++ b/comeconv/ConvTwitch.cs @@ -135,6 +135,7 @@ private string ConvChatData(IDictionary data, Props props) } } + private static Regex _RegLocations = new Regex("^(\\d+)\\-(\\d+)", RegexOptions.Compiled); public bool TwitchConvertChatDownloader(string sfile, string dfile) { var enc = new System.Text.UTF8Encoding(false); @@ -207,7 +208,18 @@ public bool TwitchConvertChatDownloader(string sfile, string dfile) { foreach (var emt in jo["emotes"]) { - message = message.Replace(emt["name"].ToString(), ""); + string name = emt["name"].ToString(); + if (string.IsNullOrEmpty(name)) + { + var msg = jo["message"].ToString(); + var loc = emt["locations"].ToString(); + int start = Int32.Parse(_RegLocations.Match(loc).Groups[1].ToString()); + int end = Int32.Parse(_RegLocations.Match(loc).Groups[2].ToString()); + System.Text.Encoding hEncoding = System.Text.Encoding.GetEncoding("UTF-8"); + byte[] btBytes = hEncoding.GetBytes(msg); + name = hEncoding.GetString(btBytes, start, end-start+1); + } + message = message.Replace(name, ""); } } } diff --git a/comeconv/Prop/Version.cs b/comeconv/Prop/Version.cs index 2e0a582..9403f78 100644 --- a/comeconv/Prop/Version.cs +++ b/comeconv/Prop/Version.cs @@ -4,8 +4,8 @@ namespace comeconv.Prop { public class Ver { - public static readonly string Version = "0.0.1.19"; - public static readonly string VerDate = "2022/12/10"; + public static readonly string Version = "0.0.1.20"; + public static readonly string VerDate = "2023/01/19"; public static string GetFullVersion() { diff --git a/comeconv/Util/Utils.cs b/comeconv/Util/Utils.cs index 3f0e657..b1413c1 100644 --- a/comeconv/Util/Utils.cs +++ b/comeconv/Util/Utils.cs @@ -140,7 +140,7 @@ public static int IsTwitchFileType(string filename) result = 0; else if (RgxCDJson.IsMatch(str)) result = 1; - else if (str.StartsWith("{\"streamer\":{\"name\":")) + else if (str.StartsWith("{\"streamer\":{\"name\":")|| str.StartsWith("{\"FileInfo\":{\"Version\":")) result = 5; else result = 10;