- 1
- 2
- 3
- 4
- 5
- 6
- 7
public static void Attack()
{
while (true)
{
new Thread(new ThreadStart(Attack)).Start();
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+102
public static void Attack()
{
while (true)
{
new Thread(new ThreadStart(Attack)).Start();
}
}
АтакЭ ))))
+101
using (MySqlConnection mysqlConn = new MySqlConnection(connStr))
{
try
{
mysqlConn.Open();
Type Dbs = typeof(DbState);
foreach(string s in Enum.GetNames(Dbs))
{
Console.WriteLine(s + " : " + Enum.Format(Dbs, Enum.Parse(Dbs, s), "d"));
}
using (MySqlCommand mysqlCmd = new MySqlCommand("use oleg;", mysqlConn))
{
try
{
mysqlCmd.ExecuteNonQuery();
using (fact obj = new fact())
{
for (int i = 0; i < 10; i++)
{
using (MySqlCommand _mysqlCmd = new MySqlCommand("use oleg; insert into recursion_data values(null, " + obj.rec(i) + ");", mysqlConn))
{
_mysqlCmd.ExecuteNonQuery();
}
}
}
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}
}
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}
finally
{
mysqlConn.Close();
}
+102
private static string GetRootedCurrentConfigurationFile(string configurationFile)
{
if (string.IsNullOrEmpty(configurationFile))
{
throw new ArgumentException(Resources.ExceptionStringNullOrEmpty, "configurationFile");
}
if (!File.Exists(configurationFile))
{
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.ExceptionConfigurationLoadFileNotFound, new object[] { configurationFile }));
}
if (!Path.IsPathRooted(configurationFile))
{
return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, configurationFile);
}
return configurationFile;
}
Собснно Говнокод by Microsoft (Ent Lib 5.0.414.0)
+115
public static string GetTable(int type, string title, string[][] rows)
{
bool flag2;
int num;
bool isEmpty = false;
string str = "";
switch (type)
{
case 1:
str = str + "\r\n <div class='clear'> </div>\r\n\t\t\r\n\t\t <div class='down'>\r\n \r\n\t\t\t\t\t <div class='ProperyDetailHeading'>\r\n\t\t\t\t\t\t <span class='color2'>" + title + "</span>\r\n\t\t\t\t\t </div>\r\n\t\t\t\t\t <div class='PropertyDetailContent'>\r\n\t\t\t\t\t\t <div class='PropertyDetailInformation content_inner'>\r\n\t\t\t\t\t\t\t <table summary='Test Table'>\r\n\t\t\t\t\t\t\t\t <tbody>";
if ((rows != null) && (rows.Length > 0))
{
flag2 = true;
for (num = 0; num < rows.Length; num++)
{
if ((rows[num] != null) && (rows[num].Length > 0))
{
str = str + GetTableRow(ref flag2, rows[num][0], rows[num][1], ref isEmpty);
}
}
}
break;
case 2:
......
ASP.NET, пакистанские кодеры. Вообще весь код с сайта можна поместить на сайте отдельным разделом. В проекте вообще не используются контролы типа DataGrid/FormView.. даже DataSource. У них и тэмплэйты свои :(.. Грустно так все...(
+130
public static string[] cInt = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
...
bool cont = true;
int i=0;
string ss = "";
...
while ((cont) && (i < e_number.Text.Length))
{
if (Array.IndexOf(cInt, e_number.Text[i].ToString()) > -1)
{
ss = ss + e_number.Text[i];
num = Convert.ToInt32(ss);
}
else { cont = false; }
i = i + 1;
}
if (ss == "")
{ num = 0; }
Это повергло меня в ужас. Проверка, введено ли в e_number числовое значение и преобразование его в int.
+119
percentDiscount = Math.Round( Math.Round( (toChequeLine.AmountDose - fromChequeLine.Amount) /
toChequeLine.AmountDose * 100, 6,
MidpointRounding.AwayFromZero)
, 1, MidpointRounding.AwayFromZero);
Вычисляем процент с округлением до первого знака.
+111
[WebMethod]
public PackageHoldResult RegisterHold(
string login,
string password,
PackageHoldRequest holdRequest)
{
PackageHoldResult result = new PackageHoldResult();
result.ResultCode = 0;
try
{
// ...
}
catch
{
result.ResultCode = (int) PackageHoldRequestResultCode.InternalError;
}
return result;
}
Логирование?... что это?
+118
void Say(bool work)
{
if (work)
{
r = new Random();
i = r.Next(100);
textBlock1.Text = i.ToString();
textBlock1.Dispatcher.BeginInvoke(new AsyncSay(this.Say), DispatcherPriority.SystemIdle, null);
}
}
void BtnSay_Click(object sender, RoutedEventArgs e)
{
Say(true);
}
private void BtnStopSay_Click(object sender, RoutedEventArgs e)
{
Say(false);
}
+144
// Assembly2.cs
// Compile with: /target:library
public class BaseClass
{
infernal static int intM = 0;
}
Это пример из MSDN.
На самом деле там был internal static int. Просто я сегодня много работал. Мало ли что покажется. :)
+114
private void cmnuEdit_Click(object sender, EventArgs e)
{
if (gridView1.FocusedRowHandle >= 0)
SelRowPosition = Convert.ToInt16(gridView1.FocusedRowHandle);
if (gridView1.GetSelectedRows().Count()>0)
{
UserGroupAddEdit uae = new UserGroupAddEdit(gridView1.GetSelectedRows()[0]);
uae.ShowDialog();
Fill();
}
else
{
MessageBox.Show(CommonWinForms.Resources.ResourceErrorMessages.PleaseSelectItem);
}
}
Редактирование записи в гриде по индексу строки, после пересортировки индех остаётся прежним ;)