Skip to content

Commit 79c7c70

Browse files
Fixed index of tags with Environment.NewLine "\r\n"
1 parent 0bac628 commit 79c7c70

1 file changed

Lines changed: 64 additions & 51 deletions

File tree

Unity/Assets/NativeScript/Editor/GenerateBindings.cs

Lines changed: 64 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,12 @@ static Assembly[] GetAssemblies(string[] assemblyNames)
684684
assemblies[7] = typeof(UnityEngine.Accessibility.VisionUtility).Assembly; // Unity accessibility module
685685
assemblies[8] = typeof(UnityEngine.AI.NavMesh).Assembly; // Unity AI module
686686
assemblies[9] = typeof(UnityEngine.Animations.AnimationClipPlayable).Assembly; // Unity animation module
687+
#if !UNITY_2020_1_OR_NEWER //This class migrate to package
687688
assemblies[10] = typeof(UnityEngine.XR.ARRenderMode).Assembly; // Unity AR module
689+
#else
690+
assemblies[10] = typeof(UnityEngine.XR.InputDevices).Assembly; // Unity AR module without package
691+
#endif
692+
688693
assemblies[11] = typeof(AudioSettings).Assembly; // Unity audio module
689694
assemblies[12] = typeof(Cloth).Assembly; // Unity cloth module
690695
assemblies[13] = typeof(ClusterInput).Assembly; // Unity cluster input module
@@ -710,13 +715,21 @@ static Assembly[] GetAssemblies(string[] assemblyNames)
710715
assemblies[30] = typeof(UnityEngine.Experimental.UIElements.Button).Assembly; // Unity UI elements module
711716
#endif
712717
assemblies[31] = typeof(Canvas).Assembly; // Unity UI module
713-
assemblies[32] = typeof(UnityEngine.Networking.NetworkTransport).Assembly; // Unity cloth module
718+
#if UNITY_2020_1_OR_NEWER
719+
assemblies[32] = typeof(UnityEngine.Networking.Utility).Assembly; // Unity network module
720+
#else
721+
assemblies[32] = typeof(UnityEngine.Networking.NetworkTransport).Assembly; // Unity network module
722+
#endif
714723
assemblies[33] = typeof(UnityEngine.Analytics.Analytics).Assembly; // Unity analytics module
715724
assemblies[34] = typeof(RemoteSettings).Assembly; // Unity Unity connect module
716725
assemblies[35] = typeof(UnityEngine.Networking.DownloadHandlerAudioClip).Assembly; // Unity web request audio module
717726
assemblies[36] = typeof(WWWForm).Assembly; // Unity web request module
718727
assemblies[37] = typeof(UnityEngine.Networking.DownloadHandlerTexture).Assembly; // Unity web request texture module
728+
#if !UNITY_2020_1_OR_NEWER
719729
assemblies[38] = typeof(WWW).Assembly; // Unity web request WWW module
730+
#else
731+
assemblies[38] = typeof(UnityEngine.Networking.UnityWebRequest).Assembly;
732+
#endif
720733
assemblies[39] = typeof(WheelCollider).Assembly; // Unity vehicles module
721734
assemblies[40] = typeof(UnityEngine.Video.VideoClip).Assembly; // Unity video module
722735
assemblies[41] = typeof(UnityEngine.XR.InputTracking).Assembly; // Unity VR module
@@ -13445,123 +13458,123 @@ static void InjectBuilders(
1344513458
string cppSourceContents = File.ReadAllText(CppSourcePath);
1344613459
csharpContents = InjectIntoString(
1344713460
csharpContents,
13448-
"/*BEGIN DELEGATE TYPES*/\n",
13449-
"\n\t\t/*END DELEGATE TYPES*/",
13461+
"/*BEGIN DELEGATE TYPES*/"+Environment.NewLine,
13462+
Environment.NewLine+"\t\t/*END DELEGATE TYPES*/",
1345013463
builders.CsharpDelegateTypes.ToString());
1345113464
csharpContents = InjectIntoString(
1345213465
csharpContents,
13453-
"/*BEGIN STORE INIT CALLS*/\n",
13454-
"\n\t\t\t/*END STORE INIT CALLS*/",
13466+
"/*BEGIN STORE INIT CALLS*/"+Environment.NewLine,
13467+
Environment.NewLine+"\t\t\t/*END STORE INIT CALLS*/",
1345513468
builders.CsharpStoreInitCalls.ToString());
1345613469
csharpContents = InjectIntoString(
1345713470
csharpContents,
13458-
"/*BEGIN INIT CALL*/\n",
13459-
"\n\t\t\t/*END INIT CALL*/",
13471+
"/*BEGIN INIT CALL*/"+Environment.NewLine,
13472+
Environment.NewLine+"\t\t\t/*END INIT CALL*/",
1346013473
builders.CsharpInitCall.ToString());
1346113474
csharpContents = InjectIntoString(
1346213475
csharpContents,
13463-
"/*BEGIN BASE TYPES*/\n",
13464-
"\n/*END BASE TYPES*/",
13476+
"/*BEGIN BASE TYPES*/"+Environment.NewLine,
13477+
Environment.NewLine+"/*END BASE TYPES*/",
1346513478
builders.CsharpBaseTypes.ToString());
1346613479
csharpContents = InjectIntoString(
1346713480
csharpContents,
13468-
"/*BEGIN FUNCTIONS*/\n",
13469-
"\n\t\t/*END FUNCTIONS*/",
13481+
"/*BEGIN FUNCTIONS*/"+Environment.NewLine,
13482+
Environment.NewLine+"\t\t/*END FUNCTIONS*/",
1347013483
builders.CsharpFunctions.ToString());
1347113484
csharpContents = InjectIntoString(
1347213485
csharpContents,
13473-
"/*BEGIN CPP DELEGATES*/\n",
13474-
"\n\t\t/*END CPP DELEGATES*/",
13486+
"/*BEGIN CPP DELEGATES*/"+Environment.NewLine,
13487+
Environment.NewLine+"\t\t/*END CPP DELEGATES*/",
1347513488
builders.CsharpCppDelegates.ToString());
1347613489
csharpContents = InjectIntoString(
1347713490
csharpContents,
13478-
"/*BEGIN CSHARP DELEGATES*/\n",
13479-
"\n\t\t/*END CSHARP DELEGATES*/",
13491+
"/*BEGIN CSHARP DELEGATES*/"+Environment.NewLine,
13492+
Environment.NewLine+"\t\t/*END CSHARP DELEGATES*/",
1348013493
builders.CsharpCsharpDelegates.ToString());
1348113494
csharpContents = InjectIntoString(
1348213495
csharpContents,
13483-
"/*BEGIN IMPORTS*/\n",
13484-
"\n\t\t/*END IMPORTS*/",
13496+
"/*BEGIN IMPORTS*/"+Environment.NewLine,
13497+
Environment.NewLine+"\t\t/*END IMPORTS*/",
1348513498
builders.CsharpImports.ToString());
1348613499
csharpContents = InjectIntoString(
1348713500
csharpContents,
13488-
"/*BEGIN GETDELEGATE CALLS*/\n",
13489-
"\n\t\t\t/*END GETDELEGATE CALLS*/",
13501+
"/*BEGIN GETDELEGATE CALLS*/"+Environment.NewLine,
13502+
Environment.NewLine+"\t\t\t/*END GETDELEGATE CALLS*/",
1349013503
builders.CsharpGetDelegateCalls.ToString());
1349113504
csharpContents = InjectIntoString(
1349213505
csharpContents,
13493-
"/*BEGIN DESTROY FUNCTION ENUMERATORS*/\n",
13494-
"\n\t\t\t/*END DESTROY FUNCTION ENUMERATORS*/",
13506+
"/*BEGIN DESTROY FUNCTION ENUMERATORS*/"+Environment.NewLine,
13507+
Environment.NewLine+"\t\t\t/*END DESTROY FUNCTION ENUMERATORS*/",
1349513508
builders.CsharpDestroyFunctionEnumerators.ToString());
1349613509
csharpContents = InjectIntoString(
1349713510
csharpContents,
13498-
"/*BEGIN DESTROY QUEUE CASES*/\n",
13499-
"\n\t\t\t\t\t\t/*END DESTROY QUEUE CASES*/",
13511+
"/*BEGIN DESTROY QUEUE CASES*/"+Environment.NewLine,
13512+
Environment.NewLine+"\t\t\t\t\t\t/*END DESTROY QUEUE CASES*/",
1350013513
builders.CsharpDestroyQueueCases.ToString());
1350113514
cppSourceContents = InjectIntoString(
1350213515
cppSourceContents,
13503-
"/*BEGIN FUNCTION POINTERS*/\n",
13504-
"\n\t/*END FUNCTION POINTERS*/",
13516+
"/*BEGIN FUNCTION POINTERS*/"+Environment.NewLine,
13517+
Environment.NewLine+"\t/*END FUNCTION POINTERS*/",
1350513518
builders.CppFunctionPointers.ToString());
1350613519
cppHeaderContents = InjectIntoString(
1350713520
cppHeaderContents,
13508-
"/*BEGIN TYPE DECLARATIONS*/\n",
13509-
"\n/*END TYPE DECLARATIONS*/",
13521+
"/*BEGIN TYPE DECLARATIONS*/"+Environment.NewLine,
13522+
Environment.NewLine+"/*END TYPE DECLARATIONS*/",
1351013523
builders.CppTypeDeclarations.ToString());
1351113524
cppHeaderContents = InjectIntoString(
1351213525
cppHeaderContents,
13513-
"/*BEGIN TEMPLATE DECLARATIONS*/\n",
13514-
"\n/*END TEMPLATE DECLARATIONS*/",
13526+
"/*BEGIN TEMPLATE DECLARATIONS*/"+Environment.NewLine,
13527+
Environment.NewLine+"/*END TEMPLATE DECLARATIONS*/",
1351513528
builders.CppTemplateDeclarations.ToString());
1351613529
cppHeaderContents = InjectIntoString(
1351713530
cppHeaderContents,
13518-
"/*BEGIN TEMPLATE SPECIALIZATION DECLARATIONS*/\n",
13519-
"\n/*END TEMPLATE SPECIALIZATION DECLARATIONS*/",
13531+
"/*BEGIN TEMPLATE SPECIALIZATION DECLARATIONS*/"+Environment.NewLine,
13532+
Environment.NewLine+"/*END TEMPLATE SPECIALIZATION DECLARATIONS*/",
1352013533
builders.CppTemplateSpecializationDeclarations.ToString());
1352113534
cppHeaderContents = InjectIntoString(
1352213535
cppHeaderContents,
13523-
"/*BEGIN TYPE DEFINITIONS*/\n",
13524-
"\n/*END TYPE DEFINITIONS*/",
13536+
"/*BEGIN TYPE DEFINITIONS*/"+Environment.NewLine,
13537+
Environment.NewLine+"/*END TYPE DEFINITIONS*/",
1352513538
builders.CppTypeDefinitions.ToString());
1352613539
cppSourceContents = InjectIntoString(
1352713540
cppSourceContents,
13528-
"/*BEGIN METHOD DEFINITIONS*/\n",
13529-
"\n/*END METHOD DEFINITIONS*/",
13541+
"/*BEGIN METHOD DEFINITIONS*/"+Environment.NewLine,
13542+
Environment.NewLine+"/*END METHOD DEFINITIONS*/",
1353013543
builders.CppMethodDefinitions.ToString());
1353113544
cppSourceContents = InjectIntoString(
1353213545
cppSourceContents,
13533-
"/*BEGIN INIT BODY PARAMETER READS*/\n",
13534-
"\n\t/*END INIT BODY PARAMETER READS*/",
13546+
"/*BEGIN INIT BODY PARAMETER READS*/"+Environment.NewLine,
13547+
Environment.NewLine+"\t/*END INIT BODY PARAMETER READS*/",
1353513548
builders.CppInitBodyParameterReads.ToString());
1353613549
cppSourceContents = InjectIntoString(
1353713550
cppSourceContents,
13538-
"/*BEGIN INIT BODY ARRAYS*/\n",
13539-
"\n\t/*END INIT BODY ARRAYS*/",
13551+
"/*BEGIN INIT BODY ARRAYS*/"+Environment.NewLine,
13552+
Environment.NewLine+"\t/*END INIT BODY ARRAYS*/",
1354013553
builders.CppInitBodyArrays.ToString());
1354113554
cppSourceContents = InjectIntoString(
1354213555
cppSourceContents,
13543-
"/*BEGIN INIT BODY FIRST BOOT*/\n",
13544-
"\n\t\t/*END INIT BODY FIRST BOOT*/",
13556+
"/*BEGIN INIT BODY FIRST BOOT*/"+Environment.NewLine,
13557+
Environment.NewLine+"\t\t/*END INIT BODY FIRST BOOT*/",
1354513558
builders.CppInitBodyFirstBoot.ToString());
1354613559
cppSourceContents = InjectIntoString(
1354713560
cppSourceContents,
13548-
"/*BEGIN GLOBAL STATE AND FUNCTIONS*/\n",
13549-
"\n\t/*END GLOBAL STATE AND FUNCTIONS*/",
13561+
"/*BEGIN GLOBAL STATE AND FUNCTIONS*/"+Environment.NewLine,
13562+
Environment.NewLine+"\t/*END GLOBAL STATE AND FUNCTIONS*/",
1355013563
builders.CppGlobalStateAndFunctions.ToString());
1355113564
cppHeaderContents = InjectIntoString(
1355213565
cppHeaderContents,
13553-
"/*BEGIN UNBOXING METHOD DECLARATIONS*/\n",
13554-
"\n\t\t/*END UNBOXING METHOD DECLARATIONS*/",
13566+
"/*BEGIN UNBOXING METHOD DECLARATIONS*/"+Environment.NewLine,
13567+
Environment.NewLine+"\t\t/*END UNBOXING METHOD DECLARATIONS*/",
1355513568
builders.CppUnboxingMethodDeclarations.ToString());
1355613569
cppHeaderContents = InjectIntoString(
1355713570
cppHeaderContents,
13558-
"/*BEGIN STRING DEFAULT PARAMETERS*/\n",
13559-
"\n\t/*END STRING DEFAULT PARAMETERS*/",
13571+
"/*BEGIN STRING DEFAULT PARAMETERS*/"+Environment.NewLine,
13572+
Environment.NewLine+"\t/*END STRING DEFAULT PARAMETERS*/",
1356013573
builders.CppStringDefaultParams.ToString());
1356113574
cppHeaderContents = InjectIntoString(
1356213575
cppHeaderContents,
13563-
"/*BEGIN MACROS*/\n",
13564-
"\n/*END MACROS*/",
13576+
"/*BEGIN MACROS*/"+Environment.NewLine,
13577+
Environment.NewLine+"/*END MACROS*/",
1356513578
builders.CppMacros.ToString());
1356613579

1356713580
File.WriteAllText(CsharpPath, csharpContents);
@@ -13577,13 +13590,13 @@ static string InjectIntoString(
1357713590
{
1357813591
for (int startIndex = 0; ; )
1357913592
{
13580-
int beginIndex = contents.IndexOf(beginMarker, startIndex);
13593+
int beginIndex = contents.IndexOf(beginMarker, startIndex, StringComparison.OrdinalIgnoreCase);
1358113594
if (beginIndex < 0)
1358213595
{
1358313596
return contents;
1358413597
}
1358513598
int afterBeginIndex = beginIndex + beginMarker.Length;
13586-
int endIndex = contents.IndexOf(endMarker, afterBeginIndex);
13599+
int endIndex = contents.IndexOf(endMarker, afterBeginIndex, StringComparison.OrdinalIgnoreCase);
1358713600
if (endIndex < 0)
1358813601
{
1358913602
throw new Exception(

0 commit comments

Comments
 (0)