/// <summary>
        /// Parses Credentials from a file into a usable data structure
        /// </summary>
        /// <param name="fileFormat">Format of CSV-File</param>
        /// <param name="stringTable">String table</param>
        /// <returns>A list of parsed Credentials</returns>
        public IEnumerable <Credential> ParseCredentialsFromFile(CSVFileFormat fileFormat, List <List <string> > stringTable)
        {
            List <Credential> credentials = new List <Credential>();

            for (int index = 1; index < stringTable.Count; index++)
            {
                if (stringTable[index].All(x => string.IsNullOrEmpty(x)))
                {
                    continue;
                }

                Dictionary <Credential.UserDataType, string> dictionary =
                    new Dictionary <Credential.UserDataType, string>();

                foreach (string dataType in stringTable[0])
                {
                    int column = stringTable[0].IndexOf(dataType);
                    KeyValuePair <Credential.UserDataType, string>?keyValuePair =
                        ParseUserDataType(fileFormat, dataType, stringTable[index][column]);

                    if (keyValuePair != null)
                    {
                        dictionary.Add(keyValuePair.GetValueOrDefault().Key, keyValuePair.GetValueOrDefault().Value);
                    }
                }

                if (dictionary.Count != 0)
                {
                    credentials.Add(new Credential(dictionary));
                }
            }

            return(credentials);
        }
Example #2
0
        public IDictionary <string, View> FetchSharedElementsToAnimate(MvxBasePresentationAttribute attribute, MvxViewModelRequest request)
        {
            IDictionary <string, View> sharedElements = new Dictionary <string, View>();

            KeyValuePair <string, View>?photo = CreateSharedElementPair(Resource.String.transition_contact_photo);

            if (photo != null)
            {
                sharedElements.Add(photo.GetValueOrDefault());
            }

            KeyValuePair <string, View>?phone = CreateSharedElementPair(Resource.String.transition_contact_phone);

            if (phone != null)
            {
                sharedElements.Add(phone.GetValueOrDefault());
            }

            KeyValuePair <string, View>?name = CreateSharedElementPair(Resource.String.transition_contact_full_name);

            if (name != null)
            {
                sharedElements.Add(name.GetValueOrDefault());
            }

            return(sharedElements);
        }
Example #3
0
        /// <summary>
        /// Найти идентификатор типа текущей панели
        ///  , зарегистрированного в библиотеке
        /// </summary>
        /// <returns>Идентификатор типа панели</returns>
        private int findMyID()
        {
            int  iRes   = -1;
            Type myType = Type.Missing as Type;

            myType = this.GetType();

            //Вариант №1
            KeyValuePair <int, Type>?pairRes = null;

            pairRes = (_iFuncPlugin as PlugInBase).GetRegisterTypes().First(item => { return(item.Value == myType); });

            if (!(pairRes == null))
            {
                iRes = pairRes.GetValueOrDefault().Key;
            }
            else
            {
                ;
            }

            ////Вариант №2
            //Dictionary<int, Type> dictRegId = (_iFuncPlugin as PlugInBase).GetRegisterTypes();

            //foreach (var item in dictRegId)
            //{
            //    if (item.Value == myType)
            //    {
            //        iRes = item.Key;
            //    }
            //}

            return(iRes);
        }
Example #4
0
            /// <summary>
            /// Возвратить идентификатор плюгИна по идентификатору реализованной в нем панели
            /// </summary>
            /// <param name="idFPanel">Идентификатор панели, реализованной в плюгИне</param>
            /// <returns>Идентификатор плюгИна</returns>
            public int GetKeyOfIdFPanel(int idFPanel)
            {
                int iRes = -1;
                KeyValuePair <int, PlugInBase>?pairRes = null;

                // цикл по всем загруженным плюгИнам - проверить регистрацию панели в плюгИне
                pairRes = this.FirstOrDefault(item => { return(item.Value.IsRegistred(idFPanel) == true); });

                if (!(pairRes == null))
                {
                    iRes = pairRes.GetValueOrDefault().Key;
                }
                else
                {
                    ;
                }

                //// цикл по всем загруженным плюгИнам
                //foreach (KeyValuePair<int, PlugInBase> pair in this)
                //    // проверить регистрацию панели в плюгИне
                //    if (pair.Value.IsRegistred(idFPanel) == true)
                //    {
                //        iRes = pair.Key;

                //        break;
                //    }
                //    else
                //        ;

                return(iRes);
            }
