Exemplo n.º 1
1
 public IfNull(
      object firstValue, ValueObjectType firstValueType,
      object secondValue, ValueObjectType secondValueType)
 {
     this.Value1 = new ValueWrapper(firstValue, firstValueType);
     this.Value2 = new ValueWrapper(secondValue, secondValueType);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a container for a single animation for an object
 /// </summary>
 public AnimationGroup()
 {
     Activations      = new List <AnimationActivation>();
     Effects          = new List <AnimationEffect>();
     EffectTiming     = new ValueWrapper <double>();
     HookedAnimations = new List <AfterAnimation>();
 }
Exemplo n.º 3
0
        private void GetThreadName(ThreadWrapper threadWrapper, ValueWrapper threadObject, NuGenFrameRefresher threadActiveFrameRefresher)
        {
            List <ModuleWrapper> modules = threadWrapper.FindModulesByName(GetThreadNameMethod.BaseTypeDefinition.ModuleScope.Assembly.FileName);

            if (modules.Count == 1)
            {
                ModuleWrapper       module = modules[0];
                FunctionWrapper     getThreadNameFunction = module.GetFunction(GetThreadNameMethod.Token);
                List <ValueWrapper> arguments             = new List <ValueWrapper>(1);
                arguments.Add(threadObject);

                NuGenEvaluationHandler    methodCaller     = new NuGenEvaluationHandler(threadActiveFrameRefresher);
                NuGenBaseEvaluationResult evaluationResult = methodCaller.CallFunction(getThreadNameFunction, arguments);

                if (evaluationResult.IsSuccessful)
                {
                    if (evaluationResult.Result != null && (CorElementType)evaluationResult.Result.ElementType == CorElementType.ELEMENT_TYPE_STRING)
                    {
                        ValueWrapper dereferencedResult = evaluationResult.Result.DereferenceValue();

                        if (dereferencedResult != null)
                        {
                            EvaluatedThreadName = NuGenHelperFunctions.ShowEscapeCharacters(dereferencedResult.GetStringValue(), true);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 public IfNull(
      object firstValue, ValueObjectType firstValueType,
      string secondTableName, string secondColumnName)
 {
     this.Value1 = new ValueWrapper(firstValue, firstValueType);
     this.Value2 = new ValueWrapper(secondTableName, secondColumnName);
 }
Exemplo n.º 5
0
    public void Add(TKey key, TValue value)
    {
        var wrap = new ValueWrapper(key, value);

        this.innerDict.Add(key, value);
        this.orderedElements.Add(wrap);
    }
        static T GetEditorPref <T>(string key, T fallback = default(T))
        {
            var k = GetEditorPrefKey <T>(key);

            if (!EditorPrefs.HasKey(k))
            {
                return(fallback);
            }

            var o = (object)fallback;

            if (typeof(T) == typeof(string))
            {
                o = EditorPrefs.GetString(k, (string)o);
            }
            else if (typeof(T) == typeof(bool))
            {
                o = EditorPrefs.GetBool(k, (bool)o);
            }
            else if (typeof(T) == typeof(float))
            {
                o = EditorPrefs.GetFloat(k, (float)o);
            }
            else if (typeof(T) == typeof(int))
            {
                o = EditorPrefs.GetInt(k, (int)o);
            }
            else
            {
                return(ValueWrapper <T> .Deserialize(EditorPrefs.GetString(k)));
            }

            return((T)o);
        }
        static void SetEditorPref <T>(string key, T value)
        {
            var k = GetEditorPrefKey <T>(key);

            if (typeof(T) == typeof(string))
            {
                EditorPrefs.SetString(k, (string)(object)value);
            }
            else if (typeof(T) == typeof(bool))
            {
                EditorPrefs.SetBool(k, (bool)(object)value);
            }
            else if (typeof(T) == typeof(float))
            {
                EditorPrefs.SetFloat(k, (float)(object)value);
            }
            else if (typeof(T) == typeof(int))
            {
                EditorPrefs.SetInt(k, (int)(object)value);
            }
            else
            {
                EditorPrefs.SetString(k, ValueWrapper <T> .Serialize(value));
            }
        }
Exemplo n.º 8
0
        public ABlackboardElement()
        {
            m_guid = Guid.NewGuid().ToString();
            Type   = typeof(T);
            m_name = $"new {Type.Name}";

            m_serializedType = Type.AssemblyQualifiedName;

            object newValue;

            if (Nullable.GetUnderlyingType(Type) != null)
            {
                newValue = (T)Activator.CreateInstance(Type);
            }
            else
            {
                T defaultT = default;
                newValue = defaultT;
            }

            m_valueWrapper = new ValueWrapper()
            {
                Value = (T)newValue
            };
        }
Exemplo n.º 9
0
 public GroupConcat(bool distinct, string tableName, string columnName, string separator, OrderByList orderBy)
 {
     this.Distinct = distinct;
     this.Value = new ValueWrapper(tableName, columnName);
     this.Separator = separator;
     this.OrderBy = orderBy;
 }
        private static void NotArray(ValueWrapper valueWrapper)
        {
            var message = typeof(DropdownAttribute).Name + " works only when the type of the field is equal to the element type of the array";

            EditorGUILayout.HelpBox(message, MessageType.Warning);
            valueWrapper.DrawDefaultField();
        }
        private static void FieldNull(ValueWrapper valueWrapper, DropdownAttribute attribute)
        {
            var message = $"{typeof(DropdownAttribute).Name} cannot find a values field with name \"{attribute.ValuesFieldName}\"";

            EditorGUILayout.HelpBox(message, MessageType.Warning);
            valueWrapper.DrawDefaultField();
        }
Exemplo n.º 12
0
        public TValue this[TKey key]
        {
            get
            {
                TValue value = default;
                if (TryGetValue(key, out value))
                {
                    return(value);
                }
                else
                {
                    throw new KeyNotFoundException();
                }
            }

            set
            {
                ValueWrapper wrapper = default;
                if (!dictionary.TryGetValue(key, out wrapper))
                {
                    Add(key, value);
                }
                else
                {
                    wrapper.value = value;
                }
            }
        }
Exemplo n.º 13
0
 public GroupConcat(bool distinct, ValueWrapper value, string separator, OrderByList orderBy)
 {
     this.Distinct = distinct;
     this.Value = value;
     this.Separator = separator;
     this.OrderBy = orderBy;
 }
Exemplo n.º 14
0
        private static void NotObject(ValueWrapper wrapper)
        {
            string warning = typeof(ShowAssetPreviewAttribute).Name + " can only be used on Object fields";

            EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning);
            wrapper.DrawDefaultField();
        }
        private static void NotIntFloat(ValueWrapper wrapper)
        {
            string warning = typeof(SliderAttribute).Name + " can only be used on int or float fields";

            EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning);
            wrapper.DrawDefaultField();
        }
Exemplo n.º 16
0
 /// <summary>Constructor of the class.</summary>
 /// <param name="node">The class node.</param>
 /// <param name="autoExpand">The value if nodes should get expanded.</param>
 public ClassTreeNode(ClassNode node, ValueWrapper <bool> enableHierarchyView, ValueWrapper <bool> autoExpand)
     : this(node, enableHierarchyView, autoExpand, null)
 {
     Contract.Requires(node != null);
     Contract.Requires(enableHierarchyView != null);
     Contract.Requires(autoExpand != null);
 }
Exemplo n.º 17
0
        /// <summary>
        ///     Verifyes that handle corresponds instance of object and returns index of object.
        ///     Returns 0, if invalid handle.
        /// </summary>
        private int HandleToIndex(UInt32 handle)
        {
            if (handle == 0)
            {
                return(0);
            }
            var id    = (byte)(handle >> 24);
            var index = (int)(handle & 0xFFFFFF);

            if (index >= _valueWrapperCount)
            {
                return(0);
            }
            ValueWrapper item = _items[index];

            if (item.Value is null)
            {
                return(0);
            }
            if (id != item.InstanceId)
            {
                return(0);
            }
            return(index);
        }
Exemplo n.º 18
0
    protected void InitMaterial()
    {
        selectedAxisSpace         = isKeywordEnabled(Constants.Shader.AXIS_COLORS_LOCAL) ? Space.Local : Space.World;
        useThreeLightSystem       = isKeywordEnabled(Constants.Shader.SYMETRIC_COLORS_ON_KEYWORD);
        useGradientLightXColors   = isKeywordEnabled(Constants.Shader.AXIS_GRADIENT_ON_X_KEYWORD);
        useGradientLightYColors   = isKeywordEnabled(Constants.Shader.AXIS_GRADIENT_ON_Y_KEYWORD);
        useGradientLightZColors   = isKeywordEnabled(Constants.Shader.AXIS_GRADIENT_ON_Z_KEYWORD);
        useVertexColors           = isKeywordEnabled(Constants.Shader.VERTEX_COLOR_KEYWORD);
        useMainTexture            = isKeywordEnabled(Constants.Shader.USE_MAIN_TEXTURE_KEYWORD);
        useGPUInstancing          = material.enableInstancing;
        useAmbientLight           = isKeywordEnabled(Constants.Shader.AMBIENT_LIGHT_KEYWORD);
        useDirectLight            = isKeywordEnabled(Constants.Shader.DIRECT_LIGHT_KEYWORD);
        useSpotLight              = isKeywordEnabled(Constants.Shader.SPOT_LIGHT_KEYWORD);
        usePointLight             = isKeywordEnabled(Constants.Shader.POINT_LIGHT_KEYWORD);
        selectedLightSourcesBlend = isKeywordEnabled(Constants.Shader.BLEND_LIGHT_SOURCES_KEYWORD) ? LightSourcesBlend.Multiple : LightSourcesBlend.Individual;
        useGlobalGradient         = isKeywordEnabled(Constants.Shader.GRADIENT_LOCAL_KEYWORD) || isKeywordEnabled(Constants.Shader.GRADIENT_WORLD_KEYWORD);
        selectedGradientSpace     = isKeywordEnabled(Constants.Shader.GRADIENT_LOCAL_KEYWORD) ? Space.Local : Space.World;
        useCustomLightmapping     = isKeywordEnabled(Constants.Shader.CUSTOM_LIGHTMAPPING_KEYWORD);
        useUnityLightmapping      = isKeywordEnabled(Constants.Shader.UNITY_LIGHTMAPPING_KEYWORD);
        receiveCustomShadows      = isKeywordEnabled(Constants.Shader.RECEIVE_CUSTOM_SHADOW_KEYWORD);
        castCustomShadows         = isKeywordEnabled(Constants.Shader.CAST_CUSTOM_SHADOW_ON_KEYWORD);
        useFog = isKeywordEnabled(Constants.Shader.USE_FOG_KEYWORD);

        if (useCustomLightmapping || useUnityLightmapping)
        {
            selectedUVChannel = (int)lightmapUVChannel.floatValue;
        }
    }
Exemplo n.º 19
0
 public IfNull(
     string firstTableName, string firstColumnName,
     string secondTableName, string secondColumnName)
 {
     this.Value1 = new ValueWrapper(firstTableName, firstColumnName);
     this.Value2 = new ValueWrapper(secondTableName, secondColumnName);
 }
Exemplo n.º 20
0
        private static void NotString(ValueWrapper wrapper)
        {
            string warning = typeof(ResizableTextAreaAttribute).Name + " can only be used on string fields";

            EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning);
            wrapper.DrawDefaultField();
        }
Exemplo n.º 21
0
 public Add(
     object value1, ValueObjectType valueType1,
     object value2, ValueObjectType valueType2)
 {
     this.Value1 = new ValueWrapper(value1, valueType1);
     this.Value2 = new ValueWrapper(value2, valueType2);
 }
Exemplo n.º 22
0
        public void Set(NodeConstantData nodeConstantData)
        {
            var constantType = Type.GetType(nodeConstantData.ConstantType);

            SetType(Type.GetType(nodeConstantData.ConstantType));
            ValueWrapper.SetFromString(nodeConstantData.Value);
        }
        private static void ValidateProperty(ValueWrapper wrapper, ValidateInputAttribute attribute)
        {
            var validationCallback = ReflectionUtility.GetMethod(wrapper.Target, attribute.CallbackName);

            if (validationCallback == null || validationCallback.ReturnType != typeof(bool) || validationCallback.GetParameters().Length != 1)
            {
                WrongType();
                return;
            }

            var  fieldType     = wrapper.Type;
            Type parameterType = validationCallback.GetParameters()[0].ParameterType;

            if (fieldType != parameterType)
            {
                FieldMismatch();
                return;
            }

            if (!(bool)validationCallback.Invoke(wrapper.Target, new[] { wrapper.GetValue() }))
            {
                if (string.IsNullOrEmpty(attribute.Message))
                {
                    EditorDrawUtility.DrawHelpBox(wrapper.DisplayName + " is not valid", MessageType.Error);
                }
                else
                {
                    EditorDrawUtility.DrawHelpBox(attribute.Message, MessageType.Error);
                }
            }
        }
Exemplo n.º 24
0
 public Add(
     object value1, ValueObjectType valueType1,
     string tableName2, string columnName2)
 {
     this.Value1 = new ValueWrapper(value1, valueType1);
     this.Value2 = new ValueWrapper(tableName2, columnName2);
 }
Exemplo n.º 25
0
 public Add(
     string tableName1, string columnName1,
     string tableName2, string columnName2)
 {
     this.Value1 = new ValueWrapper(tableName1, columnName1);
     this.Value2 = new ValueWrapper(tableName2, columnName2);
 }
Exemplo n.º 26
0
 public IfNull(
      string firstTableName, string firstColumnName,
      object secondValue, ValueObjectType secondValueType)
 {
     this.Value1 = new ValueWrapper(firstTableName, firstColumnName);
     this.Value2 = new ValueWrapper(secondValue, secondValueType);
 }
Exemplo n.º 27
0
        /// <summary>
        ///     Releases object from internal list. Its handle becomes invalid.
        ///     index must be valid
        /// </summary>
        private void RemoveInternal(int index)
        {
            int nextIndex  = _items[index].NextIndex;
            int prevIndex  = _items[index].PrevIndex;
            int nextIndex0 = _items[0].NextIndex;
            int prevIndex0 = _items[0].PrevIndex;

            ValueWrapper item = _items[index];

            item.Value     = null;
            item.NextIndex = 0;
            item.PrevIndex = prevIndex0;

            _items[0].PrevIndex = index;

            if (prevIndex0 > 0)
            {
                _items[prevIndex0].NextIndex = index;
            }

            _items[prevIndex].NextIndex = nextIndex;

            if (nextIndex > 0)
            {
                _items[nextIndex].PrevIndex = prevIndex;
            }

            Count--;
        }
Exemplo n.º 28
0
 public Divide(
     object value1,
     string tableName2, string column2
     )
 {
     this.Value1 = new ValueWrapper(value1, ValueObjectType.Value);
     this.Value2 = new ValueWrapper(tableName2, column2);
 }
Exemplo n.º 29
0
 public Divide(
     string tableName1, string column1,
     object value2, ValueObjectType valueType2
     )
 {
     this.Value1 = new ValueWrapper(tableName1, column1);
     this.Value2 = new ValueWrapper(value2, valueType2);
 }
Exemplo n.º 30
0
 public Divide(
     string tableName1, string column1,
     string tableName2, string column2
     )
 {
     this.Value1 = new ValueWrapper(tableName1, column1);
     this.Value2 = new ValueWrapper(tableName2, column2);
 }
Exemplo n.º 31
0
 public Multiply(
     object value1,
     object value2
     )
 {
     this.Value1 = new ValueWrapper(value1, ValueObjectType.Value);
     this.Value2 = new ValueWrapper(value2, ValueObjectType.Value);
 }
Exemplo n.º 32
0
        private bool OnException(object sender, Exception ex)
        {
            var result = new ValueWrapper<bool>(false);

            if (Exception != null) Exception(sender, new EventArgs<Exception, ValueWrapper<bool>>(ex, result));

            return result.Value;
        }
Exemplo n.º 33
0
        void RegisterBuiltInValueType <T>(ReadWriteOperations <T> operations)
        {
            ValueInstantiator instantiator = BuiltInValue <T> .CreateInstantiator(operations);

            ValueWrapper wrapper = BuiltInValue <T> .CreateWrapper(operations);

            RegisterBuiltInType(typeof(T), StandardTypeSignature.Create, instantiator, wrapper);
        }
Exemplo n.º 34
0
 public Multiply(
     string tableName1, object value1, ValueObjectType valueType1,
     string tableName2, object value2, ValueObjectType valueType2
     )
 {
     this.Value1 = new ValueWrapper(tableName1, value1, valueType1);
     this.Value2 = new ValueWrapper(tableName2, value2, valueType2);
 }
Exemplo n.º 35
0
 public Multiply(
     string tableName1, string column1,
     object value2
     )
 {
     this.Value1 = new ValueWrapper(tableName1, column1);
     this.Value2 = new ValueWrapper(value2, ValueObjectType.Value);
 }
Exemplo n.º 36
0
 public Divide(
     object value1,
     object value2
     )
 {
     this.Value1 = new ValueWrapper(value1, ValueObjectType.Value);
     this.Value2 = new ValueWrapper(value2, ValueObjectType.Value);
 }
Exemplo n.º 37
0
 public RegisteredType(uint id, Type type, TypeSignatureCreator signatureCreator, ValueInstantiator instantiator, ValueWrapper wrapper)
 {
     Id            = id;
     Type          = type;
     TypeSignature = signatureCreator(id, type);
     Instantiator  = instantiator;
     Wrapper       = wrapper;
 }
Exemplo n.º 38
0
            public Task SaveAsync(string value, CancellationToken cancellationToken)
            {
                this.valueWrapper = new ValueWrapper {
                    Value = value
                };

                return(Task.CompletedTask);
            }
Exemplo n.º 39
0
 public int GetHashCode(ValueWrapper <T> obj)
 {
     if (obj.Val == null)
     {
         return(0);
     }
     return(_comparer.GetHashCode(obj.Val));
 }
Exemplo n.º 40
0
 /// <summary>
 /// Creates a prototype that can present a string
 /// </summary>
 public Text()
 {
     RenderName = GetType().FullName;
     Parameter.Add("Text", TextValue    = new ValueWrapper <string>());
     Parameter.Add("FontSize", FontSize = new ValueWrapper <ScreenPos>());
     Parameter.Add("Align", Align       = new ValueWrapper <Align>());
     Parameter.Add("Valign", Valign     = new ValueWrapper <Valign>());
 }
Exemplo n.º 41
0
 /// <summary>
 ///     Reserve space in the internal list of objects
 /// </summary>
 public void Reserve(int capacity)
 {
     if (capacity > _items.Length)
     {
         ValueWrapper[] oldItems = _items;
         _items = new ValueWrapper[capacity];
         oldItems.CopyTo(_items, 0);
     }
 }
Exemplo n.º 42
0
 public Replace(
     string sourceTableName, string sourceColumn,
     string searchTableName, string searchColumn,
     string replaceWithTableName, string replaceWithColumn)
 {
     this.SourceValue = new ValueWrapper(sourceTableName, sourceColumn);
     this.SearchValue = new ValueWrapper(searchTableName, searchColumn);
     this.ReplaceWithValue = new ValueWrapper(replaceWithTableName, replaceWithColumn);
 }
Exemplo n.º 43
0
 public Replace(
     string sourceTableName, string sourceColumn,
     object search, ValueObjectType searchType,
     object replace, ValueObjectType replaceWithType)
 {
     this.SourceValue = new ValueWrapper(sourceTableName, sourceColumn);
     this.SearchValue = new ValueWrapper(search, searchType);
     this.ReplaceWithValue = new ValueWrapper(replace, replaceWithType);
 }
Exemplo n.º 44
0
 public Replace(
     object source, ValueObjectType sourceType,
     string searchTableName, string searchColumn,
     string replaceWithTableName, string replaceWithColumn)
 {
     this.SourceValue = new ValueWrapper(source, sourceType);
     this.SearchValue = new ValueWrapper(searchTableName, searchColumn);
     this.ReplaceWithValue = new ValueWrapper(replaceWithTableName, replaceWithColumn);
 }
Exemplo n.º 45
0
 /// <summary>
 /// Creates a Prototype for a single rectangle
 /// </summary>
 public Rect()
 {
     RenderName = GetType().FullName;
     Parameter.Add("LineWidth", LineWidth = new ValueWrapper <double>()
     {
         Value  = 1,
         Exists = true
     });
 }
Exemplo n.º 46
0
        private void _listBox_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (_ignoreItemCheck)
            {
                return;
            }

            _ignoreItemCheck = true;
            try
            {
                ValueWrapper wrapper = (ValueWrapper)_listBox.Items[e.Index];
                if (e.Index == 0)
                {
                    if (e.NewValue == CheckState.Checked)
                    {
                        for (int n = 1; n < _listBox.Items.Count; n++)
                        {
                            _listBox.SetItemChecked(n, true);
                        }
                    }
                    else if (e.NewValue == CheckState.Unchecked)
                    {
                        for (int n = 1; n < _listBox.Items.Count; n++)
                        {
                            _listBox.SetItemChecked(n, false);
                        }
                    }
                }
                else
                {
                    bool diff = false;

                    for (int n = 1; n < _listBox.Items.Count; n++)
                    {
                        if (n != e.Index && e.NewValue != _listBox.GetItemCheckState(n))
                        {
                            diff = true;
                            break;
                        }
                    }

                    if (diff)
                    {
                        _listBox.SetItemCheckState(0, CheckState.Indeterminate);
                    }
                    else
                    {
                        _listBox.SetItemCheckState(0, e.NewValue);
                    }
                }
            }
            finally
            {
                _ignoreItemCheck = false;
            }
        }
Exemplo n.º 47
0
        /// <summary>
        ///     Puts object in internal list and returns its index there.
        /// </summary>
        private int AddInternal(TObject value)
        {
            ValueWrapper item0 = _items[0];

            if (item0.PrevIndex == 0)
            {
                if (_valueWrapperCount == _items.Length)
                {
                    ValueWrapper[] oldItems = _items;
                    _items = new ValueWrapper[oldItems.Length * 2];
                    oldItems.CopyTo(_items, 0);
                }
                _items[_valueWrapperCount] = new ValueWrapper();
                item0.PrevIndex            = _valueWrapperCount;
                _valueWrapperCount++;
            }

            int currentIndex = item0.PrevIndex;

            ValueWrapper currentItem = _items[currentIndex];

            int nextIndex  = currentItem.NextIndex;
            int prevIndex  = currentItem.PrevIndex;
            int nextIndex0 = item0.NextIndex;
            int prevIndex0 = item0.PrevIndex;

            currentItem.Value    = value;
            currentItem.HasValue = true;
            if (currentItem.InstanceId == 0xFF)
            {
                currentItem.InstanceId = 1;
            }
            else
            {
                currentItem.InstanceId++;
            }
            currentItem.NextIndex = nextIndex0;
            currentItem.PrevIndex = 0;

            item0.NextIndex = currentIndex;
            item0.PrevIndex = prevIndex;

            if (prevIndex > 0)
            {
                _items[prevIndex].NextIndex = 0;
            }

            if (nextIndex0 > 0)
            {
                _items[nextIndex0].PrevIndex = currentIndex;
            }

            Count++;

            return(currentIndex);
        }
Exemplo n.º 48
0
 /// <summary>
 ///     Sets the capacity to the actual number of elements in the internal list of objects,
 ///     if that number is less than a threshold value.
 /// </summary>
 public void TrimExcess()
 {
     if (_valueWrapperCount == _items.Length)
     {
         return;
     }
     ValueWrapper[] oldItems = _items;
     _items = new ValueWrapper[_valueWrapperCount];
     oldItems.CopyTo(_items, 0); // TODO: Verify
 }
Exemplo n.º 49
0
            public Task <bool> RemoveAsync(CancellationToken cancellationToken)
            {
                if (this.valueWrapper != null)
                {
                    this.valueWrapper = null;
                    return(Task.FromResult(true));
                }

                return(Task.FromResult(false));
            }
Exemplo n.º 50
0
    public static void Add <T>(
        this IDictionary <string, IValueWrapper> dictionary,
        string key,
        T value
        )
    {
        ValueWrapper <T> valueWrapper = new ValueWrapper <T>(value);

        dictionary.Add(key, valueWrapper);
    }
Exemplo n.º 51
0
        public OperationsViewModel(IUnityContainer unityContainer, IInitData initData, ISettingsService settingsService)
        {
            InitData = initData;
            SettingsService = settingsService;
            IsOperationsViewEnabled = true;
            IsCancellationRequested = new ValueWrapper<bool>(false);
            GenerateDataGrid();

            UnityContainer = unityContainer;
        }
Exemplo n.º 52
0
        public void when_TryGetValue_called_with_nonexistent_key__should_return_false()
        {
            var mruCache = new MruCache<ValueWrapper<int>, object>(12);

            object added = new object();
            var key = new ValueWrapper<int>(0);

            mruCache.Add(key, added);

            object res;
            Assert.IsFalse(mruCache.TryGetValue(new ValueWrapper<int>(1), out res));
            Assert.IsNull(res);
        }
Exemplo n.º 53
0
        public void when_TryGetValue_called_with_existing_key__should_return_what_it_was_provided()
        {
            var mruCache = new MruCache<ValueWrapper<int>, object>(12);

            object added = new object();
            var key = new ValueWrapper<int>(0);

            mruCache.Add(key, added);

            object res;
            Assert.IsTrue(mruCache.TryGetValue(new ValueWrapper<int>(0), out res));
            Assert.AreEqual(added, res);
        }
Exemplo n.º 54
0
        public IEnumerable<IRowModel> AnalyzeAllPDFs(IEnumerable<IRowModel> filesToAnalyze, string[] wordsToAnalysis, string sourceFolder,
            ValueWrapper<bool> isCancellationRequested, ReportProgessEvent reportProgress)
        {
            foreach (var file in filesToAnalyze)
            {
                if (isCancellationRequested.Value)
                {
                    return filesToAnalyze;
                }

                try
                {
                    if (file.Descriptions.Any())
                    {
                        file.Descriptions.Clear();
                    }

                    var dms = wordsToAnalysis.Select(x => new DescriptionModel {Word = x, Occurances = 0});
                    foreach (var descriptionModel in dms)
                    {
                        file.Descriptions.Add(descriptionModel);
                    }

                    var pdfReader = new PdfReader(Path.Combine(sourceFolder, file.FileName));
                    string text = string.Empty;
                    int numberOfPages = pdfReader.NumberOfPages;
                    for (int page = 1; page < numberOfPages; page++)
                    {
                        text = PdfTextExtractor.GetTextFromPage(pdfReader, page);
                        foreach (var word in file.Descriptions)
                        {
                            word.Occurances += Regex.Matches(text, word.Word).Count;
                        }
                    }
                    file.Analyzed = true;
                    pdfReader.Close();
                }
                catch (Exception)
                {
                    continue;
                }
                if (OnFileAnalyzed != null)
                {
                    OnFileAnalyzed.Invoke(file);
                }
            }

            return filesToAnalyze;
        }
Exemplo n.º 55
0
        public void DownloadFiles(IEnumerable<Uri> links, string destinationPath, ReportProgessEvent reportProgess, ValueWrapper<bool> isCancellationRequested)
        {
            var client = new WebClient();
            var linksList = links.ToList();
            int counter = 0;
            string filename;
            foreach (var link in linksList)
            {
                if (isCancellationRequested.Value)
                {
                    return;
                }
                filename = Path.GetFileName(link.LocalPath);

                reportProgess(counter++*100/linksList.Count);

                try
                {
                    client.DownloadFile(link, filename);
                    Thread.Sleep(500);
                }
                catch (Exception)
                {
                    //zakladam ze wsyzstkie pliki sie pobiora bez przypalow.
                }
                var path = Path.Combine(destinationPath, filename);
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                File.Copy(filename, path);

                if (OnFileDownloaded != null)
                {
                    OnFileDownloaded.Invoke(path);
                }
            }
        }
Exemplo n.º 56
0
        /// <summary>
        /// The default Constructor.
        /// </summary>
        public SceneManager(GameWindow gameWindow, Camera camera, FontLibrary fontLibrary, string fontPath, IDirectoryHandler directoryHandler, IGameSettings gameSettings, ValueWrapper<bool> debug)
        {
            GameWindow = gameWindow;
            SceneList = new List<Scene>();
            _scenesToAdd = new List<Scene>();
            _scenesToRemove = new List<Scene>();

            Directories = directoryHandler;

            FontPath = fontPath;
            GameFontLibrary = fontLibrary;
            DefaultFont = GameFontLibrary.GetFirstOrDefault(GameFontType.Default);
            FontDrawing = new QFontDrawing();
            FontDrawing.ProjectionMatrix = camera.ScreenProjectionMatrix;

            ScreenCamera = camera;
            ScreenCamera.Center = Vector2.Zero;
            ScreenCamera.MaximumScale = new Vector2(10000, 10000);

            GameSettings = gameSettings;

            Debug = debug;
        }
Exemplo n.º 57
0
 public GroupConcat(string tableName, string columnName)
 {
     this.Value = new ValueWrapper(tableName, columnName);
 }
Exemplo n.º 58
0
 public GroupConcat(string tableName, string columnName, OrderByList orderBy)
 {
     this.Value = new ValueWrapper(tableName, columnName);
     this.OrderBy = orderBy;
 }
Exemplo n.º 59
0
 public GroupConcat(string tableName, string columnName, string separator)
 {
     this.Value = new ValueWrapper(tableName, columnName);
     this.Separator = separator;
 }
Exemplo n.º 60
0
 public GroupConcat(bool distinct, ValueWrapper value)
 {
     this.Distinct = distinct;
     this.Value = value;
 }