public ProjectBasicConfig GetConfig(PackageChannel channel) { if (!File.Exists(BuildPaths.ProjectBasicConfigFilePath)) { Debug.LogError("xcode basic config not found!"); return(null); } ProjectBasicConfig config = new ProjectBasicConfig(); string[] signingConfig = File.ReadAllLines(BuildPaths.ProjectBasicConfigFilePath); string channelFlag = "channel=" + ChannelToStr(channel); for (int i = 0; i < signingConfig.Length; ++i) { string lineContent = signingConfig[i]; if (!lineContent.Contains(channelFlag)) { continue; } while (!signingConfig[++i].Contains("code_signing_identity")) { } config.CodeSigningIdentify = ClipConfigValue(signingConfig[i].Trim()); while (!signingConfig[++i].Contains("provisioning_profile")) { } config.ProvisioningProfile = ClipConfigValue(signingConfig[i].Trim()); while (!signingConfig[++i].Contains("provisioning_profile_specifier")) { } config.ProvisioningProfileSpecifier = ClipConfigValue(signingConfig[i].Trim()); while (!signingConfig[++i].Contains("team_id")) { } config.TeamId = ClipConfigValue(signingConfig[i].Trim()); while (!signingConfig[++i].Contains("bundle_identity")) { } config.BundleIdentity = ClipConfigValue(signingConfig[i].Trim()); while (!signingConfig[++i].Contains("display_name")) { } config.DisplayName = ClipConfigValue(signingConfig[i].Trim()); config.Dump(); return(config); } return(null); }
public RedirectResult Upload(int?id) { if (Request.Files.Count > 0) { HttpPostedFileBase file = Request.Files[0]; if (file != null && file.ContentLength > 0 && file.ContentType == "text/plain") { using (DataContext _db = new DataContext()) { using (DbContextTransaction tran = _db.Database.BeginTransaction(IsolationLevel.Snapshot)) { try { int user_id = ((User)Session["CurrentUser"]).Id; Channel channel; string line; using (StreamReader stream = new StreamReader(file.InputStream)) { while ((line = stream.ReadLine()) != null) { channel = new Channel(); channel.UserId = user_id; channel.Name = line; _db.Channels.Add(channel); _db.SaveChanges(); PackageChannel pChannel = new PackageChannel() { ChannelId = channel.Id, PackageId = id.Value, }; _db.PackageChannels.Add(pChannel); } } _db.SaveChanges(); tran.Commit(); } catch { tran.Rollback(); } } } } } return(Redirect("/Channel/Channels/" + id)); }
private static string ChannelToStr(PackageChannel channel) { switch (channel) { case PackageChannel.DEBUG: return("Debug"); case PackageChannel.QA: return("QA"); case PackageChannel.Release: return("Release"); default: throw new ArgumentOutOfRangeException("channel", channel, null); } }
public JsonResult DeleteChannel(int id, int package_id) { using (DataContext _db = new DataContext()) { try { PackageChannel p_ch = _db.PackageChannels.Include(p => p.Channel).Where(p => p.ChannelId == id && p.PackageId == package_id).FirstOrDefault(); if (p_ch != null) { this.AddLoging(_db, LogType.Channel, LogMode.Delete, ((User)Session["CurrentUser"]).Id, 0, p_ch.Channel.Name, new List <LoggingData>() { new LoggingData { field = Utils.Utils.GetDisplayName(typeof(Models.Channel), "Name"), new_val = p_ch.Channel.Name, old_val = string.Empty } } ); _db.Entry(p_ch.Channel).State = System.Data.Entity.EntityState.Deleted; _db.Entry(p_ch).State = System.Data.Entity.EntityState.Deleted; _db.SaveChanges(); } } catch { return(Json(0)); } } return(Json(1)); }
public static void OnPostProcessBuild(BuildTarget target, string xcodeProjectPath, PackageChannel channel, ProjectBuildData data) { if (target != BuildTarget.iOS) { Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run"); return; } // Create a new project object from build target XCProject project = new XCProject(xcodeProjectPath + "Unity-iPhone.xcodeproj"); // Find and run through all projmods files to patch the project. // Please pay attention that ALL projmods files in your project folder will be excuted! string[] files = Directory.GetFiles(Application.dataPath, "*.projmods", SearchOption.AllDirectories); foreach (string file in files) { Debug.Log("ProjMod File: " + file); project.ApplyMod(file); } ProjectBasicConfig config = new ProjectBasicConfigLoader().GetConfig(channel); OverWriteBuildSetting(config, project); OverWriteInfoPlist(config, xcodeProjectPath, data); project.overwriteBuildSetting("ENABLE_BITCODE", "NO"); // Finally save the xcode project project.Save(); }
public JsonResult Channel(Channel channel) { if (ModelState.IsValid) { using (DataContext _db = new DataContext()) { using (DbContextTransaction tran = _db.Database.BeginTransaction(IsolationLevel.Snapshot)) { try { int user_id = ((User)Session["CurrentUser"]).Id; if (channel.Id == 0) { channel.UserId = ((User)Session["CurrentUser"]).Id; _db.Channels.Add(channel); _db.SaveChanges(); PackageChannel pChannel = new PackageChannel() { ChannelId = channel.Id, PackageId = Utils.Utils.TryIntParse(Request["package_id"]), }; _db.PackageChannels.Add(pChannel); this.AddLoging(_db, LogType.Channel, LogMode.Add, user_id, channel.Id, channel.Name, Utils.Utils.GetAddedData(typeof(Channel), channel) ); } else { Channel chan = _db.PackageChannels.Where(p => p.ChannelId == channel.Id).Select(c => c.Channel).FirstOrDefault(); if (chan != null) { chan.Name = channel.Name; _db.Entry(chan).State = System.Data.Entity.EntityState.Modified; List <LoggingData> logs = Newtonsoft.Json.JsonConvert.DeserializeObject <List <LoggingData> >(channel.Logging); if (logs != null && logs.Count > 0) { this.AddLoging(_db, LogType.Package, LogMode.Change, user_id, channel.Id, channel.Name, logs ); } } } _db.SaveChanges(); tran.Commit(); } catch (Exception) { tran.Rollback(); return(Json("0")); } } } return(Json("1")); } return(Json("0")); }