private void CompareFormatted(ComparerTabViewModel vm, object parameter)
        {
            string formattedJsonl;
            string formattedJson2;

            try
            {
                formattedJsonl = Format(vm.Json1Content, vm.Json1Name);
                formattedJson2 = Format(vm.Json2Content, vm.Json2Name);
            }
            catch (Exception e)
            {
                Message = $" {e.Message} Correct JSON or compare without preliminary formatting. ";
                return;
            }

            try
            {
                JsonComparer.Compare(formattedJsonl, vm.Json1Name, formattedJson2, vm.Json2Name);
                Message = "";
            }
            catch (Exception e)
            {
                Message = $" Failed to compare JSONs. {e.Message} ";
            }
        }
예제 #2
0
 private bool CanCompare(ComparerTabViewModel vm, object parameter)
 {
     return(!string.IsNullOrWhiteSpace(vm.Json1Name) &&
            !string.IsNullOrWhiteSpace(vm.Json1Content) &&
            !string.IsNullOrWhiteSpace(vm.Json2Name) &&
            !string.IsNullOrWhiteSpace(vm.Json2Content));
 }
예제 #3
0
 private void Compare(ComparerTabViewModel vm, object parameter)
 {
     try
     {
         JsonComparer.Compare(vm.Json1Content, vm.Json1Name, vm.Json2Content, vm.Json2Name);
     }
     catch (Exception e)
     {
         MessageBox.Show("Error while comparing JSONs: " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void Compare(ComparerTabViewModel vm, object parameter)
 {
     try
     {
         JsonComparer.Compare(vm.Json1Content, vm.Json1Name, vm.Json2Content, vm.Json2Name);
         Message = "";
     }
     catch (Exception e)
     {
         Message = $"Failed to compare JSONs. {e.Message} ";
     }
 }
예제 #5
0
 private void CompareFormatted(ComparerTabViewModel vm, object parameter)
 {
     try
     {
         var formattedJsonl = JsonFormatter.Format(vm.Json1Content, vm.Json1Name);
         var formattedJson2 = JsonFormatter.Format(vm.Json2Content, vm.Json2Name);
         JsonComparer.Compare(formattedJsonl, vm.Json1Name, formattedJson2, vm.Json2Name);
     }
     catch (Exception e)
     {
         MessageBox.Show("Error while comparing formatted JSONs: " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }