public MmlDatum[] compile(string srcMUCFullPath, string wrkMUCFullPath) { if (!ok) { return(null); } this.wrkMUCFullPath = wrkMUCFullPath; compiler.Init(); compiler.SetCompileSwitch("IDE"); MmlDatum[] ret; musicDriverInterface.Log.writeMethod = disp; musicDriverInterface.Log.off = 0; if (!setting.other.LogWarning) { musicDriverInterface.Log.off = (int)musicDriverInterface.LogLevel.WARNING; } if (setting.other.LogLevel == (int)LogLevel.INFO) { musicDriverInterface.Log.level = LogLevel.INFO; } else if (setting.other.LogLevel == (int)LogLevel.DEBUG) { musicDriverInterface.Log.level = LogLevel.DEBUG; } else if (setting.other.LogLevel == (int)LogLevel.TRACE) { musicDriverInterface.Log.level = LogLevel.TRACE; } using (FileStream sourceMML = new FileStream(srcMUCFullPath, FileMode.Open, FileAccess.Read, FileShare.Read)) ret = compiler.Compile(sourceMML, appendFileReaderCallback); // wrkMUCFullPath, disp); return(ret); }
public MmlDatum[] compileFromSrcText(string srcText, string wrkMMLFullPath, string srcFileFullPath, Point point, bool doTrace) { if (!ok) { return(null); } MoonDriverManager.wrkMMLFullPath = wrkMMLFullPath; compiler.Init(); if (doTrace) { compiler.SetCompileSwitch("IDE"); } if (point != Point.Empty) { compiler.SetCompileSwitch(string.Format("SkipPoint=R{0}:C{1}", point.Y, point.X)); } MmlDatum[] ret; musicDriverInterface.Log.writeMethod = disp; musicDriverInterface.Log.off = 0; if (!setting.other.LogWarning) { musicDriverInterface.Log.off = (int)musicDriverInterface.LogLevel.WARNING; } if (setting.other.LogLevel == (int)LogLevel.INFO) { musicDriverInterface.Log.level = LogLevel.INFO; } else if (setting.other.LogLevel == (int)LogLevel.DEBUG) { musicDriverInterface.Log.level = LogLevel.DEBUG; } else if (setting.other.LogLevel == (int)LogLevel.TRACE) { musicDriverInterface.Log.level = LogLevel.TRACE; } musicDriverInterface.Log.level = LogLevel.INFO; compiler.SetCompileSwitch(string.Format("ORIGPATH={0}", wrkMMLFullPath)); compiler.SetCompileSwitch( "MoonDriverOption=-i" , string.Format("MoonDriverOption={0}", srcFileFullPath) ); byte[] src = Encoding.GetEncoding(932).GetBytes(srcText); using (MemoryStream sourceMML = new MemoryStream(src)) ret = compiler.Compile(sourceMML, appendFileReaderCallback); // wrkMUCFullPath, disp); currentGD3Tag = compiler.GetGD3TagInfo(src); //foreach(MmlDatum d in ret) //{ // if(d.type == enmMMLType.Note) // { // Console.WriteLine("{0} {1}", d.linePos.row, d.linePos.col); // ; // } //} return(ret); }