Exemplo n.º 1
0
        public static string GetDenoiseLines(bool denoise, DenoiseFilterType type)
        {
            string denoiseLines = "#denoise";
            string strPath      = "";

            if (denoise)
            {
                EnumProxy p = EnumProxy.Create(type);
                if (p.Tag != null)
                {
                    if (p.Tag.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture).Contains("undot"))
                    {
                        strPath = "LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "UnDot.dll") + "\")\r\n";
                    }
                    else if (p.Tag.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture).Contains("fluxsmoothst"))
                    {
                        strPath = "LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "FluxSmooth.dll") + "\")\r\n";
                    }
                    else if (p.Tag.ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture).Contains("convolution3d"))
                    {
                        strPath = "LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "Convolution3DYV12.dll") + "\")\r\n";
                    }
                    denoiseLines = string.Format(strPath + p.Tag + " # " + p);
                }
                else
                {
                    denoiseLines = "#denoise - " + p;
                }
            }
            return(denoiseLines);
        }
Exemplo n.º 2
0
        public static string GetNvDeInterlacerLine(bool deint, NvDeinterlacerType type)
        {
            string nvDeInterlacerLine = "";

            if (deint)
            {
                EnumProxy p = EnumProxy.Create(type);
                if (p.Tag != null)
                {
                    nvDeInterlacerLine = p.Tag.ToString();
                }
            }
            return(nvDeInterlacerLine);
        }
Exemplo n.º 3
0
        private void listViewDetails_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListViewItem itm = this.listViewDetails.Items[e.Index];

            // Do not allow checking if there are no updates or it is set to ignore.
            if (itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString()) ||
                itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.UpdateIgnored).ToString()) ||
                itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.Disabled).ToString()))
            {
                e.NewValue = CheckState.Unchecked;
            }

            iUpgradeable file = MainForm.Instance.UpdateHandler.UpdateData.FindByName(itm.Name);

            if (e.NewValue == CheckState.Checked)
            {
                file.DownloadChecked = file.AllowUpdate = true;
            }
            else
            {
                file.DownloadChecked = false;
            }

            if (e.NewValue == CheckState.Unchecked &&
                itm.SubItems["Status"].Text.Equals(EnumProxy.Create(PackageStatus.Reinstall).ToString()))
            {
                ProgramSettings pSettings = UpdateCacher.GetPackage(itm.Name);
                if (pSettings != null && !pSettings.UpdateAllowed())
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.Disabled).ToString();
                }
                else if (!file.isAvailable())
                {
                    e.NewValue           = CheckState.Checked;
                    file.DownloadChecked = file.AllowUpdate = true;
                }
                else if (!file.AllowUpdate && file.HasAvailableVersion)
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateIgnored).ToString();
                }
                else if (file.HasAvailableVersion)
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateAvailable).ToString();
                }
                else
                {
                    itm.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString();
                }
            }
        }
Exemplo n.º 4
0
        public static string GetResizeLine(bool resize, int hres, int vres, int hresWithBorder, int vresWithBorder, ResizeFilterType type, bool crop, CropValues cropValues, int originalHRes, int originalVRes)
        {
            int iInputHresAfterCrop = originalHRes;
            int iInputVresAfterCrop = originalVRes;

            if (crop)
            {
                iInputHresAfterCrop = iInputHresAfterCrop - cropValues.left - cropValues.right;
                iInputVresAfterCrop = iInputVresAfterCrop - cropValues.top - cropValues.bottom;
            }

            // only resize if necessary
            if (!resize || (hres == iInputHresAfterCrop && vres == iInputVresAfterCrop))
            {
                if (hresWithBorder > iInputHresAfterCrop || vresWithBorder > iInputVresAfterCrop)
                {
                    return(string.Format("AddBorders({0},{1},{2},{3})",
                                         Math.Floor((hresWithBorder - iInputHresAfterCrop) / 2.0), Math.Floor((vresWithBorder - iInputVresAfterCrop) / 2.0),
                                         Math.Ceiling((hresWithBorder - iInputHresAfterCrop) / 2.0), Math.Ceiling((vresWithBorder - iInputVresAfterCrop) / 2.0)));
                }
                else
                {
                    return("#resize");
                }
            }

            EnumProxy p = EnumProxy.Create(type);

            if (p.Tag != null)
            {
                if (hresWithBorder > hres || vresWithBorder > vres)
                {
                    return(string.Format(p.Tag + ".AddBorders({3},{4},{5},{6}) # {2}", hres, vres, p,
                                         Math.Floor((hresWithBorder - hres) / 2.0), Math.Floor((vresWithBorder - vres) / 2.0),
                                         Math.Ceiling((hresWithBorder - hres) / 2.0), Math.Ceiling((vresWithBorder - vres) / 2.0)));
                }
                else
                {
                    return(string.Format(p.Tag + " # {2}", hres, vres, p));
                }
            }
            else
            {
                return("#resize - " + p);
            }
        }
