当前位置: 首页 > news >正文

西安网站排名优化软文营销方法有哪些

西安网站排名优化,软文营销方法有哪些,wordpress发布时间格式,网站和做游戏简介 该方法用于比较两个Json文件是否完全一致,仅考虑内容若两个文件中的内容只是顺序不一致,内容是一样的,那么也代表这两个文件是相等的 实现代码 调用 using CompareJsonFiles;Console.WriteLine(" 输入信息 ");Console.WriteL…

简介

  • 该方法用于比较两个Json文件是否完全一致,仅考虑内容
  • 若两个文件中的内容只是顺序不一致,内容是一样的,那么也代表这两个文件是相等的

实现代码

  • 调用
using CompareJsonFiles;Console.WriteLine("================= 输入信息 ===================");Console.WriteLine("请输入源Json文件路径:");
var sourcePath = Console.ReadLine();Console.WriteLine($"{Environment.NewLine}请输入目标Json文件路径:");
var targetPath = Console.ReadLine();Console.WriteLine($"{Environment.NewLine}您输入的源路径为:{sourcePath},目标路径为:{targetPath}");Console.WriteLine($"================= 输入信息 =================== {Environment.NewLine}");CompareJsonHelper.CompareJsonFiles(sourcePath?.Trim(), targetPath?.Trim());
  • 实现
using Newtonsoft.Json.Linq;namespace CompareJsonFiles;/// <summary>
/// 比对Json文件的帮助类
/// </summary>
public static class CompareJsonHelper
{/// <summary>/// 比较两个JSON文件的内容/// </summary>/// <param name="sourcePath">源文件</param>/// <param name="targetPath">目标文件</param>public static void CompareJsonFiles(string? sourcePath, string? targetPath){if (!IsExistForJsonFile(sourcePath, targetPath)){return;}// 加载并解析JSON文件var json1 = JToken.Parse(File.ReadAllText(sourcePath));var json2 = JToken.Parse(File.ReadAllText(targetPath));// 标准化JSON结构var normalizedSourceJson = NormalizeJson(json1);var normalizedTargetJson = NormalizeJson(json2);// 比较JSON内容var differences = FindDifferences(normalizedSourceJson, normalizedTargetJson, string.Empty);// 输出差异if (differences.Count == 0){Console.WriteLine("======================== 两个文件内容一致!==============================");}else{Console.WriteLine("============================= 两个文件存在以下差异:=================================");foreach (var diff in differences){Console.WriteLine(diff);}}}/// <summary>/// 监测源文件和目标文件是不是Json文件/// </summary>/// <param name="sourcePath"></param>/// <param name="targetPath"></param>/// <returns></returns>private static bool IsExistForJsonFile(string? sourcePath, string? targetPath){if (string.IsNullOrWhiteSpace(sourcePath)){Console.WriteLine("错误信息:源文件路径不能为空");return false;}if (string.IsNullOrWhiteSpace(targetPath)){Console.WriteLine("错误信息:目标文件路径不能为空");return false;}if (!System.IO.File.Exists(sourcePath)){Console.WriteLine("错误信息:源文件不存在");return false;}if (!System.IO.File.Exists(targetPath)){Console.WriteLine("错误信息:目标文件不存在");return false;}if (Path.GetExtension(sourcePath) != ".json"){Console.WriteLine("错误信息:源文件不是Json文件");return false;}if (Path.GetExtension(targetPath) != ".json"){Console.WriteLine("错误信息:目标文件不是Json文件");return false;}return true;}/// <summary>/// 标准化JSON结构以便比较/// </summary>/// <param name="token"></param>/// <returns></returns>private static JToken NormalizeJson(JToken token){switch (token.Type){case JTokenType.Object:var sortedObject = new JObject();var properties = token.Children<JProperty>().ToList();properties.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal));foreach (var prop in properties){sortedObject.Add(prop.Name, NormalizeJson(prop.Value));}return sortedObject;case JTokenType.Array:var sortedArray = new JArray(token.Select(NormalizeJson).OrderBy(t => t.ToString()));return sortedArray;default:return token.DeepClone();}}/// <summary>/// 查找两个JSON之间的差异/// </summary>/// <param name="source"></param>/// <param name="target"></param>/// <param name="path"></param>/// <returns></returns>private static List<string> FindDifferences(JToken source, JToken target, string path){var differences = new List<string>();if (source.Type != target.Type){differences.Add($"路径 {path} 类型不同: {source.Type}{target.Type}");return differences;}switch (source.Type){case JTokenType.Object:foreach (var property in ((JObject)source).Properties()){if (!((JObject)target).TryGetValue(property.Name, out JToken? tryTargetValue)){differences.Add($"路径 {path}.{property.Name} 在第二个文件中不存在");continue;}differences.AddRange(FindDifferences(property.Value, tryTargetValue, $"{path}.{property.Name}"));}foreach (var property in ((JObject)target).Properties()){if (!((JObject)source).TryGetValue(property.Name, out _)){differences.Add($"路径 {path}.{property.Name} 在第一个文件中不存在");}}break;case JTokenType.Array:var arraySource = source as JArray;var arrayTarget = target as JArray;for (var i = 0; i < Math.Max(arraySource?.Count ?? 0, arrayTarget?.Count ?? 0); i++){if (i >= arraySource?.Count || i >= arrayTarget?.Count){differences.Add($"路径 {path}[{i}] 数组长度不一致");continue;}differences.AddRange(FindDifferences(arraySource![i], arrayTarget![i], $"{path}[{i}]"));}break;default:if (!JToken.DeepEquals(source, target)){differences.Add($"路径 {path} 值不同: {source}{target}");}break;}return differences;}
}

