public static void Prefix(ushort segment)
 {
     if (!InSimulationThread())
     {
         return;
     }
     Log.Info($"SplitSegment.Prefix() segment:{segment}" /*\n" + Environment.StackTrace*/, true);
     SegmentData = SegmentRecord.Create(segment, man_);
 }
        /// <summary>
        /// scenario 1: no change - returns the input node.
        /// scenario 2: move node : segment is released and a smaller segment is created - returns the moved node.
        /// scenario 3: merge node: segment is released and the other node is returned.
        ///
        /// How to handle:
        /// 1: skip (DONE)
        /// 2: copy segment end for the node that didn't move (moved node cannot have customisations) (DONE)
        /// 3: when split-segment creates a new segment, that copy segment end to it.
        /// </summary>
        /// <param name="node">input/output node</param>
        public static void Prefix(ref ushort node) // TODO remove ref when in lates harmony.
        {
            if (!InSimulationThread())
            {
                return;
            }
            NodeID = node;
            AssertEqual(NodeID.ToNode().CountSegments(), 1, "CountSegments");
            ushort segmentID = NetUtil.GetFirstSegment(NodeID);

            Log.Info($"MoveMiddleNode.Prefix() node:{NodeID} segment:{segmentID}" /*+"\n" + Environment.StackTrace*/, true);
            SegmentData = SegmentRecord.Create(segmentID, man_);
            NodeID2     = segmentID.ToSegment().GetOtherNode(NodeID);
        }
 public static void Prefix(ushort segment)
 {
     if (UpgradingSegmentData != null)
     {
         KianCommons.Log.Error("Unexpected UpgradingSegmentData != null");
         UpgradingSegmentData = null;
     }
     if (m_upgrading)
     {
         UpgradingSegmentData = SegmentRecord.Create(segment, man_);
     }
     Log.Debug($"ReleaseSegment.Prefix({segment})\n" + Environment.StackTrace);
     if (man_ is IReleaser releaser)
     {
         releaser.Release(new InstanceID {
             NetSegment = segment
         });
         releaser.Release(InstanceIDExtension.SegmentEnd(segment, true));
         releaser.Release(InstanceIDExtension.SegmentEnd(segment, false));
     }
 }