Exemple #1
0
 /// <summary>
 /// Create a new type by re-arranging the Vector subchannels.
 /// </summary>
 /// <param name="s1">The first subchanel.</param>
 /// <param name="s2">The second subchannel.</param>
 /// <returns>Vector2Node</returns>
 public Vector2Node GetSubchannels(Subchannel s1, Subchannel s2)
 {
     return(SubchannelsInternal <Vector2Node>(s1.ToString(), s2.ToString()));
 }
Exemple #2
0
 /// <summary>
 /// Create a new type by re-arranging the Vector subchannels.
 /// </summary>
 /// <param name="s1">The first subchanel.</param>
 /// <param name="s2">The second subchannel.</param>
 /// <param name="s3">The third subchannel.</param>
 /// <param name="s4">The fourth subchannel.</param>
 /// <returns>Vector4Node</returns>
 public Vector4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3, Subchannel s4)
 {
     return(SubchannelsInternal <Vector4Node>(s1.ToString(), s2.ToString(), s3.ToString(), s4.ToString()));
 }
Exemple #3
0
        public void WriteEntry(byte[] subchannel, bool raw, long startingLba, uint blocks)
        {
            if (subchannel.Length / _subSize != blocks)
            {
                _logSw.WriteLine("Data length is invalid!");
                _logSw.Flush();

                return;
            }

            int[] p = new int[subchannel.Length / 8];
            int[] q = new int[subchannel.Length / 8];
            int[] r = new int[subchannel.Length / 8];
            int[] s = new int[subchannel.Length / 8];
            int[] t = new int[subchannel.Length / 8];
            int[] u = new int[subchannel.Length / 8];
            int[] v = new int[subchannel.Length / 8];
            int[] w = new int[subchannel.Length / 8];

            for (int i = 0; i < subchannel.Length; i += 8)
            {
                p[i / 8]  = subchannel[i] & 0x80;
                p[i / 8] += (subchannel[i + 1] & 0x80) >> 1;
                p[i / 8] += (subchannel[i + 2] & 0x80) >> 2;
                p[i / 8] += (subchannel[i + 3] & 0x80) >> 3;
                p[i / 8] += (subchannel[i + 4] & 0x80) >> 4;
                p[i / 8] += (subchannel[i + 5] & 0x80) >> 5;
                p[i / 8] += (subchannel[i + 6] & 0x80) >> 6;
                p[i / 8] += (subchannel[i + 7] & 0x80) >> 7;

                q[i / 8]  = (subchannel[i] & 0x40) << 1;
                q[i / 8] += subchannel[i + 1] & 0x40;
                q[i / 8] += (subchannel[i + 2] & 0x40) >> 1;
                q[i / 8] += (subchannel[i + 3] & 0x40) >> 2;
                q[i / 8] += (subchannel[i + 4] & 0x40) >> 3;
                q[i / 8] += (subchannel[i + 5] & 0x40) >> 4;
                q[i / 8] += (subchannel[i + 6] & 0x40) >> 5;
                q[i / 8] += (subchannel[i + 7] & 0x40) >> 6;

                r[i / 8]  = (subchannel[i] & 0x20) << 2;
                r[i / 8] += (subchannel[i + 1] & 0x20) << 1;
                r[i / 8] += subchannel[i + 2] & 0x20;
                r[i / 8] += (subchannel[i + 3] & 0x20) >> 1;
                r[i / 8] += (subchannel[i + 4] & 0x20) >> 2;
                r[i / 8] += (subchannel[i + 5] & 0x20) >> 3;
                r[i / 8] += (subchannel[i + 6] & 0x20) >> 4;
                r[i / 8] += (subchannel[i + 7] & 0x20) >> 5;

                s[i / 8]  = (subchannel[i] & 0x10) << 3;
                s[i / 8] += (subchannel[i + 1] & 0x10) << 2;
                s[i / 8] += (subchannel[i + 2] & 0x10) << 1;
                s[i / 8] += subchannel[i + 3] & 0x10;
                s[i / 8] += (subchannel[i + 4] & 0x10) >> 1;
                s[i / 8] += (subchannel[i + 5] & 0x10) >> 2;
                s[i / 8] += (subchannel[i + 6] & 0x10) >> 3;
                s[i / 8] += (subchannel[i + 7] & 0x10) >> 4;

                t[i / 8]  = (subchannel[i] & 0x08) << 4;
                t[i / 8] += (subchannel[i + 1] & 0x08) << 3;
                t[i / 8] += (subchannel[i + 2] & 0x08) << 2;
                t[i / 8] += (subchannel[i + 3] & 0x08) << 1;
                t[i / 8] += subchannel[i + 4] & 0x08;
                t[i / 8] += (subchannel[i + 5] & 0x08) >> 1;
                t[i / 8] += (subchannel[i + 6] & 0x08) >> 2;
                t[i / 8] += (subchannel[i + 7] & 0x08) >> 3;

                u[i / 8]  = (subchannel[i] & 0x04) << 5;
                u[i / 8] += (subchannel[i + 1] & 0x04) << 4;
                u[i / 8] += (subchannel[i + 2] & 0x04) << 3;
                u[i / 8] += (subchannel[i + 3] & 0x04) << 2;
                u[i / 8] += (subchannel[i + 4] & 0x04) << 1;
                u[i / 8] += subchannel[i + 5] & 0x04;
                u[i / 8] += (subchannel[i + 6] & 0x04) >> 1;
                u[i / 8] += (subchannel[i + 7] & 0x04) >> 2;

                v[i / 8]  = (subchannel[i] & 0x02) << 6;
                v[i / 8] += (subchannel[i + 1] & 0x02) << 5;
                v[i / 8] += (subchannel[i + 2] & 0x02) << 4;
                v[i / 8] += (subchannel[i + 3] & 0x02) << 3;
                v[i / 8] += (subchannel[i + 4] & 0x02) << 2;
                v[i / 8] += (subchannel[i + 5] & 0x02) << 1;
                v[i / 8] += subchannel[i + 6] & 0x02;
                v[i / 8] += (subchannel[i + 7] & 0x02) >> 1;

                w[i / 8]  = (subchannel[i] & 0x01) << 7;
                w[i / 8] += (subchannel[i + 1] & 0x01) << 6;
                w[i / 8] += (subchannel[i + 2] & 0x01) << 5;
                w[i / 8] += (subchannel[i + 3] & 0x01) << 4;
                w[i / 8] += (subchannel[i + 4] & 0x01) << 3;
                w[i / 8] += (subchannel[i + 5] & 0x01) << 2;
                w[i / 8] += (subchannel[i + 6] & 0x01) << 1;
                w[i / 8] += subchannel[i + 7] & 0x01;
            }

            for (uint block = 0; block < blocks; block++)
            {
                bool rwEmpty = true;

                if (raw)
                {
                    for (uint i = 12 * block; i < (12 * block) + 12; i++)
                    {
                        if (r[i] == 0 &&
                            s[i] == 0 &&
                            t[i] == 0 &&
                            u[i] == 0 &&
                            v[i] == 0 &&
                            w[i] == 0)
                        {
                            continue;
                        }

                        rwEmpty = false;

                        break;
                    }
                }

                bool corruptedPause = false;
                bool pause          = false;

                for (int i = 0; i < 12; i++)
                {
                    if (p[i] == 0 ||
                        p[i] == 0xFF)
                    {
                        continue;
                    }

                    corruptedPause = true;

                    break;
                }

                if (!corruptedPause)
                {
                    pause = p[0] == 1;
                }

                byte[] subBuf = new byte[12];
                subBuf[0]  = (byte)q[0 + (block * 12)];
                subBuf[1]  = (byte)q[1 + (block * 12)];
                subBuf[2]  = (byte)q[2 + (block * 12)];
                subBuf[3]  = (byte)q[3 + (block * 12)];
                subBuf[4]  = (byte)q[4 + (block * 12)];
                subBuf[5]  = (byte)q[5 + (block * 12)];
                subBuf[6]  = (byte)q[6 + (block * 12)];
                subBuf[7]  = (byte)q[7 + (block * 12)];
                subBuf[8]  = (byte)q[8 + (block * 12)];
                subBuf[9]  = (byte)q[9 + (block * 12)];
                subBuf[10] = (byte)q[10 + (block * 12)];
                subBuf[11] = (byte)q[11 + (block * 12)];

                _logSw.WriteLine(Subchannel.PrettifyQ(subBuf, _bcd, startingLba + block, corruptedPause, pause,
                                                      rwEmpty));
            }

            _logSw.Flush();
        }
