string GetTargetPathForNativeType(string path) { var pos = path.IndexOf(NativeTypeSubpath, StringComparison.InvariantCulture); if (pos >= 0) { var relativePath = path.Remove(0, pos); return(Path.Combine(DestinationDir, "src", FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.InvariantCulture)), relativePath)); } return(null); }
string GetTargetPathForManualSource(string path) { var pos = path.IndexOf(XamarinSourcePath, StringComparison.InvariantCulture); if (pos >= 0) { var relativePath = path.Remove(0, pos + XamarinSourcePath.Length); return(Path.Combine(DestinationDir, "src", FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.InvariantCulture)), relativePath)); } return(null); }
string GetTargetPathForRuntimeSource(string path) { var pos = path.IndexOf(RuntimeSubpath, StringComparison.InvariantCulture); if (pos >= 0) { var relativePath = path.Remove(0, pos + 1); // +1 is used to remove the leading / from RuntimeSubpath var result = Path.Combine(DestinationDir, "src", FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.InvariantCulture)), relativePath); return(result); } return(null); }
string GetTargetPathForGeneratedPath(string path) { var subpath = (InstallDir.Contains("Xamarin.iOS.framework")) ? "native" : "full"; var pos = path.IndexOf(subpath, StringComparison.InvariantCulture); if (pos >= 0) { var relativePath = path.Remove(0, pos + subpath.Length + 1); return(Path.Combine(DestinationDir, "src", FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.InvariantCulture)), relativePath)); } return(null); }
string GetSourcePathForRuntimeSource(string path) { Console.WriteLine($"Path is {path}"); if (path.StartsWith(InstallDir, StringComparison.Ordinal)) { var removalPath = Path.Combine(InstallDir, FrameworkPath.Replace(".framework", ""), "src"); Console.WriteLine($"Removal path s {removalPath}"); var src = path.Remove(0, removalPath.Length); Console.WriteLine($"Src is {src}"); if (src.StartsWith("/", StringComparison.Ordinal)) { src = src.Remove(0, 1); } return(Path.Combine(XamarinSourcePath.Replace("src", "runtime"), src)); } return(path); }
/// <summary> /// Returns the source path for the bindings that were manually done. /// </summary> /// <returns>The source path for manual source.</returns> /// <param name="path">Path.</param> string GetSourcePathForManualSource(string path) { var removalPath = $"/{FrameworkPath}/"; var srcFolder = Path.Combine("src", FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.InvariantCulture))) + Path.DirectorySeparatorChar; var pos = path.IndexOf(removalPath, StringComparison.InvariantCulture); var src = path.Remove(0, pos + FrameworkPath.Length + 2); pos = src.IndexOf(srcFolder, StringComparison.InvariantCulture); if (pos >= 0) { src = src.Remove(0, src.IndexOf(srcFolder, StringComparison.InvariantCulture) + srcFolder.Length); } else // we are dealing with a correct path (this does happen on the mac side) { src = src.Remove(0, src.IndexOf("/src/", StringComparison.InvariantCulture) + "/src/".Length); } src = Path.Combine(XamarinSourcePath, src); return(src); }
private void SetDefaultPaths() { if (string.IsNullOrEmpty(FrameworkPath) || !FrameworkPath.StartsWith(RootPath)) { FrameworkPath = RootPath; } if (string.IsNullOrEmpty(TestSuiteFile) || !TestSuiteFile.StartsWith(RootPath)) { if (string.IsNullOrEmpty(TestSuiteFile)) { TestSuiteFile = RootPath; } else if (RootPath.EndsWith(Path.PathSeparator.ToString())) { TestSuiteFile = RootPath + Path.GetFileName(TestSuiteFile); } else { TestSuiteFile = RootPath + @"\" + Path.GetFileName(TestSuiteFile); } } }
/// <summary> /// Returns the source path for a generated file. /// </summary> /// <returns>The source path for native type.</returns> /// <param name="path">Path.</param> string GetSourcePathForGeneratedPath(string path) { var frameworkPrefix = FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.Ordinal)); var installPath = Path.Combine(InstallDir, "src", frameworkPrefix); // we might be looking at a mdb that was already gone thorugh mdb rebase, if that is the case, do find the path for the final target if (path.StartsWith(InstallDir, StringComparison.InvariantCulture)) { var src = path.Substring(installPath.Length + 1); if (src.StartsWith("/", StringComparison.Ordinal)) { src = src.Remove(0, 1); } src = Path.Combine(XamarinSourcePath, (InstallDir.Contains("Xamarin.iOS.framework")) ? "build/ios/native/" : "build/mac/full/", src); return(src); } else { var pos = path.IndexOf($"/{frameworkPrefix}/", StringComparison.InvariantCulture); var src = path.Remove(0, pos + $"/{frameworkPrefix}/".Length); // 3 for src and 1 for / src = Path.Combine(XamarinSourcePath, src); return(src); } }
public void Apply() { Path = new FrameworkPath(Frameworks.Foundation); }
public void Apply() { Path = new FrameworkPath(Frameworks.NoFramework); InitCollections(); }
//public void Apply() //{ // InitCollections(); //} //void InitCollections() //{ // GroupsCollection.Groups.AddRange( // new List<IGroup> { // new Group // { // Name = "Group01", // Members = new List<IUser> // { // new User { FirstName = "John", LastName = "Smith", BirthDate = new DateTime(1900, 1, 1), City = "London" }, // new User { FirstName = "John", LastName = "Joe", BirthDate = new DateTime(1953, 11, 12), City = "New York" } // } // }, // new Group // { // Name = "Group02", // Members = new List<IUser> // { // new User { FirstName = "Patrick", LastName = "O'Neil", BirthDate = new DateTime(1971, 4, 3), City = "Dublin" } // } // }, // new Group(), // new Group // { // Name = "Group04", // Members = new List<IUser> // { // new User { FirstName = "John", LastName = "Joe", BirthDate = new DateTime(1953, 11, 12), City = "New York" }, // new User { FirstName = "John", LastName = "Joe", BirthDate = new DateTime(1953, 11, 12), City = "New York" }, // new User { FirstName = "John", LastName = "Joe", BirthDate = new DateTime(1953, 11, 12), City = "New York" } // } // } // }); // GroupsCollection.Groups.ToList().ForEach(group => UsersCollection.Users.AddRange(group.Members)); //} public void Apply() { Path = new FrameworkPath(Frameworks.Bootstrap); }