/*Console.SetCursorPosition Method try & catch*/
class TrisClass
{
//definition empty ,,,,,
//variables empty ,,,,,
//controls empty ,,,,,
void draw()
{
string formattext="";
string succsign="{}';
string failsign="..";
int ii,kk,positionx=0,positiony=0;
now=DateTime.Now;
formattext="";
formattext=formattext+"Time:[" + now.ToString("yyyy-MM-dd HH:mm:ss") + "]";
try
{
Console.SetCursorPosition(positionx,positiony+0);
Console.Write(formattext);
}
catch(ArgumentOutOfRangeException e)
{
Console.Clear();
Console.WriteLine(e.Message);
}
for(ii=0; ii<MAPY-1; ii++)
{
formattext="";
for(kk=1; kk<MAPX-1; kk++)
{
if(tris[ii,kk] == 1) formattext=formattext+succsign;
else formattext=formattext+failsign;
}
try
{
Console.SetCursorPosition(positionx,positiony+2+ii);
Console.Write(formattext);
}
catch(ArgumentOutOfRangeException e)
{
Console.Clear();
Console.WriteLine(e.Message);
}
}
formattext="";
formattext=formattext+"Score:[" + score.ToString("0000") + "]";
try
{
Console.SetCursorPosition(positionx,positiony+0);
Console.Write(formattext);
}
catch(ArgumentOutOfRangeException e)
{
Console.Clear();
Console.WriteLine(e.Message);
}
}//end of method
}//end of class
'c# 언어' 카테고리의 다른 글
TrisPackage.Tris/common_init(); (0) | 2021.11.17 |
---|---|
time_tick - keyboard hit(Auto) (0) | 2021.11.16 |
ShowDialog호출시 SubForm에서 데이타 받기(set,get) (0) | 2021.11.10 |
C#에서 <Null String>과 <Empty String> 차이 (0) | 2021.11.05 |
가비지 컬렉션 (Garbage Collection) (0) | 2021.11.03 |