1. PHP / Говнокод #4134

    +161

    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
    $divid = '';
    
    if ( $ja_left && $ja_right && $ja_mascol ) {
      //2 columns on the right
    	$divid = '';
    } elseif ( ($ja_left && !$ja_right && !$ja_mascol) ) {
      //One column without masscol
    	$divid = '-lo';
    } elseif ((!$ja_left && $ja_right && !$ja_mascol)) {
      //One column with masscol
    	$divid = '-ro';
    } elseif ((!$ja_left && !$ja_right && $ja_mascol)) {
      //One column with masscol
    	$divid = '-mo';
    } elseif ((!$ja_left && $ja_right && $ja_mascol)) {
      //One column with masscol
    	$divid = '-rm';
    } elseif (($ja_left && !$ja_right && $ja_mascol)) {
      //One column with masscol
    	$divid = '-lm';
    } elseif (($ja_left && $ja_right && !$ja_mascol)) {
      //One column with masscol
    	$divid = '-lr';
    } else {
      //No column in right
    	$divid = '-w';
    }
    
    
    // далее в другом файле
    
    <div id="ja-containerwrap<?php echo $divid ?>">

    Шаблон для жумлы. Особенно хороши комментарии

    mad_max, 31 Августа 2010

    Комментарии (6)
  2. Java / Говнокод #4133

    +79

    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
    /**
             * Convenience method call with one parameter
             * 
             * @param method name of method to call
             * @param p0 method's parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0) throws XMLRPCException {
                    Object[] params = {
                            p0,
                    };
                    return callEx(method, params);
            }
            
            /**
             * Convenience method call with two parameters
             * 
             * @param method name of method to call
             * @param p0 method's 1st parameter
             * @param p1 method's 2nd parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0, Object p1) throws XMLRPCException {
                    Object[] params = {
                            p0, p1,
                    };
                    return callEx(method, params);
            }
    
    //.......................................................
    //.....................cut.............................
    //.......................................................
    
            /**
             * Convenience method call with seven parameters
             * 
             * @param method name of method to call
             * @param p0 method's 1st parameter
             * @param p1 method's 2nd parameter
             * @param p2 method's 3rd parameter
             * @param p3 method's 4th parameter
             * @param p4 method's 5th parameter
             * @param p5 method's 6th parameter
             * @param p6 method's 7th parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) throws XMLRPCException {
                    Object[] params = {
                            p0, p1, p2, p3, p4, p5, p6,
                    };
                    return callEx(method, params);
            }
    
    
            /**
             * Convenience method call with eight parameters
             * 
             * @param method name of method to call
             * @param p0 method's 1st parameter
             * @param p1 method's 2nd parameter
             * @param p2 method's 3rd parameter
             * @param p3 method's 4th parameter
             * @param p4 method's 5th parameter
             * @param p5 method's 6th parameter
             * @param p6 method's 7th parameter
             * @param p7 method's 8th parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) throws XMLRPCException {
                    Object[] params = {
                            p0, p1, p2, p3, p4, p5, p6, p7,
                    };
                    return callEx(method, params);
            }

    http://code.google.com/p/android-xmlrpc/source/browse/trunk/XMLRPC/src/org/xmlrpc/android/XMLRPCClient.java

    striker, 31 Августа 2010

    Комментарии (9)
  3. PHP / Говнокод #4132

    +157

    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
    //               
                       // <?php if (!Yii::app()->user->checkAccess('partner')) { ?>
    
                            a+='<td'+cl+'>'+msg['keywords'][i][mord] + '</td>';
    
                       // <?php } ?>
    
                            //'</strong></td><td'+cl+'>'+currentMordCost+
                            a+='<td'+cl+'>'+(msg['keywords'][i]['costM'])
                            +'</td>'+
                            '<td'+cl+'>'+$.getTiming(msg['domainTrust'], msg['keywords'][i][mord]) + '</td>' +
                            '<td'+cl+'><img class="info" src=\"/images/information.png\" alt=\"'+i+'\" id=\"'+i+'\" > <B>' +msg['keywords'][i]['notice']+'</B></td></tr>';
                            msg['keywords'][i]['domainTrust'] = msg['domainTrust'];
                            hints[i]=jQuery.getHint(msg['keywords'][i]);
                            if (msg['keywords'][i]['bad']==true)
                                badCount++;
                            //mordNestedCost = mord/2 / msg['keywords'][i]['nested'].length;
    
                            //costMNested=(msg['keywords'][i]['costM']) / 2 / msg['keywords'][i]['nested'].length;
                            //if (halfMord == "-")
                            //	mordNestedCost = costMNested = "-";
                                mod='';modA='';
                            for (k=0;k<msg['keywords'][i]['nested'].length;k++)
                            {
    
                                if (k==parseInt(msg['keywords'][i]['up']))
                                    {
                                        mod  = '<span style="color:#626262;font-weight:bold;">';
                                        modA = '<\/span>';
                                    }
                                    if (msg['keywords'][i]['nested'][k]['freq'] <= 50 && msg['keywords'][i]['nested'][k]['mordCost'] >= 1)
                                            {
                                    msg['keywords'][i]['nested'][k]['notice'] += " <BR><span style='color:red'>Возможно посчитано неверно!</span>";
                                    hasCriticalErrors = true;
                                            }
                                a+= '<tr><td'+cl+'>' + mod + '    '+(msg['keywords'][i]['nested'][k]['title'])+ modA +
                                '</td>';
    
                            // // <?php if (!Yii::app()->user->checkAccess('partner')) { ?>
    
                                a+='<td'+cl+'>'+(msg['keywords'][i]['nested'][k][mord])+'</td>';
    
                            // <?php } ?>
    
                                a+='<td'+cl+'>'+
                                //'</td><td'+cl+'>'+currentNestedMordCost+'</td><td'+cl+'>'+
                                (msg['keywords'][i]['nested'][k]['costM'])+'</td>'+
                                    '<td'+cl+'>'+$.getTiming(msg['domainTrust'], msg['keywords'][i]['nested'][k][mord]) + '</td>' +
                                    '<td'+cl+'>'+'<img class="info" src=\"/images/information.png\" alt=\"info_'+i+'_'+k+'\" id=\"'+i+'_'+k+'\" >'+' <B>'+msg['keywords'][i]['nested'][k]['notice']+'</B></td></tr>';
                                msg['keywords'][i]['nested'][k]['domainTrust'] = msg['domainTrust'];
                                hints[i+'_'+k]=jQuery.getHint(msg['keywords'][i]['nested'][k]);
                                if (msg['keywords'][i]['nested']['bad'] == true)
                                    badCount++;
    
    
    
    
                            }

    Как вам такая каша из яваскрипта, пхп и хтмл?

    user654321, 31 Августа 2010

    Комментарии (15)
  4. JavaScript / Говнокод #4131

    +159

    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
    echo "<script type='text/javascript'>  
    function checksubmit ( form )
                {  ";
        echo "if (acton) {";
    $get_count_parts="SELECT PartID, ProdDesc FROM Pr2  WHERE  ProdID='".$_SESSION["ProdID"]."' AND FOblig='*'";
    $get_count_parts1=mysql_query($get_count_parts);
    while ($pr=mysql_fetch_assoc($get_count_parts1))
    {
        echo"var zart".$pr['PartID']."=document.getElementsByName('21_".$pr['PartID']."')[0].value;
                  var name".$pr['PartID']."=document.getElementsByName('14_".$pr['PartID']."')[0].value;";    
    }
    echo "var curr=document.getElementsByName('20_1')[0].value;
              if (curr=='') { alert('Currency was not specified'); return false;}";
    $get_count_parts2=mysql_query($get_count_parts);
    while ($pr=mysql_fetch_assoc($get_count_parts2))
    {
        echo"else if (zart".$pr['PartID']."=='' &&  name".$pr['PartID']."!='') {alert('Art for ".$pr['ProdDesc']." was not specified'); return false;}";    
    }
    echo "}  return true; 
             } </script>";

    Born, 31 Августа 2010

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

    +164

    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
    class Cmd
    {
    private:  /* ... */
    protected: /* ... */
    public:
    	virtual void Assign(Cmd *Source) {}
    	/* ... */
    };
    //---------------------------------------------------------------------------
    class UARTCmd: public Cmd
    {
    private: /* ... */
    protected:
    	byte FCode;
    	unsigned short FCRCbytes;
    	int FLenData;
    	byte FData[256];
    	unsigned short FInit_CRC;
    	unsigned short FPoly_CRC;
    
    	TypeCommand TypeCmd;
    public:
    	virtual void Assign(Cmd *Source) { /* .1. */ }
    	/* ... */
    };
    //---------------------------------------------------------------------------
    class TRANSITCmd: public Cmd
    {
    private: /* ... */
    protected:
    	byte FCode;
    	unsigned short FCRCbytes;
    	int FLenData;
    	byte FData[256];
    	unsigned short FInit_CRC;
    	unsigned short FPoly_CRC;
    
    	byte FID;
    
    	unsigned short FNumb;
    public:
    	virtual void Assign(Cmd *Source) { /* .2. */ /* .3. */ }
    	/* ... */
    };
    //---------------------------------------------------------------------------
    class ASKCmd: public Cmd
    {
    private: /* ... */
    protected:
    	byte FCode;
    	unsigned short FCRCbytes;
    	int FLenData;
    	byte FData[256];
    	unsigned short FInit_CRC;
    	unsigned short FPoly_CRC;
    
    	byte FID;
    
    	byte FidFrom;
    	byte FTimeR;
    	unsigned short FSID;
    public:
    	virtual void Assign(Cmd *Source) { /* .2. */ /* .4. */ }
    	/* ... */
    };
    //---------------------------------------------------------------------------
    class RESPCmd: public Cmd
    {
    private: /* ... */
    protected:
    	byte FCode;
    	unsigned short FCRCbytes;
    	int FLenData;
    	byte FData[256];
    	unsigned short FInit_CRC;
    	unsigned short FPoly_CRC;
    
    	byte FID;
    
    	byte FidFrom;
    	byte FTimeR;
    	unsigned short FSID;
    
    	byte FidResp;
    	unsigned short FCRCResp;
    public:
    	virtual void Assign(Cmd *Source) { /* .2. */ /* .4. */ /* .5. */ }
    	/* ... */
    };

    Сие чудо я должен реализовывать! Так сказать, привести в порядок код.

    P.S. Первоначальный вариант выглядит в разы лучше.
    P.P.S. /* .1. */ - обозначает часть кода

    sanchousf, 30 Августа 2010

    Комментарии (16)
  6. Perl / Говнокод #4129

    −247

    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
    if($ENV{'mode'} eq "dialup"){
      if($ENV{'login'}=~/^P/){
        if($ENV{'bill'}){
          if($ENV{'passwd1'}){
            if($ENV{'passwd1'} eq $ENV{'passwd2'}){
    	  if($ENV{'email'}){
                my($rUser)=check_radius_user_new($ENV{'login'});
    	    my($sUser)=check_http_user_new($ENV{'login'});
    	   #my($Email)=Check_MailBox($ENV{'login'},$ENV{'email'});
        	    if(($rUser==0)and($sUser==0)and($Email==0)){
                  my($bUser)=check_billing_user($ENV{'bill'});
    	      if($bUser==0){
                    add_radius_user($ENV{'login'},$ENV{'passwd1'});
    	        add_http_user($ENV{'login'},$ENV{'passwd1'});
        	        add_billing($ENV{'login'},$ENV{'bill'});
    		Add_MailBox($ENV{'login'},$ENV{'email'},$ENV{'passwd1'});
            	$ENV{'message'}="User created";
                  }else{$ENV{'message'}="Error: Billing name is already exist";}
    	      if($Email!=0){$ENV{'message'}="Error: Email name or alias is already exist";}
                }else{$ENV{'message'}="Error: Sorry such login is already exist";}
    	  }else{$ENV{'message'}="Error: Enter e-mail";}
            }else{$ENV{'message'}="Error: Password mistake";}
          }else{$ENV{'message'}="Error: Enter password";}
        }else{$ENV{'message'}="Error: Enter billing name";}		
      }else{$ENV{'message'}="Error: Enter login";}
    }else{$ENV{'message'}="Error: ";}
    $ENV{'message'}=~s/ /\%20/g;

    Может это так и надо делать?

    Werdn, 30 Августа 2010

    Комментарии (17)
  7. Куча / Говнокод #4128

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Методы изобретательства, с помощью которых три программиста легко могут составить такие программы для компьютера, 
    посредством которых компьютер может изобрести много   изобретений без помощи человека [это является названием 
    данного (то есть нижеизложенного) произведения]
    
    http://55522.ru/

    Law, 30 Августа 2010

    Комментарии (8)
  8. PHP / Говнокод #4127

    +165

    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
    if ($date_reg_2!="0000-00-00 00:00:00")
      	{
      	$start_date_array_2 = explode (" ",$date_reg_2);
      	$start_time_array_2 = explode (":",$start_date_array_2[1]);
      	$time_base_2 = $start_time_array_2[0].":".$start_time_array_2[1];
      	$request_date_start_2 = $start_date_array_2[0]." ".$time_base_2;
      	$request_time_start_2 = $time_base_2.":00";
      	}
      	 if($date_do_array[0]!="0000-00-00")
            {
            $request_date_start_2 = $date_do_array[0]." ".$time_do_array[0].":".$time_do_array[1];
            }
    	if (date("Y-m-d H:m")>$request_date_start_2)
    	{
    	if ($con_from_bill=='0') $color = "#FED0D0";
    	elseif ($time_online<$request_time_start_2&&$con_from_bill==0) $color = "#CAF0BC";
    	else if ($con_from_bill==1||$status==5) $color = "#CAF0BC";
    	else $color = "#FED0D0";
            }
            else
            {
            if ($date_perezvon_array[0]!='0000-00-00' && $perezvon=='0')$color = "#F6FC48";
            else $color = "#ffffff";
            
            }
            
             if ($date_do_array[0]!="0000-00-00") $time_base = $time_do_array[0].":".$time_do_array[1];
            else $time_base =$start_time_array[0].":".$start_time_array[1];
             if($date_do_array[0]!="0000-00-00" && $start_date_array[0]==$date[$w])
            {
            $color = "#D2EAFD";
            }
            else $color = $color;
            
             if (date("Y-m-d")>$day_today)
    	{
    	if ($con_from_bill=="0" && $status != 5) $color = "#F51F1F";
    	else $color = "#CAF0BC";
    	
    	}
    	else  $color= $color;
        
            $url_edit = "/start/incoming_info.php?callid=$callid&teamid=$teamid&from=from_connect";
        if ($date_do!="0000-00-00 00:00:00" && $date[$w]==$start_date_array[0])$ahref = "<a href=\"#\" class=\"hint\" onMouseover=\"showhint('$info_request', this, event, '250px')\"><span style=\"background-color:$color;font-size:8pt;font-family:arial,helvetica,sans serif;color: #969595;font-weight:normal;\">";
            else $ahref="<A HREF=\"javascript:;\" onClick=\"openHorWin('$url_edit')\" class=\"link_incoming\" style=\"background-color:$color;width:100%\"><span style=\"color:$text_color\">";
      if($status!="33" && $status!="34") $time_info = $time_info."<nobr>$ahref $time_base - $incoming </a></span><nobr><br>";
      	else
      	{				
    		
    		if ( $status == 34 && $cancel == 1 ) $color = "#FF8A42";
    		else if      ( $connect_poe == 0 )  $color = "#72AFFF";
    		else if ( $connect_poe == 1 )  $color = "#CAF0BC";
    		else      					   $color = "#FED0D0";
    		
    		if ( $status == "33" )
    	        $url_edit = "/start/psevdo.php?do=info&callid=$callid";
    		else
    			$url_edit = "/start/poe.php?callid=$callid";
    	
      	$start_date_array_33 = explode (" ",$date_reg_2);
      	$start_time_array_33 = explode (":",$start_date_array_33[1]);
      	$time_base_33 = $start_time_array_33[0].":".$start_time_array_33[1];
      	 $ahref="<A HREF=\"$url_edit\"   onClick=\"openHorWin2()\" target=\"displayWindow\"   class=\"link_incoming\" style=\"background-color:$color;width:100%;text-decoration:none;\"><span style=\"color:$text_color\">";
        	 $comments = substr($comments,0,20);
    		 $incoming = $incoming == "., -0" ? $comments : $incoming;
        	 $time_info = $time_info."<nobr>$ahref $time_base - $incoming</a></span><nobr><br>";
      	}
      	}

    Долго и упорно пытался вставить свой "если" в этот код никак не мог найти куда лучше его вставить :-D
    Люди не пишита так никогда, кому то потом придется в этом ковырятся...

    jackkum, 30 Августа 2010

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

    +171

    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
    TCHAR szPort[7];
    
    	strcpy(m_szAddress,szAddress);
        
        // INITIALIZE RETURN VALUE TO INDICATE COM PORT NOT INITIALIZED 	
    	bool bRetVal = false;
    	
    	switch( byCOMPort )
    	{
    	case 1:
    		_tcscpy(szPort,_T("COM1:"));
    		break;
    	case 2:
    		_tcscpy(szPort,_T("COM2:"));
    		break;
    	case 3:
    		_tcscpy(szPort,_T("COM3:"));
    		break;
    	case 4:
    		_tcscpy(szPort,_T("COM4:"));
    		break;
    	}

    Вот так гибко можно отрывать любой из четырёх COM портов.

    slavap, 30 Августа 2010

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

    +142

    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
    using System;
    using System.IO;
    using System.IO.Compression;
    using System.Text;
    using System.Net;
    
    class Data : IDisposable
    {
        public void Dispose() { }
    
        MemoryStream MemStr;
    
        public Data(string Url)
        {
            UnZipFile(Url);
        }
    
        MemoryStream DownloadData(string Url)
        {
            using (WebClient Wc = new WebClient())
            {
                MemStr = new MemoryStream(Wc.DownloadData(Url));
            }
    
            return MemStr;
        }
    
        void UnZipFile(string Url)
        {
            MemoryStream MemStr = DownloadData(Url);
    
            using (GZipStream ZipStr = new GZipStream(MemStr, CompressionMode.Decompress))
            {
                byte[] P = new byte[ZipStr.BaseStream.Length];
                ZipStr.BaseStream.Read(P, 0, P.Length);
                FileStream Fs = new FileStream("TmpFile.zip", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                Fs.Write(P, 0, P.Length);
                Fs.Flush();
            }
        }
    }
    
    class Program
    {
        static void Main()
        {
            while (true)
            {
                Console.Write("\nPlease, insert link to download ZIP-file >> ");
                string Abc = Console.ReadLine();
    
                using (Data Obj = new Data(Abc)) ;
            }
        }
    }

    sergylens, 29 Августа 2010

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