Пример #1
0
        /*
         * start the application
         */
        public static int Main(
            string[] args)
        {
            bool   encrypt = true;
            string infile  = null;
            string outfile = null;
            string keyfile = null;

            if (args.Length < 2)
            {
//				Console.Error.WriteLine("Usage: java " + typeof(DesExample).Name + " infile outfile [keyfile]");
                Console.Error.WriteLine("Usage: " + typeof(DesExample).Name + " infile outfile [keyfile]");
                return(1);
            }

            keyfile = "deskey.dat";
            infile  = args[0];
            outfile = args[1];

            if (args.Length > 2)
            {
                encrypt = false;
                keyfile = args[2];
            }

            try
            {
                DesExample de = new DesExample(infile, outfile, keyfile, encrypt);
                de.process();
            }
            catch (Exception)
            {
                return(1);
            }

            return(0);
        }
Пример #2
0
		/*
		* start the application
		*/
		public static int Main(
			string[] args)
		{
			bool encrypt = true;
			string infile = null;
			string outfile = null;
			string keyfile = null;

			if (args.Length < 2)
			{
//				Console.Error.WriteLine("Usage: java " + typeof(DesExample).Name + " infile outfile [keyfile]");
				Console.Error.WriteLine("Usage: " + typeof(DesExample).Name + " infile outfile [keyfile]");
				return 1;
			}

			keyfile = "deskey.dat";
			infile = args[0];
			outfile = args[1];

			if (args.Length > 2)
			{
				encrypt = false;
				keyfile = args[2];
			}

			try
			{
				DesExample de = new DesExample(infile, outfile, keyfile, encrypt);
				de.process();
			}
			catch (Exception)
			{
				return 1;
			}

			return 0;
		}