public void TrackEvent( float time, string key, string value ) { AnalyticDataIndividual data = new AnalyticDataIndividual(); ; { data.Timestamp = time; data.Key = key; data.Value = value; } TrackEvent( data ); }
public void TrackEvent( AnalyticDataIndividual data ) { if ( ( data.Key.Length == 0 ) && ( data.Value.Length == 0 ) ) return; int occur = -1; bool add = true; { // Try to find data within occurrences { for ( int key = 0; key < Occurrences.Count; key++ ) { if ( Occurrences[key].Key == data.Key ) { occur = key; break; } } } // If not add and continue if ( occur == -1 ) { AnalyticDataIndividual datakey = new AnalyticDataIndividual(); { datakey.Key = data.Key; data.Timestamp = 0; } Occurrences.Add( datakey ); occur = Occurrences.Count - 1; } // Otherwise add and check for over max else if ( Occurrences[occur].Timestamp > MAXOCCURRENCES ) { add = false; } } if ( add ) { AnalyticDataIndividual temp = Occurrences[occur]; { temp.Timestamp++; } Occurrences.RemoveAt( occur ); Occurrences.Insert( occur, temp ); RoundData.Add( data ); } }