Пример #1
0
        /// <summary>
        /// Adds the supplied replays to the store
        /// </summary>
        /// <param name="filenames">Array of FullPath strings to the replay files</param>
        public void AddReplays(object[] filenames)
        {
            foreach (string filename in filenames)
            {
                string file = ReplayManagerPath + @"\" + Path.GetFileName(filename);

                FileInfo     fileinfo = new FileInfo(file);
                ReplayReader reader   = new ReplayReader(file);
                Replay       replay   = reader.Read();

                if (replay != null && replay.IsValid)
                {
                    //add the replay
                    ReplayStore.ReplayRow row = recs.Replay.AddReplayRow(
                        0, replay.Name, replay.HashCode, fileinfo.Name, DateTime.Now, fileinfo.LastWriteTime);
                    //add the map
                    recs.Map.AddMapRow(replay.Map, row.ID);

                    //add the players
                    for (int index = 0; index < replay.Players.NumPlayers; index++)
                    {
                        recs.Player.AddPlayerRow(replay.Players[index].Name, row.ID);
                    }
                }
            }
        }
Пример #2
0
		private void lvReplays_DoubleClick(object sender, System.EventArgs e)
		{
			//show the last selected replay
			frmReplayView rv = new frmReplayView();
			string filename = Methods.GetReplayFilenameByReplayID(dvReplays, (int)lvReplays.SelectedItems[lvReplays.SelectedItems.Count - 1].Tag);
			ReplayReader reader = new ReplayReader(replayManager.ReplayManagerFilePath + @"\" + filename);
			rv.Replay = reader.Read();
			rv.ShowDialog();
		}
Пример #3
0
		void miRenameReplayClick(object sender, System.EventArgs e)
		{
			Replay replay = null;
			if (lvReplays.SelectedItems.Count == 1)
			{
				ReplayStore.ReplayRow row = storeReader.GetReplayByID((int)lvReplays.SelectedItems[0].Tag);

				frmInput input = new frmInput();
				string question = StoreReader.STORE_REPLAYNAMERENAME_INPUT.Replace("{0}", row.Name);;
				input.Question = question;
				input.Caption = "Replay Rename...";
				input.Input = row.Name;
				input.MaxLength = 255;
				DialogResult result = input.ShowDialog(this);

				if (result == DialogResult.OK)
				{
					ReplayReader reader = new ReplayReader(replayManager.ReplayManagerFilePath + @"\" + row.Filename);
					replay = reader.Read();
					if (replay != null && replayManager.RenameReplay(replay, input.Input))
					{
						Methods.RenameReplay(storeReader, row.ID, input.Input);
						dvReplays = Methods.CreateReplayDataView(storeReader, storeReader.Replays);
						Methods.PopulateReplaysView(lvReplays, dvReplays, dvReplays.RowFilter, dvReplays.Sort);
					}
					else
					{
						string error = ReplayManager.MANAGER_REPLAYFILERENAME_FAIL.Replace("{0}", row.Filename);
						error = error.Replace("{1}", input.Input);

						MessageBox.Show(this, error, "Rename failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
					}
				}
			}
			else
				MessageBox.Show(this, StoreReader.STORE_REPLAYFILERENAME_SELECT, "Rename failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
Пример #4
0
		/// <summary>
		/// Adds the supplied replays to the store
		/// </summary>
		/// <param name="filenames">Array of FullPath strings to the replay files</param>
		public void AddReplays(object[] filenames)
		{
			foreach (string filename in filenames)
			{
				string file = ReplayManagerPath + @"\" + Path.GetFileName(filename);

				FileInfo fileinfo = new FileInfo(file);
				ReplayReader reader = new ReplayReader(file);
				Replay replay = reader.Read();

				if (replay != null && replay.IsValid)
				{
					//add the replay
					ReplayStore.ReplayRow row = recs.Replay.AddReplayRow(
						0, replay.Name, replay.HashCode, fileinfo.Name, DateTime.Now, fileinfo.LastWriteTime);
					//add the map
					recs.Map.AddMapRow(replay.Map, row.ID);

					//add the players
					for (int index = 0; index < replay.Players.NumPlayers; index++)
					{
						recs.Player.AddPlayerRow(replay.Players[index].Name, row.ID);
					}
				}
			}
		}