private static Payload DecodeText(BinaryReader reader) { var payload = new TextPayload(); payload.DecodeImpl(reader, reader.BaseStream.Length); return(payload); }
private static Payload ProcessText(BinaryReader reader) { var payload = new TextPayload(); payload.ProcessChunkImpl(reader, reader.BaseStream.Length); return(payload); }
public static void PrintError(this IChatClient client, string?sender = null, XivChatType?type = null, params object?[] contents) { var payload = new TextPayload(string.Join("\n", contents.Select(x => x?.ToString() ?? "null"))); client.PrintError(new SeString(payload), sender, type); }
public override int GetHashCode() { int hash = 1; if (LogName.Length != 0) { hash ^= LogName.GetHashCode(); } if (resource_ != null) { hash ^= Resource.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.ProtoPayload) { hash ^= ProtoPayload.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.TextPayload) { hash ^= TextPayload.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.JsonPayload) { hash ^= JsonPayload.GetHashCode(); } if (timestamp_ != null) { hash ^= Timestamp.GetHashCode(); } if (Severity != 0) { hash ^= Severity.GetHashCode(); } if (InsertId.Length != 0) { hash ^= InsertId.GetHashCode(); } if (httpRequest_ != null) { hash ^= HttpRequest.GetHashCode(); } hash ^= Labels.GetHashCode(); if (operation_ != null) { hash ^= Operation.GetHashCode(); } if (Trace.Length != 0) { hash ^= Trace.GetHashCode(); } if (sourceLocation_ != null) { hash ^= SourceLocation.GetHashCode(); } hash ^= (int)payloadCase_; return(hash); }
private void OnWriteClick(object sender, RoutedEventArgs e) { SerializeConfig(); NdefMessage message = new NdefMessage(); Payload payload; if (tabNdefData.SelectedIndex == (int)Tab.Text) { payload = new TextPayload("en", textTextData.Text, false); } else { payload = new UriPayload((UriPrefix)comboUriData.SelectedIndex, textUriData.Text); } message.AddRecord(new NdefRecord(payload)); controller.WriteNdefMessage(readerList[0], message, (byte)config.UserMemoryPage, (byte)config.UpdateMemorySize); }
private static bool TryGetPayload(string text, out IPayload payload, Model.System system) { payload = new TextPayload(text); var sinvRegex = Regex.Match(text, @"\\(SINV|sinv|Sinv)\[(0|1|2)\]"); if (sinvRegex.Success) { payload = new SineWaveAnimationPayload(sinvRegex.Groups[2].ToString() == "1" || sinvRegex.Groups[2].ToString() == "2"); // todo: add the other sinv animation return(true); } var nRegex = Regex.Match(text, @"\\(N|n)\<(.*)\>"); if (nRegex.Success) { payload = new SpeakerPayload(nRegex.Groups[2].ToString()); return(true); } var fnRegex = Regex.Match(text, @"\\(fn|Fn|FN)\<(.*)\>"); if (fnRegex.Success) { payload = new FontPayload(fnRegex.Groups[2].ToString()); return(true); } var cRegex = Regex.Match(text, @"\\(C|c)\[(\d*)\]"); if (cRegex.Success) { payload = new ColorPayload(int.Parse(cRegex.Groups[2].ToString())); return(true); } var vRegex = Regex.Match(text, @"\\(V|v)\[(\d*)\]"); if (vRegex.Success) { var id = int.Parse(vRegex.Groups[2].ToString()); var name = system.variables[id]; if (string.IsNullOrEmpty(name)) { name = id.ToString(); } payload = new VariablePayload(id, name); return(true); } // "Commands" - we don't need to parse these, they're mostly for in-game interactions var comRegex = Regex.Match(text, @"\\(Com|com|COM)\[(\d*)\]"); if (comRegex.Success) { payload = new TextPayload(string.Empty); return(true); } var quakeRegex = Regex.Match(text, @"\\(quake|Quake|QUAKE)\[(0|1)\]"); if (quakeRegex.Success) { payload = new QuakeAnimationPayload(quakeRegex.Groups[2].ToString() == "1"); return(true); } switch (text) { case @"\G": // CURRENCY NAME payload = new TextPayload("clams/$"); return(true); case @"\!": // WAIT FOR INPUT (todo: add some kinda icon) payload = new TextPayload(string.Empty); return(true); case @"\>": // DISABLE WORD WRAP (todo: add some kinda icon) payload = new TextPayload(string.Empty); return(true); case @"\<": // ENABLE WORD WRAP (todo: add some kinda icon) payload = new TextPayload(string.Empty); return(true); case @"\^": // DO NOT WAIT FOR INPUT (todo: add some kinda icon) payload = new TextPayload(string.Empty); return(true); case @"\|": // WAIT FOR 1s (todo: add some kinda icon) payload = new TextPayload(string.Empty); return(true); case @"\.": // WAIT FOR 1/4s (todo: add some kinda icon) payload = new TextPayload(string.Empty); return(true); case @"\$": // WAIT FOR 1/4s (todo: add some kinda icon) payload = new TextPayload("[current currency]"); return(true); case @"\LECLEAR": // CLEAR TEXT EFFECTS (todo) payload = new TextPayload(string.Empty); return(true); case @"\lb": // LINEBREAK? (this might be used for choices, todo: investigate) payload = new TextPayload("<br>", false); return(true); // Escape characters case "\\\"": payload = new TextPayload("\""); return(true); // Party substitution case @"\n[1]": payload = new TextPayload("OMORI"); return(true); case @"\n[2]": payload = new TextPayload("AUBREY"); return(true); case @"\n[3]": payload = new TextPayload("KEL"); return(true); case @"\n[4]": payload = new TextPayload("HERO"); return(true); case @"\n[8]": payload = new TextPayload("SUNNY"); return(true); case @"\n[9]": payload = new TextPayload("AUBREY"); return(true); case @"\n[10]": payload = new TextPayload("KEL"); return(true); case @"\n[11]": payload = new TextPayload("HERO"); return(true); case @"\n[16]": payload = new TextPayload("BERLY"); return(true); // Text size case @"\{": payload = new IncreaseTextSizePayload(); return(true); case @"\}": payload = new DecreaseTextSizePayload(); return(true); // Macros case @"\aub": payload = new SpeakerPayload("AUBREY"); return(true); case @"\kel": payload = new SpeakerPayload("KEL"); return(true); case @"\her": payload = new SpeakerPayload("HERO"); return(true); case @"\omo": payload = new SpeakerPayload("OMORI"); return(true); case @"\bas": payload = new SpeakerPayload("BASIL"); return(true); case @"\who": payload = new SpeakerPayload("???"); return(true); case @"\mar": payload = new SpeakerPayload("MARI"); return(true); case @"\min": payload = new SpeakerPayload("MINCY"); return(true); case @"\art": payload = new SpeakerPayload("ARTIST"); return(true); case @"\spxh": payload = new SpeakerPayload("SPACE EX-HUSBAND"); return(true); case @"\mai": payload = new SpeakerPayload("MAILBOX"); return(true); case @"\swh": payload = new SpeakerPayload("SWEETHEART"); return(true); case @"\kim": payload = new SpeakerPayload("KIM"); return(true); case @"\cha": payload = new SpeakerPayload("CHARLIE"); return(true); case @"\ang": payload = new SpeakerPayload("ANGEL"); return(true); case @"\mav": payload = new SpeakerPayload("THE MAVERICK"); return(true); case @"\van": payload = new SpeakerPayload("VANCE"); return(true); case @"\spg": payload = new SpeakerPayload("SPACE PIRATE GUY"); return(true); case @"\spd": payload = new SpeakerPayload("SPACE PIRATE DUDE"); return(true); case @"\spb": payload = new SpeakerPayload("SPACE PIRATE BUDDY"); return(true); case @"\wis": payload = new SpeakerPayload("WISE ROCK"); return(true); case @"\ber": payload = new SpeakerPayload("BERLY"); return(true); /* TODO: This is a duplicate macro... bug in the game? * case @"\van": * payload = new SpeakerPayload("VAN"); * return true; */ case @"\nos": payload = new SpeakerPayload("NOSE"); return(true); case @"\bun": payload = new SpeakerPayload("BUN"); return(true); case @"\lad": payload = new SpeakerPayload("MIKAL"); return(true); case @"\dai": payload = new SpeakerPayload("DAISY"); return(true); case @"\neb": payload = new SpeakerPayload("NEB"); return(true); case @"\hap": payload = new SpeakerPayload("HAPPY"); return(true); case @"\eye": payload = new SpeakerPayload("EYEBROWS"); return(true); case @"\ban": payload = new SpeakerPayload("BANGS"); return(true); case @"\shaw": payload = new SpeakerPayload("SHAWN"); return(true); case @"\ren": payload = new SpeakerPayload("REN"); return(true); case @"\char": payload = new SpeakerPayload("CHARLENE"); return(true); case @"\wee": payload = new SpeakerPayload("WEEPING WILLOW"); return(true); case @"\hum": payload = new SpeakerPayload("HUMPHREY"); return(true); case @"\gra": payload = new SpeakerPayload("GRANDMA"); return(true); case @"\che": payload = new SpeakerPayload("CHEERS"); return(true); case @"\sna": payload = new SpeakerPayload("SNALEY"); return(true); case @"\swe": payload = new SpeakerPayload("SWEETHEART"); return(true); case @"\smm": payload = new SpeakerPayload("SPROUT MOLE MIKE"); return(true); case @"\jaw": payload = new SpeakerPayload("MR. JAWSUM"); return(true); case @"\ems": payload = new SpeakerPayload("EMS"); return(true); case @"\ash": payload = new SpeakerPayload("ASH"); return(true); case @"\plu": payload = new SpeakerPayload("PLUTO"); return(true); case @"\due": payload = new SpeakerPayload("DUE"); return(true); case @"\cru": payload = new SpeakerPayload("CRUE"); return(true); case @"\ros": payload = new SpeakerPayload("ROSA"); return(true); case @"\kit": payload = new SpeakerPayload("KITE KID"); return(true); case @"\sca": payload = new SpeakerPayload("SCARECROW"); return(true); case @"\tvg": payload = new SpeakerPayload("TVGIRL"); return(true); case @"\sha": payload = new SpeakerPayload("SHADY MOLE"); return(true); case @"\may": payload = new SpeakerPayload("MAYOR MOLE"); return(true); case @"\sle": payload = new SpeakerPayload("SLEEPY MOLE"); return(true); case @"\spo": payload = new SpeakerPayload("SPORTY MOLE"); return(true); /* TODO: also duplicate? * case @"\che": * payload = new SpeakerPayload("CHEF MOLE"); * return true; */ case @"\spr": payload = new SpeakerPayload("SPROUT MOLE"); return(true); /* todo: also duplicate? * case @"\ban": * payload = new SpeakerPayload("BANDITO MOLE"); * return true; */ case @"\toa": payload = new SpeakerPayload("TOASTY"); return(true); /* * case @"\bun": * payload = new SpeakerPayload("BUN BUNNY"); * return true; */ case @"\ma1": payload = new SpeakerPayload("MAFIALLIGATOR 1"); return(true); case @"\ma2": payload = new SpeakerPayload("MAFIALLIGATOR 2"); return(true); case @"\spe": payload = new SpeakerPayload("SPELLING BEE"); return(true); case @"\hot": payload = new SpeakerPayload("HOTDOG"); return(true); case @"\bud": payload = new SpeakerPayload("BUDGIRL"); return(true); case @"\tom": payload = new SpeakerPayload("TOMATO GIRL"); return(true); case @"\lea": payload = new SpeakerPayload("LEAFY"); return(true); case @"\ora": payload = new SpeakerPayload("ORANGE JOE"); return(true); case @"pro": payload = new SpeakerPayload("PROPELLER GHOST"); return(true); case @"\str": payload = new SpeakerPayload("STRAW HAT GHOST"); return(true); case @"\top": payload = new SpeakerPayload("TOP HAT GHOST"); return(true); case @"\po": payload = new SpeakerPayload("PO"); return(true); case @"\lar": payload = new SpeakerPayload("LARAMIE"); return(true); case @"\fer": payload = new SpeakerPayload("FERRIS"); return(true); case @"\gum": payload = new SpeakerPayload("GUMBO"); return(true); case @"\gib": payload = new SpeakerPayload("GIBS"); return(true); case @"\cre": payload = new SpeakerPayload("CREEPY CAT"); return(true); case @"\duw": payload = new SpeakerPayload("DUCK WIFE"); return(true); case @"\duj": payload = new SpeakerPayload("DUCK JR."); return(true); case @"\duc": payload = new SpeakerPayload("DUCK"); return(true); case @"\pes": payload = new SpeakerPayload("PESSI"); return(true); case @"\smo": payload = new SpeakerPayload("SMOL"); return(true); case @"\gen": payload = new SpeakerPayload("GENKI"); return(true); case @"\LUE": payload = new SpeakerPayload("LUE"); return(true); case @"\pol": payload = new SpeakerPayload("POLAR BEAR"); return(true); case @"\sou": payload = new SpeakerPayload("SOUS-CHEF MOLE"); return(true); case @"\tea": payload = new SpeakerPayload("TEACHER MOLE"); return(true); case @"\st1": payload = new SpeakerPayload("STUDENT MOLE 1"); return(true); case @"\st2": payload = new SpeakerPayload("STUDENT MOLE 2"); return(true); case @"\st3": payload = new SpeakerPayload("STUDENT MOLE 3"); return(true); case @"\dun": payload = new SpeakerPayload("DUNCE MOLE"); return(true); case @"\lau": payload = new SpeakerPayload("LAUNDRY MOLE"); return(true); case @"\squ": payload = new SpeakerPayload("SQUARE MOLE"); return(true); case @"\dm1": payload = new SpeakerPayload("DINING MOLE 1"); return(true); case @"\dm2": payload = new SpeakerPayload("DINING MOLE 2"); return(true); case @"\dm3": payload = new SpeakerPayload("DINING MOLE 3"); return(true); case @"\mm1": payload = new SpeakerPayload("MISC MOLE 1"); return(true); case @"\mm2": payload = new SpeakerPayload("MISC MOLE 2"); return(true); case @"\joc": payload = new SpeakerPayload("JOCK JAMS"); return(true); case @"\sp1": payload = new SpeakerPayload("SPACE CREW 1"); return(true); case @"\sp2": payload = new SpeakerPayload("SPACE CREW 2"); return(true); case @"\sp3": payload = new SpeakerPayload("SPACE CREW 3"); return(true); case @"\ear": payload = new SpeakerPayload("EARTH"); return(true); case @"\sbf": payload = new SpeakerPayload("SPACE BOYFRIEND"); return(true); case @"\sxbf": payload = new SpeakerPayload("SPACE EX-BOYFRIEND"); return(true); case @"\cap": payload = new SpeakerPayload("CAPT. SPACEBOY"); return(true); case @"\shb": payload = new SpeakerPayload("SPACE HUSBAND"); return(true); case @"\sxhb": payload = new SpeakerPayload("SPACE EX-HUSBAND"); return(true); case @"\kev": payload = new SpeakerPayload("KEVIN"); return(true); default: return(false); } }
public KoreographyPayload GetCopy() { TextPayload newPL = new TextPayload(); newPL.TextVal = TextVal; return newPL; }
public string ToHtml() { // Text size works in a stack-based fashion - we need to take care of this here. var atSizeStack = 4; for (var i = 0; i < this.Count; i++) { var thisPayload = this[i]; if (thisPayload is IncreaseTextSizePayload) { if (atSizeStack >= 4) { atSizeStack++; this[i] = new TextPayload($"<span class=\"s{atSizeStack}\">", false); } else { atSizeStack++; this[i] = new TextPayload("</span>", false); } } if (thisPayload is DecreaseTextSizePayload) { if (atSizeStack <= 4) { atSizeStack--; this[i] = new TextPayload($"<span class=\"s{atSizeStack}\">", false); } else { atSizeStack--; this[i] = new TextPayload("</span>", false); } } } if (atSizeStack < 4) { while (atSizeStack != 4) { this.Add(new TextPayload("</span>", false)); atSizeStack++; } } if (atSizeStack > 4) { while (atSizeStack != 4) { this.Add(new TextPayload("</span>", false)); atSizeStack--; } } //Same thing for fonts var atFontStack = 0; for (var i = 0; i < this.Count; i++) { var thisPayload = this[i]; if (thisPayload is FontPayload fontPayload) { var text = string.Empty; if (atFontStack > 0) { text += "</span>"; atFontStack--; } atFontStack++; this[i] = new TextPayload(text + $"<span class=\"f{fontPayload.FontName}\">", false); } } if (atFontStack > 0) { this.Add(new TextPayload("</span>", false)); } return(this.Aggregate(string.Empty, (current, payload) => current + payload.ToHtml())); }
public MainWindow() { InitializeComponent(); // Global.UseSyncContextPost = true; DeserializeConfig(); controller.OnConnected += (success, readers) => { if (success) { AddLog("Success Connected."); } else { AddLog("Success Failured."); } foreach (var reader in readers) { AddLog(reader.Name); } readerList = readers; AddLog("-------"); }; controller.OnDisconnected += () => { readerList = null; AddLog("Disconnected."); AddLog("-------"); }; Reader targetReader = null; controller.OnEnterCard += (card, r) => { AddLog("Enter:" + card.Id + ":" + card.Type + " on " + r.Name + " : " + r.SerialNumber); if (targetReader == null) { labelIDm.Content = card.Id; labelType.Content = card.Type; buttonRead.IsEnabled = true; buttonWrite.IsEnabled = true; buttonSend.IsEnabled = true; targetReader = r; } AddLog("-------"); return(Disposition.Leave); }; controller.OnLeaveCard += (card, r) => { if (card != null) { AddLog("Leave:" + card.Id + " on " + r.Name + " : " + r.SerialNumber); } if (targetReader == r) { labelIDm.Content = ""; labelType.Content = ""; buttonRead.IsEnabled = false; buttonWrite.IsEnabled = false; buttonSend.IsEnabled = false; targetReader = null; } AddLog("-------"); }; controller.OnAPDUCommand += (success, reader, command, data) => { if (success != ExecStatus.Error) { AddLog("Success APDU Command:"); string datastring = BitConverter.ToString(data); AddLog("Data:" + datastring); } else { AddLog("Failure APDU Command:(" + command.Sw1 + "," + command.Sw2 + ")"); string reason = ""; if (command.Exception != null) { reason = command.Exception.Message; } AddLog("Reason:" + reason); } AddLog("-------"); }; controller.OnWriteNdefMessage += (success, reader, message) => { if (success) { AddLog("Success WriteNdefMessage:"); } else { AddLog("Failure WriteNdefMessage:"); } AddLog("-------"); }; controller.OnReadNdefMessage += (success, reader, message) => { if (success) { if (message.Records.Count == 0) { AddLog("Record is invalid."); AddLog("-------"); return; } if (message.Records[0].TypeNameFormat != TypeNameFormat.NfcForumWellKnownType) { AddLog("Record is not support format."); AddLog("-------"); return; } var payload = message.Records[0].Payload; if (payload.GetType() == typeof(TextPayload)) { tabNdefData.SelectedIndex = (int)Tab.Text; TextPayload tp = (TextPayload)payload; textTextData.Text = tp.Text; } else if (payload.GetType() == typeof(UriPayload)) { tabNdefData.SelectedIndex = (int)Tab.Uri; UriPayload up = (UriPayload)payload; comboUriData.SelectedIndex = (int)up.Prefix; textUriData.Text = up.Data; } else { AddLog("Payload is not support format."); AddLog("-------"); return; } AddLog("Success to Read Ndef Data"); } else { AddLog("Failure ReadNdefMessage:"); } AddLog("-------"); }; controller.ConnectService(); foreach (UriPrefix value in Enum.GetValues(typeof(UriPrefix))) { string name = Enum.GetName(typeof(UriPrefix), value); comboUriData.Items.Add(name); } tabNdefData.SelectedIndex = (int)Tab.Text; }