public int CompareTo(FileVersion other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var lastWriteDateComparison = LastWriteDate.CompareTo(other.LastWriteDate);

            if (lastWriteDateComparison != 0)
            {
                return(lastWriteDateComparison);
            }
            return(CreationDate.CompareTo(other.CreationDate));
        }
Exemplo n.º 2
0
 public void Save(string dir, bool random_uuid, bool save_image)
 {
     try
     {
         FsUtils.RecreateDirectory(dir);
         var json = new JObject()
         {
             ["name"]              = Name,
             ["write_counter"]     = WriteCounter,
             ["version"]           = Version,
             ["mii_charinfo_file"] = MiiCharInfoFileName,
             ["first_write_date"]  = FirstWriteDate.ToJSON(),
             ["last_write_date"]   = LastWriteDate.ToJSON(),
             ["id"] = Id.ToJSON(),
         };
         if (!random_uuid)
         {
             var uuid_array = new JArray();
             foreach (var uuid_byte in Uuid)
             {
                 uuid_array.Add(uuid_byte);
             }
             json["uuid"] = uuid_array;
         }
         FsUtils.SaveJSON(Path.Combine(dir, "amiibo.json"), json);
         FsUtils.CreateEmptyFile(Path.Combine(dir, "amiibo.flag"));
         if (save_image)
         {
             FsUtils.SaveFromURL(OriginalAmiibo.ImageURL, Path.Combine(dir, "amiibo.png"));
         }
     }
     catch (Exception ex)
     {
         ExceptionUtils.LogExceptionMessage(ex);
     }
 }