Exemple #4
0
 /// <summary>
 /// Create a new type by re-arranging the Vector subchannels.
 /// </summary>
 /// <param name="s">The subchannel.</param>
 /// <returns>ScalarNode</returns>
 public ScalarNode GetSubchannels(Subchannel s)
 {
     return(SubchannelsInternal <ScalarNode>(s.ToString()));
 }
Exemple #5
0
 /// <summary>
 /// Create a new type by re-arranging the Vector subchannels.
 /// </summary>
 /// <param name="s1">The first subchannel.</param>
 /// <param name="s2">The second subchannel.</param>
 /// <param name="s3">The third subchannel.</param>
 /// <param name="s4">The fourth subchannel.</param>
 /// <param name="s5">The fifth subchannel.</param>
 /// <param name="s6">The sixth subchannel.</param>
 /// <returns>Matrix3x2Node</returns>
 public Matrix3x2Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3, Subchannel s4, Subchannel s5, Subchannel s6)
 {
     return(SubchannelsInternal <Matrix3x2Node>(s1.ToString(), s2.ToString(), s3.ToString(), s4.ToString(), s5.ToString(), s6.ToString()));
 }
Exemple #6
0
        /// <summary>
        /// Create a new type by re-arranging the Vector subchannels.
        /// </summary>
        /// <param name="s1">The first subchannel.</param>
        /// <param name="s2">The second subchannel.</param>
        /// <param name="s3">The third subchannel.</param>
        /// <param name="s4">The fourth subchannel.</param>
        /// <param name="s5">The fifth subchannel.</param>
        /// <param name="s6">The sixth subchannel.</param>
        /// <param name="s7">The seventh subchannel.</param>
        /// <param name="s8">The eighth subchannel.</param>
        /// <param name="s9">The ninth subchannel.</param>
        /// <param name="s10">The tenth subchannel.</param>
        /// <param name="s11">The eleventh subchannel.</param>
        /// <param name="s12">The twelfth subchannel.</param>
        /// <param name="s13">The thirteenth subchannel.</param>
        /// <param name="s14">The fourteenth subchannel.</param>
        /// <param name="s15">The fifteenth subchannel.</param>
        /// <param name="s16">The sixteenth subchannel.</param>
        /// <returns>Matrix4x4Node</returns>
