The coordinates aren't useful though, at least for this effort. They are the coordinates of your ship within the system, in meters from the primary star, iirc
Yeah, there has been some talk of grabbing the names of visited systems from the logs. The coordinates aren't useful though, at least for this effort. They are the coordinates of your ship within the system, in meters from the primary star, iirc
using System;
using System.IO;
using System.Threading;
public class LogWatcher
{
public event EventHandler<LogLineEventArgs> LogLine;
public event EventHandler<EventArgs> FinishedLog;
private void OnLogLine(LogLineEventArgs args)
{
EventHandler<LogLineEventArgs> local = LogLine;
if (local != null)
{
local(this, args);
}
}
private void OnFinishedLog(EventArgs e)
{
EventHandler<EventArgs> local = FinishedLog;
if(local != null)
{
local(this, e);
}
}
private long lastOffset = 0;
private string logFilename;
private bool running = false;
public LogWatcher(string logFilename)
{
this.logFilename = logFilename;
}
public void Start()
{
running = true;
while (running)
{
Read();
Thread.Sleep(5000);
}
}
public void Stop()
{
running = false;
}
public void ResetLastRead()
{
lastOffset = 0;
}
private void Read()
{
if(File.Exists(logFilename))
{
using (System.IO.FileStream logReader = new System.IO.FileStream(logFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite))
{
logReader.Seek(lastOffset, SeekOrigin.Begin);
StreamReader sr = new StreamReader(logReader);
string line = sr.ReadLine();
while (!string.IsNullOrEmpty(line))
{
OnLogLine(new LogLineEventArgs(line));
line = sr.ReadLine();
}
lastOffset = logReader.Position;
sr.Close();
if (sr != null)
{
sr.Dispose();
}
}
OnFinishedLog(new EventArgs());
}
}
}
public class LogLineEventArgs : EventArgs
{
public LogLineEventArgs(string line)
{
Line = line;
}
public string Line { get; set; }
}
//// Attach to the event LogLine and you are looking for this
if(e.Line.Contains("System:"))
{
var startOfName = line.IndexOf("(")+1;
var endOfName = line.IndexOf(")");
// This can happen lots of times per system change, only get the first one.
var thisSystem = line.Substring(startOfName, endOfName - startOfName);
if(thisSystem != lastSystem)
{
lastSystem = thisSystem;
// Do stuff.
}
}
#!/usr/bin/perl -w
# vim: textwidth=0 wrapmargin=0 shiftwidth=2 tabstop=2 softtabstop
use strict;
my $last_system;
while (<STDIN>) {
# {17:40:02} System:3(Xi Wangkala) Body:31 Pos:(7241.34,-1733.84,-2736.61)
if (/^\{(?<time>[0-9:]{8})\} System:[0-9]+\((?<system>.+)\) Body/) {
if (!defined($last_system) or $last_system ne $+{'system'}) {
$last_system = $+{'system'};
print $+{'time'}, ": ", $+{'system'}, "\n";
#print $+{'system'}, "\n";
}
}
}
Note that there are a few systems whose names contain parantheses.
i.e. anchor the end of the system name on the 'Body' string, I've not yet come across a system name with that in it.
Is there a crowdsourced list/shared spreadsheet/web API for Station info as opposed to EDSC's System info?
Is there a crowdsourced list/shared spreadsheet/web API for Station info as opposed to EDSC's System info?
My data is now available at http://starchart.club/elite.json. It is updated every 10 minutes or so.
It is free to use but please use the standard HTTP headers Accept-Encoding: gzip (to reduce traffic by 90+%) and the If-Modified-Since headers and caching if possible.
My data is now available at http://starchart.club/elite.json. It is updated every 10 minutes or so.
It is free to use but please use the standard HTTP headers Accept-Encoding: gzip (to reduce traffic by 90+%) and the If-Modified-Since headers and caching if possible.
Is that pulling from EDSC? I just did a quick search for a batch of ~50 "Col 285 Sector" stars I submitted yesterday or the day before, but I'm not seeing them. Although, hmm. I guess maybe they don't have a high cr or something.
Not pulling from EDSC yet. I'm still thinking of doing it right.
I've decided to refrain from using any artificial IDs in my internal API. The systems are identified by their positions using 27.5 bit fixed point (1/32Ly) integer coordinates only. So I need to know if a system was added or it has been just shifted around.
Thanks for the hint on the cr value, though. Earlier I've tested EDSC with the default cr value only. Having the value reduced I see there are many more systems than anticipated.
Not pulling from EDSC yet. I'm still thinking of doing it right.
I've decided to refrain from using any artificial IDs in my internal API. The systems are identified by their positions using 27.5 bit fixed point (1/32Ly) integer coordinates only. So I need to know if a system was added or it has been just shifted around.
Thanks for the hint on the cr value, though. Earlier I've tested EDSC with the default cr value only. Having the value reduced I see there are many more systems than anticipated.
Nice, you noticed that too, the FD coordinates all evenly divide by 0.03125 (1/32).
A few questions:
- What is the current situation of TGC?
- Is it ready for prime time? As in can it already be used for a massive crowd sourced effort to get as much distances as possible
- What is the current status wrt storing other static data?
If TGC is ready for prime time I'm going to write the OCR commanders a few PM's to see if their solutions are also capable of getting the distances from the nav menu. This would mean much less time then doing a manual look up of distances using the GM.