Changeset 31654
- Timestamp:
- 03/29/09 12:43:45 (4 years ago)
- Location:
- lang/csharp/soyText/soyText
- Files:
-
- 1 added
- 7 modified
-
Debug.cs (added)
-
Document.cs (modified) (2 diffs)
-
DocumentSet.cs (modified) (4 diffs)
-
Form1.cs (modified) (5 diffs)
-
Token.cs (modified) (2 diffs)
-
bin/Debug/soyText.exe (modified) (previous)
-
bin/Debug/soyText.pdb (modified) (previous)
-
soyText.csproj (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/csharp/soyText/soyText/Document.cs
r31620 r31654 64 64 tx.Write(content); 65 65 tx.Close(); 66 _lastUpdate = null; 66 67 } 67 68 public Boolean isNew … … 95 96 get { return documentSet.getFileName(handle, state); } 96 97 } 97 public DateTime lastUpdate 98 long? _lastUpdate = null; 99 public long lastUpdate 98 100 { 99 101 get 100 102 { 101 return File.GetLastWriteTime(fileName); 103 if (_lastUpdate != null) return (long)_lastUpdate; 104 return (long)(_lastUpdate = File.GetLastWriteTime(fileName).Ticks); 102 105 } 103 106 } -
lang/csharp/soyText/soyText/DocumentSet.cs
r31517 r31654 34 34 public int byRecency(Document d1, Document d2) 35 35 { 36 long d = d1.lastUpdate .Ticks - d2.lastUpdate.Ticks;36 long d = d1.lastUpdate - d2.lastUpdate; 37 37 return (d == 0 ? 0 : (d < 0 ? 1 : -1)); 38 38 } 39 39 public List<Document> getRecents() 40 40 { 41 Debug.print("文書一覧取得中..."); 41 42 var res = new List<Document>(); 42 43 foreach (string fileName … … 49 50 res.Add(createDocument(handle)); 50 51 } 52 Debug.print("文書一覧並べ替え中..."); 51 53 res.Sort(byRecency);/* delegate(Document d1, Document d2) 52 54 { … … 67 69 var t = workspace.indexer.createToken(kw); 68 70 var res = new HashSet<Document>(); 69 71 Debug.print("文字検索: " + kw); 70 72 foreach (var st in t.existentSuperstrings) 71 73 { 72 74 res.UnionWith(exactSearch(st)); 75 } 76 Debug.print("activeな文書を検索: " + kw); 77 foreach (var d in getRecents()) 78 { 79 if (d.matches(kw)) res.Add(d); 73 80 } 74 81 /* … … 92 99 }*/ 93 100 var resList = res.ToList(); 101 Debug.print("検索結果の並べ替え: "+kw); 94 102 resList.Sort(byRecency); 103 Debug.print("End: 検索結果の並べ替え: " + kw); 95 104 return resList; 96 105 //return getRecents().FindAll(d => d.matches(kw)); -
lang/csharp/soyText/soyText/Form1.cs
r31620 r31654 14 14 namespace SoyText 15 15 { 16 public delegate void SyncUIAction(); 16 17 public partial class Form1 : Form 17 18 { … … 21 22 public static Form1 defaultInstance; 22 23 String _statusText = ""; 24 Queue<SyncUIAction> uiActionQueue=new Queue<SyncUIAction>(); 23 25 public String statusText 24 26 { … … 55 57 } 56 58 IEnumerator<int> listings; 59 public DocumentSet documentSet 60 { 61 get { return workspace.documentSet; } 62 } 57 63 public void refreshList() 58 64 { 59 //docList.Items.Clear(); 60 docListBox.Items.Clear(); 61 listings = refreshListLoop(null); 62 } 63 public DocumentSet documentSet 64 { 65 get { return workspace.documentSet; } 66 } 67 public IEnumerator<int> refreshListLoop(String kw) { 68 var cnt = 0; 69 foreach (Document d in documentSet.search(kw)) 70 { 71 //var i = docList.Items.Add("" + d.handle); 72 if (kw==null || d.matches(kw)) 73 { 74 docListBox.Items.Add(d);//"" + d.handle); 65 refreshList(null); 66 } 67 public void refreshList(String kw) { 68 new Thread(delegate() 69 { 70 var cnt = 0; 71 var res = documentSet.search(kw); 72 syncUI(delegate() 73 { 74 docListBox.Items.Clear(); 75 }); 76 foreach (Document d in res) 77 { 78 //var i = docList.Items.Add("" + d.handle); 79 var d2 = d; 80 //if (kw == null || d.matches(kw)) 81 //{ 82 syncUI(delegate() 83 { 84 docListBox.Items.Add(d2); 85 }); 86 //} 87 Thread.Sleep(1); 88 //if (cnt % 10 == 0) yield return 0; 89 cnt++; 90 if (cnt > 100) break; 75 91 } 76 if (cnt % 10 == 0) yield return 0; 77 cnt++; 78 if (cnt > 100) yield break; 79 } 80 } 81 92 statusText = "完了"; 93 }).Start(); 94 } 95 public void syncUI(SyncUIAction u) 96 { 97 uiActionQueue.Enqueue(u); 98 } 82 99 private void newDocument() 83 100 { … … 103 120 if (e.KeyCode.Equals(Keys.Enter)) 104 121 { 105 var s=documentSet.search(command.Text); 106 docListBox.Items.Clear(); 107 listings = refreshListLoop(command.Text); 122 //var s=documentSet.search(command.Text); 123 refreshList(command.Text); 108 124 /* 109 125 var lim = 100; … … 132 148 listings = null; 133 149 } 150 } 151 //Text = "" + uiActionQueue.Count; 152 while (uiActionQueue.Count > 0) 153 { 154 uiActionQueue.Dequeue().Invoke(); 134 155 } 135 156 } -
lang/csharp/soyText/soyText/Token.cs
r31441 r31654 95 95 { 96 96 get { 97 if (!File.Exists(superstringPath)) return 0; 97 98 return new FileInfo(superstringPath).Length; 98 99 } … … 139 140 { 140 141 if (content.Length == 1) return res; 141 142 142 143 var ct = mostRareChar; 143 144 foreach (var t in ct.existentSuperstrings) -
lang/csharp/soyText/soyText/soyText.csproj
r31588 r31654 49 49 </ItemGroup> 50 50 <ItemGroup> 51 <Compile Include="Debug.cs" /> 51 52 <Compile Include="Document.cs" /> 52 53 <Compile Include="DocumentSet.cs" />
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)