private void ParseMetadata(LuaScriptMetadata outMetadata, string script)
 {
     if (script == "")
         return;
     string[] asLines = script.Split(new string[]{ "\r\n", "\n"}, StringSplitOptions.RemoveEmptyEntries);
     for (int i = 0; i < 5; i++)
     {
         if (asLines[i].StartsWith("local __title"))
         {
             string[] split = asLines[i].Split(new char[]{ '=' }, 2);
             string cleaned = split[1].Replace("\"", String.Empty).Replace(";", String.Empty).Trim();
             outMetadata.Title = cleaned;
         }
         else if (asLines[i].StartsWith("local __author"))
         {
             string[] split = asLines[i].Split(new char[]{ '=' }, 2);
             string cleaned = split[1].Replace("\"", String.Empty).Replace(";", String.Empty).Trim();
             outMetadata.Author = cleaned;
         }
         else if (asLines[i].StartsWith("local __version"))
         {
             string[] split = asLines[i].Split(new char[]{ '=' }, 2);
             string cleaned = split[1].Replace("\"", String.Empty).Replace(";", String.Empty).Trim();
             Console.WriteLine(cleaned);
             outMetadata.ScriptVersion = new Version(cleaned);
         }
         else if (asLines[i].StartsWith("local __url"))
         {
             string[] split = asLines[i].Split(new char[]{ '=' }, 2);
             string cleaned = split[1].Replace("\"", String.Empty).Replace(";", String.Empty).Trim();
             outMetadata.URL = cleaned;
         }
         else if (asLines[i].StartsWith("local __description"))
         {
             string[] split = asLines[i].Split(new char[]{ '=' }, 2);
             string cleaned = split[1].Replace("\"", String.Empty).Replace(";", String.Empty).Trim();
             outMetadata.Description = cleaned;
         }
     }
 }
 private void CheckLocalScript()
 {
     string fullFileName = Program.ProgramSettings.LunaLuaDirectory + System.IO.Path.DirectorySeparatorChar + "LuaScriptsLib" + System.IO.Path.DirectorySeparatorChar + m.LuaURL.Substring(m.LuaURL.LastIndexOf("/")).Trim('/');
     if(File.Exists(fullFileName))
     {
         using (StreamReader sr = new StreamReader(fullFileName))
         {
             LuaScriptLocal = sr.ReadToEnd();
             LocalMetadata = new LuaScriptMetadata();
             ParseMetadata(LocalMetadata, LuaScriptLocal);
         }
     }
 }