Expand|Select|Wrap|Line Numbers
- //---This is in the main program--
- namespace MediaUL
- {
- static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- static public string plist;
- [STAThread]
- static public void pconv()
- {
- string aux, dest,aux2;
- while (true)
- if (Program.plist != null)
- {
- int i = 0;
- while (Program.plist[Program.plist.Length-i-1] != '.') i++;
- aux2 = Program.plist.Substring(0, Program.plist.Length - i - 1);
- i = 0;
- while (aux2[aux2.Length-i-1] != '\\') i++;
- dest = aux2.Substring(aux2.Length - i , aux2.Length - 1);
- aux = "-i \"" + Program.plist + "\" -ar 22050 -ab 32 -f flv -s 320x240 " + dest + "up.flv";
- Process process = new Process();
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.RedirectStandardOutput = true;
- process.StartInfo.RedirectStandardError = true;
- process.StartInfo.CreateNoWindow = true;
- process.StartInfo.FileName = "ffmpeg.exe";
- process.StartInfo.Arguments = aux;
- process.Start();
- while (!process.HasExited) Thread.Sleep(20);
- process.Dispose();
- //process = new Process();
- //for (i = 0; i < Program.plist.Length - 1; i++)
- // Program.plist[i] = Program.plist[i + 1];
- //Program.plist.Intersect("");
- }
- else Thread.Sleep(20);
- }
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
- }
- //---Relevant code from form1(here is where I start the thread--
- private void Form1_Load(object sender, EventArgs e)
- {
- Thread pThread=new Thread(new ThreadStart(Program.pconv));
- pThread.SetApartmentState(ApartmentState.STA);
- pThread.Start();
- }