Ejemplo n.º 1
0
 internal static ResourceFileModel FromDto(ResourceFileDto dto)
 {
     return(new ResourceFileModel
     {
         Id = dto.Id,
         Path = dto.Path,
         Sha1 = dto.Sha1,
         Size = dto.Size,
         UpdateDate = dto.UpdateDate,
     });
 }
Ejemplo n.º 2
0
        public static async Task <(int TimeStamp, List <ResourceFileDto> Dtos)> GetResourceUpdatedFilesAsync(int resourceId, int timestamp = 0)
        {
            var json = await client.GetStringAsync($"api/?q=lsfile&resid={Util.Int2Csid(resourceId)}&t={timestamp}");

            dynamic dyna           = JsonConvert.DeserializeObject(json);
            var     lastFileChange = (int)dyna.t;
            var     dtos           = new List <ResourceFileDto>();

            foreach (var o in dyna.r)
            {
                var model = new ResourceFileDto
                {
                    Id         = (int)o.id,
                    Size       = (int)o.s,
                    Path       = ((string)o.p).Replace('/', '\\').TrimStart('\\'),
                    Sha1       = (string)o.h,
                    UpdateDate = (int)o.t,
                    Status     = (int)o.d,
                };
                dtos.Add(model);
            }
            return(lastFileChange, dtos);
        }