#pragma warning disable SA1117 // Parameters must be on same line or separate lines
        public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3, Subchannel s4,
                                            Subchannel s5, Subchannel s6, Subchannel s7, Subchannel s8,
                                            Subchannel s9, Subchannel s10, Subchannel s11, Subchannel s12,
                                            Subchannel s13, Subchannel s14, Subchannel s15, Subchannel s16)
        {
            return(SubchannelsInternal <Matrix4x4Node>(s1.ToString(), s2.ToString(), s3.ToString(), s4.ToString(),
                                                       s5.ToString(), s6.ToString(), s7.ToString(), s8.ToString(),
                                                       s9.ToString(), s10.ToString(), s11.ToString(), s12.ToString(),
                                                       s13.ToString(), s14.ToString(), s15.ToString(), s16.ToString()));
        }
 public PassiveSubchannelTransport(Subchannel subchannel)
 {
     _subchannel = subchannel;
 }
Exemple #8
0
        public bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag)
        {
            if (!IsWriting)
            {
                ErrorMessage = "Tried to write on a non-writable image";

                return(false);
            }

            Track track =
                Tracks.FirstOrDefault(trk => sectorAddress >= trk.TrackStartSector &&
                                      sectorAddress <= trk.TrackEndSector);

            if (track is null)
            {
                ErrorMessage = $"Can't found track containing {sectorAddress}";

                return(false);
            }

            switch (tag)
            {
            case SectorTagType.CdTrackFlags:
            case SectorTagType.CdTrackIsrc: return(WriteSectorTag(data, sectorAddress, tag));

            case SectorTagType.CdSectorSubchannel:
            {
                if (track.TrackSubchannelType == 0)
                {
                    ErrorMessage =
                        $"Trying to write subchannel to track {track.TrackSequence}, that does not have subchannel";

                    return(false);
                }

                if (data.Length % 96 != 0)
                {
                    ErrorMessage = "Incorrect data size for subchannel";

                    return(false);
                }

                if (_subStream == null)
                {
                    try
                    {
                        _subStream = new FileStream(_writingBaseName + ".sub", FileMode.OpenOrCreate,
                                                    FileAccess.ReadWrite, FileShare.None);
                    }
                    catch (IOException e)
                    {
                        ErrorMessage = $"Could not create subchannel file, exception {e.Message}";

                        return(false);
                    }
                }

                _subStream.
                Seek((long)(track.TrackSubchannelOffset + ((sectorAddress - track.TrackStartSector) * 96)),
                     SeekOrigin.Begin);

                _subStream.Write(Subchannel.Deinterleave(data), 0, data.Length);

                return(true);
            }

            default:
                ErrorMessage = $"Unsupported tag type {tag}";

                return(false);
            }
        }
        public JsonResult Ajax_AddJRTTImages(JrttimagesReq req)
        {
            Subchannel sb = sh.SelSubchannel((long)Convert.ToInt32(req.PlatforminfoID));

            if (sb == null)
            {
                return(Json(new AjaxResult <Object>("渠道信息错误!")));
            }
            if (string.IsNullOrWhiteSpace(sb.PyscriptPic))
            {
                return(Json(new AjaxResult <Object>("渠道《" + sb.SubChannelName + "》,没有填写发布图片脚本!")));
            }
            if (string.IsNullOrWhiteSpace(sb.AnalogPacket))
            {
                return(Json(new AjaxResult <Object>("渠道COOKIE错误!")));
            }

            //base64加密(COOKIE)
            string ck = EncodeBase64("utf-8", sb.AnalogPacket);

            //string script = "E:/work/NET/WebManager/WebManager/Web.Manager/wwwroot/PY/上传图片到材料库.py" + " " + ck + " " + req.Url;
            string script = sb.PyscriptPic + " " + ck + " " + req.Url;

            var psi = new ProcessStartInfo("python", script)
            {
                RedirectStandardOutput = true
            };
            var proc = Process.Start(psi);

            if (proc == null)
            {
                Console.WriteLine("Can not exec.");
            }
            else
            {
                Console.WriteLine("-------------Start read standard output--------------");
                //开始读取
                using (var sr = proc.StandardOutput)
                {
                    while (!sr.EndOfStream)
                    {
                        //Console.WriteLine(sr.ReadLine());
                        string jsonText = sr.ReadLine();
                        Console.WriteLine(jsonText);
                        JObject jo = (JObject)JsonConvert.DeserializeObject(jsonText);

                        JrttimagesReq md = new JrttimagesReq();
                        md.PlatforminfoID = req.PlatforminfoID;
                        md.Url            = req.Url;
                        md.Height         = jo["height"].ToString();
                        md.Width          = jo["width"].ToString();
                        md.WebUrl         = jo["web_url"].ToString();
                        md.MimeType       = jo["mime_type"].ToString();

                        return(Json(jrtt.Add(md)));
                    }

                    if (!proc.HasExited)
                    {
                        proc.Kill();
                    }
                }
                Console.WriteLine("---------------Read end------------------");
                Console.WriteLine($"Total execute time :{(proc.ExitTime - proc.StartTime).TotalMilliseconds} ms");
                Console.WriteLine($"Exited Code : {proc.ExitCode}");
            }

            return(Json(new AjaxResult <Object>("上传头条服务器失败!")));
        }
