Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (includeFileName != null)
                {
                    includeFileName.Clear();
                }
                if (includeFileBuffer != null)
                {
                    includeFileBuffer.Clear();
                }



                if (inputWindow.IsDisposed)
                {
                    inputWindow = new Input(this);

                    if (outputWindow.IsDisposed)
                    {
                        outputWindow = new Output(this);
                    }

                    inputWindow.SetOutputWindow(outputWindow);
                    outputWindow.SetInputWindow(inputWindow);
                }
                else if (outputWindow.IsDisposed)
                {
                    outputWindow = new Output(this);

                    if (inputWindow.IsDisposed)
                    {
                        inputWindow = new Input(this);
                    }

                    inputWindow.SetOutputWindow(outputWindow);
                    outputWindow.SetInputWindow(inputWindow);
                }



                inputWindow.Location = new Point(this.Location.X + 100, this.Location.Y);
                inputWindow.Show();


                inputWindow.fileName = null;
                if (inputWindow.includeBuffers != null)
                {
                    inputWindow.includeBuffers.Clear();
                }


                textBox1.Text = fileName = ofd.FileName;

                string dirPath = Path.GetDirectoryName(fileName);


                TraverseIncludefiles(fileName, dirPath, includeFileName, includeFileBuffer);



                StreamReader sr        = new StreamReader(textBox1.Text);
                string       inputData = sr.ReadToEnd();


                //includeFileName.Add(fileName);
                //includeFileBuffer.Add(inputData);

                inputWindow.fileName       = fileName;
                inputWindow.includeBuffers = includeFileBuffer;

                inputWindow.richTextBox2.Text = inputData;

                char[]   splitters = { '.', '\\' };
                string[] tokkens   = fileName.Split(splitters);

                if (tokkens[tokkens.Length - 1].Contains("vert"))
                {
                    VSradioButton.Checked = true; shader = "-vs";
                }
                else if (tokkens[tokkens.Length - 1].Contains("frag"))
                {
                    FSradioButton.Checked = true; shader = "-fs";
                }
                else if (tokkens[tokkens.Length - 1].Contains("tesc"))
                {
                    HSradioButton.Checked = true; shader = "-hs";
                }
                else if (tokkens[tokkens.Length - 1].Contains("tese"))
                {
                    DSradioButton.Checked = true; shader = "-ds";
                }
                else if (tokkens[tokkens.Length - 1].Contains("geom"))
                {
                    GSradioButton.Checked = true; shader = "-gs";
                }
                else if (tokkens[tokkens.Length - 1].Contains("comp"))
                {
                    CSradioButton.Checked = true; shader = "-cs";
                }

                inputWindow.Text = inputWindow.label5.Text = "Input from " + shaderString + " \"" + tokkens[tokkens.Length - 2] + "." + tokkens[tokkens.Length - 1] + "\"";
                inputWindow.label5.Update();
            }
        }
Beispiel #2
0
        private void OpenInputWindow()
        {
            if (inputWindow.IsDisposed)
            {
                inputWindow = new Input(this);

                if (outputWindow.IsDisposed)
                {
                    outputWindow = new Output(this);
                }

                inputWindow.SetOutputWindow(outputWindow);
                outputWindow.SetInputWindow(inputWindow);
            }
            else if (outputWindow.IsDisposed)
            {
                outputWindow = new Output(this);

                if (inputWindow.IsDisposed)
                {
                    inputWindow = new Input(this);
                }

                inputWindow.SetOutputWindow(outputWindow);
                outputWindow.SetInputWindow(inputWindow);
            }

            inputWindow.Location = new Point(this.Location.X + 200, this.Location.Y);
            inputWindow.Show();



            //inputWindow.fileName[inputWindow.fileName.Length - 1] = textBox1.Text = fileName;

            switch (language)
            {
            case "-hlsl": HLSLradioButton.Checked = true; break;

            case "-glsl": GLSLradioButton.Checked = true; break;

            case "-msl": MSLradioButton.Checked = true; break;

            default: break;
            }



            textBox1.Text = fileName;

            string dirPath = Path.GetDirectoryName(fileName);


            TraverseIncludefiles(fileName, dirPath, includeFileName, includeFileBuffer);



            StreamReader sr        = new StreamReader(textBox1.Text);
            string       inputData = sr.ReadToEnd();


            //includeFileBuffer.Add(inputData);

            inputWindow.fileName       = fileName;
            inputWindow.includeBuffers = includeFileBuffer;

            //StreamReader sr = new StreamReader(textBox1.Text);
            //string inputData = sr.ReadToEnd();

            inputWindow.richTextBox2.Text = inputData;

            char[]   splitters = { '.', '\\' };
            string[] tokkens   = fileName.Split(splitters);

            if (tokkens[tokkens.Length - 1].Contains("vert"))
            {
                VSradioButton.Checked = true; shader = "-vs";
            }
            else if (tokkens[tokkens.Length - 1].Contains("frag"))
            {
                FSradioButton.Checked = true; shader = "-fs";
            }
            else if (tokkens[tokkens.Length - 1].Contains("tesc"))
            {
                HSradioButton.Checked = true; shader = "-hs";
            }
            else if (tokkens[tokkens.Length - 1].Contains("tese"))
            {
                DSradioButton.Checked = true; shader = "-ds";
            }
            else if (tokkens[tokkens.Length - 1].Contains("geom"))
            {
                GSradioButton.Checked = true; shader = "-gs";
            }
            else if (tokkens[tokkens.Length - 1].Contains("comp"))
            {
                CSradioButton.Checked = true; shader = "-cs";
            }

            inputWindow.Text = inputWindow.label5.Text = "Input from " + shaderString + " \"" + tokkens[tokkens.Length - 2] + "." + tokkens[tokkens.Length - 1] + "\"";
            inputWindow.label5.Update();

            inputWindow.button2.PerformClick();
        }
Beispiel #3
0
 public void SetOutputWindow(Output paramForm)
 {
     outputWindow = paramForm;
 }