~alexharrington/xibo/upgrade-db-backup-switch

« back to all changes in this revision

Viewing changes to client/dotNET/HardwareKey.cs

  • Committer: Dan Garner
  • Date: 2009-08-02 17:26:04 UTC
  • mfrom: (55.3.7 1.0.0)
  • Revision ID: mail@dangarner.co.uk-20090802172604-8dgszq4st41u39qu
MergedĀ lp:~dangarner/xibo/xmds-logging-103

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        {
32
32
            System.Diagnostics.Debug.WriteLine("[IN]", "HardwareKey");
33
33
 
34
 
            hardwareKey = Hashes.MD5(GetCPUId() + GetVolumeSerial("C"));
 
34
            // Get the key from the Settings
 
35
            hardwareKey = Properties.Settings.Default.hardwareKey;
 
36
 
 
37
            // Is the key empty?
 
38
            if (hardwareKey == "")
 
39
            {
 
40
                // Calculate the Hardware key from the CPUID and Volume Serial
 
41
                hardwareKey = Hashes.MD5(GetCPUId() + GetVolumeSerial("C"));
 
42
 
 
43
                // Store the key
 
44
                Properties.Settings.Default.hardwareKey = hardwareKey;
 
45
            }
35
46
 
36
47
            System.Diagnostics.Debug.WriteLine("[OUT]", "HardwareKey");
37
48
        }
48
59
        }
49
60
 
50
61
        /// <summary>
 
62
        /// Regenerates the hardware key
 
63
        /// </summary>
 
64
        public void Regenerate()
 
65
        {
 
66
            // Calculate the Hardware key from the CPUID and Volume Serial
 
67
            hardwareKey = Hashes.MD5(GetCPUId() + GetVolumeSerial("C"));
 
68
 
 
69
            // Store the key
 
70
            Properties.Settings.Default.hardwareKey = hardwareKey;
 
71
            Properties.Settings.Default.Save();
 
72
        }
 
73
 
 
74
        /// <summary>
51
75
        /// return Volume Serial Number from hard drive
52
76
        /// </summary>
53
77
        /// <param name="strDriveLetter">[optional] Drive letter</param>