public void Save() { try { if (Default == null || Default.Count <= 0) { return; } List <JobInfoSyncData> list = Tools.CloneByJson <List <JobInfoSyncData> >(Default); foreach (JobInfoSyncData job in list) { job.createtmp = EncodeHelper.EncodeBase64(job.createtmp); job.targetsql = EncodeHelper.EncodeBase64(job.targetsql); job.sourcesql = EncodeHelper.EncodeBase64(job.sourcesql); job.sourcedbstring = EncodeAndDecode.Encode(job.sourcedbstring); job.targetdbstring = EncodeAndDecode.Encode(job.targetdbstring); job.xmlconfig = EncodeHelper.EncodeBase64(job.xmlconfig); } File.WriteAllText(path, JsonConvert.DeserializeObject(JsonConvert.SerializeObject(list)).ToString()); } catch (Exception ex) { Log4netUtil.Error("定时同步任务配置保存失败,请检查,原因:" + ex.Message, ex); } }
public void EncodeDecodeBase64Test() { string original = "test1..."; string encoded = EncodeHelper.EncodeBase64(original); string decoded = EncodeHelper.DecodeBase64(encoded); Assert.Equal(original, decoded); }
public void Encode_Decode_Base64_Test() { var plain = "Man你好"; var cipher = EncodeHelper.EncodeBase64(Encoding.UTF8, plain); var origin = EncodeHelper.DecodeBase64(Encoding.UTF8, cipher); Console.WriteLine(cipher); Console.WriteLine(origin); }
public void Save() { try { if (Default == null || Default.Count <= 0) { return; } List <JobInfoPushMessage> list = Tools.CloneByJson <List <JobInfoPushMessage> >(Default); foreach (JobInfoPushMessage job in list) { job.dbstring = EncodeHelper.EncodeBase64(job.dbstring); } File.WriteAllText(path, JsonConvert.DeserializeObject(JsonConvert.SerializeObject(list)).ToString()); } catch (Exception ex) { Log4netUtil.Error("消息推送任务配置保存失败,请检查,原因:" + ex.Message, ex); } }
public void EncodeBase64Test(string expected, string value) { Assert.Equal(expected, EncodeHelper.EncodeBase64(value)); }
public void NUllEncodeDecodeBase64Test() { Assert.Equal("", EncodeHelper.EncodeBase64(null)); Assert.Equal("", EncodeHelper.DecodeBase64(null)); }