private void OnAddDropDown(Rect buttonRect, ReorderableList list)
 {
     var menu = new GenericMenu();
     if (kModule._inputData.Length >= 2) return;
     if (kModule._inputData.Length == 0)
     {
         menu.AddItem(new GUIContent("Right Hand"),
                  false, OnClickHandler,
                  new DataParams() { jointType = KinectUIHandType.Right });
         menu.AddItem(new GUIContent("Left Hand"),
                  false, OnClickHandler,
                  new DataParams() { jointType = KinectUIHandType.Left });
     }
     else if (kModule._inputData.Length == 1)
     {
         DataParams param;
         string name;
         if (kModule._inputData[0].trackingHandType == KinectUIHandType.Left){
             param = new DataParams() { jointType = KinectUIHandType.Right };
             name = "Right Hand";
         }
         else
         {
             param = new DataParams() { jointType = KinectUIHandType.Left };
             name = "Left Hand";
         }
         menu.AddItem(new GUIContent(name),false, OnClickHandler, param);
     }
     menu.ShowAsContext();
 }
Beispiel #2
0
        public IServerExpressionPlan PrepareExpression(DataParams paramsValue)
        {
                        #if LOGCACHEEVENTS
            FScript.FProcess.FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} preparing batched expression '{1}'.", Thread.CurrentThread.GetHashCode(), GetText()));
                        #endif

            PlanDescriptor planDescriptor;
            IRemoteServerExpressionPlan plan = _batch.PrepareExpression(((LocalProcess)ServerProcess).DataParamsToRemoteParams(paramsValue), out planDescriptor);
            return(new LocalExpressionPlan(_script._process, plan, planDescriptor, paramsValue));
        }
Beispiel #3
0
        /// <summary> Prepares the given expression for selection. </summary>
        /// <param name='expression'> A single valid Dataphor expression to prepare. </param>
        /// <returns> An <see cref="IServerExpressionPlan"/> instance for the prepared expression. </returns>
        public IServerExpressionPlan PrepareExpression(string expression, DataParams paramsValue, DebugLocator locator)
        {
                        #if LOGCACHEEVENTS
            FSession.FServer.FInternalServer.LogMessage(String.Format("Thread {0} preparing expression '{1}'.", Thread.CurrentThread.GetHashCode(), AExpression));
                        #endif

            PlanDescriptor planDescriptor;
            IRemoteServerExpressionPlan plan = _process.PrepareExpression(expression, DataParamsToRemoteParams(paramsValue), locator, out planDescriptor, GetProcessCleanupInfo());
            return(new LocalExpressionPlan(this, plan, planDescriptor, paramsValue));
        }
Beispiel #4
0
 public IServerPlan Prepare(DataParams paramsValue)
 {
     if (IsExpression())
     {
         return(PrepareExpression(paramsValue));
     }
     else
     {
         return(PrepareStatement(paramsValue));
     }
 }
Beispiel #5
0
        public IDataSet LoadDataSet(string dataSourceName, string symbol, DataPeriod period)
        {
            DataId      dataId     = new DataId(dataSourceName, symbol, period);
            IDataSource dataSource = LoadDataSource(dataId.Source);
            DataParams  dataParams = GetDataParams(dataId, UserFilesFolder, dataSource);
            IDataSet    dataSet    = LoadCsvFile(dataParams);

            dataSet.Properties = dataSource.InstrumentProperties[symbol];

            return(dataSet);
        }
Beispiel #6
0
 public IServerStatementPlan PrepareStatement(DataParams paramsValue)
 {
     try
     {
         _script.CheckParsed();
         return((IServerStatementPlan)_script.Process.CompileStatement(_batch, null, paramsValue, _script.SourceContext));
     }
     catch (Exception E)
     {
         throw _script.Process.ServerSession.WrapException(E);
     }
 }
Beispiel #7
0
 public static void SetDataOutputParams(IServerProcess process, DataParams dataParams, NativeParam[] nativeParams)
 {
     for (int index = 0; index < dataParams.Count; index++)
     {
         DataParam dataParam = dataParams[index];
         if ((dataParam.Modifier == Modifier.Var) || (dataParam.Modifier == Modifier.Out))
         {
             var dataValue = NativeValueToDataValue((ServerProcess)process, nativeParams[index].Value);
             dataParam.Value = dataValue.IsNil ? null : dataValue.AsNative;
         }
     }
 }
 protected RestRequest(HttpMethod method, UrlParams urlParameters, HeaderParams headerParameters, QueryParams queryParameters,
                       BodyParams bodyParameters, DataParams dataParameters)
 {
     Method           = method;
     UrlParameters    = urlParameters.ThrowIfNull(nameof(urlParameters)).ToList();
     HeaderParameters = headerParameters.ThrowIfNull(nameof(headerParameters)).ToList();
     QueryParameters  = queryParameters.ThrowIfNull(nameof(queryParameters)).ToList();
     BodyParameters   = bodyParameters.ThrowIfNull(nameof(bodyParameters))
                        .Select(p => new FieldRequestData(p.Name, p.Value))
                        .Concat(dataParameters.ThrowIfNull(nameof(dataParameters)))
                        .ToList();
 }
