public SettingsPrivacyViewModelBase(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator, TLInputPrivacyKeyBase inputKey, TLType key)
            : base(protoService, cacheService, aggregator)
        {
            _inputKey = inputKey;
            _key      = key;

            UpdatePrivacyAsync();
            Aggregator.Subscribe(this);
        }
Пример #2
0
        private void SyncTLs(TLType translationType, bool ForceOverwrite = false)
        {
            string PersonalityNumber = Personality.Value.Replace("c", "");
            string FolderPath        = Paths.PluginPath;

            switch (translationType)
            {
            case TLType.Scenario:
                Logger.Log(LogLevel.Info, $"Syncing Scenario translations for personality {Personality.Value}...");
                FolderPath = Path.Combine(FolderPath, @"translation\adv\scenario");
                FolderPath = Path.Combine(FolderPath, Personality.Value);
                break;

            case TLType.Communication:
                Logger.Log(LogLevel.Info, $"Syncing Communication translations for personality {Personality.Value}...");
                if (Personality.Value.Contains("-"))
                {
                    Logger.Log(LogLevel.Info, $"Scenario characters have no Communication files, skipping.");
                    return;
                }
                FolderPath = Path.Combine(FolderPath, @"translation\communication");
                break;

            case TLType.H:
                Logger.Log(LogLevel.Info, $"Syncing H translations for personality {Personality.Value}...");
                FolderPath = Path.Combine(FolderPath, @"translation\h\list");
                break;

            default:
                return;
            }

            if (!Directory.Exists(FolderPath))
            {
                return;
            }

            var FilePaths = Directory.GetFiles(FolderPath, "*.txt", SearchOption.AllDirectories).Reverse();

            if (FilePaths.Count() == 0)
            {
                return;
            }

            foreach (string File1 in FilePaths)
            {
                string Ending   = File1.Replace(FolderPath, "").Remove(0, 1);
                bool   DidEdit1 = false;

                switch (translationType)
                {
                case TLType.Scenario:
                    if (Ending.Contains("penetration"))
                    {
                        continue;
                    }
                    Ending = Ending.Remove(0, 2);
                    break;

                case TLType.Communication:
                    if (Ending.Contains($"communication_{PersonalityNumber}"))
                    {
                        Ending = Ending.Remove(0, Ending.IndexOf("communication_"));
                    }
                    else if (Ending.Contains($"communication_off_{PersonalityNumber}"))
                    {
                        Ending = Ending.Remove(0, Ending.IndexOf("communication_off_"));
                    }
                    else if (Ending.Contains($"optiondisplayitems_{PersonalityNumber}"))
                    {
                        Ending = Ending.Remove(0, Ending.IndexOf("optiondisplayitems_"));
                    }
                    else
                    {
                        continue;
                    }
                    break;

                case TLType.H:
                    if (Ending.Contains($"personality_voice_{Personality.Value}"))
                    {
                        Ending = $"personality_voice_{Personality.Value}";
                    }
                    else
                    {
                        continue;
                    }
                    break;
                }
                //Logger.Log(LogLevel.Info, $"+{Ending}");

                string[] Lines1 = File.ReadAllLines(File1);
                Dictionary <string, string> TLLines = new Dictionary <string, string>();

                for (int i = 0; i < Lines1.Count(); i++)
                {
                    string Line1 = Lines1[i];
                    if (Line1.IsNullOrEmpty())
                    {
                        continue;
                    }

                    var Line1Split = Line1.Split('=');

                    if (CheckLineForErrors(Line1, File1, i + 1))
                    {
                        continue;
                    }

                    if (Line1.StartsWith(@"//") || Line1.EndsWith("="))
                    {
                        continue;
                    }

                    if (FormatTLText(ref Line1Split[1]))
                    {
                        DidEdit1 = true;
                    }

                    if (FormatUnTLText(ref Line1Split[0]))
                    {
                        DidEdit1 = true;
                    }

                    Lines1[i] = $"{Line1Split[0]}={Line1Split[1]}";
                    try
                    {
                        TLLines.Add(Line1Split[0], Line1Split[1]);
                    }
                    catch (ArgumentException)
                    {
                        Logger.Log(LogLevel.Warning, $"Duplicate translation line detected, only the first will be used: {Line1Split[0]}");
                    }
                }
                //foreach (var x in TLLines)
                //    Logger.Log(LogLevel.Info, x);

                if (DidEdit1)
                {
                    SaveFile(File1, Lines1);
                }

                foreach (string File2 in FilePaths.Where(x => x != File1))
                {
                    switch (translationType)
                    {
                    case TLType.Scenario:
                        if (!File2.Replace(FolderPath, "").EndsWith(Ending))
                        {
                            continue;
                        }
                        break;

                    case TLType.Communication:
                        if ((File2.Contains($"communication_{PersonalityNumber}") || File2.Contains($"communication_off_{PersonalityNumber}")) &&
                            (Ending.Contains($"communication_{PersonalityNumber}") || Ending.Contains($"communication_off_{PersonalityNumber}")))
                        {
                        }
                        else if (File2.Contains($"optiondisplayitems_{PersonalityNumber}") && Ending.Contains($"optiondisplayitems_{PersonalityNumber}"))
                        {
                        }
                        else
                        {
                            continue;
                        }
                        break;

                    case TLType.H:
                        if (!File2.Contains(Ending))
                        {
                            continue;
                        }
                        break;
                    }

                    bool     DidEdit2 = false;
                    string[] Lines2   = File.ReadAllLines(File2);

                    //Logger.Log(LogLevel.Info, $"-{File2}");

                    for (int i = 0; i < Lines2.Count(); i++)
                    {
                        string Line2 = Lines2[i];
                        if (Line2.IsNullOrEmpty())
                        {
                            continue;
                        }
                        string[] Line2Split = Line2.Split('=');

                        if (CheckLineForErrors(Line2, File2, i + 1))
                        {
                            continue;
                        }

                        if (FormatUnTLText(ref Line2Split[0]))
                        {
                            DidEdit2 = true;
                        }

                        if (FormatTLText(ref Line2Split[1]))
                        {
                            DidEdit2 = true;
                        }

                        Lines2[i] = $"{Line2Split[0]}={Line2Split[1]}";

                        string JPText = Line2Split[0];
                        if (JPText.StartsWith(@"//"))
                        {
                            JPText = JPText.Substring(2, Line2Split[0].Length - 2);
                        }
                        JPText = JPText.Trim();

                        string TLText = Line2Split[1];

                        if (TLLines.TryGetValue(JPText, out string NewTLText))
                        {
                            if (TLText.IsNullOrEmpty())
                            {
                                Lines2[i] = $"{JPText}={NewTLText}";
                                DidEdit2  = true;
                                //Logger.Log(LogLevel.Info, $"Setting:{JPText}={NewTLText}");
                            }
                            else
                            {
                                if (TLText != NewTLText)
                                {
                                    StringBuilder sb = new StringBuilder("Translations do not match!").Append(Environment.NewLine);
                                    sb.Append(File1).Append(Environment.NewLine);
                                    sb.Append($"{JPText}={NewTLText}").Append(Environment.NewLine);
                                    sb.Append($"Line:{i + 1} {File2}").Append(Environment.NewLine);
                                    sb.Append($"{JPText}={TLText}");
                                    if (ForceOverwrite)
                                    {
                                        sb.Append(Environment.NewLine).Append("Overwriting...");
                                        Lines2[i] = $"{JPText}={NewTLText}";
                                        DidEdit2  = true;
                                    }
                                    Logger.Log(LogLevel.Warning, sb.ToString());
                                    continue;
                                }
                            }
                        }
                    }
                    if (DidEdit2)
                    {
                        SaveFile(File2, Lines2);
                    }
                }
            }
        }
Пример #3
0
 public ExecParams(TLVector3 parameter)
 {
     this.parameter = parameter;
     Init();
 }
Пример #4
0
 public ExecParams(TLPoly parameter)
 {
     this.parameter = parameter;
     Init();
 }
Пример #5
0
 public ExecParams(TLElement parameter)
 {
     this.parameter = parameter;
     Init();
 }
Пример #6
0
        public static void ProcessError(TLRPCError error, TLType request, params Object[] args)
        {
            if (error.ErrorCode == 406 || error.ErrorMessage == null)
            {
                return;
            }
            if (request == TLType.ChannelsJoinChannel ||
                request == TLType.ChannelsEditAdmin ||
                request == TLType.ChannelsInviteToChannel ||
                request == TLType.MessagesAddChatUser ||
                request == TLType.MessagesStartBot ||
                request == TLType.ChannelsEditBanned)
            {
                //if (fragment != null)
                //{
                ShowAddUserAlert(error.ErrorMessage, (Boolean)args[0]);
                //}
                //else
                //{
                //    if (error.ErrorMessage.Equals("PEER_FLOOD"))
                //    {
                //        ShowPeerFloodAlert(1);
                //    }
                //}
            }
            else if (request == TLType.MessagesCreateChat)
            {
                if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowFloodWaitAlert(error.ErrorMessage);
                }
                else
                {
                    ShowAddUserAlert(error.ErrorMessage, false);
                }
            }
            else if (request == TLType.ChannelsCreateChannel)
            {
                if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowFloodWaitAlert(error.ErrorMessage);
                }
            }
            else if (request == TLType.MessagesEditMessage)
            {
                if (!error.ErrorMessage.Equals("MESSAGE_NOT_MODIFIED"))
                {
                    ShowSimpleAlert(Strings.Android.EditMessageError);
                }
            }
            else if (request == TLType.MessagesSendMessage ||
                     request == TLType.MessagesSendMedia ||
                     request == TLType.MessagesSendInlineBotResult ||
                     request == TLType.MessagesForwardMessages)
            {
                if (error.ErrorMessage.Equals("PEER_FLOOD"))
                {
                    ShowPeerFloodAlert(0);
                }
            }
            else if (request == TLType.MessagesImportChatInvite)
            {
                if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleAlert(Strings.Android.FloodWait);
                }
                else if (error.ErrorMessage.Equals("USERS_TOO_MUCH"))
                {
                    ShowSimpleAlert(Strings.Android.JoinToGroupErrorFull);
                }
                else
                {
                    ShowSimpleAlert(Strings.Android.JoinToGroupErrorNotExist);
                }
            }
            else if (request == TLType.MessagesGetAttachedStickers)
            {
                //Toast.makeText(fragment.getParentActivity(), Strings.Android.ErrorOccurred + "\n" + error.ErrorMessage, Toast.LENGTH_SHORT).show();
            }
            else if (request == TLType.AccountConfirmPhone)
            {
                if (error.ErrorMessage.Contains("PHONE_CODE_EMPTY") || error.ErrorMessage.Contains("PHONE_CODE_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidCode);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EXPIRED"))
                {
                    ShowSimpleAlert(Strings.Android.CodeExpired);
                }
                else if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleAlert(Strings.Android.FloodWait);
                }
                else
                {
                    ShowSimpleAlert(error.ErrorMessage);
                }
            }
            else if (request == TLType.AuthResendCode)
            {
                if (error.ErrorMessage.Contains("PHONE_NUMBER_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidPhoneNumber);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EMPTY") || error.ErrorMessage.Contains("PHONE_CODE_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidCode);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EXPIRED"))
                {
                    ShowSimpleAlert(Strings.Android.CodeExpired);
                }
                else if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleAlert(Strings.Android.FloodWait);
                }
                else if (error.ErrorCode != -1000)
                {
                    ShowSimpleAlert(Strings.Android.ErrorOccurred + "\n" + error.ErrorMessage);
                }
            }
            else if (request == TLType.AccountSendConfirmPhoneCode)
            {
                if (error.ErrorCode == 400)
                {
                    ShowSimpleAlert(Strings.Android.CancelLinkExpired);
                }
                else if (error.ErrorMessage != null)
                {
                    if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                    {
                        ShowSimpleAlert(Strings.Android.FloodWait);
                    }
                    else
                    {
                        ShowSimpleAlert(Strings.Android.ErrorOccurred);
                    }
                }
            }
            else if (request == TLType.AccountChangePhone)
            {
                if (error.ErrorMessage.Contains("PHONE_NUMBER_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidPhoneNumber);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EMPTY") || error.ErrorMessage.Contains("PHONE_CODE_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidCode);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EXPIRED"))
                {
                    ShowSimpleAlert(Strings.Android.CodeExpired);
                }
                else if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleAlert(Strings.Android.FloodWait);
                }
                else
                {
                    ShowSimpleAlert(error.ErrorMessage);
                }
            }
            else if (request == TLType.AccountSendChangePhoneCode)
            {
                if (error.ErrorMessage.Contains("PHONE_NUMBER_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidPhoneNumber);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EMPTY") || error.ErrorMessage.Contains("PHONE_CODE_INVALID"))
                {
                    ShowSimpleAlert(Strings.Android.InvalidCode);
                }
                else if (error.ErrorMessage.Contains("PHONE_CODE_EXPIRED"))
                {
                    ShowSimpleAlert(Strings.Android.CodeExpired);
                }
                else if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleAlert(Strings.Android.FloodWait);
                }
                else if (error.ErrorMessage.StartsWith("PHONE_NUMBER_OCCUPIED"))
                {
                    ShowSimpleAlert(string.Format(Strings.Android.ChangePhoneNumberOccupied, (String)args[0]));
                }
                else
                {
                    ShowSimpleAlert(Strings.Android.ErrorOccurred);
                }
            }
            else if (request == TLType.AccountUpdateUsername)
            {
                switch (error.ErrorMessage)
                {
                case "USERNAME_INVALID":
                    ShowSimpleAlert(Strings.Android.UsernameInvalid);
                    break;

                case "USERNAME_OCCUPIED":
                    ShowSimpleAlert(Strings.Android.UsernameInUse);
                    break;

                //case "USERNAMES_UNAVAILABLE":
                //    ShowSimpleAlert(Strings.Android.FeatureUnavailable);
                //    break;
                default:
                    ShowSimpleAlert(Strings.Android.ErrorOccurred);
                    break;
                }
            }
            else if (request == TLType.ContactsImportContacts)
            {
                if (error == null || error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleAlert(Strings.Android.FloodWait);
                }
                else
                {
                    ShowSimpleAlert(Strings.Android.ErrorOccurred + "\n" + error.ErrorMessage);
                }
            }
            else if (request == TLType.AccountGetPassword || request == TLType.AccountGetTmpPassword)
            {
                if (error.ErrorMessage.StartsWith("FLOOD_WAIT"))
                {
                    ShowSimpleToast(GetFloodWaitString(error.ErrorMessage));
                }
                else
                {
                    ShowSimpleToast(error.ErrorMessage);
                }
            }
            else if (request == TLType.PaymentsSendPaymentForm)
            {
                switch (error.ErrorMessage)
                {
                case "BOT_PRECHECKOUT_FAILED":
                    ShowSimpleToast(Strings.Android.PaymentPrecheckoutFailed);
                    break;

                case "PAYMENT_FAILED":
                    ShowSimpleToast(Strings.Android.PaymentFailed);
                    break;

                default:
                    ShowSimpleToast(error.ErrorMessage);
                    break;
                }
            }
            else if (request == TLType.PaymentsValidateRequestedInfo)
            {
                switch (error.ErrorMessage)
                {
                case "SHIPPING_NOT_AVAILABLE":
                    ShowSimpleToast(Strings.Android.PaymentNoShippingMethod);
                    break;

                default:
                    ShowSimpleToast(error.ErrorMessage);
                    break;
                }
            }
            //// Added
            //else if (request == TLType.AuthSignUp)
            //{
            //    if (error.ErrorMessage.Contains("PHONE_NUMBER_INVALID"))
            //    {
            //        ShowSimpleAlert(Strings.Android.InvalidPhoneNumber);
            //    }
            //    else if (error.ErrorMessage.Contains("PHONE_CODE_EMPTY") || error.ErrorMessage.Contains("PHONE_CODE_INVALID"))
            //    {
            //        ShowSimpleAlert(Strings.Android.InvalidCode);
            //    }
            //    else if (error.ErrorMessage.Contains("PHONE_CODE_EXPIRED"))
            //    {
            //        ShowSimpleAlert(Strings.Android.CodeExpired);
            //    }
            //    else if (error.ErrorMessage.Contains("FIRSTNAME_INVALID"))
            //    {
            //        ShowSimpleAlert(Strings.Android.InvalidFirstName);
            //    }
            //    else if (error.ErrorMessage.Contains("LASTNAME_INVALID"))
            //    {
            //        ShowSimpleAlert(Strings.Android.InvalidLastName);
            //    }
            //    else
            //    {
            //        ShowSimpleAlert(error.ErrorMessage);
            //    }
            //}

            return;
        }
