/// <summary>
 /// 保存配置文件
 /// </summary>
 public static bool SaveConfigData()
 {
     if (ConfigDataService.ConfigData != null)
     {
         //string path = System.Environment.CurrentDirectory + @"\config.json";
         StringConvert.FileWrite(FilePath, StringConvert.ListToJson(ConfigDataService.ConfigData));
         return(true);
     }
     return(false);
 }
示例#2
0
        /// <summary>
        /// 保存成json文件
        /// </summary>
        /// <param name="myBookmarkses"></param>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static bool SaveMyBookmarksToJsonFile(List <MyBookmarks> myBookmarkses, string filePath)
        {
            BookmarksType bookmarksType = new BookmarksType();

            bookmarksType.Info = myBookmarkses;
            List <string> types = new List <string>();

            foreach (var item in myBookmarkses.GroupBy(a => a.Type).ToList())
            {
                types.Add(item.Key);
            }
            bookmarksType.Type = types;
            return(StringConvert.FileWrite(filePath, StringConvert.ListToJson(bookmarksType)));
        }