コード例 #1
0
        /// <summary>
        /// Download button click event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void DownloadSubmit_Click(object sender, RoutedEventArgs e)
        {
            var button = (Button)sender; //Cast sender to button

            button.IsEnabled = false;    //Disable download button

            //Initialize download

            /** Host select **/
            var response = await HostSelect.OpenSelect(listBox, _hosts); //Show list select item and store result in "response"

            button.IsEnabled = true;                                     //Enable download button again.
            listBox.Items.RemoveAt(0);                                   //Removing list item from list.

            //Return if cancelled
            if ((bool)response.TempHostSettings["cancel"])
            {
                return;
            }

            /** Download settings **/
            response.DownloadDestination = Properties.Settings.Default.DownloadFolder; //Set default download folder
            response = await DownlaodSettings.OpenDialog(this, response);              //Open download settings

            //Return if cancelled
            if ((bool)response.TempHostSettings["cancel"])
            {
                return;
            }

            //Set temp folder
            response.TempFileDestination = (Properties.Settings.Default.CustomTempDownloadFolder) ? Properties.Settings.Default.TempDownloadFolder : Properties.Settings.Default.DEFAULT_TempDownloadFolder;

            /** Prepare download **/

            var listItem = new StreamDownloaderControls.UserControls.DownloadListItem()
            {
                Filename       = response.FileName,
                DownloadFolder = response.DownloadDestination,
                DownloadURL    = response.RawURL
            };

            listBox.Items.Add(listItem);

            var downloadContainer = new DownloadContainer(listItem, response);

            await downloadContainer.Initialize();

            downloadContainer.Start();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: RainerRoss/ILEditor
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect Selector;

            //Application.Run(new Splash());

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);

            Config = new Config(CONFIGDIR);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (Password.Decode(IBMi.CurrentSystem.GetValue("password")) == "")
                    {
                        MessageBox.Show("ILEditor has been updated to encrypt local passwords. Please update your password in the Connection Settings.", "Password Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        new Connection().ShowDialog();
                    }

                    Connected = IBMi.Connect();

                    if (Connected)
                    {
                        Application.Run(new Editor());
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            DialogResult Result = MessageBox.Show("Would you like to try and connect again using a plain FTP connection? This will change the systems settings.", "Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (Result == DialogResult.Yes)
                            {
                                IBMi.CurrentSystem.SetValue("useFTPES", "false");
                                Connected = IBMi.Connect();
                                if (Connected)
                                {
                                    Application.Run(new Editor());
                                    IBMi.Disconnect();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: nangs/ILEditor
        static void Main()
        {
            string promptedPassword = "";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect     Selector;
            PasswordPrompt Prompter;

            if (!Directory.Exists(APPDIR))
            {
                Directory.CreateDirectory(APPDIR);
                if (Directory.Exists(SYSTEMSDIR_Old))
                {
                    Directory.Move(SYSTEMSDIR_Old, SYSTEMSDIR);
                }

                if (File.Exists(CONFIGDIR_Old))
                {
                    File.Move(CONFIGDIR_Old, CONFIGFILE);
                }

                if (Directory.Exists(SOURCEDIR_Old))
                {
                    Directory.Move(SOURCEDIR_Old, SOURCEDIR);
                }
            }

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);
            Directory.CreateDirectory(PROJDIR);

            Config = new Config(CONFIGFILE);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (IBMi.CurrentSystem.GetValue("password") == "")
                    {
                        Prompter = new PasswordPrompt(IBMi.CurrentSystem.GetValue("alias"), IBMi.CurrentSystem.GetValue("username"));
                        Prompter.ShowDialog();
                        if (Prompter.Success)
                        {
                            promptedPassword = Prompter.GetResult();
                        }
                    }

                    Connected = IBMi.Connect(Selector.OfflineModeSelected(), promptedPassword);

                    if (Connected)
                    {
                        Application.Run(new Editor());
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            DialogResult Result = MessageBox.Show("Would you like to try and connect again using a plain FTP connection? This will change the systems settings.", "Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (Result == DialogResult.Yes)
                            {
                                IBMi.CurrentSystem.SetValue("useFTPES", "false");
                                Connected = IBMi.Connect(false, promptedPassword);
                                if (Connected)
                                {
                                    Application.Run(new Editor());
                                    IBMi.Disconnect();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: wuchengw/ILEditor
        static void Main()
        {
            string promptedPassword = "";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect     Selector;
            PasswordPrompt Prompter;

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);
            Directory.CreateDirectory(DUMPSDIR);

            Config = new Config(CONFIGFILE);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (IBMi.CurrentSystem.GetValue("password") == "")
                    {
                        Prompter = new PasswordPrompt(IBMi.CurrentSystem.GetValue("alias"), IBMi.CurrentSystem.GetValue("username"));
                        Prompter.ShowDialog();
                        if (Prompter.Success)
                        {
                            promptedPassword = Prompter.GetResult();
                        }
                    }

                    Connected = IBMi.Connect(Selector.OfflineModeSelected(), promptedPassword);

                    if (Connected)
                    {
                        if (Config.GetValue("srcdat_agreement") == "false")
                        {
                            MessageBox.Show("Thanks for using ILEditor. This is a notice to tell you that when editing source members, the SRCDAT value is not retained. This is due to a restriction in our connection method. By using ILEditor you agree to our LICENCE, found on the ILEditor GitHub repository. Please seek ILEditor GitHub issues for further information.", "ILEditor Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Config.SetValue("srcdat_agreement", "true");
                            Config.SaveConfig();
                        }

                        try
                        {
                            Application.Run(new Editor());
                        }
                        catch (Exception e)
                        {
                            File.WriteAllText(Path.Combine(DUMPSDIR, DateTime.Now.ToFileTime() + ".txt"), e.ToString());
                            MessageBox.Show("There was an error. Crash dump created: " + DUMPSDIR);
                        }
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            MessageBox.Show("Failed to connect. Perhaps try disabling FTPES and then connecting again.", "Connection", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }
コード例 #5
0
        static void Main()
        {
            string promptedPassword = "";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect     Selector;
            PasswordPrompt Prompter;

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);
            Directory.CreateDirectory(DUMPSDIR);

            Config = new Config(CONFIGFILE);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (IBMi.CurrentSystem.GetValue("password") == "")
                    {
                        Prompter = new PasswordPrompt(IBMi.CurrentSystem.GetValue("alias"), IBMi.CurrentSystem.GetValue("username"));
                        Prompter.ShowDialog();
                        if (Prompter.Success)
                        {
                            promptedPassword = Prompter.GetResult();
                        }
                    }

                    Connected = IBMi.Connect(Selector.OfflineModeSelected(), promptedPassword);

                    if (Connected)
                    {
                        try
                        {
                            Application.Run(new Editor());
                        }
                        catch (Exception e)
                        {
                            File.WriteAllText(Path.Combine(DUMPSDIR, DateTime.Now.ToFileTime() + ".txt"), e.ToString());
                            MessageBox.Show("There was an error. Crash dump created.");
                        }
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            MessageBox.Show("Failed to connect. Perhaps try disabling FTPES and then connecting again.", "Connection", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }