Beispiel #1
0
        private void ParseHeader()
        {
            var header = DemoHeader.ParseFrom(BitStream);

            if (header.Filestamp != "HL2DEMO")
            {
                throw new Exception("Invalid File-Type - expecting HL2DEMO");
            }

            if (header.Protocol != 4)
            {
                throw new Exception("Invalid Demo-Protocol");
            }

            Header = header;
        }
Beispiel #2
0
        /// <summary>
        /// Parses the header (first few hundret bytes) of the demo.
        /// </summary>
        public void ParseHeader()
        {
            var header = DemoHeader.ParseFrom(BitStream);

            if (header.Filestamp != "HL2DEMO")
            {
                throw new InvalidDataException("Invalid File-Type - expecting HL2DEMO");
            }

            if (header.Protocol != 4)
            {
                throw new InvalidDataException("Invalid Demo-Protocol");
            }

            Header = header;


            if (HeaderParsed != null)
            {
                HeaderParsed(this, new HeaderParsedEventArgs(Header));
            }
        }
Beispiel #3
0
 public HeaderParsedEventArgs(DemoHeader header)
 {
     this.Header = header;
 }
Beispiel #4
0
 public HeaderParsedEventArgs(DemoHeader header)
 {
     this.Header = header;
 }
		private static Source DetermineDemoSource(Demo demo, DemoHeader header)
		{
			// Check if it's a POV demo
			Match match = LocalRegex.Match(header.ServerName);
			if (match.Success || header.ServerName.Contains("localhost"))
			{
				demo.Type = "POV";
				return Source.Factory("pov");
			}

			// Check for esea demos, appart the filename there is no magic to detect it
			if (demo.Name.Contains("esea"))
			{
				return Source.Factory("esea");
			}

			// Check for faceit demos
			// (Before May 2015) Faceit : uses regex - no false positive but could miss some Faceit demo (when premade playing because of custom team name)
			// (May 2015) Faceit : uses hostname
			if (demo.Hostname.Contains("FACEIT.com") || FILENAME_FACEIT_REGEX.Match(demo.Name).Success)
			{
				return Source.Factory("faceit");
			}

			// Check for cevo demos
			if (demo.Hostname.Contains("CEVO.com"))
			{
				return Source.Factory("cevo");
			}

			// Check for ebot demos
			if (demo.Hostname.Contains("eBot") || FILENAME_EBOT_REGEX.Match(demo.Name).Success)
			{
				return Source.Factory("ebot");
			}

			if (demo.Name.IndexOf("popflash", StringComparison.OrdinalIgnoreCase) >= 0 ||
				demo.Hostname.IndexOf("popflash", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return Source.Factory("popflash");
			}

			// If none of the previous checks matched, we use ValveAnalyzer
			return Source.Factory("valve");
		}