コード例 #1
0
        public List <SequenceInfo> GetSequence(string owner = null)
        {
            List <SequenceInfo> list = new List <SequenceInfo>();
            DataTable           dt   = null;

            if (String.IsNullOrEmpty(owner))
            {
                dt = this.GetDataTable("SELECT * FROM user_sequences");
            }
            else
            {
                dt = this.GetDataTable("SELECT sequence_owner,sequence_name,MIN_VALUE,max_value,INCREMENT_BY,cycle_flag,ORDER_FLAG,cache_size,last_number FROM all_sequences   t where sequence_owner='" + owner + "'");
            }

            foreach (DataRow dr in dt.Rows)
            {
                SequenceInfo info = new SequenceInfo();
                info.Owner     = owner;
                info.Cache     = Convert.ToInt32(dr["cache_size"]);
                info.Cycle     = (dr["cycle_flag"].ToString() == "Y" ? true : false);
                info.Increment = Convert.ToInt32(dr["INCREMENT_BY"]);
                info.MaxValue  = Convert.ToDecimal(dr["max_value"]);
                info.MinValue  = Convert.ToDecimal(dr["MIN_VALUE"]);
                info.Name      = dr["sequence_name"].ToString();
                info.Start     = Convert.ToDecimal(dr["last_number"]);

                list.Add(info);
            }

            return(list);
        }
コード例 #2
0
ファイル: SequenceUtils.cs プロジェクト: saneki/mm-rando
        public static void ReadSequenceInfo()
        {
            RomData.SequenceList    = new List <SequenceInfo>();
            RomData.TargetSequences = new List <SequenceInfo>();

            string[] lines = Properties.Resources.SEQS
                             .Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);

            int i = 0;

            while (i < lines.Length)
            {
                var sourceName       = lines[i];
                var sourceType       = Array.ConvertAll(lines[i + 1].Split(','), int.Parse).ToList();
                var sourceInstrument = Convert.ToInt32(lines[i + 2], 16);

                var targetName       = lines[i];
                var targetType       = Array.ConvertAll(lines[i + 1].Split(','), int.Parse).ToList();
                var targetInstrument = Convert.ToInt32(lines[i + 2], 16);

                SequenceInfo sourceSequence = new SequenceInfo
                {
                    Name       = sourceName,
                    Type       = sourceType,
                    Instrument = sourceInstrument
                };

                SequenceInfo targetSequence = new SequenceInfo
                {
                    Name       = targetName,
                    Type       = targetType,
                    Instrument = targetInstrument
                };

                if (sourceSequence.Name.StartsWith("mm-"))
                {
                    targetSequence.Replaces = Convert.ToInt32(lines[i + 3], 16);
                    sourceSequence.MM_seq   = Convert.ToInt32(lines[i + 3], 16);
                    RomData.TargetSequences.Add(targetSequence);
                    i += 4;
                }
                else
                {
                    if (sourceSequence.Name == "mmr-f-sot")
                    {
                        sourceSequence.Replaces = 0x33;
                    }
                    ;

                    i += 3;
                };

                if (sourceSequence.MM_seq != 0x18)
                {
                    RomData.SequenceList.Add(sourceSequence);
                }
                ;
            }
            ;
        }
コード例 #3
0
        public CachingSequence <TValue> GetSequence(SequenceInfo sequenceInfo, Session session)
        {
            var node   = session.StorageNode;
            var result = node.KeySequencesCache.GetOrAdd(sequenceInfo, CreateSequence);

            return((CachingSequence <TValue>)result);
        }