Beispiel #9
0
        private static void InsertDocument(IServerProcess process, Guid documentID, Guid rootElementID)
        {
            DataParams paramsValue = new DataParams();

            paramsValue.Add(DataParam.Create(process, "ADocumentID", documentID));
            paramsValue.Add(DataParam.Create(process, "AElementID", rootElementID));
            process.Execute
            (
                "insert table { row { ADocumentID ID, AElementID Root_Element_ID }, key { } } into .System.Internet.XMLDocument",
                paramsValue
            );
        }
Beispiel #10
0
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     if (_document != String.Empty)
     {
         _params = paramsValue;
         if ((_mode == FormMode.Delete) && !ConfirmDelete)
         {
             SourceLink.Source.DataView.Delete();
         }
         else
         {
             _mainSourceParams = paramsValue["AParams"] as DataParams;
             try
             {
                 IFormInterface form = HostNode.Session.LoadForm(this, _document, new FormInterfaceHandler(InternalBeforeActivateForm));
                 try
                 {
                     form.OnClosed += new EventHandler(OnClosedHandler);
                     form.TopMost   = TopMost;
                     InternalAfterActivateForm(form);
                     bool forceAcceptReject = (_onFormAccepted != null) || (_onFormRejected != null) || (OnFormAcceptedEvent != null) || (OnFormRejectedEvent != null);
                     if ((_mode != FormMode.None) || (SourceLinkType != SourceLinkType.None) || forceAcceptReject)
                     {
                         if (forceAcceptReject)
                         {
                             form.ForceAcceptReject = true;
                         }
                         form.Show
                         (
                             (IFormInterface)FindParent(typeof(IFormInterface)),
                             new FormInterfaceHandler(FormAccepted),
                             new FormInterfaceHandler(FormRejected),
                             _mode
                         );
                     }
                     else
                     {
                         form.Show(_mode);
                     }
                 }
                 catch
                 {
                     form.Dispose();
                     throw;
                 }
             }
             finally
             {
                 _mainSourceParams = null;
             }
         }
     }
 }
