private static List <object> _executeCommand(bool ReturnResults, string CommandName, object[] args) { lock (Lock_Item) { // Maybe return bool and results as an Out? UODLL.SetTop(UOHandle, 0); UODLL.PushStrVal(UOHandle, "Call"); UODLL.PushStrVal(UOHandle, CommandName); foreach (object o in args) { if (o is Int32) { // (o.GetType() == typeof(int)) UODLL.PushInteger(UOHandle, Convert.ToInt32(o)); } else if (o is string) { UODLL.PushStrVal(UOHandle, (string)o); } else if (o is bool) { UODLL.PushBoolean(UOHandle, Convert.ToBoolean(o)); } } if (UODLL.Execute(UOHandle) != 0) { return(null); } if (!ReturnResults) { return(null); } int objectcnt = UODLL.GetTop(UOHandle); List <object> Results = new List <object>(); for (int i = 1; i <= objectcnt; i++) { int _gettype = UODLL.GetType(UOHandle, i); switch (_gettype) { case 1: Results.Add(UODLL.GetBoolean(UOHandle, i).ToString()); break; case 3: Results.Add(UODLL.GetInteger(UOHandle, i).ToString()); break; case 4: Results.Add(UODLL.GetString(UOHandle, i)); break; default: return(null); } } return(Results); } }
private static bool GetBoolean(string command) { lock (Lock_Item) { UODLL.SetTop(UOHandle, 0); UODLL.PushStrVal(UOHandle, "Get"); UODLL.PushStrVal(UOHandle, command); int result = UODLL.Execute(UOHandle); if (result == 0) { return(UODLL.GetBoolean(UOHandle, 1)); } else { return(false); } } }