예제 #1
0
        private bool TryCompileScript(string script, out IEnumerable <IDiscordScript> scripts)
        {
            CompilerOptions options = new CompilerOptions();

            options.AddReference(Utilities.AssemblyLocation <Logging>());
            options.AddReference(Utilities.AssemblyLocation <IDiscordScript>());
            options.AddReference(Utilities.AssemblyLocation <MediaPlayer>());

#if DEBUG
            options.AddReferenceSearchFolder(Path.GetDirectoryName(typeof(IDiscordClient).GetTypeInfo().Assembly.Location));        //core
            options.AddReferenceSearchFolder(Path.GetDirectoryName(typeof(Discord​Socket​Client).GetTypeInfo().Assembly.Location)); //web socket
            options.AddReferenceSearchFolder(Path.GetDirectoryName(typeof(Discord​Rest​Client).GetTypeInfo().Assembly.Location));   //Rest
#endif
            options.AddReference("Discord.Net.Core.dll");
            options.AddReference("Discord.Net.WebSocket.dll");
            options.AddReference("Discord.Net.Rest.dll");

            return(ScriptBuilder.Instance.TryBuildScript(script, options, out scripts));
        }