Пример #1
0
 internal static void CreateJsonFile(string jsonToWrite, string jsonFileName)
 {
     try
     {
         var jsonFile = Path.Combine(DirectoryHandler.DirectoryCreation(Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName,
                                                                                     "UFHtmlExtractor")), jsonFileName + ".json");
         File.WriteAllText(jsonFile, jsonToWrite, Encoding.UTF8);
         var projFilePath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
         var p1           = new Microsoft.Build.Evaluation.Project(Path.Combine(projFilePath,
                                                                                Path.GetFileName(projFilePath.TrimEnd(Path.DirectorySeparatorChar)) + ".csproj"));
         p1.AddItem("None", Path.Combine("UFHtmlExtractor", jsonFileName + ".json"));
         p1.Save();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Creation of Json File, Failed!");
     }
 }