Ejemplo n.º 1
0
 public void LoadFunctionsInFile(FileInfo file, string functionsName)
 {
     LoadTextFile(
         file.DirectoryName,
         file.Name,
         (filePath) =>
     {
         StreamReader reader = new StreamReader(file.OpenRead());
         string text         = reader.ReadToEnd();
         FunctionsManager.Get(functionsName).LoadScript(text, functionsName, file.Extension == ".lua" ? Functions.Type.Lua : Functions.Type.CSharp);
     });
 }
Ejemplo n.º 2
0
        private void LoadFunctions(string fileName, string functionsName)
        {
            string ext    = Path.GetExtension(fileName);
            string folder = "LUA";

            Functions.Type scriptType = Functions.Type.Lua;

            if (string.Compare(".cs", ext, true) == 0)
            {
                folder     = "CSharp";
                scriptType = Functions.Type.CSharp;
            }

            LoadTextFile(folder, fileName, (filePath) =>
            {
                if (File.Exists(filePath))
                {
                    string text = File.ReadAllText(filePath);
                    FunctionsManager.Get(functionsName).LoadScript(text, functionsName, scriptType);
                }
            });
        }