2012-04-13 146 views
0

我有一個使用3個PHP文件的模板。轉換PHP到ASP?

連接器fileimport.php 連接器icon.php elFinder.class.php

是否有可能有這些轉換到ASP.NET?

連接器fileimport.php

<?php 

error_reporting(0); // Set E_ALL for debuging 

if (function_exists('date_default_timezone_set')) { 
    date_default_timezone_set('Europe/Moscow'); 
} 

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php'; 

/** 
* Simple example how to use logger with elFinder 
**/ 
class elFinderLogger implements elFinderILogger { 

    public function log($cmd, $ok, $context, $err='', $errorData = array()) { 
     if (false != ($fp = fopen('./log.txt', 'a'))) { 
      if ($ok) { 
       $str = "cmd: $cmd; OK; context: ".str_replace("\n", '', var_export($context, true))."; \n"; 
      } else { 
       $str = "cmd: $cmd; FAILED; context: ".str_replace("\n", '', var_export($context, true))."; error: $err; errorData: ".str_replace("\n", '', var_export($errorData, true))."\n"; 
      } 
      fwrite($fp, $str); 
      fclose($fp); 
     } 
    } 

} 

$opts = array(
    'root'   => '../../../../examfilemanager/',      // path to root directory 
    'URL'    => "examfilemanager/", // root directory URL 
    'rootAlias'  => 'Home',  // display this instead of root directory name 
    //'uploadAllow' => array('images/*'), 
    //'uploadDeny' => array('all'), 
    //'uploadOrder' => 'deny,allow' 
    // 'disabled'  => array(),  // list of not allowed commands 
    // 'dotFiles'  => false,  // display dot files 
    // 'dirSize'  => true,   // count total directories sizes 
    // 'fileMode'  => 0666,   // new files mode 
    // 'dirMode'  => 0777,   // new folders mode 
    // 'mimeDetect' => 'internal',  // files mimetypes detection method (finfo, mime_content_type, linux (file -ib), bsd (file -Ib), internal (by extensions)) 
    // 'uploadAllow' => array(),  // mimetypes which allowed to upload 
    // 'uploadDeny' => array(),  // mimetypes which not allowed to upload 
    // 'uploadOrder' => 'deny,allow', // order to proccess uploadAllow and uploadAllow options 
    // 'imgLib'  => 'mogrify',  // image manipulation library (imagick, mogrify, gd) 
    // 'tmbDir'  => '.tmb',  // directory name for image thumbnails. Set to "" to avoid thumbnails generation 
    // 'tmbCleanProb' => 1,   // how frequiently clean thumbnails dir (0 - never, 100 - every init request) 
    // 'tmbAtOnce' => 5,   // number of thumbnails to generate per request 
    // 'tmbSize'  => 48,   // images thumbnails size (px) 
    // 'fileURL'  => true,   // display file URL in "get info" 
    // 'dateFormat' => 'j M Y H:i', // file modification date format 
    // 'logger'  => null,   // object logger 
    // 'defaults'  => array(  // default permisions 
    // 'read' => true, 
    // 'write' => true, 
    // 'rm'  => true 
    // ), 
    // 'perms'  => array(),  // individual folders/files permisions  
    // 'debug'  => true,   // send debug to client 
    'archiveMimes' => array(),  // allowed archive's mimetypes to create. Leave empty for all available types. 
    // 'archivers' => array()  // info about archivers to use. See example below. Leave empty for auto detect 
    'archivers' => array(
     'create' => array(
      'application/x-gzip' => array(
       'cmd' => 'tar', 
       'argc' => '-czf', 
       'ext' => 'tar.gz' 
       ) 
      ), 
     'extract' => array(
      'application/x-gzip' => array(
       'cmd' => 'tar', 
       'argc' => '-xzf', 
       'ext' => 'tar.gz' 
       ), 
      'application/x-bzip2' => array(
       'cmd' => 'tar', 
       'argc' => '-xjf', 
       'ext' => 'tar.bz' 
       ) 
      ) 
     ) 
); 

$fm = new elFinder($opts); 
$fm->run(); 

?> 

連接器icon.php

<?php 

error_reporting(0); // Set E_ALL for debuging 

if (function_exists('date_default_timezone_set')) { 
    date_default_timezone_set('Europe/Moscow'); 
} 

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php'; 

/** 
* Simple example how to use logger with elFinder 
**/ 
class elFinderLogger implements elFinderILogger { 

