Exemplo n.º 1
0
        /// <summary>
        /// Poll the DoW Playback folder for new replays
        /// </summary>
        /// <param name="resursive"></param>
        /// <returns>Returns an array of objects holding the filename and hashcode of each replay</returns>
        public object[] PollPlaybackFolder(bool resursive)
        {
            string[] files = null;
            try
            {
                files = Directory.GetFiles(DoWPlaybackFolder, "*.rec");
            }
            catch
            {
                MessageBox.Show(null, "It appears as if your DoWPlaybackFolder setting is incorrect. Please change it in the DoWRM.exe.Config file.", "Playback folder incorrect...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            System.Collections.ArrayList list = new System.Collections.ArrayList();

            if (files != null)
            {
                foreach (string file in files)
                {
                    FileStream fs   = File.OpenRead(file);
                    byte[]     data = new byte[fs.Length];
                    fs.Read(data, 0, data.Length);
                    fs.Close();

                    MD5    md5  = new MD5CryptoServiceProvider();
                    byte[] hash = md5.ComputeHash(data);

                    ReplayHash replayHash = new ReplayHash();
                    replayHash.Filename = file;
                    replayHash.HashCode = hash;
                    list.Add(replayHash);
                }
            }

            return(list.ToArray());
        }
Exemplo n.º 2
0
		/// <summary>
		/// Poll the DoW Playback folder for new replays
		/// </summary>
		/// <param name="resursive"></param>
		/// <returns>Returns an array of objects holding the filename and hashcode of each replay</returns>
		public object[] PollPlaybackFolder(bool resursive)
		{
			string[] files = null;
			try
			{
				files = Directory.GetFiles(DoWPlaybackFolder, "*.rec");
			}
			catch
			{
				MessageBox.Show(null, "It appears as if your DoWPlaybackFolder setting is incorrect. Please change it in the DoWRM.exe.Config file.", "Playback folder incorrect...", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
				
			System.Collections.ArrayList list = new System.Collections.ArrayList();
	
			if (files != null)
			{
				foreach (string file in files)
				{
					FileStream fs = File.OpenRead(file);
					byte[] data = new byte[fs.Length];
					fs.Read(data, 0, data.Length);
					fs.Close();

					MD5 md5 = new MD5CryptoServiceProvider();
					byte[] hash = md5.ComputeHash(data);
			
					ReplayHash replayHash = new ReplayHash();
					replayHash.Filename = file;
					replayHash.HashCode = hash;
					list.Add(replayHash);
				}
			}

			return list.ToArray();
		}