private Type GetType(FieldTypes type)
        {
            switch (type)
            {
            case FieldTypes.Boolean:
                return(typeof(bool));

            case FieldTypes.DateTime:
                return(typeof(DateTime));

            case FieldTypes.Double:
                return(typeof(Double));

            case FieldTypes.Int:
                return(typeof(int));

            case FieldTypes.Money:
                return(typeof(decimal));

            case FieldTypes.Varchar:
                return(typeof(string));

            default:
                return(typeof(string));
            }
        }
Пример #2
0
        /// <summary>
        /// Create a value for the scoped fieldtype,  with a preferred default
        /// </summary>
        /// <param name="scope">Scope (usually the name of the type) for which to create the field</param>
        /// <param name="fieldType">FieldType of the field to construct</param>
        /// <param name="preferredDefaultValue">preferred default</param>
        /// <returns>a new or cached value for the given fieldType, with the scope of it's value being restricted to the Type scope</returns>
        public object CreateCachedValue(string scope, FieldTypes fieldType, object preferredDefaultValue)
        {
            if (fieldType == FieldTypes.FLAGS)
            {
                return(preferredDefaultValue);
            }
            string requestedField = scope + "." + fieldType.ToString();
            object fieldValue     = preferredDefaultValue;

            // Check if the configuration exists
            if (LastUsedFieldValues == null)
            {
                LastUsedFieldValues = new Dictionary <string, object>();
            }

            // Check if settings for the requesting type exist, if not create!
            if (LastUsedFieldValues.ContainsKey(requestedField))
            {
                // Check if a value is set (not null)!
                if (LastUsedFieldValues[requestedField] != null)
                {
                    fieldValue = LastUsedFieldValues[requestedField];
                }
                else
                {
                    // Overwrite null value
                    LastUsedFieldValues[requestedField] = fieldValue;
                }
            }
            else
            {
                LastUsedFieldValues.Add(requestedField, fieldValue);
            }
            return(fieldValue);
        }
Пример #3
0
        /// <summary>
        /// This function will be used to add
        /// table cell
        /// </summary>
        /// <param name="tableRow">Table Row</param>
        /// <param name="aField">Field</param>
        /// <param name="fieldType">Type of field</param>
        /// <returns></returns>
        private static TableCell AddTableCell(TableRow tableRow,
                                              string value, FieldTypes fieldType)
        {
            TableCell tableCell1 = new TableCell();

            string valueToPrint = "NA";

            switch (fieldType)
            {
            case FieldTypes.DateTime:
                if (!string.IsNullOrWhiteSpace(value))
                {
                    DateTime createdDate = DateTime.Now;
                    createdDate  = DateTime.Parse(value);
                    valueToPrint = TimeAgo(createdDate);
                }
                else
                {
                    valueToPrint = "NA";
                }
                break;

            case FieldTypes.Text:
                valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA";
                break;

            default:
                valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA";
                break;
            }

            tableCell1.Text = valueToPrint;
            tableRow.Cells.Add(tableCell1);
            return(tableCell1);
        }
Пример #4
0
        public void TestUpdateValidSpecialProperties(ResourceId resource, FieldTypes fType, Properties.PropertyName propName)
        {
            var guid    = GuidsForUpdate[resource].Values.First();
            var handler = new DefaultManager();
            var props   = GenerateExceptedProperties(Defines.FieldTypeApi, propName.GetEnumStringValue(), SpecialMappingValue[propName]);

            if (propName != Properties.PropertyName.Field)
            {
                props[Properties.PropertyName.Field.GetEnumStringValue()] = UuidUtil.GetId(FieldsCreator.Data[$"{Defines.ReferenceResource[resource].First()}-{FieldType.Mail.ToString()}-2"].Guid);
            }

            var request  = GenerateUpdateRequest(resource, guid.ToString(), props);
            var response = handler.Send <object>(FieldManager.FieldHandlingRelativeUrl, JsonConvert.SerializeObject(request), TestCoreFramework.Enums.HttpMethod.PUT);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent));

            var result = (new FieldManager()).GetFieldDetails(guid);

            if (propName == Properties.PropertyName.Enabled)
            {
                PrAssert.That(result.Result.Values.SingleOrDefault().Key.ToString(), PrIs.Not.EqualTo(propName.GetEnumStringValue()));
            }
            else
            {
                PrAssert.That(result.Result.Values.SingleOrDefault().Value.Properties[propName.GetEnumStringValue()], PrIs.Not.EqualTo(SpecialMappingValue[propName]));
            }
        }