Example #5
0
 public bool IsCheck(KeyValuePair <string, string>?pro)
 {
     if (!IsCheckUser)
     {
         return(true);
     }
     if (!pro.HasValue)
     {
         return(false);
     }
     if (pro.GetValueOrDefault().Key == UserName && pro.GetValueOrDefault().Value == Password)
     {
         return(true);
     }
     return(false);
 }
Example #6
0
            public string GetCategory(int index)
            {
                KeyValuePair <string, int[]>?entry = GetEntry(index);

                if (entry == null)
                {
                    return(null);
                }
                return(entry.GetValueOrDefault().Key);
            }
Example #7
0
            public int[] GetSdr(int index)
            {
                KeyValuePair <string, int[]>?entry = GetEntry(index);

                if (entry == null)
                {
                    return(null);
                }
                return(entry.GetValueOrDefault().Value);
            }
Example #8
0
        public void NavigateToNextUrl()
        {
            KeyValuePair <string, string>?item = this.NextItem();
            string url = item.GetValueOrDefault().Value;

            if (item != null && !string.IsNullOrWhiteSpace(url))
            {
                StatusManager.Status("Navigating to: " + url);
                this.Driver.NavigateToUrl(url);
            }
            else
            {
                StatusManager.Status("Navigating to: about:blank");
                this.Driver.NavigateToUrl("about:blank");
                this.Driver.Recorder.Stop();
            }
        }
Example #9
0
    private void RemoveFromList(GameObject obj)
    {
        KeyValuePair <float, GameObject>?p = null;

        foreach (var pair in _singleClickList)
        {
            if (pair.Value != obj)
            {
                continue;
            }

            p = pair;
            break;
        }

        if (p != null)
        {
            _singleClickList.Remove(p.GetValueOrDefault());
        }
    }
Example #10
0
        public void UpdateCurrActiveGridItem(Vector2 playerPos)
        {
            var gridPos = GetGridPosFromMousePos(playerPos);

            // If position isnt in grid
            if (!PosIsInGrid(gridPos))
            {
                if (currActiveGridItem != null)
                {
                    ExitGrid?.Invoke();
                    currActiveGridItem = null;
                }

                return;
            }

            // Get grid item currently hovering over
            var gridItem = gridItems[gridPos];

            // If no currently active grid item has been set
            if (currActiveGridItem == null)
            {
                currActiveGridItem = new KeyValuePair <Vector2Int, EditorGridItem>(gridPos, gridItem);
                EnterGrid?.Invoke(gridPos);
                return;
            }

            // Get last last frame currently hovering grid item
            var lastGridPos  = currActiveGridItem.GetValueOrDefault().Key;
            var lastGridItem = currActiveGridItem?.Value;

            if (lastGridPos == gridPos)
            {
                return;
            }

            // Grid item events
            EnterGrid?.Invoke(gridPos);
            currActiveGridItem = new KeyValuePair <Vector2Int, EditorGridItem>(gridPos, gridItem);
        }
Example #11
0
        public string ProvideTitle()
        {
            KeyValuePair <string, string>?item = this.NextItem();

            return(item.GetValueOrDefault().Key);
        }
Example #12
0
        public K Find(K key)
        {
            KeyValuePair <K, K>?keyValuePair = this.data.Find(key);

            return(keyValuePair.GetValueOrDefault().Key);
        }