Changeset 4073

Show
Ignore:
Timestamp:
10/05/07 00:12:35 (1 year ago)
Author:
xmlhacker
Message:

moving into Scripts. Need to do this in two stages

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/nuxleus/nuXleus.build

    r4069 r4073  
    194194    </csc> 
    195195  </target> 
     196  <target name="Nuxleus.Language" depends="init"> 
     197    <csc target="library" output="${build.dir}/Nuxleus.Language.dll"> 
     198      <sources> 
     199        <include name="${source.dir}/Nuxleus.Language/**/*.cs"/> 
     200      </sources> 
     201      <references> 
     202        <include name="System.dll"/> 
     203        <include name="System.Xml.dll"/> 
     204      </references> 
     205    </csc> 
     206  </target> 
    196207  <target name="Nuxleus.Messaging" depends="init"> 
    197208    <csc target="library" output="${build.dir}/Nuxleus.Messaging.dll"> 
     
    232243        <include name="System.Web.dll"/> 
    233244        <include name="System.Configuration.dll"/> 
     245      </references> 
     246    </csc> 
     247  </target> 
     248  <target name="Nuxleus.Semantics" depends="init"> 
     249    <csc target="library" output="${build.dir}/Nuxleus.Semantics.dll"> 
     250      <sources> 
     251        <include name="${source.dir}/Nuxleus.Semantics/**/*.cs"/> 
     252      </sources> 
     253      <references> 
     254        <include name="System.dll"/> 
     255        <include name="System.Xml.dll"/> 
    234256      </references> 
    235257    </csc> 
     
    351373    <!-- <call target="Nuxleus.Extension.Silverlight"/> --> 
    352374    <call target="Nuxleus.IO"/> 
     375    <call target="Nuxleus.Language"/> 
    353376    <call target="Nuxleus.Messaging"/> 
    354377    <call target="Nuxleus.Process"/> 
    355378    <call target="Nuxleus.PubSub"/> 
     379    <call target="Nuxleus.Semantics"/> 
    356380    <call target="Nuxleus.Service"/> 
    357381    <call target="Nuxleus.Utility"/> 
  • trunk/nuxleus/src/Nuxleus.Web/HttpHandler/NuxleusHttpNotFoundHandler.cs

    r4065 r4073  
    88 
    99namespace Nuxleus.Web.HttpHandler 
    10 {  
    11   public class NuxleusHttpNotFoundHandler : IHttpHandler 
    12   {   
    13     private void FindMatch(string current, IList<string> matches, string[] tokens, int index) {  
    14       if(index == tokens.Length) { 
    15         return; 
    16       } 
     10
     11    public class NuxleusHttpNotFoundHandler : IHttpHandler 
     12    { 
     13        private void FindMatch(string current, IList<string> matches, string[] tokens, int index) 
     14        { 
     15            if (index == tokens.Length) 
     16            { 
     17                return; 
     18            } 
    1719 
    18       FileSystemInfo[] directories = (new DirectoryInfo(current)).GetFileSystemInfos(); 
     20            FileSystemInfo[] directories = (new DirectoryInfo(current)).GetFileSystemInfos(); 
    1921 
    20       string token = tokens[index].ToLower(); 
    21       foreach (FileSystemInfo fsi in directories)  { 
    22         string name = fsi.Name.ToLower(); 
    23         if(fsi is DirectoryInfo) { 
    24           DirectoryInfo dir = (DirectoryInfo)fsi; 
    25           if(name.Contains(token)) { 
    26             if(matches.Contains(dir.Parent.FullName)) 
    27               matches.Remove(dir.Parent.FullName); 
    28             matches.Add(dir.FullName); 
    29             FindMatch(dir.FullName, matches, tokens, index+1); 
    30           } else if (StringMatching.AreNeighbors(token, name, 2)) { 
    31             if(matches.Contains(dir.Parent.FullName)) 
    32               matches.Remove(dir.Parent.FullName); 
    33             matches.Add(dir.FullName); 
    34             FindMatch(dir.FullName, matches, tokens, index+1); 
    35           } 
    36         } else if(fsi is FileInfo) { 
    37           FileInfo fi = (FileInfo)fsi; 
    38           if(name.Contains(token)) { 
    39             if(matches.Contains(fi.DirectoryName)) 
    40               matches.Remove(fi.DirectoryName); 
    41             matches.Add(fi.FullName); 
    42           } else if (StringMatching.AreNeighbors(token, name, 2)) { 
    43             if(matches.Contains(fi.DirectoryName)) 
    44               matches.Remove(fi.DirectoryName); 
    45             matches.Add(fi.FullName); 
    46           } 
    47         } 
    48       } 
     22            string token = tokens[index].ToLower(); 
     23            foreach (FileSystemInfo fsi in directories) 
     24            { 
     25                string name = fsi.Name.ToLower(); 
     26                if (fsi is DirectoryInfo) 
     27                { 
     28                    DirectoryInfo dir = (DirectoryInfo)fsi; 
     29                    if (name.Contains(token)) 
     30                    { 
     31                        if (matches.Contains(dir.Parent.FullName)) 
     32                            matches.Remove(dir.Parent.FullName); 
     33                        matches.Add(dir.FullName); 
     34                        FindMatch(dir.FullName, matches, tokens, index + 1); 
     35                    } 
     36                    else if (StringMatching.AreNeighbors(token, name, 2)) 
     37                    { 
     38                        if (matches.Contains(dir.Parent.FullName)) 
     39                            matches.Remove(dir.Parent.FullName); 
     40                        matches.Add(dir.FullName); 
     41                        FindMatch(dir.FullName, matches, tokens, index + 1); 
     42                    } 
     43                } 
     44                else if (fsi is FileInfo) 
     45                { 
     46                    FileInfo fi = (FileInfo)fsi; 
     47                    if (name.Contains(token)) 
     48                    { 
     49                        if (matches.Contains(fi.DirectoryName)) 
     50                            matches.Remove(fi.DirectoryName); 
     51                        matches.Add(fi.FullName); 
     52                    } 
     53                    else if (StringMatching.AreNeighbors(token, name, 2)) 
     54                    { 
     55                        if (matches.Contains(fi.DirectoryName)) 
     56                            matches.Remove(fi.DirectoryName); 
     57                        matches.Add(fi.FullName); 
     58                    } 
     59                } 
     60            } 
     61        } 
     62 
     63        public void ProcessRequest(HttpContext context) 
     64        { 
     65            HttpRequest req = context.Request; 
     66            HttpResponse resp = context.Response; 
     67 
     68            IList<string> matches = new List<string>(); 
     69            string[] tokens = req.Path.Trim('/').ToLower().Split('/'); 
     70            string current = Directory.GetCurrentDirectory(); 
     71            FindMatch(current, matches, tokens, 0); 
     72 
     73            StringBuilder sb = new StringBuilder(String.Format("<html><head/><body><p>Could not find {0}.</p>", HttpUtility.HtmlEncode(req.Path))); 
     74 
     75            if (matches.Count != 0) 
     76            { 
     77                sb.Append("<p>We have however found potential match:</p><ul>"); 
     78                foreach (string m in matches) 
     79                { 
     80                    sb.Append(String.Format("<li>{0}</li>", HttpUtility.HtmlEncode(m))); 
     81                } 
     82 
     83                sb.Append("</ul>"); 
     84            } 
     85            sb.Append("<p>Or maybe you'd rather create that resource instead?</p></body></html>"); 
     86 
     87            resp.Write(sb.ToString()); 
     88 
     89            // Even if we build a friendly page, this is still a Page Not Found 
     90            // let's not break HTTP 
     91            resp.StatusCode = 404; 
     92            resp.StatusDescription = "Not Found"; 
     93        } 
     94 
     95        public bool IsReusable 
     96        { 
     97            get { return false; } 
     98        } 
    4999    } 
    50      
    51     public void ProcessRequest(HttpContext context) 
    52     { 
    53       HttpRequest req = context.Request; 
    54       HttpResponse resp = context.Response; 
    55  
    56       IList<string> matches = new List<string>(); 
    57       string[] tokens = req.Path.Trim('/').ToLower().Split('/'); 
    58       string current = Directory.GetCurrentDirectory(); 
    59       FindMatch(current, matches, tokens, 0); 
    60  
    61       StringBuilder sb = new StringBuilder(String.Format("<html><head/><body><p>Could not find {0}.</p>", HttpUtility.HtmlEncode(req.Path))); 
    62        
    63       if(matches.Count != 0) { 
    64         sb.Append("<p>We have however found potential match:</p><ul>"); 
    65         foreach(string m in matches) { 
    66           sb.Append(String.Format("<li>{0}</li>", HttpUtility.HtmlEncode(m))); 
    67         } 
    68          
    69         sb.Append("</ul>"); 
    70       } 
    71       sb.Append("<p>Or maybe you'd rather create that resource instead?</p></body></html>"); 
    72        
    73       resp.Write(sb.ToString()); 
    74  
    75       // Even if we build a friendly page, this is still a Page Not Found 
    76       // let's not break HTTP 
    77       resp.StatusCode = 404; 
    78       resp.StatusDescription = "Not Found"; 
    79     } 
    80  
    81     public bool IsReusable 
    82     { 
    83       get { return false; } 
    84     } 
    85   } 
    86100}