Exemple #10
0
        private void SendMessagesInBand()
        {
            Subchannel toSend = null;

            // see if there are any subchannels where we could send messages
            if (subchannels.Any(channel => !channel.Blocked))
            {
                var queued = subchannels.FirstOrDefault(channel => channel.Queued);

                if (queued != null)
                {
                    toSend = queued;
                }
                else if (messagesReliable.Count > 0)
                {
                    toSend = subchannels.First(channel => channel.Empty);

                    byte[] bytes;
                    lock (messageLock)
                    {
                        bytes = TakeMessages(messagesReliable,
                                             BYTES_PER_MESSAGE);
                    }

                    toSend.Queue(bytes, 0, bytes.Length);
                }
            }

            if (toSend == null && messagesUnreliable.Count == 0)
            {
                return;
            }

            var packet = MakePacket();

            if (toSend != null)
            {
                packet.Flags |= (int)PacketFlags.IsReliable;

                packet.Stream.WriteBits(toSend.Index, 3);
                reliableStateOut = Flip(reliableStateOut, toSend.Index);

                foreach (var channel in streams)
                {
                    toSend.Write(packet);
                }
            }

            if (messagesUnreliable.Count > 0)
            {
                var space = MAX_PACKET_SIZE - (packet.Stream.Position + 7) / 8;

                byte[] bytes;
                lock (messageLock)
                {
                    bytes = TakeMessages(messagesUnreliable, space);
                }

                packet.Stream.Write(bytes);
            }

            SendDatagram(packet);
        }
        public JsonResult Ajax_PostWTT(string PYScript, long id)
        {
            if (id < 1)
            {
                return(Json(new AjaxResult <Object>("信息错误!")));
            }

            Ypjrttweitoutiaoinfo model = wtt.Sel_Ypjrttweitoutiaoinfo(id);

            if (model == null)
            {
                return(Json(new AjaxResult <Object>("头条信息不存在!")));
            }
            //验证图片路径
            string[] Images = model.Images.Split(",");
            foreach (var it in Images)
            {
                string its = it.Replace("/", "\\");
                its = its.Substring(0, its.LastIndexOf("\\"));
                if (!Directory.Exists(its))
                {
                    return(Json(new AjaxResult <Object>("图片路劲错误!")));
                }
            }

            //循环查询脚本
            var pids = model.PlatformIds.Split(',');

            foreach (var item in pids)
            {
                Subchannel md = sh.SelSubchannel((long)Convert.ToInt32(item));
                if (md != null)
                {
                    if (string.IsNullOrWhiteSpace(md.PyscriptShortEssay))
                    {
                        return(Json(new AjaxResult <Object>("渠道《" + md.SubChannelName + "》,没有填写发布 短文 脚本!")));
                    }
                    if (string.IsNullOrWhiteSpace(md.AnalogPacket))
                    {
                        return(Json(new AjaxResult <Object>("渠道COOKIE错误!")));
                    }


                    //base64加密(COOKIE)
                    string ck = EncodeBase64("utf-8", md.AnalogPacket);

                    //base64加密
                    string content = EncodeBase64("utf-8", model.Content);

                    string script = md.PyscriptShortEssay + " " + ck + " " + model.Images + " " + content;

                    //base64解码
                    //string ss = DecodeBase64("utf-8", content);

                    //PY执行脚本
                    return(Ajax_PublicPostWTT(script, id));
                }
            }

            return(Json(new AjaxResult <Object>("发布完成!", 0)));

            #region

            /*//开始同步信息
             * //string[] imgs = model.Images.Split(',');
             * //base64加密
             * string content = EncodeBase64("utf-8", model.Content);
             * //string imgs= EncodeBase64("utf-8", model.Images);
             *
             * string script = PYScript + " " + model.Images + " " + content;
             * //string script = "E:/work/NET/WebManager/WebManager/Web.Manager/wwwroot/PY/发微头条图文皆可.py  1111 123123";
             *
             * //base64解码
             * //string ss = DecodeBase64("utf-8", content);
             *
             * //PY执行脚本
             * return Ajax_PublicPostWTT(script, id);*/

            #endregion
        }
