Beispiel #1
0
        static void Main(string[] args)
        {
            usage();
            if (args.Length < 3)
            {
                Console.WriteLine("Need minimum of 3 arguments");
                return;
            }
            Console.WriteLine("AkaLibExample.Main() starting...");
            int i = 0;
            // int key = 23028892;
            // string uname = "Demo expires 3/1/2020";

            // Get user, key and  from command line - used to init AKA library
            int key = Convert.ToInt32(args[i++]);
            string uname = args[i++];

            double rate = Convert.ToDouble(args[i++]); // discount rate 7.0% as 7.0
            double coupon = (i < args.Length) ? Convert.ToDouble(args[i++]) : rate;

            Console.WriteLine("rate: " + rate + " coupon: " + coupon);

            // Initialize the library
            Console.WriteLine("AkaLibExample.main() - creating Initialization with key: " + key + " uname: " + uname);
            Initialization akareg = new Initialization(key, uname);
            Console.WriteLine("AkaLibExample.main() - created Initialization - error: " + akareg.Error());
            if (akareg.Error() > 0)
            {
                Console.WriteLine("AkaLibExample.main() - Initialization failed with error: " + akareg.ErrorString());
                return;
            }

            Console.WriteLine("AkaLibExample.main() - Version: " + Initialization.Version() + " Expiration Libdate: " + akareg.Expiration().Libdate() + " Expiration YearOf: " + akareg.Expiration().YearOf() + " MonthOf: " + akareg.Expiration().MonthOf() + " DayOf: " + akareg.Expiration().DayOf());
            int error = exampleValuation();
            if (error > 0)
            {
                printError("AkaLibExample.main()", "exampleValuation() returned an error: " + error);
            }

            Console.WriteLine("AkaLibExample.Main() finished...");
        }
Beispiel #2
0
 internal static HandleRef getCPtr(Initialization obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }