public void Fetch(AggregationHandler handler, bool localOnly, bool preProcessed = false) { m_AggregationHandler = handler; EditorPrefs.SetString(k_UrlKey, m_RawDataPath); DateTime start, end; try { start = DateTime.Parse(m_StartDate).ToUniversalTime(); } catch { throw new Exception("The start date is not properly formatted. Correct format is YYYY-MM-DD."); } try { // Add one day to include the whole of that day end = DateTime.Parse(m_EndDate).ToUniversalTime().Add(new TimeSpan(24, 0, 0)); } catch { throw new Exception("The end date is not properly formatted. Correct format is YYYY-MM-DD."); } RawDataClient.GetInstance().m_DataPath = m_DataPath; var fileList = RawDataClient.GetInstance().GetFiles(new UnityAnalyticsEventType[] { UnityAnalyticsEventType.custom }, start, end); ProcessAggregation(fileList); }
void ProcessAggregation() { DateTime start, end; try { start = DateTime.Parse(m_StartDate).ToUniversalTime(); } catch { start = DateTime.Parse("2000-01-01").ToUniversalTime(); } try { end = DateTime.Parse(m_EndDate).ToUniversalTime().Add(new TimeSpan(24, 0, 0)); } catch { end = DateTime.UtcNow; } if (m_DateChangeHasOccurred || RawDataClient.GetInstance().m_ManifestInvalidated || m_ViewModel.m_RawDataFileList == null || m_ViewModel.m_RawDataFileList.Count == 0) { RawDataClient.GetInstance().m_DataPath = m_RawDataPath; m_ViewModel.m_RawDataFileList = RawDataClient.GetInstance().GetFiles( new UnityAnalyticsEventType[] { UnityAnalyticsEventType.custom }, start, end); m_DateChangeHasOccurred = false; if (m_ViewModel.m_RawDataFileList.Count == 0) { return; } } if (m_InspectorViewModel.remapDensity && string.IsNullOrEmpty(m_InspectorViewModel.remapColorField)) { Debug.LogWarning("You have selected 'Remap color to field' but haven't specified a field name. No remapping can occur."); } // When these are the same, points where these values match will be aggregated to the same point var aggregateOn = new List <string>() { "x", "y", "z", "t", "rx", "ry", "rz", "dx", "dy", "dz", "z" }; // Specify groupings for unique lists var groupOn = new List <string>() { "eventName" }; // userID is optional if (m_InspectorViewModel.separateUsers) { aggregateOn.Add("userID"); groupOn.Add("userID"); } if (m_SeparateSessions) { aggregateOn.Add("sessionID"); groupOn.Add("sessionID"); } if (m_SeparateDebug) { aggregateOn.Add("debug"); groupOn.Add("debug"); } if (m_SeparatePlatform) { aggregateOn.Add("platform"); groupOn.Add("platform"); } // Arbitrary Fields are included if specified if (m_SeparateCustomField) { aggregateOn.AddRange(m_SeparationFields); groupOn.AddRange(m_SeparationFields); } // Specify smoothing properties (must be a subset of aggregateOn) var smoothOn = new Dictionary <string, float>(); // Smooth space if (m_InspectorViewModel.smoothSpaceOption == SMOOTH_VALUE || m_InspectorViewModel.smoothSpaceOption == SMOOTH_NONE) { float spaceSmoothValue = (m_InspectorViewModel.smoothSpaceOption == SMOOTH_NONE) ? 0f : m_InspectorViewModel.smoothSpace; smoothOn.Add("x", spaceSmoothValue); smoothOn.Add("y", spaceSmoothValue); smoothOn.Add("z", spaceSmoothValue); smoothOn.Add("dx", spaceSmoothValue); smoothOn.Add("dy", spaceSmoothValue); smoothOn.Add("dz", spaceSmoothValue); } // Smooth rotation if (m_InspectorViewModel.smoothRotationOption == SMOOTH_VALUE || m_InspectorViewModel.smoothRotationOption == SMOOTH_NONE) { float rotationSmoothValue = (m_InspectorViewModel.smoothRotationOption == SMOOTH_NONE) ? 0f : m_InspectorViewModel.smoothRotation; smoothOn.Add("rx", rotationSmoothValue); smoothOn.Add("ry", rotationSmoothValue); smoothOn.Add("rz", rotationSmoothValue); } // Smooth time if (m_InspectorViewModel.smoothTimeOption == SMOOTH_VALUE || m_InspectorViewModel.smoothTimeOption == SMOOTH_NONE) { float timeSmoothValue = (m_InspectorViewModel.smoothTimeOption == SMOOTH_NONE) ? 0f : m_InspectorViewModel.smoothTime; smoothOn.Add("t", timeSmoothValue); } string remapToField = m_InspectorViewModel.remapDensity ? m_InspectorViewModel.remapColorField : ""; int remapOption = m_InspectorViewModel.remapDensity ? m_InspectorViewModel.remapOptionIndex : 0; m_Aggregator.Process(OnAggregated, m_ViewModel.m_RawDataFileList, start, end, aggregateOn, smoothOn, groupOn, remapToField, m_RemapOptionIds[remapOption], m_InspectorViewModel.remapPercentile); }
/// <summary> /// Fetch the files within the currently specified date range. /// </summary> public void Fetch() { RawDataClient.GetInstance().m_DataPath = m_RawDataPath; ProcessAggregation(); }