Config: Add option to specify weighing mode
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Test / Run tests (push) Successful in 2m8s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Test / Run tests (push) Successful in 2m8s
				
			This commit is contained in:
		@@ -1,3 +1,4 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
@@ -5,6 +6,8 @@ using Microsoft.Extensions.Configuration;
 | 
			
		||||
 | 
			
		||||
namespace Elwig.Helpers {
 | 
			
		||||
 | 
			
		||||
    public enum WeighingMode { Gross, Net, Box }
 | 
			
		||||
 | 
			
		||||
    public record struct ScaleConfig {
 | 
			
		||||
        public string Id;
 | 
			
		||||
        public string? Type;
 | 
			
		||||
@@ -41,6 +44,7 @@ namespace Elwig.Helpers {
 | 
			
		||||
        public string DatabaseFile = App.DataPath + "database.sqlite3";
 | 
			
		||||
        public string? DatabaseLog = null;
 | 
			
		||||
        public string? Branch = null;
 | 
			
		||||
        public WeighingMode? WeighingMode;
 | 
			
		||||
        public string? UpdateUrl = null;
 | 
			
		||||
        public bool UpdateAuto = false;
 | 
			
		||||
        public string? SyncUrl = null;
 | 
			
		||||
@@ -74,6 +78,8 @@ namespace Elwig.Helpers {
 | 
			
		||||
            DatabaseLog = log != null ? Path.Combine(Path.GetDirectoryName(FileName) ?? App.DataPath, log) : null;
 | 
			
		||||
            Branch = config["general:branch"];
 | 
			
		||||
            Debug = TrueValues.Contains(config["general:debug"]?.ToLower());
 | 
			
		||||
            var weighing = config["general:weighing"];
 | 
			
		||||
            WeighingMode = weighing != null && Enum.TryParse<WeighingMode>(weighing, true, out var w) ? w : null;
 | 
			
		||||
            UpdateUrl = config["update:url"];
 | 
			
		||||
            UpdateAuto = TrueValues.Contains(config["update:auto"]?.ToLower());
 | 
			
		||||
            SyncUrl = config["sync:url"];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user