Esempio n. 1
0
        private void ParseMetadata(string line, int lineCount)
        {
            try
            {
                //#metadata [whatsbeingset] "value"
                var split = line.Split(new char[] { ' ' }, 3);
                //so now
                //split[0] is metadata
                //split[1] is what we're assigning
                //split[2] is the value

                if (split[1] == "title")
                {
                    ScriptMetadata.SetMetadata(split[2].Trim('"'), METADATATYPE.SCRIPT_TITLE);
                }
                else
                {
                    throw new InvalidDataException("Metadata error at line " + lineCount + ": Metadata type not defined");
                }
            }
            catch (InvalidDataException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("\nERROR: ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write(ex.Message);
            }
        }
Esempio n. 2
0
 public void ReadScript(string file)
 {
     currentScript = File.ReadAllLines(file);
     ScriptMetadata.SetMetadata("BasicScriptingLanguage", METADATATYPE.AUTHOR);
     for (lineCount = 0; lineCount < currentScript.Count(); lineCount++)
     {
         string actualLine = Regex.Replace(currentScript[lineCount], " {2,}", "\t");
         InterpretLine(actualLine.Trim('\t'), lineCount);
     }
 }