A game about forced loneliness, made by TACStudios
at master 945 lines 55 kB view raw
1 2//------------------------------------------------------------------------------ 3// <auto-generated> 4// This code was generated by a tool. 5// 6// TextTransform Samples/Packages/com.unity.collections/Unity.Collections/FixedStringFormatMethods.tt 7// 8// Changes to this file may cause incorrect behavior and will be lost if 9// the code is regenerated. 10// </auto-generated> 11//------------------------------------------------------------------------------ 12 13using System; 14using Unity.Collections.LowLevel.Unsafe; 15 16namespace Unity.Collections 17{ 18 /// <summary> 19 /// Provides extension methods for FixedString*N*Bytes. 20 /// </summary> 21 public unsafe static partial class FixedStringMethods 22 { 23 /// <summary> 24 /// Interpolates strings into a format string and appends the result to this string. 25 /// </summary> 26 /// <remarks> 27 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 28 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 29 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 30 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 31 /// 32 /// The overloads of this method take up to ten strings to interpolate into the format string. 33 /// </remarks> 34 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 35 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 36 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 37 /// <param name="dest">The string to append to.</param>d 38 /// <param name="format">A string to be interpolated and appended.</param> 39 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 40 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 41 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/) })] 42 public static unsafe FormatError AppendFormat<T, U, T0>(ref this T dest, in U format, in T0 arg0) 43 where T : unmanaged, INativeList<byte>, IUTF8Bytes 44 where U : unmanaged, INativeList<byte>, IUTF8Bytes 45 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 46 { 47 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 48 int formatLength = formatRef.Length; 49 byte* formatBytes = formatRef.GetUnsafePtr(); 50 int i = 0; 51 FormatError err = FormatError.None; 52 while (i < formatLength) 53 { 54 byte currByte = formatBytes[i++]; 55 if (currByte == (byte)'{') 56 { 57 if (i < formatLength) 58 currByte = formatBytes[i++]; 59 else 60 return FormatError.BadFormatSpecifier; 61 62 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 63 { 64 switch (currByte - (byte)'0') 65 { 66 case 0: err = dest.Append(in arg0); break; 67 default: err = FormatError.BadFormatSpecifier; break; 68 } 69 } 70 else if (currByte == (byte)'{') 71 err = dest.AppendRawByte(currByte); 72 else 73 err = FormatError.BadFormatSpecifier; 74 } 75 else if (currByte == (byte)'}') 76 { 77 if (i < formatLength) 78 currByte = formatBytes[i++]; 79 else 80 err = FormatError.BadFormatSpecifier; 81 82 if (currByte == (byte)'}') 83 err = dest.AppendRawByte(currByte); 84 else 85 err = FormatError.BadFormatSpecifier; 86 } 87 else 88 err = dest.AppendRawByte(currByte); 89 90 if (err != FormatError.None) 91 return err; 92 } 93 94 return FormatError.None; 95 } 96 97 /// <summary> 98 /// Interpolates strings into a format string and appends the result to this string. 99 /// </summary> 100 /// <remarks> 101 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 102 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 103 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 104 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 105 /// 106 /// The overloads of this method take up to ten strings to interpolate into the format string. 107 /// </remarks> 108 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 109 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 110 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 111 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 112 /// <param name="dest">The string to append to.</param>d 113 /// <param name="format">A string to be interpolated and appended.</param> 114 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 115 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 116 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 117 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/) })] 118 public static unsafe FormatError AppendFormat<T, U, T0, T1>(ref this T dest, in U format, in T0 arg0, in T1 arg1) 119 where T : unmanaged, INativeList<byte>, IUTF8Bytes 120 where U : unmanaged, INativeList<byte>, IUTF8Bytes 121 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 122 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 123 { 124 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 125 int formatLength = formatRef.Length; 126 byte* formatBytes = formatRef.GetUnsafePtr(); 127 int i = 0; 128 FormatError err = FormatError.None; 129 while (i < formatLength) 130 { 131 byte currByte = formatBytes[i++]; 132 if (currByte == (byte)'{') 133 { 134 if (i < formatLength) 135 currByte = formatBytes[i++]; 136 else 137 return FormatError.BadFormatSpecifier; 138 139 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 140 { 141 switch (currByte - (byte)'0') 142 { 143 case 0: err = dest.Append(in arg0); break; 144 case 1: err = dest.Append(in arg1); break; 145 default: err = FormatError.BadFormatSpecifier; break; 146 } 147 } 148 else if (currByte == (byte)'{') 149 err = dest.AppendRawByte(currByte); 150 else 151 err = FormatError.BadFormatSpecifier; 152 } 153 else if (currByte == (byte)'}') 154 { 155 if (i < formatLength) 156 currByte = formatBytes[i++]; 157 else 158 err = FormatError.BadFormatSpecifier; 159 160 if (currByte == (byte)'}') 161 err = dest.AppendRawByte(currByte); 162 else 163 err = FormatError.BadFormatSpecifier; 164 } 165 else 166 err = dest.AppendRawByte(currByte); 167 168 if (err != FormatError.None) 169 return err; 170 } 171 172 return FormatError.None; 173 } 174 175 /// <summary> 176 /// Interpolates strings into a format string and appends the result to this string. 177 /// </summary> 178 /// <remarks> 179 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 180 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 181 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 182 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 183 /// 184 /// The overloads of this method take up to ten strings to interpolate into the format string. 185 /// </remarks> 186 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 187 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 188 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 189 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 190 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 191 /// <param name="dest">The string to append to.</param>d 192 /// <param name="format">A string to be interpolated and appended.</param> 193 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 194 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 195 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 196 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 197 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/) })] 198 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2) 199 where T : unmanaged, INativeList<byte>, IUTF8Bytes 200 where U : unmanaged, INativeList<byte>, IUTF8Bytes 201 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 202 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 203 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 204 { 205 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 206 int formatLength = formatRef.Length; 207 byte* formatBytes = formatRef.GetUnsafePtr(); 208 int i = 0; 209 FormatError err = FormatError.None; 210 while (i < formatLength) 211 { 212 byte currByte = formatBytes[i++]; 213 if (currByte == (byte)'{') 214 { 215 if (i < formatLength) 216 currByte = formatBytes[i++]; 217 else 218 return FormatError.BadFormatSpecifier; 219 220 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 221 { 222 switch (currByte - (byte)'0') 223 { 224 case 0: err = dest.Append(in arg0); break; 225 case 1: err = dest.Append(in arg1); break; 226 case 2: err = dest.Append(in arg2); break; 227 default: err = FormatError.BadFormatSpecifier; break; 228 } 229 } 230 else if (currByte == (byte)'{') 231 err = dest.AppendRawByte(currByte); 232 else 233 err = FormatError.BadFormatSpecifier; 234 } 235 else if (currByte == (byte)'}') 236 { 237 if (i < formatLength) 238 currByte = formatBytes[i++]; 239 else 240 err = FormatError.BadFormatSpecifier; 241 242 if (currByte == (byte)'}') 243 err = dest.AppendRawByte(currByte); 244 else 245 err = FormatError.BadFormatSpecifier; 246 } 247 else 248 err = dest.AppendRawByte(currByte); 249 250 if (err != FormatError.None) 251 return err; 252 } 253 254 return FormatError.None; 255 } 256 257 /// <summary> 258 /// Interpolates strings into a format string and appends the result to this string. 259 /// </summary> 260 /// <remarks> 261 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 262 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 263 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 264 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 265 /// 266 /// The overloads of this method take up to ten strings to interpolate into the format string. 267 /// </remarks> 268 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 269 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 270 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 271 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 272 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 273 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 274 /// <param name="dest">The string to append to.</param>d 275 /// <param name="format">A string to be interpolated and appended.</param> 276 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 277 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 278 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 279 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 280 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 281 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/) })] 282 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3) 283 where T : unmanaged, INativeList<byte>, IUTF8Bytes 284 where U : unmanaged, INativeList<byte>, IUTF8Bytes 285 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 286 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 287 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 288 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 289 { 290 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 291 int formatLength = formatRef.Length; 292 byte* formatBytes = formatRef.GetUnsafePtr(); 293 int i = 0; 294 FormatError err = FormatError.None; 295 while (i < formatLength) 296 { 297 byte currByte = formatBytes[i++]; 298 if (currByte == (byte)'{') 299 { 300 if (i < formatLength) 301 currByte = formatBytes[i++]; 302 else 303 return FormatError.BadFormatSpecifier; 304 305 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 306 { 307 switch (currByte - (byte)'0') 308 { 309 case 0: err = dest.Append(in arg0); break; 310 case 1: err = dest.Append(in arg1); break; 311 case 2: err = dest.Append(in arg2); break; 312 case 3: err = dest.Append(in arg3); break; 313 default: err = FormatError.BadFormatSpecifier; break; 314 } 315 } 316 else if (currByte == (byte)'{') 317 err = dest.AppendRawByte(currByte); 318 else 319 err = FormatError.BadFormatSpecifier; 320 } 321 else if (currByte == (byte)'}') 322 { 323 if (i < formatLength) 324 currByte = formatBytes[i++]; 325 else 326 err = FormatError.BadFormatSpecifier; 327 328 if (currByte == (byte)'}') 329 err = dest.AppendRawByte(currByte); 330 else 331 err = FormatError.BadFormatSpecifier; 332 } 333 else 334 err = dest.AppendRawByte(currByte); 335 336 if (err != FormatError.None) 337 return err; 338 } 339 340 return FormatError.None; 341 } 342 343 /// <summary> 344 /// Interpolates strings into a format string and appends the result to this string. 345 /// </summary> 346 /// <remarks> 347 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 348 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 349 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 350 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 351 /// 352 /// The overloads of this method take up to ten strings to interpolate into the format string. 353 /// </remarks> 354 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 355 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 356 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 357 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 358 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 359 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 360 /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam> 361 /// <param name="dest">The string to append to.</param>d 362 /// <param name="format">A string to be interpolated and appended.</param> 363 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 364 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 365 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 366 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 367 /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param> 368 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 369 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/) })] 370 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3, T4>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4) 371 where T : unmanaged, INativeList<byte>, IUTF8Bytes 372 where U : unmanaged, INativeList<byte>, IUTF8Bytes 373 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 374 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 375 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 376 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 377 where T4 : unmanaged, INativeList<byte>, IUTF8Bytes 378 { 379 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 380 int formatLength = formatRef.Length; 381 byte* formatBytes = formatRef.GetUnsafePtr(); 382 int i = 0; 383 FormatError err = FormatError.None; 384 while (i < formatLength) 385 { 386 byte currByte = formatBytes[i++]; 387 if (currByte == (byte)'{') 388 { 389 if (i < formatLength) 390 currByte = formatBytes[i++]; 391 else 392 return FormatError.BadFormatSpecifier; 393 394 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 395 { 396 switch (currByte - (byte)'0') 397 { 398 case 0: err = dest.Append(in arg0); break; 399 case 1: err = dest.Append(in arg1); break; 400 case 2: err = dest.Append(in arg2); break; 401 case 3: err = dest.Append(in arg3); break; 402 case 4: err = dest.Append(in arg4); break; 403 default: err = FormatError.BadFormatSpecifier; break; 404 } 405 } 406 else if (currByte == (byte)'{') 407 err = dest.AppendRawByte(currByte); 408 else 409 err = FormatError.BadFormatSpecifier; 410 } 411 else if (currByte == (byte)'}') 412 { 413 if (i < formatLength) 414 currByte = formatBytes[i++]; 415 else 416 err = FormatError.BadFormatSpecifier; 417 418 if (currByte == (byte)'}') 419 err = dest.AppendRawByte(currByte); 420 else 421 err = FormatError.BadFormatSpecifier; 422 } 423 else 424 err = dest.AppendRawByte(currByte); 425 426 if (err != FormatError.None) 427 return err; 428 } 429 430 return FormatError.None; 431 } 432 433 /// <summary> 434 /// Interpolates strings into a format string and appends the result to this string. 435 /// </summary> 436 /// <remarks> 437 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 438 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 439 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 440 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 441 /// 442 /// The overloads of this method take up to ten strings to interpolate into the format string. 443 /// </remarks> 444 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 445 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 446 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 447 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 448 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 449 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 450 /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam> 451 /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam> 452 /// <param name="dest">The string to append to.</param>d 453 /// <param name="format">A string to be interpolated and appended.</param> 454 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 455 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 456 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 457 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 458 /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param> 459 /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param> 460 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 461 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/) })] 462 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3, T4, T5>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5) 463 where T : unmanaged, INativeList<byte>, IUTF8Bytes 464 where U : unmanaged, INativeList<byte>, IUTF8Bytes 465 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 466 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 467 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 468 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 469 where T4 : unmanaged, INativeList<byte>, IUTF8Bytes 470 where T5 : unmanaged, INativeList<byte>, IUTF8Bytes 471 { 472 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 473 int formatLength = formatRef.Length; 474 byte* formatBytes = formatRef.GetUnsafePtr(); 475 int i = 0; 476 FormatError err = FormatError.None; 477 while (i < formatLength) 478 { 479 byte currByte = formatBytes[i++]; 480 if (currByte == (byte)'{') 481 { 482 if (i < formatLength) 483 currByte = formatBytes[i++]; 484 else 485 return FormatError.BadFormatSpecifier; 486 487 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 488 { 489 switch (currByte - (byte)'0') 490 { 491 case 0: err = dest.Append(in arg0); break; 492 case 1: err = dest.Append(in arg1); break; 493 case 2: err = dest.Append(in arg2); break; 494 case 3: err = dest.Append(in arg3); break; 495 case 4: err = dest.Append(in arg4); break; 496 case 5: err = dest.Append(in arg5); break; 497 default: err = FormatError.BadFormatSpecifier; break; 498 } 499 } 500 else if (currByte == (byte)'{') 501 err = dest.AppendRawByte(currByte); 502 else 503 err = FormatError.BadFormatSpecifier; 504 } 505 else if (currByte == (byte)'}') 506 { 507 if (i < formatLength) 508 currByte = formatBytes[i++]; 509 else 510 err = FormatError.BadFormatSpecifier; 511 512 if (currByte == (byte)'}') 513 err = dest.AppendRawByte(currByte); 514 else 515 err = FormatError.BadFormatSpecifier; 516 } 517 else 518 err = dest.AppendRawByte(currByte); 519 520 if (err != FormatError.None) 521 return err; 522 } 523 524 return FormatError.None; 525 } 526 527 /// <summary> 528 /// Interpolates strings into a format string and appends the result to this string. 529 /// </summary> 530 /// <remarks> 531 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 532 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 533 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 534 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 535 /// 536 /// The overloads of this method take up to ten strings to interpolate into the format string. 537 /// </remarks> 538 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 539 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 540 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 541 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 542 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 543 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 544 /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam> 545 /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam> 546 /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam> 547 /// <param name="dest">The string to append to.</param>d 548 /// <param name="format">A string to be interpolated and appended.</param> 549 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 550 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 551 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 552 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 553 /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param> 554 /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param> 555 /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param> 556 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 557 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/) })] 558 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6) 559 where T : unmanaged, INativeList<byte>, IUTF8Bytes 560 where U : unmanaged, INativeList<byte>, IUTF8Bytes 561 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 562 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 563 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 564 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 565 where T4 : unmanaged, INativeList<byte>, IUTF8Bytes 566 where T5 : unmanaged, INativeList<byte>, IUTF8Bytes 567 where T6 : unmanaged, INativeList<byte>, IUTF8Bytes 568 { 569 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 570 int formatLength = formatRef.Length; 571 byte* formatBytes = formatRef.GetUnsafePtr(); 572 int i = 0; 573 FormatError err = FormatError.None; 574 while (i < formatLength) 575 { 576 byte currByte = formatBytes[i++]; 577 if (currByte == (byte)'{') 578 { 579 if (i < formatLength) 580 currByte = formatBytes[i++]; 581 else 582 return FormatError.BadFormatSpecifier; 583 584 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 585 { 586 switch (currByte - (byte)'0') 587 { 588 case 0: err = dest.Append(in arg0); break; 589 case 1: err = dest.Append(in arg1); break; 590 case 2: err = dest.Append(in arg2); break; 591 case 3: err = dest.Append(in arg3); break; 592 case 4: err = dest.Append(in arg4); break; 593 case 5: err = dest.Append(in arg5); break; 594 case 6: err = dest.Append(in arg6); break; 595 default: err = FormatError.BadFormatSpecifier; break; 596 } 597 } 598 else if (currByte == (byte)'{') 599 err = dest.AppendRawByte(currByte); 600 else 601 err = FormatError.BadFormatSpecifier; 602 } 603 else if (currByte == (byte)'}') 604 { 605 if (i < formatLength) 606 currByte = formatBytes[i++]; 607 else 608 err = FormatError.BadFormatSpecifier; 609 610 if (currByte == (byte)'}') 611 err = dest.AppendRawByte(currByte); 612 else 613 err = FormatError.BadFormatSpecifier; 614 } 615 else 616 err = dest.AppendRawByte(currByte); 617 618 if (err != FormatError.None) 619 return err; 620 } 621 622 return FormatError.None; 623 } 624 625 /// <summary> 626 /// Interpolates strings into a format string and appends the result to this string. 627 /// </summary> 628 /// <remarks> 629 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 630 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 631 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 632 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 633 /// 634 /// The overloads of this method take up to ten strings to interpolate into the format string. 635 /// </remarks> 636 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 637 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 638 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 639 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 640 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 641 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 642 /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam> 643 /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam> 644 /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam> 645 /// <typeparam name="T7">The type of value to interpolate into the format string.</typeparam> 646 /// <param name="dest">The string to append to.</param>d 647 /// <param name="format">A string to be interpolated and appended.</param> 648 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 649 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 650 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 651 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 652 /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param> 653 /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param> 654 /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param> 655 /// <param name="arg7">A FixedString*N*Bytes to interpolate into the format string.</param> 656 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 657 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/), typeof(FixedString128Bytes /*T7*/) })] 658 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7) 659 where T : unmanaged, INativeList<byte>, IUTF8Bytes 660 where U : unmanaged, INativeList<byte>, IUTF8Bytes 661 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 662 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 663 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 664 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 665 where T4 : unmanaged, INativeList<byte>, IUTF8Bytes 666 where T5 : unmanaged, INativeList<byte>, IUTF8Bytes 667 where T6 : unmanaged, INativeList<byte>, IUTF8Bytes 668 where T7 : unmanaged, INativeList<byte>, IUTF8Bytes 669 { 670 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 671 int formatLength = formatRef.Length; 672 byte* formatBytes = formatRef.GetUnsafePtr(); 673 int i = 0; 674 FormatError err = FormatError.None; 675 while (i < formatLength) 676 { 677 byte currByte = formatBytes[i++]; 678 if (currByte == (byte)'{') 679 { 680 if (i < formatLength) 681 currByte = formatBytes[i++]; 682 else 683 return FormatError.BadFormatSpecifier; 684 685 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 686 { 687 switch (currByte - (byte)'0') 688 { 689 case 0: err = dest.Append(in arg0); break; 690 case 1: err = dest.Append(in arg1); break; 691 case 2: err = dest.Append(in arg2); break; 692 case 3: err = dest.Append(in arg3); break; 693 case 4: err = dest.Append(in arg4); break; 694 case 5: err = dest.Append(in arg5); break; 695 case 6: err = dest.Append(in arg6); break; 696 case 7: err = dest.Append(in arg7); break; 697 default: err = FormatError.BadFormatSpecifier; break; 698 } 699 } 700 else if (currByte == (byte)'{') 701 err = dest.AppendRawByte(currByte); 702 else 703 err = FormatError.BadFormatSpecifier; 704 } 705 else if (currByte == (byte)'}') 706 { 707 if (i < formatLength) 708 currByte = formatBytes[i++]; 709 else 710 err = FormatError.BadFormatSpecifier; 711 712 if (currByte == (byte)'}') 713 err = dest.AppendRawByte(currByte); 714 else 715 err = FormatError.BadFormatSpecifier; 716 } 717 else 718 err = dest.AppendRawByte(currByte); 719 720 if (err != FormatError.None) 721 return err; 722 } 723 724 return FormatError.None; 725 } 726 727 /// <summary> 728 /// Interpolates strings into a format string and appends the result to this string. 729 /// </summary> 730 /// <remarks> 731 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 732 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 733 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 734 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 735 /// 736 /// The overloads of this method take up to ten strings to interpolate into the format string. 737 /// </remarks> 738 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 739 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 740 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 741 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 742 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 743 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 744 /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam> 745 /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam> 746 /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam> 747 /// <typeparam name="T7">The type of value to interpolate into the format string.</typeparam> 748 /// <typeparam name="T8">The type of value to interpolate into the format string.</typeparam> 749 /// <param name="dest">The string to append to.</param>d 750 /// <param name="format">A string to be interpolated and appended.</param> 751 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 752 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 753 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 754 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 755 /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param> 756 /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param> 757 /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param> 758 /// <param name="arg7">A FixedString*N*Bytes to interpolate into the format string.</param> 759 /// <param name="arg8">A FixedString*N*Bytes to interpolate into the format string.</param> 760 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 761 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/), typeof(FixedString128Bytes /*T7*/), typeof(FixedString128Bytes /*T8*/) })] 762 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7, in T8 arg8) 763 where T : unmanaged, INativeList<byte>, IUTF8Bytes 764 where U : unmanaged, INativeList<byte>, IUTF8Bytes 765 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 766 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 767 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 768 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 769 where T4 : unmanaged, INativeList<byte>, IUTF8Bytes 770 where T5 : unmanaged, INativeList<byte>, IUTF8Bytes 771 where T6 : unmanaged, INativeList<byte>, IUTF8Bytes 772 where T7 : unmanaged, INativeList<byte>, IUTF8Bytes 773 where T8 : unmanaged, INativeList<byte>, IUTF8Bytes 774 { 775 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 776 int formatLength = formatRef.Length; 777 byte* formatBytes = formatRef.GetUnsafePtr(); 778 int i = 0; 779 FormatError err = FormatError.None; 780 while (i < formatLength) 781 { 782 byte currByte = formatBytes[i++]; 783 if (currByte == (byte)'{') 784 { 785 if (i < formatLength) 786 currByte = formatBytes[i++]; 787 else 788 return FormatError.BadFormatSpecifier; 789 790 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 791 { 792 switch (currByte - (byte)'0') 793 { 794 case 0: err = dest.Append(in arg0); break; 795 case 1: err = dest.Append(in arg1); break; 796 case 2: err = dest.Append(in arg2); break; 797 case 3: err = dest.Append(in arg3); break; 798 case 4: err = dest.Append(in arg4); break; 799 case 5: err = dest.Append(in arg5); break; 800 case 6: err = dest.Append(in arg6); break; 801 case 7: err = dest.Append(in arg7); break; 802 case 8: err = dest.Append(in arg8); break; 803 default: err = FormatError.BadFormatSpecifier; break; 804 } 805 } 806 else if (currByte == (byte)'{') 807 err = dest.AppendRawByte(currByte); 808 else 809 err = FormatError.BadFormatSpecifier; 810 } 811 else if (currByte == (byte)'}') 812 { 813 if (i < formatLength) 814 currByte = formatBytes[i++]; 815 else 816 err = FormatError.BadFormatSpecifier; 817 818 if (currByte == (byte)'}') 819 err = dest.AppendRawByte(currByte); 820 else 821 err = FormatError.BadFormatSpecifier; 822 } 823 else 824 err = dest.AppendRawByte(currByte); 825 826 if (err != FormatError.None) 827 return err; 828 } 829 830 return FormatError.None; 831 } 832 833 /// <summary> 834 /// Interpolates strings into a format string and appends the result to this string. 835 /// </summary> 836 /// <remarks> 837 /// Similar to `StringBuilder.AppendFormat` but with significant limitations: 838 /// - Only supports FixedString*N*Bytes arguments. To use other string types, convert them to FixedString*N*Bytes first. 839 /// - Only supports numeric format placeholders of the form `{0}` .. `{N}`. 840 /// - No format modifiers (*e.g.* `{0:x}`) are supported. 841 /// 842 /// The overloads of this method take up to ten strings to interpolate into the format string. 843 /// </remarks> 844 /// <typeparam name="T">A FixedString*N*Bytes type.</typeparam> 845 /// <typeparam name="U">A FixedString*N*Bytes type.</typeparam> 846 /// <typeparam name="T0">The type of value to interpolate into the format string.</typeparam> 847 /// <typeparam name="T1">The type of value to interpolate into the format string.</typeparam> 848 /// <typeparam name="T2">The type of value to interpolate into the format string.</typeparam> 849 /// <typeparam name="T3">The type of value to interpolate into the format string.</typeparam> 850 /// <typeparam name="T4">The type of value to interpolate into the format string.</typeparam> 851 /// <typeparam name="T5">The type of value to interpolate into the format string.</typeparam> 852 /// <typeparam name="T6">The type of value to interpolate into the format string.</typeparam> 853 /// <typeparam name="T7">The type of value to interpolate into the format string.</typeparam> 854 /// <typeparam name="T8">The type of value to interpolate into the format string.</typeparam> 855 /// <typeparam name="T9">The type of value to interpolate into the format string.</typeparam> 856 /// <param name="dest">The string to append to.</param>d 857 /// <param name="format">A string to be interpolated and appended.</param> 858 /// <param name="arg0">A FixedString*N*Bytes to interpolate into the format string.</param> 859 /// <param name="arg1">A FixedString*N*Bytes to interpolate into the format string.</param> 860 /// <param name="arg2">A FixedString*N*Bytes to interpolate into the format string.</param> 861 /// <param name="arg3">A FixedString*N*Bytes to interpolate into the format string.</param> 862 /// <param name="arg4">A FixedString*N*Bytes to interpolate into the format string.</param> 863 /// <param name="arg5">A FixedString*N*Bytes to interpolate into the format string.</param> 864 /// <param name="arg6">A FixedString*N*Bytes to interpolate into the format string.</param> 865 /// <param name="arg7">A FixedString*N*Bytes to interpolate into the format string.</param> 866 /// <param name="arg8">A FixedString*N*Bytes to interpolate into the format string.</param> 867 /// <param name="arg9">A FixedString*N*Bytes to interpolate into the format string.</param> 868 /// <returns><see cref="FormatError.None"/> if successful. Otherwise returns the appropriate <see cref="FormatError"/>.</returns> 869 [GenerateTestsForBurstCompatibility(GenericTypeArguments = new[] { typeof(FixedString128Bytes /*T*/), typeof(FixedString128Bytes /*U*/), typeof(FixedString128Bytes /*T0*/), typeof(FixedString128Bytes /*T1*/), typeof(FixedString128Bytes /*T2*/), typeof(FixedString128Bytes /*T3*/), typeof(FixedString128Bytes /*T4*/), typeof(FixedString128Bytes /*T5*/), typeof(FixedString128Bytes /*T6*/), typeof(FixedString128Bytes /*T7*/), typeof(FixedString128Bytes /*T8*/), typeof(FixedString128Bytes /*T9*/) })] 870 public static unsafe FormatError AppendFormat<T, U, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(ref this T dest, in U format, in T0 arg0, in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5, in T6 arg6, in T7 arg7, in T8 arg8, in T9 arg9) 871 where T : unmanaged, INativeList<byte>, IUTF8Bytes 872 where U : unmanaged, INativeList<byte>, IUTF8Bytes 873 where T0 : unmanaged, INativeList<byte>, IUTF8Bytes 874 where T1 : unmanaged, INativeList<byte>, IUTF8Bytes 875 where T2 : unmanaged, INativeList<byte>, IUTF8Bytes 876 where T3 : unmanaged, INativeList<byte>, IUTF8Bytes 877 where T4 : unmanaged, INativeList<byte>, IUTF8Bytes 878 where T5 : unmanaged, INativeList<byte>, IUTF8Bytes 879 where T6 : unmanaged, INativeList<byte>, IUTF8Bytes 880 where T7 : unmanaged, INativeList<byte>, IUTF8Bytes 881 where T8 : unmanaged, INativeList<byte>, IUTF8Bytes 882 where T9 : unmanaged, INativeList<byte>, IUTF8Bytes 883 { 884 ref var formatRef = ref UnsafeUtilityExtensions.AsRef(in format); 885 int formatLength = formatRef.Length; 886 byte* formatBytes = formatRef.GetUnsafePtr(); 887 int i = 0; 888 FormatError err = FormatError.None; 889 while (i < formatLength) 890 { 891 byte currByte = formatBytes[i++]; 892 if (currByte == (byte)'{') 893 { 894 if (i < formatLength) 895 currByte = formatBytes[i++]; 896 else 897 return FormatError.BadFormatSpecifier; 898 899 if (currByte >= (byte)'0' && currByte <= (byte)'9' && i < formatLength && formatBytes[i++] == (byte)'}') 900 { 901 switch (currByte - (byte)'0') 902 { 903 case 0: err = dest.Append(in arg0); break; 904 case 1: err = dest.Append(in arg1); break; 905 case 2: err = dest.Append(in arg2); break; 906 case 3: err = dest.Append(in arg3); break; 907 case 4: err = dest.Append(in arg4); break; 908 case 5: err = dest.Append(in arg5); break; 909 case 6: err = dest.Append(in arg6); break; 910 case 7: err = dest.Append(in arg7); break; 911 case 8: err = dest.Append(in arg8); break; 912 case 9: err = dest.Append(in arg9); break; 913 default: err = FormatError.BadFormatSpecifier; break; 914 } 915 } 916 else if (currByte == (byte)'{') 917 err = dest.AppendRawByte(currByte); 918 else 919 err = FormatError.BadFormatSpecifier; 920 } 921 else if (currByte == (byte)'}') 922 { 923 if (i < formatLength) 924 currByte = formatBytes[i++]; 925 else 926 err = FormatError.BadFormatSpecifier; 927 928 if (currByte == (byte)'}') 929 err = dest.AppendRawByte(currByte); 930 else 931 err = FormatError.BadFormatSpecifier; 932 } 933 else 934 err = dest.AppendRawByte(currByte); 935 936 if (err != FormatError.None) 937 return err; 938 } 939 940 return FormatError.None; 941 } 942 943 944 } 945}