@@ -12,7 +12,7 @@ namespace NetworkTables
12
12
{
13
13
internal partial class Storage
14
14
{
15
- private bool GetPersistentEntries ( bool periodic , List < ( string key , Value value ) > entries )
15
+ private bool GetPersistentEntries ( bool periodic , List < StoragePair > entries )
16
16
{
17
17
using ( m_monitor . Enter ( ) )
18
18
{
@@ -22,19 +22,19 @@ private bool GetPersistentEntries(bool periodic, List<(string key, Value value)>
22
22
{
23
23
Entry entry = i . Value ;
24
24
if ( ! entry . IsPersistent ( ) ) continue ;
25
- entries . Add ( ( i . Key , entry . Value ) ) ;
25
+ entries . Add ( new StoragePair ( i . Key , entry . Value ) ) ;
26
26
}
27
27
}
28
28
entries . Sort ( ) ;
29
29
return true ;
30
30
}
31
31
32
- private static async Task SavePersistentImpl ( StreamWriter stream , IEnumerable < ( string key , Value value ) > entries )
32
+ private static async Task SavePersistentImpl ( StreamWriter stream , IEnumerable < StoragePair > entries )
33
33
{
34
34
await stream . WriteAsync ( "[NetworkTables Storage 3.0]\n " ) . ConfigureAwait ( false ) ;
35
35
foreach ( var i in entries )
36
36
{
37
- var v = i . value ;
37
+ var v = i . Second ;
38
38
if ( v == null ) continue ;
39
39
switch ( v . Type )
40
40
{
@@ -63,7 +63,7 @@ private static async Task SavePersistentImpl(StreamWriter stream, IEnumerable<(s
63
63
continue ;
64
64
}
65
65
66
- await WriteStringAsync ( stream , i . key ) . ConfigureAwait ( false ) ;
66
+ await WriteStringAsync ( stream , i . First ) . ConfigureAwait ( false ) ;
67
67
68
68
await stream . WriteAsync ( '=' ) . ConfigureAwait ( false ) ;
69
69
@@ -260,7 +260,7 @@ private static void UnescapeString(string source, out string dest)
260
260
261
261
public void SavePersistent ( Stream stream , bool periodic )
262
262
{
263
- List < ( string key , Value value ) > entries = new List < ( string key , Value value ) > ( ) ;
263
+ List < StoragePair > entries = new List < StoragePair > ( ) ;
264
264
if ( ! GetPersistentEntries ( periodic , entries ) ) return ;
265
265
StreamWriter w = new StreamWriter ( stream ) ;
266
266
Task task = SavePersistentImpl ( w , entries ) ;
@@ -281,7 +281,7 @@ public string SavePersistent(string filename, bool periodic)
281
281
bak += ".bak" ;
282
282
283
283
//Get entries before creating files
284
- List < ( string key , Value value ) > entries = new List < ( string key , Value value ) > ( ) ;
284
+ List < StoragePair > entries = new List < StoragePair > ( ) ;
285
285
if ( ! GetPersistentEntries ( periodic , entries ) ) return null ;
286
286
287
287
@@ -349,7 +349,7 @@ public async Task<string> SavePersistentAsync(string filename, bool periodic)
349
349
bak += ".bak" ;
350
350
351
351
//Get entries before creating files
352
- List < ( string key , Value value ) > entries = new List < ( string key , Value value ) > ( ) ;
352
+ List < StoragePair > entries = new List < StoragePair > ( ) ;
353
353
if ( ! GetPersistentEntries ( periodic , entries ) ) return null ;
354
354
355
355
string err = null ;
@@ -523,7 +523,7 @@ public async Task<bool> LoadPersistentAsync(Stream stream, Action<int, string> w
523
523
{
524
524
int lineNum = 1 ;
525
525
526
- List < ( string key , Value value ) > entries = new List < ( string key , Value value ) > ( ) ;
526
+ List < StoragePair > entries = new List < StoragePair > ( ) ;
527
527
528
528
List < bool > boolArray = new List < bool > ( ) ;
529
529
List < double > doubleArray = new List < double > ( ) ;
@@ -657,7 +657,7 @@ public async Task<bool> LoadPersistentAsync(Stream stream, Action<int, string> w
657
657
}
658
658
if ( name . Length != 0 && value != null )
659
659
{
660
- entries . Add ( ( name , value ) ) ;
660
+ entries . Add ( new StoragePair ( name , value ) ) ;
661
661
}
662
662
663
663
}
@@ -670,13 +670,13 @@ public async Task<bool> LoadPersistentAsync(Stream stream, Action<int, string> w
670
670
monitor = await m_monitor . EnterAsync ( ) . ConfigureAwait ( false ) ;
671
671
foreach ( var i in entries )
672
672
{
673
- if ( ! m_entries . TryGetValue ( i . key , out Entry entry ) )
673
+ if ( ! m_entries . TryGetValue ( i . First , out Entry entry ) )
674
674
{
675
- entry = new Entry ( i . key ) ;
676
- m_entries . Add ( i . key , entry ) ;
675
+ entry = new Entry ( i . First ) ;
676
+ m_entries . Add ( i . First , entry ) ;
677
677
}
678
678
var oldValue = entry . Value ;
679
- entry . Value = i . value ;
679
+ entry . Value = i . Second ;
680
680
bool wasPersist = entry . IsPersistent ( ) ;
681
681
if ( ! wasPersist ) entry . Flags |= EntryFlags . Persistent ;
682
682
@@ -691,28 +691,28 @@ public async Task<bool> LoadPersistentAsync(Stream stream, Action<int, string> w
691
691
{
692
692
if ( oldValue != null )
693
693
{
694
- m_notifier . NotifyEntry ( i . key , i . value , ( NotifyFlags . NotifyNew | NotifyFlags . NotifyLocal ) ) ;
694
+ m_notifier . NotifyEntry ( i . First , i . Second , ( NotifyFlags . NotifyNew | NotifyFlags . NotifyLocal ) ) ;
695
695
}
696
- else if ( oldValue != i . value )
696
+ else if ( oldValue != i . Second )
697
697
{
698
698
NotifyFlags notifyFlags = NotifyFlags . NotifyUpdate | NotifyFlags . NotifyLocal ;
699
699
if ( ! wasPersist ) notifyFlags |= NotifyFlags . NotifyFlagsChanged ;
700
- m_notifier . NotifyEntry ( i . key , i . value , notifyFlags ) ;
700
+ m_notifier . NotifyEntry ( i . First , i . Second , notifyFlags ) ;
701
701
}
702
702
}
703
703
704
704
if ( m_queueOutgoing == null ) continue ;
705
705
++ entry . SeqNum ;
706
706
707
- if ( oldValue == null || oldValue . Type != i . value . Type )
707
+ if ( oldValue == null || oldValue . Type != i . Second . Type )
708
708
{
709
- msgs . Add ( Message . EntryAssign ( i . key , entry . Id , entry . SeqNum . Value , i . value , entry . Flags ) ) ;
709
+ msgs . Add ( Message . EntryAssign ( i . First , entry . Id , entry . SeqNum . Value , i . Second , entry . Flags ) ) ;
710
710
}
711
711
else if ( entry . Id != 0xffff )
712
712
{
713
- if ( oldValue != i . value )
713
+ if ( oldValue != i . Second )
714
714
{
715
- msgs . Add ( Message . EntryUpdate ( entry . Id , entry . SeqNum . Value , i . value ) ) ;
715
+ msgs . Add ( Message . EntryUpdate ( entry . Id , entry . SeqNum . Value , i . Second ) ) ;
716
716
}
717
717
if ( ! wasPersist )
718
718
msgs . Add ( Message . FlagsUpdate ( entry . Id , entry . Flags ) ) ;
0 commit comments