コード例 #4
0
        public void SequenceInfoNode_AppendAttribute_Works()
        {
            // setup
            var sequenceInfo = new SequenceInfo();

            sequenceInfo.AllowedAttributes.Should().HaveCount(3);
            sequenceInfo.Attributes.Should().BeEmpty();

            sequenceInfo
            .AddAttributes(
                new Fb2Attribute(AttributeNames.Name, "Test Sequence"),
                new Fb2Attribute(AttributeNames.Number, "1"))
            .AppendAttribute(AttributeNames.Language, "eng");

            sequenceInfo.Attributes.Should().HaveCount(3);

            // query
            sequenceInfo.TryGetAttribute(AttributeNames.Name, out var nameResult)
            .Should()
            .BeTrue();
            nameResult.Should().Be(new Fb2Attribute(AttributeNames.Name, "Test Sequence"));

            sequenceInfo.TryGetAttribute(AttributeNames.Number, out var numberResult)
            .Should()
            .BeTrue();
            numberResult.Should().Be(new Fb2Attribute(AttributeNames.Number, "1"));

            sequenceInfo.TryGetAttribute(AttributeNames.Language, out var langResult)
            .Should()
            .BeTrue();
            langResult.Should().Be(new Fb2Attribute(AttributeNames.Language, "eng"));
        }
コード例 #5
0
        private SequenceInfo BuildSequence(HierarchyDef hierarchyDef, KeyInfo key)
        {
            var seed      = 0L;
            var cacheSize = (long)context.Configuration.KeyGeneratorCacheSize;

            var generatorName = key.GeneratorName;
            KeyGeneratorConfiguration configuration;

            if (keyGeneratorConfigurations.TryGetValue(generatorName, out configuration))
            {
                seed      = configuration.Seed;
                cacheSize = configuration.CacheSize;
            }

            var sequence = new SequenceInfo(generatorName)
            {
                Seed            = seed + cacheSize, // Preallocate keys for the first access
                Increment       = cacheSize,
                MappingDatabase = hierarchyDef.Root.MappingDatabase,
                MappingSchema   = context.Configuration.DefaultSchema,
                MappingName     = context.NameBuilder.BuildSequenceName(key),
            };

            return(sequence);
        }
コード例 #6
0
        public void Fb2Node_RemoveAttributes_ByPredicate()
        {
            // setup
            var sequenceInfo = new SequenceInfo();

            sequenceInfo.AllowedAttributes.Should().HaveCount(3);
            sequenceInfo.Attributes.Should().BeEmpty();

            sequenceInfo
            .AddAttributes(
                new Fb2Attribute(AttributeNames.Name, "Test Sequence"),
                new Fb2Attribute(AttributeNames.Number, "1"))
            .AddAttribute(() => new Fb2Attribute(AttributeNames.Language, "eng"));

            sequenceInfo.Attributes.Should().HaveCount(3);

            //Func<KeyValuePair<string, string>, bool> nameWrongCasePredicate = (kvp) => kvp.Key.Equals("nAMe");
            //Func<KeyValuePair<string, string>, bool> nameAttributePredicate = (kvp) => kvp.Key.Equals(AttributeNames.Name);

            Func <Fb2Attribute, bool> nameWrongCasePredicate = (kvp) => kvp.Key.Equals("nAMe");
            Func <Fb2Attribute, bool> nameAttributePredicate = (kvp) => kvp.Key.Equals(AttributeNames.Name);

            sequenceInfo.RemoveAttribute(nameWrongCasePredicate); // not removing anything, no matches
            sequenceInfo.Attributes.Should().HaveCount(3);

            sequenceInfo.RemoveAttribute(nameAttributePredicate);
            sequenceInfo.Attributes.Should().HaveCount(2).And.NotContain((attr) => attr.Key == AttributeNames.Name);
        }
コード例 #7
0
        public void Fb2Node_RemoveAttributes_ByAttributeName_CaseInSensitive()
        {
            // setup
            var sequenceInfo = new SequenceInfo();

            sequenceInfo.AllowedAttributes.Should().HaveCount(3);
            sequenceInfo.Attributes.Should().BeEmpty();

            sequenceInfo
            .AddAttributes(
                new Fb2Attribute(AttributeNames.Name, "Test Sequence"),
                new Fb2Attribute(AttributeNames.Number, "1"))
            .AddAttribute(() => new Fb2Attribute(AttributeNames.Language, "eng"));

            sequenceInfo.Attributes.Should().HaveCount(3);

            sequenceInfo.RemoveAttribute("NamE", true);
            //sequenceInfo.Attributes.Should().HaveCount(2).And.NotContainKey(AttributeNames.Name);
            sequenceInfo.Attributes.Should().HaveCount(2).And.NotContain((attr) => attr.Key == AttributeNames.Name);

            sequenceInfo.RemoveAttribute("NUmBeR", true);
            //sequenceInfo.Attributes.Should().HaveCount(1).And.NotContainKey(AttributeNames.Name, AttributeNames.Number);
            sequenceInfo.Attributes.Should().HaveCount(1).And.NotContain((attr) => attr.Key == AttributeNames.Name || attr.Key == AttributeNames.Number);

            sequenceInfo.RemoveAttribute("lAnG", true);
            sequenceInfo.Attributes.Should().BeEmpty();
        }
