Changeset 36733 for lang/csharp

Show
Ignore:
Timestamp:
02/13/10 10:53:32 (3 years ago)
Author:
hoge1e3
Message:
 
Location:
lang/csharp/soyText/soyText
Files:
18 modified

Legend:

Unmodified
Added
Removed
  • lang/csharp/soyText/soyText/DocumentList.cs

    r36658 r36733  
    33using System.Linq; 
    44using System.Text; 
    5 using System.IO; 
    6 using System.Text.RegularExpressions; 
    7  
     5    
    86namespace SoyText 
    97{ 
    10      
    11     class DocumentList 
    12     { 
    13         DocumentSet documentSet; 
    14         IDChain first,last; 
    15         /*List<string> ids = new List<string>(); 
    16         public List<string> idList 
    17         { 
    18             get { return ids; } 
    19         }*/ 
    20         public DocumentList(DocumentSet d) { documentSet = d; init(); } 
    21         void init() 
    22         { 
    23             scanDir(); 
    24  
    25         } 
    26         public IEnumerable<IDChain> getIDS() 
    27         { 
    28             for (var idc = first; idc != null; idc = idc.next) 
    29             { 
    30                 yield return idc; 
    31             } 
    32         } 
    33         private void scanDir() 
    34         { 
    35            
    36             DocumentState state=DocumentState.active; 
    37             var dir=documentSet.stateDir(state); 
    38             List<IDInfo> infs = new List<IDInfo>(); 
    39             foreach (string fileName 
    40                in Mkdir.getFiles(dir)) 
    41             { 
    42                 var m = Regex.Match(fileName, @"([^/\\]+).txt$"); 
    43                 if (m.Success) 
    44                 { 
    45                     var id = m.Groups[1].Value; 
    46                     infs.Add(new IDInfo(id,File.GetLastWriteTime(documentSet.getFileName(id,state)).Ticks)); 
    47                 } 
    48             } 
    49             infs.Sort(); 
    50             foreach (var inf in infs) { 
    51                 pushID(inf.id); 
    52                 //Debug.syslog(inf.id); 
    53             } 
    54             //Debug.syslog(""+ids.Count); 
    55         } 
    56         internal IDChain pushID(string id) 
    57         { 
    58             var idc = new IDChain(); 
    59             idc.id = id; 
    60             idc.prev = last; 
    61             if (first == null) first = idc; 
    62             if (last != null) 
    63             { 
    64                 last.next = idc; 
    65             } 
    66             last = idc; 
    67             return idc; 
    68         } 
    69         internal IDChain insertIDChain(IDChain idc) 
    70         { 
    71             idc.next = first; 
    72             idc.prev = null; 
    73             if (last == null) last = idc; 
    74             if (first != null) 
    75             { 
    76                 first.prev = idc; 
    77             } 
    78             first = idc; 
    79             return idc; 
    80         } 
    81  
    82         internal IDChain insertID(string id) 
    83         { 
    84             var idc=new IDChain(); 
    85             idc.id=id; 
    86             insertIDChain(idc); 
    87             return idc; 
    88         } 
    89         internal IDChain removeIDChain(IDChain idc) 
    90         { 
    91             if (idc.prev != null) 
    92             { 
    93                 idc.prev.next = idc.next; 
    94             } 
    95             if (idc.next != null) 
    96             { 
    97                 idc.next.prev = idc.prev; 
    98             } 
    99             idc.prev = null; 
    100             idc.next = null; 
    101             return idc; 
    102         } 
    103         class IDInfo : IComparable 
    104         { 
    105             public string id; 
    106             public long lastUpdate; 
    107             public IDInfo(string id, long lastUpdate) 
    108             { 
    109                 this.id = id; 
    110                 this.lastUpdate = lastUpdate; 
    111             } 
    112  
    113             #region IComparable メンバ 
    114  
    115             public int CompareTo(object obj) 
    116             { 
    117                 if (obj is IDInfo) 
    118                 { 
    119                     IDInfo t = (IDInfo)obj; 
    120                     if (t.lastUpdate > lastUpdate) return 1; 
    121                     if (t.lastUpdate < lastUpdate) return -1; 
    122                 } 
    123                 return 0; 
    124             } 
    125  
    126             #endregion 
    127         } 
    128  
    129  
    130  
    131     } 
    132     class IDChain 
    133     { 
    134         public string id; 
    135         public Document document; 
    136         public IDChain prev, next; 
    137     } 
    138     /* 
    1398    public class DocumentList: SortedList<long,Document> 
    1409    { 
     
    15423            return true; 
    15524        } 
    156     }*/ 
     25    } 
    15726} 
  • lang/csharp/soyText/soyText/DocumentListMap.cs

    r36658 r36733  
    11using System; 
    22using System.Collections.Generic; 
    3 using System.Linq; 
     3using System.Linq;    
    44using System.Text; 
    55 
     
    88    class DocumentListMap 
    99    { 
    10         private DocumentList list; 
    11         DocumentSet documentSet; 
    12         public DocumentListMap(DocumentSet documentSet) 
    13         { 
    14             this.documentSet = documentSet; 
    15             list = new DocumentList(documentSet); 
    16         } 
    17         private SortedList<string, IDChain> map = new SortedList<string, IDChain>(); 
    18         //private SortedList<string, Document> removed = new SortedList<string, Document>(); 
     10        private DocumentList list=new DocumentList(); 
     11        private SortedList<string, Document> map = new SortedList<string, Document>(); 
    1912        public void add(Document d) 
    2013        { 
    21             if (contains(d.id)) return; 
    22             //list.add(d); 
    23             var idc=list.insertID(d.id); 
    24             /*if (removed.ContainsKey(d.id)) 
    25             { 
    26                 removed.Remove(d.id); 
    27             }*/ 
    28             map.Add(d.id, idc); 
     14            list.add(d); 
     15            map.Add(d.id, d); 
    2916        } 
    3017 
    3118 
    32         public IEnumerable<Document> getRecents() 
     19        internal DocumentList getRecents() 
    3320        { 
    34             foreach (var idc in list.getIDS())  
    35             {    
    36                 /*if (!removed.ContainsKey(id)) 
    37                 {*/ 
    38                     yield return byIdChain(idc); 
    39                 //} 
    40             } 
    41             //return list; 
    42         } 
    43         public Document byIdChain(IDChain idc) 
    44         { 
    45             if (idc.document == null) { 
    46                  idc.document= documentSet.createDocument(idc.id); 
    47             } 
    48             return idc.document; 
    49         } 
    50         IDChain getIDChain(string id) 
    51         { 
    52             return map[id]; 
     21            return list; 
    5322        } 
    5423        public Document byId(string id) 
    5524        { 
    56             return byIdChain(getIDChain(id)); 
     25            return map[id]; 
    5726        } 
    5827 
     
    6231        } 
    6332 
    64         internal bool update(Document document) 
     33        internal void update(Document document) 
    6534        { 
    66             if (!remove(document)) return false; 
     35            if (!contains(document.id)) return; 
     36            list.Remove(document); 
     37            map.Remove(document.id); 
    6738            document.clearLastUpdate(); 
    6839            add(document); 
    69             return true; 
    7040        } 
    7141 
     
    7343        { 
    7444            if (!contains(document.id)) return false; 
    75             //list.Remove(document); 
    76             //removed.Add(document.id, document); 
    77             list.removeIDChain(getIDChain(document.id)); 
     45            list.Remove(document); 
    7846            map.Remove(document.id); 
    7947            return true; 
  • lang/csharp/soyText/soyText/DocumentSearcher.cs

    r36658 r36733  
    33using System.Linq; 
    44using System.Text; 
    5  
     5    
    66namespace SoyText 
    77{ 
     
    2121        public IEnumerable<Document> search() 
    2222        { 
    23             var rec = documentSet.getRecents(); 
    24             /*var rec = new DocumentList(); 
     23            var rec0 = documentSet.getRecents(); 
     24            var rec = new DocumentList(); 
    2525            lock (rec0) 
    2626            { 
    2727                foreach (var d in rec0) rec.Add(d.Key, d.Value); 
    28             }*/ 
     28            } 
    2929            //var res = new DocumentList(); 
    3030            if (searchCondition == null || searchCondition is AnyCondition) 
     
    3232                foreach (var d in rec) 
    3333                { 
    34                     if (skip !=0  && d.lastUpdate >= skip) 
     34                    if (skip !=0  && d.Value.lastUpdate >= skip) 
    3535                    { 
    3636                        continue; 
    3737                    } 
    38                     yield return d; 
     38                    yield return d.Value; 
    3939                    //res.Add(d.Key, d.Value); 
    4040                    if (terminated) break; 
     
    4242                yield break; 
    4343            } 
    44             var c = 0;// rec.Count; 
     44            var c = rec.Count; 
    4545            var cnt = 0; 
    4646            var found = 0; 
     
    4949                Debug.print("文書を検索: " + searchCondition + "(" + cnt + "/" + c + ") - " + found + "件見つかりました"); 
    5050                cnt++; 
    51                 if (skip != 0 && d.lastUpdate >= skip) 
     51                if (skip != 0 && d.Value.lastUpdate >= skip) 
    5252                { 
    5353                    continue; 
    5454                }  
    55                 if (searchCondition.matches(d)) 
     55                if (searchCondition.matches(d.Value)) 
    5656                { 
    5757                    //if (!res.ContainsKey(d.Key)) 
    5858                    //{ 
    5959                    found++; 
    60                         yield return d; 
     60                        yield return d.Value; 
    6161                    //    res.Add(d.Key, d.Value); 
    6262                    //} 
  • lang/csharp/soyText/soyText/DocumentSet.cs

    r36658 r36733  
    55using System.Text; 
    66using System.Text.RegularExpressions; 
    7 using System.Threading; 
    8  
     7using System.Threading;    
     8  
    99namespace SoyText 
    1010{ 
     
    5353        private Document addToCache(Document d) 
    5454        { 
    55             if (cache == null) cache = new DocumentListMap(this); 
     55            if (cache == null) cache = new DocumentListMap(); 
    5656            lock (cache) 
    5757            { 
     
    6666        } 
    6767        static int count = 0; 
    68         public IEnumerable<Document> getRecents() 
     68        public DocumentList getRecents() 
    6969        { 
    70             /*if (cache != null) return cache.getRecents(); 
     70            if (cache != null) return cache.getRecents(); 
    7171            Debug.syslog("Getrecent called " + (++count) + "times"); 
    7272            Debug.print("文書一覧取得中..."); 
     73            //var res = new DocumentList(); 
    7374             
    74             searchMax(DocumentState.active, true);*/ 
    75             if (cache == null) cache = new DocumentListMap(this); 
    76              
     75            /*searchMax(DocumentState.active, true); 
     76            searchMax(DocumentState.archived, false); 
     77            searchMax(DocumentState.indexed,true);*/ 
     78            searchMax(DocumentState.active, true); 
     79            if (cache == null) cache = new DocumentListMap(); 
     80            Debug.print("文書一覧並べ替え中..."); 
     81            //res.Sort(byRecency); 
     82            Debug.print("END: 文書一覧並べ替え中..."); 
    7783 
    7884            return cache.getRecents(); 
     
    155161            return s.search(); 
    156162        } 
    157         /*public Document getOldestActiveDocument() 
     163        public Document getOldestActiveDocument() 
    158164        { 
    159165            var r = getRecents(); 
    160166            return r[0]; 
    161         }*/ 
     167        } 
    162168 
    163169        /*internal IEnumerable<object> search(SearchCondition condition) 
  • lang/csharp/soyText/soyText/EditorTab.cs

    r36658 r36733  
    33using System.ComponentModel; 
    44using System.Drawing; 
    5 using System.Data; 
     5using System.Data;  
    66using System.Linq; 
    77using System.Text; 
     
    99using System.Text.RegularExpressions; 
    1010 
    11     
     11      
    1212namespace SoyText 
    1313{ 
     
    6565        bool listInited = false; 
    6666        ListSyncer listSyncer; 
    67         string listSyncerCondition(string condition) 
    68         { 
    69             var syncC = condition; 
    70             if (syncC == null || syncC == "") 
    71             { 
    72                 syncC = "-type:SearchLog"; 
    73             } 
    74             return syncC; 
    75         } 
    7667        public EditorTab(Form2 parent,string condition, bool searchOnLoad) 
    7768        { 
     
    8980            inst++; 
    9081            defaultInstance = this; 
    91  
    92             listSyncer = documentSet.listSyncerSet.add(docListBox, listSyncerCondition(condition)); 
     82            listSyncer = documentSet.listSyncerSet.add(docListBox, condition); 
    9383             
    9484            tagSet.onTagFound += delegate(string tag) 
     
    175165                refreshTagFilters(); 
    176166            } 
    177  
    178             listSyncer.condExpr = listSyncerCondition(condition); 
     167             
     168            listSyncer.condExpr = condition; 
    179169            if (titleChanged != null) titleChanged(kw); 
    180170            if (documentSearcher != null && !ftSearching) documentSearcher.terminate(); 
     
    201191                    { 
    202192                        tagSet.add(d); 
    203                         //Debug.syslog("doc - id=" + d.id);  
    204193                        if (documentSet.searchLogSet.add(d)) 
    205194                        { 
    206                             //Debug.syslog("newtab - id=" + d.id+" / "+d.parsed["condition"]+" ft = "+ft+"  closed ="+d.parsed["closed"]); 
     195                            Debug.syslog("newtab - " + d.parsed["condition"]+" ft = "+ft+"  closed ="+d.parsed["closed"]); 
    207196                            if (ft && d.parsed["closed"] != "true") 
    208197                            { 
     
    216205                        else 
    217206                        { 
    218                             //Debug.syslog("listSyncer.add - id=" + d.id); 
    219207                            cnt++; 
    220208                            listSyncer.add(d); 
     
    824812            ExecForm.open(curDoc); 
    825813        } 
     814 
    826815        private void docListBox_DragEnter(object sender, DragEventArgs e) 
    827816        { 
     
    837826            foreach (var f in s) 
    838827            { 
    839                 var d = documentSet.createDocument(); 
     828                var d=documentSet.createDocument(); 
    840829                d.str["type"] = "file"; 
    841830                d.str["tag"] = "file"; 
  • lang/csharp/soyText/soyText/LoggedDocumentSearcher.cs

    r36658 r36733  
    22using System.Collections.Generic; 
    33using System.Linq; 
    4 using System.Text; 
     4using System.Text;    
    55 
    66namespace SoyText 
     
    6464 
    6565 
    66                 var rec = documentSet.getRecents(); 
    67                 /*var rec = new DocumentList(); 
     66                var rec0 = documentSet.getRecents(); 
     67                var rec = new DocumentList(); 
    6868                lock (rec0) 
    6969                { 
    7070                    foreach (var d in rec0) rec.Add(d.Key, d.Value); 
    71                 }*/ 
    72  
    73                 var c = 0;// rec.Count; 
     71                } 
     72                 
     73                var c = rec.Count; 
    7474                var cnt = 0; 
    7575                var found = 0; 
     
    7979                { 
    8080                    checkTimeout(timeOutTime); 
    81                     var d = dent;//.Value; 
     81                    var d = dent.Value; 
    8282                    if (newestDoc==null) newestDoc=d; 
    8383                    oldestDoc=d; 
  • lang/csharp/soyText/soyText/SearchLogSet.cs

    r36658 r36733  
    22using System.Collections.Generic; 
    33using System.Linq; 
    4 using System.Text; 
     4using System.Text;     
    55 
    66namespace SoyText 
     
    1313            this.superSet = superSet; 
    1414            expr2doc = new Dictionary<string, Document>(); 
    15             recents = new List<Document>(); 
     15            recents = new DocumentList(); 
    1616        } 
    1717        Dictionary<string,Document> expr2doc = null; 
    18         List<Document> recents; 
     18        DocumentList recents; 
    1919 
    2020        internal bool add(Document d) 
     
    2626            { 
    2727                expr2doc[c] = d; 
    28                 recents.Add(d); 
     28                recents.add(d); 
    2929            } 
    3030            else 
     
    3434            return true; 
    3535        } 
    36         internal List<Document> getRecents() 
     36        internal DocumentList getRecents() 
    3737        { 
    3838            return recents; 
  • lang/csharp/soyText/soyText/bin/Debug/soyText.application

    r36650 r36733  
    1212        </dsig:Transforms> 
    1313        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
    14         <dsig:DigestValue>WO7NaKrov9ZJeYckPZ/bkERtzPY=</dsig:DigestValue> 
     14        <dsig:DigestValue>QbKbYGZG9Rv42NJ5HdbgHy312Us=</dsig:DigestValue> 
    1515      </hash> 
    1616    </dependentAssembly> 
  • lang/csharp/soyText/soyText/bin/Debug/soyText.exe.manifest

    r36650 r36733  
    114114  </dependency> 
    115115  <dependency> 
    116     <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="129024"> 
     116    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="133120"> 
    117117      <assemblyIdentity name="soyText" version="1.0.0.0" language="neutral" processorArchitecture="msil" /> 
    118118      <hash> 
     
    121121        </dsig:Transforms> 
    122122        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
    123         <dsig:DigestValue>dYPQ1A1O7P3dwDWj5Wy78F6mfTM=</dsig:DigestValue> 
     123        <dsig:DigestValue>s4/FGjF4J8K2w7O1vFRDjCIgxfk=</dsig:DigestValue> 
    124124      </hash> 
    125125    </dependentAssembly> 
    126126  </dependency> 
    127   <file name="soyText.ico" size="1150"> 
     127  <file name="soyText.ico" size="5430"> 
    128128    <hash> 
    129129      <dsig:Transforms> 
     
    131131      </dsig:Transforms> 
    132132      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
    133       <dsig:DigestValue>vhj8XTvtrUg7dbYknTlxCp11YXc=</dsig:DigestValue> 
     133      <dsig:DigestValue>fAA37rDzj6wr6z6Bsj7TxnDzcUY=</dsig:DigestValue> 
    134134    </hash> 
    135135  </file> 
  • lang/csharp/soyText/soyText/bin/Debug/soyText.vshost.application

    r36650 r36733  
    1212        </dsig:Transforms> 
    1313        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
    14         <dsig:DigestValue>WO7NaKrov9ZJeYckPZ/bkERtzPY=</dsig:DigestValue> 
     14        <dsig:DigestValue>QbKbYGZG9Rv42NJ5HdbgHy312Us=</dsig:DigestValue> 
    1515      </hash> 
    1616    </dependentAssembly> 
  • lang/csharp/soyText/soyText/bin/Release/soyText.application

    r36488 r36733  
    55  <deployment install="true" mapFileExtensions="true" /> 
    66  <dependency> 
    7     <dependentAssembly dependencyType="install" codebase="soyText.exe.manifest" size="7046"> 
     7    <dependentAssembly dependencyType="install" codebase="soyText.exe.manifest" size="7506"> 
    88      <assemblyIdentity name="soyText.exe" version="1.0.0.2" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" /> 
    99      <hash> 
     
    1212        </dsig:Transforms> 
    1313        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
    14         <dsig:DigestValue>D8FXY2X0SyPowP4MtjnbgPBYw4A=</dsig:DigestValue> 
     14        <dsig:DigestValue>beohKYxz5iqQyoXCfRTTIMvb+aA=</dsig:DigestValue> 
    1515      </hash> 
    1616    </dependentAssembly> 
  • lang/csharp/soyText/soyText/bin/Release/soyText.exe.manifest

    r36488 r36733  
    22<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1"> 
    33  <asmv1:assemblyIdentity name="soyText.exe" version="1.0.0.2" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" /> 
     4  <description asmv2:iconFile="soyText.ico" xmlns="urn:schemas-microsoft-com:asm.v1" /> 
    45  <application /> 
    56  <entryPoint> 
     
    113114  </dependency> 
    114115  <dependency> 
    115     <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="104448"> 
     116    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="115200"> 
    116117      <assemblyIdentity name="soyText" version="1.0.0.0" language="neutral" processorArchitecture="msil" /> 
    117118      <hash> 
     
    120121        </dsig:Transforms> 
    121122        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
    122         <dsig:DigestValue>Rif36i8Fo2qIUJGDoABT5aNp1Lc=</dsig:DigestValue> 
     123        <dsig:DigestValue>9XmM9u3b7qEvhIzZPefannEyiyA=</dsig:DigestValue> 
    123124      </hash> 
    124125    </dependentAssembly> 
    125126  </dependency> 
     127  <file name="soyText.ico" size="1150"> 
     128    <hash> 
     129      <dsig:Transforms> 
     130        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> 
     131      </dsig:Transforms> 
     132      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 
     133      <dsig:DigestValue>vhj8XTvtrUg7dbYknTlxCp11YXc=</dsig:DigestValue> 
     134    </hash> 
     135  </file> 
    126136</asmv1:assembly>