private void gen_tmp(BinType type)
        {
            Image_header header = new Image_header();

            switch (type)
            {
            case BinType.BOOTLOADER:
                header.dest_addr = 0xf8000000;
                break;

            case BinType.BIN:
                header.dest_addr = 0x0;
                break;

            default:
                throw new Exception("BinType err\n");
            }
            if (type == BinType.BOOTLOADER)
            {
                tool.BuildPackage(header, bootload_file, tmp_blf);
            }
            if (type == BinType.BIN)
            {
                tool.BuildPackage(header, bin_file, tmp_bin);
            }
        }
Exemplo n.º 2
0
        public List <BinType> GetAllBinTypes()
        {
            try
            {
                List <LUT_BinType> dbBinTypes = this.db.LUT_BinType.ToList();

                List <BinType> binTypes = new List <BinType>();

                foreach (LUT_BinType dbBin in dbBinTypes)
                {
                    BinType binType = new BinType()
                    {
                        binTypeId            = dbBin.BinTypeId,
                        binTypeDesc          = dbBin.BinTypeDesc,
                        capacity             = dbBin.Capacity,
                        binTrashDisposalArea = dbBin.BinTrashDisposalArea
                    };

                    binTypes.Add(binType);
                }

                return(binTypes);
            }
            catch (Exception ex)
            {
                throw ErrorHandler.Handle(ex, this);
            }
        }
Exemplo n.º 3
0
 public SplitComputer(string featureName, int numBins, BinType binType)
 {
     _featureName = featureName;
     _binType     = binType;
     _numBins     = numBins;
     _data        = new Dictionary <int, BinInfo[]>();
 }
Exemplo n.º 4
0
 public static Bin Create(GPSLocation gpsLocation, BinType binTypes, bool collectionReady)
 {
     return(new Bin
     {
         GPSLocation = gpsLocation,
         BinType = binTypes,
         CollectionReady = collectionReady,
     });
 }
Exemplo n.º 5
0
 internal DataSetInfo()
 {
     Files     = ImmutableList <IFileSystemInfo> .Empty;
     Bias      = ImmutableList <IFileSystemInfo> .Empty;
     Dark      = ImmutableList <IFileSystemInfo> .Empty;
     OutFolder = "calibrated";
     Suffix    = "_calib";
     Bin       = BinType.NoBin;
 }
Exemplo n.º 6
0
        private void BinTypepicker_SelectedIndexChanged(object sender, EventArgs e)
        {
            var picker        = (Picker)sender;
            int selectedIndex = picker.SelectedIndex;

            if (selectedIndex >= 0)
            {
                BinType selected = (BinType)picker.SelectedItem;
                model.BinTypeCode = selected.Code;
            }
        }
Exemplo n.º 7
0
 public void BinTypesIsLoaded(ZoneViewModel zvm)
 {
     bintypepicker.ItemsSource = model.BinTypes;
     if (!string.IsNullOrEmpty(model.BinTypeCode))
     {
         List <BinType> list = new List <BinType>(model.BinTypes);
         BinType        bt1  = list.Find(x => x.Code == model.BinTypeCode);
         if (bt1 is BinType)
         {
             bintypepicker.SelectedItem = bt1;
         }
     }
 }
        public async Task <ActionResult <BinTypeDto> > CreateBinType(CreateBinTypeDto createBinTypeDto)
        {
            var binType = new BinType
            {
                TypeName = createBinTypeDto.TypeName
            };

            _binTypeRepository.AddBinType(binType);

            if (await _binTypeRepository.SaveAllAsync())
            {
                return(Ok(_mapper.Map <BinTypeDto>(binType)));
            }

            return(BadRequest("Failed to add bin type."));
        }
Exemplo n.º 9
0
        private async Task LoadBinTypesList()
        {
            List <BinType> loadedbintypes = await NAV.GetBinTypeList(1, int.MaxValue, ACD.Default).ConfigureAwait(true);

            if ((!IsDisposed) && (loadedbintypes is List <BinType>))
            {
                BinTypes.Clear();
                foreach (BinType bintype in loadedbintypes)
                {
                    BinTypes.Add(bintype);
                }
                BinType finded = BinTypes.Find(x => x.Code == BinTypeCode);
                if (finded is BinType)
                {
                    SelectedBinType = finded;
                }
            }
        }
