示例#1
0
        protected int CompareTo(MsDataFilePath other)
        {
            // Culture specific sorting desirable in file paths
// ReSharper disable StringCompareToIsCultureSpecific
            int result = FilePath.CompareTo(other.FilePath);

            if (result != 0)
            {
                return(result);
            }
            result = SampleName.CompareTo(other.SampleName);
            if (result != 0)
            {
                return(result);
            }
            result = SampleIndex.CompareTo(other.SampleIndex);
            if (result != 0)
            {
                return(result);
            }
            result = CentroidMs1.CompareTo(other.CentroidMs1);
            if (result != 0)
            {
                return(result);
            }
            result = CentroidMs2.CompareTo(other.CentroidMs2);
            if (result != 0)
            {
                return(result);
            }
            return(LockMassParameters.CompareTo(other.LockMassParameters));
// ReSharper restore StringCompareToIsCultureSpecific
        }
示例#2
0
        static void Main(string[] args)
        {
            // From time is how many minutes back from now we will read the IOT Hub to get messages
            //            DateTime fromTime = DateTime.UtcNow.AddMinutes(-600);
            DateTime fromTime = DateTime.UtcNow;

            // Set to true to read from the sample data file instead of the IoT Hub.
            bool useTextFile = false;

            // Delete and re-create the index
            bool reCreateIndex = false;

            // Create the service client
            SearchServiceClient serviceClient = new SearchServiceClient(Constants.SearchServiceName, new SearchCredentials(Constants.ApiKey));

            if (reCreateIndex)
            {
                // Delete the index if it already exists.
                IndexUtils.DeleteIndexIfExists(serviceClient, Constants.IndexName);

                // Create the new index definition
                var indexDef = SampleIndex.CreateIndexDefinition(Constants.IndexName);

                // Create the index
                IndexUtils.CreateIndex(serviceClient, Constants.IndexName, indexDef);
            }


            //Subscribe to the IotHub and get the data
            var eventHubClient    = EventHubClient.CreateFromConnectionString(Constants.Hub2ConnectionString, Constants.IotHubD2CEndpoint);
            CancellationToken cts = new CancellationToken();
            var tasks             = new List <Task>();

            var d2cPartitions = eventHubClient.GetRuntimeInformation().PartitionIds;

            if (useTextFile)
            {
                // Read the text file and upload the documents to the index.
                var dataToBeSentToIndex = Utils.Utils.GetModelList(Utils.Utils.ReadFileToList(Constants.SampleTextFile));
                IndexUtils.UploadDcuments(serviceClient, dataToBeSentToIndex, Constants.IndexName);
            }

            else
            {
                // Read the messages from the IoT Hub

                foreach (string partition in d2cPartitions)
                {
                    // Get messages from the hub
                    tasks.Add(IotHubMessageHelper.GetHubMessagesWriteDocumentsTask(eventHubClient, serviceClient, partition, fromTime, cts));
                }

                var x = Utils.Utils.RunTask(tasks);
            }

            //IotHubMessageHelper.GetHubMessagesWriteDocumentsTask(eventHubClient, serviceClient, partition, fromTime).Wait();
            Console.WriteLine("Press ENTER to exit.");
            Console.ReadLine();
        }
示例#3
0
        public void set_index_priority()
        {
            using (var store = NewRemoteDocumentStore(fiddler: true))
            {
                var index = new SampleIndex
                {
                    Conventions = new DocumentConvention()
                };
                index.Execute(store);

                store.DatabaseCommands.SetIndexPriority("SampleIndex", IndexingPriority.Normal);

                var stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex");

                Assert.Equal(IndexingPriority.Normal, stats.Priority);



                store.DatabaseCommands.SetIndexPriority("SampleIndex", IndexingPriority.Idle);

                stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex");

                Assert.Equal(IndexingPriority.Idle, stats.Priority);



                store.DatabaseCommands.SetIndexPriority("SampleIndex", IndexingPriority.Disabled);

                stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex");

                Assert.Equal(IndexingPriority.Disabled, stats.Priority);



                store.DatabaseCommands.SetIndexPriority("SampleIndex", IndexingPriority.Abandoned);

                stats = store.DatabaseCommands.GetStatistics().Indexes.First(x => x.Name == "SampleIndex");

                Assert.Equal(IndexingPriority.Abandoned, stats.Priority);
            }
        }
示例#4
0
        /// <summary>
        /// Generates the line from the selected <see cref="TimingPoint"/>
        /// </summary>
        /// <returns></returns>
        public string GetLine()
        {
            int style = MathHelper.GetIntFromBitArray(new BitArray(new[] { Kiai, false, false, OmitFirstBarLine }));

            return($"{(SaveWithFloatPrecision ? Offset.ToInvariant() : Offset.ToRoundInvariant())},{MpB.ToInvariant()},{Meter.TempoNumerator.ToInvariant()},{SampleSet.ToIntInvariant()},{SampleIndex.ToInvariant()},{(SaveWithFloatPrecision ? Volume.ToInvariant() : Volume.ToRoundInvariant())},{Convert.ToInt32(Uninherited).ToInvariant()},{style.ToInvariant()}");
        }