- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
static /*public*/ string GenerateRandomJpegName()
{
return GenerateRandomString() + ".jpg";
}
static string GenerateRandomString()
{
bool UseSigns = true;
bool UseUpperLetters = true;
bool UseLetters = true;
int Length;
NewLabel:
try
{
Length = new Random(DateTime.Now.Millisecond - DateTime.Now.Second + new Random(DateTime.Now.Millisecond).Next(0, 100) / new Random(DateTime.Now.Millisecond - DateTime.Now.Second).Next(0, 10)).Next(0, 100);
}
catch { goto NewLabel; }
string result = "C:/";
try
{
int Seed = 0;
char[] letters = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
char[] signs = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
List<char> keyWords = new List<char>();
List<char> upperLetters = new List<char>();
foreach (char c in letters)
upperLetters.Add(Convert.ToChar(c.ToString().ToUpper()));
if (UseLetters)
foreach (char c in letters)
keyWords.Add(c);
if (UseSigns)
foreach (char c in signs)
keyWords.Add(c);
if (UseUpperLetters)
foreach (char c in upperLetters)
keyWords.Add(c);
int MaxValue = keyWords.Count;
for (int i = 0; i <= Length; i++)
{
try
{
Random mainrand = new Random(Seed);
char RandChar = keyWords[mainrand.Next(0, MaxValue)];
result += RandChar;
Seed += DateTime.Now.Millisecond + Seed - new Random().Next(10) + new Random(DateTime.Now.Millisecond + 800 * 989 / 3).Next(10);
}
catch { continue; }
}
}
catch { }
return result;
}