using System; using System.Drawing; using Arp.Prova.ImageLibrary; using Arp.Prova.CsvLib; using Arp.Prova.PlayLib; using System.IO; // CodeClass public class CodeClass : CodeClass_Base { public static int CodeStart() { //「CodeClass_Base.dll」から開始処理・終了処理を実行 // 開始処理 //StartFuncの中は、ResultFileの実行しているCode名(key名)に変更 int resultCode = StartFunc("01_PC名変更"); if( resultCode == 0 ) { // メイン処理 resultCode = MainFunc(); // 終了処理 resultCode = EndFunc(resultCode); } else if( resultCode == 2 ) { // スキップの場合 resultCode = 0; } return resultCode; } private static int MainFunc() { //↓↓ここからシナリオを記述する↓↓ //設定ファイル(Setting.csv)のパスを指定 string rootPath = GetRootPath(); string sFilePath = Path.Combine(rootPath,"Setting.csv"); //設定ファイル(Setting.csv)の存在確認 if (System.IO.File.Exists(sFilePath)) { //コンピュータ名を取得 string PcName = Environment.MachineName; //取得したコンピュータ名をログビューアに表示 PlayLib.TestLog("コンピュータ名:" + PcName); //設定ファイルから、コンピュータ名をキーに「項目1」の値を取得 string value = CsvLib.GetField(sFilePath, "コンピュータ名", PcName, "項目1"); //値の取得に成功したか if((value != null)) { //取得した値をログに表示 PlayLib.TestLog("項目1:" + value); } else { //エラーメッセージのサンプル MsgBoxShowError("エラーメッセージのサンプルです"); return -1; } } return 0; } }