Beispiel #1
0
        /// <summary>
        /// 植物情報(PlantClientInformation.xml)を読み込む
        /// </summary>
        private void StartupPlantClientInformationXmlRead()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Plant_Client_Information));
            StreamReader  sr         = new StreamReader("PlantClientInformation.xml", new UTF8Encoding(false));

            plant_c_info = (Plant_Client_Information)serializer.Deserialize(sr);
            sr.Close();
        }
Beispiel #2
0
        /// <summary>
        /// PlantClientInformation.xml収穫されたときの情報の書き込み
        /// </summary>
        private void HarvestPlantClientInformationXmlWrite(int HPCI_StartUp)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Plant_Client_Information));
            StreamReader  sr         = new StreamReader(s_info.stClientDir + "PlantClientInformation.xml", new UTF8Encoding(false));

            plant_c_info = (Plant_Client_Information)serializer.Deserialize(sr);
            sr.Close();
            plant_c_info.startup = HPCI_StartUp;
            XmlSerializer serializer1 = new XmlSerializer(typeof(Plant_Client_Information));
            StreamWriter  sw          = new StreamWriter(s_info.stClientDir + "PlantClientInformation.xml", false, new UTF8Encoding(false));

            serializer1.Serialize(sw, plant_c_info);
            sw.Close();
        }
Beispiel #3
0
        private void MainWindClosing()
        {
            string exe_name = "plant_client";

            //エラー処理

            while (true)
            {
                if (Process.GetProcessesByName(exe_name).Length >= 1)
                {
                    MessageBox.Show("閉じる(初期化)出来ません。\nplant_client.exeを終了させて下さい。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    break;
                }
            }
            //完全に終了できないときがあるので強制終了する
            watcher.EnableRaisingEvents = false;
            watcher.Dispose();
            //初期化//
            // フォルダを削除する
            Directory.Delete(s_info.stPlantPicturetDir, true);
            Directory.Delete(s_info.stPlantinfoDir, true);
            // フォルダを作成する
            Directory.CreateDirectory(s_info.stPlantPicturetDir);
            Directory.CreateDirectory(s_info.stPlantinfoDir);
            //PlantClientInformation.xmlファイル初期化
            plant_c_info         = new Plant_Client_Information();
            plant_c_info.startup = -2;
            XmlSerializer serializer = new XmlSerializer(typeof(Plant_Client_Information));
            StreamWriter  sw         = new StreamWriter(s_info.stClientDir + "PlantClientInformation.xml", false, new UTF8Encoding(false));

            serializer.Serialize(sw, plant_c_info);
            sw.Close();
            Environment.Exit(0);
        }