mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-01 09:36:03 -04:00
Add support for '//reference X.dll' alternative syntax to 'Reference X.dll' (Thanks SpiralP)
This commit is contained in:
parent
43dc6c0c54
commit
3abe564c1c
@ -16,13 +16,8 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Timers;
|
||||
using MCGalaxy.Commands;
|
||||
using MCGalaxy.Maths;
|
||||
using BlockID = System.UInt16;
|
||||
using MCGalaxy.Config;
|
||||
using System.Collections.Generic;
|
||||
using MCGalaxy.Config;
|
||||
using MCGalaxy.Maths;
|
||||
|
||||
namespace MCGalaxy.Games {
|
||||
|
||||
|
@ -128,11 +128,17 @@ namespace MCGalaxy.Scripting {
|
||||
return results;
|
||||
}
|
||||
|
||||
static bool IsReferenceLine(string line) {
|
||||
// Originally only 'Reference X.dll' syntax was supported
|
||||
// Later '//Reference X.dll' was added, and is preferred
|
||||
return line.CaselessStarts("reference ") || line.CaselessStarts("//reference ");
|
||||
}
|
||||
|
||||
static List<string> ReadSource(string path, CompilerParameters args, ref int offset) {
|
||||
List<string> lines = Utils.ReadAllLinesList(path);
|
||||
// Allow referencing other assemblies using 'Reference [assembly name]' at top of the file
|
||||
for (int i = 0; i < lines.Count; i++) {
|
||||
if (!lines[i].CaselessStarts("reference ")) break;
|
||||
if (!IsReferenceLine(lines[i])) break;
|
||||
|
||||
int index = lines[i].IndexOf(' ') + 1;
|
||||
// For consistency with C#, treat 'Reference X.dll;' as 'Reference X.dll'
|
||||
|
Loading…
x
Reference in New Issue
Block a user