public void FromVegas(Vegas vegas)
        {
            try
            {
                _vegas = vegas;

                ScriptArgs args = Script.Args;
                if (args.Count > 0)
                {
                    _closeonfinish = System.Convert.ToBoolean(args.ValueOf("closeonfinish") ?? "false");
                    _savewhendone  = System.Convert.ToBoolean(args.ValueOf("savewhendone") ?? "false");
                    _makeveg       = System.Convert.ToBoolean(args.ValueOf("makeveg") ?? "false");
                    _file          = args.ValueOf("file");
                }
                else
                {
                    var dialog = new OpenFileDialog {
                        Filter = ".srt files (*.srt)|*.srt", CheckPathExists = true, InitialDirectory = vegas.Project.FilePath
                    };
                    DialogResult result = dialog.ShowDialog();
                    vegas.UpdateUI();

                    if (result == DialogResult.OK)
                    {
                        _file = Path.GetFullPath(dialog.FileName);
                    }
                    else
                    {
                        return;
                    }
                }

                if (_makeveg)
                {
                    Media media = vegas.Project.MediaPool.AddMedia(Script.Args.ValueOf("media"));

                    foreach (MediaStream stream in media.Streams)
                    {
                        if (stream is VideoStream)
                        {
                            VideoTrack t = vegas.Project.AddVideoTrack();
                            VideoEvent e = t.AddVideoEvent(new Timecode(), media.Length);
                            e.ResampleMode = VideoResampleMode.Disable;
                            e.AddTake(stream);
                        }
                        else if (stream is AudioStream)
                        {
                            AudioTrack t = vegas.Project.AddAudioTrack();
                            AudioEvent e = t.AddAudioEvent(new Timecode(), media.Length);
                            e.AddTake(stream);
                        }
                    }

                    vegas.SaveProject(Script.Args.ValueOf("output"));
                }

                using (FileStream fs = new FileStream(_file, FileMode.Open, FileAccess.Read))
                    using (StreamReader stream = new StreamReader(fs))
                    {
                        while (!stream.EndOfStream)
                        {
                            string line = stream.ReadLine();

                            if (Regex.IsMatch(line, "^[0-9]+$"))
                            {
                                line = stream.ReadLine();

                                if (Regex.IsMatch(line, "^" + SRT_TIME_PATTERN + " --> " + SRT_TIME_PATTERN + "$"))
                                {
                                    MatchCollection stamps = Regex.Matches(line, SRT_TIME_PATTERN);

                                    TimeSpan s = TimeSpan.ParseExact(stamps[0].Value, SRT_TIME_FORMAT, null);
                                    TimeSpan e = TimeSpan.ParseExact(stamps[1].Value, SRT_TIME_FORMAT, null);
                                    string   t = string.Empty;

                                    while (!stream.EndOfStream)
                                    {
                                        line = stream.ReadLine();
                                        if (!string.IsNullOrEmpty(line))
                                        {
                                            if (!string.IsNullOrEmpty(t))
                                            {
                                                t += "[br]";
                                            }

                                            t += line;
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }

                                    Region r = Convert(s, e, t);
                                    if (r != null)
                                    {
                                        vegas.Project.Regions.Add(r);
                                    }
                                }
                            }
                        }
                    }

                if (_savewhendone)
                {
                    vegas.SaveProject();
                }
                if (_closeonfinish)
                {
                    vegas.Exit();
                }
            }
            catch (VegasException e)
            {
                Vegas.COM.ShowError(e.Title, e.Message);
            }
        }