1. Список говнокодов пользователя qwe345asd

    Всего: 4

  2. C# / Говнокод #19830

    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
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    private void CaretNormalize()  {
                if (Template.Terminals.Count == 0) { _sTermEnd = _sOffStart = _sOffEnd = _sTermStart = 0; return; }
                if (_sTermStart == _sTermEnd) {
                    if (_sTermStart < 0) _sTermEnd = _sOffStart = _sOffEnd = _sTermStart = 0;
                    else if (_sTermEnd > Template.Terminals.Count - 1) {
                        _sTermEnd = _sTermStart = Template.Terminals.Count - 1;
                        _sOffStart = _sOffEnd = Template.Terminals[Template.Terminals.Count - 1].Text.Length;
                    }
                    else  {
                        if (_sOffStart != _sOffEnd) {
                            var nos = Math.Min(_sOffStart, _sOffEnd);
                            _sOffEnd = Math.Max(_sOffStart, _sOffEnd);
                            _sOffStart = nos;
                            if (_sOffStart < 0)  {
                                _sTermEnd = --_sTermStart;
                                if (_sTermEnd < 0) _sTermStart = _sOffStart = 0; else _sOffStart = Template.Terminals[_sTermEnd].Text.Length - 1;
                            }
                            if (_sOffEnd > Template.Terminals[_sTermEnd].Text.Length - 1) {
                                _sTermEnd = ++_sTermStart;
                                if (_sTermEnd > Template.Terminals.Count - 1)
                                {
                                    _sTermEnd = Template.Terminals.Count - 1;
                                    _sOffEnd = Template.Terminals[_sTermEnd].Text.Length;
                                }
                                else _sOffEnd = 0;
                            }
                        }
                        else
                        {
                            if (_sOffStart < 0) {
                                _sTermEnd = --_sTermStart;
                                if (_sTermEnd < 0)  _sTermStart = _sOffEnd = _sOffStart = 0; else _sOffEnd = _sOffStart = Template.Terminals[_sTermEnd].Text.Length - 1;
                            }
                            if (_sOffEnd > Template.Terminals[_sTermEnd].Text.Length - 1) {
                                _sTermEnd = ++_sTermStart;
                                if (_sTermEnd > Template.Terminals.Count - 1) {
                                    _sTermEnd = Template.Terminals.Count - 1;
                                    _sOffEnd = _sOffStart = Template.Terminals[_sTermEnd].Text.Length;
                                } else _sOffEnd = _sOffStart = 0;
                            }
                        }
                    }
                } else {
                    if (_sTermStart > _sTermEnd) {
                        var t = _sTermStart;
                        _sTermStart = _sTermEnd;
                        _sTermEnd = t;
                        t = _sOffStart;
                        _sOffStart = _sOffEnd;
                        _sOffEnd = t;
                    }
                    if (_sTermStart < 0) _sOffStart = _sTermStart = 0;
    
                    if (_sTermEnd > Template.Terminals.Count - 1) {
                        _sTermEnd = Template.Terminals.Count - 1;
                        _sOffEnd = Template.Terminals[Template.Terminals.Count - 1].Text.Length;
                    }
                    if (_sOffStart < 0) {
                        --_sTermStart;
                        if (_sTermStart < 0) _sTermStart = _sOffStart = 0; else _sOffStart = Template.Terminals[_sTermStart].Text.Length - 1;
                    }
                    if (_sOffEnd > Template.Terminals[_sTermEnd].Text.Length - 1) {
                        ++_sTermEnd;
                        if (_sTermEnd > Template.Terminals.Count - 1) {
                            _sTermEnd = Template.Terminals.Count - 1;
                            _sOffEnd = Template.Terminals[_sTermEnd].Text.Length;
                        }
                        else _sOffEnd = 0;
                    }
                }
            }

    qwe345asd, 17 Апреля 2016

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

    +3

    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
    Task.Run(() =>
                         {
                             while (true)
                             {
                                 var nrl = new List<int>();
                                 lock (delList)
                                 {
                                     foreach (var i in delList)
                                     {
                                         try { File.Delete(System.IO.Path.GetTempPath() + @"\" + SesionRandom + i + ".xps"); }
                                         catch (Exception)
                                         {
                                             nrl.Add(i);
                                         }
                                     }
                                     delList = nrl;
                                 }
                                 Thread.Sleep(10000);
                             }
                         });

    Упёртый файл не хочет удаляться, пока не попробуешь n раз....

    qwe345asd, 16 Апреля 2016

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

    +5

    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
    var ls = new List<List<Tuple<Terminal, int>>>();
                var cl = new List<Tuple<Terminal, int>>();
                for (int i = 0; i < Template.Terminals.Count; i++)
                {
                    var term = Template.Terminals[i];
                    var s = term.Text;
                    if (s.Count(c => c == '\n' || c == '\r') > 0)
                    {
                        var arr = s.Split('\n', '\r');
                        for (var j = 0; j < arr.Length - 1; j++)
                        {
                            if (arr[j].Length == 0) arr[j] = " ";
                            cl.Add(Tuple.Create(new Terminal(arr[j], term), i));
                            ls.Add(cl);
                            cl = new List<Tuple<Terminal, int>>();
                        }
                        s = arr[arr.Length - 1];
                    }
                    cl.Add(Tuple.Create(new Terminal(s, term), i));
                }
                ls.Add(cl);
    
                var h = 0d;
                var renderLine = new List<Tuple<double, int, Terminal>>();
                var flag = false;
                foreach (var l in ls)
                {
                    renderLine = new List<Tuple<double, int, Terminal>>();
                    var w = 0d;
                    var lineH = 0d;
                    foreach (var term in l)
                    {
                        var ft = new FormattedText(term.Item1.Text, CultureInfo.CurrentCulture,
                            FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.Black);
                        ft.Set(term.Item1);
                        lineH = Math.Max(lineH, ft.Height);
                        w += ft.WidthIncludingTrailingWhitespace;
                        renderLine.Add(Tuple.Create(w, term.Item2, term.Item1));
                    }
                    h += lineH;
                    if (p.Y < h) { flag = true; break; }
                }
                pp = p;
                InvalidateVisual();
                if (!flag)
                    return;
                flag = false;
                Tuple<double, int, Terminal> ct = null;
                foreach (var d in renderLine)
                    if (d.Item1 > p.X)
                    {
                        flag = true;
                        ct = d;
                        Debug.WriteLine(d.Item2);
                        _sTermEnd = _sTermStart = d.Item2;
                        break;
                    }
                if (!flag)
                    return;
                var ft1 = new FormattedText(ct.Item3.Text, CultureInfo.CurrentCulture,
                     FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.Black);
                ft1.Set(ct.Item3);
                var sw = ct.Item1 - ft1.WidthIncludingTrailingWhitespace;
                for (int i = 0; i < ct.Item3.Text.Length; i++)
                {
                    var ch = ct.Item3.Text[i];
                    var ft2 = new FormattedText(ch.ToString(), CultureInfo.CurrentCulture,
                        FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.Black);
                    ft2.Set(ct.Item3);
                    sw += ft2.WidthIncludingTrailingWhitespace;
                    if (sw > p.X)
                    {
                        Debug.WriteLine(i);
                        _sOffEnd = _sOffStart = i;
                        break;
                    }
                }

    qwe345asd, 13 Апреля 2016

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

    +4

    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
    private static void Main(string[] args)
            {
                var c1 = 1; var c2 = 0;
                Task.Run(() =>
                {
                    var f = new Func<int, int, int, int>((p, q, w) =>
                    {
                        Console.WriteLine(p + " " + q + " " + w);
                        Thread.Sleep(p);
                        Console.Beep(q + 264, w);
                        return 1;
                    });
                    int bi, a1, a2, a3;
                    bi = 33554432;
                    while (true)
                        bi = (int) Math.Pow(2, 24 - c2) + (a1 = 125) - a1 +
                             (a2 = (67075013 & bi) == bi
                                 ? ((63945802 & bi) == bi
                                     ? ((57539367 & bi) == bi ? 0 : 33)
                                     : ((57539367 & bi) == bi ? 88 : 66))
                                 : ((63945802 & bi) == bi ? ((57539367 & bi) == bi ? 132 : 176) : 202)) - a2 -
                             (a3 = c1%288 != 0
                                 ? (c1 *= 2) - c1 +
                                   (c1%64 == 0
                                       ? 1000 + (c1 /= 64) - c1 + (c1 *= 3) - c1
                                       : c1%8 == 0 ? 500 : (a1 = 250) - 125)
                                 : (c1%125 == 0 ? 1001 - (c1 /= 36000) : c1%25 == 0 ? 500 : c1%5 == 0 ? 125 : 250) +
                                   (c1 *= 5) - c1) + a3*f(a1, a2, a3) + ++c2 - c2 + (c2 %= 26) - c2 +
                             (c1 = c1 == 160 ? 1 : c1) - c1;
                });
                Console.ReadKey();
            }

    Вот так.

    qwe345asd, 07 Марта 2016

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