예제 #1
0
 /// <inheritdoc/>
 public bool SaveManifest(PluginManifest manifest, string path)
 {
     try
     {
         var data = JsonSerializer.Serialize(manifest, _jsonOptions);
         File.WriteAllText(Path.Combine(path, "meta.json"), data);
         return(true);
     }
     catch (ArgumentException e)
     {
         _logger.LogWarning(e, "Unable to save plugin manifest due to invalid value. {Path}", path);
         return(false);
     }
 }
예제 #2
0
        public bool SaveManifest(PluginManifest manifest, string path)
        {
            if (manifest == null)
            {
                return(false);
            }

            try
            {
                var data = JsonSerializer.Serialize(manifest, _jsonOptions);
                File.WriteAllText(Path.Combine(path, "meta.json"), data, Encoding.UTF8);
                return(true);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                _logger.LogWarning(e, "Unable to save plugin manifest. {Path}", path);
                return(false);
            }
        }