Exemple #1
0
            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);
                }
            }
Exemple #2
0
 private void SetBoolean(string command, bool value)
 {
     lock (Lock_Item)
     {
         UODLL.SetTop(UOHandle, 0);
         UODLL.PushStrVal(UOHandle, "Set");
         UODLL.PushStrVal(UOHandle, command);
         UODLL.PushBoolean(UOHandle, value);
         UODLL.Execute(UOHandle);
     }
 }