コード例 #1
0
 public ScanStoreRestImpl(String configFileName, CodeLineScanEvent e)
 {
     try
     {
         CreateScanStoreConfigFileIfNecessary(configFileName, e);
         string text = System.IO.File.ReadAllText(configFileName);
         Settings = Newtonsoft.Json.JsonConvert.DeserializeObject <ScanStoreConfig>(text);
     }
     catch (FileNotFoundException ex)
     {
         throw new ConfigNotFoundException(ex);
     }
 }
コード例 #2
0
ファイル: ScanStoreApi.cs プロジェクト: lulzzz/pos_hardware
 public ScanStoreApi(String configFileName)
 {
     try
     {
         String dir  = AppDomain.CurrentDomain.BaseDirectory;
         string text = System.IO.File.ReadAllText(configFileName);
         Settings = Newtonsoft.Json.JsonConvert.DeserializeObject <ScanStoreConfig>(text);
     }
     catch (FileNotFoundException e)
     {
         throw new ConfigNotFoundException(e);
     }
 }
コード例 #3
0
 private void CreateScanStoreConfigFileIfNecessary(String configFileName, CodeLineScanEvent e)
 {
     if (!System.IO.File.Exists(configFileName) && Utils.IsConfigurationEvent(e))
     {
         var             configData = Utils.ConfigurationData(e);
         var             longUrl    = configData.RetrieveLongUrl();
         ScanStoreConfig settings   = new ScanStoreConfig()
         {
             ClientId        = configData.ClientId,
             AccessKey       = configData.AccessKey,
             BaseUrl         = longUrl,
             ProtocolVersion = configData.ProtocolVersion
         };
         settings.Write(configFileName);
     }
 }