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);
 }
Exemple #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;
 }
Exemple #3
0
 public static string getHtmlCode(string urlToFetch)
 {
     var urlContents = new Web().getUrlContents(urlToFetch);
     return urlContents;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
        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 "";
        }