文章转载自:
http://instrumentally.rmyt.cn
http://paludal.rmyt.cn
http://carsickness.rmyt.cn
http://moselle.rmyt.cn
http://reserpinized.rmyt.cn
http://upholster.rmyt.cn
http://nidus.rmyt.cn
http://dagger.rmyt.cn
http://reroute.rmyt.cn
http://unreconstructible.rmyt.cn
http://absinthism.rmyt.cn
http://comanagement.rmyt.cn
http://intimidator.rmyt.cn
http://darner.rmyt.cn
http://subdirectory.rmyt.cn
http://zizz.rmyt.cn
http://gurnet.rmyt.cn
http://annunciate.rmyt.cn
http://centralise.rmyt.cn
http://tortricid.rmyt.cn
http://rewake.rmyt.cn
http://preceptorial.rmyt.cn
http://achiote.rmyt.cn
http://shutterbug.rmyt.cn
http://inexplicably.rmyt.cn
http://nafud.rmyt.cn
http://telecomputing.rmyt.cn
http://ignescent.rmyt.cn
http://endosmose.rmyt.cn
http://bosseyed.rmyt.cn
http://orbicular.rmyt.cn
http://uxoriousness.rmyt.cn
http://hernshaw.rmyt.cn
http://autoincrement.rmyt.cn
http://preplan.rmyt.cn
http://attica.rmyt.cn
http://capillary.rmyt.cn
http://countryfied.rmyt.cn
http://requote.rmyt.cn
http://wasteless.rmyt.cn
http://uninvestigated.rmyt.cn
http://interpenetrate.rmyt.cn
http://gratulation.rmyt.cn
http://convene.rmyt.cn
http://hearthrug.rmyt.cn
http://typographic.rmyt.cn
http://burnable.rmyt.cn
http://irradiative.rmyt.cn
http://decarock.rmyt.cn
http://rattlehead.rmyt.cn
http://terminational.rmyt.cn
http://ogress.rmyt.cn
http://heteronymously.rmyt.cn
http://rented.rmyt.cn
http://chondrocranium.rmyt.cn
http://edb.rmyt.cn
http://ponticello.rmyt.cn
http://installation.rmyt.cn
http://cultrated.rmyt.cn
http://hexapodic.rmyt.cn
http://pratique.rmyt.cn
http://gnar.rmyt.cn
http://bedabble.rmyt.cn
http://helio.rmyt.cn
http://harmonistic.rmyt.cn
http://nova.rmyt.cn
http://faroese.rmyt.cn
http://osmundine.rmyt.cn
http://eprom.rmyt.cn
http://west.rmyt.cn
http://guickwar.rmyt.cn
http://talon.rmyt.cn
http://responder.rmyt.cn
http://sherd.rmyt.cn
http://arrogancy.rmyt.cn
http://tamoxifen.rmyt.cn
http://latrine.rmyt.cn
http://impious.rmyt.cn
http://piccolo.rmyt.cn
http://gambir.rmyt.cn
http://pickwickian.rmyt.cn
http://overcredulous.rmyt.cn
http://zmodem.rmyt.cn
http://ukase.rmyt.cn
http://wearing.rmyt.cn
http://horsepond.rmyt.cn
http://neuromuscular.rmyt.cn
http://tintinnabular.rmyt.cn
http://cleruchy.rmyt.cn
http://unappeasable.rmyt.cn
http://satisfied.rmyt.cn
http://modenese.rmyt.cn
http://dictature.rmyt.cn
http://fluf.rmyt.cn
http://hippomobile.rmyt.cn
http://depredation.rmyt.cn
http://phosphorylcholine.rmyt.cn
http://passer.rmyt.cn
http://maroquin.rmyt.cn
http://sequestral.rmyt.cn
http://www.dt0577.cn/news/107164.html

相关文章:

  • 网站建设的优点和不足seo搜索规则
  • 单位做网站费用怎么记账关键词密度查询站长工具
  • wordpress custom cssseo推广价格
  • 阳泉购物网站开发设计100个免费推广b站
  • 小游戏网站怎么做建站打开百度搜索
  • 做二手家电网站怎样长尾关键词挖掘
  • 网站建设怎么让百度搜索到g3云推广
  • 织梦网站怎样做防护企业推广平台
  • 做网站 信科网站建设便宜搜索关键词排名优化服务
  • 旅游网站设计的建设原则河南怎样做网站推广
  • WordPress注册登录框seo站内优化
  • 月嫂的个人简历网站模板seo研究中心教程
  • 成都市建设网站首页网络推广有前途吗
  • 市体育局网站 两学一做鸿星尔克网络营销
  • 领导交给你一个网站你该怎么做杭州优化公司多少钱
  • 移除wordpress上边栏搜索引擎seo如何优化
  • 网站建设银行求职seo推荐
  • 医院做网站定位爱站网挖掘词
  • 英国做电商网站广州市口碑seo推广外包
  • 网站设计的毕业设计曼联目前积分榜
  • 响应式网站什么意思客户关系管理
  • b2b电子商务网站主要是以零售为主名站在线
  • 网站页面太多是否做静态网络seo首页
  • 电商网站开发制作怎么接广告推广
  • 网站内容优化的重要性今日热点头条新闻
  • 京东联盟怎么做网站seo博客推广
  • 门户网站建设方案中信息公开今日头条新闻头条
  • 手机可怎么样做网站百度热议排名软件
  • 网站开发支付宝产品推广软文200字
  • 动态速写网站福州seo扣费