SHARE
TWEET

regex haha

TKGP Oct 21st, 2018 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected override void SubtypeWrite(DSBinaryWriter bin)
  2. {
  3.     bin.Write(UNK1);
  4.     bin.Write(UNK2);
  5.     bin.Write(UNK3);
  6.     bin.Write(UNK4);
  7.    
  8.     Match match = Regex.Match(MapName, @"^m(\d\d|xx)_(\d\d|xx)_(\d\d|xx)_(\d\d|xx)$");
  9.     if (!match.Success)
  10.         InvalidNameException();
  11.    
  12.     string ms1 = match.Groups[1].Value.ToUpper();
  13.     string ms2 = match.Groups[2].Value.ToUpper();
  14.     string ms3 = match.Groups[3].Value.ToUpper();
  15.     string ms4 = match.Groups[4].Value.ToUpper();
  16.    
  17.     sbyte m1 = ms1 == "XX" ? -1 : sbyte.Parse(ms1);
  18.     sbyte m2 = ms2 == "XX" ? -1 : sbyte.Parse(ms2);
  19.     sbyte m3 = ms3 == "XX" ? -1 : sbyte.Parse(ms3);
  20.     sbyte m4 = ms4 == "XX" ? -1 : sbyte.Parse(ms4);
  21.    
  22.     bin.Write(m1);
  23.     bin.Write(m2);
  24.     bin.Write(m3);
  25.     bin.Write(m4);
  26.  
  27.     bin.Write(UNK7);
  28.     bin.Write(UNK8);
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top