Ejemplo n.º 1
0
 public PnlReplayComment(ReplayInfo replay, ReplayComment comment)
 {
     this.InitializeComponent();
     this.mReplay = replay;
     this.mComment = comment;
 }
Ejemplo n.º 2
0
 public static void Download(ReplayInfo replay)
 {
     Download(replay, replay.Location);
 }
Ejemplo n.º 3
0
 public DlgReplayInfo(ReplayInfo replay)
 {
     this.CommentCount = -1;
     this.DeletedComment = -1;
     this.components = null;
     this.InitializeComponent();
     this.mReplay = replay;
 }
Ejemplo n.º 4
0
 private static void Download(ReplayInfo replay, string location)
 {
     VGen0 method = null;
     WaitCallback callBack = null;
     try
     {
         WebClient client;
         if (Program.MainForm.InvokeRequired)
         {
             if (method == null)
             {
                 method = delegate {
                     Download(replay, location);
                 };
             }
             Program.MainForm.BeginInvoke(method);
         }
         else
         {
             string uriString = ConfigSettings.GetString("BaseReplayURL", "http://gpgnet.gaspowered.com/replays/") + location;
             client = new WebClient();
             string replaysDirectory = Program.Settings.SupcomPrefs.Replays.ReplaysDirectory;
             if (!Directory.Exists(replaysDirectory))
             {
                 Directory.CreateDirectory(replaysDirectory);
             }
             replaysDirectory = replaysDirectory.TrimEnd(new char[] { '\\' }) + @"\" + location.Replace("/", ".");
             if (System.IO.File.Exists(replaysDirectory))
             {
                 ReceieveReplay(replaysDirectory);
             }
             else
             {
                 if (callBack == null)
                 {
                     callBack = delegate (object s) {
                         if (replay != null)
                         {
                             replay.Downloads++;
                         }
                         DataAccess.ExecuteQuery("IncrementReplayDownload", new object[] { location });
                     };
                 }
                 ThreadQueue.QueueUserWorkItem(callBack, new object[0]);
                 DlgDownloadProgress dlg = new DlgDownloadProgress(location, client);
                 dlg.DownloadCancelled += delegate (object s, EventArgs e) {
                     dlg.Client.CancelAsync();
                     client.DownloadFileCompleted -= new AsyncCompletedEventHandler(ReplayInfo.client_DownloadFileCompleted);
                 };
                 dlg.Show();
                 client.DownloadFileCompleted += new AsyncCompletedEventHandler(ReplayInfo.client_DownloadFileCompleted);
                 Guid userToken = Guid.NewGuid();
                 ActiveDownloads[userToken] = replaysDirectory;
                 client.DownloadFileAsync(new Uri(uriString), replaysDirectory + ".gzip", userToken);
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }
Ejemplo n.º 5
0
 protected override void LoadLayoutData()
 {
     if ((base.LayoutData != null) && (base.LayoutData is ReplayInfo))
     {
         this.mReplay = base.LayoutData as ReplayInfo;
     }
     base.LoadLayoutData();
 }