Beispiel #11
0
        /// <summary>
        ///     Event for the final button of the profile setup:
        ///     - Inserts the user's information into the database
        ///     - Creates a table for liked profiles
        ///     - Opens the finder screen and closes the profile setup screen
        /// </summary>
        public void Finish()
        {
            var profileSetup  = GetComponentInParent <ProfileSetup>();
            var finderProfile = new DataTable(FinderController.ProfileTable);

            finderProfile.AddProperty(new DataProperty("Name", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("Age", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("City", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("PhoneNumber", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavMovie", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavMusic", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavFood", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavSport", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavGame", DataProperty.DataPropertyType.VARCHAR));
            finderProfile.AddProperty(new DataProperty("FavVacation", DataProperty.DataPropertyType.VARCHAR));
            AppData.Instance().Registry.Register(finderProfile);

            var fields = FormContent.GetComponentsInChildren <Text>().Where(x => x.tag == "InputName");

            var handshake = new InformationProtocol(Protocol.Data)
                            .SetHandler("finderProfileUpdate", InformationProtocol.HandlerType.Update)
                            .AddParameter("action", "insert")
                            .AddParameter("name", PlayerPrefs.GetString("name"))
                            .AddParameter("uid", PlayerPrefs.GetString("uid"));

            var parameters = DataParams.Build();

            foreach (var field in fields)
            {
                var key   = field.name;
                var value = field.GetComponentInChildren <InputField>().text;

                if (string.IsNullOrEmpty(value))
                {
                    Warning.SetActive(true);
                    return;
                }

                parameters.Append(key, value);
                handshake.AddParameter(key, value);
            }

            finderProfile.Insert(parameters);
            handshake.Send(request => {
                var likeTable = new DataTable(FinderController.LikeTable);
                likeTable.AddProperty(new DataProperty("ProfileID", DataProperty.DataPropertyType.VARCHAR));
                AppData.Instance().Registry.Register(likeTable);

                profileSetup.gameObject.SetActive(false);
                profileSetup.FinderController.gameObject.SetActive(true);
            });
        }
Beispiel #12
0
        public static DataParams ParamsArrayToDataParams(IServerProcess process, DataParam[] paramsValue)
        {
            DataParams dataParams = new DataParams();

            if (paramsValue != null)
            {
                foreach (var dataParam in paramsValue)
                {
                    dataParams.Add(dataParam);
                }
            }
            return(dataParams);
        }
        public static DateTime GetBDTime()
        {
            DateTime TimeBD = new DateTime();

            try
            {
                return(DataParams.GetBDTime());
            }
            catch (Exception ex)
            {
                //  GasLogB.CrearLogError(ex, paramsobj);
            }
            return(TimeBD);
        }
Beispiel #14
0
 public IRemoteServerStatementPlan PrepareStatement(RemoteParam[] paramsValue, out PlanDescriptor planDescriptor)
 {
     try
     {
         DataParams localParamsValue          = _script.Process.RemoteParamsToDataParams(paramsValue);
         RemoteServerStatementPlan remotePlan = new RemoteServerStatementPlan(_script.Process, (ServerStatementPlan)_serverBatch.PrepareStatement(localParamsValue));
         planDescriptor = _script.Process.GetPlanDescriptor(remotePlan);
         return(remotePlan);
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
Beispiel #15
0
        private static void WriteContent(IServerProcess process, Guid elementID, string content, int childSequence, byte type)
        {
            DataParams paramsValue = new DataParams();

            paramsValue.Add(DataParam.Create(process, "AElementID", elementID));
            paramsValue.Add(DataParam.Create(process, "ASequence", childSequence));
            paramsValue.Add(DataParam.Create(process, "AContent", content));
            paramsValue.Add(DataParam.Create(process, "AType", type));
            process.Execute
            (
                "insert table { row { AElementID Element_ID, ASequence Sequence, AContent Content, AType Type }, key { } } into .System.Internet.XMLContent",
                paramsValue
            );
        }
        private void AddRewards()
        {
            DataSource.Create();

            AppData.Instance().MannyAttribute.IncrementAttribute(Attribute.Coins, _prizeController.CurrentPrize);
            AppData.Instance().MannyAttribute.IncrementAttribute(Attribute.Experience, _experience);
            AppData.Instance().MannyAttribute.Save();

            DataSource.Insert(DataParams.Build("Won", _won ? 1 : 0)
                              .Append("CorrectAnswers", _questionController.CurrentQuestionIndex)
                              .Append("Prize", _prizeController.CurrentPrize).Append("Experience", _experience)
                              .Append("TimePlayedSeconds", Time.time));
            Tracking.RequestSend();
        }
Beispiel #17
0
 public void UpdateParams(DataParams dAERuntimeParams)
 {
     if (dAERuntimeParams == null)
     {
         return;
     }
     foreach (DataParam dAERuntimeParam in dAERuntimeParams)
     {
         if ((dAERuntimeParam.Modifier == Language.Modifier.Out) || (dAERuntimeParam.Modifier == Language.Modifier.Var))
         {
             ((DAEParameter)this[dAERuntimeParam.Name]).Value = dAERuntimeParam.Value;
         }
     }
 }
Beispiel #18
0
        public static void Execute(Program program, string statement, DataParams dataParams)
        {
            IServerStatementPlan plan = ((IServerProcess)program.ServerProcess).PrepareStatement(statement, dataParams);

            try
            {
                plan.CheckCompiled();
                plan.Execute(dataParams);
            }
            finally
            {
                ((IServerProcess)program.ServerProcess).UnprepareStatement(plan);
            }
        }
Beispiel #19
0
        /// <summary>
        ///     OnClick event for the hasLiked/pass buttons
        /// </summary>
        /// <param name="hasLiked"></param>
        public void NextProfile(bool hasLiked)
        {
            var likedProfiles  = FinderProfileController.LikedProfiles;
            var currentProfile = FinderProfileController.GetCurrentProfile();

            if (hasLiked && !likedProfiles.Contains(currentProfile))
            {
                likedProfiles.Add(currentProfile);
                AppData.Instance().Registry.Fetch(LikeTable)
                .Insert(DataParams.Build("ProfileID", currentProfile.ProfileInfo.PlayerUID));
            }
            FinderProfileController.NextProfile();
            UpdateUI();
        }
Beispiel #20
0
        public override object InternalExecute(Program program, object[] arguments)
        {
            var tableVar           = APIUtilities.ResolveTableVarName(program, (string)arguments[0]);
            var identifyingKey     = APIUtilities.FindIdentifyingKey(program, tableVar);
            var keyValues          = APIUtilities.GetKeyValues(program, identifyingKey, (string)arguments[1]);
            var keyEqualExpression = Compiler.BuildKeyEqualExpression(program.Plan, String.Empty, "AKey", new Schema.RowType(identifyingKey.Columns).Columns, keyValues.DataType.Columns);
            var tableVarExpression = new IdentifierExpression(tableVar.Name);
            var restrictExpression = new RestrictExpression(tableVarExpression, keyEqualExpression);
            var expression         = new D4TextEmitter().Emit(restrictExpression);
            var dataParams         = new DataParams();

            dataParams.Add(new DataParam("AKey", keyValues.DataType, Modifier.In, keyValues));

            return(APIUtilities.EvaluateSingleton(program, expression, dataParams));
        }
Beispiel #21
0
        public override object InternalExecute(Program program, object[] arguments)
        {
            var tableVar = APIUtilities.ResolveTableVarName(program, (string)arguments[0]);

            var insertStatement = new InsertStatement(new IdentifierExpression("ARow"), new IdentifierExpression(tableVar.Name));
            var statement       = new D4TextEmitter().Emit(insertStatement);
            var dataParams      = new DataParams();
            var row             = (IRow)arguments[1];

            dataParams.Add(new DataParam("ARow", row.DataType, Modifier.In, row));

            APIUtilities.Execute(program, statement, dataParams);

            return(null);
        }
Beispiel #22
0
 public void Execute(ref RemoteParamData paramsValue, out ProgramStatistics executeTime, ProcessCallInfo callInfo)
 {
     _process.ProcessCallInfo(callInfo);
     try
     {
         DataParams localParamsValue = _process.RemoteParamDataToDataParams(paramsValue);
         ServerStatementPlan.Execute(localParamsValue);
         _process.DataParamsToRemoteParamData(localParamsValue, ref paramsValue);
         executeTime = ServerStatementPlan.ProgramStatistics;
     }
     catch (Exception E)
     {
         throw WrapException(E);
     }
 }
Beispiel #23
0
 /// <summary>
 ///     Fire the given query to create an update call.
 /// </summary>
 /// <param name="dataParams">DataParameters parameters</param>
 /// <param name="callback">Used to react on a succesful query, may be null</param>
 public void Update(DataParams dataParams, Action callback = null)
 {
     if (dataParams != null)
     {
         foreach (var dataParam in dataParams.Parameters)
         {
             _command.Parameters.Add(new SqliteParameter("@" + dataParam.Key.ToLower(), dataParam.Value));
         }
     }
     _command.ExecuteNonQuery();
     _command.Parameters.Clear();
     if (callback != null)
     {
         callback();
     }
 }
    private void OnAddDropDown(Rect buttonRect, ReorderableList list)
    {
        var menu = new GenericMenu();

        if (_kModule.InputData.Length >= 2)
        {
            return;
        }

        if (_kModule.InputData.Length == 0)
        {
            menu.AddItem(new GUIContent("Right Hand"),
                         false, OnClickHandler,
                         new DataParams {
                JointType = KinectUIHandType.Right
            });

            menu.AddItem(new GUIContent("Left Hand"),
                         false, OnClickHandler,
                         new DataParams {
                JointType = KinectUIHandType.Left
            });
        }
        else if (_kModule.InputData.Length == 1)
        {
            DataParams param;
            string     handName;

            if (_kModule.InputData[0].HandType == KinectUIHandType.Left)
            {
                param = new DataParams {
                    JointType = KinectUIHandType.Right
                };
                handName = "Right Hand";
            }
            else
            {
                param = new DataParams {
                    JointType = KinectUIHandType.Left
                };
                handName = "Left Hand";
            }
            menu.AddItem(new GUIContent(handName), false, OnClickHandler, param);
        }

        menu.ShowAsContext();
    }
Beispiel #25
0
        public IServerCursor Open(DataParams paramsValue)
        {
            IServerCursor serverCursor;
            //ServerProcess.RaiseTraceEvent(TraceCodes.BeginOpenCursor, "Begin Open Cursor");
            Exception exception    = null;
            int       nestingLevel = _process.BeginTransactionalCall();

            try
            {
                CheckCompiled();

                                #if TIMING
                DateTime startTime = DateTime.Now;
                System.Diagnostics.Debug.WriteLine(String.Format("{0} -- ServerExpressionPlan.Open", DateTime.Now.ToString("hh:mm:ss.ffff")));
                                #endif
                ServerCursor cursor = new ServerCursor(this, _program, paramsValue);
                try
                {
                    cursor.Open();
                                        #if TIMING
                    System.Diagnostics.Debug.WriteLine(String.Format("{0} -- ServerExpressionPlan.Open -- Open Time: {1}", DateTime.Now.ToString("hh:mm:ss.ffff"), (DateTime.Now - startTime).ToString()));
                                        #endif
                    serverCursor = (IServerCursor)cursor;
                }
                catch
                {
                    Close((IServerCursor)cursor);
                    throw;
                }
            }
            catch (Exception E)
            {
                if (Header != null)
                {
                    Header.IsInvalidPlan = true;
                }

                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _process.EndTransactionalCall(nestingLevel, exception);
            }
            //ServerProcess.RaiseTraceEvent(TraceCodes.EndOpenCursor, "End Open Cursor");
            return(serverCursor);
        }
Beispiel #26
0
 public static NativeParam[] DataParamsToNativeParams(IServerProcess process, DataParams dataParams)
 {
     NativeParam[] nativeParams = new NativeParam[dataParams.Count];
     for (int index = 0; index < dataParams.Count; index++)
     {
         var dataParam   = dataParams[index];
         var nativeValue = DataParamToNativeValue(process, dataParam);
         nativeParams[index] =
             new NativeParam()
         {
             Name     = dataParam.Name,
             Modifier = NativeCLIUtility.ModifierToNativeModifier(dataParam.Modifier),
             Value    = nativeValue
         };
     }
     return(nativeParams);
 }
        // Parameter Translation
        public DataParams RemoteParamsToDataParams(RemoteParam[] paramsValue)
        {
            if ((paramsValue != null) && (paramsValue.Length > 0))
            {
                DataParams localParamsValue = new DataParams();
                foreach (RemoteParam remoteParam in paramsValue)
                {
                    localParamsValue.Add(new DataParam(remoteParam.Name, (Schema.ScalarType)_serverProcess.ServerSession.Server.Catalog[remoteParam.TypeName], RemoteModifierToModifier(remoteParam.Modifier)));
                }

                return(localParamsValue);
            }
            else
            {
                return(null);
            }
        }
Beispiel #28
0
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            // Collect the params
            DataParams localParamsValue = BaseArgument.CollectArguments(this);

            // Serialize the params and place them on the clipboard
            if (localParamsValue != null)
            {
                Clipboard.SetData
                (
                    ClipboardFormatName,
                    DataParamSerializer.DataParamsToSerializableParamData
                    (
                        HostNode.Session.DataSession.UtilityProcess,
                        localParamsValue
                    )
                );
            }
        }
Beispiel #29
0
        protected override void InternalExecute(INode sender, EventParams paramsValue)
        {
            // Fetch the data params from the clipboard and deserialize them
            DataParams localParamsValue =
                DataParamSerializer.SerializableParamDataToDataParams
                (
                    HostNode.Session.DataSession.UtilityProcess,
                    (SerializableParamData)Clipboard.GetData(ClipboardFormatName)
                );

            // Change the params to be out
            foreach (DataParam param in localParamsValue)
            {
                param.Modifier = Modifier.Out;
            }

            // Apply the params
            BaseArgument.ApplyArguments(this, localParamsValue);
        }
Beispiel #30
0
        /// <summary>
        ///     shuts down game and returns to menu
        /// </summary>
        public override void OnUnload()
        {
            var coins = Mathf.RoundToInt(GameScore * 36 / 1080f);

            coins = coins <= 0 ? 0 : coins;

            AppData.Instance().MannyAttribute.IncrementAttribute(Attribute.Coins, coins);

            var experience = GameScore * 30 / 1080;

            experience = experience <= 0 ? 0 : experience;

            AppData.Instance().MannyAttribute.IncrementAttribute(Attribute.Experience, experience);
            AppData.Instance().MannyAttribute.Save();

            DataSource.Insert(DataParams.Build("Points", GameScore).Append("ExperienceGained", experience)
                              .Append("Coins", coins).Append("LogosCaught", LogosCaught).Append("FakeLogosCaught", FakeLogosCaught)
                              .Append("TimePlayedSeconds", Time.time));
            Tracking.RequestSend();
        }
Beispiel #31
0
        public void Execute(DataParams paramsValue)
        {
            Exception exception    = null;
            int       nestingLevel = _process.BeginTransactionalCall();

            try
            {
                CheckCompiled();
                _program.Execute(paramsValue);
            }
            catch (Exception E)
            {
                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _process.EndTransactionalCall(nestingLevel, exception);
            }
        }