    public function log($cmd, $ok, $context, $err='', $errorData = array()) { 
     if (false != ($fp = fopen('./log.txt', 'a'))) { 
      if ($ok) { 
       $str = "cmd: $cmd; OK; context: ".str_replace("\n", '', var_export($context, true))."; \n"; 
      } else { 
       $str = "cmd: $cmd; FAILED; context: ".str_replace("\n", '', var_export($context, true))."; error: $err; errorData: ".str_replace("\n", '', var_export($errorData, true))."\n"; 
      } 
      fwrite($fp, $str); 
      fclose($fp); 
     } 
    } 

} 

$opts = array(
    'root'   => '../../../../examicon/',      // path to root directory 
    'URL'    => "examicon/", // root directory URL 
    'rootAlias'  => 'Home',  // display this instead of root directory name 
    //'uploadAllow' => array('images/*'), 
    //'uploadDeny' => array('all'), 
    //'uploadOrder' => 'deny,allow' 
    // 'disabled'  => array(),  // list of not allowed commands 
    // 'dotFiles'  => false,  // display dot files 
    // 'dirSize'  => true,   // count total directories sizes 
    // 'fileMode'  => 0666,   // new files mode 
    // 'dirMode'  => 0777,   // new folders mode 
    // 'mimeDetect' => 'internal',  // files mimetypes detection method (finfo, mime_content_type, linux (file -ib), bsd (file -Ib), internal (by extensions)) 
    // 'uploadAllow' => array(),  // mimetypes which allowed to upload 
    // 'uploadDeny' => array(),  // mimetypes which not allowed to upload 
    // 'uploadOrder' => 'deny,allow', // order to proccess uploadAllow and uploadAllow options 
    // 'imgLib'  => 'mogrify',  // image manipulation library (imagick, mogrify, gd) 
    // 'tmbDir'  => '.tmb',  // directory name for image thumbnails. Set to "" to avoid thumbnails generation 
    // 'tmbCleanProb' => 1,   // how frequiently clean thumbnails dir (0 - never, 100 - every init request) 
    // 'tmbAtOnce' => 5,   // number of thumbnails to generate per request 
    // 'tmbSize'  => 48,   // images thumbnails size (px) 
    // 'fileURL'  => true,   // display file URL in "get info" 
    // 'dateFormat' => 'j M Y H:i', // file modification date format 
    // 'logger'  => null,   // object logger 
    // 'defaults'  => array(  // default permisions 
    // 'read' => true, 
    // 'write' => true, 
    // 'rm'  => true 
    // ), 
    // 'perms'  => array(),  // individual folders/files permisions  
    // 'debug'  => true,   // send debug to client 
    'archiveMimes' => array(),  // allowed archive's mimetypes to create. Leave empty for all available types. 
    // 'archivers' => array()  // info about archivers to use. See example below. Leave empty for auto detect 
    'archivers' => array(
     'create' => array(
      'application/x-gzip' => array(
       'cmd' => 'tar', 
       'argc' => '-czf', 
       'ext' => 'tar.gz' 
       ) 
      ), 
     'extract' => array(
      'application/x-gzip' => array(
       'cmd' => 'tar', 
       'argc' => '-xzf', 
       'ext' => 'tar.gz' 
       ), 
      'application/x-bzip2' => array(
       'cmd' => 'tar', 
       'argc' => '-xjf', 
       'ext' => 'tar.bz' 
       ) 
      ) 
     ) 
); 

$fm = new elFinder($opts); 
$fm->run(); 

?> 

第三個文件是太大,在這個崗位包括。但這甚至可能嗎?

+3

當然可以將其轉換。只要把它扔出去,並用ASP重寫(希望ASP.NET而不是那些可憐的「經典」ASP)。那麼,真正的問題在哪裏? – 2012-04-13 21:53:35

+3

當然,如果你投入足夠的汗水,通常任何語言都可以轉換爲任何其他語言。 – 2012-04-13 21:54:05

+0

Def。可能。你在找人幫你嗎? – 2012-04-13 21:56:46

回答

1

即使有可能存在一些自動化工具,我強烈選擇反對。每種語言都有其具體細節,原始轉換很少是一個好主意。

按照其他建議 - 自己重寫它,不要依賴某種工具。

0

也許你可以使用這個(我不知道它是什麼,因爲我不知道什麼ASP究竟)

http://www.asp.net/downloads/archived-v11/migration-assistants/php-to-aspnet

+0

試過,無法讓它工作不幸。希望找到某種類型的轉換器,而不必重新編寫數千行代碼。 – 2012-04-13 21:56:57

+0

@JamesWilson這是不可能自動轉換它。除非AI已經遠遠超過了我的知識,否則它需要人類開發人員用相同的意圖/語義重寫它。零件可能會被轉換,但是可惜...並且就開發商而言,SO是*不是*招聘網站;-) – 2012-04-13 22:01:19