Ejemplo n.º 1
0
        private static void PassRetrivedData <T>(ref BinaryData <T> binaryData)
        {
            int index = _numberOfKeysInBinaryDatabase;
            T   value = binaryData.GetInitializedValue();

            bool hasFoundDataInTheList = false;

            for (int i = 0; i < _numberOfKeysInBinaryDatabase; i++)
            {
                if (StringOperation.IsSameString(binaryData.GetKey(), _listOfBinaryDataKeys[i]))
                {
                    value = (T)rawBinaryData.keyedValues[i];
                    index = i;
                    hasFoundDataInTheList = true;
                    break;
                }
            }

            if (!hasFoundDataInTheList)
            {
                rawBinaryData.keyedValues.Add(binaryData.GetKey(), value);
                _listOfBinaryDataKeys.Add(binaryData.GetKey());
            }

            binaryData.SetIndexOfBinaryDataWrapper(index);
            binaryData.SetData(value);
        }
Ejemplo n.º 2
0
        private void AddNewCurrency(string newCurrencyName)
        {
            bool isUniqueCurrencyName = true;

            foreach (AccountManagerSettings.CurrecnyInfo currencyInfo in _reference.listOfCurrencyInfos)
            {
                if (StringOperation.IsSameString(currencyInfo.enumName, newCurrencyName))
                {
                    isUniqueCurrencyName = false;
                    break;
                }
            }

            foreach (AccountManagerSettings.CurrecnyInfo currencyInfo in _listOfCurrencyToBeAdded)
            {
                if (StringOperation.IsSameString(currencyInfo.enumName, newCurrencyName))
                {
                    isUniqueCurrencyName = false;
                    break;
                }
            }

            if (isUniqueCurrencyName)
            {
                AccountManagerSettings.CurrecnyInfo newCurrency = new AccountManagerSettings.CurrecnyInfo()
                {
                    enumName = newCurrencyName
                };

                _listOfCurrencyToBeAdded.Add(newCurrency);
                _flagedForGeneratingEnum = true;

                return;
            }

            Debug.LogError("The following currency name is already in used : " + newCurrencyName);
        }
Ejemplo n.º 3
0
        private static void OnPassingTheLoadedBinaryDataToDifferentQueueV2 <T>(ref int numberOfDataBinaryDatabase, ref Queue <BinaryData <T> > queueOfBinaryDataToRecieveInitialValues)
        {
            int index = numberOfDataBinaryDatabase;

            while (queueOfBinaryDataToRecieveInitialValues.Count > 0)
            {
                bool hasFoundInBinarayDatabase = false;

                BinaryData <T> binaryData = queueOfBinaryDataToRecieveInitialValues.Dequeue();
                T value = binaryData.GetInitializedValue();

                for (int i = 0; i < numberOfDataBinaryDatabase; i++)
                {
                    if (StringOperation.IsSameString(_listOfBinaryDataKeys[i], binaryData.GetKey()))
                    {
                        index = i;
                        //value =  (T)rawBinaryData.keyedValues[i];
                        value = (T)Convert.ChangeType(rawBinaryData.keyedValues[i], typeof(T));
                        hasFoundInBinarayDatabase = true;
                        break;
                    }
                }

                if (!hasFoundInBinarayDatabase)
                {
                    rawBinaryData.keyedValues.Add(binaryData.GetKey(), value);
                    binaryData.SetIndexOfBinaryDataWrapper(index++);
                }
                else
                {
                    binaryData.SetIndexOfBinaryDataWrapper(index);
                }


                binaryData.SetData(value);
            }
        }