Changeset 33970 for lang/csharp
- Timestamp:
- 06/14/09 23:24:17 (4 years ago)
- Location:
- lang/csharp/soyText/soyText
- Files:
-
- 4 added
- 8 removed
- 14 modified
-
Converter.cs (modified) (1 diff)
-
DocumentList.cs (modified) (1 diff)
-
DocumentListMap.cs (added)
-
DocumentSearcher.cs (added)
-
DocumentSercher.cs (deleted)
-
DocumentSet.cs (modified) (8 diffs)
-
EditorTab.cs (modified) (2 diffs)
-
IDocumentSearcher.cs (added)
-
LoggedDocumentSearcher.cs (modified) (1 diff)
-
PythonEngine.cs (modified) (1 diff)
-
PythonUtil.cs (modified) (2 diffs)
-
UniqueList.cs (added)
-
bin/Debug/Microsoft.DirectX.AudioVideoPlayback.dll (deleted)
-
bin/Debug/Microsoft.DirectX.Diagnostics.dll (deleted)
-
bin/Debug/Microsoft.DirectX.DirectDraw.dll (deleted)
-
bin/Debug/Microsoft.DirectX.DirectInput.dll (deleted)
-
bin/Debug/Microsoft.DirectX.DirectPlay.dll (deleted)
-
bin/Debug/Microsoft.DirectX.DirectSound.dll (deleted)
-
bin/Debug/Microsoft.DirectX.dll (deleted)
-
bin/Debug/soyText.application (modified) (1 diff)
-
bin/Debug/soyText.exe (modified) (previous)
-
bin/Debug/soyText.exe.manifest (modified) (2 diffs)
-
bin/Debug/soyText.pdb (modified) (previous)
-
bin/Debug/soyText.vshost.application (modified) (1 diff)
-
soyText.csproj (modified) (3 diffs)
-
soyText.suo (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
lang/csharp/soyText/soyText/Converter.cs
r33887 r33970 19 19 Application.Exit(); 20 20 } 21 foreach (var d in w.documentSet.search("" )) {21 foreach (var d in w.documentSet.search("",false)) { 22 22 var id = d.parsed["id"] ?? "null"; 23 23 id = Regex.Replace(id, @"[^0-9A-Za-z_\-@]", ""); -
lang/csharp/soyText/soyText/DocumentList.cs
r33649 r33970 8 8 public class DocumentList: SortedList<long,Document> 9 9 { 10 public voidadd(Document d)10 public bool add(Document d) 11 11 { 12 Add(d.uniqueLastUpdate, d); 12 var key=-d.uniqueLastUpdate; 13 if (ContainsKey(key)) return false; 14 Add(key, d); 15 return true; 13 16 } 14 17 } -
lang/csharp/soyText/soyText/DocumentSet.cs
r33887 r33970 10 10 { 11 11 public enum FoundHandlerAction { End, Accept, Ignore }; 12 public delegate FoundHandlerAction FoundHandler(Document d);12 //public delegate FoundHandlerAction FoundHandler(Document d); 13 13 public class DocumentSet 14 14 { … … 16 16 public int maxHandle = -1; 17 17 internal Workspace workspace; 18 DocumentList cache=null;18 DocumentListMap cache=null; 19 19 public String stateDir(DocumentState state) 20 20 { … … 50 50 private Document addToCache(Document d) 51 51 { 52 if (cache == null) cache = new DocumentList ();52 if (cache == null) cache = new DocumentListMap(); 53 53 lock (cache) 54 54 { 55 cache. Add(-d.uniqueLastUpdate,d);55 cache.add(d); 56 56 } 57 57 return d; … … 64 64 public DocumentList getRecents() 65 65 { 66 if (cache != null) return cache ;66 if (cache != null) return cache.getRecents(); 67 67 Debug.print("文書一覧取得中..."); 68 68 //var res = new DocumentList(); … … 72 72 searchMax(DocumentState.indexed,true);*/ 73 73 searchMax(DocumentState.active, true); 74 if (cache == null) cache = new DocumentList ();74 if (cache == null) cache = new DocumentListMap(); 75 75 Debug.print("文書一覧並べ替え中..."); 76 76 //res.Sort(byRecency); 77 77 Debug.print("END: 文書一覧並べ替え中..."); 78 79 return cache ;78 79 return cache.getRecents(); 80 80 } 81 81 Dictionary<DocumentState, int> docCount; … … 98 98 } 99 99 } 100 public Document byId(string id) 101 { 102 getRecents(); 103 return cache.byId(id); 104 } 100 105 public void clear() 101 106 { … … 114 119 return lastPublishedID=res; 115 120 } 116 public DocumentSe rcher createDocumentSearcher(String kw, FoundHandler f)121 public DocumentSearcher createDocumentSearcher(SearchCondition cond) 117 122 { 118 var s = new DocumentSercher(); 119 s.searchCondition = SearchCondition.fromExpression(kw); 120 s.foundHandler = f; 123 var s = new DocumentSearcher(); 124 s.searchCondition = cond; 121 125 s.documentSet = this; 122 126 return s; 123 127 } 124 public IEnumerable<Document> search(string kw) 128 129 public IDocumentSearcher createDocumentSearcher(String kw, bool logging) 125 130 { 126 var s=createDocumentSearcher(kw,null); 131 if (logging) 132 { 133 if (kw == "") 134 { 135 return createDocumentSearcher("", false); 136 } 137 return createLoggedDocumentSearcher(kw); 138 } 139 else 140 { 141 var s = new DocumentSearcher(); 142 s.searchCondition = SearchCondition.fromExpression(kw); 143 s.documentSet = this; 144 return s; 145 } 146 } 147 public LoggedDocumentSearcher createLoggedDocumentSearcher(string cond) 148 { 149 return new LoggedDocumentSearcher(this, cond); 150 } 151 public IEnumerable<Document> search(string kw, bool logging) 152 { 153 var s=createDocumentSearcher(kw,logging); 127 154 return s.search(); 128 155 } … … 132 159 return r[0]; 133 160 } 161 162 internal IEnumerable<object> search(SearchCondition condition) 163 { 164 return search(condition); 165 } 134 166 } 135 167 } -
lang/csharp/soyText/soyText/EditorTab.cs
r33887 r33970 98 98 TerminableThread searchThread; 99 99 TerminableThread lineSearchThread; 100 DocumentSercher documentSearcher;100 IDocumentSearcher documentSearcher; 101 101 public void syncUI(SyncUIAction a) { 102 102 SyncUI.exe(a); … … 135 135 docListBox.Items.Clear(); 136 136 }); 137 documentSearcher = documentSet.createDocumentSearcher(kw,null); 137 documentSearcher = documentSet.createDocumentSearcher(kw,false); 138 138 139 foreach (var d2 in documentSearcher.search()) 139 140 //delegate(Document d) -
lang/csharp/soyText/soyText/LoggedDocumentSearcher.cs
r33852 r33970 6 6 namespace SoyText 7 7 { 8 class LoggedDocumentSearcher8 public class LoggedDocumentSearcher : IDocumentSearcher 9 9 { 10 10 DocumentSet documentSet; 11 IDocumentSearcher noLogSrc; 12 string condition; 13 public LoggedDocumentSearcher(DocumentSet documentSet,string cond) 14 { 15 this.documentSet = documentSet; 16 condition = cond; 17 } 11 18 public static bool isLoggingOfPastTimeStampGeneration(Document d) 12 19 { 13 20 return d.parsed["type"] == "ImportLog"; 14 21 } 15 public IEnumerable<Document> search(string kw) 22 bool terminated = false; 23 public void terminate() 16 24 { 17 var searchLog = documentSet.searchLogSet.addOrGet(kw); 18 bool useSearchLog=searchLog.parsed["hasCache"]=="true"; 19 List<string> res = new List<string>(); 20 foreach (var d in documentSet.search(kw)) { 21 res.Add(d.id); 22 yield return d; 25 if (noLogSrc == null) return; 26 terminated = true; 27 noLogSrc.terminate(); 28 } 29 public IEnumerable<Document> search() 30 { 31 bool useSearchLog = false; 32 Document searchLog = null; 33 try 34 { 35 36 searchLog = documentSet.searchLogSet.addOrGet(condition); 37 searchLog.parsed["closed"] = "false"; 38 useSearchLog = searchLog.parsed["hasCache"] == "true"; 39 40 UniqueList<string> res = new UniqueList<string>(); 41 noLogSrc = documentSet.createDocumentSearcher(condition, false); 42 foreach (var d in noLogSrc.search()) 43 { 44 res.add(d.id); 45 yield return d; 46 if (useSearchLog) 47 { 48 if (isLoggingOfPastTimeStampGeneration(d)) 49 { 50 useSearchLog = false; 51 } 52 if (d.id == searchLog.id) 53 { 54 break; 55 } 56 } 57 } 58 if (terminated) yield break; 23 59 if (useSearchLog) 24 60 { 25 if (isLoggingOfPastTimeStampGeneration(d))61 foreach (var l in Str.eachLine(searchLog.body)) 26 62 { 27 useSearchLog = false; 28 } 29 if (d.id == searchLog.id) 30 { 31 break; 63 var d = documentSet.byId(l); 64 if (d != null) 65 { 66 if (res.add(l)) 67 { 68 yield return d; 69 } 70 } 32 71 } 33 72 } 34 } 35 if (useSearchLog) 36 { 37 foreach (var l in Str.eachLine(searchLog.body)) 73 searchLog.parsed["hasCache"] = "true"; 74 var con = ""; 75 foreach (var id in res) 38 76 { 39 res.Add(l); 77 con += id + "\r\n"; 78 } 79 searchLog.body = con; 80 if (!terminated) 81 { 82 searchLog.save(); 40 83 } 41 84 } 42 searchLog.parsed["hasCache"] = "true"; 85 finally 86 { 87 searchLog.save(); 88 } 43 89 } 44 90 } -
lang/csharp/soyText/soyText/PythonEngine.cs
r33783 r33970 48 48 catch (Exception ex) 49 49 { 50 50 51 MessageBox.Show(ex.ToString()); 51 52 //return "Error executing code: " + ex.ToString(); -
lang/csharp/soyText/soyText/PythonUtil.cs
r33783 r33970 3 3 using System.Linq; 4 4 using System.Text; 5 using System.Text.RegularExpressions; 5 6 6 7 namespace SoyText … … 20 21 public void write(object o) 21 22 { 22 stdout += o; 23 var s = o + ""; 24 s = Regex.Replace(s, @"\r*\n", "\r\n"); 25 stdout += s; 23 26 } 24 27 public PythonUtil(DocumentSet s) -
lang/csharp/soyText/soyText/bin/Debug/soyText.application
r33887 r33970 12 12 </dsig:Transforms> 13 13 <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 14 <dsig:DigestValue> im1npT+HIoJhF5lA1zyCeNKJWak=</dsig:DigestValue>14 <dsig:DigestValue>5x0RfGAb0hKKRBBG4uaBfsvDOP0=</dsig:DigestValue> 15 15 </hash> 16 16 </dependentAssembly> -
lang/csharp/soyText/soyText/bin/Debug/soyText.exe.manifest
r33887 r33970 113 113 </dependency> 114 114 <dependency> 115 <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="7 4752">115 <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="76800"> 116 116 <assemblyIdentity name="soyText" version="1.0.0.0" language="neutral" processorArchitecture="msil" /> 117 117 <hash> … … 120 120 </dsig:Transforms> 121 121 <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 122 <dsig:DigestValue> 2PXEjnMCcNfs+glU3ouLw3jxRDs=</dsig:DigestValue>122 <dsig:DigestValue>cejsNAlmEozSx4YsLLN87rI9Ajs=</dsig:DigestValue> 123 123 </hash> 124 124 </dependentAssembly> -
lang/csharp/soyText/soyText/bin/Debug/soyText.vshost.application
r33887 r33970 12 12 </dsig:Transforms> 13 13 <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 14 <dsig:DigestValue> im1npT+HIoJhF5lA1zyCeNKJWak=</dsig:DigestValue>14 <dsig:DigestValue>5x0RfGAb0hKKRBBG4uaBfsvDOP0=</dsig:DigestValue> 15 15 </hash> 16 16 </dependentAssembly> -
lang/csharp/soyText/soyText/soyText.csproj
r33852 r33970 100 100 <Compile Include="AnyCondition.cs" /> 101 101 <Compile Include="DocumentList.cs" /> 102 <Compile Include="DocumentSercher.cs" /> 102 <Compile Include="DocumentListMap.cs" /> 103 <Compile Include="DocumentSearcher.cs" /> 103 104 <Compile Include="DocumentSet.cs" /> 104 105 <Compile Include="DThread.cs" /> … … 128 129 <DependentUpon>Form2.cs</DependentUpon> 129 130 </Compile> 131 <Compile Include="IDocumentSearcher.cs" /> 130 132 <Compile Include="ImportDialog.cs"> 131 133 <SubType>Form</SubType> … … 195 197 <Compile Include="Tokenizer.cs" /> 196 198 <Compile Include="TxtEnc.cs" /> 199 <Compile Include="UniqueList.cs" /> 197 200 <Compile Include="Workspace.cs" /> 198 201 <Compile Include="WorkspaceSelector.cs">
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)