Exemple #12
0
 public void Disconnect()
 {
     CurrentAddress = null;
     Subchannel.UpdateConnectivityState(ConnectivityState.Idle, "Disconnected.");
 }
Exemple #13
0
 public void UpdateState(ConnectivityState state, Status?status = null)
 {
     _state = state;
     Subchannel.UpdateConnectivityState(_state, status ?? Status.DefaultSuccess);
 }
Exemple #14
0
 public TestSubchannelTransport(Subchannel subchannel, Func <CancellationToken, Task <ConnectivityState> >?onTryConnect)
 {
     Subchannel    = subchannel;
     _onTryConnect = onTryConnect;
     _connectTcs   = new TaskCompletionSource <object?>(TaskCreationOptions.RunContinuationsAsynchronously);
 }
Exemple #15
0
        // Return true if indexes have changed
        bool WriteSubchannelToImage(MmcSubchannel supportedSubchannel, MmcSubchannel desiredSubchannel, byte[] sub,
                                    ulong sectorAddress, uint length, SubchannelLog subLog,
                                    Dictionary <byte, string> isrcs, byte currentTrack, ref string mcn, Track[] tracks)
        {
            if (supportedSubchannel == MmcSubchannel.Q16)
            {
                sub = Subchannel.ConvertQToRaw(sub);
            }

            if (desiredSubchannel != MmcSubchannel.None)
            {
                _outputPlugin.WriteSectorsTag(sub, sectorAddress, length, SectorTagType.CdSectorSubchannel);
            }

            subLog?.WriteEntry(sub, supportedSubchannel == MmcSubchannel.Raw, (long)sectorAddress, length);

            byte[] deSub = Subchannel.Deinterleave(sub);

            // Check subchannel
            for (int subPos = 0; subPos < deSub.Length; subPos += 96)
            {
                byte[] q = new byte[12];
                Array.Copy(deSub, subPos + 12, q, 0, 12);

                CRC16CCITTContext.Data(q, 10, out byte[] crc);
                bool crcOk = crc[0] == q[10] && crc[1] == q[11];

                // ISRC
                if ((q[0] & 0x3) == 3)
                {
                    string isrc = Subchannel.DecodeIsrc(q);

                    if (isrc == null ||
                        isrc == "000000000000")
                    {
                        continue;
                    }

                    if (!crcOk)
                    {
                        continue;
                    }

                    if (!isrcs.ContainsKey(currentTrack))
                    {
                        _dumpLog?.WriteLine($"Found new ISRC {isrc} for track {currentTrack}.");
                        UpdateStatus?.Invoke($"Found new ISRC {isrc} for track {currentTrack}.");
                    }
                    else if (isrcs[currentTrack] != isrc)
                    {
                        _dumpLog?.
                        WriteLine($"ISRC for track {currentTrack} changed from {isrcs[currentTrack]} to {isrc}.");

                        UpdateStatus?.
                        Invoke($"ISRC for track {currentTrack} changed from {isrcs[currentTrack]} to {isrc}.");
                    }

                    isrcs[currentTrack] = isrc;
                }
                else if ((q[0] & 0x3) == 2)
                {
                    string newMcn = Subchannel.DecodeMcn(q);

                    if (newMcn == null ||
                        newMcn == "0000000000000")
                    {
                        continue;
                    }

                    if (!crcOk)
                    {
                        continue;
                    }

                    if (mcn is null)
                    {
                        _dumpLog?.WriteLine($"Found new MCN {newMcn}.");
                        UpdateStatus?.Invoke($"Found new MCN {newMcn}.");
                    }
                    else if (mcn != newMcn)
                    {
                        _dumpLog?.WriteLine($"MCN changed from {mcn} to {newMcn}.");
                        UpdateStatus?.Invoke($"MCN changed from {mcn} to {newMcn}.");
                    }

                    mcn = newMcn;
                }
                else if ((q[0] & 0x3) == 1)
                {
                    // TODO: Indexes

                    // Pregap
                    if (q[2] != 0)
                    {
                        continue;
                    }

                    if (!crcOk)
                    {
                        continue;
                    }

                    byte trackNo = (byte)(((q[1] / 16) * 10) + (q[1] & 0x0F));

                    for (int i = 0; i < tracks.Length; i++)
                    {
                        if (tracks[i].TrackSequence != trackNo ||
                            trackNo == 1)
                        {
                            continue;
                        }

                        byte pmin   = (byte)(((q[3] / 16) * 10) + (q[3] & 0x0F));
                        byte psec   = (byte)(((q[4] / 16) * 10) + (q[4] & 0x0F));
                        byte pframe = (byte)(((q[5] / 16) * 10) + (q[5] & 0x0F));
                        int  qPos   = (pmin * 60 * 75) + (psec * 75) + pframe;

                        if (tracks[i].TrackPregap >= (ulong)(qPos + 1))
                        {
                            continue;
                        }

                        tracks[i].TrackPregap       = (ulong)(qPos + 1);
                        tracks[i].TrackStartSector -= tracks[i].TrackPregap;

                        if (i > 0)
                        {
                            tracks[i - 1].TrackEndSector = tracks[i].TrackStartSector - 1;
                        }

                        _dumpLog?.WriteLine($"Pregap for track {trackNo} set to {tracks[i].TrackPregap} sectors.");
                        UpdateStatus?.Invoke($"Pregap for track {trackNo} set to {tracks[i].TrackPregap} sectors.");

                        return(true);
                    }
                }
            }

            return(false);
        }