Пример #5
0
        /// <summary>
        /// This function will be used to add
        /// table cell
        /// </summary>
        /// <param name="tableRow">Table Row</param>
        /// <param name="aField">Field</param>
        /// <param name="fieldType">Type of field</param>
        /// <returns></returns>
        private static TableCell AddTableCell(TableRow tableRow, Sitecore.Data.Fields.Field aField, FieldTypes fieldType)
        {
            TableCell tableCell1 = new TableCell();

            string valueToPrint = "NA";

            switch (fieldType)
            {
                case FieldTypes.DateTime:
                    if ((aField != null) && !string.IsNullOrEmpty(aField.Value))
                    {
                        string dateFormat = "r";
                        DateTime createdDate = DateTime.Now;
                        createdDate = Sitecore.DateUtil.IsoDateToDateTime(aField.Value);
                        valueToPrint = createdDate.ToString(dateFormat);
                    }
                    else
                    {
                        valueToPrint = "NA";
                    }
                    break;
                case FieldTypes.Text:
                    valueToPrint = ((aField != null) && !string.IsNullOrEmpty(aField.Value)) ? aField.Value : "NA";
                    break;
                default:
                    valueToPrint = ((aField != null) && !string.IsNullOrEmpty(aField.Value)) ? aField.Value : "NA";
                    break;
            }

            tableCell1.Text = valueToPrint;
            tableRow.Cells.Add(tableCell1);
            return tableCell1;
        }
        private char GetCharFromFieldType(FieldTypes value)
        {
            char result;

            switch (value)
            {
            case FieldTypes.Empty:
                result = '+';
                break;

            case FieldTypes.Snake:
                result = 'o';
                break;

            case FieldTypes.NextHead:
                result = GetAnimatedCircle();
                break;

            case FieldTypes.Wall:
                result = '▒';
                break;

            default:
                throw new ArgumentException("Unknown field type");
            }

            return(result);
        }
Пример #7
0
        bool Find2()
        {
            foreach (var cctor in DeobUtils.GetInitCctors(module, 3))
            {
                foreach (var calledMethod in DotNetUtils.GetCalledMethods(module, cctor))
                {
                    var type = calledMethod.DeclaringType;
                    if (type.IsPublic)
                    {
                        continue;
                    }
                    var fieldTypes = new FieldTypes(type);
                    if (!fieldTypes.All(requiredFields1))
                    {
                        continue;
                    }
                    if (!HasInitializeMethod(type, "_Initialize") && !HasInitializeMethod(type, "_Initialize64"))
                    {
                        continue;
                    }

                    initializeMethod     = calledMethod;
                    postInitializeMethod = FindMethod(type, "System.Void", "PostInitialize", "()");
                    loadMethod           = FindMethod(type, "System.IntPtr", "Load", "()");
                    cliSecureRtType      = type;
                    FindStringDecrypters();
                    return(true);
                }
            }

            return(false);
        }
        public void Initialize(string webURL, ContentType contentType, SearchFilter filter, bool isOr)
        {
            this.WebURL      = webURL;
            this.ContentType = contentType;
            this.IsOr        = isOr;
            this.FillFilterTypeComboBox();
            this.FillPropertyComboBox();

            string          fieldName  = filter.FieldName;
            CamlFilterTypes filterType = filter.FilterType;
            FieldTypes      fieldType  = filter.FieldType;

            this.SearchFilter = new SearchFilter(fieldName, fieldType, filterType, filter.FilterValue);

            PropertyComboBox.SelectedValue   = this.SearchFilter.FieldName;
            FilterTypeComboBox.SelectedValue = this.SearchFilter.FieldType;
            if (this.IsOr == true)
            {
                AndOrComboBox.SelectedIndex = 1;
            }
            else
            {
                AndOrComboBox.SelectedIndex = 0;
            }

            PropertyLabel.Content    = this.SearchFilter.FieldName;
            FilterTypeLabel.Content  = this.SearchFilter.FilterType.ToString();
            FilterValueLabel.Content = this.SearchFilter.FilterValue;
            AndOrLabel.Content       = Languages.Translate(this.IsOr == true ? "Or" : "And");
        }
Пример #9
0
        private string GetCamlFieldTypeString(FieldTypes fieldType)
        {
            string camlString = String.Empty;

            switch (fieldType)
            {
            case FieldTypes.Boolean:
                camlString = "boolean";
                break;

            case FieldTypes.Choice:
                camlString = "Text";
                break;

            case FieldTypes.Computed:
                camlString = "text";
                break;

            case FieldTypes.ContentType:
                camlString = "text";
                break;

            case FieldTypes.ContentTypeId:
                camlString = "text";
                break;

            case FieldTypes.Counter:
                camlString = "number";
                break;

            case FieldTypes.DateTime:
                camlString = "DateTime";
                break;

            case FieldTypes.File:
                camlString = "text";
                break;

            case FieldTypes.Lookup:
                camlString = "number";
                break;

            case FieldTypes.Note:
                camlString = "text";
                break;

            case FieldTypes.Number:
                camlString = "number";
                break;

            case FieldTypes.Text:
                camlString = "text";
                break;

            case FieldTypes.User:
                camlString = "text";
                break;
            }
            return(camlString);
        }
Пример #10
0
        internal pSprite(Texture2D texture, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                         Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour, Object tag)
        {
            Type = SpriteTypes.Image;

            localTexture = texture;

            Disposable = false;

            SpriteEffect = SpriteEffects.None;

            OriginType = originType;

            UpdateTextureSize();
            UpdateTextureAlignment();

            Clock           = clockType;
            CurrentPosition = startPosition;
            StartPosition   = CurrentPosition;
            CurrentRotation = 0;
            CurrentScale    = 1;
            Depth           = drawDepth;
            AlwaysDraw      = alwaysDraw;
            Field           = fieldType;
            CurrentColour   = colour;
            StartColour     = colour;
            Tag             = tag;
        }
