Ejemplo n.º 1
0
        public bool IsFake()
        {
            if (ExecParams.ContainsKey("RunMode") && ExecParams["RunMode"].ToLowerInvariant() == "prebilling")
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 public ExecParams Flood(
     float value,
     int from,
     int to,
     ExecParams This = null)
 {
     This = This ?? this;
     this._Flood(value, from, to, This);
     return(this);
 }
Ejemplo n.º 3
0
 public ExecParams Keep(
     object leapCallback = null,
     bool reassign       = false,
     bool dispose        = true,
     float?zeroIn        = null,
     bool skipLeap       = false,
     ExecParams This     = null)
 {
     This = This ?? this;
     this._Keep(leapCallback, reassign, dispose, zeroIn, skipLeap, This);
     return(this);
 }
Ejemplo n.º 4
0
 public ExecParams Wait(
     int duration,
     object leapCallback = null,
     bool reassign       = false,
     bool dispose        = true,
     float?zeroIn        = null,
     bool skipLeap       = false,
     ExecParams This     = null)
 {
     This = This ?? this;
     this._Wait(duration, leapCallback, reassign, dispose, zeroIn, skipLeap, This);
     return(this);
 }
Ejemplo n.º 5
0
 private Func <int, int, object, bool, bool, float?, bool, ExecParams, ExecParams> _Revert;// break// put back old data
 public ExecParams Revert(
     int from,
     int to,
     object leapCallback = null,
     bool reassign       = false,
     bool dispose        = true,
     float?zeroIn        = null,
     bool skipLeap       = false,
     ExecParams This     = null)
 {
     This = This ?? this;
     this._Revert(from, to, leapCallback, reassign, dispose, zeroIn, skipLeap, This);
     return(this);
 }
Ejemplo n.º 6
0
 public ExecParams Then(
     float value,
     string ease,
     int duration,
     object leapCallback = null,
     bool reassign       = false,
     bool dispose        = true,
     float?zeroIn        = null,
     bool skipLeap       = false,
     ExecParams This     = null)
 {
     This = This ?? this;
     this._Then(value, ease, duration, leapCallback, reassign, dispose, zeroIn, skipLeap, This);
     return(this);
 }
Ejemplo n.º 7
0
        public Task(TaskDescription description)
            : base(description)
        {
            if (Priority == TaskPriority.Urgent)
            {
                if (!ExecParams.ContainsKey("MinTime"))
                {
                    ExecParams["MinTime"] = "0";
                }

                if (!ExecParams.ContainsKey("MaxTime"))
                {
                    ExecParams["MaxTime"] = ExecParams["MinTime"];
                }
            }

            OutputParams = new Dictionary <string, string>();

            Time = new TaskTimeMeasurement();
            Time.Started(TaskTimeMetric.Postponed);
            if (this.IsFake())
            {
                Time.Edge(started: TaskTimeMetric.Queued, finished: TaskTimeMetric.Postponed);
            }

            Estimations     = null;
            CurrentSchedule = null;
            Incarnation     = new IncarnationParams();

            State = TaskState.Defined;

            string stepName    = ExecParams.ContainsKey("StepName")? ExecParams["StepName"]: null;
            string storageRoot = IOProxy.Storage.BuildPath(UserId, WfId, stepId: TaskId.ToString(), stepName: stepName);

            this.PackageEngineState = new PackageEngineState(description, storageRoot); // todo : measure PackageEngineState expenses
        }
Ejemplo n.º 8
0
            public TLType[] Add(object[] options, object[] instructionsSet = null)
            {
                object[] instructions = null;
                if (instructionsSet != null)
                {
                    instructions = instructionsSet;
                }
                else if (options != null)
                {
                    instructions = _code.BindInstructionSet(options);
                }
                else
                {
                    return(null);
                }

                object[] timelines     = (object[])instructions[0];
                int      timelineCount = timelines.Count();

                object[] objectParams = (object[])instructions[1];
                int      objCount     = objectParams.Count();

                object[] paramKeys = (object[])instructions[3];

                object[] propValues = (object[])instructions[2];

                bool relative = (bool?)instructions[4] ?? _access.defaults.relative;

                TLType[] nodes = new TLType[objCount];

                for (int t = 0; t < timelineCount; t++)
                {
                    Timeline timeline = (Timeline)timelines[t];

                    Binding binding = (Binding)timeline.code.binding;

                    if (binding.proxy == null)
                    {
                        binding.nodesPerStream = 0;
                        binding.propsPerNode   = instructions[3] != null ? instructions[3].Count() : instructions[2] != null ? instructions[2].Count() : 0;
                        binding.propDataLength = timeline.length;
                        //binding.propsPerNodeList = new int[1000/*queue.propsPerNodeList*/];
                        binding.state = "prebuff";
                        binding.continuancePosValData0 = 1;
                        binding.data0PropDataLength    = binding.continuancePosValData0 + binding.propDataLength;
                        binding.nodeDataLength         = binding.data0PropDataLength * binding.propsPerNode + binding.propsPerNode + 1;
                        binding.streamDataLength       = 0;
                        binding.data    = new float[0];
                        _code.Reversion = (int dataPos) =>
                        {
                            return(dataPos - (binding.propDataLength * (dataPos / binding.propDataLength << 0)) + binding.continuancePosValData0);
                        };
                        binding.proxy = 1;
                        binding.proxy = Agent();
                    }


                    //int[] runtimePropsPerNodeList = binding.propsPerNodeList;
                    // comment out for dynamic keys
                    //int runtimeLastPropsPerNode = binding.propsPerNodeList.Keys.Max() - 1;
                    binding.nodesPerStream += instructions[1].Count();
                    float[] predata = null;

                    for (int o = 0; o < objCount; o++)
                    {
                        object[] obj   = (object[])objectParams[o];
                        var      param = obj[0] as TLType;
                        if (obj[0] is TLPoly)
                        {
                            param = obj[0] as TLPoly;
                        }
                        else if (obj[0] is TLVector3)
                        {
                            param = obj[0] as TLVector3;
                        }
                        else if (obj[0] is TLElement)
                        {
                            param = obj[0] as TLElement;
                        }

                        // TODO refactor - move to class declarations
                        string dataType = (string)CheckListGet(param.type, new
                                                               string[] {
                            "position=translation",
                            "Vector4=translation",
                            "Vector3=translation",
                            "Vector2=translation",
                            "rotation=radian",
                            "Euler=radian",
                            "translate=translation",
                            "translation=" + param.type,
                            "radian=" + param.type,
                            "poly=" + param.type,
                            "other=uniform"
                        });
                        // no precision conversion nessary already float points
                        //float dataTypePrecision = (float?)instructions[5] ?? (float)TMath.Type.Precision(dataType);

                        int?paramKey = (int?)paramKeys[o];

                        object[] initProp = (object[])propValues[0];
                        //string propName = (string)initProp[0];
                        object initPropValue = (object)initProp[1];
                        float? propValueEnd  = (float?)initProp[2];
                        //float? propPrecision = (float?)initProp[3];

                        ExecParams[] paramNode;

                        object[] props;
                        object[] pkeys;

                        propIdKey = dataType == "radian" ? 806 : 801;
                        if (param is TLPoly)
                        {
                            props = TMath.Poly.Generate(dataType, (float[])param.poly, (float[])initPropValue);
                            //props = TMath.Poly.Generate(dataType, (float[])param.poly, (float[])initPropValue, dataTypePrecision);
                            pkeys     = props.Length == paramKeys.Count() ? paramKeys : TMath.Poly.GenerateKeys(props, paramKey ?? propIdKey);
                            paramNode = (ExecParams[])((TLPoly)param).timeline;
                            if (paramNode.Length < props.Length)
                            {
                                paramNode = paramNode.Resize(props.Length);
                                for (int p = 0; p < paramNode.Length; p++)
                                {
                                    paramNode[p] = new ExecParams(((TLPoly)param));
                                }
                                ((TLPoly)param).timeline = paramNode;
                            }
                        }
                        else
                        {
                            props = TMath.Type.ConvertToTypeData(dataType, (object[])propValues, 1, 2);
                            //props = TMath.Type.convertToPrecisionDataType(dataType, (object[])propValues, 1, 2, dataTypePrecision);
                            pkeys = props.Length == paramKeys.Count() ? paramKeys : TMath.Poly.GenerateKeys(props, paramKey ?? propIdKey);
                        }

                        binding.propsPerNode        = props.Length;
                        binding.highestPropsPerNode = binding.propsPerNode > binding.highestPropsPerNode ? binding.propsPerNode : binding.highestPropsPerNode;

                        binding.nodeDataLength = binding.data0PropDataLength * binding.propsPerNode + binding.propsPerNode + 1;

                        binding.streamDataLength += binding.nodeDataLength;
                        float[] zeroin = new float[binding.nodeDataLength];
                        if (predata == null)
                        {
                            binding.increment = 0;
                            predata           = new float[0];
                        }
                        predata = predata.Concat(zeroin);

                        int buffKey = (int?)obj[1] ?? binding.buffIdKey;

                        IDictionary <int, object> buffKeyDic;
                        if (binding.ids.TryGetValue(buffKey, out buffKeyDic))
                        {
                            /* Cannot overwrite */
                        }
                        else
                        {
                            param.timeline.binding    = buffKey;
                            param.timeline.position   = binding.dataIncrement;
                            param.timeline.conversion = dataType;
                            param.timeline.relative   = relative;
                            binding.ids.Add(buffKey, new Dictionary <int, object>()
                            {
                                { 0, param }
                            });
                        }

                        predata[binding.increment++] = (binding.buffIdKey = buffKey);
                        binding.dataIncrement++; // For the node slot, assign buffIdKey for ensure consistency & no conflict
                        binding.buffIdKey++;     // increment
                        // comment out for dynamic keys
                        // if (runtimePropsPerNodeList[runtimeLastPropsPerNode] != pkeys.length)
                        //binding.propsPerNodeList.Add(buffKey, binding.propsPerNode);
                        int propsPerNodeListDic;
                        if (binding.propsPerNodeList.TryGetValue(buffKey, out propsPerNodeListDic))
                        {
                            /* Cannot overwrite */
                            //binding.propsPerNodeList[buffKey] = binding.propsPerNode;
                        }
                        else
                        {
                            binding.propsPerNodeList.Add(buffKey, binding.propsPerNode);
                        }

                        for (int p = 0; p < props.Length; p++)
                        {
                            object[] prop        = (object[])props[p];
                            string   propName    = prop[0].ToString();
                            float    propValue   = (float?)prop[1] ?? (float)param.GetMember(propName);
                            bool     hasEndValue = dataType != "poly" && prop[2] != null;
                            float    endValue    = dataType != "poly" && hasEndValue ? (float)prop[2] : 0;
                            bool     isXYZ       = dataType != "poly" && (bool)prop[3];

                            int propKey = pkeys[p] != null ? (int)pkeys[p] : binding.propIdKey;

                            predata[binding.increment++] = propKey;
                            binding.dataIncrement++;
                            predata[binding.increment++] = 1;

                            var properties = dataType == "poly" ? (ExecParams)(((TLPoly)param).timeline)[(int)prop[0]] : (ExecParams)param.GetMember("timeline." + propName);
                            properties.binding   = propKey;
                            properties.data0PosI = binding.dataIncrement++;
                            //properties.relative = relative;
                            //properties.conversion = dataType;
                            binding.dataIncrement += propDataLength;
                            //properties.precision = dataTypePrecision;

                            bool isDomElement = (dataType != "poly" && (param.GetMember(propName + ".value") != null || param is TLElement));
                            // TO-DO rework binding for all or future demos, uniform scheme
                            // Assign starting value to both stream value and node property

                            object propKeyObject;
                            if (binding.ids[buffKey].TryGetValue(propKey, out propKeyObject))
                            {
                                /* Cannot overwrite
                                 * binding.ids[buffKey][propKey] = new
                                 * {
                                 *  binding = isDomElement ? "value" : propName,
                                 *  property = isDomElement ? propName : null,
                                 *  value = propValue
                                 * };
                                 */
                            }
                            else
                            {
                                switch (propName)
                                {
                                case "x":
                                    binding.ids[buffKey].Add(propKey, new Bind.x {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "y":
                                    binding.ids[buffKey].Add(propKey, new Bind.y {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "z":
                                    binding.ids[buffKey].Add(propKey, new Bind.z {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "w":
                                    binding.ids[buffKey].Add(propKey, new Bind.w {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "u":
                                    binding.ids[buffKey].Add(propKey, new Bind.u {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "v":
                                    binding.ids[buffKey].Add(propKey, new Bind.v {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "value":
                                    binding.ids[buffKey].Add(propKey, new Bind.value {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "radius":
                                    binding.ids[buffKey].Add(propKey, new Bind.radius {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "scale":
                                    binding.ids[buffKey].Add(propKey, new Bind.scale {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "rotation":
                                    binding.ids[buffKey].Add(propKey, new Bind.rotation {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                case "alpha":
                                    binding.ids[buffKey].Add(propKey, new Bind.alpha {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;

                                default:
                                    binding.ids[buffKey].Add(propKey, new Bind.value {
                                        parameter = param
                                    }.Dom(isDomElement, propName).xyz(isXYZ));
                                    break;
                                }
                            }

                            if (isDomElement)
                            {
                                param.GetMember(propName + ".value",
                                                propValue
                                                //propName == "value" ? propValue : propValue / dataTypePrecision
                                                );
                            }
                            else
                            {
                                param.GetMember(propName,
                                                propValue
                                                //propName == "value" ? propValue : propValue / dataTypePrecision
                                                );
                            }

                            for (int bDI = 0, alen = binding.propDataLength; bDI < alen; bDI++)
                            {
                                if (hasEndValue)
                                {
                                    if (relative)
                                    {
                                        predata[binding.increment++] = ((endValue - propValue) / propDataLength);
                                    }
                                    else
                                    {
                                        predata[binding.increment++] = (propValue + ((endValue - propValue) / propDataLength * bDI));
                                    }
                                }
                                else
                                {
                                    if (relative)
                                    {
                                        predata[binding.increment++] = 0;
                                    }
                                    else
                                    {
                                        predata[binding.increment++] = propValue;
                                    }
                                }
                            }
                            binding.propIdKey = propKey;
                            binding.propIdKey++;
                        }
                        nodes[o] = param;
                    }
                    binding.data = binding.data.Concat(predata);
                }
                return(nodes);
            }
Ejemplo n.º 9
0
 public Exec(TLVector2 This)
 {
     x = new ExecParams(This);
     y = new ExecParams(This);
 }