예제 #1
0
        public Group CreateEntry(string var, string value, string op)
        {
            Group g = new Group();

            g.panel             = new Panel();
            g.panel.BorderStyle = BorderStyle.FixedSingle;

            g.var          = new ExtendedControls.TextBoxBorder();
            g.var.Size     = new Size(120, 24);
            g.var.Location = new Point(panelmargin, panelmargin);
            g.var.Text     = var;
            g.panel.Controls.Add(g.var);
            toolTip1.SetToolTip(g.var, "Variable name");

            int nextpos = g.var.Right;

            if (shownoexpand || showadd)
            {
                g.op          = new ExtendedControls.ComboBoxCustom();
                g.op.Size     = new Size(50, 24);
                g.op.Location = new Point(g.var.Right + 4, panelmargin);

                string ttip = "";
                if (showadd && shownoexpand)
                {
                    g.op.Items.AddRange(new string[] { "=", "$=", "+=", "$+=" });
                    ttip = "= assign, expand, $= assign, no expansion, += add, expand, $+= add, no expansion";
                }
                else if (showadd)
                {
                    g.op.Items.AddRange(new string[] { "=", "+=" });
                    ttip = "= assign, expand, += add, expand";
                }
                else
                {
                    g.op.Items.AddRange(new string[] { "=", "$=" });
                    ttip = "= assign, expand, $= add, no expansion";
                }

                toolTip1.SetToolTip(g.op, ttip);
                toolTip1.SetToolTip(g.op.GetInternalSystemControl, ttip);

                if (g.op.Items.Contains(op))
                {
                    g.op.SelectedItem = op;
                }

                g.panel.Controls.Add(g.op);

                nextpos = g.op.Right;
            }


            g.value            = new ExtendedControls.TextBoxBorder();
            g.value.Location   = new Point(nextpos + 4, panelmargin);
            g.value.Text       = value.ReplaceEscapeControlChars();
            g.value.Multiline  = true;
            g.value.WordWrap   = true;
            g.value.ScrollBars = ScrollBars.Vertical;
            toolTip1.SetToolTip(g.value, "Variable value");
            g.panel.Controls.Add(g.value);

            g.del        = new ExtendedControls.ButtonExt();
            g.del.Size   = new Size(24, 24);
            g.del.Text   = "X";
            g.del.Tag    = g;
            g.del.Click += Del_Clicked;
            toolTip1.SetToolTip(g.del, "Delete entry");
            g.panel.Controls.Add(g.del);

            groups.Add(g);

            panelVScroll1.Controls.Add(g.panel);
            theme.ApplyToControls(g.panel, SystemFonts.DefaultFont);

            FixUpGroups();

            return(g);
        }
예제 #2
0
        void ReadyToDisplay()
        {
            panelVScroll.RemoveAllControls(new List <Control>()
            {
                buttonMore
            });

            mgr = new VersioningManager();

            int[] edversion = System.Reflection.Assembly.GetExecutingAssembly().GetVersion();
            System.Diagnostics.Debug.Assert(edversion != null);

            mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "Actions", "*.act", "Action File");

            if (managedownloadmode)
            {
                mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "Flights", "*.vid", "Video File");
                mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "AddonFiles", "*.inf", "Other Files");

                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "ActionFiles/V1", downloadactfolder, EDDOptions.Instance.AppDataDirectory, "*.act", edversion, "Action File");
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "VideoFiles/V1", downloadflightfolder, EDDOptions.Instance.AppDataDirectory, "*.vid", edversion, "Video File");
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "AddonFiles/V1", downloadaddonfolder, EDDOptions.Instance.AppDataDirectory, "*.inf", edversion, "Other File");

