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;
        }
        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;
        }
Пример #3
0
        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;
        }
Пример #4
0
        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++;
                }
            }
        }
        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;
        }
        public void SetFieldValue(Fields aField, string aValue)
        {
            InputType inputType = GetInputType(aField);
            string locator = GetLocator(aField, LocatorType.Edit);

            SetFieldValue(inputType, locator, aValue);
        }
Пример #7
0
 public Fields Fields() {
     var fields = new Fields();
     foreach (var join in Join) {
         fields.Add(join.Fields());
     }
     return fields;
 }
Пример #8
0
 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;
 }
        public string GetFieldValue(Fields aField)
        {
            InputType inputType = GetInputType(aField);
            string locator = GetLocator(aField, LocatorType.Edit);

            return GetFieldValue(inputType, locator);
        }
        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);
                }
            }
        }
        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;
        }
Пример #12
0
 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());
 }
 private SlowCompositeReaderWrapper(CompositeReader reader)
     : base()
 {
     @in = reader;
     fields = MultiFields.GetFields(@in);
     liveDocs = MultiFields.GetLiveDocs(@in);
     @in.RegisterParentReader(this);
 }
Пример #14
0
 public static void ExecuteEdit(IWin32Window owner, Fields fields)
 {
     using (var form = new ViewFieldsForm())
     {
         form.Init(fields, true);
         form.ShowDialog(owner);
     }
 }
 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();
 }
 public SqlServerEntityKeysExtractFromOutput(AbstractConnection connection, Entity entity)
     : base(connection) {
     _connection = connection;
     EntityName = entity.Name;
     _entity = entity;
     _fields = new List<string>(new FieldSqlWriter(entity.PrimaryKey).AddDeleted(entity).Alias(connection.L, connection.R).Keys()) { "TflKey" };
     _key = _entity.PrimaryKey;
 }
Пример #17
0
 public override Vector2i Play(Fields.IField field)
 {
     if (KI is KI.IPlayableKI)
     {
         return Vector2i.IndexToVector(((UniTTT.Logik.KI.IPlayableKI)KI).Play(field, Symbol), field.Width, field.Height);
     }
     else
         return new Vector2i(-1, -1);
 }
Пример #18
0
        public static string Select(Fields fields, string leftTable, string rightTable, AbstractConnection connection, string leftSchema, string rightSchema) {
            var maxDop = connection.MaxDop ? "OPTION (MAXDOP 2);" : ";";
            var sqlPattern = "\r\nSELECT\r\n    {0}\r\nFROM {1} l\r\nINNER JOIN {2} r ON ({3})\r\n" + maxDop;

            var columns = new FieldSqlWriter(fields).Input().Select(connection).Prepend("l.").ToAlias(connection.L, connection.R, true).Write(",\r\n    ");
            var join = new FieldSqlWriter(fields).FieldType(FieldType.MasterKey, FieldType.PrimaryKey).Name(connection.L, connection.R).Input().Set("l", "r").Write(" AND ");

            return string.Format(sqlPattern, columns, SafeTable(leftTable, connection, leftSchema), SafeTable(rightTable, connection, rightSchema), @join);
        }
        public DapperBulkUpdateOperation(AbstractConnection connection, Entity entity) {
            _connection = connection;
            _tflBatchId = entity.TflBatchId;
            _fields = entity.OutputFields();
            var writer = new FieldSqlWriter(_fields);
            var sets = writer.Alias(_connection.L, _connection.R).SetParam().Write(", ", false);

            _sql = string.Format(@"UPDATE [{0}] SET {1}, TflBatchId = @TflBatchId WHERE TflKey = @TflKey;", entity.OutputName(), sets);
        }
Пример #20
0
        public void SelectFieldDeclaredOnBaseReturnsCorrectField()
        {
            var sut = new Fields<SubClassWithFields>();
            var expected = typeof(SubClassWithFields).GetField("ReadOnlyText");

            var actual = sut.Select(x => x.ReadOnlyText);

            Assert.Equal(expected, actual);
        }
        public void VerifyFieldMemberCallsVerifyField()
        {
            var sut = new Mock<IdiomaticAssertion> { CallBase = true }.Object;
            var field = new Fields<ClassWithMembers>().Select(x => x.PublicField);

            sut.Verify((MemberInfo)field);

            sut.ToMock().Verify(x => x.Verify(field));
        }
Пример #22
0
 public override Vector2i Play(Fields.Field field)
 {
     if (AI is AI.IPlayableAI)
     {
         return Vector2i.FromIndex(((UniTTT.Logik.AI.IPlayableAI)AI).Play(field), field.Width, field.Height);
     }
     else
         return new Vector2i(-1, -1);
 }
Пример #23
0
        public void QueryFieldUsingLinqSyntaxReturnsCorrectField()
        {
            var sut = new Fields<ClassWithFields>();

            FieldInfo actual = from x in sut select x.ReadOnlyText;

            var expected = typeof(ClassWithFields).GetField("ReadOnlyText");
            Assert.Equal(expected, actual);
        }
Пример #24
0
    public Configuration(string configFilename)
    {
      this.m_configFilename = configFilename;
      Debug.Log("Config file set to: {0}.", this.m_configFilename);

      /* Default field initialization. */
      this.m_currentSerializer = new DataContractJsonSerializer(typeof(Fields));
      this.m_configFields = new Fields();
    }
Пример #25
0
        public void SelectFieldReturnsCorrectField()
        {
            var sut = new Fields<ClassWithFields>();

            FieldInfo actual = sut.Select(x => x.ReadOnlyText);

            var expected = typeof(ClassWithFields).GetField("ReadOnlyText");
            Assert.Equal(expected, actual);
        }
Пример #26
0
        public void RecordType_DifferentFieldTypes()
        {
            var fields1 = new Fields { { "name", IntegerType.Create() }, { "lastname", StringType.Create() } };
            var fields2 = new Fields { { "name", StringType.Create() }, { "lastname", StringType.Create() } };

            var t1 = new RecordType("somerecord", fields1);
            var t2 = new RecordType("somerecord", fields2);

            Assert.That(t1 != t2);
        }
Пример #27
0
        public PasswordDocument()
        {
            IsLoaded = false;
            _fileName = string.Empty;
            DocumentPassword = string.Empty;

            _passwordFields = new Fields(this);
            _passwordTypes = new PasswordTypes(this);
            _passwords = new Passwords(this);
        }
Пример #28
0
 public static int GetFullFields(Fields.Field field)
 {
     int count = 0;
     for (int i = 0; i < field.Length; i++)
     {
         if (!field.IsFieldEmpty(i))
             count++;
     }
     return count;
 }
Пример #29
0
 public static Fields.Field GetRandomField(Fields.Field field)
 {
     char player = '2';
     for (int i = 0; i < field.Length; i++)
     {
         field.SetField(GetRandomZug(field), player);
         player = Player.Player.PlayerChange(player);
     }
     return field;
 }
Пример #30
0
 public LuceneKeysExtractAll(LuceneConnection luceneConnection, Entity entity, bool input = false) {
     _luceneConnection = luceneConnection;
     _entity = entity;
     _input = input;
     _fields = entity.PrimaryKey;
     if (entity.Version != null && !_fields.HaveField(entity.Version.Alias)) {
         _fields.Add(entity.Version);
     }
     _selected = _fields.Select(f => input ? f.Name : f.Alias).ToArray();
 }
Пример #31
0
 /// <summary>
 /// Modifies a message. It sends a modified outcome to the peer.
 /// </summary>
 /// <param name="message">The message to modify.</param>
 /// <param name="deliveryFailed">If set, the message's delivery-count is incremented.</param>
 /// <param name="undeliverableHere">Indicates if the message should not be redelivered to this endpoint.</param>
 /// <param name="messageAnnotations">Annotations to be combined with the current message annotations.</param>
 public void Modify(Message message, bool deliveryFailed, bool undeliverableHere = false, Fields messageAnnotations = null)
 {
     this.ThrowIfDetaching("Modify");
     this.DisposeMessage(message, new Modified()
     {
         DeliveryFailed     = deliveryFailed,
         UndeliverableHere  = undeliverableHere,
         MessageAnnotations = messageAnnotations
     },
                         null);
 }
Пример #32
0
        public GridConfigurationEditor(IIOHelper ioHelper) : base(ioHelper)
        {
            var items = Fields.First(x => x.Key == "items");

            items.Validators.Add(new GridValidator());
        }
Пример #33
0
        public override string ToString()
        {
            if (Terms == null)
            {
                string termString = String.Format("{0}{{{1}}}:{2}", TermType.ToString().ToUpperInvariant(), String.Join(",", Values), String.Join(",", Fields.Select(field => field.Name)));
                if (Inverted.HasValue && Inverted.Value)
                {
                    termString = "(NOT+" + termString + ")";
                }
                return(termString);
            }

            var sb = new StringBuilder();

            sb.Append("(");
            foreach (var term in Terms)
            {
                if (term.Operator.HasValue)
                {
                    sb.Append("+" + term.Operator.ToString().ToUpperInvariant() + "+");
                }
                sb.Append(term);
            }
            sb.Append(")");

            return(sb.ToString());
        }
Пример #34
0
 public override string ToString()
 {
     return(Fields.ToString() + " " + DbfRecordNo.ToString());
 }
Пример #35
0
        public Fields CreateNewFields()
        {
            Fields fields = this.typeFixture.CreateNewFields();

            return(fields);
        }
