public bool Compile(PhactoryHost.Database.Resource resource) { FileInfo fileInfo = Host.GetFileInfo(resource); if (fileInfo == null) { return(false); } if (!IsResourceSupported(resource)) { return(false); } List <String> resourceFilenames = new List <String>(); List <int> execPtrs = new List <int>(); Document.Document document = Host.XMLRead <Document.Document>(fileInfo.FullName); string outputFilename = fileInfo.FullName + ".bin"; if (File.Exists(outputFilename)) { File.Delete(outputFilename); } var compiler = new Phactory.Text.Compiler.TextCompiler(); int charsNotFound = 0; if (!compiler.Compile(outputFilename, document.Charset, document.Text, document.AppendEndOfText, out charsNotFound)) { return(false); } if (charsNotFound > 0) { Plugin.ControllerCompiler.Host.Log("Warning : " + charsNotFound + " characters in text was/were not found in charset !"); } return(true); }
public bool Compile(PhactoryHost.Database.Resource resource) { FileInfo fileInfo = Host.GetFileInfo(resource); if (fileInfo == null) { return false; } if (!IsResourceSupported(resource)) { return false; } List<String> resourceFilenames = new List<String>(); List<int> execPtrs = new List<int>(); Document.Document document = Host.XMLRead<Document.Document>(fileInfo.FullName); string outputFilename = fileInfo.FullName + ".bin"; if (File.Exists(outputFilename)) { File.Delete(outputFilename); } var compiler = new Phactory.Text.Compiler.TextCompiler(); int charsNotFound = 0; if (!compiler.Compile(outputFilename, document.Charset, document.Text, document.AppendEndOfText, out charsNotFound)) { return false; } if (charsNotFound>0) { Plugin.ControllerCompiler.Host.Log("Warning : " + charsNotFound + " characters in text was/were not found in charset !"); } return true; }