#if DEBUG
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "ActionFiles/Debug", downloadactdebugfolder, EDDOptions.Instance.AppDataDirectory, "*.act", edversion, "Action File");
#endif
            }

            mgr.Sort();

            panelVScroll.SuspendLayout();

            int[] tabs;
            if (managedownloadmode)
            {
                tabs = new int[] { 0, 100, 300, 380, 590, 770, 860, 940 }
            }
            ;
            else
            {
                tabs = new int[] { 0, 100, 300, 380, 590, 590, 740, 840 }
            };

            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[0] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Type"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[1] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Name"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[2] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Version"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[3] + panelleftmargin, panelheightmargin), Size = new Size(120, 24), Text = "Description"
            });
            if (managedownloadmode)
            {
                panelVScroll.Controls.Add(new Label()
                {
                    Location = new Point(tabs[4] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Status"
                });
            }
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[5] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Action"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[6] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Delete"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[7] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Enabled"
            });

            int vpos = panelheightmargin + 30;

            foreach (VersioningManager.DownloadItem di in mgr.downloaditems)
            {
                Group g = new Group();
                g.di                = di;
                g.panel             = new Panel();
                g.panel.BorderStyle = BorderStyle.FixedSingle;
                g.panel.Tag         = g;
                g.panel.MouseEnter += MouseEnterControl;

                g.type          = new Label();
                g.type.Location = new Point(tabs[0], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.type.Size     = new Size(tabs[1] - tabs[0], 24);
                g.type.Text     = di.itemtype;
                g.panel.Controls.Add(g.type);

                g.info          = new ExtendedControls.ButtonExt();
                g.info.Location = new Point(tabs[1], labelheightmargin + 2);      // 8 spacing, allow 8*4 to indent
                g.info.Size     = new Size(16, 16);
                g.info.Text     = "i";
                g.info.Click   += Info_Click;
                g.info.Tag      = g;
                g.panel.Controls.Add(g.info);

                g.name          = new Label();
                g.name.Location = new Point(tabs[1] + 18, labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.name.Size     = new Size(tabs[2] - tabs[1] - 18, 24);
                g.name.Text     = di.itemname;
                g.panel.Controls.Add(g.name);

                g.version          = new Label();
                g.version.Location = new Point(tabs[2], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.version.Size     = new Size(tabs[3] - tabs[2], 24);
                g.version.Text     = (di.localversion != null) ? di.localversion.ToString(".") : "N/A";
                g.panel.Controls.Add(g.version);

                g.shortdesc          = new Label();
                g.shortdesc.Location = new Point(tabs[3], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.shortdesc.Size     = new Size(tabs[4] - tabs[3], 24);
                g.shortdesc.Text     = di.ShortLocalDescription;
                if (g.shortdesc.Text.Length == 0)
                {
                    g.shortdesc.Text = "N/A";
                }
                g.panel.Controls.Add(g.shortdesc);

                if (managedownloadmode)
                {
                    string text;
                    if (di.state == VersioningManager.ItemState.EDOutOfDate)
                    {
                        text = "Newer EDD required";
                    }
                    else if (di.state == VersioningManager.ItemState.UpToDate)
                    {
                        text = (di.localmodified) ? "Locally modified" : "Up to Date";
                    }
                    else if (di.state == VersioningManager.ItemState.LocalOnly)
                    {
                        text = "Local Only";
                    }
                    else if (di.state == VersioningManager.ItemState.NotPresent)
                    {
                        text = "Version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                    }
                    else
                    {
                        text = "New version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                    }

                    g.actionlabel          = new Label();
                    g.actionlabel.Location = new Point(tabs[4], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                    g.actionlabel.Size     = new Size(tabs[5] - tabs[4], 24);
                    g.actionlabel.Text     = text;
                    g.panel.Controls.Add(g.actionlabel);

                    if (text.Contains("ersion"))        // cheap and nasty way
                    {
                        g.actionbutton          = new ExtendedControls.ButtonExt();
                        g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                        g.actionbutton.Size     = new Size(80, 24);
                        g.actionbutton.Text     = (di.state == VersioningManager.ItemState.NotPresent) ? "Install" : "Update";
                        g.actionbutton.Click   += Actionbutton_Click;
                        g.actionbutton.Tag      = g;
                        g.panel.Controls.Add(g.actionbutton);
                    }
                }
                else
                {
                    bool loaded = CheckActionLoaded != null?CheckActionLoaded(g.di.itemname) : false;

                    if (loaded)     // may not be loaded IF its got an error.
                    {
                        g.actionbutton          = new ExtendedControls.ButtonExt();
                        g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                        g.actionbutton.Size     = new Size(80, 24);
                        g.actionbutton.Text     = "Edit";
                        g.actionbutton.Click   += ActionbuttonEdit_Click;
                        g.actionbutton.Tag      = g;
                        g.panel.Controls.Add(g.actionbutton);
                    }
                }

                if (di.HasLocalCopy)
                {
                    g.deletebutton          = new ExtendedControls.ButtonExt();
                    g.deletebutton.Location = new Point(tabs[6], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.deletebutton.Size     = new Size(24, 24);
                    g.deletebutton.Text     = "X";
                    g.deletebutton.Click   += Deletebutton_Click;
                    g.deletebutton.Tag      = g;
                    g.panel.Controls.Add(g.deletebutton);
                }

                if (di.localenable.HasValue)
                {
                    g.enabled          = new ExtendedControls.CheckBoxCustom();
                    g.enabled.Location = new Point(tabs[7], labelheightmargin);
                    g.enabled.Size     = new Size(100, 20);
                    g.enabled.Text     = "Enabled";
                    g.enabled.Checked  = di.localenable.Value;
                    g.enabled.Click   += Enabled_Click;
                    g.enabled.Tag      = g;
                    g.panel.Controls.Add(g.enabled);
                }

                int panelwidth = Math.Max(panelVScroll.Width - panelVScroll.ScrollBarWidth, 10) - panelleftmargin * 2;

                g.panel.Location = new Point(panelleftmargin, vpos);
                g.panel.Size     = new Size(panelwidth, 32);

                vpos += g.panel.Height + 4;

                panelVScroll.Controls.Add(g.panel);
            }

            buttonMore.Location = new Point(panelleftmargin, vpos);

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            if (theme != null)
            {
                theme.ApplyToControls(panelVScroll, font);
            }

            panelVScroll.ResumeLayout();
        }

        bool infoclicked = false;
예제 #3
0
        void ReadyToDisplay()
        {
            panelVScroll.RemoveAllControls();

            mgr = new VersioningManager();

            int[] edversion = ObjectExtensionsNumbersBool.GetEDVersion();
            System.Diagnostics.Debug.Assert(edversion != null);

            mgr.ReadLocalFiles(Tools.GetAppDataDirectory(), "Actions", "*.act", "Action File");
            mgr.ReadInstallFiles(downloadactfolder, Tools.GetAppDataDirectory(), "*.act", edversion, "Action File");

#if DEBUG
            mgr.ReadInstallFiles(downloadactdebugfolder, Tools.GetAppDataDirectory(), "*.act", edversion, "Action File");
#endif

            mgr.ReadLocalFiles(Tools.GetAppDataDirectory(), "Flights", "*.vid", "Video File");
            mgr.ReadInstallFiles(downloadflightfolder, Tools.GetAppDataDirectory(), "*.vid", edversion, "Video File");

            mgr.Sort();

            panelVScroll.SuspendLayout();

            int[] tabs = { 0, 100, 260, 340, 550, 730, 820, 900 };

            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[0] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Type"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[1] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Name"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[2] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Version"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[3] + panelleftmargin, panelheightmargin), Size = new Size(120, 24), Text = "Description"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[4] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Status"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[5] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Action"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[6] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Delete"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[7] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Enabled"
            });

            int vpos = panelheightmargin + 30;

            foreach (VersioningManager.DownloadItem di in mgr.downloaditems)
            {
                Group g = new Group();
                g.di                = di;
                g.panel             = new Panel();
                g.panel.BorderStyle = BorderStyle.FixedSingle;
                g.panel.Tag         = g;
                g.panel.MouseEnter += MouseEnterControl;

                g.type          = new Label();
                g.type.Location = new Point(tabs[0], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.type.Size     = new Size(tabs[1] - tabs[0], 24);
                g.type.Text     = di.itemtype;
                g.panel.Controls.Add(g.type);

                g.info          = new ExtendedControls.ButtonExt();
                g.info.Location = new Point(tabs[1], labelheightmargin + 2);      // 8 spacing, allow 8*4 to indent
                g.info.Size     = new Size(16, 16);
                g.info.Text     = "i";
                g.info.Click   += Info_Click;
                g.info.Tag      = g;
                g.panel.Controls.Add(g.info);

                g.name          = new Label();
                g.name.Location = new Point(tabs[1] + 18, labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.name.Size     = new Size(tabs[2] - tabs[1] - 18, 24);
                g.name.Text     = di.itemname;
                g.panel.Controls.Add(g.name);

                g.version          = new Label();
                g.version.Location = new Point(tabs[2], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.version.Size     = new Size(tabs[3] - tabs[2], 24);
                g.version.Text     = (di.localversion != null) ? di.localversion.ToString(".") : "N/A";
                g.panel.Controls.Add(g.version);

                g.shortdesc          = new Label();
                g.shortdesc.Location = new Point(tabs[3], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.shortdesc.Size     = new Size(tabs[4] - tabs[3], 24);
                g.shortdesc.Text     = di.ShortLocalDescription;
                if (g.shortdesc.Text.Length == 0)
                {
                    g.shortdesc.Text = "N/A";
                }
                g.panel.Controls.Add(g.shortdesc);

                string text;
                if (di.state == VersioningManager.ItemState.EDOutOfDate)
                {
                    text = "Newer EDD required";
                }
                else if (di.state == VersioningManager.ItemState.UpToDate)
                {
                    text = (di.localmodified) ? "Locally modified" : "Up to Date";
                }
                else if (di.state == VersioningManager.ItemState.LocalOnly)
                {
                    text = "Local Only";
                }
                else if (di.state == VersioningManager.ItemState.NotPresent)
                {
                    text = "Version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                }
                else
                {
                    text = "New version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                }

                g.actionlabel          = new Label();
                g.actionlabel.Location = new Point(tabs[4], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.actionlabel.Size     = new Size(tabs[5] - tabs[4], 24);
                g.actionlabel.Text     = text;
                g.panel.Controls.Add(g.actionlabel);

                if (text.Contains("ersion"))        // cheap and nasty way
                {
                    g.actionbutton          = new ExtendedControls.ButtonExt();
                    g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.actionbutton.Size     = new Size(80, 24);
                    g.actionbutton.Text     = (di.state == VersioningManager.ItemState.NotPresent) ? "Install" : "Update";
                    g.actionbutton.Click   += Actionbutton_Click;
                    g.actionbutton.Tag      = g;
                    g.panel.Controls.Add(g.actionbutton);
                }

                if (di.HasLocalCopy)
                {
                    g.deletebutton          = new ExtendedControls.ButtonExt();
                    g.deletebutton.Location = new Point(tabs[6], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.deletebutton.Size     = new Size(24, 24);
                    g.deletebutton.Text     = "X";
                    g.deletebutton.Click   += Deletebutton_Click;
                    g.deletebutton.Tag      = g;
                    g.panel.Controls.Add(g.deletebutton);
                }

                if (di.localenable.HasValue)
                {
                    g.enabled          = new ExtendedControls.CheckBoxCustom();
                    g.enabled.Location = new Point(tabs[7], labelheightmargin);
                    g.enabled.Size     = new Size(100, 20);
                    g.enabled.Text     = "Enabled";
                    g.enabled.Checked  = di.localenable.Value;
                    g.enabled.Click   += Enabled_Click;
                    g.enabled.Tag      = g;
                    g.panel.Controls.Add(g.enabled);
                }

                int panelwidth = Math.Max(panelVScroll.Width - panelVScroll.ScrollBarWidth, 10) - panelleftmargin * 2;

                g.panel.Location = new Point(panelleftmargin, vpos);
                g.panel.Size     = new Size(panelwidth, 32);

                vpos += g.panel.Height + 4;

                panelVScroll.Controls.Add(g.panel);
            }

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            if (theme != null)
            {
                theme.ApplyToControls(panelVScroll, font);
            }

            panelVScroll.ResumeLayout();
        }