当前位置: 首页>>代码示例>>C#>>正文


C# Fields类代码示例

本文整理汇总了C#中Fields的典型用法代码示例。如果您正苦于以下问题:C# Fields类的具体用法?C# Fields怎么用?C# Fields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Fields类属于命名空间,在下文中一共展示了Fields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AGI_Fields

        public AGI_Fields(Fields gi_fields)
        {
            fields = new int[F_MAX_X * F_MAX_Y];

            /* 初期化 */
            int cnt = 0;
            for (int i = 0 ; i < fields.Length; i++)
            {
                if (i < F_MAX_X)
                {
                    fields[i] = WALL;
                }
                else if (i > (F_MAX_X * (F_MAX_Y - 1)))
                {
                    fields[i] = WALL;
                }
                else if (((i % F_MAX_X) == 0) || ((i % F_MAX_X) == (F_MAX_X - 1)))
                {
                    fields[i] = WALL;
                }
                else
                {
                    if (gi_fields.GetFieldsInfo(cnt) == 0)
                    {
                        fields[i] = EMPUTY;
                    }
                    else
                    {
                        fields[i] = OBJECT;
                    }
                    cnt++;
                }
            }
        }
开发者ID:yuusuwalann,项目名称:procon2015,代码行数:34,代码来源:AGI_Fields.cs

示例2: GetGameState

        public static GameStates GetGameState(Fields.Field field, Player.Player currentPlayer)
        {
            if (currentPlayer == null)
            {
                return GameStates.Laufend;
            }

            foreach (char symbol in GetAllPlayerSymbols(field))
            {
                if (WinChecker.Pruefe(symbol, field))
                {
                    if (currentPlayer.Symbol == symbol)
                    {
                        return GameStates.Gewonnen;
                    }
                    else
                    {
                        return GameStates.Verloren;
                    }
                }
            }

            if (!FieldHelper.HasEmptyFields(field))
            {
                return GameStates.Unentschieden;
            }
            return GameStates.Laufend;
        }
开发者ID:Postremus,项目名称:UniTTT,代码行数:28,代码来源:FieldHelper.cs