コード例 #8
0
ファイル: ExpressionEvaluator.cs プロジェクト: rsumner33/PTVS
        private ISet <Namespace> MakeSequence(ExpressionEvaluator ee, Node node)
        {
            ISet <Namespace> result;

            if (!ee.GlobalScope.NodeVariables.TryGetValue(node, out result))
            {
                var seqItems    = ((SequenceExpression)node).Items;
                var indexValues = new ISet <Namespace> [seqItems.Count];

                for (int i = 0; i < seqItems.Count; i++)
                {
                    indexValues[i] = Evaluate(seqItems[i]);
                }

                ISet <Namespace> sequence;
                if (node is ListExpression)
                {
                    sequence = new ListInfo(indexValues, _unit.ProjectState._listType).SelfSet;
                }
                else
                {
                    Debug.Assert(node is TupleExpression);
                    sequence = new SequenceInfo(indexValues, _unit.ProjectState._tupleType).SelfSet;
                }

                ee.GlobalScope.NodeVariables[node] = result = sequence;
            }

            return(result);
        }
コード例 #9
0
        public override SequenceInfo GetSequenceInfo()
        {
            var sequenceInfo = new SequenceInfo();

            sequenceInfo.AllowedDdlStatements = DdlStatements.All;
            sequenceInfo.Features             = SequenceFeatures.None;
            sequenceInfo.MaxIdentifierLength  = MaxIdentifierLength;
            return(sequenceInfo);
        }
コード例 #10
0
 public SchemaNode this[SequenceInfo sequenceInfo]
 {
     get
     {
         SchemaNode result;
         sequenceMap.TryGetValue(sequenceInfo, out result);
         return(result);
     }
 }
コード例 #11
0
        public SequenceInfo ReadSequenceInfo()
        {
            SequenceInfo si = new SequenceInfo();

            si.In  = fileReader.ReadInt32();
            si.Out = fileReader.ReadInt32();

            return(si);
        }
コード例 #12
0
        public override SequenceInfo GetSequenceInfo()
        {
            var info = new SequenceInfo();

            info.AllowedDdlStatements = DdlStatements.All;
            info.Features             = SequenceFeatures.Cache;
            info.MaxIdentifierLength  = MaxIdentifierLength;
            return(info);
        }
コード例 #13
0
        private SequenceQuery GetSequenceQuery(SequenceInfo sequenceInfo, Session session, bool executionFromUpgrade)
        {
            var generatorNode = GetGeneratorNode(sequenceInfo, session.StorageNode);

            if (domain.Configuration.ShareStorageSchemaOverNodes)
            {
                return(queryBuilder.BuildNextValueQuery(generatorNode, session.StorageNode.Configuration, sequenceInfo.Increment, executionFromUpgrade));
            }
            return(queryBuilder.BuildNextValueQuery(generatorNode, sequenceInfo.Increment, executionFromUpgrade));
        }
コード例 #14
0
        public TValue GetNextValue(SequenceInfo sequenceInfo, Session session)
        {
            if (syncRoot == null)
            {
                return(GetNextValueUnsafe(sequenceInfo, session));
            }

            lock (syncRoot)
                return(GetNextValueUnsafe(sequenceInfo, session));
        }
コード例 #15
0
        public CachingSequence <TValue> GetSequence(SequenceInfo sequenceInfo, Session session)
        {
            var items = session.Extensions.Get <CachingSequenceCollection>();

            if (items == null)
            {
                items = new CachingSequenceCollection(session);
                session.Extensions.Set(items);
            }
            return(items.GetSequence(sequenceInfo, accessor));
        }