Exemplo n.º 5
0
        public static string GetResizeLine(bool resize, int hres, int vres, ResizeFilterType type)
        {
            if (!resize)
            {
                return("#resize");
            }
            EnumProxy p = EnumProxy.Create(type);

            if (p.Tag != null)
            {
                return(string.Format(p.Tag + " # {2}", hres, vres, p));
            }
            else
            {
                return("#resize - " + p);
            }
        }
Exemplo n.º 6
0
        public static string GetDenoiseLines(bool denoise, DenoiseFilterType type)
        {
            string denoiseLines = "#denoise";

            if (denoise)
            {
                EnumProxy p = EnumProxy.Create(type);
                if (p.Tag != null)
                {
                    denoiseLines = string.Format(p.Tag + " # " + p);
                }
                else
                {
                    denoiseLines = "#denoise - " + p;
                }
            }
            return(denoiseLines);
        }
Exemplo n.º 7
0
        private void setIgnoreValue_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem ts = (ToolStripMenuItem)sender;

            foreach (ListViewItem item in listViewDetails.SelectedItems)
            {
                ProgramSettings pSettings = UpdateCacher.GetPackage(item.Name);
                iUpgradeable    file      = MainForm.Instance.UpdateHandler.UpdateData.FindByName(item.Name);
                Version         latest    = file.AvailableVersion;
                file.AllowUpdate = !(ts.Checked);

                if (pSettings != null && !pSettings.UpdateAllowed())
                {
                    item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.Disabled).ToString();
                    item.Checked = false;
                }
                else if (!file.isAvailable())
                {
                    item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.Reinstall).ToString();
                    item.Checked     = true;
                    file.AllowUpdate = true;
                }
                else if (latest != null && file.CurrentVersion == null || latest.CompareTo(file.CurrentVersion) != 0)
                {
                    if (!file.AllowUpdate)
                    {
                        item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateIgnored).ToString();
                        item.Checked = false;
                    }
                    else
                    {
                        item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.UpdateAvailable).ToString();
                        item.Checked = true;
                    }
                }
                else
                {
                    item.SubItems["Status"].Text = EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString();
                    item.Checked = false;
                }
            }
        }
Exemplo n.º 8
0
        public static string GetResizeLine(bool resize, int hres, int vres, int hresWithBorder, int vresWithBorder, ResizeFilterType type, bool crop, CropValues cropValues, int originalHRes, int originalVRes)
        {
            int iInputHresAfterCrop = originalHRes;
            int iInputVresAfterCrop = originalVRes;

            if (crop)
            {
                iInputHresAfterCrop = iInputHresAfterCrop - cropValues.left - cropValues.right;
                iInputVresAfterCrop = iInputVresAfterCrop - cropValues.top - cropValues.bottom;
            }

            // only resize if necessary
            if (!resize || (hres == iInputHresAfterCrop && vres == iInputVresAfterCrop))
            {
                if (hresWithBorder > iInputHresAfterCrop || vresWithBorder > iInputVresAfterCrop)
                {
                    return(getAddBorders(hres, vres, hresWithBorder, vresWithBorder));
                }
                else
                {
                    return("#resize");
                }
            }

            EnumProxy p = EnumProxy.Create(type);

            if (p.Tag != null)
            {
                if (hresWithBorder > hres || vresWithBorder > vres)
                {
                    return(string.Format(p.Tag + "." + getAddBorders(hres, vres, hresWithBorder, vresWithBorder) + " # {2}", hres, vres, p));
                }
                else
                {
                    return(string.Format(p.Tag + " # {2}", hres, vres, p));
                }
            }
            else
            {
                return("#resize - " + p);
            }
        }
