public void EditProjectIcon(string route, EditProjectIcon icon) { try { if (icon.Icon.Length > 0) { //Console.WriteLine("not null"); File.Delete(route + "/Assets/" + "icon.png"); try { using (FileStream filestream = System.IO.File.Create(route + "/Assets/" + "icon.png")) { icon.Icon.CopyTo(filestream); filestream.Flush(); } } catch (Exception e) { Console.WriteLine("Edit icon File catch" + e); } } } catch (Exception)//icon file null exception { // Console.WriteLine("null"); } }
public void EditProjectFolder(string oldProjectName, string newProjectName, string bundleIdentifier, EditProjectIcon icon) { string[] dirs = System.IO.Directory.GetDirectories(rootPath); char[] spearator = { '\\' }; try { foreach (var dir in dirs) { if (dir.Split(spearator)[1] == oldProjectName) { //Console.WriteLine("Edited :" + dir.Split(spearator)[1]); EditProjectIcon(rootPath + "/" + oldProjectName, icon); System.IO.Directory.Move(rootPath + "/" + oldProjectName, rootPath + "/" + newProjectName); break; } } } catch (Exception) { //Console.WriteLine("old and new project names are same"); // Console.WriteLine("icon "+icon.Icon.Length); } string[] categoryDirs = System.IO.Directory.GetDirectories(rootPath + "/" + newProjectName); foreach (var category in categoryDirs) { string[] appDirs = System.IO.Directory.GetDirectories(category); foreach (var app in appDirs) { //Console.WriteLine(app); string[] appFile = Directory.GetFiles(app, "*.ipa"); if (appFile.Length == 1) { string[] details = appFile[0].Split(spearator); File.Delete(app + "/manifest.plist"); string ipaFilePath = ""; string toBeSearched = "Main"; int ix = appFile[0].IndexOf(toBeSearched); if (ix != -1) { ipaFilePath = ipaRootPath + appFile[0].Substring(ix + toBeSearched.Length); } string tempId = appFile[0].Substring(ix + toBeSearched.Length); FileOperationLibrary.ManifestPlist manifest = new FileOperationLibrary.ManifestPlist(); manifest.CreateManifest(app.Replace('\\', '/'), ipaFilePath.Replace('\\', '/'), bundleIdentifier, Convert.ToString(tempId.Split(spearator)[2]), newProjectName); } } } }
public ActionResult <Project> PutProject(string oldProjectName, [FromForm] Project project, [FromForm] EditProjectIcon icon) { if (!projectExists(oldProjectName)) { return(NotFound()); } DatabaseOperation db = new DatabaseOperation(); db.UpdateProject(oldProjectName, project.ProjectName, project.BundleIdentifier); FileHierarchyCreation file = new FileHierarchyCreation(); file.EditProjectFolder(oldProjectName, project.ProjectName, project.BundleIdentifier, icon); return(StatusCode(200, new{ title = "Project updated successfully.", status = 200 })); }