Пример #7
0
        private void FixType(TLType type)
        {
            // TODO: refactor this huge method.

            string typeName = type.OriginalName;

			//Additions for compatibity with layer 51 schema

            // Vector.
            Match match = VectorRegex.Match(typeName);
            if (match.Success)
            {
                TLType itemsType = _typesBox[match.Groups["ItemsType"].Value];
                FixType(itemsType);
                type.Name = string.Format("System.Collections.Generic.List<{0}>", itemsType.Name);
                if (match.Groups["Bare"].Success)
                {
                    type.SerializationModeOverride = TLSerializationMode.Bare;
                }
                type.IsBuiltIn = true;
                return;
            }

            // bool.
            match = BoolRegex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (bool).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // string.
            match = StringRegex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (string).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // string.
            match = DoubleRegex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (double).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // int.
            match = Int32Regex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (UInt32).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // long.
            match = Int64Regex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (UInt64).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // int128.
            match = Int128Regex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (Int128).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // int256.
            match = Int256Regex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (Int256).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // bytes.
            match = TLBytesRegex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (byte[]).FullName;
                type.IsBuiltIn = true;
                return;
            }

            // % bare types.
            match = BareTypeRegex.Match(typeName);
            if (match.Success)
            {
                typeName = match.Groups["Type"].Value;
                type.Name = _constructors.Where(c => c.Type.Name == typeName).Select(c => c.Name).SingleOrDefault() ?? typeName;
                type.SerializationModeOverride = TLSerializationMode.Bare;
                // TODO: fix type.
                return;
            }

            // Object.
            match = TLObjectRegex.Match(typeName);
            if (match.Success)
            {
                type.Name = typeof (Object).FullName;
                type.IsBuiltIn = true;
            }
        }
