示例#1
0
 public ascx_Execute_Scripts()
 {
     handleSpecialControlKeys();
     //var logoFile = "..\\O2_Logo.gif";
     //var tempPath = "".tempDir(false).pathCombine(logoFile);
     pathToPictureBox = "O2_Logo.gif".local();
     if (!pathToPictureBox.fileExists())
         pathToPictureBox = new Web().checkIfFileExistsAndDownloadIfNot(pathToPictureBox, @"http://o2platform.googlecode.com/svn/trunk/O2_Scripts/_DataFiles/_Images/O2_Logo.gif");
     //else
     //	pathToPictureBox = tempPath;
     "pathToPictureBox: {0}".debug(pathToPictureBox);
 }
示例#2
0
 public override bool execute()
 {
     if (sourceObject == null)
         return false;
     var fileToUnzip = (string) sourceObject;
     if (fileToUnzip.IndexOf("http://") > -1)
         fileToUnzip = new Web().downloadBinaryFile(fileToUnzip);
     if (!File.Exists(fileToUnzip))
         return false;
     folderToUnzipFiles = folderToUnzipFiles ?? DI.config.TempFolderInTempDirectory;
     List<string> unzipedFiles = new zipUtils().unzipFileAndReturnListOfUnzipedFiles(fileToUnzip, folderToUnzipFiles);
     if (unzipedFiles.Count == 0)
         return false;
     resultsObject = unzipedFiles;
     return true;
 }
示例#3
0
文件: SvnApi.cs 项目: pusp/o2platform
 public static string getHtmlCode(string urlToFetch)
 {
     var urlContents = new Web().getUrlContents(urlToFetch);
     return urlContents;
 }
示例#4
0
文件: SvnApi.cs 项目: pusp/o2platform
 public static List<SvnMappedUrl> getSvnMappedUrls(string urlToFetch)
 {
     var svnMappedUrls = new List<SvnMappedUrl>();
     var codeToParse = new Web().getUrlContents(urlToFetch);
     if (codeToParse != "")
     {
         var nodes = Majestic12ToXml.ConvertNodesToXml(codeToParse);
         foreach (var element in nodes.OfType<XElement>().Descendants("li").Descendants("a"))
         {
             var virtualPath = element.Attribute("href").Value;
             if (virtualPath != "../")
                 svnMappedUrls.Add(new SvnMappedUrl(urlToFetch, virtualPath, element.Value));
         }
     }
     return svnMappedUrls;
 }
示例#5
0
文件: DnD.cs 项目: pusp/o2platform
        public static String tryToGetFileOrDirectoryFromDroppedObject(DragEventArgs dragEventArgs, bool downloadIfHttp)
        {
            var dataReceived = new List<object>();
            String[] sFormats = dragEventArgs.Data.GetFormats();
            foreach (string sFormat in sFormats)
                dataReceived.Add(dragEventArgs.Data.GetData(sFormat));

            foreach (object item in dataReceived)
            {
                if (item != null)
                    switch (item.GetType().Name)
                    {
                        case "String":
                            if (File.Exists(item.ToString()) || Directory.Exists(item.ToString()))
                                return item.ToString();                            
                            if ( item.ToString().ToLower().StartsWith("http"))
                            {
                                if (downloadIfHttp)
                                {
                                    var savedUrlContents = new Web().saveUrlContents(item.ToString());
                                    if (savedUrlContents != "" && File.Exists(savedUrlContents))
                                        return savedUrlContents;
                                }
                                return item.ToString();
                            }
                            break;
                        case "String[]":
                            foreach (string subItem in (string[]) item)
                                if (File.Exists(subItem) || Directory.Exists(subItem))
                                    return subItem;
                            break;
                    }
            }
            return "";
        }