Save() public method

Saves using the specified writer.
public Save ( IKeySetWriter writer ) : bool
writer IKeySetWriter The writer.
return bool
コード例 #1
0
ファイル: Demote.cs プロジェクト: jbtule/keyczar-dotnet
        public override int Run(string[] remainingArguments)
        {
            using (var keySet = new MutableKeySet(_location))
            {
                var status = keySet.Demote(_version);
                if (status == null)
                {
                    Console.WriteLine("{0} {1}", Localized.MsgUnknownVersion, _version);
                    return -1;
                }
                try
                {
                    if (keySet.Save(new KeySetWriter(_location, overwrite: true)))
                    {
                        Console.WriteLine(Localized.MsgDemotedVersion, _version, status);
                        return 0;
                    }
                }
                catch
                {
                }
            }

            Console.WriteLine("{0} {1}", Localized.MsgCouldNotWrite, _location);
            return -1;
        }
コード例 #2
0
ファイル: Revoke.cs プロジェクト: jbtule/keyczar-dotnet
 public override int Run(string[] remainingArguments)
 {
     using (var keySet = new MutableKeySet(_location))
     {
         var status = keySet.Revoke(_version);
         if (!status)
         {
             Console.WriteLine("{0} {1}.", Localized.MsgCouldNotRevoke, _version);
             return -1;
         }
         try
         {
             if (keySet.Save(new KeySetWriter(_location, overwrite: true)))
             {
                 Console.WriteLine("{0} {1}.", Localized.MsgRevokedVersion, _version);
                 return 0;
             }
         }
         catch
         {
         }
         Console.WriteLine("{0} {1}.", Localized.MsgCouldNotWrite, _location);
         return -1;
     }
 }