コード例 #1
0
ファイル: OVF_Conv.cs プロジェクト: internsaccount/ovfwrapper
        private void btnrun_Click(object sender, EventArgs e)
        {
            progressBar1.Value = 0;
            label7.Text        = "0%";
            btnlog.Visible     = false;
            String eul_chk = "", log = "";

            if (txtsrc.Text == null || txtsrc.Text == "Drag and drop source file" || txtsrc.Text == "source location")
            {
                MessageBox.Show("Please browse or drag and drop source file");
            }
            else if (txttrg.Text == "" || txttrg.Text == "Target")
            {
                MessageBox.Show("Please browse the target location");
            }
            else if (txt_f_n1.Text == "" || txt_f_n1.Text == "Enter File Name")
            {
                MessageBox.Show("Please enter the save as file name");
            }
            else if (cmbtrg.Text == "Select extension" || cmbtrg.Text == "")
            {
                MessageBox.Show("Please select the extension for conversion");
            }
            else if (chklog.Checked && cmblog.Text == "")
            {
                MessageBox.Show("Please select the logging level");
            }
            else
            {
                UseWaitCursor = true;

                if (chklog.Checked)//Checks whether the logs option is enabled
                {
                    log = @"--X:logFile=" + filename + " --X:logLevel=" + cmblog.Text + " ";
                    s   = log + txtsrc.Text.Trim() + " " + txttrg.Text.Trim() + "\\" + txt_f_n1.Text.Trim() + "." + cmbtrg.Text.Trim();
                    //String s=@"\"vcloud\:\/\/[email protected]:[email protected]/cloud/org/m211057782-9439/?vdc=m211057782&org=M211057782-9439&vappTemplate=test&catalog=SG_Catalog" \"C:\Users\gayatrib\Desktop\exp\"";
                }
                else
                {
                    s = txtsrc.Text.Trim() + " " + txttrg.Text.Trim() + "\\" + txt_f_n1.Text.Trim() + "." + cmbtrg.Text.Trim();
                    //String s=@"\"vcloud\:\/\/[email protected]:[email protected]/cloud/org/m211057782-9439/?vdc=m211057782&org=M211057782-9439&vappTemplate=test&catalog=SG_Catalog" \"C:\Users\gayatrib\Desktop\exp\"";
                }
                txtsynx.Text = s;
                OvfClass ovf = new OvfClass();
                eul_chk = ovf.eula_chk("--eula \"" + txtsrc.Text + "\"");//checking whether the manifest file has enduser licence agreement
                if (eul_chk != null)
                {
                    if (log == "")
                    {
                        s = " --acceptAllEulas " + txtsrc.Text.Trim() + " " + txttrg.Text.Trim() + "\\" + txt_f_n1.Text.Trim() + "." + cmbtrg.Text.Trim();
                    }
                    else
                    {
                        s = log + " --acceptAllEulas " + txtsrc.Text.Trim() + " " + txttrg.Text.Trim() + "\\" + txt_f_n1.Text.Trim() + "." + cmbtrg.Text.Trim();
                    }
                    EULA f16 = new EULA(eul_chk, s, s, log);//Opens a new form to show the end user's licence agreement
                    f16.Show();
                }
                else
                {
                    txtres.Text = "Please Wait";
                    if (!backgroundWorker1.IsBusy)
                    {
                        // This method will start the execution asynchronously in the background
                        backgroundWorker1.RunWorkerAsync();
                    }
                }
            }
        }
