public DialogueLine(string line, DialogueFile file, int num)
        {
            Regex re = new Regex("([^:]+):(\"([^\"]*)\")?({.*})?");
            var match = re.Match(line);

            LineType = match.Groups[1].Value;
            QuotedContent = match.Groups[2].Value;
            Content = match.Groups[3].Value;
            var opt = match.Groups[4].Value;
            Options = JsonConvert.DeserializeObject<LineOptions>(opt) ?? new LineOptions();

            File = file;
            LineNumber = num;
        }
        public DialogueCompiler(Options opts)
        {
            if (Instance == null) {
                Instance = this;
            }

            BasePath = Path.GetDirectoryName(Path.GetFullPath(opts.InputFile));

            BaseFile = DialogueFile.Open(opts.InputFile);
            ImportFile(BaseFile);

            if (opts.Output == null) {
                Out = Console.Out;
            } else {
                Out = new StreamWriter(opts.Output);
            }
        }
 public override bool Run(DialogueFile file)
 {
     DialogueCompiler.Instance.Error(statement, "No such statement ({0})", statement.LineType);
     return false;
 }
 public override bool Run(DialogueFile file)
 {
     return true;
 }
 public abstract bool Run(DialogueFile file);
 public override bool Run(DialogueFile file)
 {
     file.AddLines(File.Lines);
     return false;
 }
 public AtInclude(DialogueLine param)
 {
     File = DialogueFile.Open(param.Content);
 }
 public void ImportFile(DialogueFile file)
 {
     file.Parse();
     files.Add(file);
 }
        public static DialogueFile Open(string path)
        {
            var f = path = Path.Combine(DialogueCompiler.Instance.BasePath, path);
            if (!File.Exists(f)) {
                f = path + ".txt";
                if (!File.Exists(f)) {
                    f = path + ".dlg";
                    if (!File.Exists(f)) {
                        f = path + ".ch";
                    }
                }
            }

            if (!cache.ContainsKey(f)) {
                cache[f] = new DialogueFile(f);
            }

            return cache[f];
        }