Main(
            string[] args)
        {
            try
            {
                if ((args == null) || (args.Length < 5) || (args.Length > 7))
                {
                    ShowUsage();
                }

                if (string.Equals(args[0], "CopyFileToGuest", StringComparison.OrdinalIgnoreCase))
                {
                    bool overwriteExisting = false;
                    bool createFullPath    = false;

                    //
                    // If OverwriteExisting argument is specified, get its value.
                    //

                    if (args.Length > 5)
                    {
                        overwriteExisting = Convert.ToBoolean(
                            args[5],
                            CultureInfo.InvariantCulture);

                        //
                        // If CreateFullPath argument is specified, get its value.
                        //

                        if (args.Length == 7)
                        {
                            createFullPath = Convert.ToBoolean(
                                args[6],
                                CultureInfo.InvariantCulture);
                        }
                    }

                    //
                    // Copy file to the guest.
                    //

                    GuestServiceInterface guestServiceInterface = new GuestServiceInterface();

                    guestServiceInterface.CopyFileToGuest(
                        args[1],
                        args[2],
                        args[3],
                        args[4],
                        overwriteExisting,
                        createFullPath);
                }
                else
                {
                    ShowUsage();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
Exemplo n.º 2
0
        Main(
            string[] args)
        {
            try
            {
                if ((args == null) || (args.Length < 5) || (args.Length > 7))
                {
                    ShowUsage();
                }

                if (string.Equals(args[0], "CopyFileToGuest", StringComparison.OrdinalIgnoreCase))
                {
                    bool overwriteExisting = false;
                    bool createFullPath = false;

                    //
                    // If OverwriteExisting argument is specified, get its value.
                    //

                    if (args.Length > 5)
                    {
                        overwriteExisting = Convert.ToBoolean(
                            args[5],
                            CultureInfo.InvariantCulture);

                        //
                        // If CreateFullPath argument is specified, get its value.
                        //

                        if (args.Length == 7)
                        {
                            createFullPath = Convert.ToBoolean(
                                args[6],
                                CultureInfo.InvariantCulture);
                        }
                    }

                    //
                    // Copy file to the guest.
                    //

                    GuestServiceInterface guestServiceInterface = new GuestServiceInterface();

                    guestServiceInterface.CopyFileToGuest(
                        args[1],
                        args[2],
                        args[3],
                        args[4],
                        overwriteExisting,
                        createFullPath);
                }
                else
                {
                    ShowUsage();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }