예제 #1
0
        public List <SPGetStatusByCode_Result> GetStatusByCode(StatusQuery query)
        {
            List <SPGetStatusByCode_Result> result = new List <SPGetStatusByCode_Result>();

            result = _entities.SPGetStatusByCode(query.Type, query.Code).ToList();
            return(result);
        }
예제 #2
0
        public IActionResult CreateSaved(Pricetranfer pricetranfer)
        {
            StatusQuery Notification;

            if (ModelState.IsValid)
            {
                try
                {
                    _pricetranfer.Insert(pricetranfer);
                    var statusInsert = _pricetranfer.SaveChanges();
                    if (statusInsert > 0)
                    {
                        TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Thêm thành công"));
                        return(RedirectToAction("Index", "Tranfer"));
                    }
                    else
                    {
                        Notification   = new StatusQuery("error", "", "Thêm mới thất bại");
                        ViewBag.Status = Notification.Status;
                        ViewBag.Value  = Notification.Value;
                        ViewBag.Type   = Notification.Type;
                    }
                }
                catch (Exception)
                {
                    return(View(pricetranfer));
                }
            }
            else
            {
                return(View(pricetranfer));
            }
            return(View(pricetranfer));
        }
예제 #3
0
 public override Task <StatusResponse> Status(StatusQuery request, ServerCallContext context)
 {
     return(Task.FromResult(new StatusResponse
     {
         Initialised = _routingRules.Initialised
     }));
 }
예제 #4
0
        public ActionResult Create(Favourite favourite)
        {
            StatusQuery Notification;

            if (ModelState.IsValid)
            {
                try
                {
                    _favouriteRepo.Insert(favourite);
                    var statusInsert = _favouriteRepo.SaveChanges();
                    if (statusInsert > 0)
                    {
                        TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Thêm thành công"));
                        return(RedirectToAction("Index", "Favourite"));
                    }
                    else
                    {
                        Notification   = new StatusQuery("error", "", "Thêm mới thất bại");
                        ViewBag.Status = Notification.Status;
                        ViewBag.Value  = Notification.Value;
                        ViewBag.Type   = Notification.Type;
                    }
                }
                catch (Exception)
                {
                    return(View(favourite));
                }
            }
            return(View(favourite));
        }
예제 #5
0
        //
        // Event Insight (name, value) and specialized helpers
        // ---------------------------------

        /// <inheritdoc/>
        public string GetEventValueString(int nTrackIndex, int nTrackOffset)
        {
            int ExpandedRSE = CurrentRunningStatus8; // << 8;
            int delta       = Increment(nTrackOffset);

            if (delta == -1)
            {
                Debug.Assert(false, string.Format("warning… {0:X2}", ExpandedRSE));
            }
            // channel voice
            else if (StatusQuery.IsNoteOn(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            else if (StatusQuery.IsNoteOff(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            // channel voice mode
            else if (StatusQuery.IsKeyAftertouch(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            else if (StatusQuery.IsControlChange(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            else if (StatusQuery.IsProgramChange(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            else if (StatusQuery.IsChannelAftertouch(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            else if (StatusQuery.IsPitchBend(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 2]).StringifyHex());
            }
            // sysex and seq-specific
            else if (StatusQuery.IsSequencerSpecific(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, FileHandle[nTrackIndex, nTrackOffset] + 1]).StringifyHex());
            }
            else if (StatusQuery.IsSystemExclusive(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, FileHandle[nTrackIndex].GetEndOfSystemExclusive(nTrackOffset) - nTrackOffset]).StringifyHex());
            }
            // any missed common messages
            else if (StatusQuery.IsSystemCommon(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, FileHandle[nTrackIndex, nTrackOffset] + 1]).StringifyHex());
            }
            else if (StatusQuery.IsSystemRealtime(ExpandedRSE))
            {
                return((FileHandle[nTrackIndex, nTrackOffset, 4]).StringifyHex());
            }
            return(null);
        }
예제 #6
0
        /// <summary>
        /// Get the next read position.
        ///
        /// When calling this method, the reader is likely leaving off
        /// from the following
        ///
        /// 1. [**Delta-Time**] [**Status**] — following a status byte
        ///    add one to offset
        /// 2. [**Delta-Time**] — following delta-time (running status message)
        ///    offset increment not necessary.
        /// </summary>
        public int Increment(int offset)
        {
            int Op = offset, Op1 = offset + 1;
            int status = CurrentStatus & 0xFF; // convert to byte

            // FF (append one)
            if (StatusQuery.IsNoteOff(status))
            {
                return(Op1);                                   // 0x8c 0xNN 0xNN
            }
            if (StatusQuery.IsNoteOn(status))
            {
                return(Op1);                                   // 0x9c 0xNN 0xNN
            }
            if (StatusQuery.IsKeyAftertouch(status))
            {
                return(Op1);                                   // 0xAc 0xNN 0xNN
            }
            if (StatusQuery.IsControlChange(status))
            {
                return(Op1);                                   // 0xBc 0xNN 0xNN
            }
            if (StatusQuery.IsProgramChange(status))
            {
                return(Op);                                    // 0xCc 0xNN
            }
            if (StatusQuery.IsChannelAftertouch(status))
            {
                return(Op);                                    // 0xDc 0xNN
            }
            if (StatusQuery.IsPitchBend(status))
            {
                return(Op1);                                   // 0xEc 0xNN 0xNN
            }
            if (StatusQuery.IsSequencerSpecific(status))
            {
                return(Op + FileHandle[ReaderIndex, Op]);
            }
            if (StatusQuery.IsSystemExclusive(status))
            {
                return(FileHandle[ReaderIndex].GetEndOfSystemExclusive(offset));
            }
            //
            if (StatusQuery.IsSystemCommon(status))
            {
                return(Op + FileHandle[ReaderIndex, Op]);
            }
            if (StatusQuery.IsSystemRealtime(status))
            {
                return(Op);                                   // 0xF0
            }
            if (!StatusQuery.IsMidiBMessage(CurrentRunningStatus8))
            {
                return(-1);
            }
            // what if there are two realtime messages lined after the other?

            return(-1);
        }
예제 #7
0
 public StatusResponse Status()
 {
     try
     {
         var statusQuery    = new StatusQuery();
         var statusResponse = Client.Status(statusQuery);
         return(statusResponse);
     }
     catch (RpcException e)
     {
         Console.WriteLine(e.Status.Detail);
         return(null);
     }
 }
예제 #8
0
        public IActionResult Edit(int id)
        {
            StatusQuery Notification;
            var         _vehicle = _vehicletypeRepository.GetById(id);

            if (_vehicle.Id == 2)
            {
                Notification   = new StatusQuery("warning", "", "Chuc vu ton tai");
                ViewBag.Status = Notification.Status;
                ViewBag.Value  = Notification.Value;
                ViewBag.Type   = Notification.Type;
            }
            return(View(_vehicle));
        }
예제 #9
0
        public BaseResponse <SPGetStatusByCode_Result> GetStatusByCode(StatusQuery query)
        {
            var response = new BaseResponse <SPGetStatusByCode_Result>();

            try
            {
                response.Value = _statusRepository.GetStatusByCode(query).FirstOrDefault();
            }
            catch (Exception ex)
            {
                response.Message   = "Error: " + ex.Message + " StackTrace: " + ex.StackTrace;
                response.IsSuccess = false;
            }
            return(response);
        }
예제 #10
0
        public List <SPGetStatus_Result> Filter(StatusQuery query, out int count)
        {
            count = 0;
            int pageNumber = query.PageNumber != 0 ? query.PageNumber : 1;
            var keyword    = string.IsNullOrEmpty(query.Keyword) != true ? query.Keyword : "";
            var start      = 0;
            var limit      = query.PageSize;

            start = (pageNumber - 1) * limit;
            int totalRow = 0;
            List <SPGetStatus_Result> result     = new List <SPGetStatus_Result>();
            ObjectParameter           prTotalRow = new ObjectParameter("total", totalRow);

            result = _entities.SPGetStatus(query.Type, Util.DetecVowel(keyword), start, limit, prTotalRow).ToList();
            count  = (prTotalRow.Value == null) ? 0 : Convert.ToInt32(prTotalRow.Value);
            return(result);
        }
예제 #11
0
        public BaseListResponse <SPGetStatus_Result> FilterStatus(StatusQuery query)
        {
            var response = new BaseListResponse <SPGetStatus_Result>();
            int count    = 0;

            try
            {
                response.Data       = _statusRepository.Filter(query, out count);
                response.TotalItems = count;
                response.PageNumber = query.PageNumber != 0 ? query.PageNumber : 1;
                response.PageSize   = query.PageSize;
            }
            catch (Exception ex)
            {
                response.Message = "Error: " + ex.Message + " StackTrace: " + ex.StackTrace;
            }
            return(response);
        }
예제 #12
0
        public IActionResult Index()
        {
            StatusQuery Notification;

            Notification   = new StatusQuery("warning", "", "Vui lòng kiểm tra lại");
            ViewBag.Status = Notification.Status;
            ViewBag.Value  = Notification.Value;
            ViewBag.Type   = Notification.Type;
            var _listVehicle = _vehicletypeRepository.GetAll();
            List <VehicleTypeModel> ListVehicleTypeModel = new List <VehicleTypeModel>();

            foreach (var item in _listVehicle)
            {
                if (item.Id != 0)
                {
                    var vehicleTypeModel = new VehicleTypeModel()
                    {
                        Active      = "Đã kích hoạt",
                        Descreption = item.Descreption,
                        Name        = item.Name,
                        Id          = item.Id
                    };
                    ListVehicleTypeModel.Add(vehicleTypeModel);
                }
                else
                {
                    var vehicleTypeModel = new VehicleTypeModel()
                    {
                        Active      = "bbbbb",
                        Descreption = item.Descreption,
                        Name        = item.Name,
                        Id          = item.Id
                    };
                    ListVehicleTypeModel.Add(vehicleTypeModel);
                }
            }


            return(View(ListVehicleTypeModel));
        }
        public ActionResult Create(Information information)
        {
            StatusQuery Notification;

            if (ModelState.IsValid)
            {
                try
                {
                    var obj = _formation.GetAll().FirstOrDefault(item => item.Name.ToLower() == information.Name.ToLower());
                    if (obj != null)
                    {
                        Notification   = new StatusQuery("warning", "", "Vui lòng kiểm tra lại");
                        ViewBag.Status = Notification.Status;
                        ViewBag.Value  = Notification.Value;
                        ViewBag.Type   = Notification.Type;
                        ModelState.AddModelError("Name", "Tên người dùng đã tồn tại");
                        return(View(information));
                    }
                    _formation.Insert(information);
                    var statusInsert = _formation.SaveChanges();
                    if (statusInsert > 0)
                    {
                        TempDataHelper.Put <StatusQuery>(TempData, "Notification", new StatusQuery("success", "", "Thêm thành công"));
                        return(RedirectToAction("Index", "Information"));
                    }
                }
                catch (Exception)
                {
                    return(View(information));
                }
            }
            else
            {
                return(View(information));
            }
            return(RedirectToAction("Index"));
        }
예제 #14
0
        public string GetEventString(int nTrackIndex, int nTrackOffset)
        {
            int offset0 = nTrackOffset, offset1 = nTrackOffset + 1;

            if (!StatusQuery.IsMidiMessage(CurrentRunningStatus8))
            {
                Debug.Assert(false, string.Format("warning… {0:X2}", CurrentRunningStatus8));
                return(null);
            }
            // metadata
            if (StatusQuery.IsSequencerSpecific(CurrentRunningStatus8))
            {
                return(StatusQuery.SystemExclusiveRange.Name);
            }
            else if (StatusQuery.IsNoteOn(CurrentRunningStatus8))
            {
                return(GetNoteMsg(offset0, StringRes.format_note_on));
            }
            else if (StatusQuery.IsNoteOff(CurrentRunningStatus8))
            {
                return(GetNoteMsg(offset0, StringRes.fotmat_note_off));
            }
            // channel/voice
            else if (0x21 == CurrentRunningStatus8)
            {
                return(FileHandle.Get8Bit(nTrackIndex, offset1).ToString());
            }
            else if (StatusQuery.IsKeyAftertouch(CurrentRunningStatus8))
            {
                return(string.Format(StringRes.mA, FileHandle[nTrackIndex, offset0], FileHandle[nTrackIndex, offset1]));
            }
            else if (StatusQuery.IsControlChange(CurrentRunningStatus8))
            {
                var mapIndex   = FileHandle.Get8Bit(nTrackIndex, offset0);
                var mapString1 = mapIndex > 127 ? $"{mapIndex}?" : EnumFile.CMAP[mapIndex].Trim();
                var mapString2 = FileHandle.Get8Bit(nTrackIndex, offset1);
                return(string.Format(StringRes.mB, mapString1, mapString2));
            }
            else if (StatusQuery.IsProgramChange(CurrentRunningStatus8))
            {
                return(EnumFile.IMAP[FileHandle[nTrackIndex, offset0]].Replace((char)0xA, (char)0x20).Trim());
            }
            else if (StatusQuery.IsChannelAftertouch(CurrentRunningStatus8))
            {
                return(StatusQuery.ChannelAftertouchRange.Name);
            }
            else if (StatusQuery.IsPitchBend(CurrentRunningStatus8))
            {
                return(StatusQuery.PitchBendRange.Name);
            }
            // system
            else if (StatusQuery.IsSystemCommon(CurrentRunningStatus8))
            {
                return(StatusQuery.SystemCommonMessageRange.Name);
            }
            else if (StatusQuery.IsSystemRealtime(CurrentRunningStatus8))
            {
                return(StatusQuery.SystemRealtimeRange.Name);
            }
            return(null);
        }
예제 #15
0
        public byte[] GetEventValue(int nTrackIndex, int nTrackOffset)
        {
            int         offset0 = nTrackOffset, offset1 = nTrackOffset + 1;
            int         length   = Increment(offset0); // delta-byte-encoded 'size' integer.
            List <byte> returned = new List <byte> {
                (byte)(CurrentRunningStatus8 & 0xFF)
            };

            // channel/voice
            if (StatusQuery.IsNoteOn(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            else if (StatusQuery.IsNoteOff(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            // channel/voice (mode)
            else if (StatusQuery.IsKeyAftertouch(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            else if (StatusQuery.IsControlChange(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            else if (StatusQuery.IsProgramChange(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            else if (StatusQuery.IsChannelAftertouch(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            else if (StatusQuery.IsPitchBend(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, offset0, 2]);
            }
            // metadata
            else if (StatusQuery.IsSequencerSpecific(CurrentRunningStatus8))
            {
                returned.Clear();
                returned.AddRange(FileHandle[nTrackIndex, nTrackOffset, 1]);
                returned.AddRange(FileHandle[nTrackIndex, offset0, FileHandle[nTrackIndex, offset0] + 1]);
            }
            // system
            else if (StatusQuery.IsSystemExclusive(CurrentRunningStatus8))
            {
                returned.Clear();
                returned.AddRange(FileHandle[nTrackIndex, nTrackOffset, 1]);
                returned.AddRange(FileHandle[nTrackIndex, nTrackOffset, FileHandle[nTrackIndex, nTrackOffset] + 1]);
            }
            else if (StatusQuery.IsSystemCommon(CurrentRunningStatus8))
            {
                returned.Clear();
                returned.AddRange(FileHandle[nTrackIndex, nTrackOffset, 2]);
                returned.AddRange(FileHandle[nTrackIndex, nTrackOffset, FileHandle[nTrackIndex, nTrackOffset] + 1]);
            }
            else if (StatusQuery.IsSystemRealtime(CurrentRunningStatus8))
            {
                returned.AddRange(FileHandle[nTrackIndex, nTrackOffset, 2]);
            }
            else if (length == -1)
            {
                Debug.Assert(false, string.Format("warning… {0:X2}", CurrentRunningStatus8));
            }
            byte[] bytes = returned.ToArray();
            return(bytes);
        }
예제 #16
0
        /// <summary>
        /// provides **default parser semantic** in that from here we delegate
        /// each message to <see cref="MessageHandler"/>.
        /// `MessageHandler` can be set via the constructor, or explicitly after
        /// initializing (creating/.ctor) `Reader`.
        ///
        /// Additionally, <see cref="OnMidiMessage(MidiMsgType, int, int, int, byte, long, int, bool)"/>
        /// exists and can be set as the default message-handler in which case any assigned
        /// event handler(s) (`ProcessMidiMessage`) or delegates (`MessageHandler`)
        /// can and will be used.
        /// </summary>
        public virtual int GetNTrackMessage(int nTrackIndex, int nTrackOffset, int delta)
        {
            int    DELTA_Returned = delta;
            ushort msg16          = FileHandle.Get16Bit(nTrackIndex, nTrackOffset);
            byte   msg8           = (byte)(msg16 & 0xFF);

            CurrentStatus = msg16;
            // var hexMsg = $"{msg16:X2}";
            if (msg16 >= 0xFF00 && msg16 <= 0xFF0C)
            {
                MessageHandler(MidiMsgType.MetaStr, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                return(++DELTA_Returned);
            }
            switch (msg16)
            {
            case Stat16.EndOfTrack:  // FF2F
                MessageHandler(MidiMsgType.EOT, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].Data.Length;
                break;

            case Stat16.SequenceNumber: // 0xFF00
            case Stat16.ChannelPrefix:  // FF20
            case Stat16.PortMessage:    // FF21?
            case Stat16.SetTempo:       // FF51
                MessageHandler(MidiMsgType.MetaInf, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SMPTEOffset: // FF54
                MessageHandler(MidiMsgType.MetaInf, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.TimeSignature: // FF58
            case Stat16.KeySignature:  // FF59
                MessageHandler(MidiMsgType.MetaInf, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SequencerSpecific_70: // 0xFF70
            case Stat16.SequencerSpecific_71: // 0xFF71
            case Stat16.SequencerSpecific_72: // 0xFF72
            case Stat16.SequencerSpecific_73: // 0xFF73
            case Stat16.SequencerSpecific_74: // 0xFF74
            case Stat16.SequencerSpecific_75: // 0xFF75
            case Stat16.SequencerSpecific_76: // 0xFF76
            case Stat16.SequencerSpecific_77: // 0xFF77
            case Stat16.SequencerSpecific_78: // 0xFF78
            case Stat16.SequencerSpecific_79: // 0xFF79
            case Stat16.SequencerSpecific_7A: // 0xFF7A
            case Stat16.SequencerSpecific_7B: // 0xFF7B
            case Stat16.SequencerSpecific_7C: // 0xFF7C
            case Stat16.SequencerSpecific_7D: // 0xFF7D
            case Stat16.SequencerSpecific_7E: // 0xFF7E
                // we have FF70LLNN where LL is a byte length (assumed: variable bit) and NN is the data we're being provided.
                // MPC Pro software generates it.
                // Theoretically, this could probably happen for other FF70-FF7E?
                MessageHandler(MidiMsgType.SequencerSpecificUnknown, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SequencerSpecific: // FF7F
                MessageHandler(MidiMsgType.SequencerSpecific, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SystemExclusive: // 0xF0
                MessageHandler(MidiMsgType.SystemExclusive, nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                DELTA_Returned = FileHandle[nTrackIndex].GetEndOfSystemExclusive(nTrackOffset);
                break;

            default:
            {
                if (FileHandle.Tracks[nTrackIndex].Data[nTrackOffset] < 0x80) // running-status message
                {
                    // Running Status
                    CurrentStatus = CurrentRunningStatus16;

                    int ExpandedRSE = CurrentRunningStatus8;// << 8;
                    int delta1      = -1;
                    if ((delta1 = Increment(nTrackOffset)) == -1)
                    {
                        int test = GetOffset(nTrackIndex, nTrackOffset);
                        Debug.Assert(false, string.Format("warning… {0:X2}, {1:X}|{1:N0}", ExpandedRSE, test));
                    }
                    else
                    {
                        DELTA_Returned = delta1;
                        MessageHandler(GetMidiMessageType(CurrentRunningStatus8), nTrackIndex, nTrackOffset, CurrentRunningStatus16, (byte)CurrentRunningStatus8, CurrentTrackPulse, CurrentRunningStatus8, true);
                    }
                }
                //else if (StatusQuery.IsMidiMessage(msg32))
                else if (StatusQuery.IsMidiMessage(msg8))
                {
                    //CurrentTrackRunningStatus = (FileHandle[nTrackIndex, nTrackOffset]);
                    CurrentRunningStatus8  = msg8;
                    CurrentRunningStatus16 = msg16;
                    DELTA_Returned         = Increment(nTrackOffset + 1);
                    MessageHandler(GetMidiMessageType(CurrentRunningStatus8), nTrackIndex, nTrackOffset, msg16, msg8, CurrentTrackPulse, CurrentRunningStatus8, false);
                    DELTA_Returned++;
                    return(DELTA_Returned);
                }
                else
                {
                    throw new FormatException(
                              $"Bad format(?)!\n" +
                              $"There is probably a problem with the Input File (unless we made an error reading it)!\n" +
                              $"Here is some debug info: {GetDebugInfo(nTrackIndex, nTrackOffset, delta)}");
                }
            }

            break;
            }
            return(++DELTA_Returned);
        }
예제 #17
0
        /// <summary>
        /// In MIDI Format 1, this would be the first track (index = 0).
        /// Otherwise Format 0: index = 0 and with
        /// Format 2, each track will essentially be like a Format 0 track.
        ///
        /// This method collects information from the 'tempo map' track such as
        ///
        /// - Tempo Information
        /// - SMPTE Offset
        /// - Time Signature
        /// - Key Signatuer
        /// - Sequencer Specific Data
        /// - System Exclusive Data (in tempo map)
        /// </summary>
        int GetTempoMap(int nTrackIndex, int nTrackOffset, int delta)
        {
            int  DELTA_Returned = delta;
            var  msg16          = FileHandle.Get16Bit(nTrackIndex, nTrackOffset);
            byte msg8           = (byte)(msg16 & 0xFF);

            CurrentStatus = msg16; // This is just an attempt at aligning running status.
            // var hexMsg = $"{msg16:X2}";
            if (msg16 >= 0xFF00 && msg16 <= 0xFF0C)
            {
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                return(++DELTA_Returned);
            }
            switch (msg16)
            {
            // text
            case Stat16.SequenceNumber: // 0xFF00
            case Stat16.ChannelPrefix:  // 0xFF20
            case Stat16.PortMessage: /* 0xFF21 */ DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset); break;

            case Stat16.EndOfTrack: /* 0xFF2F */ DELTA_Returned = FileHandle.Tracks[nTrackIndex].Data.Length - 1; break;

            case Stat16.SetTempo: // 0xFF51
                var muspqn = FileHandle[ReaderIndex].ReadU24(nTrackOffset + 3);
                TempoMap.Push(muspqn, Division, CurrentTrackPulse);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SMPTEOffset: // 0xFF54
                SMPTE.SetSMPTE(
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 3],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 4],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 5],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 6],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 7]
                    );
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.TimeSignature: // 0xFF58
                TimeSignature.SetSignature(
                    (int)this[nTrackIndex, nTrackOffset + 3],
                    (int)Math.Pow(-this[nTrackIndex, nTrackOffset + 4], 2),
                    (int)this[nTrackIndex, nTrackOffset + 5],
                    (int)this[nTrackIndex, nTrackOffset + 6]
                    );
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.KeySignature: // 0xFF59
                KeySignature.SetSignature(
                    this[nTrackIndex, nTrackOffset + 3],
                    this[nTrackIndex, nTrackOffset + 4]);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SequencerSpecific_70: // 0xFF70
            case Stat16.SequencerSpecific_71: // 0xFF71
            case Stat16.SequencerSpecific_72: // 0xFF72
            case Stat16.SequencerSpecific_73: // 0xFF73
            case Stat16.SequencerSpecific_74: // 0xFF74
            case Stat16.SequencerSpecific_75: // 0xFF75
            case Stat16.SequencerSpecific_76: // 0xFF76
            case Stat16.SequencerSpecific_77: // 0xFF77
            case Stat16.SequencerSpecific_78: // 0xFF78
            case Stat16.SequencerSpecific_79: // 0xFF79
            case Stat16.SequencerSpecific_7A: // 0xFF7A
            case Stat16.SequencerSpecific_7B: // 0xFF7B
            case Stat16.SequencerSpecific_7C: // 0xFF7C
            case Stat16.SequencerSpecific_7D: // 0xFF7D
            case Stat16.SequencerSpecific_7E: // 0xFF7E
            case Stat16.SequencerSpecific:    // 0xFF7F
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SystemExclusive:
                var pLastIndex = FileHandle[nTrackIndex].GetEndOfSystemExclusive(nTrackOffset);
                DELTA_Returned = pLastIndex;
                break;

            default:
            {
                if (FileHandle.Tracks[nTrackIndex].Data[nTrackOffset] < 0x80)
                {
                    CurrentStatus = CurrentRunningStatus16;
                    // Running Status
                    // int ExpandedRSE = CurrentTrackRunningStatus;// << 8;
                    int ExpandedRSE = CurrentRunningStatus8;// << 8;
                    int delta1      = -1;
                    if ((delta1 = Increment(nTrackOffset)) == -1)
                    {
                        int test = GetOffset(nTrackIndex, nTrackOffset);
                        Debug.Assert(false, string.Format("warning… {0:X2}, {1:X}|{1:N0}", ExpandedRSE, test));
                    }
                    else
                    {
                        DELTA_Returned = delta1;
                    }
                }
                else if (StatusQuery.IsMidiMessage(msg8))
                {
                    CurrentRunningStatus8  = msg8;
                    CurrentRunningStatus16 = msg16;
                    DELTA_Returned         = Increment(nTrackOffset + 1);
                    return(++DELTA_Returned);
                }
                else
                {
                    throw new FormatException("Bad format!\nThere is probably a problem with the Input File unless we made an error reading it!)");
                }
            }

            break;
            }
            return(++DELTA_Returned);
        }
예제 #18
0
 public async Task <string> Get(StatusQuery query)
 {
     //await Task.Delay(1000);
     return("Hello World");
 }
예제 #19
0
        public List <Statut> GetAllStatut()
        {
            StatusQuery sq = new StatusQuery(contexte);

            return(sq.GetAll().ToList());
        }
예제 #20
0
 public BaseListResponse <SPGetStatus_Result> Search([FromUri] StatusQuery query)
 {
     return(categoryService.FilterStatus(query));
 }
예제 #21
0
 public BaseResponse <SPGetStatusByCode_Result> GetByCode([FromUri] StatusQuery query)
 {
     return(categoryService.GetStatusByCode(query));
 }
예제 #22
0
        public Status GetStatus(int id)
        {
            StatusQuery sq = new StatusQuery(contexte);

            return(sq.GetByID(id));
        }
예제 #23
0
        /// <summary>
        /// Récupérer une liste de Statuses en base
        /// </summary>
        /// <returns>Statuses List</returns>
        public List <Status> GetAllStatuses()
        {
            StatusQuery sq = new StatusQuery(_context);

            return(sq.GetAll().ToList());
        }
예제 #24
0
        /// <summary>
        /// Récupérer un Status en base
        /// </summary>
        /// <param name="statusId">Id de l'Status</param>
        /// <returns>Status</returns>
        public Status GetStatus(int statusId)
        {
            StatusQuery sq = new StatusQuery(_context);

            return(sq.GetById(statusId));
        }