Пример #8
0
        protected override async void SendExecute()
        {
            var user = SelectedItems.FirstOrDefault();

            if (user == null)
            {
                return;
            }

            TLType type = 0;
            Task <MTProtoResponse <TLUpdatesBase> > task = null;

            if (_item is TLChannel channel)
            {
                type = TLType.ChannelsInviteToChannel;
                task = ProtoService.InviteToChannelAsync(channel.ToInputChannel(), new TLVector <TLInputUserBase> {
                    user.ToInputUser()
                });
            }
            else if (_item is TLChat chat)
            {
                var count  = 100;
                var config = CacheService.GetConfig();
                if (config != null)
                {
                    count = config.ForwardedCountMax;
                }

                type = TLType.MessagesAddChatUser;
                task = ProtoService.AddChatUserAsync(chat.Id, user.ToInputUser(), count);
            }

            if (task == null)
            {
                return;
            }

            var response = await task;

            if (response.IsSucceeded)
            {
                NavigationService.GoBack();

                if (response.Result is TLUpdates updates)
                {
                    var newMessage = updates.Updates.FirstOrDefault(x => x is TLUpdateNewMessage) as TLUpdateNewMessage;
                    if (newMessage != null)
                    {
                        Aggregator.Publish(newMessage.Message);
                    }

                    var newChannelMessage = updates.Updates.FirstOrDefault(x => x is TLUpdateNewChannelMessage) as TLUpdateNewChannelMessage;
                    if (newChannelMessage != null)
                    {
                        Aggregator.Publish(newChannelMessage.Message);
                    }
                }
            }
            else
            {
                AlertsService.ProcessError(response.Error, type, _item is TLChannel inner && inner.IsBroadcast);
            }
        }
Пример #9
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);
            }