using System.Collections.Generic;
using System.Threading.Tasks;
public static void Main()
var model = new CommonOperationNotificationModel
NotificationType = OperationNotificationType.LockByOddsJump,
Message = "Lock Market Alert",
Data = new NotificationInfo
new NotificationArgument{ElementType = NotificationElementType.DirectTranslate, Value1 = "gaming:participant:33545"},
new NotificationArgument{ElementType = NotificationElementType.LeagueTranslate, Value1 = "800545"},
new NotificationArgument{ElementType = NotificationElementType.Template, Value1 = "{0} v {3}"},
new NotificationArgument{ElementType = NotificationElementType.DirectTranslate, Value1 = "gaming:participant:684545"},
new NotificationArgument{ElementType = NotificationElementType.MarketTypeTranslate, Value1 = "4", Value2 = "{Rank:1}"}
MessageTemplate = @$"{DateTime.Now.ToString()}
-MatchId: 3321487({{1}}, {{2}})
{{4}}, LockedAt 2H55' (odds jump exceeded lock point)"
var translateTargets = model.Data.Arguments.Where(a => a.ElementType.ToString().EndsWith("Translate"));
Translate(translateTargets);
var templateTargets = model.Data.Arguments.Where(a => a.ElementType == NotificationElementType.Template);
foreach (var t in templateTargets)
t.TranslateResult = string.Format(t.Value1, model.Data.Arguments.Select(a => (object)a.TranslateResult).ToArray());
var stringForEgClientg = string.Format(model.Data.MessageTemplate, model.Data.Arguments.Select(a => (object)a.TranslateResult).ToArray());
Console.Write(stringForEgClientg);
private static void Translate(IEnumerable<NotificationArgument> translateTargets)
foreach (var t in translateTargets)
if (t.ElementType == NotificationElementType.LeagueTranslate)
t.TranslateResult = "League" + t.Value1;
if (t.ElementType == NotificationElementType.DirectTranslate)
t.TranslateResult = "直接送displaykey去infra" + t.Value1;
if (t.ElementType == NotificationElementType.MarketTypeTranslate)
t.TranslateResult = "market" + t.Value1 + t.Value2;
public enum OperationNotificationType
public enum NotificationElementType
CancelReasonTranslate = 6
public class CommonOperationNotificationModel
public OperationNotificationType NotificationType { get; set; }
public string Message { get; set; }
public NotificationInfo Data { get; set; }
public class NotificationInfo
public NotificationArgument[] Arguments { get; set; }
public string MessageTemplate { get; set; }
public class NotificationArgument
public NotificationElementType ElementType { get; set; }
public string Value1 { get; set; }
public string Value2 { get; set; }
public string Value3 { get; set; }
public string Value4 { get; set; }
public string Value5 { get; set; }
public string TranslateResult { get; set; }