Пример #1
0
        private void clone_Click(object sender, EventArgs e)
        {
            List <string> Commands = new List <string>();

            string[] member, path;

            CloneList = new Dictionary <string, string>();
            foreach (ListViewItem listitem in memberList.Items)
            {
                if (listitem.Checked)
                {
                    member = (string[])listitem.Tag;
                    path   = member[0].Split('/');
                    CloneList.Add("/QSYS.lib/" + lib.Text + ".lib/" + path[0] + ".file/" + path[1] + ".mbr", member[1]);
                }
            }

            foreach (string Dir in Directory.GetDirectories(IBMiUtils.GetLocalDir(lib.Text)))
            {
                try
                {
                    Directory.Delete(Dir, true);
                } catch (Exception ex) { }
            }

            foreach (string Dir in LocalSPFs)
            {
                Directory.CreateDirectory(Dir);
            }

            bool isOkay = true;

            foreach (var File in CloneList)
            {
                if (IBMi.DownloadFile(File.Value, File.Key) == true) //Error?
                {
                    isOkay = false;
                    break;
                }
            }

            if (isOkay)
            {
                MessageBox.Show("Source-Physical File cloned sucessfully.", "SPF Clone", MessageBoxButtons.OK, MessageBoxIcon.Information);
                string Location = Program.SOURCEDIR + "\\" + IBMi.CurrentSystem.GetValue("system") + "\\" + lib.Text;
                Process.Start("explorer.exe", "/select, " + Location);
                this.Close();
            }
            else
            {
                MessageBox.Show("There was an error during the clone process.");
            }
        }