我正在使用http://nova.astrometry.net/
的印版求解服务来进行天文摄影项目我找到了AstrometryNetClient(在这里:https://github.com/elendil-software/AstrometryNetClient),通过对代码进行一些更改,我设法使它对我有效,并且效果很好。
我的问题是,当我单击按钮将其更改为运行时,由于某种原因它不起作用!
它在以下行停止:var res = client.Login();
我认为问题出在前一行:var client = new Client(apiKey);
,因为当我使用F11检查代码时,它显示
“已连接=假”表示登录http://nova.astrometry.net/api/
这是原始代码:
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using software.elendil.AstrometryNet;
using software.elendil.AstrometryNet.Enum;
using software.elendil.AstrometryNet.Json;
namespace Test
{
internal static class Program
{
private static void Main(string[] args)
{
const string apiKey = "astrometrynetapikey";
const string file = "test.fit";
try
{
var client = new Client(apiKey);
var res = client.Login();
Console.WriteLine("Login : " + res.status);
CancellationTokenSource tokenSource = new
CancellationTokenSource();
CancellationToken token = tokenSource.Token;
var uploadArguments = new UploadArgs
{publicly_visible = Visibility.n};
var uploadResponse = client.Upload(file, uploadArguments);
Task<SubmissionStatusResponse>
submissionStatusResponse = client.GetSubmissionStatus(uploadResponse.subid, token);
Task<JobStatusResponse> jobStatusResponse =
client.GetJobStatus(submissionStatusResponse.Result.jobs[0], token);
if (jobStatusResponse.Result.status.Equals(ResponseJobStatus.success))
{
var calibrationResponse = client.GetCalibration(submissionStatusResponse.Result.jobs[0]);
var objectsInFieldResponse = client.GetObjectsInField(submissionStatusResponse.Result.jobs[0]);
Console.WriteLine("\nRA : " + calibrationResponse.ra);
Console.WriteLine("Dec : " + calibrationResponse.dec);
Console.WriteLine("radius : " + calibrationResponse.radius);
Console.WriteLine("");
foreach (string obj in objectsInFieldResponse.objects_in_field)
{
Console.WriteLine(obj);
}
}
else
{
Console.WriteLine("Status : " + jobStatusResponse.Result.status);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
Console.ReadKey();
}
}
}
}
答案 0 :(得分:0)
我想我已经找到了一个解决方案,似乎我需要安装Newtonsoft.Json,现在工作正常。 谢谢大家的支持!