Public String gefilename (string type)
{
// 4 + months 2 + days 2 + hours 2 + minutes 2 + seconds 2 + milliseconds 3 + 8-bit random number
String year = datetime. Now. year. tostring ();
String month = datetime. Now. Month. tostring ();
If (month. Length <2) {month = "0" + month ;}
String day = datetime. Now. Day. tostring ();
If (day. Length <2) {day = "0" + day ;}
String hour = datetime. Now. Hour. tostring ();
If (hour. Length <2) {hour = "0" + hour ;}
String minute = datetime. Now. Minute. tostring ();
If (minute. Length <2) {minute = "0" + minute ;}
String second = datetime. Now. Second. tostring ();
If (second. Length <2) {second = "0" + second ;}
String millisecond = datetime. Now. millisecond. tostring ("000 ");
// An 8-bit random number
Random rad = new random ();
Int value = rad. Next (10000000,100 1000000 );
String filename = year + month + day + hour + minute + second + millisecond + value. tostring () + type;
Return filename;
}