Пример #1
0
        private static FirmwareOption _OptionWork(string hash, long size, string systemId, string id, FirmwareOptionStatus status = FirmwareOptionStatus.Acceptable)
        {
            hash = hash.ToUpperInvariant();

            //confirm that it's been added as a file
            if (!FirmwareFilesByHash.ContainsKey(hash))
            {
                throw new InvalidOperationException("Added option for unregistered file");
            }

            var fo = new FirmwareOption
            {
                SystemId   = systemId,
                FirmwareId = id,
                Hash       = hash,
                Status     = status,
                Size       = size
            };

            FirmwareOptions.Add(fo);

            // first option is automatically ideal
            if (FirmwareOptions.Count == 1 && fo.Status == FirmwareOptionStatus.Acceptable)
            {
                fo.Status = FirmwareOptionStatus.Ideal;
            }

            return(fo);
        }
Пример #2
0
        //adds an acceptable option for a firmware ID to the database
        static FirmwareOption Option(string hash, string systemId, string id, FirmwareOptionStatus status = FirmwareOptionStatus.Acceptable)
        {
            var fo = new FirmwareOption
            {
                systemId   = systemId,
                firmwareId = id,
                hash       = hash,
                status     = status,
            };

            FirmwareOptions.Add(fo);

            //first option is automatically ideal
            if (FirmwareOptions.Count == 1 && fo.status == FirmwareOptionStatus.Acceptable)
            {
                fo.status = FirmwareOptionStatus.Ideal;
            }

            return(fo);
        }
Пример #3
0
        // adds an acceptable option for a firmware ID to the database
        private static FirmwareOption Option(string hash, long size, string systemId, string id, FirmwareOptionStatus status = FirmwareOptionStatus.Acceptable)
        {
            var fo = new FirmwareOption
            {
                SystemId   = systemId,
                FirmwareId = id,
                Hash       = hash,
                Status     = status,
                Size       = size
            };

            FirmwareOptions.Add(fo);

            // first option is automatically ideal
            if (FirmwareOptions.Count == 1 && fo.Status == FirmwareOptionStatus.Acceptable)
            {
                fo.Status = FirmwareOptionStatus.Ideal;
            }

            return(fo);
        }