public void GenerateUserAction(int nCode) { MHScene pScene = CurrentScene(); if (pScene == null) { return; } EventTriggered(pScene, MHRoot.EventUserInput, new MHUnion(nCode)); }
protected MHGroup ParseProgram(byte[] text) { if (text.Length == 0) { return(null); } IMHParser parser = null; MHParseNode pTree = null; MHGroup pRes = null; // Look at the first byte to decide whether this is text or binary. Binary // files will begin with 0xA0 or 0xA1, text files with white space, comment ('/') // or curly bracket. // This is only there for testing: all downloaded objects will be in ASN1 byte ch = text[0]; if (ch >= 128) { parser = new MHParseBinary(text); } else { parser = new MHParseText(text); } // Parse the binary or text. pTree = parser.Parse(); switch (pTree.GetTagNo()) { // The parse node should be a tagged item. case ASN1Codes.C_APPLICATION: pRes = new MHApplication(); break; case ASN1Codes.C_SCENE: pRes = new MHScene(); break; default: pTree.Failure("Expected Application or Scene"); break; // throws exception. } pRes.Initialise(pTree, this); // Convert the parse tree. return(pRes); }