Exemplo n.º 1
0
        private void browserBtn_Click(object sender, EventArgs e)
        {
            string oldPath     = openFileDialog1.InitialDirectory;
            string oldFileName = openFileDialog1.FileName;

            if (System.IO.File.Exists(textureNamePath_txBx.Text))
            {
                openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName(textureNamePath_txBx.Text);
            }
            else if (textureNamePath_txBx.Tag != null && System.IO.File.Exists((string)textureNamePath_txBx.Tag))
            {
                openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName((string)textureNamePath_txBx.Tag);
            }
            else if (rootPath != null)
            {
                string root = rootPath;

                if (root.Contains("data\\"))
                {
                    root = root.Substring(0, root.IndexOf("data\\"));
                }

                openFileDialog1.InitialDirectory = root + @"src\texture_library";
            }

            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == DialogResult.OK)
            {
                textureNamePath_txBx.Tag = openFileDialog1.FileName;

                textureNamePath_txBx.Text = System.IO.Path.GetFileName(openFileDialog1.FileName);

                ParticalsWin pWin = (ParticalsWin)ownerPanel;

                if (pWin != null)
                {
                    string path = pWin.getTexturePath(textureNamePath_txBx.Text);

                    if (path == null)
                    {
                        pWin.addToTextureDic(openFileDialog1.FileName);
                    }
                }
            }

            if ((oldPath == null || oldPath.Trim().Length == 0) && oldFileName != null)
            {
                oldPath = System.IO.Path.GetDirectoryName(oldFileName);
            }

            openFileDialog1.InitialDirectory = oldPath;
        }
Exemplo n.º 2
0
        private void textureNamePath_txBx_TextChanged(object sender, EventArgs e)
        {
            if (rgb_picBx != null)
            {
                rgb_picBx.Image   = null;
                alpha_picBx.Image = null;
            }

            if (textureNamePath_txBx.Text.ToLower().EndsWith(".tga"))
            {
                string path = null;

                if (textureNamePath_txBx.Tag != null &&
                    ((string)textureNamePath_txBx.Tag).EndsWith(textureNamePath_txBx.Text))
                {
                    path = (string)textureNamePath_txBx.Tag;
                }
                else
                {
                    ParticalsWin pWin = (ParticalsWin)ownerPanel;

                    if (pWin != null)
                    {
                        path = pWin.getTexturePath(textureNamePath_txBx.Text);

                        textureNamePath_txBx.Tag = path;

                        if (path == null)
                        {
                            pWin.addToTextureDic(openFileDialog1.FileName);
                        }
                    }
                }

                if (rgb_picBx != null && path != null)
                {
                    setIconImage(path);
                }
            }

            base.keyVal_numericUpDown_ValueChanged(sender, e);
        }