Changeset 350 for binary-improvements/MapRendering/Web/LogBuffer.cs
- Timestamp:
- Jan 19, 2019, 6:08:32 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/LogBuffer.cs
r326 r350 19 19 if (instance == null) { 20 20 instance = new LogBuffer (); 21 } ;21 } 22 22 } 23 23 … … 60 60 } 61 61 62 public LogEntry this [int index] {62 public LogEntry this [int _index] { 63 63 get { 64 64 lock (logEntries) { 65 if ( index >= listOffset &&index < listOffset + logEntries.Count) {66 return logEntries [ index];65 if (_index >= listOffset && _index < listOffset + logEntries.Count) { 66 return logEntries [_index]; 67 67 } 68 68 } … … 101 101 } 102 102 103 private readonly List<LogEntry> emptyList = new List<LogEntry> (); 104 103 105 public List<LogEntry> GetRange (ref int _start, int _count, out int _end) { 104 106 lock (logEntries) { 105 if (_count < 1) { 107 int index; 108 109 if (_count < 0) { 110 _count = -_count; 111 112 if (_start >= listOffset + logEntries.Count) { 113 _start = listOffset + logEntries.Count - 1; 114 } 115 106 116 _end = _start; 107 return new List<LogEntry> (); 117 118 if (_start < listOffset) { 119 return emptyList; 120 } 121 122 _start -= _count - 1; 123 124 if (_start < listOffset) { 125 _start = listOffset; 126 } 127 128 index = _start - listOffset; 129 _end += 1; 130 _count = _end - _start; 131 } else { 132 if (_start < listOffset) { 133 _start = listOffset; 134 } 135 136 if (_start >= listOffset + logEntries.Count) { 137 _end = _start; 138 return emptyList; 139 } 140 141 index = _start - listOffset; 142 143 if (index + _count > logEntries.Count) { 144 _count = logEntries.Count - index; 145 } 146 147 _end = _start + _count; 108 148 } 109 110 if (_start < listOffset) {111 _start = listOffset;112 }113 114 if (_start >= listOffset + logEntries.Count) {115 _end = _start;116 return new List<LogEntry> ();117 }118 119 int index = _start - listOffset;120 121 if (index + _count > logEntries.Count) {122 _count = logEntries.Count - index;123 }124 125 _end = _start + _count;126 149 127 150 return logEntries.GetRange (index, _count);
Note:
See TracChangeset
for help on using the changeset viewer.