示例#1
0
文件: Piwik.cs 项目: x1sc0/SI-GUI
 public TDFPiwik(string allowed_title, string allowed_txt)
 {
     aSet = new access_settings();
     Set  = aSet.open_settings();
     if (Set.Piwik.trackingID == null)
     {
         // Create new user ID
         string stemp = Environment.UserName + DateTime.Now.ToString();
         MD5    algo  = MD5.Create();
         Set.Piwik.trackingID = BitConverter.ToString(algo.ComputeHash(Encoding.ASCII.GetBytes(stemp))).Replace("-", "").ToLower().Remove(16);
     }
     // Check whether GAnalytic tracking is allowed
     sallowed_title = allowed_title;
     sallowed_txt   = allowed_txt.Replace("%trackingID", Set.Piwik.trackingID).Replace("nl", Environment.NewLine);
     if (!Set.Piwik.manually_set)
     {
         Set.Piwik.tracking_allowed = Tracking_allowed();
         Set.Piwik.manually_set     = true;
     }
     aSet.save_settings(Set);
     bw                     = new BackgroundWorker();
     bw.DoWork             += new DoWorkEventHandler(submit_piwik);
     bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(todo);
 }