Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Casasoft ObjectMatrix/NET 0.1");
            Console.WriteLine("copyright (c) 2020 Roberto Ceccarelli - Casasoft\n");

            List <string> extra;

            bool        shouldShowHelp = false;
            string      packet         = string.Empty;
            string      outfile        = string.Empty;
            string      messagebase    = "Internal";
            FidoAddress myAddress      = new FidoAddress();
            FidoAddress destAddress    = new FidoAddress();
            OptionSet   options        = new OptionSet()
            {
                { "t|toss-packet=", "Toss this packet", n => packet = n },
                { "p|packet-for=", "Create packet for this address", a => destAddress = new FidoAddress(a) },
                { "a|my-address=", "Local 5D fidonet address", a => myAddress = new FidoAddress(a) },
                { "o|output-file=", "Output filename", o => outfile = o },
                { "messagebase=", "Internal (default) or Hudson", b => messagebase = b },
                { "h|help", "show this message and exit", h => shouldShowHelp = h != null },
            };

            try
            {
                extra = options.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine($"Try `{exeName} --help' for more information.");
                return;
            }

            if (shouldShowHelp)
            {
                ShowHelp(options);
                return;
            }

            if (!string.IsNullOrWhiteSpace(packet))
            {
                toss(packet, myAddress);
                return;
            }

            if (destAddress.net != 0)
            {
                if (messagebase.ToUpper() == "HUDSON")
                {
                    packHudson(destAddress, myAddress, outfile);
                }
                else
                {
                    pack(destAddress, myAddress, outfile);
                }

                return;
            }
        }
Beispiel #2
0
        private static void toss(string packetFile, FidoAddress addr)
        {
            Console.WriteLine($"Tossing packet: {packetFile}");
            byte[]       rawpkt = File.ReadAllBytes(packetFile);
            BBSMsgPacket pkt    = new BBSMsgPacket(rawpkt);

            Console.WriteLine($"{pkt.Messages.Count} messages found.");
            pkt.Toss(addr.domain);
            Console.WriteLine("Toss completed.");
        }
Beispiel #3
0
 /// <summary>
 /// Build a packed message from Hudsonbase header and body
 /// </summary>
 /// <param name="header"></param>
 /// <param name="body"></param>
 public HudsonPackedMessage(Messages msgbase, int msgnum) : this()
 {
     MsgHdr.MsgHdrRecord header = msgbase.Headers.Data[msgnum - 1];
     Text      = new MsgText(msgbase.MsgBodies[msgnum]);
     Text.Area = msgbase.Areas[header.Board];
     orig      = new FidoAddress(header.OrigZone, header.OrigNet, header.OrigNode, 0);
     dest      = new FidoAddress(header.DestZone, header.DestNet, header.DestNode, 0);
     FromUser  = header.WhoFrom;
     DestUser  = header.WhoTo;
     Subject   = header.Subject;
     Timestamp = FidonetHelpers.FidoFormatDatetime(header.Timestamp);
 }
Beispiel #4
0
        private static void packHudson(FidoAddress destAddress, FidoAddress myAddress, string outfile)
        {
            Messages  mb  = new Messages();
            MsgPacket pkt = new MsgPacket();

            pkt.dest = destAddress;
            pkt.orig = myAddress;
            foreach (MsgHdr.MsgHdrRecord h in mb.Headers.Data)
            {
                pkt.Messages.Add(new HudsonPackedMessage(mb, h.MsgNum));
            }
            File.WriteAllBytes(outfile, pkt.Binary);
        }
 /// <summary>
 /// builds message from database entity
 /// </summary>
 /// <param name="m"></param>
 public BBSPackedMessage(Message m) : base()
 {
     orig         = new FidoAddress(m.OrigZone, m.OrigNet, m.OrigNode, m.OrigPoint);
     dest         = new FidoAddress(m.DestZone, m.DestNet, m.DestNode, m.DestPoint);
     FromUser     = m.MessageFrom;
     DestUser     = m.MessageTo;
     Timestamp    = FidonetHelpers.FidoFormatDatetime(m.DateTime);
     Subject      = m.Subject;
     attr         = new MsgAttributes((ushort)m.Attributes);
     Text.Area    = m.Area;
     Text.MsgId   = m.FidoId;
     Text.ReplyId = m.FidoReplyTo;
     Text.Tear    = m.TearLine;
     Text.Origin  = m.OriginLine;
     Text.Lines   = TextHelper.SplitString(m.Body);
     Text.Path    = m.PathLines;
     Text.SeenBy  = m.SeenByLines;
 }
Beispiel #6
0
 private static void pack(FidoAddress destAddress, FidoAddress myAddress, string outfile)
 {
 }