getType() public method

get Type from index
public getType ( int index ) : byte
index int index
return byte
Esempio n. 1
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem lvi in listViewEx1.Items)
     {
         if (m_sfo.getType((int)lvi.Tag) == (byte)SFOParser.SFOType.String && lvi.SubItems[1].Text[lvi.SubItems[1].Text.Length - 1] != '\0')
         {
             lvi.SubItems[1].Text += '\0';
         }
         m_sfo.setLabel((int)lvi.Tag, lvi.SubItems[0].Text);
         m_sfo.setValue((int)lvi.Tag, lvi.SubItems[1].Text);
     }
     m_sfo.saveSFO();
     MessageBox.Show(Resources.strings.File_saved);
 }
Esempio n. 2
0
        private void readSFOToListView(SFOParser sfo, ListView lv)
        {
            lv.Items.Clear();
            AttributeToolStripMenuItem.Enabled = false;
            resolutionToolStripMenuItem.Enabled = false;
            audioToolStripMenuItem.Enabled = false;
            m_attribute_lvi = null;
            m_sound_formate_lvi = null;
            m_resolutin_lvi = null;
            for (int i = 0; i < sfo.Length; i++) {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = sfo.getKey(i);
                lvi.Tag = i;
                switch (sfo.getType(i)) {
                    case 0:
                        // lvi.SubItems.Add(BitConverter.ToString((byte[])sfo.getValue(i), 16));
                        lvi.SubItems.Add(Encoding.UTF8.GetString((byte[])sfo.getValue(i)));
                        break;
                    case 2:
                        lvi.SubItems.Add((string)sfo.getValue(i));
                        break;
                    case 4:
                        lvi.SubItems.Add(sfo.getValue(i) + "");
                        break;
                    default:
                        lvi.SubItems.Add("(unknow *NOT BE SAVED*) " + BitConverter.ToString((byte[])sfo.getValue(i), 16));
                        break;
                }

                if (sfo.getKey(i).Equals("ATTRIBUTE")) {
                    m_attribute_lvi = lvi;
                    AttributeToolStripMenuItem.Enabled = true;
                    int attribute = (int)sfo.getValue(i);
                    if ((attribute & PSP3) == PSP3) {
                        toolStripComboBox1.SelectedIndex = 3;
                    } else if ((attribute & PSP2) == PSP2) {
                        toolStripComboBox1.SelectedIndex = 2;
                    } else if ((attribute & PSP1) == PSP1) {
                        toolStripComboBox1.SelectedIndex = 1;
                    } else {
                        toolStripComboBox1.SelectedIndex = 0;
                    }
                }

                if (sfo.getKey(i).Equals("RESOLUTION")) {
                    m_resolutin_lvi = lvi;
                    resolutionToolStripMenuItem.Enabled = true;
                    int res = (int)sfo.getValue(i);
                    SetResolution(res);
                }
                if (sfo.getKey(i).Equals("SOUND_FORMAT")) {
                    m_sound_formate_lvi = lvi;
                    audioToolStripMenuItem.Enabled = true;
                    int snd = (int)sfo.getValue(i);
                    SetSountFormat(snd);
                }
                lv.Items.Add(lvi);
            }
        }
Esempio n. 3
0
        private void readSFOToListView(SFOParser sfo, ListView lv)
        {
            lv.Items.Clear();
            AttributeToolStripMenuItem.Enabled  = false;
            resolutionToolStripMenuItem.Enabled = false;
            audioToolStripMenuItem.Enabled      = false;
            m_attribute_lvi     = null;
            m_sound_formate_lvi = null;
            m_resolutin_lvi     = null;
            for (int i = 0; i < sfo.Length; i++)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = sfo.getKey(i);
                lvi.Tag  = i;
                switch (sfo.getType(i))
                {
                case 0:
                    // lvi.SubItems.Add(BitConverter.ToString((byte[])sfo.getValue(i), 16));
                    lvi.SubItems.Add(Encoding.UTF8.GetString((byte[])sfo.getValue(i)));
                    break;

                case 2:
                    lvi.SubItems.Add((string)sfo.getValue(i));
                    break;

                case 4:
                    lvi.SubItems.Add(sfo.getValue(i) + "");
                    break;

                default:
                    lvi.SubItems.Add("(unknow *NOT BE SAVED*) " + BitConverter.ToString((byte[])sfo.getValue(i), 16));
                    break;
                }

                if (sfo.getKey(i).Equals("ATTRIBUTE"))
                {
                    m_attribute_lvi = lvi;
                    AttributeToolStripMenuItem.Enabled = true;
                    int attribute = (int)sfo.getValue(i);
                    if ((attribute & PSP3) == PSP3)
                    {
                        toolStripComboBox1.SelectedIndex = 3;
                    }
                    else if ((attribute & PSP2) == PSP2)
                    {
                        toolStripComboBox1.SelectedIndex = 2;
                    }
                    else if ((attribute & PSP1) == PSP1)
                    {
                        toolStripComboBox1.SelectedIndex = 1;
                    }
                    else
                    {
                        toolStripComboBox1.SelectedIndex = 0;
                    }
                }

                if (sfo.getKey(i).Equals("RESOLUTION"))
                {
                    m_resolutin_lvi = lvi;
                    resolutionToolStripMenuItem.Enabled = true;
                    int res = (int)sfo.getValue(i);
                    SetResolution(res);
                }
                if (sfo.getKey(i).Equals("SOUND_FORMAT"))
                {
                    m_sound_formate_lvi            = lvi;
                    audioToolStripMenuItem.Enabled = true;
                    int snd = (int)sfo.getValue(i);
                    SetSountFormat(snd);
                }
                lv.Items.Add(lvi);
            }
        }