Example #1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomTransparencySoftwareSerializer">A delegate to serialize custom transparency software JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <TransparencySoftware> CustomTransparencySoftwareSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("name", Name),
                new JProperty("version", Version),
                new JProperty("legal_status", LegalStatus.ToString()),
                new JProperty("open_source_license", OpenSourceLicense.ToString()),
                new JProperty("vendor", Vendor),

                Logo.HasValue
                               ? new JProperty("logo", Logo.ToString())
                               : null,

                HowToUse.HasValue
                               ? new JProperty("how_to_use", HowToUse.ToString())
                               : null,

                MoreInformation.HasValue
                               ? new JProperty("more_information", MoreInformation.ToString())
                               : null,

                SourceCodeRepository.HasValue
                               ? new JProperty("source_code_repository", SourceCodeRepository.ToString())
                               : null

                );

            return(CustomTransparencySoftwareSerializer != null
                       ? CustomTransparencySoftwareSerializer(this, JSON)
                       : JSON);
        }
        private MoreInformation UpdateInformationsList(List <MoreInformation> more, bool bought)
        {
            long HoldLastDate = M.isNull(more.Last().date) ?
                                (long)M.DateTimeToUnixTime(DateTime.Now) //if it Null
                : (long)more.Last().date;                                //if Date has Value

            int HoldNo = M.isNull(more.Last().no) ?
                         1 //if it Null
                : (int)more.Last().no;

            string HoldtypeOfNo = M.isNull(more.Last().typeOfNo) ?
                                  "" //if it Null
                : more.Last().typeOfNo;

            var now = (long)M.DateTimeToUnixTime(DateTime.Now);

            MoreInformation listUpdate = new MoreInformation()
            {
                bought   = bought,
                date     = now,
                lifeTime = now - HoldLastDate,
                typeOfNo = HoldtypeOfNo,
                no       = HoldNo
            };

            return(listUpdate);
        }
 private List <MoreInformation> replaceLast(List <MoreInformation> more, MoreInformation listUpdate)
 {
     try
     {
         more[more.Count - 1] = listUpdate;
         return(more);
     }
     catch (Exception ex) { throw new AppException("Exception:", ex);; }
 }
 public static PackageResult KnownReplacement(string name, MoreInformation moreInformation)
 {
     return(new PackageResult()
     {
         PackageName = name,
         Dependencies = new PackageResult[0],
         SupportType = SupportType.KnownReplacementAvailable,
         MoreInformation = moreInformation
     });
 }
        private List <MoreInformation> UpdateInformationsAdd(List <MoreInformation> more)
        {
            int    HoldNo       = (int)more.Last().no;
            string HoldtypeOfNo = more.Last().typeOfNo;
            var    now          = (long)M.DateTimeToUnixTime(DateTime.Now);

            MoreInformation listUpdate = new MoreInformation()
            {
                bought   = more.Last().bought,
                date     = now,
                typeOfNo = HoldtypeOfNo,
                no       = HoldNo,
                lifeTime = 0
            };

            return(replaceLast(more, listUpdate));
        }
        private List <MoreInformation> UpdateLifetimeanddate(List <MoreInformation> more, int lastDateBy = 1)
        {
            int    HoldNo       = (int)more.Last().no;
            string HoldtypeOfNo = more.Last().typeOfNo;
            var    now          = (long)M.DateTimeToUnixTime(DateTime.Now);
            long   HoldLastDate = (long)more[more.Count - lastDateBy].date;

            MoreInformation listUpdate = new MoreInformation()
            {
                bought   = more.Last().bought,
                date     = now,
                typeOfNo = HoldtypeOfNo,
                no       = HoldNo,
                lifeTime = now - HoldLastDate
            };

            return(replaceLast(more, listUpdate));
        }