<commit_before>﻿using EDDiscovery.DB;
using EDDiscovery2.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EDDiscovery
{
    public class SystemPosition
    {
        public DateTime time;
        public string Name;
        public int Nr;
        public int BodyNr;

        public ISystem curSystem;
        public ISystem prevSystem;
        public ISystem lastKnownSystem;
        public string strDistance;
        public IVisitedSystems vs;
        

        public SystemPosition()
        {
        }

        public SystemPosition(IVisitedSystems vs)
        {
            Name = vs.Name;
            time = vs.Time;
            this.vs = vs;
        }

        public void Update()
        {
            if (this.vs is VisitedSystemsClass)
            {
                VisitedSystemsClass vsc = (VisitedSystemsClass)vs;
                vsc.Update();
            }
        }

        static public SystemPosition Parse(DateTime lasttime, string line)
        {
            SystemPosition sp = new SystemPosition();

            try
            {
                if (line.Length < 15)
                    return null;

                if (line.StartsWith("<data>"))
                    return null;

                string str = line.Substring(1, 2);

                int hour = int.Parse(str);
                int min = int.Parse(line.Substring(4, 2));
                int sec = int.Parse(line.Substring(7, 2));

                sp.time = new DateTime(lasttime.Year, lasttime.Month, lasttime.Day, hour, min, sec);

                if (sp.time.Subtract(lasttime).TotalHours < -12)
                    sp.time = sp.time.AddDays(1);<commit_msg>BugFix.   Playsession parsed wring date if you had played for moroe then 12 hours and you passed realtime.  The new systems got wrong date.<commit_after>﻿using EDDiscovery.DB;
using EDDiscovery2.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EDDiscovery
{
    public class SystemPosition
    {
        public DateTime time;
        public string Name;
        public int Nr;
        public int BodyNr;

        public ISystem curSystem;
        public ISystem prevSystem;
        public ISystem lastKnownSystem;
        public string strDistance;
        public IVisitedSystems vs;
        

        public SystemPosition()
        {
        }

        public SystemPosition(IVisitedSystems vs)
        {
            Name = vs.Name;
            time = vs.Time;
            this.vs = vs;
        }

        public void Update()
        {
            if (this.vs is VisitedSystemsClass)
            {
                VisitedSystemsClass vsc = (VisitedSystemsClass)vs;
                vsc.Update();
            }
        }

        static public SystemPosition Parse(DateTime lasttime, string line)
        {
            SystemPosition sp = new SystemPosition();

            try
            {
                if (line.Length < 15)
                    return null;

                if (line.StartsWith("<data>"))
                    return null;

                string str = line.Substring(1, 2);

                int hour = int.Parse(str);
                int min = int.Parse(line.Substring(4, 2));
                int sec = int.Parse(line.Substring(7, 2));

                sp.time = new DateTime(lasttime.Year, lasttime.Month, lasttime.Day, hour, min, sec);

                if (sp.time.Subtract(lasttime).TotalHours < -4)
                    sp.time = sp.time.AddDays(1);
{'fraction_non_alphanumeric': 0.08219559765951519, 'fraction_numerical': 0.006965728615213151, 'mean_word_length': 1.5460992907801419, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '492628', 'n_tokens_mistral': 1000, 'n_tokens_neox': 941, 'n_words': 256}