using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Concurrent;
using HXX.Scanner.Common;
using HXX.Scanner.Biz.Socket;
namespace HXX.Scanner.Biz
{
///
/// 扫描环境相关
///
public class biz_environment
{
///
/// 根据int参数判断纸张规格
///
///
///
public static PaperSize get_paper_size(int size)
{
PaperSize result;
switch (size)
{
case 3:
result = PaperSize.A3;
break;
case 4:
result = PaperSize.A4;
break;
case 8:
result = PaperSize.K8;
break;
case 16:
result = PaperSize.K16;
break;
default:
result = PaperSize.A4;
break;
}
return result;
}
///
/// 根据纸张规格判断纸张参数
///
///
///
public static Tuple get_paper_size(string size)
{
Tuple result;
switch (size)
{
case "A3":
result = new Tuple(3, PaperSize.A3);
break;
case "A4":
result = new Tuple(4, PaperSize.A4);
break;
default:
result = new Tuple(4, PaperSize.A4);
break;
}
return result;
}
///
/// 判断当前扫描环境(正式扫描还是测试扫描)
///
///
///
public static ScanType get_scan_type(int data)
{
ScanType result;
switch (data)
{
case 0:
result = ScanType.Formal;
break;
case 1:
result = ScanType.Test_From_Web;
break;
case 2:
result = ScanType.Test_3rd_Party;
break;
default:
result = ScanType.Test_Panel_1_Side;
break;
}
return result;
}
///
/// 判断扫单面还是双面
///
///
///
public static bool get_ab(int data)
{
if (data == 1)
{
return false;
}
else
{
return true;
}
}
///
/// 获取客户端专属uuid
///
public static void init_unique_client_id()
{
var key = "unique_client_id";
var id = config_manager.Get(key);
if (string.IsNullOrEmpty(id))
{
id = Guid.NewGuid().ToString();
config_manager.Set(key, id);
}
config_environment.unique_client_id = id;
}
}
}