private void NFCForm_Load(object sender, EventArgs e) { // デザインモードではNFCを動作させない if (DesignMode) { return; } string configPath = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; Console.WriteLine("PATH"); Console.WriteLine(configPath); Console.WriteLine(configPath); Console.WriteLine(configPath); Console.WriteLine(configPath); if (Settings.Default.EnableNativeNfcLog) { string nativeNfcLog = Settings.Default.NativeNfcLog; Debug.WriteLine("Enable Nfc Log"); string fileName = Directory.GetCurrentDirectory() + @"\" + nativeNfcLog; FeliCaNfcDllWrapperClass.FeliCaLibNfcStartLogging(fileName); } Debug.WriteLine("RegisterWindowMessage, message=" + MSG_STR_OF_FIND); cardFindMessage = RegisterWindowMessage(MSG_STR_OF_FIND); if (cardFindMessage == 0) { Console.Error.WriteLine("Failed to register window message, param=" + MSG_STR_OF_FIND); return; } Debug.WriteLine("RegisterWindowMessage, message=" + MSG_STR_OF_ENABLE); cardEnableMessage = RegisterWindowMessage(MSG_STR_OF_ENABLE); if (cardEnableMessage == 0) { Console.Error.WriteLine("Failed to register window message, param=" + MSG_STR_OF_ENABLE); return; } bool result; Debug.WriteLine("initialize nfc library"); result = FeliCaNfcDllWrapperClass.FeliCaLibNfcInitialize(); if (!result) { Console.Error.WriteLine("Failed to nfc initialize library"); DispatchErrorEvent(); DisposeNfc(); return; } StringBuilder portName = new StringBuilder("USB0"); Debug.WriteLine("open nfc usb port, port name=" + portName.ToString()); result = FeliCaNfcDllWrapperClass.FeliCaLibNfcOpen(portName); if (!result) { Console.Error.WriteLine("Failed to nfc open, port_name=" + portName); DispatchErrorEvent(); DisposeNfc(); return; } Debug.WriteLine("set poll callback parameters, msf_str_of_find=" + MSG_STR_OF_FIND + ", msg_str_of_enable=" + MSG_STR_OF_ENABLE); result = FeliCaNfcDllWrapperClass.FeliCaLibNfcSetPollCallbackParameters(this.Handle, MSG_STR_OF_FIND, MSG_STR_OF_ENABLE); if (!result) { Console.Error.WriteLine("Failed to set poll callback parameters, msf_str_of_find=" + MSG_STR_OF_FIND + ", msg_str_of_enable=" + MSG_STR_OF_ENABLE); DispatchErrorEvent(); DisposeNfc(); return; } }