private static JobHeader AddOrUpdate(string location, Guid identifier, JobData data)
        {
            int version = 1;
            string name = identifier.ToHex();

            JobFileEntry[] info = GetInfo(location, x => x.Identifier == identifier);
            JobFileEntry current = info.FirstOrDefault();

            if (current != null)
                version = current.Version + 1;

            string path = Path.Combine(location, $"{name}-{version}");
            JobHeader header = new JobHeader
            {
                Identifier = identifier,
                Version = version
            };

            File.WriteAllText(path, JsonConvert.SerializeObject(data));
            return header;
        }
Beispiel #2
0
 public void Job(JobHeader header, JobData data)
 {
     items[header] = data;
 }
Beispiel #3
0
            private new JobHeader Add(JobData data)
            {
                JobHeader header = new JobHeader
                {
                    Identifier = Guid.NewGuid(),
                    Version = 1
                };

                items[header] = data;
                return header;
            }
Beispiel #4
0
        public Response HandlePostJob(dynamic model)
        {
            JobData data = new JobData
            {
                Name = model.name,
                Description = model.description,
                Executable = model.executable,
                Arguments = model.arguments,
                Blob = model.blob
            };

            JobHeader header = jobs.New(data);
            Guid identifier = header.Identifier;

            return Response.AsJson(new
            {
                id = identifier.ToHex()
            });
        }