Пример #1
0
        public static AbstractImageList GetImagesFromNode(XmlDocument doc, XmlNode node)
        {
            AbstractImageList result = new AbstractImageList();

            result.Name = (node.Attributes["Name"] == null) ? "" : node.Attributes["Name"].InnerText;
            int           totalIndex = 0;
            List <string> names      = new List <string>();

            foreach (XmlNode imageNode in node.SelectNodes("*"))
            {
                if (imageNode.Name == "Names")
                {
                    names.Clear();
                    foreach (XmlNode nameNode in imageNode.ChildNodes)
                    {
                        names.Add(nameNode.InnerText);
                    }
                }
                else
                {
                    List <AbstractImage> innerResult = GetImagesFromNodeInner(doc, node, imageNode, names, 0, totalIndex);
                    result.Images.AddRange(innerResult);
                    totalIndex += innerResult.Count;
                }
            }

            if ((string.IsNullOrEmpty(result.Name)) && (result.Images.Count > 0))
            {
                result.Name = result.Images[0].Name;
            }

            return(result);
        }
        private void SetupEntryDropdown(AbstractImageList list = null)
        {
            if (list == null)
            {
                list = GetImageListFromComboBoxItem();
            }

            int    listCount            = list.Count;
            string entryHexFormatString = (listCount > 255) ? "X4" : "X2";

            if (listCount > 1)
            {
                ddl_Entry.Items.Clear();
                for (int index = 0; index < listCount; index++)
                {
                    //string addend = (list[index].Name == null) ? "" : (" - " + list[index].Name);
                    //string name = list.HideEntryIndex ? addend : ((index) + addend);

                    bool   hasVisibleName = !string.IsNullOrEmpty(list[index].Name);
                    bool   hideEntryIndex = list.HideEntryIndex && (hasVisibleName);
                    string name           = string.Format("{0}{1}", (hideEntryIndex ? "" : ((index).ToString(entryHexFormatString) + " - ")), (list[index].Name ?? ""));
                    ddl_Entry.Items.Add(name);
                }
                ddl_Entry.SelectedIndex = 0;

                ddl_Entry.Visible = true;
                lbl_Entry.Visible = true;
            }
            else
            {
                ddl_Entry.Visible = false;
                lbl_Entry.Visible = false;
            }
        }
Пример #3
0
        private void SetupEntryDropdown(AbstractImageList list = null)
        {
            if (list == null)
            {
                list = GetImageListFromComboBoxItem();
            }

            int listCount = list.Count;

            if (listCount > 1)
            {
                ddl_Entry.Items.Clear();
                for (int index = 0; index < listCount; index++)
                {
                    string addend = (list[index].Name == null) ? "" : (" - " + list[index].Name);
                    ddl_Entry.Items.Add((index + 1) + addend);
                }
                ddl_Entry.SelectedIndex = 0;

                ddl_Entry.Visible = true;
                lbl_Entry.Visible = true;
            }
            else
            {
                ddl_Entry.Visible = false;
                lbl_Entry.Visible = false;
            }
        }
Пример #4
0
        public static AbstractImageList GetEffectImages(Stream iso, bool isPsp)
        {
            AbstractImageList result = new AbstractImageList();

            result.Name           = "Effects";
            result.HideEntryIndex = true;

            if (isPsp)
            {
                result.Images.AddRange(GetPSPEffectImages(iso));
            }
            else
            {
                result.Images.AddRange(GetPSXEffectImages(iso));
            }

            return(result);
        }
        public bool ImportEntireFile(string path)
        {
            AbstractImageList list  = GetImageListFromComboBoxItem();
            int           listIndex = (list.Count == 1) ? 0 : ddl_Entry.SelectedIndex;
            AbstractImage abIm      = list[listIndex];
            bool          result    = abIm.ImportEntireFile(iso, path);

            if (abIm.IsEffect)
            {
                Type type = abIm.Sector.GetType();

                if (type == typeof(PatcherLib.Iso.PsxIso.Sectors))
                {
                    list.Images[listIndex] = AllOtherImages.GetPSXEffectImage(iso, abIm.EffectIndex);
                }
                else if ((type == typeof(PatcherLib.Iso.PspIso.Sectors)) || (type == typeof(PatcherLib.Iso.FFTPack.Files)))
                {
                    list.Images[listIndex] = AllOtherImages.GetPSPEffectImage(iso, abIm.EffectIndex);
                }
            }

            RefreshPictureBox(true);
            return(result);
        }
Пример #6
0
        private void SetupEntryDropdown(AbstractImageList list = null)
        {
            if (list == null)
            {
                list = GetImageListFromComboBoxItem();
            }

            int listCount = list.Count;
            if (listCount > 1)
            {
                ddl_Entry.Items.Clear();
                for (int index = 0; index < listCount; index++)
                {
                    string addend = (list[index].Name == null) ? "" : (" - " + list[index].Name);
                    ddl_Entry.Items.Add((index + 1) + addend);
                }
                ddl_Entry.SelectedIndex = 0;

                ddl_Entry.Visible = true;
                lbl_Entry.Visible = true;
            }
            else
            {
                ddl_Entry.Visible = false;
                lbl_Entry.Visible = false;
            }
        }
        public AbstractImage GetImageFromComboBoxItem()
        {
            AbstractImageList list = GetImageListFromComboBoxItem();

            return((list.Count == 1) ? list[0] : list[ddl_Entry.SelectedIndex]);
        }
Пример #8
0
        public static AbstractImageList GetImagesFromNode(XmlDocument doc, XmlNode node)
        {
            AbstractImageList result = new AbstractImageList();
            result.Name = (node.Attributes["Name"] == null) ? "" : node.Attributes["Name"].InnerText;
            int totalIndex = 0;
            List<string> names = new List<string>();

            foreach (XmlNode imageNode in node.SelectNodes("*"))
            {
                if (imageNode.Name == "Names")
                {
                    names.Clear();
                    foreach (XmlNode nameNode in imageNode.ChildNodes)
                    {
                        names.Add(nameNode.InnerText);
                    }
                }
                else
                {
                    List<AbstractImage> innerResult = GetImagesFromNodeInner(doc, node, imageNode, names, 0, totalIndex);
                    result.Images.AddRange(innerResult);
                    totalIndex += innerResult.Count;
                }
            }

            if ((string.IsNullOrEmpty(result.Name)) && (result.Images.Count > 0))
                result.Name = result.Images[0].Name;

            return result;
        }