Пример #36
0
        public override MixAttributeSetData ParseModel(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            if (string.IsNullOrEmpty(Id))
            {
                Id = Guid.NewGuid().ToString();
                CreatedDateTime = DateTime.UtcNow;
                Priority        = Repository.Count(m => m.AttributeSetName == AttributeSetName && m.Specificulture == Specificulture, _context, _transaction).Data + 1;
            }

            if (string.IsNullOrEmpty(AttributeSetName))
            {
                AttributeSetName = _context.MixAttributeSet.First(m => m.Id == AttributeSetId)?.Name;
            }
            if (AttributeSetId == 0)
            {
                AttributeSetId = _context.MixAttributeSet.First(m => m.Name == AttributeSetName)?.Id ?? 0;
            }
            Values = Values ?? MixAttributeSetValues.UpdateViewModel
                     .Repository.GetModelListBy(a => a.DataId == Id && a.Specificulture == Specificulture, _context, _transaction).Data.OrderBy(a => a.Priority).ToList();
            Fields = MixAttributeFields.UpdateViewModel.Repository.GetModelListBy(f => f.AttributeSetId == AttributeSetId, _context, _transaction).Data;

            foreach (var field in Fields.OrderBy(f => f.Priority))
            {
                var val = Values.FirstOrDefault(v => v.AttributeFieldId == field.Id);
                if (val == null)
                {
                    val = new MixAttributeSetValues.UpdateViewModel(
                        new MixAttributeSetValue()
                    {
                        AttributeFieldId   = field.Id,
                        AttributeFieldName = field.Name,
                    }
                        , _context, _transaction)
                    {
                        StringValue = field.DefaultValue,
                        Priority    = field.Priority,
                        Field       = field
                    };
                    Values.Add(val);
                }
                val.Priority         = field.Priority;
                val.AttributeSetName = AttributeSetName;
                if (Data[val.AttributeFieldName] != null)
                {
                    if (val.Field.DataType == MixEnums.MixDataType.Reference)
                    {
                        var arr = Data[val.AttributeFieldName].Value <JArray>();
                        if (arr != null)
                        {
                            foreach (JObject objData in arr)
                            {
                                string id = objData["id"]?.Value <string>();
                                // if have id => update data, else add new
                                if (!string.IsNullOrEmpty(id))
                                {
                                    //var getData = Repository.GetSingleModel(m => m.Id == id && m.Specificulture == Specificulture, _context, _transaction);
                                    //if (getData.IsSucceed)
                                    //{
                                    //    getData.Data.Data = objData;
                                    //    RefData.Add(getData.Data);
                                    //}
                                }
                                else
                                {
                                    RefData.Add(new FormViewModel()
                                    {
                                        Specificulture = Specificulture,
                                        AttributeSetId = field.ReferenceId.Value,
                                        Data           = objData
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        ParseModelValue(Data[val.AttributeFieldName], val);
                    }
                }
                else
                {
                    Data.Add(ParseValue(val));
                }
            }

            // Save Edm html
            var getAttrSet = Mix.Cms.Lib.ViewModels.MixAttributeSets.ReadViewModel.Repository.GetSingleModel(m => m.Name == AttributeSetName, _context, _transaction);
            var getEdm     = Lib.ViewModels.MixTemplates.UpdateViewModel.GetTemplateByPath(getAttrSet.Data.EdmTemplate, Specificulture);
            var edmField   = Values.FirstOrDefault(f => f.AttributeFieldName == "edm");

            if (edmField != null && getEdm.IsSucceed && !string.IsNullOrEmpty(getEdm.Data.Content))
            {
                string body = getEdm.Data.Content;
                foreach (var prop in Data.Properties())
                {
                    body = body.Replace($"[[{prop.Name}]]", Data[prop.Name].Value <string>());
                }
                var edmFile = new FileViewModel()
                {
                    Content    = body,
                    Extension  = ".html",
                    FileFolder = "edms",
                    Filename   = $"{getAttrSet.Data.EdmSubject}-{Id}"
                };
                if (FileRepository.Instance.SaveWebFile(edmFile))
                {
                    Data["edm"]          = edmFile.WebPath;
                    edmField.StringValue = edmFile.WebPath;
                }
            }
            //End save edm
            return(base.ParseModel(_context, _transaction));;
        }
 private void SetInitialized(Fields field)
 {
     _initializedFields |= field;
 }
 private bool IsNotInitialized(Fields field)
 {
     return((_initializedFields & field) != field);
 }
Пример #39
0
        public async Task <CipherView> DecryptAsync()
        {
            var model = new CipherView(this);

            await DecryptObjAsync(model, this, new HashSet <string>
            {
                "Name",
                "Notes"
            }, OrganizationId);

            switch (Type)
            {
            case Enums.CipherType.Login:
                model.Login = await Login.DecryptAsync(OrganizationId);

                break;

            case Enums.CipherType.SecureNote:
                model.SecureNote = await SecureNote.DecryptAsync(OrganizationId);

                break;

            case Enums.CipherType.Card:
                model.Card = await Card.DecryptAsync(OrganizationId);

                break;

            case Enums.CipherType.Identity:
                model.Identity = await Identity.DecryptAsync(OrganizationId);

                break;

            default:
                break;
            }

            if (Attachments?.Any() ?? false)
            {
                model.Attachments = new List <AttachmentView>();
                var tasks = new List <Task>();
                async Task decryptAndAddAttachmentAsync(Attachment attachment)
                {
                    var decAttachment = await attachment.DecryptAsync(OrganizationId);

                    model.Attachments.Add(decAttachment);
                }

                foreach (var attachment in Attachments)
                {
                    tasks.Add(decryptAndAddAttachmentAsync(attachment));
                }
                await Task.WhenAll(tasks);
            }
            if (Fields?.Any() ?? false)
            {
                model.Fields = new List <FieldView>();
                var tasks = new List <Task>();
                async Task decryptAndAddFieldAsync(Field field)
                {
                    var decField = await field.DecryptAsync(OrganizationId);

                    model.Fields.Add(decField);
                }

                foreach (var field in Fields)
                {
                    tasks.Add(decryptAndAddFieldAsync(field));
                }
                await Task.WhenAll(tasks);
            }
            if (PasswordHistory?.Any() ?? false)
            {
                model.PasswordHistory = new List <PasswordHistoryView>();
                var tasks = new List <Task>();
                async Task decryptAndAddHistoryAsync(PasswordHistory ph)
                {
                    var decPh = await ph.DecryptAsync(OrganizationId);

                    model.PasswordHistory.Add(decPh);
                }

                foreach (var ph in PasswordHistory)
                {
                    tasks.Add(decryptAndAddHistoryAsync(ph));
                }
                await Task.WhenAll(tasks);
            }
            return(model);
        }
        public override int Merge(MergeState mergeState)
        {
            int docCount = 0;
            int idx      = 0;

            foreach (AtomicReader reader in mergeState.Readers)
            {
                SegmentReader matchingSegmentReader = mergeState.MatchingSegmentReaders[idx++];
                CompressingTermVectorsReader matchingVectorsReader = null;
                if (matchingSegmentReader != null)
                {
                    TermVectorsReader vectorsReader = matchingSegmentReader.TermVectorsReader;
                    // we can only bulk-copy if the matching reader is also a CompressingTermVectorsReader
                    if (vectorsReader != null && vectorsReader is CompressingTermVectorsReader)
                    {
                        matchingVectorsReader = (CompressingTermVectorsReader)vectorsReader;
                    }
                }

                int   maxDoc   = reader.MaxDoc;
                IBits liveDocs = reader.LiveDocs;

                if (matchingVectorsReader == null || matchingVectorsReader.Version != VERSION_CURRENT || matchingVectorsReader.CompressionMode != compressionMode || matchingVectorsReader.ChunkSize != chunkSize || matchingVectorsReader.PackedInt32sVersion != PackedInt32s.VERSION_CURRENT)
                {
                    // naive merge...
                    for (int i = NextLiveDoc(0, liveDocs, maxDoc); i < maxDoc; i = NextLiveDoc(i + 1, liveDocs, maxDoc))
                    {
                        Fields vectors = reader.GetTermVectors(i);
                        AddAllDocVectors(vectors, mergeState);
                        ++docCount;
                        mergeState.CheckAbort.Work(300);
                    }
                }
                else
                {
                    CompressingStoredFieldsIndexReader index = matchingVectorsReader.Index;
                    IndexInput vectorsStreamOrig             = matchingVectorsReader.VectorsStream;
                    vectorsStreamOrig.Seek(0);
                    ChecksumIndexInput vectorsStream = new BufferedChecksumIndexInput((IndexInput)vectorsStreamOrig.Clone());

                    for (int i = NextLiveDoc(0, liveDocs, maxDoc); i < maxDoc;)
                    {
                        // We make sure to move the checksum input in any case, otherwise the final
                        // integrity check might need to read the whole file a second time
                        long startPointer = index.GetStartPointer(i);
                        if (startPointer > vectorsStream.GetFilePointer())
                        {
                            vectorsStream.Seek(startPointer);
                        }
                        if ((pendingDocs.Count == 0) && (i == 0 || index.GetStartPointer(i - 1) < startPointer)) // start of a chunk
                        {
                            int docBase   = vectorsStream.ReadVInt32();
                            int chunkDocs = vectorsStream.ReadVInt32();
                            if (Debugging.AssertsEnabled)
                            {
                                Debugging.Assert(docBase + chunkDocs <= matchingSegmentReader.MaxDoc);
                            }
                            if (docBase + chunkDocs < matchingSegmentReader.MaxDoc && NextDeletedDoc(docBase, liveDocs, docBase + chunkDocs) == docBase + chunkDocs)
                            {
                                long chunkEnd    = index.GetStartPointer(docBase + chunkDocs);
                                long chunkLength = chunkEnd - vectorsStream.GetFilePointer();
                                indexWriter.WriteIndex(chunkDocs, this.vectorsStream.GetFilePointer());
                                this.vectorsStream.WriteVInt32(docCount);
                                this.vectorsStream.WriteVInt32(chunkDocs);
                                this.vectorsStream.CopyBytes(vectorsStream, chunkLength);
                                docCount     += chunkDocs;
                                this.numDocs += chunkDocs;
                                mergeState.CheckAbort.Work(300 * chunkDocs);
                                i = NextLiveDoc(docBase + chunkDocs, liveDocs, maxDoc);
                            }
                            else
                            {
                                for (; i < docBase + chunkDocs; i = NextLiveDoc(i + 1, liveDocs, maxDoc))
                                {
                                    Fields vectors = reader.GetTermVectors(i);
                                    AddAllDocVectors(vectors, mergeState);
                                    ++docCount;
                                    mergeState.CheckAbort.Work(300);
                                }
                            }
                        }
                        else
                        {
                            Fields vectors = reader.GetTermVectors(i);
                            AddAllDocVectors(vectors, mergeState);
                            ++docCount;
                            mergeState.CheckAbort.Work(300);
                            i = NextLiveDoc(i + 1, liveDocs, maxDoc);
                        }
                    }

                    vectorsStream.Seek(vectorsStream.Length - CodecUtil.FooterLength());
                    CodecUtil.CheckFooter(vectorsStream);
                }
            }
            Finish(mergeState.FieldInfos, docCount);
            return(docCount);
        }
 public ActivationStatusRequest()
 {
     Fields.Add("Label", new Field(FT.Alpha, 6, "@@ASRQ"));
     Fields.Add("ActivationCode", new Field(FT.Alpha, 10));
     Fields.Add("EndSegment", new Field(FT.Alpha, 1, "|"));
 }
Пример #42
0
 public void WriteField(Field field)
 {
     field.AllTypesAreResolved = !_visibility;
     Fields.Add(field);
 }
Пример #43
0
 public matg() : base("matg", "match_globals", 644)
 {
     Fields.AddRange(new MetaNode[] {
         new Padding(172),
         new HaloPlugins.Objects.Data.Enum("Language", new string[] {  }, 32),
         new TagBlock("Havok Cleanup Resources", 8, 1, new MetaNode[] {
             new TagReference("Object_Cleanup_Effect", "effe"),
         }),
         new TagBlock("Collision Damage", 72, 1, new MetaNode[] {
             new TagReference("Collision_Damage", "jpt!"),
             new Value("Min Game Acc (Default)", typeof(float)),
             new Value("Max Game Acc (Default)", typeof(float)),
             new Value("Min Gam Scale (Default)", typeof(float)),
             new Value("Max Gam Scale (Default)", typeof(float)),
             new Value("Min abs Acc (Default)", typeof(float)),
             new Value("Max abs Acc (Default)", typeof(float)),
             new Value("Min abs Scale (Default)", typeof(float)),
             new Value("Max abs Scale (Default)", typeof(float)),
             new Padding(32),
         }),
         new TagBlock("Sound Info", 36, 1, new MetaNode[] {
             new TagReference("Sound_Class", "sncl"),
             new TagReference("Sound_FX", "sfx+"),
             new TagReference("Sound_Mix", "snmx"),
             new TagReference("Sound_Combat_Dialogue", "adlg"),
             new TagIndex("Resources", "****"),
         }),
         new TagBlock("AI Information", 360, 1, new MetaNode[] {
             new Value("Danger Broadly Facing", typeof(float)),
             new Padding(4),
             new Value("Danger Shooting Near", typeof(float)),
             new Padding(4),
             new Value("Danger Shooting At", typeof(float)),
             new Padding(4),
             new Value("Danger Extremely Close", typeof(float)),
             new Padding(4),
             new Value("Danger Sheild Damage", typeof(float)),
             new Value("Danger Extended Shield Damage", typeof(float)),
             new Value("Danger Body Damage", typeof(float)),
             new Value("Danger Extended Body Damage", typeof(float)),
             new Padding(48),
             new TagReference("AI_Dialog", "adlg"),
             new StringId("default_mission_dialogue_sound_effect"),
             new Padding(20),
             new Value("Jump Down", typeof(float)),
             new Value("Jump Step", typeof(float)),
             new Value("Jump Crouch", typeof(float)),
             new Value("Jump Stand", typeof(float)),
             new Value("Jump Storey", typeof(float)),
             new Value("Jump Tower", typeof(float)),
             new Value("Max Jump Down Height Down", typeof(float)),
             new Value("Max Jump Down Height Step", typeof(float)),
             new Value("Max Jump Down Height Crouch", typeof(float)),
             new Value("Max Jump Down Height Stand", typeof(float)),
             new Value("Max Jump Down Height Storey", typeof(float)),
             new Value("Max Jump Down Height Tower", typeof(float)),
             new Value("Hoist Step", typeof(float)),
             new Value("...To", typeof(float)),
             new Value("Hoist Crouch", typeof(float)),
             new Value("...To", typeof(float)),
             new Value("Hoist Stand", typeof(float)),
             new Value("...To", typeof(float)),
             new Padding(24),
             new Value("Vault Step", typeof(float)),
             new Value("...To", typeof(float)),
             new Value("Vault Crouch", typeof(float)),
             new Value("...To", typeof(float)),
             new Padding(48),
             new TagBlock("Gravemind Properties", 12, 1, new MetaNode[] {
                 new Value("Min Retreat Time", typeof(float)),
                 new Value("Ideal Retreat Time", typeof(float)),
                 new Value("Max Retreat Time", typeof(float)),
             }),
             new Padding(48),
             new Value("Scary Target Threhold", typeof(float)),
             new Value("Scary Weapon Threhold", typeof(float)),
             new Value("Player Scariness", typeof(float)),
             new Value("Berserking Actor Scariness", typeof(float)),
         }),
         new TagBlock("Damage Table", 8, 1, new MetaNode[] {
             new TagBlock("Damage Groups", 12, -1, new MetaNode[] {
                 new StringId("Name"),
                 new TagBlock("Armor Modifiers", 8, -1, new MetaNode[] {
                     new StringId("Name"),
                     new Value("Damage Multiplier", typeof(float)),
                 }),
             }),
         }),
         new Padding(8),
         new TagBlock("Sounds (Obsolete)", 8, 2, new MetaNode[] {
             new TagReference("Sound", "****"),
         }),
         new TagBlock("Camera", 20, 1, new MetaNode[] {
             new TagReference("Default_Unit_Camera_Track", "trak"),
             new Value("Default Change Pause", typeof(float)),
             new Value("1st Person Change Pause", typeof(float)),
             new Value("Following Camera Change Pause", typeof(float)),
         }),
         new TagBlock("Player Control", 128, 1, new MetaNode[] {
             new Value("Magnetism Friction", typeof(float)),
             new Value("Magnetism Adhesion", typeof(float)),
             new Value("Inconsequential Target Scale", typeof(float)),
             new Padding(12),
             new Value("Crosshair Location X", typeof(float)),
             new Value("Crosshair Location Y", typeof(float)),
             new Value("Seconds To Start", typeof(float)),
             new Value("Seconds To Full Speed", typeof(float)),
             new Value("Decay Rate", typeof(float)),
             new Value("Full Speed Multiplier", typeof(float)),
             new Value("Pegged Magnitude", typeof(float)),
             new Value("Pegged Angular Threshold", typeof(float)),
             new Padding(8),
             new Value("Look Default Pitch Rate", typeof(float)),
             new Value("Look Default Yaw Rate", typeof(float)),
             new Value("Look Peg Threshold", typeof(float)),
             new Value("Look Yaw Acceleration Time", typeof(float)),
             new Value("Look Yaw Acceleration Scale", typeof(float)),
             new Value("Look Pitch Acceleration Time", typeof(float)),
             new Value("Look Pitch Acceleration Scale", typeof(float)),
             new Value("Look Auto-leveling Scale", typeof(float)),
             new Padding(12),
             new Value("Min Weapon Swap Ticks", typeof(short)),
             new Value("Min Autoleveling Ticks", typeof(short)),
             new Value("Gravity Scale", typeof(float)),
             new TagBlock("Look Function", 4, 16, new MetaNode[] {
                 new Value("Scale", typeof(float)),
             }),
             new Value("Minimmum Action Hold Time", typeof(float)),
         }),
         new TagBlock("Difficulty", 644, 1, new MetaNode[] {
             new Value("Easy Enemy Damage", typeof(float)),
             new Value("Normal Enemy Damage", typeof(float)),
             new Value("Heroic Enemy Damage", typeof(float)),
             new Value("Legendary Enemy Damage", typeof(float)),
             new Value("Easy Enemy Vitality", typeof(float)),
             new Value("Normal Enemy Vitality", typeof(float)),
             new Value("Heroic Enemy Vitality", typeof(float)),
             new Value("Legendary Enemy Vitality", typeof(float)),
             new Value("Easy Enemy Sheild", typeof(float)),
             new Value("Normal Enemy Sheild", typeof(float)),
             new Value("Heroic Enemy Sheild", typeof(float)),
             new Value("Legendary Enemy Sheild", typeof(float)),
             new Value("Easy Enemy Recharge", typeof(float)),
             new Value("Normal Enemy Recharge", typeof(float)),
             new Value("Heroic Enemy Recharge", typeof(float)),
             new Value("Legendary Enemy Recharge", typeof(float)),
             new Value("Easy Friend Damage", typeof(float)),
             new Value("Normal Friend Damage", typeof(float)),
             new Value("Heroic Friend Damage", typeof(float)),
             new Value("Legendary Friend Damage", typeof(float)),
             new Value("Easy Friend Vitality", typeof(float)),
             new Value("Normal Friend Vitality", typeof(float)),
             new Value("Heroic Friend Vitality", typeof(float)),
             new Value("Legendary Friend Vitality", typeof(float)),
             new Value("Easy Friend Sheild", typeof(float)),
             new Value("Normal Friend Sheild", typeof(float)),
             new Value("Heroic Friend Sheild", typeof(float)),
             new Value("Legendary Friend Sheild", typeof(float)),
             new Value("Easy Friend Recharge", typeof(float)),
             new Value("Normal Friend Recharge", typeof(float)),
             new Value("Heroic Friend Recharge", typeof(float)),
             new Value("Legendary Friend Recharge", typeof(float)),
             new Value("Easy Infection Forms", typeof(float)),
             new Value("Normal Infection Forms", typeof(float)),
             new Value("Heroic Infection Forms", typeof(float)),
             new Value("Legendary Infection Forms", typeof(float)),
             new Padding(16),
             new Value("Easy Rate Of Fire", typeof(float)),
             new Value("Normal Rate Of Fire", typeof(float)),
             new Value("Heroic Rate Of Fire", typeof(float)),
             new Value("Legendary Rate Of Fire", typeof(float)),
             new Value("Easy Projectile Error", typeof(float)),
             new Value("Normal Projectile Error", typeof(float)),
             new Value("Heroic Projectile Error", typeof(float)),
             new Value("Legendary Projectile Error", typeof(float)),
             new Value("Easy Burst Error", typeof(float)),
             new Value("Normal Burst Error", typeof(float)),
             new Value("Heroic Burst Error", typeof(float)),
             new Value("Legendary Burst Error", typeof(float)),
             new Value("Easy New Target Delay", typeof(float)),
             new Value("Normal New Target Delay", typeof(float)),
             new Value("Heroic New Target Delay", typeof(float)),
             new Value("Legendary New Target Delay", typeof(float)),
             new Value("Easy Burst Separation", typeof(float)),
             new Value("Normal Burst Separation", typeof(float)),
             new Value("Heroic Burst Separation", typeof(float)),
             new Value("Legendary Burst Separation", typeof(float)),
             new Value("Easy Target Tracking", typeof(float)),
             new Value("Normal Target Tracking", typeof(float)),
             new Value("Heroic Target Tracking", typeof(float)),
             new Value("Legendary Target Tracking", typeof(float)),
             new Value("Easy Target Leading", typeof(float)),
             new Value("Normal Target Leading", typeof(float)),
             new Value("Heroic Target Leading", typeof(float)),
             new Value("Legendary Target Leading", typeof(float)),
             new Value("Easy Overcharge Chance", typeof(float)),
             new Value("Normal Overcharge Chance", typeof(float)),
             new Value("Heroic Overcharge Chance", typeof(float)),
             new Value("Legendary Overcharge Chance", typeof(float)),
             new Value("Easy Special Fire Delay", typeof(float)),
             new Value("Normal Special Fire Delay", typeof(float)),
             new Value("Heroic Special Fire Delay", typeof(float)),
             new Value("Legendary Special Fire Delay", typeof(float)),
             new Value("Easy Guidance Vs Player", typeof(float)),
             new Value("Normal Guidance Vs Player", typeof(float)),
             new Value("Heroic Guidance Vs Player", typeof(float)),
             new Value("Legendary Guidance Vs Player", typeof(float)),
             new Value("Easy Melee Delay Base", typeof(float)),
             new Value("Normal Melee Delay Base", typeof(float)),
             new Value("Heroic Melee Delay Base", typeof(float)),
             new Value("Legendary Melee Delay Base", typeof(float)),
             new Value("Easy Melee Delay Scale", typeof(float)),
             new Value("Normal Melee Delay Scale", typeof(float)),
             new Value("Heroic Melee Delay Scale", typeof(float)),
             new Value("Legendary Melee Delay Scale", typeof(float)),
             new Padding(16),
             new Value("Easy Grenade Chance Scale", typeof(float)),
             new Value("Normal Grenade Chance Scale", typeof(float)),
             new Value("Heroic Grenade Chance Scale", typeof(float)),
             new Value("Legendary Grenade Chance Scale", typeof(float)),
             new Value("Easy Grenade Timer Scale", typeof(float)),
             new Value("Normal Grenade Timer Scale", typeof(float)),
             new Value("Heroic Grenade Timer Scale", typeof(float)),
             new Value("Legendary Grenade Timer Scale", typeof(float)),
             new Padding(48),
             new Value("Easy Major Upgrade (Normal)", typeof(float)),
             new Value("Normal Major Upgrade (Normal)", typeof(float)),
             new Value("Heroic Major Upgrade (Normal)", typeof(float)),
             new Value("Legendary Major Upgrade (Normal)", typeof(float)),
             new Value("Easy Major Upgrade (Few)", typeof(float)),
             new Value("Normal Major Upgrade (Few)", typeof(float)),
             new Value("Heroic Major Upgrade (Few)", typeof(float)),
             new Value("Legendary Major Upgrade (Few)", typeof(float)),
             new Value("Easy Major Upgrade (Many)", typeof(float)),
             new Value("Normal Major Upgrade (Many)", typeof(float)),
             new Value("Heroic Major Upgrade (Many)", typeof(float)),
             new Value("Legendary Major Upgrade (Many)", typeof(float)),
             new Value("Easy Player Vehicle Ram Chance", typeof(float)),
             new Value("Normal Player Vehicle Ram Chance", typeof(float)),
             new Value("Heroic Player Vehicle Ram Chance", typeof(float)),
             new Value("Legendary Player Vehicle Ram Chance", typeof(float)),
             new Padding(132),
         }),
         new TagBlock("Grenades", 44, 2, new MetaNode[] {
             new Value("Max Count", typeof(short)),
             new Padding(2),
             new TagReference("Throwing_Effect", "effe"),
             new Padding(16),
             new TagReference("Equipment", "eqip"),
             new TagReference("Projectile", "proj"),
         }),
         new TagBlock("Rasterizer Data", 264, 1, new MetaNode[] {
             new TagReference("Distance_Attenuation", "bitm"),
             new TagReference("Vector_Normalization", "bitm"),
             new TagReference("Gradients", "bitm"),
             new TagReference("Loading_Screen", "bitm"),
             new TagReference("Loading_Screen_Sweep", "bitm"),
             new TagReference("Loading_Screen_Spinner", "bitm"),
             new TagReference("Glow", "bitm"),
             new TagReference("Loading_Screen_Logos", "bitm"),
             new TagReference("Loading_Screen_Tickers", "bitm"),
             new Padding(16),
             new TagBlock("Global Vertex Shaders", 8, 32, new MetaNode[] {
                 new TagReference("Vertex_Shader", "vrtx"),
             }),
             new TagReference("Default_2D", "bitm"),
             new TagReference("Default_3D", "bitm"),
             new TagReference("Default_Cube_Map", "bitm"),
             new Padding(48),
             new Padding(36),
             new TagReference("Global_Shader", "shad"),
             new Flags("Flags", new string[] { "Tint_Edge_Density" }, 32),
             new Value("Active Camo Refraction Amount", typeof(float)),
             new Value("Active Camo Distance Falloff", typeof(float)),
             new Value("Active Camo Tint Color R", typeof(float)),
             new Value("Active Camo Tint Color G", typeof(float)),
             new Value("Active Camo Tint Color B", typeof(float)),
             new Value("Active Camo Hyper Stealth Refraction", typeof(float)),
             new Value("Active Camo Hyper Stealth Distance Falloff", typeof(float)),
             new Value("Active Camo Hyper Stealth Tint  R", typeof(float)),
             new Value("Active Camo Hyper Stealth Tint G", typeof(float)),
             new Value("Active Camo Hyper Stealth Tint B", typeof(float)),
             new TagReference("unused", "bitm"),
         }),
         new TagBlock("Interface Tag Refernces", 152, 1, new MetaNode[] {
             new TagReference("Font_System", "bitm"),
             new TagReference("Font_Terminal", "bitm"),
             new TagReference("Screen_Color_Table", "colo"),
             new TagReference("Hud_Color_Table", "colo"),
             new TagReference("Editor_Color_Table", "colo"),
             new TagReference("Dialog_Color_Table", "colo"),
             new TagReference("Hud_Globals", "hudg"),
             new TagReference("Motion_Sensor_Sweep_Bitmap", "bitm"),
             new TagReference("Motion_Sensor_Sweep_Bitmap_Mask", "bitm"),
             new TagReference("Multiplayer_Hud_Bitmap", "bitm"),
             new Padding(8),
             new TagReference("Hud_Digits_Definition", "hud#"),
             new TagReference("Motion_Sensor_Blip_Bitmap", "bitm"),
             new TagReference("Interface_Goo_Map_1", "bitm"),
             new TagReference("Interface_Goo_Map_2", "bitm"),
             new TagReference("Interface_Goo_Map_3", "bitm"),
             new TagReference("Mainmenu_UI_Globals", "wgtz"),
             new TagReference("Singleplayer_UI_Globals", "wgtz"),
             new TagReference("Multiplayer_UI_Globals", "wgtz"),
         }),
         new TagBlock("Weapon List (To Do With Hard Coded Enum)", 152, 20, new MetaNode[] {
             new TagReference("Weapon", "item"),
             new Padding(144),
         }),
         new TagBlock("Cheat Powerups", 152, 20, new MetaNode[] {
             new TagReference("Powerup", "eqip"),
             new Padding(144),
         }),
         new TagBlock("Multiplayer Information (depricated)", 152, 1, new MetaNode[] {
             new TagReference("Flag", "item"),
             new TagReference("Unit", "unit"),
             new Padding(8),
             new TagReference("Hill_Shader", "shad"),
             new TagReference("Flag_Shader", "shad"),
             new TagReference("Ball", "item"),
             new Padding(104),
         }),
         new TagBlock("Player Information", 284, 1, new MetaNode[] {
             new TagReference("unused", "unit"),
             new Padding(28),
             new Value("Walking Speed", typeof(float)),
             new Padding(4),
             new Value("Forward Run Speed", typeof(float)),
             new Value("Backward Run Speed", typeof(float)),
             new Value("Sideways Run Speed", typeof(float)),
             new Value("Run Acceleration", typeof(float)),
             new Value("Forward Crouch Speed", typeof(float)),
             new Value("Backward Crouch Speed", typeof(float)),
             new Value("Sideways Crouch Speed", typeof(float)),
             new Value("Crouch Acceleration", typeof(float)),
             new Value("Airborn Acceleration", typeof(float)),
             new Padding(16),
             new Value("Grenade Origin X", typeof(float)),
             new Value("Grenade Origin Y", typeof(float)),
             new Value("Grenade Origin Z", typeof(float)),
             new Padding(12),
             new Value("Stun Penalty Movement", typeof(float)),
             new Value("Stun Penalty Turning", typeof(float)),
             new Value("Stun Penalty Jumping", typeof(float)),
             new Value("Min Stun Time", typeof(float)),
             new Value("Max Stun Time", typeof(float)),
             new Padding(8),
             new Value("Fp Idle Time", typeof(float)),
             new Value("...To", typeof(float)),
             new Value("Fp Skip Fraction", typeof(float)),
             new Padding(16),
             new TagReference("Coop_Respawn_Effect", "effe"),
             new Value("Binoculars Zoom Count", typeof(float)),
             new Value("Binoculars Zoom Range", typeof(float)),
             new Value("...To", typeof(float)),
             new TagReference("Binoculars_Zoom_In_Sound", "snd!"),
             new TagReference("Binoculars_Zoom_Out_Sound", "snd!"),
             new Padding(16),
             new TagReference("Active_Camo_On", "snd!"),
             new TagReference("Active_Camo_Off", "snd!"),
             new TagReference("Active_Camo_Error", "snd!"),
             new TagReference("Active_Camo_Ready", "snd!"),
             new TagReference("Flashlight_On", "snd!"),
             new TagReference("Flashlight_Off", "snd!"),
             new TagReference("Ice_Cream", "snd!"),
         }),
         new TagBlock("Player Representation", 188, 4, new MetaNode[] {
             new TagReference("1st_Person_Hands", "mode"),
             new TagReference("1st_Person_Body", "mode"),
             new Padding(160),
             new TagReference("3rd_Person_Unit", "unit"),
             new StringId("3rd Person Unit Variant"),
         }),
         new TagBlock("Falling Damage", 104, 1, new MetaNode[] {
             new Padding(8),
             new Value("Harmful Falling Distance", typeof(float)),
             new Value("...To", typeof(float)),
             new TagReference("Falling_Damage", "jpt!"),
             new Padding(8),
             new Value("Maximum Falling Distance", typeof(float)),
             new TagReference("Distance_Damage", "jpt!"),
             new TagReference("Vehicle_Environment_Collision_Damage", "jpt!"),
             new TagReference("Vehicle_Killed_Unit_Damage_Effect", "jpt!"),
             new TagReference("Vehicle_Collision_Damage", "jpt!"),
             new TagReference("Flaming_Death_Damage", "jpt!"),
             new Padding(28),
         }),
         new TagBlock("Old Materials", 36, 33, new MetaNode[] {
             new StringId("Material Name"),
             new StringId("General Material Name"),
             new Value("Ground Friction Scale", typeof(float)),
             new Value("Ground Friction Normal K0 Scale", typeof(float)),
             new Value("Ground Friction Normal K1 Scale", typeof(float)),
             new Value("Ground Depth Scale", typeof(float)),
             new Value("Ground Damp Fraction Scale", typeof(float)),
             new TagReference("Melee_Hit_Sound", "snd!"),
         }),
         new TagBlock("Materials", 180, 256, new MetaNode[] {
             new StringId("Name"),
             new StringId("Parent Name"),
             new Flags("Flags", new string[] {  }, 32),
             new HaloPlugins.Objects.Data.Enum("Old Material Type", new string[] { "Dirt", "Sand", "Stone", "Snow", "Wood", "Metal_(hollow)", "Metal_(thin)", "Metal_(thick)", "Rubber", "Glass", "Force_Field", "Grunt", "Hunter_Armor", "Hunter_Skin", "Elite", "Jackal", "Jackal_Energy_Shield", "Engineer_Skin", "Engineer_Force_Field", "Flood_Combat_Form", "Flood_Carrier_Form", "Cyborg_Armor", "Cyborg_Energy_Shield", "Human_Armor", "Human_Skin", "Sentinel", "Monitor", "Plastic", "Water", "Leaves", "Elite_Energy_Shield", "Ice", "Hunter_Shield" }, 32),
             new StringId("General Armor"),
             new StringId("Specific Armor"),
             new Padding(4),
             new Value("Friction", typeof(float)),
             new Value("Restitution", typeof(float)),
             new Value("Density", typeof(float)),
             new TagReference("Old_Material_Physics", "mpdt"),
             new TagReference("Breakable_Surface", "bsdt"),
             new TagReference("Sound_Sweetener_(small)", "snd!"),
             new TagReference("Sound_Sweetener_(medium)", "snd!"),
             new TagReference("Sound_Sweetener_(large)", "snd!"),
             new TagReference("Sound_Sweetener_Rolling", "snd!"),
             new TagReference("Sound_Sweetener_Grinding", "snd!"),
             new TagReference("Sound_Sweetener_(melee)", "snd!"),
             new Padding(8),
             new TagReference("Effect_Sweetener_(small)", "effe"),
             new TagReference("Effect_Sweetener_(medium)", "effe"),
             new TagReference("Effect_Sweetener_(large)", "effe"),
             new TagReference("Effect_Sweetener_Rolling", "effe"),
             new TagReference("Effect_Sweetener_Grinding", "effe"),
             new TagReference("Effect_Sweetener_(melee)", "effe"),
             new Padding(8),
             new Flags("Sweetener Inheritance Flags", new string[] { "Sound_Small", "Sound_Medium", "Sound_Large", "Sound_Rolling", "Sound_Grinding", "Sound_Melee", "", "Effect_Small", "Effect_Medium", "Effect_Large", "Effect_Rolling", "Effect_Grinding", "Effect_Melee" }, 32),
             new TagReference("Material_Effects", "foot"),
         }),
         new TagBlock("Multiplayer UI (obsolete)", 32, 1, new MetaNode[] {
             new Padding(32),
         }),
         new TagBlock("Profile Colors", 12, 32, new MetaNode[] {
             new Value("R", typeof(float)),
             new Value("G", typeof(float)),
             new Value("B", typeof(float)),
         }),
         new TagReference("Multiplayer_Globals", "mulg"),
         new TagBlock("Runtime Level Data", 8, 1, new MetaNode[] {
             new TagBlock("Campaign Levels", 264, 20, new MetaNode[] {
                 new Value("Campaign ID", typeof(int)),
                 new Value("Map ID", typeof(int)),
                 new LongString("Scenario Path", StringType.Asci),
             }),
         }),
         new TagBlock("UI Level Data", 24, 1, new MetaNode[] {
             new TagBlock("Campaigns", 2884, 4, new MetaNode[] {
                 new Value("Campaign ID", typeof(int)),
                 new Padding(2880),
             }),
             new TagBlock("Campaign Levels", 2896, 20, new MetaNode[] {
                 new Value("Campaign ID", typeof(int)),
                 new Value("Map ID", typeof(int)),
                 new TagReference("Preview_Image", "bitm"),
                 new ShortString("English Name", StringType.Unicode),
                 new ShortString("Japanese Name", StringType.Unicode),
                 new ShortString("German Name", StringType.Unicode),
                 new ShortString("French Name", StringType.Unicode),
                 new ShortString("Spanish Name", StringType.Unicode),
                 new ShortString("Italian Name", StringType.Unicode),
                 new ShortString("Korean Name", StringType.Unicode),
                 new ShortString("Chinese Name", StringType.Unicode),
                 new ShortString("Portuguese Name", StringType.Unicode),
                 new LongString("English Description", StringType.Unicode),
                 new LongString("Japanese Description", StringType.Unicode),
                 new LongString("German Description", StringType.Unicode),
                 new LongString("French Description", StringType.Unicode),
                 new LongString("Spanish Description", StringType.Unicode),
                 new LongString("Italian Description", StringType.Unicode),
                 new LongString("Korean Description", StringType.Unicode),
                 new LongString("Chinese Description", StringType.Unicode),
                 new LongString("Portuguese Description", StringType.Unicode),
             }),
             new TagBlock("Multiplayer", 3172, 50, new MetaNode[] {
                 new Value("Map ID", typeof(int)),
                 new TagReference("Preview_Image", "bitm"),
                 new ShortString("English Name", StringType.Unicode),
                 new ShortString("Japanese Name", StringType.Unicode),
                 new ShortString("German Name", StringType.Unicode),
                 new ShortString("French Name", StringType.Unicode),
                 new ShortString("Spanish Name", StringType.Unicode),
                 new ShortString("Italian Name", StringType.Unicode),
                 new ShortString("Korean Name", StringType.Unicode),
                 new ShortString("Chinese Name", StringType.Unicode),
                 new ShortString("Portuguese Name", StringType.Unicode),
                 new LongString("English Description", StringType.Unicode),
                 new LongString("Japanese Description", StringType.Unicode),
                 new LongString("German Description", StringType.Unicode),
                 new LongString("French Description", StringType.Unicode),
                 new LongString("Spanish Description", StringType.Unicode),
                 new LongString("Italian Description", StringType.Unicode),
                 new LongString("Korean Description", StringType.Unicode),
                 new LongString("Chinese Description", StringType.Unicode),
                 new LongString("Portuguese Description", StringType.Unicode),
                 new LongString("Scenario Path", StringType.Asci),
                 new Value("Sort Order", typeof(int)),
                 new Flags("Flags", new string[] { "Unlockable" }, 16),
                 new Value("Max Teams None", typeof(byte)),
                 new Value("Max Teams CTF", typeof(byte)),
                 new Value("Max Teams Slayer", typeof(byte)),
                 new Value("Max Teams Oddball", typeof(byte)),
                 new Value("Max Teams KOTH", typeof(byte)),
                 new Value("Max Teams Race", typeof(byte)),
                 new Value("Max Teams Headhunter", typeof(byte)),
                 new Value("Max Teams Juggernaught", typeof(byte)),
                 new Value("Max Teams Territories", typeof(byte)),
                 new Value("Max Teams Assault", typeof(byte)),
                 new Value("Max Teams Stub 10", typeof(byte)),
                 new Value("Max Teams Stub 11", typeof(byte)),
                 new Value("Max Teams Stub 12", typeof(byte)),
                 new Value("Max Teams Stub 13", typeof(byte)),
                 new Value("Max Teams Stub 14", typeof(byte)),
                 new Value("Max Teams Stub 15", typeof(byte)),
                 new Padding(2),
             }),
         }),
         new TagReference("Default_Global_Lighting", "gldf"),
         new Padding(8),
         new Value("English String Count", typeof(int)),
         new Value("English String Table Size", typeof(int)),
         new Value("English String Index Offset", typeof(int)),
         new Value("English String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Japanese String Count", typeof(int)),
         new Value("Japanese String Table Size", typeof(int)),
         new Value("Japanese String Index Offset", typeof(int)),
         new Value("Japanese String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Dutch String Count", typeof(int)),
         new Value("Dutch String Table Size", typeof(int)),
         new Value("Dutch String Index Offset", typeof(int)),
         new Value("Dutch String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("French String Count", typeof(int)),
         new Value("French String Table Size", typeof(int)),
         new Value("French String Index Offset", typeof(int)),
         new Value("French String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Spanish String Count", typeof(int)),
         new Value("Spanish String Table Size", typeof(int)),
         new Value("Spanish String Index Offset", typeof(int)),
         new Value("Spanish String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Italian String Count", typeof(int)),
         new Value("Italian String Table Size", typeof(int)),
         new Value("Italian String Index Offset", typeof(int)),
         new Value("Italian String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Korean String Count", typeof(int)),
         new Value("Korean String Table Size", typeof(int)),
         new Value("Korean String Index Offset", typeof(int)),
         new Value("Korean String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Chinese String Count", typeof(int)),
         new Value("Chinese String Table Size", typeof(int)),
         new Value("Chinese String Index Offset", typeof(int)),
         new Value("Chinese String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new Value("Portuguese String Count", typeof(int)),
         new Value("Portuguese String Table Size", typeof(int)),
         new Value("Portuguese String Index Offset", typeof(int)),
         new Value("Portuguese String Table Offset", typeof(int)),
         new Value("Unknown", typeof(int)),
     });
 }
 public override void Run()
 {
     if (VERBOSE)
     {
         Console.WriteLine(Thread.CurrentThread.Name + ": launch search thread");
     }
     while (Environment.TickCount < stopTimeMS)
     {
         try
         {
             IndexSearcher s = outerInstance.GetCurrentSearcher();
             try
             {
                 // Verify 1) IW is correctly setting
                 // diagnostics, and 2) segment warming for
                 // merged segments is actually happening:
                 foreach (AtomicReaderContext sub in s.IndexReader.Leaves)
                 {
                     SegmentReader segReader = (SegmentReader)sub.Reader;
                     IDictionary <string, string> diagnostics = segReader.SegmentInfo.Info.Diagnostics;
                     assertNotNull(diagnostics);
                     string source;
                     diagnostics.TryGetValue("source", out source);
                     assertNotNull(source);
                     if (source.Equals("merge", StringComparison.Ordinal))
                     {
                         assertTrue("sub reader " + sub + " wasn't warmed: warmed=" + outerInstance.warmed + " diagnostics=" + diagnostics + " si=" + segReader.SegmentInfo,
                                    !outerInstance.m_assertMergedSegmentsWarmed || outerInstance.warmed.ContainsKey(segReader.core));
                     }
                 }
                 if (s.IndexReader.NumDocs > 0)
                 {
                     outerInstance.SmokeTestSearcher(s);
                     Fields fields = MultiFields.GetFields(s.IndexReader);
                     if (fields == null)
                     {
                         continue;
                     }
                     Terms terms = fields.GetTerms("body");
                     if (terms == null)
                     {
                         continue;
                     }
                     TermsEnum termsEnum     = terms.GetIterator(null);
                     int       seenTermCount = 0;
                     int       shift;
                     int       trigger;
                     if (totTermCount.Get() < 30)
                     {
                         shift   = 0;
                         trigger = 1;
                     }
                     else
                     {
                         trigger = totTermCount.Get() / 30;
                         shift   = Random.Next(trigger);
                     }
                     while (Environment.TickCount < stopTimeMS)
                     {
                         BytesRef term = termsEnum.Next();
                         if (term == null)
                         {
                             totTermCount.Set(seenTermCount);
                             break;
                         }
                         seenTermCount++;
                         // search 30 terms
                         if ((seenTermCount + shift) % trigger == 0)
                         {
                             //if (VERBOSE) {
                             //System.out.println(Thread.currentThread().getName() + " now search body:" + term.Utf8ToString());
                             //}
                             totHits.AddAndGet(outerInstance.RunQuery(s, new TermQuery(new Term("body", term))));
                         }
                     }
                     //if (VERBOSE) {
                     //System.out.println(Thread.currentThread().getName() + ": search done");
                     //}
                 }
             }
             finally
             {
                 outerInstance.ReleaseSearcher(s);
             }
         }
         catch (Exception t)
         {
             Console.WriteLine(Thread.CurrentThread.Name + ": hit exc");
             outerInstance.m_failed.Set(true);
             Console.WriteLine(t.ToString());
             throw new Exception(t.ToString(), t);
         }
     }
 }
Пример #45
0
 public override NestedField CreateNestedField(long id, string name, IFieldSettings?settings = null)
 {
     return(Fields.Boolean(id, name, this, settings));
 }
Пример #46
0
 public IField FindField(string name)
 {
     return(Fields.FindField(name));
 }
Пример #47
0
 public override RootField CreateRootField(long id, string name, Partitioning partitioning, IFieldSettings?settings = null)
 {
     return(Fields.Boolean(id, name, partitioning, this, settings));
 }
Пример #48
0
 public ClassDescripter CreateFiled(params FieldDescripter[] fields)
 {
     Fields.AddRange(fields);
     return(this);
 }
Пример #49
0
 public IEnumerable <IDataField> GetDataFields()
 {
     return(Fields.Select(x => (IDataField)x.Value));
 }
Пример #50
0
        /// <summary>
        /// Event arguments for CanRead events.
        /// </summary>
        /// <param name="ProvisioningClient">XMPP Provisioning Client used.</param>
        /// <param name="e">Message with request.</param>
        public CanReadEventArgs(ProvisioningClient ProvisioningClient, MessageEventArgs e)
            : base(ProvisioningClient, e)
        {
            this.provisioningClient = ProvisioningClient;
            this.fieldTypes         = (FieldType)0;

            foreach (XmlAttribute Attr in e.Content.Attributes)
            {
                switch (Attr.LocalName)
                {
                case "all":
                    if (CommonTypes.TryParse(Attr.Value, out bool b) && b)
                    {
                        this.fieldTypes |= FieldType.All;
                    }
                    break;

                case "m":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Momentary;
                    }
                    break;

                case "p":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Peak;
                    }
                    break;

                case "s":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Status;
                    }
                    break;

                case "c":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Computed;
                    }
                    break;

                case "i":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Identity;
                    }
                    break;

                case "h":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Historical;
                    }
                    break;
                }
            }

            List <string> Fields = null;

            foreach (XmlNode N in e.Content.ChildNodes)
            {
                if (N is XmlElement E && E.LocalName == "f")
                {
                    if (Fields is null)
                    {
                        Fields = new List <string>();
                    }

                    Fields.Add(XML.Attribute(E, "n"));
                }
            }

            if (!(Fields is null))
            {
                this.fields = Fields.ToArray();
            }
Пример #51
0
        public void SetFieldValue(string fieldName, IEnumerable <string> fieldValues, string language)
        {
            CFFormField field = Fields.Where(f => f.Name == fieldName).FirstOrDefault();

            field.SetValues(fieldValues, language);
        }
Пример #52
0
 private void InitializeMemberDescriptors()
 {
     MemberDescriptors = MemberDescriptor.GetMemberDescriptors(typeof(T));
     Debug.Assert(Fields.Count == 0);
     Fields.AddRange(MemberDescriptors);
 }
Пример #53
0
 public mode() : base("mode", "render_model", 132, new ModelDefinition())
 {
     Fields.AddRange(new MetaNode[] {
         new StringId("Model Name"),
         new Flags("Flags", new string[] { "Force_Third_Person", "Force_Carmack_Reverse", "Force_Node_Maps" }, 32),
         new Value("Unknown", typeof(int)),
         new Padding(8),
         new TagBlock("Compression Info", 56, 1, new MetaNode[] {
             new Value("X (min)", typeof(float)),
             new Value("X (max)", typeof(float)),
             new Value("Y (min)", typeof(float)),
             new Value("Y (max)", typeof(float)),
             new Value("Z (min)", typeof(float)),
             new Value("Z (max)", typeof(float)),
             new Value("U (min)", typeof(float)),
             new Value("U (max)", typeof(float)),
             new Value("V (min)", typeof(float)),
             new Value("V (max)", typeof(float)),
             new Value("Secondary U (Min)", typeof(float)),
             new Value("Secondary U (max)", typeof(float)),
             new Value("Secondary V (min)", typeof(float)),
             new Value("Secondary V (max)", typeof(float)),
         }),
         new TagBlock("Regions", 16, 16, new MetaNode[] {
             new StringId("Part Name"),
             new Value("Node Map Offset", typeof(short)),
             new Value("Node Map Size", typeof(short)),
             new TagBlock("Permutation", 16, 32, new MetaNode[] {
                 new StringId("Permutation Name"),
                 new Value("Lowest Piece (Index)", typeof(short)),
                 new Value("Low Piece (Index)", typeof(short)),
                 new Value("Medium-Low Piece (Index)", typeof(short)),
                 new Value("Medium-High Piece (Index)", typeof(short)),
                 new Value("High Piece (Index)", typeof(short)),
                 new Value("Highest Piece (Index)", typeof(short)),
             }),
         }),
         new TagBlock("Sections", 92, 255, new MetaNode[] {
             new HaloPlugins.Objects.Data.Enum("Global Geometry Classification", new string[] { "Rigid", "Rigid_Boned", "Skinned" }, 32),
             new Value("Vertex Count", typeof(short)),
             new Value("Triangle Count", typeof(short)),
             new Value("Part Count", typeof(short)),
             new Value("Shadow Casting Triangle Cour", typeof(short)),
             new Value("Shadow Casting Part Count", typeof(short)),
             new Value("Opaque Point Count", typeof(short)),
             new Value("Opaque Vertex Count", typeof(short)),
             new Value("Opaque Part Count", typeof(short)),
             new Value("Opaque Max Nodes/Verte", typeof(byte)),
             new Value("Transparent Max Nodes/Verte", typeof(byte)),
             new Value("Shadow Casting Rigid Triangle Count", typeof(short)),
             new HaloPlugins.Objects.Data.Enum("Geometry Classification", new string[] { "Rigid", "Rigid_Boned", "Skinned" }, 16),
             new Flags("Unknown", new string[] { "Compressed_Position", "Compressed_Texcoord", "Compressed_Secondary_Texcoord" }, 32),
             new Value("Hardware Node Count", typeof(byte)),
             new Value("Node Map Size", typeof(byte)),
             new Value("Software Plane Count", typeof(byte)),
             new Padding(3),
             new Value("Unknown", typeof(short)),
             new Padding(2),
             new Value("Total SubPart Count", typeof(int)),
             new Flags("Section Lighting FLags", new string[] { "Has_Im_Texcoords", "Has_Im_inc._rad.", "Has_Im_Colors", "Has_Im_prt" }, 8),
             new Value("Rigid Node Index", typeof(byte)),
             new Value("", typeof(byte)),
             new Flags("Flags", new string[] { "Geometry_Postprocessed" }, 8),
             // Not used in cache.
             new TagBlock("Section Data", 88, 1, new MetaNode[] {
                 new Padding(88),
             }),
             new Value("Raw Offset", typeof(int)),
             new Value("Raw Size", typeof(int)),
             new Value("Raw Header Size", typeof(int)),
             new Value("Raw Data Size", typeof(int)),
             new TagBlock("Resource", 16, -1, new MetaNode[] {
                 new Value("Unknown", typeof(int)),
                 new Value("Primary Locator", typeof(short)),
                 new Value("Secondary Locator", typeof(short)),
                 new Value("Size", typeof(int)),
                 new Value("Offset", typeof(int)),
             }),
             new TagIndex("Owner_Tag_Section_Offset", "mode"),
             new Value("Unknown", typeof(int)),
             new Value("Unused", typeof(int)),
         }),
         new TagBlock("Invalid Section Pair Bits", 4, 1013, new MetaNode[] {
             new Value("Bits", typeof(int)),
         }),
         new TagBlock("Section Groups", 12, 6, new MetaNode[] {
             new Flags("Detail Levels", new string[] { "L1_(super_Low)", "L2_(low", "L3_(medium)", "L4_(high)", "L5_(super_high)", "L6_(hollywood)" }, 32),
             new TagBlock("Compount Nodes", 16, 255, new MetaNode[] {
                 new Value("Node Index", typeof(byte)),
                 new Value("Node Index", typeof(byte)),
                 new Value("Node Index", typeof(byte)),
                 new Value("Node Index", typeof(byte)),
                 new Value("Node Weight", typeof(float)),
                 new Value("Node Weight", typeof(float)),
                 new Value("Node Weight", typeof(float)),
             }),
         }),
         new Value("L1 Section Group Index", typeof(short)),
         new Value("L2 Section Group Index", typeof(short)),
         new Value("L3 Section Group Index", typeof(short)),
         new Value("L4 Section Group Index", typeof(short)),
         new Value("L5 Section Group Index", typeof(short)),
         new Value("L6 Section Group Index", typeof(short)),
         new TagBlock("Nodes", 96, 255, new MetaNode[] {
             new StringId("Name"),
             new Value("Parent Node Index", typeof(short)),
             new Value("First Child Node Index", typeof(short)),
             new Value("Next Sibling Node Index", typeof(short)),
             new Value("Import Node Index", typeof(short)),
             new Value("Default Translation X", typeof(float)),
             new Value("Default Translation Y", typeof(float)),
             new Value("Default Translation Z", typeof(float)),
             new Value("Default Rotation i", typeof(float)),
             new Value("Default Rotation j", typeof(float)),
             new Value("Default Rotation k", typeof(float)),
             new Value("Default Rotation w", typeof(float)),
             new Value("Inverse Foward i", typeof(float)),
             new Value("Inverse Foward j", typeof(float)),
             new Value("Inverse Foward k", typeof(float)),
             new Value("Inverse Left i", typeof(float)),
             new Value("Inverse Left j", typeof(float)),
             new Value("Inverse Left k", typeof(float)),
             new Value("Inverse Up i", typeof(float)),
             new Value("Inverse Up j", typeof(float)),
             new Value("Inverse Up k", typeof(float)),
             new Value("Inverse Position i", typeof(float)),
             new Value("Inverse Position j", typeof(float)),
             new Value("Inverse Position k", typeof(float)),
             new Value("Inverse Scale", typeof(float)),
             new Value("Distance from Parent", typeof(float)),
         }),
         new Padding(8),
         new TagBlock("Marker Groups", 12, 4096, new MetaNode[] {
             new StringId("Name"),
             new TagBlock("Markers", 36, 256, new MetaNode[] {
                 new Value("Region index", typeof(byte)),
                 new Value("Permutation Index", typeof(byte)),
                 new Value("Node Index", typeof(short)),
                 new Value("Translation X", typeof(float)),
                 new Value("Translation Y", typeof(float)),
                 new Value("Tranlsation Z", typeof(float)),
                 new Value("Rotation i", typeof(float)),
                 new Value("Rotation j", typeof(float)),
                 new Value("Rotation k", typeof(float)),
                 new Value("Rotation w", typeof(float)),
                 new Value("Scale", typeof(float)),
             }),
         }),
         new TagBlock("Materials", 32, 1024, new MetaNode[] {
             new TagReference("Old_Shader", "shad"),
             new TagReference("Shader", "shad"),
             new TagBlock("Propeties", 8, 16, new MetaNode[] {
                 new Value("Int Value", typeof(int)),
                 new Value("Real Value", typeof(float)),
             }),
             new Value("Brakable Surface Index", typeof(int)),
             new Padding(4),
         }),
         new Padding(8),
         new Value("Unknown", typeof(float)),
         new TagBlock("Prt Info", 88, 1, new MetaNode[] {
             new Value("SH Order", typeof(short)),
             new Value("Clustor Number", typeof(short)),
             new Value("PCA Vectors Per Clustor", typeof(short)),
             new Value("Number of Rays", typeof(short)),
             new Value("Number of Bounces", typeof(short)),
             new Value("Mat Index for sbsfc Scattering", typeof(short)),
             new Value("Length Scale", typeof(float)),
             new Value("Number of LODs", typeof(int)),
             new TagBlock("Lod Info", 12, 6, new MetaNode[] {
                 new Value("Clustor Offset", typeof(int)),
                 new TagBlock("Section Info", 8, 255, new MetaNode[] {
                     new Value("Section Index", typeof(int)),
                     new Value("PCA Data Offset", typeof(int)),
                 }),
             }),
             new TagBlock("Clustor Basis", 4, 34560, new MetaNode[] {
                 new Value("Basis Data", typeof(int)),
             }),
             new Padding(16),
             new Value("Raw Offset", typeof(int)),
             new Value("Raw Size", typeof(int)),
             new Value("Raw Header Size", typeof(int)),
             new Value("Raw Data Size", typeof(int)),
             new TagBlock("Resource", 16, -1, new MetaNode[] {
                 new Value("Unknown", typeof(int)),
                 new Value("Unknown", typeof(int)),
                 new Value("Size", typeof(uint)),
                 new Value("Offset", typeof(uint)),
             }),
             new TagIndex("Owner_Section_Data_Offset", "mode"),
             new Value("Unknown", typeof(int)),
             new Value("Unused", typeof(int)),
         }),
         new TagBlock("Section Render Leaves", 8, 255, new MetaNode[] {
             new TagBlock("Node Render Leaves", 16, 64, new MetaNode[] {
                 new TagBlock("Collision Leaves", 8, 65536, new MetaNode[] {
                     new Value("Clustor", typeof(short)),
                     new Value("Surface Reference Count", typeof(short)),
                     new Value("First Surface Reference Index", typeof(int)),
                 }),
                 new TagBlock("Serface References", 8, 262144, new MetaNode[] {
                     new Value("Strip Index", typeof(short)),
                     new Value("Lightmap Triangle Index", typeof(short)),
                     new Value("BSP Node Index", typeof(int)),
                 }),
             }),
         }),
     });
 }
Пример #54
0
 public WalkerField.Distance GetDistanceInDirection(WalkerField.Direction direction)
 {
     return(Fields.Find(x => x.direction == direction).distance);
 }
Пример #55
0
        //public static void main( string[] args ) throws Exception {
        //  Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
        //  QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,  "f", analyzer );
        //  Query query = parser.parse( "a x:b" );
        //  FieldQuery fieldQuery = new FieldQuery( query, true, false );

        //  Directory dir = new RAMDirectory();
        //  IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer));
        //  Document doc = new Document();
        //  IndexableFieldType ft = new IndexableFieldType(TextField.TYPE_STORED);
        //  ft.setStoreTermVectors(true);
        //  ft.setStoreTermVectorOffsets(true);
        //  ft.setStoreTermVectorPositions(true);
        //  doc.add( new Field( "f", ft, "a a a b b c a b b c d e f" ) );
        //  doc.add( new Field( "f", ft, "b a b a f" ) );
        //  writer.addDocument( doc );
        //  writer.close();

        //  IndexReader reader = IndexReader.open(dir1);
        //  new FieldTermStack( reader, 0, "f", fieldQuery );
        //  reader.close();
        //}

        /// <summary>
        /// a constructor.
        /// </summary>
        /// <param name="reader"><see cref="IndexReader"/> of the index</param>
        /// <param name="docId">document id to be highlighted</param>
        /// <param name="fieldName">field of the document to be highlighted</param>
        /// <param name="fieldQuery"><see cref="FieldQuery"/> object</param>
        /// <exception cref="System.IO.IOException">If there is a low-level I/O error</exception>
        public FieldTermStack(IndexReader reader, int docId, string fieldName, FieldQuery fieldQuery)
        {
            this.fieldName = fieldName;

            ISet <string> termSet = fieldQuery.GetTermSet(fieldName);

            // just return to make null snippet if un-matched fieldName specified when fieldMatch == true
            if (termSet == null)
            {
                return;
            }

            Fields vectors = reader.GetTermVectors(docId);

            if (vectors == null)
            {
                // null snippet
                return;
            }

            Terms vector = vectors.GetTerms(fieldName);

            if (vector == null)
            {
                // null snippet
                return;
            }

            CharsRef             spare     = new CharsRef();
            TermsEnum            termsEnum = vector.GetIterator(null);
            DocsAndPositionsEnum dpEnum    = null;
            BytesRef             text;

            int numDocs = reader.MaxDoc;

            while ((text = termsEnum.Next()) != null)
            {
                UnicodeUtil.UTF8toUTF16(text, spare);
                string term = spare.ToString();
                if (!termSet.Contains(term))
                {
                    continue;
                }
                dpEnum = termsEnum.DocsAndPositions(null, dpEnum);
                if (dpEnum == null)
                {
                    // null snippet
                    return;
                }

                dpEnum.NextDoc();

                // For weight look here: http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/DefaultSimilarity.html
                float weight = (float)(Math.Log(numDocs / (double)(reader.DocFreq(new Term(fieldName, text)) + 1)) + 1.0);

                int freq = dpEnum.Freq;

                for (int i = 0; i < freq; i++)
                {
                    int pos = dpEnum.NextPosition();
                    if (dpEnum.StartOffset < 0)
                    {
                        return; // no offsets, null snippet
                    }
                    termList.Add(new TermInfo(term, dpEnum.StartOffset, dpEnum.EndOffset, pos, weight));
                }
            }

            // sort by position
            CollectionUtil.TimSort(termList);

            // now look for dups at the same position, linking them together
            int      currentPos = -1;
            TermInfo previous   = null;
            TermInfo first      = null;

            for (int i = 0; i < termList.Count;)
            {
                TermInfo current = termList[i];
                if (current.Position == currentPos)
                {
                    Debug.Assert(previous != null);
                    previous.SetNext(current);
                    previous = current;
                    //iterator.Remove();

                    // LUCENENET NOTE: Remove, but don't advance the i position (since removing will advance to the next item)
                    termList.RemoveAt(i);
                }
                else
                {
                    if (previous != null)
                    {
                        previous.SetNext(first);
                    }
                    previous   = first = current;
                    currentPos = current.Position;

                    // LUCENENET NOTE: Only increment the position if we don't do a delete.
                    i++;
                }
            }

            if (previous != null)
            {
                previous.SetNext(first);
            }
        }
Пример #56
0
        protected override void RefreshFields()
        {
            Type type = typeof(Camera);

            Fields.Add(new InspectorField(type, Instances, type.GetProperty("clearFlags"),
                                          new DescriptorAttribute("Clear Flag", "How the camera clears the background.", "http://docs.unity3d.com/ScriptReference/Camera-clearFlags.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("backgroundColor"), new InspectAttribute(new InspectAttribute.InspectDelegate(ShowBackground)),
                                          new DescriptorAttribute("Background Color", "The color with which the screen will be cleared.", "http://docs.unity3d.com/ScriptReference/Camera-backgroundColor.html")));

            Fields.Add(new InspectorField(type, Instances, type.GetProperty("cullingMask"), new FieldEditorAttribute("LayerMaskEditor"),
                                          new DescriptorAttribute("Culling Mask", "This is used to render parts of the scene selectively.", "http://docs.unity3d.com/ScriptReference/Camera-cullingMask.html")));

            Fields.Add(new InspectorField(type, Instances, type.GetProperty("orthographic"), new RestrictAttribute(new RestrictAttribute.RestrictDelegate(Projection)),
                                          new DescriptorAttribute("Orthographic", "Is the camera orthographic (true) or perspective (false)?", "http://docs.unity3d.com/ScriptReference/Camera-orthographic.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("orthographicSize"), new InspectAttribute(new InspectAttribute.InspectDelegate(IsOrthographic)),
                                          new DescriptorAttribute("Size", "Camera's half-size when in orthographic mode.", "http://docs.unity3d.com/ScriptReference/Camera-orthographicSize.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("fieldOfView"), new InspectAttribute(new InspectAttribute.InspectDelegate(IsFieldOfView)),
                                          new RangeValueAttribute(1, 179), new DescriptorAttribute("Field Of View", "The field of view of the camera in degrees.", "http://docs.unity3d.com/ScriptReference/Camera-fieldOfView.html")));

            Fields.Add(new InspectorField(type, Instances, type.GetProperty("nearClipPlane"),
                                          new DescriptorAttribute("Near Clip", "The near clipping plane distance.", "http://docs.unity3d.com/ScriptReference/Camera-nearClipPlane.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("farClipPlane"),
                                          new DescriptorAttribute("Far Clip", "The far clipping plane distance.", "http://docs.unity3d.com/ScriptReference/Camera-farClipPlane.html")));

            Fields.Add(new InspectorField(type, Instances, type.GetProperty("rect"),
                                          new DescriptorAttribute("Viewport Rect", "Where on the screen is the camera rendered in normalized coordinates.", "http://docs.unity3d.com/ScriptReference/Camera-rect.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("depth"),
                                          new DescriptorAttribute("Depth", "Camera's depth in the camera rendering order.", "http://docs.unity3d.com/ScriptReference/Camera-depth.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("renderingPath"), new HelpAttribute(new HelpAttribute.HelpDelegate(RenderingHelp)),
                                          new DescriptorAttribute("Rendering Path", "Rendering path.", "http://docs.unity3d.com/ScriptReference/Camera-renderingPath.html")));

            Fields.Add(new InspectorField(type, Instances, type.GetProperty("targetTexture"),
                                          new DescriptorAttribute("Render Texture", "Destination render texture (Unity Pro only).", "http://docs.unity3d.com/ScriptReference/Camera-targetTexture.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("useOcclusionCulling"),
                                          new DescriptorAttribute("Occlusion Culling", "Whether or not the Camera will use occlusion culling during rendering.", "http://docs.unity3d.com/ScriptReference/Camera-useOcclusionCulling.html")));
            Fields.Add(new InspectorField(type, Instances, type.GetProperty("hdr"), new ReadOnlyAttribute(new ReadOnlyAttribute.ReadOnlyDelegate(IsHDRAvailable)),
                                          new DescriptorAttribute("HDR", "High dynamic range rendering.", "http://docs.unity3d.com/ScriptReference/Camera-hdr.html")));

            Fields.Add(new InspectorField(null, new UnityEngine.Object[] { this }, new object[] { this }, this.GetType().GetMethod("TakeScreenshot"),
                                          new Attribute[] { new InspectAttribute(InspectorLevel.Advanced) }));
            Fields.Add(new InspectorField(null, new UnityEngine.Object[] { this }, new object[] { this }, null, this.GetType().GetField("screenshotResolution"), false,
                                          new Attribute[] { new InspectAttribute(InspectorLevel.Advanced) }));

            // Debug
            InspectorField debug = new InspectorField("Debug");

            Fields.Add(debug);

            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("aspect"), new InspectAttribute(InspectorLevel.Debug), new ReadOnlyAttribute(),
                                                new DescriptorAttribute("Aspect Ratio", "The aspect ratio (width divided by height).", "http://docs.unity3d.com/ScriptReference/Camera-aspect.html")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("clearStencilAfterLightingPass"), new InspectAttribute(InspectorLevel.Debug),
                                                new DescriptorAttribute("Clear Stencil After Lighting", "Clear Stencil After Lighting Pass.")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("depthTextureMode"), new InspectAttribute(InspectorLevel.Debug),
                                                new DescriptorAttribute("Depth Texture Mode", "How and if camera generates a depth texture.", "http://docs.unity3d.com/ScriptReference/Camera-depthTextureMode.html")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("eventMask"), new InspectAttribute(InspectorLevel.Debug),
                                                new DescriptorAttribute("Event Mask", "Mask to select which layers can trigger events on the camera.", "http://docs.unity3d.com/ScriptReference/Camera-eventMask.html")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("layerCullDistances"), new InspectAttribute(InspectorLevel.Debug), new CollectionAttribute(0),
                                                new DescriptorAttribute("Layer Cull Distances", "Per-layer culling distances.", "http://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("layerCullSpherical"), new InspectAttribute(InspectorLevel.Debug),
                                                new DescriptorAttribute("Layer Cull Spherical", "How to perform per-layer culling for a Camera.", "http://docs.unity3d.com/ScriptReference/Camera-layerCullSpherical.html")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("pixelRect"), new InspectAttribute(InspectorLevel.Debug),
                                                new DescriptorAttribute("Pixel Rect", "Where on the screen is the camera rendered in pixel coordinates.", "http://docs.unity3d.com/ScriptReference/Camera-pixelRect.html")));
            debug.Fields.Add(new InspectorField(type, Instances, type.GetProperty("transparencySortMode"), new InspectAttribute(InspectorLevel.Debug),
                                                new DescriptorAttribute("Transparency Sort Mode", "Transparent object sorting mode.", "http://docs.unity3d.com/ScriptReference/Camera-transparencySortMode.html")));

            if (camera == null)
            {
                camera         = EditorUtility.CreateGameObjectWithHideFlags("Preview Camera", HideFlags.HideAndDontSave, new Type[] { typeof(Camera) }).GetComponent <Camera>();
                camera.enabled = false;
            }

            rects = new Rect[Instances.Length];

            for (int i = 0; i < Instances.Length; i++)
            {
                rects[i] = new Rect(25, 25, 0, 0);
            }
        }
Пример #57
0
 private void Fields_GridUpdated(object sender, EventArgs e)
 {
     Fields.Rehash();
 }
Пример #58
0
 public void addFields(Fields field)
 {
     (fields = fields == null ? new List <Fields>() : fields).Add(field);
 }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Fields != null && Fields.Any())
     {
         writer.WritePropertyName("fields");
         writer.WriteStartArray();
         foreach (var item in Fields)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (ScoringProfiles != null && ScoringProfiles.Any())
     {
         writer.WritePropertyName("scoringProfiles");
         writer.WriteStartArray();
         foreach (var item in ScoringProfiles)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (DefaultScoringProfile != null)
     {
         writer.WritePropertyName("defaultScoringProfile");
         writer.WriteStringValue(DefaultScoringProfile);
     }
     if (CorsOptions != null)
     {
         writer.WritePropertyName("corsOptions");
         writer.WriteObjectValue(CorsOptions);
     }
     if (Suggesters != null && Suggesters.Any())
     {
         writer.WritePropertyName("suggesters");
         writer.WriteStartArray();
         foreach (var item in Suggesters)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (Analyzers != null && Analyzers.Any())
     {
         writer.WritePropertyName("analyzers");
         writer.WriteStartArray();
         foreach (var item in Analyzers)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (Tokenizers != null && Tokenizers.Any())
     {
         writer.WritePropertyName("tokenizers");
         writer.WriteStartArray();
         foreach (var item in Tokenizers)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (TokenFilters != null && TokenFilters.Any())
     {
         writer.WritePropertyName("tokenFilters");
         writer.WriteStartArray();
         foreach (var item in TokenFilters)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (CharFilters != null && CharFilters.Any())
     {
         writer.WritePropertyName("charFilters");
         writer.WriteStartArray();
         foreach (var item in CharFilters)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (EncryptionKey != null)
     {
         writer.WritePropertyName("encryptionKey");
         writer.WriteObjectValue(EncryptionKey);
     }
     if (ETag != null)
     {
         writer.WritePropertyName("@odata.etag");
         writer.WriteStringValue(ETag);
     }
     writer.WriteEndObject();
 }
Пример #60
0
        public override MixDatabaseData ParseModel(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            if (string.IsNullOrEmpty(Id))
            {
                Id = Guid.NewGuid().ToString();
                CreatedDateTime = DateTime.UtcNow;
                Priority        = Repository.Count(m => m.MixDatabaseName == MixDatabaseName && m.Specificulture == Specificulture, _context, _transaction).Data + 1;
            }
            Values = Values ?? MixDatabaseDataValues.UpdateViewModel
                     .Repository.GetModelListBy(a => a.DataId == Id && a.Specificulture == Specificulture, _context, _transaction).Data.OrderBy(a => a.Priority).ToList();
            Fields = MixDatabaseColumns.UpdateViewModel.Repository.GetModelListBy(f => f.MixDatabaseId == MixDatabaseId, _context, _transaction).Data;
            if (string.IsNullOrEmpty(MixDatabaseName))
            {
                MixDatabaseName = _context.MixDatabase.First(m => m.Id == MixDatabaseId)?.Name;
            }
            foreach (var field in Fields.OrderBy(f => f.Priority))
            {
                var val = Values.FirstOrDefault(v => v.MixDatabaseColumnId == field.Id);
                if (val == null)
                {
                    val = new MixDatabaseDataValues.UpdateViewModel(
                        new MixDatabaseDataValue()
                    {
                        MixDatabaseColumnId   = field.Id,
                        MixDatabaseColumnName = field.Name,
                    }
                        , _context, _transaction)
                    {
                        StringValue = field.DefaultValue,
                        Priority    = field.Priority,
                        Column      = field
                    };
                    Values.Add(val);
                }
                val.Priority        = field.Priority;
                val.MixDatabaseName = MixDatabaseName;
                if (Data[val.MixDatabaseColumnName] != null)
                {
                    if (val.Column.DataType == MixDataType.Reference)
                    {
                        var arr = Data[val.MixDatabaseColumnName].Value <JArray>();
                        foreach (JObject objData in arr)
                        {
                            string id = objData["id"]?.Value <string>();
                            // if have id => update data, else add new
                            if (!string.IsNullOrEmpty(id))
                            {
                                //var getData = Repository.GetSingleModel(m => m.Id == id && m.Specificulture == Specificulture, _context, _transaction);
                                //if (getData.IsSucceed)
                                //{
                                //    getData.Data.Data = objData;
                                //    RefData.Add(getData.Data);
                                //}
                            }
                            else
                            {
                                RefData.Add(new UpdateViewModel()
                                {
                                    Specificulture = Specificulture,
                                    MixDatabaseId  = field.ReferenceId.Value,
                                    Data           = objData
                                });
                            }
                        }
                    }
                    else
                    {
                        ParseModelValue(Data[val.MixDatabaseColumnName], val);
                    }
                }
                else
                {
                    Data.Add(ParseValue(val));
                }
            }

            return(base.ParseModel(_context, _transaction));;
        }