1. C# / Говнокод #23177

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private bool CheckBool(string value)
           {
               if (value == "on")
                   return true;
               else
                   return false;
           }

    ////

    selicate, 12 Июля 2017

    Комментарии (2)
  2. C# / Говнокод #23166

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    public static int[] GetRandomComStats(int level)
        {
            int[] stats = new int[3] { -1, -1, -1 };
            int summ = (int)(1.2f * level);
            int minStat = level / 3f - (level+ 1) / 10 < 0 ? 0 : (int)(level / 3f - (level + 1) / 10);
            int maxStat = (int)(level / 3f + (level + 1) / 10);
            Debug.Log("level: " + level + " min stat: " + minStat + " max stat: " + maxStat + " summ: " + summ);
            int fr = Random.Range(0, 2);
            int f2 = Random.Range(0, 3);
            int f1 = 0;
            stats[f2] = Random.Range(minStat, maxStat + 1);
            for (int i = 0; i < 3; i++)
            {
                if (fr == 1 && stats[i] == -1)
                {
                    if (summ - stats[f2] > maxStat) stats[i] = Random.Range(minStat,  maxStat + 1);
                    else if (summ - stats[f2] < 0) stats[i] = 0;
                    else stats[i] = Random.Range(minStat, summ - stats[f2] + 1);
                    f1 = i;
                    goto label;
                }
                fr = 1;
    
            }
            label: 
            for (int i = 0; i < 3; i++)
            {
                if (stats[i] == -1)
                {
                    if (summ < stats[f1] + stats[f2]) stats[i] = 0;
                    else if (summ - stats[f1] - stats[f2] > maxStat) stats[i] = maxStat;
                    else stats[i] = summ - stats[f1] - stats[f2];
                    Debug.Log(f1 + ": " + stats[f1]+ " " + f2 + ": " + stats[f2] + " " + i + ": " + stats[i]);
                }
            }
            return stats;
        }

    Генерация рандомных стат персонажей в зависимости от уровня.

    Super_Indus_coding, 07 Июля 2017

    Комментарии (1)
  3. C# / Говнокод #23149

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public bool isUnderpayment(double paymentValue)
     {
         if (paymentValue > 0)
             return true;
    
            return false;
      }

    Пятница, смеркалось.

    allex32, 27 Июня 2017

    Комментарии (2)
  4. C# / Говнокод #23138

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    for (int i = 0; i < components.Length; i++) 
    { 
              if (components[i]) components[i].GetComponent<ComponentScript>().ChangeComponent(CalculateCircuitScript.ComponentDataArray[components[i].GetComponent<ComponentScript>().lineNumber, components[i].GetComponent<ComponentScript>().elementNumber]); 
    }

    Конструктор трёхфазных цепей на Unity3D

    Super_Indus_coding, 19 Июня 2017

    Комментарии (0)
  5. C# / Говнокод #23109

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    protected void ASPxUploadControl1_FilesUploadComplete(object sender, DevExpress.Web.ASPxUploadControl.FilesUploadCompleteEventArgs e)
            {
                if (Request.Cookies["LID"] != null)
                {
                    int ListId = Convert.ToInt32(Request.Cookies["LID"].Value);
                    Response.Cookies["LID"].Expires = DateTime.Now.AddDays(-1);
                    foreach (DevExpress.Web.ASPxUploadControl.UploadedFile uf in ASPxUploadControl1.UploadedFiles)
                    {
                        uf.SaveAs(@"C:\TEMP\ListUploads\" + uf.FileName, true);
                        ListInfo.ImportList(Convert.ToInt16(ListId), @"C:\TEMP\ListUploads\" + uf.FileName);
                    }
                }
            }

    блять, это же каким инвалидом надо быть, чтобы так сделать загрузку файла в базу?

    Lokich, 06 Июня 2017

    Комментарии (1)
  6. C# / Говнокод #23086

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    OleDbCommand command = new OleDbCommand("select * from Прейскурант where ID = 1", bd);
                    OleDbDataReader dataReader1 = command.ExecuteReader();
                    string st;
                    dataReader1.Read();
    
                    int i = 0;
    
                    while (i < dataReader1.FieldCount)
                    {
                        st = dataReader1.GetValue(i).ToString();
                        switch (i)
                        {
                            case 0:
                                textBox1.Text = st;
                                break;
                            case 1:
                                textBox2.Text = st;
                                break;
                            case 2:
                                textBox3.Text = st;
                                break;
                            case 3:
                                textBox4.Text = st;
                                break;
                            case 4:
                                textBox5.Text = st;
                                break;
                            case 5:
                                textBox6.Text = st;
                                break;
                            case 6:
                                textBox7.Text = st;
                                break;
                            case 7:
                                textBox8.Text = st;
                                break;
                            case 8:
                                textBox9.Text = st;
                                break;
                            case 9:
                                textBox10.Text = st;
                                break;
                            case 10:
                                textBox11.Text = st;
                                break;
                            case 11:
                                textBox12.Text = st;
                                break;
                            case 12:
                                textBox13.Text = st;
                                break;
                            case 13:
                                textBox14.Text = st;
                                break;
                            case 14:
                                textBox15.Text = st;
                                break;
                        }
                        i++;
    
    
                    }
                    dataReader1.Close();
                    bd.Close();

    Заполнение текстбоксов WinForms данными из бд. Пацан на 4-м курсе.

    IWillBeHokage, 30 Мая 2017

    Комментарии (3)
  7. C# / Говнокод #23076

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    GUI.backgroundColor = Color.magenta;
    
                prop = parametersObject.GetIterator();
                var skip = true;
    
                while (prop.NextVisible(true))
                {
                    //Script object Field
                    if (skip)
                    {
                        skip = false;
                        continue;
                    }
    
                    if (prop.depth == 0)
                    {
                        position.height = propertyHeight;
                        EditorGUI.PropertyField(position, prop);
                        position.y += propertyWithSpaceHeight;
                    }
                }
    
                if (EditorGUI.EndChangeCheck())
                {
                    if (parametersObject != null && parametersObject.targetObject != null)
                    {
                        parametersObject.ApplyModifiedProperties();
                        EditorUtility.SetDirty(parametersObject.targetObject);
                    }
                }
    
                parametersProperty.stringValue = JsonUtility.ToJson(parametersObject.targetObject);
    
                GUI.backgroundColor = Color.white;

    //Код исполняется 60 раз в секунду ((((

    huran438, 28 Мая 2017

    Комментарии (6)
  8. C# / Говнокод #23075

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    GUI.backgroundColor = Color.magenta;
    
                prop = parametersObject.GetIterator();
                var skip = true;
    
                while (prop.NextVisible(true))
                {
                    //Script object Field
                    if (skip)
                    {
                        skip = false;
                        continue;
                    }
    
                    if (prop.depth == 0)
                    {
                        position.height = propertyHeight;
                        EditorGUI.PropertyField(position, prop);
                        position.y += propertyWithSpaceHeight;
                    }
                }
    
                if (EditorGUI.EndChangeCheck())
                {
                    if (parametersObject != null && parametersObject.targetObject != null)
                    {
                        parametersObject.ApplyModifiedProperties();
                        EditorUtility.SetDirty(parametersObject.targetObject);
                    }
                }
    
                parametersProperty.stringValue = JsonUtility.ToJson(parametersObject.targetObject);
    
                GUI.backgroundColor = Color.white;

    //Код исполняется 60 раз в секунду ((((

    huran438, 28 Мая 2017

    Комментарии (2)
  9. C# / Говнокод #23054

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    if (this.btn1.Content.ToString() == this.currentSide.ToString() && this.btn2.Content.ToString() == this.currentSide.ToString() && this.btn3.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn4.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn6.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn7.Content.ToString() == this.currentSide.ToString() && this.btn8.Content.ToString() == this.currentSide.ToString() && this.btn9.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn1.Content.ToString() == this.currentSide.ToString() && this.btn4.Content.ToString() == this.currentSide.ToString() && this.btn7.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn2.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn8.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn3.Content.ToString() == this.currentSide.ToString() && this.btn6.Content.ToString() == this.currentSide.ToString() && this.btn9.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn1.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn9.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn3.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn7.Content.ToString() == this.currentSide.ToString())
    this.Victory();

    Проверка на победу в крестиках-ноликах.

    fedor-analplay, 22 Мая 2017

    Комментарии (2)
  10. C# / Говнокод #22978

    +1412

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    counter++;
                        if (counter == 10)
                        {
                            Console.WriteLine();
                            counter = 0;
                        }

    Не сразу понял, что делает этот код.

    Langnasen_Dora, 07 Мая 2017

    Комментарии (65)