コード例 #16
0
        public void CreateNormalSequence()
        {
            var sequenceManager = new SequenceManager(Session.Transaction);

            var sequenceName = ObjectName.Parse("APP.test_sequence");
            var seqInfo = new SequenceInfo(sequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);

            ISequence sequence =null;
            Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo));
            Assert.IsNotNull(sequence);
        }
コード例 #17
0
    public void Save(SequenceInfo info)
    {
        LogManager.Log(Application.dataPath);
        string path  = Application.dataPath;
        int    index = path.LastIndexOf('/');

        path = path.Substring(0, index);
        path = path + FILEPATH;

        LogManager.Log(path);
    }
コード例 #18
0
            public CachingSequence <TValue> GetSequence(SequenceInfo sequenceInfo, IStorageSequenceAccessor accessor)
            {
                CachingSequence <TValue> result;

                if (!sequences.TryGetValue(sequenceInfo, out result))
                {
                    result = new CachingSequence <TValue>(accessor, false);
                    sequences.Add(sequenceInfo, result);
                }
                return(result);
            }
コード例 #19
0
        protected override IQuery CreateQuery(ISession session)
        {
            var query = base.CreateQuery(session);

            if (TestContext.CurrentContext.Test.Name != "CreateNormalSequence") {
                var seqInfo = new SequenceInfo(testSequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);
                query.Access().CreateObject(seqInfo);
            }

            return query;
        }
コード例 #20
0
    public void StartSequence(int sequence)
    {
        EventSystem.SetSelectedGameObject(null);

        if (sequence <= 0)
        {
            _currentSequence = 0;
        }
        if (sequence >= AllSequenceInfos.SequenceInfos.Count)
        {
            _currentSequence = AllSequenceInfos.SequenceInfos.Count - 1;
            return;
        }

        Debug.Log("StartSequence " + _currentSequence);

        AnimateNextButton(false);

        SequencePage.text = (_currentSequence + 1) + "/" + AllSequenceInfos.SequenceInfos.Count;

        CleanARContainerObjects();

        _currentSequenceInfo = AllSequenceInfos.GetSequenceInfo(_currentSequence);
        ExplanationText.text = MainController.Instance.GetText(_currentSequenceInfo.LanguageTag);
        AnimationsInfo    animations       = _currentSequenceInfo.Animations;
        List <GameObject> objectsToAnimate = animations.ActionObjects;
        List <GameObject> staticObjects    = animations.StaticObjects;

        for (int i = 0; i < objectsToAnimate.Count; i++)
        {
            GameObject objectToAnimate = Instantiate(objectsToAnimate[i], ARContainer.transform);
            string     animationName   = animations.AnimationName;

            if (i == 0)
            {
                AnimatorAnnouncer animatorAnnouncer = objectToAnimate.AddComponent <AnimatorAnnouncer>();
                animatorAnnouncer.SetActionController(this);
            }
            Animator animation = objectToAnimate.transform.GetComponentInChildren <Animator>();
            _currentAnimators.Add(animation);
            Debug.Log(objectToAnimate.name + " animationName " + animationName);
            animation.Play(animationName);

            if (!_trackingActive)
            {
                EnableDisableRenderer(objectToAnimate, _trackingActive);
            }
        }
        for (int i = 0; i < staticObjects.Count; i++)
        {
            GameObject objectToAnimate = Instantiate(staticObjects[i], ARContainer.transform);
        }
        EnableDisableAnimators(_trackingActive);
    }
コード例 #21
0
        /// <summary>
        /// 根据ID更新增量
        /// </summary>
        /// <param name="sequenceInfo">序列信息</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>影响行数</returns>
        public int UpdateIncrementById(SequenceInfo sequenceInfo, string connectionId = null)
        {
            int result = 0;

            DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) =>
            {
                string sql = $"UPDATE `{Table}` SET `{GetFieldByProp("Increment")}`=@Increment,`{GetFieldByProp("UpdateDate")}`=@UpdateDate{GetModifyInfoSql(sequenceInfo)} WHERE {GetFieldByProp("Id") }=@Id";
                result     = dbConn.Execute(sql, sequenceInfo, GetDbTransaction(connId));
            });

            return(result);
        }
コード例 #22
0
        public void CreateNormalSequence()
        {
            var sequenceManager = new SequenceManager(Session.Transaction);

            var sequenceName = ObjectName.Parse("APP.test_sequence");
            var seqInfo      = new SequenceInfo(sequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);

            ISequence sequence = null;

            Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo));
            Assert.IsNotNull(sequence);
        }
コード例 #23
0
        /// <summary>
        /// 根据序列类型查询序列信息
        /// </summary>
        /// <param name="seqType">序列类型</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>序列信息</returns>
        public SequenceInfo SelectBySeqType(string seqType, string connectionId = null)
        {
            SequenceInfo result = null;

            DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) =>
            {
                string sql = $"{SelectSql()} WHERE {GetFieldByProp("SeqType")}=@SeqType";
                result     = dbConn.QueryFirstOrDefault <SequenceInfo>(sql, new { SeqType = seqType });
            }, AccessMode.SLAVE);

            return(result);
        }
コード例 #24
0
    private void EnsureSequenceSeedIsUnique(SequenceInfo sequenceToCheck)
    {
      var conflictingSequence = sequences.Values
        .FirstOrDefault(sequence =>
          sequence.Seed==sequenceToCheck.Seed
            && sequence.MappingName==sequenceToCheck.MappingName
            && sequence.MappingSchema==sequenceToCheck.MappingSchema);

      if (conflictingSequence!=null)
        throw new DomainBuilderException(string.Format(Strings.ExKeyGeneratorsXAndYHaveTheSameSeedValue,
          conflictingSequence.Name, sequenceToCheck.Name));
    }
コード例 #25
0
        protected override void ExecuteStatement(ExecutionContext context)
        {
            //if (!context.User.CanCreate(DbObjectType.Sequence, SequenceName))
            //	throw new MissingPrivilegesException(context.Request.UserName(), SequenceName, Privileges.Create);

            if (context.DirectAccess.ObjectExists(SequenceName))
            {
                throw new StatementException(String.Format("An object named '{0}' already exists.", SequenceName));
            }

            if (context.DirectAccess.ObjectExists(DbObjectType.Sequence, SequenceName))
            {
                throw new StatementException(String.Format("The sequence '{0}' already exists.", SequenceName));
            }

            var startValue  = SqlNumber.Zero;
            var incrementBy = SqlNumber.One;
            var minValue    = SqlNumber.Zero;
            var maxValue    = new SqlNumber(Int64.MaxValue);
            var cache       = 16;
            var cycle       = Cycle;

            if (StartWith != null)
            {
                startValue = (SqlNumber)StartWith.EvaluateToConstant(context.Request, null).AsBigInt().Value;
            }
            if (IncrementBy != null)
            {
                incrementBy = (SqlNumber)IncrementBy.EvaluateToConstant(context.Request, null).AsBigInt().Value;
            }
            if (MinValue != null)
            {
                minValue = (SqlNumber)MinValue.EvaluateToConstant(context.Request, null).AsBigInt().Value;
            }
            if (MaxValue != null)
            {
                maxValue = (SqlNumber)MaxValue.EvaluateToConstant(context.Request, null).AsBigInt().Value;
            }

            if (minValue >= maxValue)
            {
                throw new InvalidOperationException("The minimum value cannot be more than the maximum.");
            }
            if (startValue < minValue ||
                startValue >= maxValue)
            {
                throw new InvalidOperationException("The start value cannot be out of the mim/max range.");
            }

            var seqInfo = new SequenceInfo(SequenceName, startValue, incrementBy, minValue, maxValue, cache, cycle);

            context.Request.Access().CreateObject(seqInfo);
        }
コード例 #26
0
ファイル: PeptideFormatter.cs プロジェクト: laeubisoft/pwiz
 public PeptideFormatter(SrmSettings srmSettings, ModifiedSequence lightModifiedSequence, IEnumerable <KeyValuePair <IsotopeLabelType, ModifiedSequence> > heavyModifiedSequences, ModFontHolder modFontHolder)
 {
     SrmSettings        = srmSettings;
     _lightSequenceInfo = new SequenceInfo(lightModifiedSequence);
     if (heavyModifiedSequences != null)
     {
         _heavySequenceInfos.AddRange(heavyModifiedSequences.Select(entry => Tuple.Create(entry.Key, new SequenceInfo(entry.Value))));
     }
     LightModifiedSequence = lightModifiedSequence;
     ModFontHolder         = modFontHolder;
     LinkedPeptides        = ImmutableSortedList <ModificationSite, PeptideFormatter> .EMPTY;
 }
コード例 #27
0
        public void CreateNativeSequence()
        {
            var sequenceManager = new SequenceManager(Session.Transaction);

            var tableName = ObjectName.Parse("APP.test_table");
            var seqInfo   = SequenceInfo.Native(tableName);

            ISequence sequence = null;

            Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo));
            Assert.IsNotNull(sequence);
        }
コード例 #28
0
        protected override IQuery CreateQuery(ISession session)
        {
            var query = base.CreateQuery(session);

            if (TestContext.CurrentContext.Test.Name != "CreateNormalSequence")
            {
                var seqInfo = new SequenceInfo(testSequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);
                query.CreateObject(seqInfo);
            }

            return(query);
        }
コード例 #29
0
 public PeptideFormatter(SrmSettings srmSettings, ModifiedSequence lightModifiedSequence, IEnumerable <KeyValuePair <IsotopeLabelType, ModifiedSequence> > heavyModifiedSequences, ModFontHolder modFontHolder)
 {
     SrmSettings        = srmSettings;
     _lightSequenceInfo = new SequenceInfo(lightModifiedSequence);
     if (heavyModifiedSequences != null)
     {
         _heavySequenceInfos.AddRange(heavyModifiedSequences.Select(entry => Tuple.Create(entry.Key, new SequenceInfo(entry.Value))));
     }
     LightModifiedSequence     = lightModifiedSequence;
     ModFontHolder             = modFontHolder;
     DisplayModificationOption = DisplayModificationOption.NOT_SHOWN;
 }
コード例 #30
0
ファイル: TestConsumerInfo.cs プロジェクト: bojanskr/nats.net
        public void JsonIsReadProperly()
        {
            string       json = ReadDataFile("ConsumerInfo.json");
            ConsumerInfo ci   = new ConsumerInfo(json, false);

            Assert.Equal("foo-stream", ci.Stream);
            Assert.Equal("foo-consumer", ci.Name);

            SequencePair sp = ci.Delivered;

            Assert.Equal(1u, sp.ConsumerSeq);
            Assert.Equal(2u, sp.StreamSeq);

            SequenceInfo sinfo = (SequenceInfo)sp;

            Assert.Equal(1u, sinfo.ConsumerSeq);
            Assert.Equal(2u, sinfo.StreamSeq);
            Assert.Equal(AsDateTime("2022-06-29T19:33:21.163377Z"), sinfo.LastActive);

            sp = ci.AckFloor;
            Assert.Equal(3u, sp.ConsumerSeq);
            Assert.Equal(4u, sp.StreamSeq);

            sinfo = (SequenceInfo)sp;
            Assert.Equal(3u, sinfo.ConsumerSeq);
            Assert.Equal(4u, sinfo.StreamSeq);
            Assert.Equal(AsDateTime("2022-06-29T20:33:21.163377Z"), sinfo.LastActive);

            Assert.Equal(24u, ci.NumPending);
            Assert.Equal(42, ci.NumAckPending);
            Assert.Equal(42, ci.NumRedelivered);

            ConsumerConfiguration c = ci.ConsumerConfiguration;

            Assert.Equal("foo-consumer", c.Durable);
            Assert.Equal("bar", c.DeliverSubject);
            Assert.Equal(DeliverPolicy.All, c.DeliverPolicy);
            Assert.Equal(AckPolicy.All, c.AckPolicy);
            Assert.Equal(Duration.OfSeconds(30), c.AckWait);
            Assert.Equal(10, c.MaxDeliver);
            Assert.Equal(ReplayPolicy.Original, c.ReplayPolicy);

            ClusterInfo clusterInfo = ci.ClusterInfo;

            Assert.NotNull(clusterInfo);
            Assert.Equal("clustername", clusterInfo.Name);
            Assert.Equal("clusterleader", clusterInfo.Leader);
            IList <Replica> reps = clusterInfo.Replicas;

            Assert.NotNull(reps);
            Assert.Equal(2, reps.Count);
        }
コード例 #31
0
        private TValue GetNextValueUnsafe(SequenceInfo sequenceInfo, Session session)
        {
            if (nextValue == nextValueBound)
            {
                var values = accessor.NextBulk(sequenceInfo, session);
                nextValue      = values.Offset;
                nextValueBound = values.EndOffset;
            }
            var result = nextValue;

            nextValue++;
            return((TValue)Convert.ChangeType(result, typeof(TValue)));
        }
コード例 #32
0
        public static void ReassignSkulltulaHousesMusic(byte replacement_slot = 0x75)
        {
            // changes the skulltulla house BGM to a separate slot so it plays a new music that isn't generic cave music (overused)
            // the BGM for a scene is specified by a single byte in the scene headers

            // to modify the scene header, which is in the scene, we need the scene as a file
            //  we can get this from the Romdata.SceneList but this only gets populated on enemizer
            //  and we don't NEED to populate it since vanilla scenes are static, we can just hard code it here
            //  at re-encode, we'll have fewer decoded files to re-encode too
            int swamp_spider_house_fid = 1284; // taken from ultimate MM spreadsheet (US File list -> A column)

            // scan the files for the header that contains scene music (0x15 first byte)
            // 15xx0000 0000yyzz where zz is the sequence pointer byte
            RomUtils.CheckCompressed(swamp_spider_house_fid);
            for (int b = 0; b < 0x10 * 70; b += 8)
            {
                if (RomData.MMFileList[swamp_spider_house_fid].Data[b] == 0x15 &&
                    RomData.MMFileList[swamp_spider_house_fid].Data[b + 0x7] == 0x3B)
                {
                    RomData.MMFileList[swamp_spider_house_fid].Data[b + 0x7] = replacement_slot;
                    break;
                }
            }

            int ocean_spider_house_fid = 1291; // taken from ultimate MM spreadsheet

            RomUtils.CheckCompressed(ocean_spider_house_fid);
            for (int b = 0; b < 0x10 * 70; b += 8)
            {
                if (RomData.MMFileList[ocean_spider_house_fid].Data[b] == 0x15 &&
                    RomData.MMFileList[ocean_spider_house_fid].Data[b + 0x7] == 0x3B)
                {
                    RomData.MMFileList[ocean_spider_house_fid].Data[b + 0x7] = replacement_slot;
                    break;
                }
            }


            SequenceInfo new_music_slot = new SequenceInfo
            {
                Name     = "mm-spiderhouse-replacement",
                MM_seq   = replacement_slot,
                Replaces = replacement_slot,
                Type     = new List <int> {
                    2
                },
                Instrument = 3
            };

            RomData.TargetSequences.Add(new_music_slot);
        }
コード例 #33
0
        protected override bool OnSetUp(string testName, IQuery query)
        {
            var info = new SequenceInfo(ObjectName.Parse("APP.seq1"),
                new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), false);

            query.Access().CreateObject(info);

            if (testName.EndsWith("TableId")) {
                CreateTestTable(query);
                InsertTestData(query);
            }

            return true;
        }
コード例 #34
0
 public static void CreateSequence(this ITransaction transaction, SequenceInfo sequenceInfo)
 {
     transaction.CreateObject(sequenceInfo);
 }
コード例 #35
0
        private static void SaveStoredSequence(DeviceConfiguration config, long sequence)
        {
            string json = Properties.Settings.Default.PartsStoredSequences;
            if (!string.IsNullOrEmpty(json))
            {
                var sequenceInfos = JSON.ToType<List<SequenceInfo>>(json);
                if (sequenceInfos != null)
                {
                    int i = sequenceInfos.FindIndex(o => o.UniqueId == config.UniqueId);
                    if (i < 0)
                    {
                        var sequenceInfo = new SequenceInfo();
                        sequenceInfo.UniqueId = config.UniqueId;
                        sequenceInfos.Add(sequenceInfo);
                        i = sequenceInfos.FindIndex(o => o.UniqueId == config.UniqueId);
                    }

                    sequenceInfos[i].Sequence = sequence;

                    Properties.Settings.Default.PartsStoredSequences = JSON.FromList<SequenceInfo>(sequenceInfos);
                    Properties.Settings.Default.Save();
                }
            }
            else
            {
                var sequenceInfos = new List<SequenceInfo>();

                var sequenceInfo = new SequenceInfo();
                sequenceInfo.UniqueId = config.UniqueId;
                sequenceInfo.Sequence = sequence;
                sequenceInfos.Add(sequenceInfo);

                Properties.Settings.Default.PartsStoredSequences = JSON.FromList<SequenceInfo>(sequenceInfos);
                Properties.Settings.Default.Save();
            }
        }
コード例 #36
0
ファイル: GrammarRenderer.cs プロジェクト: rsdn/nitra
 public void Render(SequenceInfo.Option info)
 {
   var name = info.RuleName;
 }
コード例 #37
0
ファイル: GrammarRenderer.cs プロジェクト: rsdn/nitra
 public void Render(SequenceInfo.ListWithSeparatorSeparator info)
 {
   var name = info.RuleName;
 }
コード例 #38
0
ファイル: GrammarRenderer.cs プロジェクト: rsdn/nitra
    public void Render(SequenceInfo.Root info)
    {
      var name = info.RuleName;
      var xx = info.Subrules[0];

    }
コード例 #39
0
ファイル: GrammarRenderer.cs プロジェクト: rsdn/nitra
 public void Render(SequenceInfo.ListItem info)
 {
   var name = info.RuleName;
 }
コード例 #40
0
        public SequenceInfo FindOrCreateBookSequence(SequenceInfoNode info, IDbTransaction transaction)
        {
            string commandText;
            FbCommand command;
            SequenceInfo sequence;

            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            this.manager.BeginConnect();

            try
            {
                commandText =
                    @"SELECT sequences.* FROM sequences
                      WHERE UPPERCASE(sequences.""SEQUENCE"") = UPPERCASE(@sequencename)";

                command = this.connection.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = commandText;
                command.Transaction = transaction as FbTransaction;

                command.Parameters.Add("@sequencename", FbDbType.VarChar).Value = info.Name;

                using (SqlDbCommand dbCommand = new SqlDbCommand(command))
                {
                    sequence = dbCommand.ExecuteObject<SequenceInfo>();
                }

                if (sequence != null)
                {
                    sequence.SequenceNumber = info.Number;
                    return sequence;
                }

                sequence = new SequenceInfo();
                sequence.SequenceName = StringUtils.Truncate(info.Name, 125);

                commandText =
                    "INSERT INTO SEQUENCES (SEQUENCEID, \"SEQUENCE\") " +
                    "VALUES (GEN_ID(GEN_SEQUENCES_ID, 1), @sequencename) " +
                    "RETURNING SEQUENCEID";

                using (FbCommand cmd = this.connection.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = commandText;
                    cmd.Transaction = transaction as FbTransaction;

                    cmd.Parameters.Add("@sequencename", FbDbType.VarChar, 125).Value = sequence.SequenceName ?? String.Empty;

                    cmd.Parameters.Add("@sequenceid", FbDbType.Integer).Direction = ParameterDirection.Output;
                    cmd.ExecuteNonQuery();

                    sequence.SequenceId = Convert.ToInt32(cmd.Parameters["@sequenceid"].Value);
                }

                sequence.SequenceNumber = info.Number;
            }
            catch (FbException exp)
            {
                throw new DatabaseException(exp.Message, exp);
            }
            finally
            {
                this.manager.EndConnect();
            }

            return sequence;
        }