diff --git a/TIASshot/Config.cs b/TIASshot/Config.cs
index 06ac672..bbbdd92 100644
--- a/TIASshot/Config.cs
+++ b/TIASshot/Config.cs
@@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Web.Configuration;
+using System.Windows.Documents;
using System.Xml;
namespace TIASshot {
@@ -10,10 +13,30 @@
static string configFile = "config.xml";
static XmlDocument doc = new XmlDocument();
+ ///
+ /// 設定ファイルを読み込む
+ ///
public static void Load() {
- doc.Load(configFile);
+ try {
+ doc.Load(configFile);
+ } catch (Exception) {
+ }
}
+ ///
+ /// 設定ファイル読み込み判定
+ ///
+ ///
+ public static bool IsLoaded() {
+ XmlNode node = doc.SelectSingleNode($"//Config");
+ return node != null;
+ }
+
+ ///
+ /// 設定ファイルからfloat値を取得
+ ///
+ ///
+ ///
public static float GetFloat(string param) {
float value = 0.0f;
XmlNode node = doc.SelectSingleNode($"//Config/{param}");
@@ -24,6 +47,11 @@
return value;
}
+ ///
+ /// 設定ファイルからint値を取得
+ ///
+ ///
+ ///
public static int GetInt(string param) {
int value = 0;
XmlNode node = doc.SelectSingleNode($"//Config/{param}");
diff --git a/TIASshot/Lucam.cs b/TIASshot/Lucam.cs
index 18ce235..985946e 100644
--- a/TIASshot/Lucam.cs
+++ b/TIASshot/Lucam.cs
@@ -107,6 +107,11 @@
///
///
public bool Connect() {
+ if (!Config.IsLoaded()) {
+ ErrorMsg = "設定ファイル(Config.xml)の読み込みに失敗しました.\r\n終了します.";
+ return false;
+ }
+
var numCam = dll.LucamNumCameras();
if ( numCam < 1 ) {
ErrorMsg = "カメラが見つかりません.\r\n終了します.";