Exemplo n.º 10
0
        public string ReadBinTypeCsvFile()
        {
            try
            {
                List <BinType> result  = new List <BinType>();
                StreamReader   sr      = new StreamReader(@"Assets/BinTypeCsv.csv");
                string         strLine = string.Empty;
                string[]       value   = null;
                int            x       = -1;
                while (!sr.EndOfStream)
                {
                    x++;
                    strLine = sr.ReadLine();
                    value   = strLine.Split(',');
                    if (x > 0 && value.Length == 2)
                    {
                        var binType = new BinType();
                        binType.Id       = Int32.Parse(value[0]);
                        binType.TypeName = value[1];

                        result.Add(binType);
                    }
                }

                _db.BinTypes.AddRange(result);
                _db.SaveChanges();

                GC.Collect();


                int counter = _db.BinTypes.Count();
                if (counter < 10)
                {
                    return("Process error less than 10 records");
                }

                return("Completed");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Exemplo n.º 11
0
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
        public DataSetInfo(Options opts)
        {
            Bin = Enum.IsDefined(typeof(BinType), opts.Bin)
                ? (BinType)(opts.Bin)
                : throw new ArgumentException("Invalid binning type.", nameof(opts));
            OutFolder = opts.OutFolder;
            Suffix    = opts.Suffix;

            if (opts.Darks?.Any() ?? false)
            {
                Dark =
                    (from glob in opts.Darks
                     from desc in Ganss.IO.Glob.Expand(glob)
                     select desc).ToImmutableList();
            }

            if (opts.Bias?.Any() ?? false)
            {
                Bias =
                    (from glob in opts.Bias
                     from desc in Ganss.IO.Glob.Expand(glob)
                     select desc).ToImmutableList();
            }

            var darkPattern = Dark is null && !string.IsNullOrWhiteSpace(opts.DarkPattern)
                ? new Regex(opts.DarkPattern)
                : null;
            var biasPattern = Bias is null && !string.IsNullOrWhiteSpace(opts.BiasPattern)
                ? new Regex(opts.BiasPattern)
                : null;

            var darkBuilder = darkPattern is null
                ? null
                : ImmutableList.CreateBuilder <IFileSystemInfo>();
            var biasBuilder = darkPattern is null
                ? null
                : ImmutableList.CreateBuilder <IFileSystemInfo>();
            var filesBuilder = ImmutableList.CreateBuilder <IFileSystemInfo>();

            foreach (var item in
                     from glob in opts.Files
                     from desc in Ganss.IO.Glob.Expand(glob)
                     select desc)
            {
                if (darkPattern?.IsMatch(item.Name) ?? false)
                {
                    darkBuilder?.Add(item);
                }
                else if (biasPattern?.IsMatch(item.Name) ?? false)
                {
                    biasBuilder?.Add(item);
                }
                else if ((Dark?.Any(x => x.FullName == item.FullName) ?? false) ||
                         (Bias?.Any(x => x.FullName == item.FullName) ?? false))
                {
                    Console.Error.WriteLine($"File {item.FullName} is present in calibrations, omitting...");
                }
                else
                {
                    filesBuilder.Add(item);
                }
            }

            Files = filesBuilder.ToImmutable();
            Dark ??= darkBuilder?.ToImmutable() ?? ImmutableList <IFileSystemInfo> .Empty;
            Bias ??= biasBuilder?.ToImmutable() ?? ImmutableList <IFileSystemInfo> .Empty;
        }
Exemplo n.º 12
0
 public BinTypeVM(BinType key)
 {
     Key = key;
 }
Exemplo n.º 13
0
 private BinTypesBuilder()
 {
     _binTypes = new BinType();
 }
 public void AddBinType(BinType binType)
 {
     _context.BinTypes.Add(binType);
 }
 public void DeleteBinType(BinType binType)
 {
     _context.BinTypes.Remove(binType);
 }
Exemplo n.º 16
0
 public BinTypeVM(BinType key)
 {
     Key = key;
 }
 public void UpdateBinType(BinType binType)
 {
     _context.Entry(binType).State = EntityState.Modified;
 }