Esempio n. 1
0
        private Image GetResourceIcon(DictObj resource)
        {
            if (((ListObj)resource[SEBSettings.KeyAdditionalResourcesResourceIcons]).Count > 0)
            {
                var icon =
                    (DictObj)((ListObj)resource[SEBSettings.KeyAdditionalResourcesResourceIcons])[0];
                var memoryStream =
                    _fileCompressor.DeCompressAndDecode(
                        (string)icon[SEBSettings.KeyAdditionalResourcesResourceIconsIconData]);
                return(Image.FromStream(memoryStream));
            }

            return(Resources.resource);
        }
Esempio n. 2
0
        private void treeViewAdditionalResources_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DictObj selectedResource = GetSelectedResource();

            if (selectedResource != null)
            {
                textBoxAdditionalResourcesTitle.Text       = (string)selectedResource[SEBSettings.KeyAdditionalResourcesTitle];
                checkBoxAdditionalResourceActive.Checked   = (bool)selectedResource[SEBSettings.KeyAdditionalResourcesActive];
                textBoxAdditionalResourceUrl.Text          = (string)selectedResource[SEBSettings.KeyAdditionalResourcesUrl];
                checkBoxAdditionalResourceAutoOpen.Checked = (bool)selectedResource[SEBSettings.KeyAdditionalResourcesAutoOpen];
                textBoxLinkURL.Text          = (string)selectedResource[SEBSettings.KeyAdditionalResourcesLinkUrl];
                textBoxRefererFilter.Text    = (string)selectedResource[SEBSettings.KeyAdditionalResourcesRefererFilter];
                checkBoxResetSession.Checked = (bool)selectedResource[SEBSettings.KeyAdditionalResourcesResetSession];
                textBoxKey.Text            = (string)selectedResource[SEBSettings.KeyAdditionalResourcesKey];
                checkBoxConfirm.Checked    = (bool)selectedResource[SEBSettings.KeyAdditionalResourcesConfirm];
                textBoxConfirmBoxText.Text = (string)selectedResource[SEBSettings.KeyAdditionalResourcesConfirmText];
                checkBoxShowButton.Checked = (bool)selectedResource[SEBSettings.KeyAdditionalResourcesShowButton];

                comboBoxModifiers.SelectedItem = string.IsNullOrEmpty((string)selectedResource[SEBSettings.KeyAdditionalResourcesModifiers]) ? null : (string)selectedResource[SEBSettings.KeyAdditionalResourcesModifiers];

                InitializeUrlFilters(selectedResource);

                if (!string.IsNullOrEmpty((string)selectedResource[SEBSettings.KeyAdditionalResourcesResourceData]))
                {
                    buttonAdditionalResourceRemoveResourceData.Visible     = true;
                    buttonAdditionalResourceEmbededResourceOpen.Visible    = true;
                    labelAdditionalResourcesResourceDataLaunchWith.Visible = true;
                    labelAdditionalResourcesFilename.Visible = true;
                    comboBoxAdditionalResourcesResourceDataLauncher.Visible = true;
                    textBoxAdditionalResourceUrl.Enabled = false;
                    comboBoxAdditionalResourcesChooseFileToLaunch.Visible = true;
                    comboBoxAdditionalResourcesChooseFileToLaunch.Enabled = false;

                    var indexBefore = (int)selectedResource[SEBSettings.KeyAdditionalResourcesResourceDataLauncher];
                    comboBoxAdditionalResourcesResourceDataLauncher.DataSource    = GetLaunchers();
                    comboBoxAdditionalResourcesResourceDataLauncher.SelectedIndex = indexBefore;
                    comboBoxAdditionalResourcesChooseFileToLaunch.Text            =
                        selectedResource[SEBSettings.KeyAdditionalResourcesResourceDataFilename].ToString();
                }
                else
                {
                    buttonAdditionalResourceRemoveResourceData.Visible     = false;
                    buttonAdditionalResourceEmbededResourceOpen.Visible    = false;
                    labelAdditionalResourcesResourceDataLaunchWith.Visible = false;
                    labelAdditionalResourcesFilename.Visible = false;
                    comboBoxAdditionalResourcesResourceDataLauncher.Visible = false;
                    textBoxAdditionalResourceUrl.Enabled = true;
                    comboBoxAdditionalResourcesChooseFileToLaunch.Visible = false;
                }

                if (!string.IsNullOrEmpty((string)selectedResource[SEBSettings.KeyAdditionalResourcesUrl]))
                {
                    buttonAdditionalResourceChooseEmbededResource.Enabled = false;
                }
                else
                {
                    buttonAdditionalResourceChooseEmbededResource.Enabled = true;
                }

                if (((ListObj)selectedResource[SEBSettings.KeyAdditionalResourcesResourceIcons]).Count > 0)
                {
                    var icon =
                        (DictObj)((ListObj)selectedResource[SEBSettings.KeyAdditionalResourcesResourceIcons])[0];
                    var memoryStream =
                        _fileCompressor.DeCompressAndDecode(
                            (string)icon[SEBSettings.KeyAdditionalResourcesResourceIconsIconData]);
                    var image = Image.FromStream(memoryStream);
                    pictureBoxAdditionalResourceIcon.Image = image;
                }
                else
                {
                    pictureBoxAdditionalResourceIcon.Image = null;
                }
            }
            groupBoxAdditionalResourceDetails.Visible = selectedResource != null;
        }