コード例 #1
0
ファイル: Program.cs プロジェクト: its-wiki/its_wiki.EA
		static void Main(string[] args)
		{

			using (FileStream fs = new FileStream(@"C:\Users\wiki\Desktop\Replays\R11\2015.09.07\0003.[1.02+] Twisted Arena.HateMeLikeAPro.Lucwasbeer.KWReplay", FileMode.Open, FileAccess.Read))
			{
				KWReplayFile replay = new KWReplayFile();
				replay.ParseStream(fs);
				foreach (var player in replay.PlayerSlots)
				{

				}
			}

			using (FileStream fs = new FileStream(@"D:\tmp2\bigstuff\MPMaps.big", FileMode.Open, FileAccess.Read))
			{
				BigFile bf = new BigFile(fs);
				bf.LoadArchive();

				BigFilePart part = bf.GetPart(@"data\mapmetadata.bin");

				//if (!Directory.Exists(output_dir)) Directory.CreateDirectory(output_dir);
				//foreach (BigFilePart part in bf.PartStartsWith(@"data\maps\official\map_mp_4_bass"))
				//{
				//	using (FileStream sfs = new FileStream(Path.Combine(output_dir, part.FileName.Substring(part.FileName.LastIndexOf('\\') + 1)), FileMode.Create, FileAccess.ReadWrite))
				//	{
				//		using (Stream content = part.OpenStream()) content.CopyTo(sfs);
				//	}
				//}

				using (FileStream sf = new FileStream(@"D:\tmp2\bigstuff\map_mp_4_bass\test.tga", FileMode.Create, FileAccess.Write))
				{
					using (Stream content = part.OpenStream())
					{
						content.CopyTo(sf);
					}
					//using (StreamWriter sr = new StreamWriter(sf))
					//{
					//	foreach (BigFilePart bfp in bf.FileParts)
					//	{
					//		sr.WriteLine("[{0}]: {1}", bfp.Offset, bfp.FileName);
					//	}
					//}

				}
			}
			Console.ReadLine();
		}
コード例 #2
0
		private void FileBinder_OnNewReplay(string ReplayFile)
		{
			KWReplayFile replay = new KWReplayFile();
			using (FileStream fs = new FileStream(ReplayFile, FileMode.Open, FileAccess.Read)) replay.ParseStream(fs);

			LoadedPlugins.ForEach(lp => lp.OnPreSave(replay));

			string NewFile = EvalExpression(txtSaveBase.Text, txtExpression.Text, replay);
			string NewFileName = Path.GetFileName(NewFile);
			string NewFileDirectory = Path.GetDirectoryName(NewFile);
			if (!Directory.Exists(NewFileDirectory)) Directory.CreateDirectory(NewFileDirectory);
			File.Copy(ReplayFile, NewFile);
			SPNOTIF.Play();

			LoadedPlugins.ForEach(lp => lp.OnSaveComplete(NewFileName, NewFile, replay));

			LogMessage(MessageType.Notification, "Successfully saved \"<b>{0}</b>\"!", NewFileName);
		}