<commit_before>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

namespace PersistentTrails
{
    //[KSPAddon(KSPAddon.Startup.Flight, false)]
    //public class RenderHook : MonoBehaviour
    //{
    //    public override void OnPostRender() {
        
    //    }
    //}

    //This is the central instance of this plugin. It organizes resources and settings and creates the TrackManager
    [KSPAddon(KSPAddon.Startup.Flight, false)]
    public class ExplorerTrackBehaviour :  MonoBehaviour
    {
        //private TrackManager trackManager;
        private Vector3 lastReferencePos;

        MainWindow mainWindow;
        bool ShouldBeInPostDrawQueue = false;
        bool IsInPostDrawQueue = false;

        private float recordingInterval;
        public float RecordingInterval { get { return recordingInterval; } set { recordingInterval = value; setupRepeatingUpdate(recordingInterval); } }


        //Awake Event - when the DLL is loaded
        public ExplorerTrackBehaviour()
        {
            mainWindow = new MainWindow(this);
            recordingInterval = 5;
        }

        ~ExplorerTrackBehaviour()
        {
            Debug.Log("ExplorerTrackBehaviour destructor");
            //trackManager = null;
            mainWindow = null;

        }

        //Called once everything else is loaded, just before the first execution tick 
        public void Awake() {
            //DontDestroyOnLoad(this);
            Debug.Log("Awakening ExplorerTrackBehaviour");

            GUIResources.LoadAssets();
            
            //mainWindowOpen = false;
     
            //Load config
            //KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType<ExplorerTrackBehaviour>();
            //configfile.load();

            //ManifestPosition = PrevManifestPosition = configfile.GetValue<Rect>("ManifestPosition");
            //TransferPosition = PrevTransferPosition = configfile.GetValue<Rect>("TransferPosition");
            //RosterPosition = PrevRosterPosition = configfile.GetValue<Rect>("RosterPosition");
            //ButtonPosition = PrevButtonPosition = configfile.GetValue<Rect>("ButtonPosition");

            //trackManager.restoreTracksFromFile();
            setupRepeatingUpdate(recordingInterval);
            lastReferencePos = FlightGlobals.currentMainBody.GetWorldSurfacePosition(0, 0, 1000);<commit_msg>fix checkGPS: NullRef-Exception during Awake() prevented the InvokeRepeating-Call<commit_after>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

namespace PersistentTrails
{
    //[KSPAddon(KSPAddon.Startup.Flight, false)]
    //public class RenderHook : MonoBehaviour
    //{
    //    public override void OnPostRender() {
        
    //    }
    //}

    //This is the central instance of this plugin. It organizes resources and settings and creates the TrackManager
    [KSPAddon(KSPAddon.Startup.Flight, false)]
    public class ExplorerTrackBehaviour :  MonoBehaviour
    {
        //private TrackManager trackManager;
        private Vector3 lastReferencePos;

        MainWindow mainWindow;
        bool ShouldBeInPostDrawQueue = false;
        bool IsInPostDrawQueue = false;

        private float recordingInterval;
        public float RecordingInterval { get { return recordingInterval; } set { recordingInterval = value; setupRepeatingUpdate(recordingInterval); } }


        //Awake Event - when the DLL is loaded
        public ExplorerTrackBehaviour()
        {
            mainWindow = new MainWindow(this);
            recordingInterval = 5;
        }

        ~ExplorerTrackBehaviour()
        {
            Debug.Log("ExplorerTrackBehaviour destructor");
            //trackManager = null;
            mainWindow = null;

        }

        //Called once everything else is loaded, just before the first execution tick 
        public void Awake() {
            //DontDestroyOnLoad(this);
            Debug.Log("Awakening ExplorerTrackBehaviour");

            GUIResources.LoadAssets();
            
            //mainWindowOpen = false;
     
            //Load config
            //KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType<ExplorerTrackBehaviour>();
            //configfile.load();

            //ManifestPosition = PrevManifestPosition = configfile.GetValue<Rect>("ManifestPosition");
            //TransferPosition = PrevTransferPosition = configfile.GetValue<Rect>("TransferPosition");
            //RosterPosition = PrevRosterPosition = configfile.GetValue<Rect>("RosterPosition");
            //ButtonPosition = PrevButtonPosition = configfile.GetValue<Rect>("ButtonPosition");

            //trackManager.restoreTracksFromFile();
            setupRepeatingUpdate(recordingInterval);
            lastReferencePos = new Vector3(0,0,0);
{'fraction_non_alphanumeric': 0.08813352330551598, 'fraction_numerical': 0.0028495827396702628, 'mean_word_length': 2.548014440433213, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1302722', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1231, 'n_words': 281}