Пример #11
0
        internal static string AnalysisJDBCType(FieldTypes fieldType)
        {
            switch (fieldType)
            {
            case FieldTypes.String:
                return(JDBCTypes.VARCHAR.ToString());

            case FieldTypes.Decimal:
                return(JDBCTypes.DECIMAL.ToString());

            case FieldTypes.Int32:
                return(JDBCTypes.INTEGER.ToString());

            case FieldTypes.Long:
                return(JDBCTypes.BIGINT.ToString());

            case FieldTypes.DateTime:
                return(JDBCTypes.TIMESTAMP.ToString());

            case FieldTypes.Float:
            case FieldTypes.Double:
            case FieldTypes.Bool:
                return("暂时不支持的数据类型");

            default:
                throw new ArgumentException(nameof(fieldType));
            }
        }
Пример #12
0
        /// <summary>
        /// Construct a CsvFile, based on a DataTable
        /// Second line of input file may contain the data types,
        /// and optionally widths.
        /// </summary>
        /// <param name="filename">comma seperated filename</param>
        public CsvFile(string filename, FieldTypes fieldType = FieldTypes.AutoDetect)
        {
            char[] delim = { ',' };
            ReadFile(filename);

            fieldNames = ParseCSV(lines[0]);

            if (fieldType == FieldTypes.AllText)
            {
                dataTypes = new string[fieldNames.Length];
                for (int i = 0; i < dataTypes.Length; i++)
                {
                    dataTypes[i] = "String";
                }
                ParseFile(dataTypes, fieldNames, 1, "");
                return;
            }
            else
            {// auto detect
                dataTypes = lines[1].Split(delim);

                if (!ValidDataTypes(dataTypes))
                {
                    dataTypes = EstimateDataTypes();
                    ParseFile(dataTypes, fieldNames, 1, "");
                }
                else
                {
                    ParseFile(dataTypes, fieldNames, 2, "");
                }
            }
        }
Пример #13
0
 public EditMetadata(FieldTypes validationType, string errorString, string displayString)
 {
     this.validationType = validationType;
     this.customString   = ".*";
     this.errorString    = errorString;
     this.displayString  = displayString;
 }
Пример #14
0
        // --------------------------------------------------------

        /// <summary>
        /// The add field.
        /// </summary>
        /// <param name="field">
        /// The field.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool AddField(FieldTypes field)
        {
            if (field != FieldTypes.Undefined)
            {
                if (fields == null)
                {
                    fields = new HashSet <FieldTypes>();
                }

                if (fields.Add(field))
                {
                    switch (field)
                    {
                    case FieldTypes.IdCardType_IdCardNumber:
                        fields.Add(FieldTypes.IdCardType);
                        fields.Add(FieldTypes.IdCardNumber);
                        break;

                    case FieldTypes.PolicyType_PolicyNumber:
                        fields.Add(FieldTypes.PolicyType);
                        fields.Add(FieldTypes.PolicyNumber);
                        break;

                    case FieldTypes.InsuranceCompanyCode_InsuranceCompanyCoding:
                        fields.Add(FieldTypes.InsuranceCompanyCode);
                        fields.Add(FieldTypes.InsuranceCompanyCoding);
                        break;
                    }

                    return(true);
                }
            }

            return(false);
        }
Пример #15
0
    public void Add(String _DataType, String _DataField, FieldTypes _FieldType, Object _DataValue, String _Expression)
    {
        DataItems fField = new DataItems();

        if (_DataType.ToUpper() == "NUMBER")
        {
            fField.DataType = DataTypes.Number;
        }
        else if (_DataType.ToUpper() == "NVARCHAR")
        {
            fField.DataType = DataTypes.NVarchar;
        }
        else if (_DataType.ToUpper() == "DATETIME")
        {
            fField.DataType = DataTypes.DateTime;
        }
        else
        {
            fField.DataType = DataTypes.Undefined;
        }
        fField.FieldType  = _FieldType;
        fField.DataValue  = _DataValue;
        fField.DataField  = _DataField;
        fField.Expression = _Expression;
        base.List.Add(fField);
    }
Пример #16
0
 public static Field GetField(FieldTypes fieldType)
 {
     switch (fieldType)
     {
         case FieldTypes.ONE:
             return new NumberField((int)fieldType);
         case FieldTypes.TWO:
             return new NumberField((int)fieldType);
         case FieldTypes.THREE:
             return new NumberField((int)fieldType);
         case FieldTypes.FOUR:
             return new NumberField((int)fieldType);
         case FieldTypes.FIVE:
             return new NumberField((int)fieldType);
         case FieldTypes.SIX:
             return new NumberField((int)fieldType);
         case FieldTypes.MIN:
             return new MiddleLayerField();
         case FieldTypes.MAX:
             return new MiddleLayerField();
         case FieldTypes.SKALA:
             return new SkalaField();
         case FieldTypes.FULL:
             return new FullField();
         default:
             return MoreOfAKindFieldFactory.GetField(fieldType);
     }
 }