示例3: Read

        public IParameters Read(TflTransform transform) {
            var parameters = new Parameters.Parameters(new DefaultFactory(_logger));

            foreach (var p in transform.Parameters) {
                if (string.IsNullOrEmpty(p.Field) && (string.IsNullOrEmpty(p.Name) || string.IsNullOrEmpty(p.Value))) {
                    throw new TransformalizeException(_logger, "The entity {0} has a {1} transform parameter without a field attribute, or name and value attributes.  Entity parameters require one or the other.", _entity.Alias, transform.Method);
                }

                var fields = new Fields(_entity.Fields, _entity.CalculatedFields);
                if (!string.IsNullOrEmpty(p.Field)) {
                    if (fields.FindByParamater(p).Any()) {
                        var field = fields.FindByParamater(p).Last();
                        var name = string.IsNullOrEmpty(p.Name) ? field.Alias : p.Name;
                        parameters.Add(field.Alias, name, null, field.Type);
                    } else {
                        if (!p.Field.StartsWith("Tfl")) {
                            _logger.EntityWarn(_entity.Name, "The entity {0} has a {1} transform parameter that references field {2}.  This field hasn't been defined yet in {0}.", _entity.Alias, transform.Method, p.Field);
                        }
                        var name = string.IsNullOrEmpty(p.Name) ? p.Field : p.Name;
                        parameters.Add(p.Field, name, p.HasValue() ? p.Value : null, "System.String");
                    }
                } else {
                    var parameter = new Parameter(p.Name, p.Value) {
                        SimpleType = Common.ToSimpleType(p.Type),
                        ValueReferencesField = p.HasValue() && fields.Find(p.Value).Any()
                    };
                    parameters.Add(p.Name, parameter);
                }
            }

            return parameters;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:32,代码来源:EntityTransformParametersReader.cs

示例4: TruncateOperation

        public TruncateOperation(string entityName, Fields fields, Fields calculatedFields = null)
            : base(string.Empty, string.Empty) {

            EntityName = entityName;

            foreach (Field field in fields.WithString()) {
                _aliases.Add(field.Alias);
                var value = field.Length.Equals("max", IC) ? Int32.MaxValue.ToString(CultureInfo.InvariantCulture) : field.Length;
                if (CanChangeType(value, typeof(int))) {
                    _lengthMap[field.Alias] = Convert.ToInt32(value);
                } else {
                    throw new TransformalizeException(Logger, "Can not change field {0}'s length of '{0}' to an integer.  Please use an integer or the keyword: max.", field.Alias, value);
                }
            }

            if (calculatedFields != null) {
                foreach (var field in calculatedFields.WithString()) {
                    if (!_aliases.Contains(field.Alias)) {
                        _aliases.Add(field.Alias);
                        var value = field.Length.Equals("max", IC) ? Int32.MaxValue.ToString(CultureInfo.InvariantCulture) : field.Length;
                        if (CanChangeType(value, typeof(int))) {
                            _lengthMap[field.Alias] = Convert.ToInt32(value);
                        } else {
                            throw new TransformalizeException(Logger, "Can not change field {0}'s length of '{1}' to an integer.  Please use an integer or the keyword: max.", field.Alias, value);
                        }
                    }
                }
            }

            base.OnFinishedProcessing += StringLengthOperation_OnFinishedProcessing;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:31,代码来源:TruncateOperation.cs

示例5: Read

        public IParameters Read(TflTransform transform) {
            var parameters = new Parameters.Parameters(_defaultFactory);
            var fields = new Fields(_process.OutputFields(), _process.CalculatedFields.WithoutOutput());

            foreach (var p in transform.Parameters) {

                if (!string.IsNullOrEmpty(p.Field)) {
                    if (fields.FindByParamater(p).Any()) {
                        var field = fields.FindByParamater(p).Last();
                        var name = string.IsNullOrEmpty(p.Name) ? field.Alias : p.Name;
                        parameters.Add(field.Alias, name, null, field.Type);
                    } else {
                        _process.Logger.Warn("A {0} transform references {1}, but I can't find the definition for {1}.\r\nYou may need to define the entity attribute in the parameter element.\r\nOr, set the output attribute to true in the field element. Process transforms rely on fields being output.\r\nOne other possibility is that the participates in a relationship with another field with the same name and Transformalize doesn't know which one you want.  If that's the case, you have to alias one of them.", transform.Method, p.Field);
                        var name = p.Name.Equals(string.Empty) ? p.Field : p.Name;
                        parameters.Add(p.Field, name, p.HasValue() ? p.Value : null, p.Type);
                    }
                } else {
                    var parameter = new Parameter(p.Name, p.Value) {
                        SimpleType = Common.ToSimpleType(p.Type),
                        ValueReferencesField = p.HasValue() && fields.Find(p.Value).Any()
                    };
                    parameters.Add(p.Name, parameter);
                }
            }

            return parameters;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:27,代码来源:ProcessTransformParametersReader.cs

示例6: SetFieldValue

        public void SetFieldValue(Fields aField, string aValue)
        {
            InputType inputType = GetInputType(aField);
            string locator = GetLocator(aField, LocatorType.Edit);

            SetFieldValue(inputType, locator, aValue);
        }
开发者ID:aliaksandr-trush,项目名称:csharp-automaton,代码行数:7,代码来源:CCVerificationManager.cs

示例7: SerializeFields

 private static string SerializeFields(Fields? fieldsToFacet)
 {
     if (fieldsToFacet  == Fields.Ip) { return "ip"; }
      if (fieldsToFacet  == Fields.InputName) { return "inputname"; }
      if (fieldsToFacet == Fields.Text) { return "text"; }
      return null;
 }
开发者ID:survili,项目名称:loggly-csharp,代码行数:7,代码来源:FacetQuery.cs

示例8: LogLoadOperation

 public LogLoadOperation(Entity entity) {
     _entity = entity;
     var fields = new Fields(entity.Fields, entity.CalculatedFields).WithOutput();
     _columns.AddRange(fields.Aliases());
     _guids.AddRange(fields.WithGuid().Aliases());
     _byteArrays.AddRange(fields.WithBytes().Aliases());
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:LogLoadOperation.cs

示例9: GetFieldValue

        public string GetFieldValue(Fields aField)
        {
            InputType inputType = GetInputType(aField);
            string locator = GetLocator(aField, LocatorType.Edit);

            return GetFieldValue(inputType, locator);
        }
开发者ID:aliaksandr-trush,项目名称:csharp-automaton,代码行数:7,代码来源:CCVerificationManager.cs

示例10: Fields

 public Fields Fields() {
     var fields = new Fields();
     foreach (var join in Join) {
         fields.Add(join.Fields());
     }
     return fields;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:Relationship.cs

示例11: PrepareSchema

        protected override void PrepareSchema() {
            NotifyBatchSize = (int)LogRows;
            BatchSize = _batchSize;

            var fromFields = new Fields(_entity.Fields, _entity.CalculatedFields).WithOutput().AddBatchId(_entity.Index, false);
            if (_entity.IsMaster() && _entity.Delete)
                fromFields.AddDeleted(_entity.Index, false);

            foreach (var field in fromFields) {
                Schema[field.Alias] = field.SystemType;
            }

            var toFields = new SqlServerEntityAutoFieldReader().Read(Connection, _entity.ProcessName, _entity.Prefix, _entity.OutputName(), string.Empty, _entity.IsMaster());
            foreach (var from in fromFields) {
                if (toFields.HaveField(from.Alias)) {
                    var to = toFields.Find(from.Alias).First();
                    if (!to.SimpleType.Equals(from.SimpleType)) {
                        if (!to.SimpleType.Equals("byte[]") && from.SimpleType.Equals("rowversion")) {
                            throw new TransformalizeException(Logger, EntityName, "{0} has a matching {1} fields, but different types: {2} != {3}.", TargetTable, from.Alias, from.SimpleType, to.SimpleType);
                        }
                    }
                } else {
                    throw new TransformalizeException(Logger, EntityName, "{0} does not have a matching {1} field.", TargetTable, from.Alias);
                }
            }
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:26,代码来源:SqlServerBulkLoadOperation.cs

示例12: Read

        public Fields Read(AbstractConnection connection, string process, string prefix, string name, string schema, bool isMaster = false) {
            var fields = new Fields();

            using (var cn = connection.GetConnection()) {
                cn.Open();
                var sql = PrepareSql();
                connection.Logger.EntityDebug(name, sql);

                var results = cn.Query(sql, new { name, schema });

                foreach (var result in results) {
                    var columnName = result.COLUMN_NAME;
                    var type = GetSystemType(result.DATA_TYPE);
                    var length = result.CHARACTER_MAXIMUM_LENGTH == "0" || result.CHARACTER_MAXIMUM_LENGTH == "-1" ? "64" : result.CHARACTER_MAXIMUM_LENGTH;
                    var fieldType = (bool)result.IS_PRIMARY_KEY ? (isMaster ? FieldType.MasterKey : FieldType.PrimaryKey) : FieldType.NonKey;
                    var field = new Field(type, length, fieldType, true, string.Empty) {
                        Name = columnName,
                        Entity = name,
                        Process = process,
                        Index = Convert.ToInt16(result.ORDINAL_POSITION - 1),
                        Schema = schema,
                        Input = true,
                        Precision = result.NUMERIC_PRECISION,
                        Scale = result.NUMERIC_SCALE,
                        Alias = prefix + columnName
                    };
                    fields.Add(field);
                }
            }

            return fields;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:32,代码来源:SqlServerEntityAutoFieldReader.cs

示例13: ExecuteEdit

 public static void ExecuteEdit(IWin32Window owner, Fields fields)
 {
     using (var form = new ViewFieldsForm())
     {
         form.Init(fields, true);
         form.ShowDialog(owner);
     }
 }
开发者ID:JenekX,项目名称:PasswordManager,代码行数:8,代码来源:ViewFieldsForm.cs

示例14: EntityKeysToOperations

 public EntityKeysToOperations(ref Entity entity, AbstractConnection connection, bool firstRun, string operationColumn = "operation") {
     _entity = entity;
     _connection = connection;
     _firstRun = firstRun;
     _operationColumn = operationColumn;
     _key = _entity.PrimaryKey.WithInput();
     _fields = _entity.Fields.WithInput();
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:EntityKeysToOperations.cs

示例15: SlowCompositeReaderWrapper

 private SlowCompositeReaderWrapper(CompositeReader reader)
     : base()
 {
     @in = reader;
     fields = MultiFields.GetFields(@in);
     liveDocs = MultiFields.GetLiveDocs(@in);
     @in.RegisterParentReader(this);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:8,代码来源:SlowCompositeReaderWrapper.cs


注:本文中的Fields类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。