Ejemplo n.º 1
0
        private void update_changingVersions()
        {
            string url = "http://tdf.io/siguidlinfo" + (set.program_version().EndsWith("ing") /*testing versions*/ ? "beta" : "");

            System.Net.WebClient wc   = downloader.getPreparedWebClient();
            string[]             info = wc.DownloadString(url).Replace("\r\n", "\n").Split(new char[] { '\n' });
            dlInfos = ChangingDLInfo.Parse(info);
        }
Ejemplo n.º 2
0
        private void loadsettings()
        {
            try
            {
                SETTINGS toapply = set.open_settings();
                //Apply settings
                cb_subfolder.Checked = toapply.cb_create_subfolder;
                downloader.setEasyFileNames(!toapply.cb_advanced_filenames);
                path_installdir.Text      = toapply.FilesFolders.InstallFolder;
                subfolder.Text            = toapply.FilesFolders.nameSubfolder;
                choose_lang.SelectedIndex = toapply.lang;
                path_to_exe.Text          = toapply.FilesFolders.lastSofficeEXE;
                path_main.Text            = toapply.FilesFolders.MainInstalldir;
                path_help.Text            = toapply.FilesFolders.HelpInstalldir;
                path_sdk.Text             = toapply.FilesFolders.SDKInstalldir;
                dl_list = toapply.DL_saved_settings.versions;
                if (dl_list == null)
                {
                    dl_list = new string[0];
                }
                dlInfos = toapply.DL_saved_settings.changingVersion;
                if (dlInfos == null)
                {
                    dlInfos = new ChangingDLInfo[0];
                }

                loadVersionstoList();
                try
                {
                    dl_versions.SelectedIndex = toapply.DL_saved_settings.versions_last_version;
                }
                catch (Exception)
                { }
                setInstallerSelected(toapply.DL_saved_settings.cb_installer);
                setHelpSelected(toapply.DL_saved_settings.cb_help);
                setSDKSelected(toapply.DL_saved_settings.cb_sdk);
            }
            catch (Exception e)
            { MessageBox.Show(e.Message); }
        }
Ejemplo n.º 3
0
        private void start_dl_Click(object sender, EventArgs e)
        {
            bool dl_allowed = (!downloader.isEasyFileNames() || progressBar.Value == 0) && (isInstallerSelected() || isHelpSelected() || isSDKSelected());

            if (!dl_allowed)
            {
                if (!(isHelpSelected() || isInstallerSelected() || isSDKSelected()))
                {
                    exceptionmessage(getstring("dl_forbidded_selection"));
                }
                else if (downloader.isEasyFileNames() && downloader.isDownloading())
                {
                    exceptionmessage(getstring("dl_forbidded_easyNames"));
                }
                else
                {
                    string debuginfo = "dl_allowed=false;progressbar.Value=" + progressBar.Value + "[checkstates|sdk:" + isSDKSelected() + "|help" + isHelpSelected() + "|Main" + isInstallerSelected() + "]";
                    exceptionmessage(getstring("dl_forbidden_other").Replace("%s", debuginfo));
                }
                return;
            }
            if (dl_versions.SelectedItem != null)
            {
                try
                {
                    int index = dl_versions.SelectedIndex;
                    if ((index == versionsFixed || (index == (versionsFixed + dlInfos.Length + 1))))
                    {
                        return;
                    }
                    if (index < versionsFixed)
                    {
                        switch (index)
                        {
                        case (0):
                            // Latest branch
                            if (isInstallerSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.LB, Downloader.Version.MAIN);
                            }
                            if (isHelpSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.LB, Downloader.Version.HP);
                            }
                            if (isSDKSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.LB, Downloader.Version.SDK);
                            }
                            break;

                        case (1):
                            // Older branch
                            if (isInstallerSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.OB, Downloader.Version.MAIN);
                            }
                            if (isHelpSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.OB, Downloader.Version.HP);
                            }
                            if (isSDKSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.OB, Downloader.Version.SDK);
                            }
                            break;

                        case (2):
                            // Testing
                            if (isInstallerSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.T, Downloader.Version.MAIN);
                            }
                            if (isHelpSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.T, Downloader.Version.HP);
                            }
                            if (isSDKSelected())
                            {
                                downloader.startStaticDL(Downloader.Branch.T, Downloader.Version.SDK);
                            }
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        // Selected Thinderboxes
                        if (index <= versionsFixed + dlInfos.Length)
                        {
                            ChangingDLInfo info = dlInfos[index - (versionsFixed + 1)];
                            if (isInstallerSelected())
                            {
                                downloader.downloadAnyVersion(info.url, Downloader.Version.MAIN, Downloader.Branch.M);
                            }
                            if (info.helppackAvailable && isHelpSelected())
                            {
                                downloader.downloadAnyVersion(info.url, Downloader.Version.HP, Downloader.Branch.M);
                            }
                            if (info.sdkAvailable && isSDKSelected())
                            {
                                downloader.downloadAnyVersion(info.url, Downloader.Version.SDK, Downloader.Branch.M);
                            }
                        }
                        else
                        {
                            if (isInstallerSelected())
                            {
                                downloader.startArchiveDownload(dl_versions.SelectedItem.ToString(), Downloader.Version.MAIN);
                            }
                            if (isHelpSelected())
                            {
                                downloader.startArchiveDownload(dl_versions.SelectedItem.ToString(), Downloader.Version.HP);
                            }
                            if (isSDKSelected())
                            {
                                downloader.startArchiveDownload(dl_versions.SelectedItem.ToString(), Downloader.Version.SDK);
                            }
                        }
                    }
                    piwik.sendFeatreUseageStats(TDFPiwik.Features.StartDL);
                }
                catch (DownloadNotAvailableException dnae)
                {
                    if (dnae.getBranch() == Downloader.Branch.T)
                    {
                        MessageBox.Show(getstring("notest_txt"), getstring("notest_ti"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        exceptionmessage(dnae.Message);
                    }
                }
                catch (MissingSettingException mse)
                {
                    exceptionmessage(mse.Message + "[ERR:SETTING_NOTSET]");
                }
            }
        }