/// <summary> /// Reads the sectors of this map. /// </summary> /// <param name="mapDirectory">The main map directory.</param> /// <param name="sectors">If set, only the given sectors will be loaded.</param> private void ReadSectors(string mapDirectory, string[] sectors = null) { var baseFiles = Directory.GetFiles(mapDirectory, "*.base"); // create itemless instances for all the sectors first; // this is so we have references to the sectors // before we read them to deal with sectors containing // nodes from other sectors foreach (var baseFile in baseFiles) { if (!SectorShouldBeLoaded(baseFile)) { continue; } var sector = new Sector(baseFile, this); Sectors.Add((sector.X, sector.Z), sector); } var sectorList = Sectors.ToList(); foreach (var sectorKvp in sectorList) { Trace.WriteLine($"Reading sector {sectorKvp.Value.ToString()}"); sectorKvp.Value.Read(); } bool SectorShouldBeLoaded(string baseFile) => sectors == null || sectors.Contains(Path.GetFileName(baseFile)); }
public async Task <IActionResult> PutSectors([FromRoute] int id, [FromBody] Sectors sectors) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sectors.SectorId) { return(BadRequest()); } _context.Entry(sectors).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SectorsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public bool Contains(string category, string key) { if (category == "ministries") { return(Ministries != null && Ministries.Contains(key)); } if (category == "sectors") { return(Sectors != null && Sectors.Contains(key)); } if (category == "tags") { return(Tags != null && Tags.Contains(key)); } if (category == "services") { return(Services != null && Services.Contains(key)); } if (category == "newsletters") { return(Newsletters != null && Newsletters.Contains(key)); } if (category == "emergency") { return(Emergency != null && Emergency.Contains(key)); } return(false); }
private void UniverseTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var node = e.NewValue; if (node is Station) { var sector = Sectors.First(sect => sect.Systems.Any(sys => sys.Stations.Contains(node as Station))); var system = sector.Systems.First(sys => sys.Stations.Contains(node as Station)); cboSector.SelectedValue = sector; cboSys.SelectedValue = system; cboStation.SelectedValue = node as Station; } else if (node is SolarSystem) { var sector = Sectors.First(sect => sect.Systems.Contains(node as SolarSystem)); cboSector.SelectedValue = sector; cboSys.SelectedValue = node as SolarSystem; cboStation.SelectedValue = null; } else if (node is Sector) { cboSector.SelectedValue = node as Sector; cboSys.SelectedValue = null; cboStation.SelectedValue = null; } }
//load sectors void LoadSectors() { var objSector = new Sectors(); var sectorList = objSector.GetSectors(int.Parse(lblClientID.Text), true); rptSector.DataSource = sectorList; rptSector.DataBind(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ConcertId,Price")] Sectors sectors) { if (id != sectors.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sectors); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SectorsExists(sectors.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ConcertId"] = new SelectList(_context.Concerts, "Id", "Name", sectors.ConcertId); return(View(sectors)); }
public void Set(List <CheckInfo> gen, List <CheckInfo> chk) { General = gen; Check = chk; TbContestName.Text = General.GetByName("ContestName"); CbCategory.Items.Clear(); var sects = Sectors.ToArray(General.GetByName("Sectors")).ToList(); foreach (var cat in sects) { if (cat != null) { CbCategory.Items.Add("(" + cat.Code + ")" + cat.WrittenName); } } CbCategory.IsEnabled = CbCategory.Items.Count > 0 ? true : false; WpPower.Children.Clear(); var pows = PowerMode.ToArray(General.GetByName("PowerMode")).ToList(); foreach (var mod in pows) { WpPower.Children.Add(new RadioButton() { Content = mod.Name, GroupName = "PowerMode" }); } TbCoeff.IsEnabled = chk.GetByName("CoeffSetting").ToBool(); TbMainContestNo.IsEnabled = chk.GetByName("AreaNoExists").ToBool(); TbSubContestNo.IsEnabled = !chk.GetByName("AreaByFreq").IsEmpty(); }
public void ActivateRandom(APIActivator activator = APIActivator.XANA) { List <Sector> randomSectors = Program.ShuffleList(Sectors.Cast <Sector>().ToList()); Boolean found = false; foreach (Sector sector in randomSectors) { try { if (!found) { sector.ActivateRandom(activator); found = true; } } catch (NoFreeTowersException) { //continue } } if (!found) { throw new NoFreeSectorsException(this); } }
public bool addSector(Sectors sector) { _db.Sectors.Add(sector); var res = _db.SaveChanges(); return((res == 1) ? true : false); }
private void AddSectorClick1(object sender, RoutedEventArgs e) { var sect = new Sector(); Sectors.Add(sect); cboSector.SelectedItem = sect; }
public bool DeleteDirectory(string target) { if (!Files.ContainsKey(target)) { return(false); } IDictionary <string, FileDescriptor> filesToRemove = new Dictionary <string, FileDescriptor>(); foreach (var file in Files) { if ((Files[file.Key].Path.Substring(0, Math.Min(Files[file.Key].Path.Length, target.Length))) == target) { foreach (var sector in Files[file.Key].Sectors) { Sectors.Remove(sector.Id); } filesToRemove.Add(file.Key, file.Value); } } foreach (var file in filesToRemove) { Files.Remove(file.Key); } return(true); }
public byte[] GetCurrentState() { List <byte> bytes = new List <byte>(); foreach (var file in Files) { bytes.AddRange(Encoding.UTF8.GetBytes(file.Key.PadRight(100))); bytes.Add((byte)((file.Value.Readable ? 1 : 0) + (file.Value.Writeable ? 2 : 0))); bytes.AddRange(BitConverter.GetBytes( (int)((file.Value.Sectors.Count - 1) * _sectorSize + file.Value.Sectors.Last().Size))); foreach (var sector in file.Value.Sectors) { bytes.AddRange(BitConverter.GetBytes((int)sector.Id)); } } bytes.AddRange(new byte[2 * _sectorSize - bytes.Count]); for (int i = 2; i < _numberOfSectors; i++) { if (Sectors.ContainsKey(i)) { bytes.AddRange(Sectors[i].Bytes); } else { bytes.AddRange(new byte[_sectorSize]); } } return(bytes.ToArray()); }
public async Task <ActionResult <Sectors> > PostSectors(Sectors sectors) { _context.Sectors.Add(sectors); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSectors", new { id = sectors.SectorId }, sectors)); }
private void SendEmailAuditRescheduling(CorrectiveAction correctiveAction) { List <string> listMails = new List <string>(); using (var scope = _serviceProvider.CreateScope()) { var _ctx = scope.ServiceProvider.GetService(typeof(SQLHoshinCoreContext)) as SQLHoshinCoreContext; var _emailSender = scope.ServiceProvider.GetService(typeof(IEmailSender)) as IEmailSender; Users newResponsibleUser = _ctx.Users.Where(x => x.Id == correctiveAction.ResponsibleUserID).SingleOrDefault(); Users lastResponsibleUser = _ctx.Users.Where(x => x.Id == correctiveAction.LastResponsibleUserID).SingleOrDefault(); Sectors sector = _ctx.Sectors.Where(x => x.SectorID == correctiveAction.SectorTreatmentID).SingleOrDefault(); listMails.AddRange(_sectorPlantRepository.GetSectorPlantReferredEmail(Convert.ToInt32(correctiveAction.PlantTreatmentID), Convert.ToInt32(correctiveAction.SectorTreatmentID))); listMails.Add(newResponsibleUser.Email); listMails.Add(lastResponsibleUser.Email); string newResponsibleName = newResponsibleUser.FirstName + " " + newResponsibleUser.Surname; string lastResponsibleName = lastResponsibleUser.FirstName + " " + lastResponsibleUser.Surname; string description = correctiveAction.Description; string sectorName = sector.Name; string estado = correctiveAction.CorrectiveActionState.Name; int correctiveActionID = correctiveAction.CorrectiveActionID; _emailSender.SendEmailAsync(listMails.ToArray(), new string[0], new string[0], $"HoshinCloud – Reasignación de Acción Correctiva", SetMessageEmail(newResponsibleName, lastResponsibleName, description, sectorName, estado, correctiveActionID), true, System.Net.Mail.MailPriority.High); } }
public IActionResult Post([FromBody] Sectors sector) { ClaimsIdentity identity = HttpContext.User.Identity as ClaimsIdentity; string role = identity.FindFirst("Role").Value; if (role == "Admin") { var res = _repo.addSector(sector); if (res) { return(Ok(new Response { StatusCode = "Success", Message = "Sector Created Successfully" })); } else { return(BadRequest(new Response { StatusCode = "Failed", Message = "Sector Creation Unsuccessful" })); } } else { return(Unauthorized(new Response { StatusCode = "Failed", Message = "Sector Creation Unsuccessful. Only Admins can be allowed" })); } }
public IHttpActionResult PutSectors(int id, Sectors sectors) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sectors.Id) { return(BadRequest()); } db.Entry(sectors).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SectorsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <summary> /// TODO: this function needs to go away. If we strike an obstactle, we should know what it is. /// This looks like a bandaid at best. /// Looks for an Obstacle at the sector passed. /// Places Friendly on map at LastSector if Obstacle detected /// </summary> /// <param name="sector"> </param> /// <param name="activeSectors"> </param> /// <param name="lastSector"> </param> /// <returns></returns> public bool SublightObstacleCheck(Coordinate lastSector, Coordinate sector, Sectors activeSectors) { //todo: I think I destroyed a star and appeared in its place when navigating to a new Region. (That or LRS is broken, or maybe it is working fine!) try { var mySector = this.ShipConnectedTo.Sector; var currentItem = Sector.Get(activeSectors, sector.X, sector.Y).Item; var currentObject = Sector.Get(activeSectors, sector.X, sector.Y).Object; if (currentItem != SectorItem.Empty) { mySector.X = lastSector.X; mySector.Y = lastSector.Y; //todo: move this to XXX label. run tests. should work. Sector.Get(activeSectors, mySector.X, mySector.Y).Item = SectorItem.PlayerShip; this.IdentifyObstacle(sector, currentObject, currentItem); this.BlockedByObstacle = true; return(true); } } catch { //Console.Write("error while checking for obstacle."); } return(false); }
/// <summary> /// Randomly allocates the PVC. /// </summary> public void AllocatePVC() { Sector lastPvcSector = _lastPvcSector.HasValue ? Sectors[_lastPvcSector.Value] : null; Sector randomSector = Sectors.Random(s => s.AllowPVC && s != lastPvcSector); randomSector.Stats.ApplyEffect(new EffectImpl.PVCEffect()); Debug.Log("Allocated PVC at " + randomSector); }
/// <summary> /// Resets the PVC allocation wait timer. /// The value is reset to the <see cref="MaxPVCAllocateWait"/> number of /// complete turn cycles (w/ adjustment). This means that if it is 1, then all players /// have to complete their turn once, and the player who got found the PVC /// has to complete their turn twice, before it is reallocated. This is to give /// an advantage to the other players. /// </summary> public void ResetPVCAllocateWait() { _lastPvcSector = Sectors.First(s => s.HasPVC).Id; Sectors[_lastPvcSector.Value].Stats.RemoveEffect <EffectImpl.PVCEffect>(); Debug.Log("Previous sector de-allocated"); _pvcAllocateWait = Game.Instance.Players.Count * MaxPVCAllocateWait; Debug.LogFormat("pvc allocate wait set to {0}", _pvcAllocateWait); }
public Sector Update(Sector sector) { Sectors sectorDb = _mapper.Map <Sector, Sectors>(sector); _ctx.Sectors.Update(sectorDb); _ctx.SaveChanges(); return(_mapper.Map <Sectors, Sector>(sectorDb)); }
//load sectors void LoadSectors() { var sectorList = new Sectors().GetSectors(1,true); rptSector.DataSource = sectorList; rptSector.DataBind(); //load sectors list for the job JobBoards chbListSectors.FillData(Bindings.Type.SECTOR, true, false); }
private void Form1_Load(object sender, EventArgs e) { pCanvas1.BackColor = Color.Black; Systems systems = new Systems(); Sectors sectors = new Sectors(); TreeWindow treeWindow = new TreeWindow(systems.getSystemTable(), sectors.getSectorTable()); treeView1.Nodes.AddRange(treeWindow.setupInitialTree()); }
/// <summary> /// Adds the map lumps to a Doom wad file. /// </summary> /// <param name="wad">The wad file to which the map should be added</param> public void AddToWad(WadFile wad) { wad.AddLump(Name, new byte[0]); wad.AddLump("LINEDEFS", Linedefs.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("SECTORS", Sectors.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("SIDEDEFS", Sidedefs.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("THINGS", Things.SelectMany(x => x.ToBytes()).ToArray()); wad.AddLump("VERTEXES", Vertices.SelectMany(x => x.ToBytes()).ToArray()); }
public VirtualWorld AddSector(string name, int towers = 10) { if (GetSector(name) == null) { Sectors.Add(new Sector(this, name, towers)); } return(this); }
public SectorsViewModel(Sectors sectors) { view = sectors; sectorService = new SectorService(); Sector = new tblSector(); SectorList = sectorService.GetSectors(); }
public List <Sectors.Intersection> Calculate(String coords) { // String trajectory = "52.3081,4.7642,0,0,EHAM,;52.2442,5.2569,13400,248,IVLUT,;52.1097,5.5653,14000,388,LUNIX,;52.0617,5.6756,16300,434,RENDI,;51.9756,5.8358,19600,509,EDUPO,;51.8558,6.0589,23200,603,NAPRO,;51.7681,6.22,25300,669,DEPAD,;51.6389,6.455,27900,767,AMOSU,;51.4047,6.8758,32100,930,MISGO,;50.7836,7.5942,38900,1291,COL,;50.5214,7.8231,40400,1434,MONAX,;49.7489,8.48,41000,1866,RIDSU,TOC;49.4653,8.6792,41000,2021,ABUKA,;48.9931,8.5842,41000,2252,KRH,;48.17,8.3214,41000,2668,NATOR,;47.8583,8.3967,41000,2823,TITIX,;47.6894,8.4369,41000,2908,TRA,;47.2603,8.5,41000,3120,RIPUS,;47.0394,8.5322,41000,3231,GERSA,TOD;46.6067,8.5942,30500,3435,SOSON,;46.4361,8.6183,26900,3523,DEGAD,;46.1044,8.665,25000,3702,ODINA,;45.5592,9.5072,17000,4142,TZO,;45.2264,9.5411,9700,4349,COD,;45.4494,9.2783,353,4821,LIML,;"; Trajectory t = new Trajectory(coords, 0); Sectors s = new Sectors(245, 900, "8.1738888889,51.2041666667;8.4111111111,51.27;8.4913888889,51.1963888889;8.6141666667,51.0833333333;8.9097222222,51.0855555556;9.2452777778,51.0855555556;9.4333333333,51.0855555556;10.0408333333,51.0833333333;10.0558333333,51.095;10.3875,51.3338888889;10.5925,51.4869444444;10.7,51.5666666667;11.1438888889,51.8063888889;11.2083333333,51.8413888889;11.13,51.9066666667;11.0916666667,52.2083333333;11.0805555556,52.2919444444;11.0702777778,52.3736111111;11.0816666667,52.4669444444;11.0833333333,52.4797222222;11.1072222222,52.7308333333;11.3436111111,52.7686111111;11.2983333333,53.1088888889;11.4302777778,53.3625;11.4438888889,53.3958333333;11.8927777778,54.2502777778;11.6383333333,54.2958333333;11.0347222222,54.5466666667;10.9833333333,54.5669444444;10.8833333333,54.5952777778;10.6666666667,54.6558333333;10.5,54.6586111111;10.0494444444,54.6547222222;8.75,54.6336111111;8.6666666667,54.7002777778;8.6666666667,54.9169444444;8.4486111111,55.0716666667;8.3919444444,55.0694444444;8.3333333333,55.0669444444;8,55.0002777778;6.5,55.0002777778;5,55.0002777778;4.5358333333,54.5002777778;4.5333333333,54.5002777778;4.1777777778,54.1113888889;4.18,54.1058333333;4.0852777778,54.0002777778;3.9427777778,53.8397222222;3.7061111111,53.57;3.6497222222,53.5002777778;3.5611111111,53.4027777778;3.4294444444,53.2494444444;3.3661111111,53.175;3.3033333333,53.1011111111;3.2547222222,53.0436111111;3.1480555556,52.9172222222;3.0683333333,52.8222222222;2.9941666667,52.7330555556;2.8988888889,52.6180555556;2.8408333333,52.5472222222;2.8291666667,52.5333333333;2.7788888889,52.4722222222;2.7102777778,52.3888888889;2.6436111111,52.3075;2.4877777778,52.1147222222;2.3563888889,51.9505555556;3.1719444444,51.9658333333;3.1719444444,51.9244444444;3.1719444444,51.4805555556;2.5,51.6369444444;2.5,51.4555555556;2,51.5;2,51.4;2,51.3833333333;2,51.3591666667;2,51.1166666667;1.9883333333,51.1141666667;1.6927777778,51.0497222222;2.8333333333,50.6919444444;3.2705555556,50.5433333333;3.2788888889,50.5275;3.3758333333,50.5033333333;3.4941666667,50.5275;3.5238888889,50.5080555556;3.5869444444,50.5033333333;3.3444444444,50.1833333333;3.63,50.1094444444;3.8202777778,50.0597222222;4.1488888889,49.9730555556;4.2319444444,49.9611111111;4.3544444444,49.8966666667;4.7555555556,49.6833333333;4.9755555556,49.5647222222;5.1013888889,49.4963888889;5.125,49.4833333333;5.8111111111,49.4311111111;5.8305555556,49.3477777778;5.9513888889,48.8325;6.2302777778,48.8194444444;6.2763888889,48.8175;6.75,48.975;6.7102777778,49.2194444444;7,49.7833333333;6.6,49.9666666667;6.6233333333,50.0513888889;7.1166666667,50.1833333333;7.3,50.6333333333;7.8166666667,50.7208333333;7.6833333333,50.8333333333;7.6822222222,50.9325;7.95,51.1;7.9713888889,51.11;8.0522222222,51.1475;8.1738888889,51.2041666667;"); List <Sectors.Intersection> ip = s.intersectionWithTrajectory(t, 1, 0); return(ip); }
public SerializableMap CreateMemento() { return(new SerializableMap { pvcAllocateWait = _pvcAllocateWait, lastPvcSector = _lastPvcSector, // create array of serialized sectors sectors = Sectors.Select(s => s.CreateMemento()).ToArray() }); }
public static string GetSectorName(int?industryID) { var r = DB.GetTable <Industries>().Where((i => (i.IndustryID == industryID))); Industries industry = r.SingleOrDefault(); var s = DB.GetTable <Sectors>().Where((i => (i.SectorID == industry.SectorID))); Sectors sector = s.SingleOrDefault(); return(sector.SectorName); }
public bool IsValid() { var startSectors = Sectors.FindAll(s => s.StartingSectorTeam != 0); if (startSectors.Count == 0) { return(false); } return(startSectors.TrueForAll(CanReachAllSectors)); }
public IHttpActionResult GetSectors(int id) { Sectors sectors = db.Sectors.Find(id); if (sectors == null) { return(NotFound()); } sectors.TypeOfSector = db.TypeOfSector.Where(t => t.Sector_Id == sectors.Id).ToList(); return(Ok(sectors)); }
/// <summary> /// The only way we can use this is if Regions get randomly assigned at this point. /// </summary> /// <param name="sectorDefs"></param> /// <param name="Regions"> </param> /// <returns></returns> public static Sectors ToSectors(this SectorDefs sectorDefs, Regions Regions) { var newSectors = new Sectors(); foreach (var sectorDef in sectorDefs) { Sectors.SetupNewSector(sectorDef, newSectors, Regions); } return(newSectors); }
public IHttpActionResult PostSectors(Sectors sectors) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Sectors.Add(sectors); db.SaveChanges(); return(Ok(sectors)); }
/// <summary> /// This function save sthe sector /// </summary> private void SaveSector() { var sector = new Sector { SectorText = txtSector.Text, Published = rbtnActiveYes.Checked }; var sectorId = new Sectors().AddEditSector(sector); //clear text box and load sectors txtSector.Text = ""; rbtnActiveYes.Checked = true; rbtnActiveNo.Checked = false; //load sectros LoadSectors(); }
public Agency() { places = new List<Place>(); field = new Sectors("field"); office = new Place("office"); research = new Place("research"); onCall = new Place("onCall"); places.Add(field); places.Add(office); places.Add(research); places.Add(onCall); field.subLocations[0].addAgent(new Agent ()); field.subLocations[0].addAgent(new Agent ()); field.subLocations[1].addAgent(new Agent ()); currentEvents = new HashSet<Event>(); }
void LoadSectors() { //bind repeater var list = new Sectors().GetSectors(1,true).ToList(); rptSectors.DataSource = list; rptSectors.DataBind(); //show and hide items/actions and no items if (list.Count > 0) { items.Visible = true; } else { items.Visible = false; } }
public Planets GetSectorPlanetsFromTarget(Planet target, Sectors sector, Planets planetList) { Planets sectorPlanets = new Planets(Config.MaxPlanets); if (planetList.Count == 0) return sectorPlanets; foreach (Planet planet in planetList) { if (planet == target) continue; if (sector == GetSector(target, planet)) { sectorPlanets.Add(planet); } } return sectorPlanets; }
// ReSharper restore InconsistentNaming /// <summary> /// This function returns data for dropdowns and lists /// </summary> /// <param name="control"></param> /// <param name="type"></param> /// <param name="bClear"></param> /// <param name="bAddEmpty"></param> /// <param name="jobId"></param> /// <param name="userId"></param> /// <param name="clientId"></param> public static void FillData(this ListControl control, Type type, bool bClear = true, bool bAddEmpty = true, int jobId = 0, int userId = 0,int clientId = 0) { if (bClear) control.Items.Clear(); if (bAddEmpty) control.Items.Add(new ListItem("-please select-", "0")); switch (type) { case Type.CLIENT_USERS: //retrieve var clientUsers = new ClientUsers().GetClientUsers(clientId); //bind foreach (var item in clientUsers) control.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.ClientUserId.ToString())); break; case Type.USER: //retrieve var users = new Users().GetUsers(0); //bind foreach (var item in users) control.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.UserId.ToString())); break; case Type.SECTOR: //retrieve var sectors = new Sectors().GetSectors(clientId,true); //bind foreach (var item in sectors) control.Items.Add(new ListItem(item.SectorText, item.SectorId.ToString())); break; case Type.CLIENT_STATUS: //retrieve var clientStatuses = new ClientStatuses().GetClientStatuses(); //bind foreach (var item in clientStatuses) control.Items.Add(new ListItem(item.ClientStatusText, item.ClientStatusId.ToString())); break; case Type.SOURCE: //retrieve var sources = new Sources().GetSources(); //bind foreach (var item in sources) control.Items.Add(new ListItem(item.SourceText, item.SourceId.ToString())); break; case Type.COUNTRY: //retrieve var countries = new Countries().GetCountries(); //bind foreach (var item in countries) control.Items.Add(new ListItem(item.Title, item.Title)); break; case Type.SALARY: var salaries = new Salaries().GetSalaries(); foreach (var item in salaries) control.Items.Add(new ListItem(item.SalaryValue.ToString("C0"), item.SalaryId.ToString())); break; case Type.HOURS: control.Items.Add(new ListItem("Full Time", "Full Time")); control.Items.Add(new ListItem("Part Time", "Part Time")); break; case Type.VACANCY_TYPE: control.Items.Add(new ListItem("Permanent", "Permanent")); control.Items.Add(new ListItem("Contract/Interim", "Contract/Interim")); control.Items.Add(new ListItem("Freelance", "Freelance")); control.Items.Add(new ListItem("Temporary/Seasonal", "Temporary/Seasonal")); break; case Type.USER_TYPE: var userTypes = new Users().GetUserTypes(); foreach (var item in userTypes) control.Items.Add(new ListItem(item.UserTypeText, item.UserTypeId.ToString())); break; case Type.APPLICATION_STATUS: var appStatus = new ApplicationStatuses().GetApplicationStatuses(new ApplicationStatusFilter { JobId = jobId }); foreach (var item in appStatus) control.Items.Add(new ListItem(item.StatusName, item.ApplicationStatusId.ToString())); break; case Type.CLIENT_GROUPS: var clientGroups = new CandidateGroups().GetGroups(new GroupFilter() { UserId = userId, Type = "CLIENT" }); foreach (var item in clientGroups) control.Items.Add(new ListItem(item.Name, item.GroupId.ToString())); break; case Type.CONTACT_GROUPS: var contactGroups = new CandidateGroups().GetGroups(new GroupFilter() { UserId = userId, Type = "CONTACT" }); foreach (var item in contactGroups) control.Items.Add(new ListItem(item.Name, item.GroupId.ToString())); break; } }
public static void ReplaceStrFile( Stream iso, Sectors file, IList<byte> bytes ) { const int bytesPerSector = 2336; const int bytesPerSectorM2 = 2352; if (bytes.Count % bytesPerSector != 0) { throw new ArgumentException( string.Format( "new STR file length must be a multiple of {0}", bytesPerSector ) ); } int numSectors = bytes.Count / bytesPerSector; byte[] tempSector = new byte[bytesPerSectorM2]; int startSector = (int)file; for (int i = 0; i < numSectors; i++) { int outputSector = startSector + i; iso.Seek( outputSector * bytesPerSectorM2, SeekOrigin.Begin ); // Keep the first 16 bytes from the original image // It contains the 00FFFFFF FFFFFFFF FFFFFF00 and MM:SS:FF bytes iso.Read( tempSector, 0, (bytesPerSectorM2 - bytesPerSector) ); // Copy the 2336 bytes from the input file to the buffer bytes.Sub( i * bytesPerSector, (i + 1) * bytesPerSector - 1 ).CopyTo( tempSector, (bytesPerSectorM2 - bytesPerSector) ); // The output from MC32.EXE doesn't have these bytes set properly: tempSector[16] = 0x01; tempSector[20] = 0x01; if ((tempSector[18] & 0x4) == 0) { // Video or Data // NOT audio, so need to update the 280 byte ecc/edc block IsoPatch.GenerateEccEdc( tempSector, IsoPatch.IsoType.Mode2Form1 ); } else { // CDXA M2F2 IsoPatch.GenerateEccEdc( tempSector, IsoPatch.IsoType.Mode2Form2 ); } // Finished mucking with the sector, write it back to the ISO iso.Seek( outputSector * bytesPerSectorM2, SeekOrigin.Begin ); iso.Write( tempSector, 0, bytesPerSectorM2 ); } }
public static byte[] ReadFile( Stream iso, Sectors file, int offset, int length ) { return IsoPatch.ReadFile( IsoPatch.IsoType.Mode2Form1, iso, (int)file, offset, length ); }
public static Sectors MirrorSector(Sectors sector) { switch (sector) { case Sectors.NordEast: return Sectors.SouthWest; case Sectors.NordWest: return Sectors.SouthEast; case Sectors.SouthEast: return Sectors.NordWest; case Sectors.SouthWest: return Sectors.NordEast; default: return Sectors.None; } }
public KnownPosition( Sectors sector, int startLocation, int length ) { Sector = sector; StartLocation = startLocation; Length = length; }
public bool ContainsKey( Sectors sector ) { return fileToSectorMap.ContainsKey( sector ); }
public KnownPosition(Sectors sector, int startLocation, int length) : this((Enum)sector, startLocation, length) { Sector = sector; }