コード例 #2
0
 //private static OVF_UpldVCD instance;
 ////Function creates only one instance of the form
 //public static OVF_UpldVCD getInstance()
 //{
 //    if (instance == null || instance.IsDisposed)
 //        instance = new OVF_UpldVCD();
 //    else
 //        instance.BringToFront();
 //    return instance;
 //}
 private void btnrun_Click(object sender, EventArgs e)
 {
     progressBar1.Value = 0;
     label9.Text        = "0%";
     btnlog.Visible     = false;
     if (txtsrc.Text == "openFileDialog1" || txtsrc.Text == "")
     {
         MessageBox.Show("Browse the source file");
     }
     else if (txtui.Text == "")
     {
         MessageBox.Show("Please enter the username");
     }
     else if (txtpwd.Text == "")
     {
         MessageBox.Show("Please enter the password");
     }
     else if (txtdtn.Text == "")
     {
         MessageBox.Show("Please enter the destination URL");
     }
     else if (txtcat.Text == "")
     {
         MessageBox.Show("Enter the catalog name");
     }
     else if (txtapp.Text == "")
     {
         MessageBox.Show("Enter the application name");
     }
     else if (chklog.Checked && cmblog.Text == "")
     {
         MessageBox.Show("Please select the logging level");
     }
     else
     {
         //Pulling organization name
         if (txtorg.Text == "" || txtorg.Text == " ")
         {
             output = orgcall();
             if (output == null)
             {
                 MessageBox.Show("Please make sure URL is proper with a '/' at last ");
             }
             else
             {
                 txtorg.Text = output.ToUpper();
             }
         }
         //pulling VDC name
         if (txtvdc.Text == "" || txtvdc.Text == " ")
         {
             vcd = vcdcall();
             if (vcd == null)
             {
                 MessageBox.Show("Please make sure URL is proper with a '/' at last ");
             }
             else
             {
                 txtvdc.Text = vcd.ToLower();
             }
         }
         url = funrem();
         if (chklog.Checked)//Checks whether the logs option is enabled
         {
             log = @"--X:logFile=" + filename + " --X:logLevel=" + cmblog.Text + " ";
             s   = log + "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
             dis = log + "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
         }
         else
         {
             s   = "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
             dis = "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
         }
         txtsynx.Text = dis;
         OvfClass ovf = new OvfClass();
         eul_chk = ovf.eula_chk("--eula \"" + txtsrc.Text + "\"");
         if (eul_chk != null)
         {
             if (log == "")
             {
                 s   = "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
                 dis = "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
             }
             else
             {
                 s   = log + "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
                 dis = log + "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + txtvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + txtcat.Text.Trim() + "\"";
             }
             EULA f16 = new EULA(eul_chk, s, dis, log);
             f16.Show();
         }
         else
         {
             txtres.Text = "Please wait";
             if (!backgroundWorker1.IsBusy)
             {
                 // This method will start the execution asynchronously in the background
                 backgroundWorker1.RunWorkerAsync();
             }
         }
     }
 }
コード例 #3
0
 private void btnrun_Click(object sender, EventArgs e)
 {
     progressBar1.Value = 0;
     label9.Text        = "0%";
     btnlog.Visible     = false;
     if (txtdhi.Text == "")
     {
         MessageBox.Show("Please enter the destination host ID");
     }
     else if (txtds.Text == "")
     {
         MessageBox.Show("Please enter the datastore name");
     }
     else if (txtun.Text == "")
     {
         MessageBox.Show("Please enter the username");
     }
     else if (txtpwd.Text == "")
     {
         MessageBox.Show("Please enter the password");
     }
     else if (chklog.Checked && cmblog.Text == "")
     {
         MessageBox.Show("Please select the logging level");
     }
     else
     {
         if (chklog.Checked)//Checks whether the logs option is enabled
         {
             log = @"--X:logFile=" + filename + " --X:logLevel=" + cmblog.Text + " ";
             s   = log + "-ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://*****:*****@" + txtdhi.Text.Trim();
             dis = log + "-ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://<username>:<password>@" + txtdhi.Text.Trim();
         }
         else
         {
             s   = "-ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://*****:*****@" + txtdhi.Text.Trim();
             dis = "-ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://<username>:<password>@" + txtdhi.Text.Trim();
         }
         //String s = "-ds=" + txtds.Text.Trim() + " \"" + txtsrc.Text.Trim() + "\" " + "vi://*****:*****@" + txtdhi.Text.Trim();
         // ovftool -ds=vsanDatastore "C:\Users\schandramoul\Downloads\t1.ova" vi://root:[email protected]
         txtsynx.Text = dis;
         OvfClass ovf = new OvfClass();
         eul_chk = ovf.eula_chk("--eula \"" + txtsrc.Text + "\"");//checking whether the manifest file has enduser licence agreement
         if (eul_chk != null)
         {
             if (log == "")
             {
                 s   = "--acceptAllEulas -ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://*****:*****@" + txtdhi.Text.Trim();
                 dis = "--acceptAllEulas -ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://<username>:<password>@" + txtdhi.Text.Trim();
             }
             else
             {
                 s   = log + "--acceptAllEulas -ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://*****:*****@" + txtdhi.Text.Trim();
                 dis = log + "--acceptAllEulas -ds=\"" + txtds.Text.Trim() + "\" \"" + txtsrc.Text.Trim() + "\" " + "vi://<username>:<password>@" + txtdhi.Text.Trim();
             }
             EULA f16 = new EULA(eul_chk, s, dis, log);//Opens a new form to show the end user's licence agreement
             f16.Show();
         }
         else
         {
             txtres.Text = "Please wait";
             if (!backgroundWorker1.IsBusy)
             {
                 // This method will start the execution asynchronously in the background
                 backgroundWorker1.RunWorkerAsync();
             }
         }
     }
 }
