Example #1
0
        private static void GenerateCommand(string[] args)
        {
            var s    = 1;
            var type = PfpConvert.GENERATED_PFP_TYPE;

            if (args[1].Equals("pfp"))
            {
                type = PfpConvert.GENERATED_PFP_TYPE;
            }
            else if (args[1].Equals("aep"))
            {
                type = PfpConvert.GENERATED_AEP_TYPE;
            }
            else
            {
                s--;
            }

            var pw    = new PfpConvert().GetPasswordGetter(args[0]);
            var entry = new GeneratedEntry {
                type = type, site = args[1 + s], name = args[2 + s]
            };

            if (3 + s < args.Length)
            {
                entry.revision = args[3 + s];
            }

            Console.WriteLine(pw(entry));
        }
Example #2
0
        private static void EncryptCommand(string[] args)
        {
            var json = new JsonConvert();
            var pfp  = new PfpConvert();

            using (var input = new StreamReader(args[1]))
                using (var output = File.OpenWrite(args[2])) {
                    var entries = json.Deserialize <BaseEntry[]>(input.ReadToEnd());
                    pfp.Save(output, args[0], entries);
                }
        }
Example #3
0
        private static void DecryptCommand(string[] args)
        {
            var json = new JsonConvert(new JsonSerializerSettings {
                Formatting = Formatting.Indented
            });
            var pfp = new PfpConvert();

            using (var input = File.OpenRead(args[1]))
                using (var output = new StreamWriter(args[2])) {
                    var entries = pfp.Load(input, args[0]);
                    output.WriteLine(json.Serialize(entries));
                }
        }