Пример #17
0
        bool Find3()
        {
            foreach (var type in module.Types)
            {
                if (type.Fields.Count < 1 || type.Fields.Count > 2)
                {
                    continue;
                }
                var fieldTypes = new FieldTypes(type);
                if (!fieldTypes.Exactly(requiredFields6) && !fieldTypes.Exactly(requiredFields7))
                {
                    continue;
                }
                if (type.Methods.Count != 2)
                {
                    continue;
                }
                if (type.FindStaticConstructor() == null)
                {
                    continue;
                }
                var cs = type.FindMethod("cs");
                if (cs == null)
                {
                    continue;
                }

                AddStringDecrypterMethod(cs);
                cliSecureRtType = type;
                return(true);
            }

            return(false);
        }
Пример #18
0
 public CamlFilter(string fieldName, FieldTypes fieldType, CamlFilterTypes filterType, string filterValue)
 {
     FieldName   = fieldName;
     FieldType   = fieldType;
     FilterType  = filterType;
     FilterValue = filterValue;
 }
Пример #19
0
        /// <summary>
        /// The retrieve handler.
        /// </summary>
        /// <param name="fieldType">
        /// The field type.
        /// </param>
        /// <returns>
        /// The <see cref="PrepareHandler"/>.
        /// </returns>
        private PrepareHandler RetrieveHandler(FieldTypes fieldType)
        {
            switch (fieldType)
            {
            case FieldTypes.BirthDate:
                return(PrepareDate);

            case FieldTypes.FamilyName:
            case FieldTypes.FirstName:
            case FieldTypes.MiddleName:
                return(PrepareText);

            case FieldTypes.BirthPlace:
            case FieldTypes.ENP:
            case FieldTypes.PolicyType:
            case FieldTypes.PolicyNumber:
            case FieldTypes.IdCardNumber:
                return(PrepareText);

            case FieldTypes.SNILS:
                return(PrepareSNILS);

            case FieldTypes.IdCardType:
            case FieldTypes.InsuranceTerritory:
            default:
                return(PrepareDefault);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MonitoredItemReference"/> struct.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="fieldType">Type of the field.</param>
 /// <param name="mappingType">Type of the mapping.</param>
 public MonitoredItemReference(int index, FieldTypes fieldType, MappingTypes mappingType)
     : this()
 {
     this.Index       = index;
     this.FieldType   = fieldType;
     this.MappingType = mappingType;
 }
Пример #21
0
        internal pSprite(pTexture texture, FieldTypes field, OriginTypes origin, ClockTypes clocking, Vector2 position,
                         float depth, bool alwaysDraw, Color4 colour)
        {
            Field    = field;
            Origin   = origin;
            Clocking = clocking;

            Position = position;
            Colour   = colour;

            Scale      = Vector2.One;
            Rotation   = 0;
            DrawDepth  = depth;
            AlwaysDraw = alwaysDraw;

            if (!alwaysDraw)
            {
                Alpha = 0;
            }
            else
            {
                Alpha = 1;
            }

            Texture      = texture;
            UsesTextures = true;
        }
 public FieldSettings(FieldTypes generalType)
 {
     InitializeComponent();
     descriptionCtrl.DescriptionChange = DescriptionChange;
     EnablePanel(generalType);
     Result = null;
 }
        private void EnablePanel(FieldTypes generalType)
        {
            switch (generalType)
            {
            case FieldTypes.Number:
                fieldRuleCtrl = new NumberFieldCtrl();
                break;

            case FieldTypes.String:
                fieldRuleCtrl = new StringFieldCtrl();
                break;

            case FieldTypes.Date:
            case FieldTypes.Time:
                fieldRuleCtrl = new DateTimeFieldCtrl();
                ((DateTimeFieldCtrl)fieldRuleCtrl).SetRuleDateTimeType(generalType);
                break;

            case FieldTypes.Enumerator:
                fieldRuleCtrl = new EnumeratorCtrl();
                break;

            case FieldTypes.MappedSource:
                fieldRuleCtrl = new MappedSourceCtrl();
                break;
            }

            this.controlPanel.Controls.Add((UserControl)this.fieldRuleCtrl, 0, 1);
            ((UserControl)this.fieldRuleCtrl).Dock = DockStyle.Fill;
        }
Пример #24
0
        List <TypeDef> FindVmHandlerTypes()
        {
            var requiredFields = new string[] {
                null,
                "System.Collections.Generic.Dictionary`2<System.UInt16,System.Type>",
                "System.UInt16",
            };
            var cflowDeobfuscator = new CflowDeobfuscator();

            foreach (var type in module.Types)
            {
                var cctor = type.FindStaticConstructor();
                if (cctor == null)
                {
                    continue;
                }
                requiredFields[0] = type.FullName;
                var fieldTypes = new FieldTypes(type);
                if (!fieldTypes.All(requiredFields))
                {
                    continue;
                }

                cflowDeobfuscator.Deobfuscate(cctor);
                var handlers = FindVmHandlerTypes(cctor);

                return(handlers);
            }

            return(null);
        }
Пример #25
0
        public override void InputValues(LayerTypes layer, FieldTypes field, int[] diceNumbers)
        {
            if (field == _fieldPointer && !IsColumnFull())
            {
                Layers[layer].InputValues(field, diceNumbers);

                if (field == FieldTypes.ONE)
                {/*ako je unos jedinica, upisuju se još i u pomoćni spremnik
                  * središnjeg sloja stupca, jer je potrebno kod računanja bodova*/

                    Layers[LayerTypes.MIDDLE].InputValues(field, diceNumbers);
                }

                if (_fieldPointer != FieldTypes.YAMB)
                {/*ako nije došlo do kraja stupca pomjeri pokazivač na sljedeće polje*/

                    int newFieldPointer = (int)_fieldPointer + 1;
                    _fieldPointer = (FieldTypes)newFieldPointer;
                }
            }
            else
            {
                throw new InaccessibleFieldException("Illegal field is selected or the column is already filled.");
            }
        }
Пример #26
0
 internal pAnimation(Texture2D[] textures, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                     Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour, object tag)
     : base(textures[0], fieldType, originType, clockType, startPosition, drawDepth, alwaysDraw, colour, tag)
 {
     TextureArray = textures;
     TextureCount = textures.Length;
 }
Пример #27
0
 public FieldSource(int position, FieldTypes type, SourceOrientation orientation, Func <double, double> f)
 {
     Function    = f;
     Position    = position;
     FieldType   = type;
     Orientation = orientation;
 }
Пример #28
0
		public void Find() {
			var requiredFields = new string[] {
				"System.Threading.ReaderWriterLock",
				"System.Collections.Hashtable",
			};
			foreach (var type in module.GetTypes()) {
				var fieldTypes = new FieldTypes(type);
				if (!fieldTypes.All(requiredFields))
					continue;
				if (type.FindMethod("Finalize") == null)
					continue;
				var executeMethod = DotNetUtils.GetMethod(type, "System.Object", "(System.String,System.Object[])");
				if (executeMethod == null || !executeMethod.IsStatic || executeMethod.Body == null)
					continue;

				var decrypterType = FindMethodsDecrypterType(type);
				if (decrypterType == null)
					continue;

				resourceDecrypter.DecryptMethod = FindDecryptMethod(decrypterType);

				methodsDecrypterCreator = type;
				methodsDecrypter = decrypterType;
				decryptExecuteMethod = executeMethod;
				return;
			}
		}
Пример #29
0
        public override void InputValues(LayerTypes layer, FieldTypes field, int[] diceNumbers)
        {
            if (_isAnnounced)
            {
                if (field == _announcedField)
                {
                    Layers[layer].InputValues(field, diceNumbers);

                    if (field == FieldTypes.ONE)
                    {
                        Layers[LayerTypes.MIDDLE].InputValues(field, diceNumbers);
                    }
                    _isAnnounced = false;
                }
                else
                {
                    throw new InaccessibleFieldException("Posted unavailable field.");
                }
            }
            else if (Layers[layer].IsFieldFilled(field))
            {
                throw new FieldIsFilledException("The field is already filled.");
            }
            else
            {
                _isAnnounced = true;
                _announcedField = field;
            }
        }
 public Field(string fieldName, string valueBefore, string valueAfter, FieldTypes fieldType)
 {
     FieldName   = fieldName;
     ValueBefore = valueBefore;
     ValueAfter  = valueAfter;
     FieldType   = fieldType;
 }
        public void AddFieldType(System.Xml.XmlNode node)
        {
            // add field type name the mapping
            var scName  = Sitecore.Xml.XmlUtil.GetAttribute("sitecoreFieldTypeName", node);
            var umlName = Sitecore.Xml.XmlUtil.GetAttribute("umlFieldTypeName", node);

            FieldTypes.Add(scName, umlName);

            // add the umlFieldTypeName to the aliases map to enable case-insensitive matches
            UmlFieldTypeAliases.Add(umlName, scName);

            // add the aliases to the alias map
            var umlAliases = Sitecore.Xml.XmlUtil.GetAttribute("umlAliases", node);

            if (string.IsNullOrEmpty(umlAliases))
            {
                return;
            }

            var aliases = umlAliases
                          .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var alias in aliases)
            {
                UmlFieldTypeAliases.Add(alias, scName);
            }
        }
Пример #32
0
 public CamlFilter(Search.SearchFilter searchFilter)
 {
     this.FieldName   = searchFilter.FieldName;
     this.FieldType   = searchFilter.FieldType;
     this.FilterType  = searchFilter.FilterType;
     this.FilterValue = searchFilter.FilterValue;
 }
Пример #33
0
        private FieldTypes[][] GenerateBaseTable(int rows, int columns, int mineCount)
        {
            var gameTable = new FieldTypes[rows][];

            var minedFields = Enumerable
                              .Range(0, rows)
                              .Select(row => Enumerable.Range(0, columns).Select(col => new { Row = row, Column = col }))
                              .SelectMany(pairs => pairs)
                              .Select(pair => new
            {
                pair.Row,
                pair.Column,
                Order = _randomNumberProvider.GetRandomNumber()
            })
                              .OrderBy(pairWithOrder => pairWithOrder.Order)
                              .Take(mineCount)
                              .ToList();

            for (var row = 0; row < rows; ++row)
            {
                gameTable[row] = new FieldTypes[columns];

                for (var col = 0; col < columns; ++col)
                {
                    gameTable[row][col] = FieldTypes.Empty;
                }
            }

            foreach (var minedField in minedFields)
            {
                gameTable[minedField.Row][minedField.Column] = FieldTypes.Mined;
            }

            return(gameTable);
        }
Пример #34
0
        public static string GetDescription(this FieldTypes value)
        {
            var enumType  = typeof(FieldTypes);
            var field     = enumType.GetField(value.ToString());
            var attribute = field.GetCustomAttribute <DescriptionAttribute>();

            return(attribute?.Description ?? value.ToString());
        }
Пример #35
0
        public void SetField(string name, object value, Type type)
        {
            curve.FireBeforeChange(BGCurve.EventPointField);

            FieldTypes.SetField(curve, type, name, value, PrivateValuesForFields);

            curve.FireChange(curve.UseEventsArgs ? BGCurveChangedArgs.GetInstance(Curve, this, BGCurve.EventPointField) : null, sender: this);
        }
Пример #36
0
 public static string getCheckBoxValue(string sVal, string CheckedValue, string UnCheckedValue, FieldTypes Type)
 {
     if (sVal.Length == 0) {
     return ToSQL(UnCheckedValue, Type);
     } else {
     return ToSQL(CheckedValue, Type);
     }
 }
Пример #37
0
        public override void InputValues(LayerTypes layer, FieldTypes field, int[] diceNumbers)
        {
            Layers[layer].InputValues(field, diceNumbers);

            if (field == FieldTypes.ONE)
            {
                Layers[LayerTypes.MIDDLE].InputValues(field, diceNumbers);
            }
        }
Пример #38
0
 public Field(int x, int y)
 {
     this.x = x;
     this.y = y;
     this.type = FieldTypes.Path;
     this.connection = null;
     this.hitbox = new Rectangle(x * Data.BlockSize, y * Data.BlockSize, Data.BlockSize, Data.BlockSize);
     this.spawner = null;
 }
Пример #39
0
 public Field(int x, int y, FieldTypes type, Field Connection)
 {
     this.x = x;
     this.y = y;
     this.type = type;
     this.connection = Connection;
     this.hitbox = new Rectangle(x * Data.BlockSize, y * Data.BlockSize, Data.BlockSize, Data.BlockSize);
     this.spawner = null;
 }
Пример #40
0
 public void InputValues(FieldTypes field, int[] diceNumbers)
 {
     if (IsFieldFilled(field))
     {
         throw new FieldIsFilledException("The field is already filled.");
     }
     else
     {
         Fields[field].SetValue(diceNumbers);
     }
 }
Пример #41
0
 public int GetFieldValue(FieldTypes field)
 {
     if (IsFieldFilled(field))
     {
         return Fields[field].Value;
     }
     else
     {
         throw new FieldIsEmptyException("Field is empty.");
     }
 }
		bool CheckFields(IList<FieldDef> fields) {
			if (fields.Count != 3)
				return false;

			var fieldTypes = new FieldTypes(fields);
			if (fieldTypes.Count("System.Boolean") != 1)
				return false;
			if (fieldTypes.Count("System.Object") == 2)
				return true;
			return fieldTypes.Count("System.Reflection.Assembly") == 1 &&
				fieldTypes.Count("System.String[]") == 1;
		}
Пример #43
0
//  GlobalFuncs Event begin
//  GlobalFuncs Event end
		public static string ToSQL(string Param, FieldTypes Type) {
		if (Param == null || Param.Length == 0) {
			return "Null";
		} else {
			string str = Quote(Param);
			if (Type == FieldTypes.Number) {
			  return str.Replace(',','.');
			} else {
			  return "\'" + str + "\'";
			}
		}
		}
Пример #44
0
 public static MoreOfAKindField GetField(FieldTypes fieldType)
 {
     switch (fieldType)
     {
         case FieldTypes.TRIS:
             return new TrisField();
         case FieldTypes.POKER:
             return new PokerField();
         case FieldTypes.YAMB:
             return new YambField();
         default:
             throw new NonExistingFieldException("");
     }
 }
Пример #45
0
        public bool EnterDiceValue(IViewTableForm frmTableDisplay, IConfirmForm frmConfirm, ColumnTypes column, LayerTypes layer, FieldTypes field)
        {
            if (_currentDiceThrow == DiceThrow.FIRST && !_turnEnded)
            {
                frmTableDisplay.DisplayMsg(Color.Red, _msg[4]);
                return false;
            }
            else
            {
                if (ValidEntering(frmConfirm, column))
                {
                    try
                    {
                        YambTable.GetInstance().InputValue(column, layer, field, _diceRoller.Dices, _currentDiceThrow);

                        if (column == ColumnTypes.ANNOUNCEMENT)
                        {
                            AnnouncementActions(frmTableDisplay, field);
                        }
                        else
                        {
                            NextTurn();
                            frmTableDisplay.EndOfTurnActions();
                        }

                        if (YambTable.GetInstance().IsTableFull())
                        {
                            frmTableDisplay.GameFinished();
                        }
                    }
                    catch (YambException)
                    {
                        frmTableDisplay.DisplayMsg(Color.Red, _msg[5]);
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
Пример #46
0
 public static DatabaseType GetType(FieldTypes type)
 {
     DatabaseType databastType = null;
     switch (type)
     {
         case FieldTypes.BLOB:
             databastType = new DatabaseType(SqlDbType.VarBinary, DbType.Binary);
             break;
         case FieldTypes.DATETIME:
             databastType = new DatabaseType(SqlDbType.DateTime, DbType.DateTime);
             break;
         case FieldTypes.INT:
             databastType = new DatabaseType(SqlDbType.Int, DbType.Int32);
             break;
         case FieldTypes.TEXT:
             databastType = new DatabaseType(SqlDbType.VarChar, DbType.String);
             break;
     }
     return databastType;
 }
Пример #47
0
 private void picBox_rowMaxAnnounce_Click(object sender, EventArgs e)
 {
     SaveToTEMP();
     announcedField = picBox_rowMaxAnnounce;
     inputFiledsColumn = ColumnTypes.ANNOUNCEMENT;
     inputFieldType = FieldTypes.MAX;
     bool entered = game.EnterDiceValue(this, new frmConfirm(), ColumnTypes.ANNOUNCEMENT, LayerTypes.MIDDLE, FieldTypes.MAX);
     if (!entered)
     {
         ReturnFromTEMP();
     }
 }
Пример #48
0
        public void InputValue(ColumnTypes column, LayerTypes layer, FieldTypes field, int[] diceNumbers, DiceThrow diceThrow)
        {
            if (column == ColumnTypes.ANNOUNCEMENT && !_announced)
            {
                if (diceThrow == DiceThrow.SECOND)
                {
                    Columns[column].InputValues(layer, field, diceNumbers);
                    _announced = true;
                }
                else
                {
                    throw new InaccessibleFieldException("The field is unavailable.");
                }
            }
            else if (_announced && column != ColumnTypes.ANNOUNCEMENT)
            {
                throw new InaccessibleFieldException("The field is unavailable.");
            }
            else
            {
                Columns[column].InputValues(layer, field, diceNumbers);
                _announced = false;
            }

            NotifyObservers();
        }
Пример #49
0
        public int GetFieldValue(ColumnTypes column, LayerTypes layer, FieldTypes field)
        {
            int value = 0;
            try
            {
                value = Columns[column].GetFieldValue(layer, field);
            }
            catch (FieldIsEmptyException)
            {
            }
            catch (KeyNotFoundException)
            {
                throw new NonExistingFieldException("There is no such field in the selected layer.");
            }

            return value;
        }
Пример #50
0
		StringDecrypterVersion GuessVersion(MethodDef cctor) {
			var fieldTypes = new FieldTypes(stringsEncodingClass);
			if (fieldTypes.Exactly(fields2x))
				return StringDecrypterVersion.V2;
			if (cctor == null)
				return StringDecrypterVersion.V1;
			if (fieldTypes.Exactly(fields3x))
				return StringDecrypterVersion.V3;
			return StringDecrypterVersion.Unknown;
		}
Пример #51
0
        bool couldBeStringDecrypterClass(TypeDefinition type)
        {
            var fields = new FieldTypes(type);
            if (fields.exists("System.Collections.Hashtable") ||
                fields.exists("System.Collections.Generic.Dictionary`2<System.Int32,System.String>") ||
                fields.exactly(fields3x)) {
                if (DotNetUtils.getMethod(type, ".cctor") == null)
                    return false;
            }
            else if (fields.exactly(fields1x) || fields.exactly(fields2x)) {
            }
            else
                return false;

            var methods = new List<MethodDefinition>(DotNetUtils.getNormalMethods(type));
            if (methods.Count != 1)
                return false;
            var method = methods[0];
            if (!DotNetUtils.isMethod(method, "System.String", "(System.Int32)"))
                return false;
            if (!method.IsStatic || !method.HasBody)
                return false;

            return true;
        }
Пример #52
0
 public int GetFieldValue(LayerTypes layer, FieldTypes field)
 {
     switch (layer)
     {
         case LayerTypes.FIRST:
             return FLayer.GetValue(((int) field) - 1);
         case LayerTypes.MIDDLE:
             return MLayer.GetValue(((int) field) - 6);
         case LayerTypes.LAST:
             return LLayer.GetValue(((int) field) - 9);
         default:
             throw new YambException("");
     }
 }
		List<TypeDef> FindVmHandlerTypes() {
			var requiredFields = new string[] {
				null,
				"System.Collections.Generic.Dictionary`2<System.UInt16,System.Type>",
				"System.UInt16",
			};
			var cflowDeobfuscator = new CflowDeobfuscator();
			foreach (var type in module.Types) {
				var cctor = type.FindStaticConstructor();
				if (cctor == null)
					continue;
				requiredFields[0] = type.FullName;
				var fieldTypes = new FieldTypes(type);
				if (!fieldTypes.All(requiredFields))
					continue;

				cflowDeobfuscator.Deobfuscate(cctor);
				var handlers = FindVmHandlerTypes(cctor);
				if (handlers.Count < NUM_HANDLERS)
					continue;

				return handlers;
			}

			return null;
		}
Пример #54
0
 private LayerTypes GetFieldsLayer(FieldTypes field)
 {
     int fieldNumberValue = (int)field;
     if (fieldNumberValue >= 1 && fieldNumberValue <= 6)
     {
         return LayerTypes.FIRST;
     }
     else if (fieldNumberValue == 7 || fieldNumberValue == 8)
     {
         return LayerTypes.MIDDLE;
     }
     else
     {
         return LayerTypes.LAST;
     }
 }
Пример #55
0
 public int GetFieldValue(ColumnTypes column, LayerTypes layer, FieldTypes field)
 {
     switch (column)
     {
         case ColumnTypes.DOWN:
             return DownColumn.GetFieldValue(layer, field);
         case ColumnTypes.UP:
             return UpColumn.GetFieldValue(layer, field);
         case ColumnTypes.FREE:
             return FreeColumn.GetFieldValue(layer, field);
         case ColumnTypes.ANNOUNCEMENT:
             return AnnouncementColumn.GetFieldValue(layer, field);
         default:
             throw new YambException("");
     }
 }
Пример #56
0
        private void AnnouncementActions(IViewTableForm frmTableDisplay, FieldTypes field)
        {
            if (_announced)
            {
                _announced = false;
                _autoValueInput = false;
                NextTurn();
                frmTableDisplay.EndOfTurnActions();
            }
            else
            {
                _announcedField = field;
                _announced = true;
                _autoValueInput = true;
            }

            frmTableDisplay.AnnouncementDisplayActions(_announced);
        }
Пример #57
0
 //Constructors
 public SecretField(FieldTypes type, SecretFields secretFieldName)
 {
     this.Type = type;
     this.SecretFieldName = secretFieldName;
 }
		private void ProcessTick(int requestId, FieldTypes field, decimal price, decimal? volume)
		{
			var l1Msg = GetLevel1Message(requestId);

			switch (field)
			{
				case FieldTypes.BidPrice:
				case FieldTypes.BidVolume:
					l1Msg.TryAdd(Level1Fields.BestBidPrice, price);
					l1Msg.TryAdd(Level1Fields.BestBidVolume, volume);
					break;
				case FieldTypes.AskPrice:
				case FieldTypes.AskVolume:
					l1Msg.TryAdd(Level1Fields.BestAskPrice, price);
					l1Msg.TryAdd(Level1Fields.BestAskVolume, volume);
					break;
				case FieldTypes.LastPrice:
				case FieldTypes.LastVolume:
					l1Msg.TryAdd(Level1Fields.LastTradePrice, price);
					l1Msg.TryAdd(Level1Fields.LastTradeVolume, volume);
					break;
				case FieldTypes.OpenPrice:
					l1Msg.TryAdd(Level1Fields.OpenPrice, price);
					break;
				case FieldTypes.HighPrice:
					l1Msg.TryAdd(Level1Fields.HighPrice, price);
					break;
				case FieldTypes.LowPrice:
					l1Msg.TryAdd(Level1Fields.LowPrice, price);
					break;
				case FieldTypes.ClosePrice:
					l1Msg.TryAdd(Level1Fields.ClosePrice, price);
					break;
				case FieldTypes.Volume:
					l1Msg.TryAdd(Level1Fields.Volume, volume);
					break;
				case FieldTypes.OpenInterest:
					l1Msg.TryAdd(Level1Fields.OpenInterest, volume);
					break;
				case FieldTypes.OptionHistoricalVolatility:
					l1Msg.TryAdd(Level1Fields.HistoricalVolatility, price);
					break;
				case FieldTypes.OptionImpliedVolatility:
					l1Msg.TryAdd(Level1Fields.ImpliedVolatility, price);
					break;
				case FieldTypes.LastYield:
					l1Msg.TryAdd(Level1Fields.Yield, price);
					break;
				case FieldTypes.CustOptionComputation:
					break;
				case FieldTypes.TradeCount:
					l1Msg.TryAdd(Level1Fields.TradesCount, (int)(volume ?? 0));
					break;
				//default:
				//	throw new InvalidOperationException("Неизвестный тип поля {0} для инструмента {1}.".Put(priceField, security));
			}

			SendOutMessage(l1Msg);
		}
Пример #59
0
 private void picBox_rowMinUp_Click(object sender, EventArgs e)
 {
     SaveToTEMP();
     inputFiledsColumn = ColumnTypes.UP;
     inputFieldType = FieldTypes.MIN;
     bool entered = game.EnterDiceValue(this, new frmConfirm(), ColumnTypes.UP, LayerTypes.MIDDLE, FieldTypes.MIN);
     if (!entered)
     {
         ReturnFromTEMP();
     }
 }
 public ProcessEditRetrieverMock(ProcessEdit process, FieldTypes fieldTypes)
 {
     this.LoadProperty(ProcessEditProperty, process);
     this.LoadProperty(FieldTypesProperty, fieldTypes);
 }