From d1a150114ed7cb73b8073b6f4cb5084913bd7dbc Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Tue, 20 Jun 2023 11:56:47 +1000 Subject: [PATCH] main: Updated batching and docs - Updated example-configs/batch.txt with new DNS records - Modified BatchForm.cs to handle new DNS record types --- FireWallet/BatchForm.cs | 23 ++++++++++------------- example-configs/batch.txt | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/FireWallet/BatchForm.cs b/FireWallet/BatchForm.cs index 10f2f59..f2e583f 100644 --- a/FireWallet/BatchForm.cs +++ b/FireWallet/BatchForm.cs @@ -667,40 +667,37 @@ namespace FireWallet { string[] updateRecord = update.Split(','); string type = updateRecord[0]; - type = type.Split(':')[1]; + type = type.Split(':')[1].Replace("\"","").Trim(); switch (type) { case "NS": - string ns = updateRecord[1].Split(':')[1].Replace("\"",""); + string ns = updateRecord[1].Split(':')[1].Replace("\"","").Replace("}","").Trim(); UpdateRecords[r] = new DNS(type, ns); break; case "DS": int keyTag = int.Parse(updateRecord[1].Split(':')[1]); int algorithm = int.Parse(updateRecord[2].Split(':')[1]); int digestType = int.Parse(updateRecord[3].Split(':')[1]); - string digest = updateRecord[4].Split(':')[1].Replace("\"", ""); + string digest = updateRecord[4].Split(':')[1].Replace("\"", "").Replace("}", ""); UpdateRecords[r] = new DNS(type, keyTag, algorithm, digestType, digest); break; case "TXT": - string txt = updateRecord[1].Split(':')[1].Replace("\"", ""); - txt.Replace("[", ""); - txt.Replace("]", ""); - UpdateRecords[r] = new DNS(type, new string[] { txt }); + string txt = updateRecord[1].Split(':')[1].Replace("\"", "").Replace("}", ""); + txt = txt.Replace("[", ""); + txt = txt.Replace("]", ""); + UpdateRecords[r] = new DNS(type, new string[] { txt.Trim() }); break; case "GLUE4": case "GLUE6": - string nsGlue = updateRecord[1].Split(':')[1].Replace("\"", ""); - string address = updateRecord[2].Split(':')[1].Replace("\"", ""); + string nsGlue = updateRecord[1].Split(':')[1].Replace("\"", "").Trim(); + string address = updateRecord[2].Split(':')[1].Replace("\"", "").Replace("}", "").Trim(); UpdateRecords[r] = new DNS(type, nsGlue, address); break; - - } - r++; } - + AddBatch(split[0], split[1], UpdateRecords); continue; } } diff --git a/example-configs/batch.txt b/example-configs/batch.txt index c4d5140..e47b8c5 100644 --- a/example-configs/batch.txt +++ b/example-configs/batch.txt @@ -6,4 +6,4 @@ woodburn4,BID,1,3 woodburn5,BID,1,3 woodburn6,BID,1,4 woodburn8,TRANSFER,hs1qlmlgnx0g3ynk4ylxkkdh9c9nernclnfq4lw6s9 -exampledomainnathan118,UPDATE,[{"type": "DS","keyTag": 20167,"algorithm": 13,"digestType": 2,"digest":"4a2ab3224727a4754a6c3d77621a5b04241a3d9c7ae7e5fa17f73121b9ff0e06"}, {"type": "NS","ns": "ns1.woodburn."}, {"type": "NS","ns": "ns2.woodburn."}, {"type": "TXT","txt": ["TEST"]}] \ No newline at end of file +exampledomainnathan90,UPDATE,[{"type": "NS","ns": "ns1.woodburn."};{"type": "NS","ns": "ns2.woodburn."};{"type": "DS","keyTag": 30273,"algorithm": 13,"digestType": 2,"digest":"9a3a8fb3d625d2a2073d740f10da6056ebed0e97f550aa7f3891ed450c7e60c9"};{"type": "GLUE4","ns": "ns1.exampledomainnathan90.","address": "1.2.3.4"};{"type": "TXT","txt": ["Test TXT record"]}] \ No newline at end of file