Exemplo n.º 9
0
            public ListViewItem CreateListViewItem()
            {
                ListViewItem myitem = new ListViewItem();

                ListViewItem.ListViewSubItem name            = new ListViewItem.ListViewSubItem();
                ListViewItem.ListViewSubItem existingVersion = new ListViewItem.ListViewSubItem();
                ListViewItem.ListViewSubItem latestVersion   = new ListViewItem.ListViewSubItem();
                ListViewItem.ListViewSubItem existingDate    = new ListViewItem.ListViewSubItem();
                ListViewItem.ListViewSubItem latestDate      = new ListViewItem.ListViewSubItem();
                ListViewItem.ListViewSubItem lastUsed        = new ListViewItem.ListViewSubItem();
                ListViewItem.ListViewSubItem status          = new ListViewItem.ListViewSubItem();

                myitem.Name = this.Name;

                name.Name            = "Name";
                existingVersion.Name = "Existing Version";
                latestVersion.Name   = "Latest Version";
                existingDate.Name    = "Existing Date";
                latestDate.Name      = "Latest Date";
                lastUsed.Name        = "Last Used";
                status.Name          = "Status";

                name.Text = this.DisplayName;

                Version v = this.availableVersion;

                if (v != null)
                {
                    latestVersion.Text = v.FileVersion;
                    latestDate.Text    = v.UploadDate.ToShortDateString();
                }
                else
                {
                    latestVersion.Text = "unknown";
                    latestDate.Text    = "unknown";
                }

                if (this.CurrentVersion != null && !String.IsNullOrEmpty(this.CurrentVersion.FileVersion))
                {
                    existingVersion.Text = this.CurrentVersion.FileVersion;
                    if (this.CurrentVersion.UploadDate.Year > 1)
                    {
                        existingDate.Text = this.CurrentVersion.UploadDate.ToShortDateString();
                    }
                    else
                    {
                        existingDate.Text = "N/A";
                    }
                }
                else
                {
                    existingVersion.Text = "N/A";
                    existingDate.Text    = "N/A";
                }

                ProgramSettings pSettings = UpdateCacher.GetPackage(this.name);

                if (pSettings != null && !pSettings.UpdateAllowed())
                {
                    status.Text = EnumProxy.Create(PackageStatus.Disabled).ToString();
                }
                else if (!this.isAvailable())
                {
                    status.Text          = EnumProxy.Create(PackageStatus.Reinstall).ToString();
                    this.DownloadChecked = this.AllowUpdate = true;
                }
                else if (!HasAvailableVersion)
                {
                    if (this.DownloadChecked)
                    {
                        status.Text = EnumProxy.Create(PackageStatus.Reinstall).ToString();
                    }
                    else
                    {
                        status.Text = EnumProxy.Create(PackageStatus.NoUpdateAvailable).ToString();
                    }
                }
                else
                {
                    if (this.AllowUpdate)
                    {
                        status.Text = EnumProxy.Create(PackageStatus.UpdateAvailable).ToString();
                    }
                    else
                    {
                        status.Text = EnumProxy.Create(PackageStatus.UpdateIgnored).ToString();
                    }
                }

                if (this.AllowUpdate)
                {
                    if (this.DownloadChecked)
                    {
                        myitem.Checked = true;
                    }
                    else
                    {
                        myitem.Checked = false;
                    }
                }

                if (pSettings != null)
                {
                    if (pSettings.LastUsed.Year > 1)
                    {
                        lastUsed.Text = pSettings.LastUsed.ToShortDateString();
                    }
                    else
                    {
                        lastUsed.Text = "N/A";
                    }
                }
                else
                {
                    lastUsed.Text = "---";
                }

                myitem.SubItems.Add(name);
                myitem.SubItems.Add(existingVersion);
                myitem.SubItems.Add(latestVersion);
                myitem.SubItems.Add(existingDate);
                myitem.SubItems.Add(latestDate);
                myitem.SubItems.Add(lastUsed);
                myitem.SubItems.Add(status);
                return(myitem);
            }