Example #1
0
 public CSharpPluginLoader(CSharpExtension extension)
 {
     Instance = this;
     CSharpPluginLoader.extension = extension;
     PluginCompiler.CheckCompilerBinary();
     compiler = new PluginCompiler();
 }
 public CSharpPluginLoader(CSharpExtension extension)
 {
     Instance = this;
     CSharpPluginLoader.extension = extension;
     PluginCompiler.CheckCompilerBinary();
     compiler = new PluginCompiler();
 }
Example #3
0
 public CompilablePlugin(CSharpExtension extension, string directory, string name)
 {
     Extension = extension;
     Directory = directory;
     ScriptName = name;
     Name = Regex.Replace(Regex.Replace(ScriptName, @"(?:^|_)([a-z])", m => m.Groups[1].Value.ToUpper()), "_", "");
     ScriptPath = string.Format("{0}\\{1}.cs", Directory, ScriptName);
     CheckLastModificationTime();
 }
Example #4
0
 public CompilablePlugin(CSharpExtension extension, string directory, string name)
 {
     Extension  = extension;
     Directory  = directory;
     ScriptName = name;
     Name       = Regex.Replace(Regex.Replace(ScriptName, @"(?:^|_)([a-z])", m => m.Groups[1].Value.ToUpper()), "_", "");
     ScriptPath = string.Format("{0}\\{1}.cs", Directory, ScriptName);
     CheckLastModificationTime();
 }
Example #5
0
 public CompilableFile(CSharpExtension extension, CSharpPluginLoader loader, string directory, string name)
 {
     Extension = extension;
     Loader = loader;
     Directory = directory;
     ScriptName = name;
     ScriptPath = Path.Combine(Directory, $"{ScriptName}.cs");
     Name = Regex.Replace(Regex.Replace(ScriptName, @"(?:^|_)([a-z])", m => m.Groups[1].Value.ToUpper()), "_", "");
     CheckLastModificationTime();
 }
Example #6
0
 public CompilableFile(CSharpExtension extension, CSharpPluginLoader loader, string directory, string name)
 {
     Extension  = extension;
     Loader     = loader;
     Directory  = directory;
     ScriptName = name;
     ScriptPath = Path.Combine(Directory, $"{ScriptName}.cs");
     Name       = Regex.Replace(ScriptName, "_", "");
     CheckLastModificationTime();
 }
Example #7
0
 public CompilableFile(CSharpExtension extension, CSharpPluginLoader loader, string directory, string name)
 {
     Extension  = extension;
     Loader     = loader;
     Directory  = directory;
     ScriptName = name;
     Name       = Regex.Replace(Regex.Replace(ScriptName, @"(?:^|_)([a-z])", m => m.Groups[1].Value.ToUpper()), "_", "");
     ScriptPath = Path.Combine(Directory, string.Format("{0}.cs", ScriptName));
     CheckLastModificationTime();
 }
Example #8
0
 public CompilableFile(CSharpExtension extension, CSharpPluginLoader loader, string directory, string name)
 {
     this.Extension  = extension;
     this.Loader     = loader;
     this.Directory  = directory;
     this.ScriptName = name;
     this.ScriptPath = Path.Combine(this.Directory, string.Concat(this.ScriptName, ".cs"));
     this.Name       = Regex.Replace(this.ScriptName, "_", "");
     this.CheckLastModificationTime();
 }
Example #9
0
        private CompilablePlugin GetCompilablePlugin(CSharpExtension extension, string directory, string name)
        {
            var class_name = Regex.Replace(Regex.Replace(name, @"(?:^|_)([a-z])", m => m.Groups[1].Value.ToUpper()), "_", "");
            CompilablePlugin plugin;

            if (!plugins.TryGetValue(class_name, out plugin))
            {
                plugin = new CompilablePlugin(extension, directory, name);
                plugins[class_name] = plugin;
            }
            return(plugin);
        }
Example #10
0
        public CSharpPluginLoader(CSharpExtension extension)
        {
            this.extension = extension;

            // Plugins inherit all references from Oxide.Ext.CSharp
            ProjectReferences = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Select(r => r.Name).ToList();
            ProjectReferences.Add("Oxide.Ext.CSharp");

            // Check if compatible compiler is installed
            PluginCompiler.BinaryPath = Environment.GetEnvironmentVariable("systemroot") + @"\Microsoft.NET\Framework64\v3.5\csc.exe";
            if (!File.Exists(PluginCompiler.BinaryPath))
            {
                Interface.GetMod().RootLogger.Write(Core.Logging.LogType.Error, "Cannot compile C# plugins. Unable to find csc.exe! Have you installed .NET v3.5 x64?");
                PluginCompiler.BinaryPath = null;
                return;
            }

            // Delete any previously compiled temporary plugin files
            foreach (var path in Directory.GetFiles(Interface.GetMod().TempDirectory, "*.dll"))
            {
                File.Delete(path);
            }
        }
Example #11
0
 public CompilablePlugin(CSharpExtension extension, CSharpPluginLoader loader, string directory, string name) : base(extension, loader, directory, name)
 {
 }
Example #12
0
 public CompilablePlugin(CSharpExtension extension, CSharpPluginLoader loader, string directory, string name) : base(extension, loader, directory, name)
 {
 }
Example #13
0
 private CompilablePlugin GetCompilablePlugin(CSharpExtension extension, string directory, string name)
 {
     var class_name = Regex.Replace(Regex.Replace(name, @"(?:^|_)([a-z])", m => m.Groups[1].Value.ToUpper()), "_", "");
     CompilablePlugin plugin;
     if (!plugins.TryGetValue(class_name, out plugin))
     {
         plugin = new CompilablePlugin(extension, directory, name);
         plugins[class_name] = plugin;
     }
     return plugin;
 }