コード例 #4
0
        //private static OVF_UpldVCD_ondem instance;
        //public static OVF_UpldVCD_ondem getInstance()
        //{
        //    if (instance == null || instance.IsDisposed)
        //        instance = new OVF_UpldVCD_ondem();
        //    else
        //        instance.BringToFront();
        //    return instance;
        //}

        private void btnrun_Click(object sender, EventArgs e)
        {
            if (txtsrc.Text == "openFileDialog1" || txtsrc.Text == "")
            {
                MessageBox.Show("Browse the source file");
            }
            else if (txtui.Text == "")
            {
                MessageBox.Show("Please enter the username");
            }
            else if (txtpwd.Text == "")
            {
                MessageBox.Show("Please enter the password");
            }
            else if (txtdtn.Text == "")
            {
                MessageBox.Show("Please enter the destination URL");
            }
            else if (cmbcat.Text == "")
            {
                MessageBox.Show("Please select the catalog name");
            }
            else if (cmbvdc.Text == "")
            {
                MessageBox.Show("Please select the VDC");
            }
            else if (txtapp.Text == "")
            {
                MessageBox.Show("Enter the application name");
            }
            else if (chklog.Checked && cmblog.Text == "")
            {
                MessageBox.Show("Please select the logging level");
            }
            else if (txtorg.Text == "")
            {
                MessageBox.Show("Please Enter the org name");
            }
            else if (cmbcat.Text == "")
            {
                MessageBox.Show("Please select the Catalog name");
            }
            else if (cmbvdc.Text == "")
            {
                MessageBox.Show("Please select VDC name");
            }
            else
            {
                url = funrem();
                if (chklog.Checked)
                {
                    log = @"--X:logFile=C:\Users\Public\upload.log --X:logLevel=" + cmblog.Text + " ";
                    s   = log + "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                    dis = log + "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                }
                else
                {
                    s   = "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                    dis = "--sourceType=\"OVF\" \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                    //ovftool--sourceType = "OVF" "C:\Users\schandramoul\Desktop\trial\dep.ovf" "vcloud://[email protected]:[email protected]?vdc=SG_VDC&org=59f0cba9-c9f0-4466-b9a2-4a17cb9523e6&vappTemplate=SG1_temp&catalog=SG_Catalog_ondem"
                }
                txtsynx.Text = dis;
                OvfClass ovf = new OvfClass();
                eul_chk = ovf.eula_chk("--eula \"" + txtsrc.Text + "\"");
                if (eul_chk != null)
                {
                    if (log == "")
                    {
                        s   = "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                        dis = "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                    }
                    else
                    {
                        s   = log + "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://" + txtui.Text.Trim() + ":" + txtpwd.Text.Trim() + "@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                        dis = log + "--sourceType=\"OVF\" --acceptAllEulas \"" + txtsrc.Text.Trim() + "\" \"vcloud://<username>:<password>@" + url + "?vdc=" + cmbvdc.Text.Trim() + "&org=" + txtorg.Text.Trim() + "&vappTemplate=" + txtapp.Text.Trim() + "&catalog=" + cmbcat.Text.Trim() + "\"";
                    }
                    EULA f16 = new EULA(eul_chk, s, dis, log);
                    f16.Show();
                }
                else
                {
                    txtres.Text = "Please wait";
                    if (!backgroundWorker1.IsBusy)
                    {
                        // This method will start the execution asynchronously in the background
                        backgroundWorker1.RunWorkerAsync();
                    }
                }
            }
        }