Exemple #1
0
            internal static bool Open()
            {
                try
                {
                    UOHandle = UODLL.Open();
                    int ver = UODLL.Version();
                    if (ver != 3)
                    {
                        return(false);
                    }
                    UODLL.SetTop(UOHandle, 0);
                    UODLL.PushStrVal(UOHandle, "Set");
                    UODLL.PushStrVal(UOHandle, "CliNr");
                    UODLL.PushInteger(UOHandle, 1);
                    if (UODLL.Execute(UOHandle) != 0)
                    {
                        return(false);
                    }

                    Lock_Item = new object();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
Exemple #2
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 #3
0
 private static void SetInt(string command, int value)
 {
     lock (Lock_Item)
     {
         UODLL.SetTop(UOHandle, 0);
         UODLL.PushStrVal(UOHandle, "Set");
         UODLL.PushStrVal(UOHandle, command);
         UODLL.PushInteger(UOHandle, value);
         UODLL.Execute(UOHandle);
     }
 }