private void startGame() { if (!PlEngine.IsInitialized) { // Thread clean = new Thread(); //string filename = @"C:\Users\Mathieu\Documents\Visual Studio 2015\Projects\TarotAfricain\TarotAfricain\Prolog\prolog.pro"; string filename = "TarotAfrikMulti.pl"; string text = System.IO.File.ReadAllText(filename); string serialNames = SerializeList(names); string serialIsIa = SerializeList(isIa); String[] param = { "-q", "-f", filename }; string query = "playGame(" + serialNames + ", " + serialIsIa + ", " + nbCarte.ToString() + "), write('end')."; PlEngine.Initialize(param); Debug.WriteLine(PlEngine.IsInitialized); Debug.WriteLine(PlEngine.PlThreadSelf()); //Debug.WriteLine("Attachement : " + PlEngine.PlThreadAttachEngine()); PlEngine.SetStreamFunctionWrite(SbsSW.SwiPlCs.Streams.PlStreamType.Output, stdout); InitializeCallBack(); PlQuery.PlCall(query); Debug.WriteLine("end"); } }
public void StreamWrite() { // NOTE: the Swrite function is only called if you flush the output or send a newline character const string validationString = "Hello .net world äöüß"; // The last 4 characters are German umlauts. PlQuery.PlCall("assert( (test_write :- writeln('" + validationString + "'), flush_output) )"); var wf = new DelegateStreamWriteFunction(Swrite); PlEngine.SetStreamFunctionWrite(PlStreamType.Output, wf); PlQuery.PlCall("test_write"); Assert.AreEqual(validationString + "\r\n", _testString); }