예제 #1
0
        public string[] GetAllFontName()
        {
            ArrayList stringlist = new ArrayList();

            for (int i = 0; ; i++)
            {
                StringBuilder sb = new StringBuilder(128);
                FileFolderHelper.ReadIniFile(i.ToString(), "Name", "", sb, 128, file);

                if (sb.ToString() != "")
                {
                    sb.Append(string.Format("({0})", i));
                    stringlist.Add(sb.ToString());
                }
                else
                {
                    break;
                }
            }
            string[] ResultStrings = new string[stringlist.Count];

            for (int i = 0; i < stringlist.Count; i++)
            {
                ResultStrings[i] = stringlist[i].ToString();
            }

            return(ResultStrings);
        }
예제 #2
0
        public int GetFontIDByID(int nID)
        {
            StringBuilder sb = new StringBuilder(128);

            FileFolderHelper.ReadIniFile(nID.ToString(), "FontID", "1", sb, 128, file);
            return(Int32.Parse(sb.ToString()));
        }
예제 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (!m_bImageSupport)
            {
                return;
            }
            //textBox.TextChanged -= new System.EventHandler(this.richTextBox2_TextChanged);
            string filename = FileFolderHelper.BrowserFile(new string[] { "tga", "uitex" });

            if (filename == string.Empty)
            {
                return;
            }

            ImageDialog dlg     = new ImageDialog(filename);
            int         nFrame  = 0;
            int         nWidth  = 0;
            int         nHeight = 0;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (dlg.strFrame != string.Empty)
                {
                    nFrame = Int32.Parse(dlg.strFrame);
                }
                if (dlg.strWidth != string.Empty)
                {
                    nWidth = Int32.Parse(dlg.strWidth);
                }
                if (dlg.strHeight != string.Empty)
                {
                    nHeight = Int32.Parse(dlg.strHeight);
                }
            }

            string retRTF = RTFHelper.GetRTFFromTgaFile(filename, textBox, nFrame);

            textBox.SelectedRtf = retRTF;

            MarkArray[textBox.SelectionStart - 1] = ImageArray.Count + ImageMark;
            filename = filename.Substring(m_Root.Length, filename.Length - m_Root.Length);

            string strW = string.Empty;
            string strH = string.Empty;

            if (nWidth != 0)
            {
                strW = widthMark + nWidth.ToString();
            }
            if (nHeight != 0)
            {
                strH = heightMark + nHeight.ToString();
            }

            string strImageMark = imageMark + filename + frameMark + nFrame.ToString() + strW + strH + frameEndMark;

            ImageArray.Add(strImageMark);
            //textBox.TextChanged += new System.EventHandler(this.richTextBox2_TextChanged);
        }
예제 #4
0
        public string GetColorNameByID(int nID)
        {
            StringBuilder sbColorName = new StringBuilder(128);

            FileFolderHelper.ReadIniFile(nID.ToString(), "Color", "", sbColorName, 128, file);

            return(sbColorName.ToString());
        }
예제 #5
0
        public CustomColor(string ColorFile)
        {
            file = ColorFile;

            string content = FileFolderHelper.FileToString(file);

            ColorTable            = Helper.CreateDataTable(content);
            ColorTable.PrimaryKey = new DataColumn[] { ColorTable.Columns[0] };
        }
예제 #6
0
        public FontCollection GetFontCollectionByID(int nID)
        {
            StringBuilder sb = new StringBuilder(128);

            FileFolderHelper.ReadIniFile(nID.ToString(), "File", "1", sb, 128, file);
            PrivateFontCollection pfc = new PrivateFontCollection();

            pfc.AddFontFile(m_Root.TrimEnd(new char[] { '\\' }) + sb.ToString());
            return(pfc);
        }
예제 #7
0
        public ImageDialog(string filename)
        {
            InitializeComponent();
            m_strFileName = filename;

            int    nPos          = m_strFileName.LastIndexOf('.');
            string strExpandName = m_strFileName.Substring(nPos, m_strFileName.Length - nPos).ToLower();

            listBox1.Items.Clear();
            if (strExpandName == ".tga")
            {
                string itemText = "0 0 0 " + m_strFileName;
                listBox1.Items.Add(itemText);
            }
            else if (strExpandName == ".uitex")
            {
                string    strfile = FileFolderHelper.FileToString(m_strFileName.Substring(0, nPos) + ".txt");
                DataTable dt      = Helper.CreateDataTable(strfile);

                foreach (DataRow row in dt.Rows)
                {
                    string strFrame  = row["Farme"].ToString();
                    string strWidth  = row["Width"].ToString();
                    string strHeight = row["High"].ToString();

                    if (Int32.Parse(strWidth) != 0)
                    {
                        string itemText = strFrame + " " + strWidth + " " + strHeight + " " + row["File"].ToString();
                        listBox1.Items.Add(itemText);
                    }
                }
            }
            else
            {
                MessageBox.Show("不支持的格式");
            }
        }