Esempio n. 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (cboChannelname.SelectedIndex == 0)
            {
                if (lstView.SelectedItems.Count > 0)
                {
                    string kata = lstView.SelectedItems[0].SubItems[1].Text.ToString();
                    string Arti = lstView.SelectedItems[0].SubItems[2].Text.ToString();
                    string Show = lstView.SelectedItems[0].SubItems[3].Text.ToString();

                    clsKata item = UpdateKata(kata, 0);
                    item.KATA = txtkata.Text;
                    item.ARTI = txtArti.Text;
                    item.SHOW = txtShow.Text;

                    cboChannelname_SelectedIndexChanged(null, null);
                }
            }
            else
            {
                if (lstView.SelectedItems.Count > 0)
                {
                    string kata = lstView.SelectedItems[0].SubItems[1].Text.ToString();
                    string Arti = lstView.SelectedItems[0].SubItems[2].Text.ToString();
                    string Show = lstView.SelectedItems[0].SubItems[3].Text.ToString();

                    clsKata item = UpdateKata(kata, 1);
                    item.KATA = txtkata.Text;
                    item.ARTI = txtArti.Text;
                    item.SHOW = txtShow.Text;

                    cboChannelname_SelectedIndexChanged(null, null);
                }
            }
        }
Esempio n. 2
0
        public clsKata UpdateKata(string kata, int nType)
        {
            clsKata item = new clsKata();

            if (nType == 0)
            {
                for (int i = 0; i < lstkata1.Count; i++)
                {
                    if (kata == lstkata1[i].KATA)
                    {
                        item = lstkata1[i];
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < lstKata2.Count; i++)
                {
                    if (kata == lstKata2[i].KATA)
                    {
                        item = lstKata2[i];
                        break;
                    }
                }
            }
            return(item);
        }
Esempio n. 3
0
        void LoadReadKata(string strPath, int nListType)
        {
            string strSplit = "";

            using (StreamReader sr = new StreamReader(strPath, Encoding.GetEncoding("euc-kr")))
            {
                strSplit = sr.ReadToEnd();
                sr.Close();
            }
            if (strSplit == "")
            {
                return;
            }

            string strParser = "";

            string[] blocks = strSplit.Split('{', '}');
            for (int i = 0; i < blocks.Length; i++)
            {
                strParser = blocks[i].Trim();
                if (strParser.Length == 1 || strParser.Length == 0)
                {
                    continue;
                }

                clsKata  item = new clsKata();
                string[] rows = strParser.Split(',');
                foreach (string line in rows)
                {
                    string[] value = line.Split(':');
                    string   Name  = value[0].Replace("\"", "").Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    string   key   = value[1].Replace("\"", "").Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();

                    if (Name == "kata")
                    {
                        item.KATA = key;
                    }
                    if (Name == "arti")
                    {
                        item.ARTI = key;
                    }
                    if (Name == "show")
                    {
                        item.SHOW = key;
                    }
                }

                if (nListType == 1)
                {
                    lstkata1.Add(item);
                }
                else
                {
                    lstKata2.Add(item);
                }
            }
        }
Esempio n. 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtkata.Text == "")
            {
                return;
            }
            if (txtArti.Text == "")
            {
                return;
            }
            if (txtShow.Text == "")
            {
                return;
            }

            if (cboChannelname.SelectedIndex == 0)
            {
                if (!FindKata(txtkata.Text, 0))
                {
                    clsKata item = new clsKata();
                    item.KATA = txtkata.Text;
                    item.ARTI = txtArti.Text;
                    item.SHOW = txtShow.Text;
                    lstkata1.Add(item);

                    cboChannelname_SelectedIndexChanged(null, null);
                }
                else
                {
                    MessageBox.Show("이미 존재합니다.");
                }
            }
            else
            {
                if (!FindKata(txtkata.Text, 1))
                {
                    clsKata item = new clsKata();
                    item.KATA = txtkata.Text;
                    item.ARTI = txtArti.Text;
                    item.SHOW = txtShow.Text;
                    lstKata2.Add(item);

                    cboChannelname_SelectedIndexChanged(null, null);
                }
                else
                {
                    MessageBox.Show("이미 존재합니다.");
                }
            }

            txtkata.Text = "";
            txtArti.Text = "";
            txtShow.Text = "";
        }