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

    −236

    1. 1
    2. 2
    string str = "trial evaluation license agreement expire about... looking for these words? I work like a fool to deliver high quality software and make a living of it and raise my children. Please support me if you want me to continue adding features";
            str = string.Concat(str, str);

    интересненькое из ndepend.core.dll

    reversemyass, 10 Октября 2016

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

    −12

    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
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    using System;
    
    
    namespace Aquapear.StringTools
    {
    	
    	/// <summary> Объединяет строки, вставляя между ними разделитель, но в конце разделитель не ставится. </summary>
    	public static class StringsJoiner
    	{
    		
    		public static String Join(String[] bits, String separator) {
    			/*if(separator.Length==0) {
    				int bitsLength = bits.Length;
    				StringBuilder builder = new StringBuilder(bits.Length);
    					for(int i = 0; i < bitsLength; i++) {
    						builder.AddLast( bits[i] );
    					}
    				return builder.Build();
    			}*/
    			return String.Join(separator, bits);
    			/*
    			int bitsLength = bits.Length;
    
    			if(bitsLength == 0) return "";
    			if(separator.Length==0) return CloseJoin(bits);
    			
    			int allCharsLength = separator.Length*(bits.Length-1);
    			for(int i = 0; i < bitsLength; i++) {
    				allCharsLength += bits[i].Length;
    			}						
    			char[] chrs = new char[allCharsLength];
    			int wordIndex = 0, wordProgress = 0;
    			bool separatorMode = false;
    
    			string word = bits[0];
    			int wordLength = word.Length;
    				
    				for(int i = 0; i < allCharsLength; i++) {
    					if(separatorMode) {
    						chrs[i] = word[wordProgress];
    						wordProgress++;
    						if(wordProgress>=wordLength) {
    							separatorMode = false;
    							wordProgress = 0;
    							word = bits[wordIndex];
    							wordLength = word.Length;
    						}
    
    					} else {
    						chrs[i] = (wordLength >= 1) ? word[wordProgress] : '\0';
    						wordProgress++;
    						if(wordProgress >= wordLength) {
    							separatorMode = true;
    							wordProgress = 0;
    							wordIndex++;
    							if(word.Length == 0) i--;
    							word = separator;
    							wordLength = word.Length;
    						}
    					}
    				}
    			return new String(chrs); */
    		}
    
    
    		static String CloseJoin(String[] bits) {
    			return String.Join("", bits);
    		}
    
    	}
    }

    d_fomenok, 07 Октября 2016

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

    −234

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    Public Class Form1
        Dim x01, x02, f01, f02, f01i, f02i, x11, x12, f12, f11, f11i, f12i, x21, x22, z1, z2, f21, f22, f21i, f22i, x31, x32 As Double
        Dim f31, f32, f31i, f32i, x41, x42, f41, f42, f41i, f42i, x51, x52, f51, f52, f51i, f52i, x61, x62, f61, f62, f61i, f62i, x71, x72 As Double
        Dim f71, f72, f71i, f72i, x81, x82, f81, f82, f81i, f82i, x91, x92, f91, f92, f91i, f92i, x101, x102, f101, f102, f101i, f102i, x111, x112, f111, f112, f111i, f112i, x121, x122 As Double
        Dim f121, f122, f121i, f122i, x131, x132, f131, f132, f131i, f132i, x141, x142, f141, f142, f141i, f142i, x151, x152, f151, f152, f151i, f152i, x161, x162, f161, f162, f161i, f162i, x171, x172 As Double
        Dim f171, f172, f171i, f172i, x181, x182, f181, f182, f181i, f182i, x191, x192, f191, f192, f191i, f192i, x201, x202, f201, f202, f201i, f202i, x211, x222, f211, f212, f211i, f212i, x221, x212, f221, f222, f221i, f222i, x231, x232 As Double
        Dim f231, f232, f231i, f232i, x241, x242, f241, f242, f241i, f242i, x251, x252, f251, f252, f251i, f252i, x261, x262, f261, f262, f261i, f262i, x271, x272, f271, f272, f271i, f272i, x281, x282, f281, f282, f281i, f282i, x291, x292 As Double
        Dim f291, f292, f291i, f292i, x301, x302, f301, f302, f301i, f302i, x311, x312, f311, f312, f311i, f312i, x321, x322 As Double
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            x01 = TextBox1.Text
            x02 = TextBox2.Text
     
            f01 = x01 - 0.5 * Math.Sin(0.3 * Math.Cos(x01) / 3) - 1
            f02 = -x02 + 0.3 * Math.Cos((0.5 * Math.Sin(x02 / 3) + 1))
            f01i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x01)) / 3) * Math.Sin(x01)
            f02i = 1 + (0.3 * Math.Sin(0.5 * Math.Sin(x02)) / 3) * (Math.Cos(x02) / 3) * 0.5 / 3
            x11 = x01 + f01 / f01i
            x12 = x02 + f02 / f02i
     
            Label7.Text = "x11= " & x11
            Label8.Text = "x12= " & x12
     
     
            f11 = x11 - 0.5 * Math.Sin(0.3 * Math.Cos(x11) / 3) - 1
            f12 = -x12 + 0.3 * Math.Cos((0.5 * Math.Sin(x12 / 3) + 1))
            f11i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x11)) / 3) * Math.Sin(x11)
            f12i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x12)) / 3) * (Math.Cos(x12) / 3) * 0.5 / 3
            x21 = x11 + f11 / f11i
            x22 = x12 + f12 / f12i
            Label9.Text = "x21= " & x21
            Label10.Text = "x22= " & x22
     
     
     
            f21 = x21 - 0.5 * Math.Sin(0.3 * Math.Cos(x21) / 3) - 1
            f22 = -x22 + 0.3 * Math.Cos((0.5 * Math.Sin(x22 / 3) + 1))
            f21i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x21)) / 3) * Math.Sin(x21)
            f22i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x22)) / 3) * (Math.Cos(x22) / 3) * 0.5 / 3
            x31 = x21 + f21 / f21i
            x32 = x22 + f22 / f22i
            Label15.Text = "x31= " & x31
            Label16.Text = "x32= " & x32
     
     
     
            f31 = x31 - 0.5 * Math.Sin(0.3 * Math.Cos(x31) / 3) - 1
            f32 = -x32 + 0.3 * Math.Cos((0.5 * Math.Sin(x32 / 3) + 1))
            f31i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x31)) / 3) * Math.Sin(x31)
            f32i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x32)) / 3) * (Math.Cos(x32) / 3) * 0.5 / 3
            x41 = x31 + f31 / f31i
            x42 = x32 + f32 / f32i
            Label17.Text = "x41= " & x41
            Label18.Text = "x42= " & x42
     
     
     
            f41 = x41 - 0.5 * Math.Sin(0.3 * Math.Cos(x41) / 3) - 1
            f42 = -x42 + 0.3 * Math.Cos((0.5 * Math.Sin(x42 / 3) + 1))
            f41i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x41)) / 3) * Math.Sin(x41)
            f42i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x42)) / 3) * (Math.Cos(x42) / 3) * 0.5 / 3
            x51 = x41 + f41 / f41i
            x52 = x42 + f42 / f42i
            Label19.Text = "x51= " & x51
            Label20.Text = "x52= " & x52
     
     
     
            f51 = x51 - 0.5 * Math.Sin(0.3 * Math.Cos(x51) / 3) - 1
            f52 = -x52 + 0.3 * Math.Cos((0.5 * Math.Sin(x52 / 3) + 1))
            f51i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x51)) / 3) * Math.Sin(x51)
            f52i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x52)) / 3) * (Math.Cos(x52) / 3) * 0.5 / 3
            x61 = x51 + f51 / f51i
            x62 = x52 + f52 / f52i
            Label21.Text = "x61= " & x61
            Label22.Text = "x62= " & x62
     
     
            f61 = x61 - 0.5 * Math.Sin(0.3 * Math.Cos(x61) / 3) - 1
            f62 = -x62 + 0.3 * Math.Cos((0.5 * Math.Sin(x62 / 3) + 1))
            f61i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x61)) / 3) * Math.Sin(x61)
            f62i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x62)) / 3) * (Math.Cos(x62) / 3) * 0.5 / 3
            x71 = x61 - f61 / f61i
            x72 = x62 + f62 / f62i
            Label23.Text = "x61= " & x71
            Label24.Text = "x62= " & x72
     
     
            f71 = x71 - 0.5 * Math.Sin(0.3 * Math.Cos(x71) / 3) - 1
            f72 = -x62 + 0.3 * Math.Cos((0.5 * Math.Sin(x72 / 3) + 1))
            f71i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x71)) / 3) * Math.Sin(x71)
            f72i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x72)) / 3) * (Math.Cos(x72) / 3) * 0.5 / 3
            x81 = x71 + f71 / f71i
            x82 = x72 - f72 / f72i
            Label25.Text = "x81= " & x81
            Label26.Text = "x82= " & x82
     
     
     
            f81 = x81 - 0.5 * Math.Sin(0.3 * Math.Cos(x81) / 3) - 1
            f82 = -x82 + 0.3 * Math.Cos((0.5 * Math.Sin(x82 / 3) + 1))

    cyberforum.ru/pascalabc/thread844601.html

    d_fomenok, 07 Октября 2016

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

    +99

    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
    // enum WithdrawalRequestStatus {... }
    
    // WithdrawalRequestStatus withdrawalRequestStatus = [...]
    
     switch (Convert.ToInt32(withdrawalRequestStatus))
                        {
                            case 0:
                                requestStatus = "New";
                                break;
                            case 1:
                                requestStatus = "Canceled";
                                break;
                            case 2:
                                requestStatus = "Rejected";
                                break;
                            case 3:
                                requestStatus = "Additional Info Required";
                                break;
                            case 4:
                                requestStatus = "Ready For Approval";
                                break;
                            case 5:
                                requestStatus = "Approved For Payout";
                                break;
                            case 6:
                                requestStatus = "Paid Out";
                                break;
                        }

    cowpoo, 02 Сентября 2016

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

    +102

    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
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    string sql = "select " + (sender == sbFind_Phone ? "distinct " : "") +
    									 "orders.id, orders.dat_add, users.family, orders.status, " +
    									 "clients.name, clients.phone, " +
    									 "orders.adress, orders.note_adress, orders.dat, orders.time_, orders.\"SUM\", orders.skidka, " +
    									 "factories.name, " +
    									 "drivers.family || ' ' || drivers.name, orders.actions, " +
    									 "orders.pay, orders.enter, clients.note, orders.website " + // website: 0 - сайт 1, 1 - сайт 2
    									 (
    										 bPrimeCost || bRolly ? ", orders.subitems || ';' || orders.actions || ';' " : ""
    										 ) +
    									 "from orders " +
    									 "left outer join users     on users.id     = orders.id_user_in " +
    									 "left outer join clients   on clients.id   = orders.id_client " +
    									 "left outer join factories on factories.id = orders.factory " +
    									 "left outer join drivers   on drivers.id   = orders.driver " +
    									 (
    										 bFrom_Site ? //---- поиск заказов с сайта ---------
    											 "where factory = " + Factorys[cbFactories.SelectedIndex - 1].id.ToString()
    											 : sender == sbMobil ? //---- поиск заказов, поступивших с моб./устройств
    												 "where '" + (bDataDelivery
    													 ? dataFrom.ToShortDateString() + "'<= dat     and dat     < '" + dtTo.AddDays(1).ToShortDateString() + "'"
    													 : // дата доставки попадает в интервал      или
    													 dataFrom.ToShortDateString() + "'<= dat_add and dat_add < '" + dtTo.AddDays(1).ToShortDateString() +
    													 "'" // дата приема заказа попадает в интервал
    													 ) +
    												 "  and (orders.note_adress containing 'Android' or orders.note_adress containing 'IOS')"
    												 : sender == sbFind_Phone ? //---- поиск по номеру телефона ------
    													 "where orders.id_client = " + ((id_client_Phone as int?)?.ToString() ?? "0")
    													 : sender == sbFind_Order // так быстрее
    														 ? //---- поиск заказов по номеру -------
    														 "where orders.id in (" + sOrders + ")"
    														 : "where '" + //---- поиск заказов по фильтрам  ----
    															 (bDataDelivery
    																 ? dataFrom.ToShortDateString() + "'<= dat     and dat     < '" + dtTo.AddDays(1).ToShortDateString() +
    																	 "'"
    																 : // дата доставки попадает в интервал      или
    																 dataFrom.ToShortDateString() + "'<= dat_add and dat_add < '" + dtTo.AddDays(1).ToShortDateString() +
    																 "'" // дата приема заказа попадает в интервал
    																 )
    															 + //---- вид оплаты --------------------
    															 (!chPayNal.Checked ? " and orders.pay != 0 " : "") + //  0 - нал.
    															 (!chPayOnl.Checked ? " and orders.pay != 1 " : "") + //  1 - онлайн
    															 (!chPayMt.Checked ? " and orders.pay != 3 " : "") + //  3 - моб/терминал
    															 (!chPayNull.Checked ? " and orders.pay != 2 " : "") //  2 - б/о
    
    															 + //---- откуда поступил ---------------
    															 (!chFromPhone.Checked ? " and orders.enter != 0 " : "") + //  0 - телефон
    															 (!chFromSite.Checked ? " and orders.enter != 1 " : "") + //  1 - сайт
    															 (!chFromClub.Checked ? " and orders.enter != 2 " : "") //  2 - delivery club
    															 +
    															 (rbTake.Checked
    																 ? " and orders.status = 0"
    																 : // принят
    																 rbKitchen.Checked
    																	 ? " and orders.status = 1"
    																	 : // на кухне
    																		 //                  rbReady.Checked ?   " and orders.status = 2":          // готов     - убрал, не хватает места
    																	 rbShip.Checked
    																		 ? " and orders.status = 3"
    																		 : // в пути
    																			 //                  rbDelive.Checked ?  " and orders.status = 4":          // доставлен - убрал, не хватает места
    																		 rbPay.Checked
    																			 ? " and orders.status = 5"
    																			 : // оплачен
    																			 rbCancel.Checked ? " and orders.status = 6" : "" // отменен
    																 )
    															 + // производство
    															 (cbFactories.SelectedIndex <= 0
    																 ? ""
    																 : " and factory = " + Factorys[cbFactories.SelectedIndex - 1].id.ToString()
    																 )
    															 + // акция
    															 (cbActions.SelectedIndex <= 0
    																 ? ""
    																 : " and substring(actions from 1 for " +
    																	 Actions[cbActions.SelectedIndex - 1].id.ToString().Length.ToString() + ") = '"
    																	 + Actions[cbActions.SelectedIndex - 1].id.ToString() + "'"
    																 )
    															 + // манагеры
    															 (cbManagers.SelectedIndex <= 0
    																 ? ""
    																 : " and orders.id_user_in = " + Managers[cbManagers.SelectedIndex - 1].id.ToString()
    																 )
    															 + // водители
    															 (cbDrivers.SelectedIndex <= 0
    																 ? ""
    																 : " and orders.driver = " + Drivers[cbDrivers.SelectedIndex - 1].id.ToString()
    																 )
    															 + // сайт заказа: первый(0) или второй(1)
    															 (rbSiteAll.Checked
    																 ? ""
    																 : " and orders.website = " +
    																	 (rbSitePirogu.Checked ? FLogo.LOGO_1 : FLogo.LOGO_2).ToString()
    																 )
    );

    Абсолютно коричневый код одного пожилого разработчика с 20-летним стажем и кандидатской степенью (прямо в классе формы).

    BigRussianSOS, 27 Августа 2016

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

    −256

    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
    var handler = new HttpClientHandler
    {
        Proxy = usingProxy ? new WebProxy(proxyURI) : null,
        UseProxy = usingProxy,
        UseCookies = true,
        CookieContainer = new CookieContainer()
    };
    
    if (session != null)
    {
        handler.CookieContainer.Add(new Uri(URL), new Cookie("PHPSESSID", session));
    }
    
    using (var client = new HttpClient(handler))
    {
        var content = new FormUrlEncodedContent(postParams);
        var responseTask = client.PostAsync(url, content);
        responseTask.Wait();
    
        var responseStringTask = responseTask.Result.Content.ReadAsStringAsync();
        responseStringTask.Wait();
    
        var cookies = handler.CookieContainer.GetCookies(new Uri(URL));
        session = cookies["PHPSESSID"].Value;
    
        return responseStringTask.Result;
    }

    Синхронный асинхронный код.

    Antibagor_100, 19 Августа 2016

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

    −320

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    string Char2Hex(char ch)
    {
    	StringWriter w = new StringWriter();
    	w.Write("\\u{0:x4}", (int)ch);
    	return w.ToString();
    }

    d_fomenok, 19 Августа 2016

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

    +366

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    var organizations =
                test.ExtensionInformation.Cast<object>()
                .Select(ext => ext as GenericPair<string, string>)
                .Where(pair => pair.first == "{$idSenderOrganization}")
                .Where(pair =>
                           {
                               int o_O;
                               return int.TryParse(pair.second, out o_O);
                           })
                .Select(_ => int.Parse(_.second));

    laMer007, 19 Августа 2016

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

    +9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    var actualCharCount = DisplayCharactersCount;
    while (DisplayCharactersCount != actualCharCount)
      {
        Thread.Sleep(500);
      }

    и такое бывает

    ewenso, 12 Августа 2016

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

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    bool shift = keys.Shift;
    
    if (keys.Control)
    {
    	return SelectNextControl(shift ? false : true);
    }

    Телерик опять жжот. Цветёт и пахнет.

    kerman, 10 Августа 2016

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