-
Notifications
You must be signed in to change notification settings - Fork 1
/
GoogleTagManagerController.cs
77 lines (70 loc) · 3.05 KB
/
GoogleTagManagerController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Services.Analytics
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using DotNetNuke.Common;
using DotNetNuke.Instrumentation;
using DotNetNuke.Services.Log.EventLog;
/// -----------------------------------------------------------------------------
/// Namespace: DotNetNuke.Services.Analytics
/// Module: GoogleAnalytics
/// -----------------------------------------------------------------------------
/// <summary>
/// Controller class definition for GoogleTagManager which handles upgrades.
/// </summary>
/// -----------------------------------------------------------------------------
public class GoogleTagManagerController
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(GoogleTagManagerController));
/// -----------------------------------------------------------------------------
/// <summary>
/// Handles module upgrades includes a new Google Tag Manager Asychronous script.
/// </summary>
/// <param name = "version">Target Version number for the upgrade.</param>
/// -----------------------------------------------------------------------------
public void UpgradeModule(string version)
{
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Retrieves the Google Tag Manager config file, "GoogleTagManager.config".
/// </summary>
/// <returns>Streamreader for the Google Tag Manager config file.</returns>
/// -----------------------------------------------------------------------------
private StreamReader GetConfigFile()
{
StreamReader fileReader = null;
string filePath = string.Empty;
try
{
filePath = Globals.ApplicationMapPath + "\\DesktopModules\\Connectors\\GoogleTagManager\\GoogleTagManager.config";
if (File.Exists(filePath))
{
fileReader = new StreamReader(filePath);
}
}
catch (Exception ex)
{
// log it
var log = new LogInfo { LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString() };
log.AddProperty("GoogleTagManager", "GetConfigFile Failed");
log.AddProperty("FilePath", filePath);
log.AddProperty("ExceptionMessage", ex.Message);
LogController.Instance.AddLog(log);
if (fileReader != null)
{
fileReader.Close();
}
Logger.Error(ex);
}
return fileReader;
}
}
}