static bool Crawl(Type type) { foreach (var member in type.GetEffectiveProperties()) { var memberType = GetDefinableType(member.GetPropertyOrFieldType()); if (memberType == null || All.Contains(memberType)) { continue; } if (memberType.IsEnum) { if (Enums.Lacks(memberType)) { Enums.Add(memberType); } } else { All.Add(memberType); return(true); } } return(false); }
public void Add(SecurityContextSet set) { foreach (SecurityContext c in set) { All.Add(c); } }
public void Load() { LoadSuccess = false; All.Clear(); var filename = Config.GetVariableFilePath(); if (!File.Exists(filename)) { if (Config.IsAdministrator) { LoadSuccess = true; return; } LoadFailedMessage = $"The file {filename} does not exist."; return; } var dom = new XmlDocument(); dom.Load(filename); var doc = dom.DocumentElement; var variablesXml = doc?.SelectNodes("variable"); if (variablesXml == null) { return; } foreach (XmlElement variableXml in variablesXml) { var name = variableXml.GetChildString("name"); var value = variableXml.GetChildString("value"); All.Add(new Variable(name, value)); } LoadSuccess = true; }
public void LinesToEmployees(List <string> lines) { foreach (var line in lines) { var splitLine = line.Split(","); var name = splitLine[0]; for (var j = 1; j < splitLine.Length; j++) { splitLine[j] = splitLine[j].Trim(); } var pay = splitLine[1]; var newPay = splitLine[2]; var workPercentage = splitLine[3]; var newWorkPercentage = splitLine[4]; var startYear = splitLine[5]; var quitYear = splitLine[6]; var department = splitLine[7]; var team = splitLine[8]; var newTeam = splitLine[9]; All.Add(new Employee( name, pay, newPay, workPercentage, newWorkPercentage, startYear, quitYear, department, team, newTeam)); } }
public virtual void ReassignToWorld() { lock (All) All.Add(this); lock (this.World.Objects) this.World.Objects.Add(this); }
public static void Add(Entry e) { lock (All) All.Add(e); var dir = Path.GetDirectoryName(e.Path); var name = Path.GetFileName(e.Path); if (!Directory.Exists(dir)) { throw new DirectoryNotFoundException("Watch.FileLines: Directory not found: " + dir); } if (!File.Exists(e.Path)) { throw new FileNotFoundException("Watch.FileLines: File not found: " + e.Path, e.Path); } if (e.Watch) { var fsw = new FileSystemWatcher(dir, name) { IncludeSubdirectories = false, NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Security | NotifyFilters.FileName, }; fsw.Created += delegate { lock (e.Mutex) { e.LastMeta = FileMetaSnapshot.From(e.Path); Refresh(e); } }; fsw.Changed += delegate { lock (e.Mutex) { e.LastMeta = FileMetaSnapshot.From(e.Path); Refresh(e); } }; fsw.Error += delegate { lock (e.Mutex) { e.LastMeta = FileMetaSnapshot.From(e.Path); Refresh(e); } }; fsw.Deleted += delegate { lock (e.Mutex) { e.LastMeta = FileMetaSnapshot.From(e.Path); Refresh(e); } }; fsw.Renamed += delegate { lock (e.Mutex) { e.LastMeta = FileMetaSnapshot.From(e.Path); Refresh(e); } }; fsw.EnableRaisingEvents = true; } Refresh(e); }
private static void Add(Actor actor, float time) { if (All.Contains(actor)) { return; } All.Add(actor); actor._time += time; // (+=) => (=) ? actor.OnAdd(); var character = actor as Character; if (character == null) { return; } var ch = character; _characters[ch.pos] = ch; foreach (var buff in ch.Buffs()) { All.Add(buff); buff.OnAdd(); } }
/// <summary> /// Write to the Event Stream /// </summary> /// <remarks> /// If the event stream doesn't exist, create it. /// The data in the event parameter includes the original stream, the recorded event, and messageId. /// <seealso cref="EventWritten"/> /// Generate the name from the event type passed in the original stream. <see cref="GetOrCreateEventTypeStream"/> /// The caller sets up the Event Stream, append the events."/> /// </remarks> /// <param name="event">Event to be written to the event stream</param> private void WriteToByEventProjection(EventWritten @event) { if (!_connected || _disposed) { throw new Exception(); } if (@event.ProjectedEvent) { return; } var stream = GetOrCreateEventTypeStream(@event, out var streamName); var epochStart = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); var created = DateTime.UtcNow; var epochTime = (long)(created - epochStart).TotalSeconds; var projectedEvent = new ProjectedEvent( streamName, @event.Event.EventNumber, @event.Event.EventStreamId, @event.Event.EventId, // reusing since the projection is linking to the original event stream.Count, @event.Event.EventType, @event.Event.Data, @event.Event.Metadata, @event.Event.IsJson, created, epochTime); stream.Add(projectedEvent); All.Add(projectedEvent); _inboundEventHandler.Handle(new EventWritten(streamName, projectedEvent, true, projectedEvent.EventNumber)); }
public EnergyIntensityConverter() { var eifd = new EnergyIntensityForDisplay(EnergyIntensityType.EnergyIntensive, "Energy Intensive"); All.Add(eifd); ForHouseholds.Add(eifd); eifd = new EnergyIntensityForDisplay(EnergyIntensityType.EnergySaving, "Energy Saving"); All.Add(eifd); ForHouseholds.Add(eifd); eifd = new EnergyIntensityForDisplay(EnergyIntensityType.Random, "Randomly chosen devices"); All.Add(eifd); ForHouseholds.Add(eifd); eifd = new EnergyIntensityForDisplay(EnergyIntensityType.AsOriginal, "As chosen for the household"); All.Add(eifd); eifd = new EnergyIntensityForDisplay(EnergyIntensityType.EnergyIntensivePreferMeasured, "Energy Intensive, but prefer measured devices if available"); All.Add(eifd); ForHouseholds.Add(eifd); eifd = new EnergyIntensityForDisplay(EnergyIntensityType.EnergySavingPreferMeasured, "Energy Saving, but prefer measured devices if available"); All.Add(eifd); ForHouseholds.Add(eifd); }
public void SetData(string name, Dictionary <ChannelInfo, TimeSeriesDouble> data) { Name = name; All.Clear(); SelectedSites.Clear(); foreach (var d in data) { var e = All.FirstOrDefault(a => a.Name == d.Key.Name); if (e == null) { e = new SiteData { Name = d.Key.Name }; All.Add(e); } switch (d.Key.Component) { case FieldComponent.Unckown: throw new Exception("неизвестная компонента"); case FieldComponent.Gic: e.Gic.Ts = d.Value; break; case FieldComponent.Ex: e.Ex.Ts = d.Value; break; case FieldComponent.Ey: e.Ey.Ts = d.Value; break; case FieldComponent.Hx: e.Hx.Ts = d.Value; break; case FieldComponent.Hy: e.Hy.Ts = d.Value; break; case FieldComponent.Hz: e.Hz.Ts = d.Value; break; case FieldComponent.Dx: e.Dhx.Ts = d.Value; break; case FieldComponent.Dy: e.Dhy.Ts = d.Value; break; default: throw new ArgumentOutOfRangeException(); } } }
public FeedbackModel AddFeedback(Guid?userId, int?rating, string text, DateTime creationTime) { var feedback = new FeedbackModel(Guid.NewGuid(), userId, rating, text, creationTime); All.Add(feedback); return(feedback); }
public static DbAuthor FillBlanks(Gender gender) { var p = NewPerson.FillBlanks(gender); var b = new DbAuthor(p.First, p.Last, p.Patronimic, (eWriterType)NewValue.Int(2)); All.Add(b); return(b); }
public Allies(int index, MemLoc primaryStatus, MemLoc secondaryStatus, params string[] words) { Index = index; PrimaryStatus = primaryStatus; SecondaryStatus = secondaryStatus; Words = words ?? new string[0]; All.Add(this); }
/// <summary> /// Adds a CVar object to the variable list. /// </summary> /// <param name="variable">The CVar object to add</param> public void Set(CVar variable) { // First of all remove any old variable with the same name Remove(variable.Name); // Then add the new one All.Add(variable); }
static void InitializeEnumerator() { All.Add(Idle); All.Add(IdleOvercovered); All.Add(ShipIdle); All.Add(ShipAttacked); All.Add(ShipOvercovered); }
public CourseVisitModel AddCourseVisit(Guid courseId, Guid profileId, DateTime visitTime) { var courseVisit = new CourseVisitModel(Guid.NewGuid(), courseId, profileId, visitTime); All.Add(courseVisit); return(courseVisit); }
public ProfileModel AddProfile(string email, string firstName, string familyName, string url, string hashedPassword, byte[] salt, string profilePictureSrc, DateTime creationTime, bool isConfirmed, AuthenticationLevel authenticationLevel, Guid?homeFacultyId) { var profile = new ProfileModel(Guid.NewGuid(), email, firstName, familyName, url, hashedPassword, salt, profilePictureSrc, creationTime, isConfirmed, authenticationLevel, homeFacultyId); All.Add(profile); return(profile); }
public T AddVariable <T>() where T : Variable { var variable = (T)Activator.CreateInstance(typeof(T), GetNextVariableName(typeof(T).ToString().Split('.').Last())); variable.Owner = this; All.Add(variable); return(variable); }
public void Add(Zone zone) { All.Add(zone); if (ReferenceEquals(zone.Main, zone)) { Main.Add(zone); } }
public PostFileDownloadModel AddPostFileDownload(Guid loginTokenId, Guid fileDownloadedId, DateTime downloadTime) { var postFileDownload = new PostFileDownloadModel(Guid.NewGuid(), loginTokenId, fileDownloadedId, downloadTime); All.Add(postFileDownload); return(postFileDownload); }
private Direction(string name, int difX, int difY, int difZ) { this.Name = name; this.DifX = difX; this.DifY = difY; this.DifZ = difZ; All.Add(this); }
public Unit Register(TypeDef type) { All = All.Add(type.Name, type); AllInOrder = (from x in All.Values orderby x.Order descending select x) .Freeze(); return(unit); }
public void DatagramReceived(Connection sourceConnection, byte[] datagram, DateTime receivedTime) { NumReceived++; LastDatagram = datagram; LastConnection = sourceConnection; LastReceivedDateTime = receivedTime; All.Add(new Tuple <byte[], Connection, DateTime>(datagram, sourceConnection, receivedTime)); }
public JsonResult Create(CardModel model) { int lastID = All.Select(m => m.ID).Max(); model.ID = lastID + 1; All.Add(model); return(Json(model)); }
public TypeDef Register(TypeDef type) { All = All.Add(type.Name, type); AllInOrder = (from x in All.Values orderby x.Order descending select x) .ToSeq() .Strict(); return(type); }
public RobotSystemLoc() { All.Add(MechanicalZero); //All.Add(WorkSpaceZero); //All.Add(PostRunParkLoc); All.Add(PurgeLoc); All.Add(ScaleLoc); All.Add(PrimeLoc); All.Add(ScrapeLoc); }
public UniversityModel AddUniversity(string fullName, string shortName, string url) { var university = new UniversityModel(Guid.NewGuid(), fullName, shortName, url); All.Add(university); SaveChanges(); return(university); }
public NewPasswordSecretModel AddNewPasswordSecret(Guid profileId, Guid secret, DateTime creationTime, DateTime expirationTime) { var newPasswordSecretModel = new NewPasswordSecretModel(Guid.NewGuid(), profileId, secret, creationTime, expirationTime, true); All.Add(newPasswordSecretModel); SaveChanges(); return(newPasswordSecretModel); }
public void MakeDepartments(Employees employees) { foreach (var employee in employees.All.Where(employee => !All.Exists(d => employee.Department.Equals(d.Name)))) { var department = new Department(employee.Department); var allEmployeesInDepartment = employees.All.Where(e => e.Department == employee.Department); department.Teams.MakeTeams(allEmployeesInDepartment.ToList(), department); All.Add(department); } }
/// <summary> /// Registers a new metric with the specified <paramref name="name"/> and returns the created metric. If a metric /// with the specified name already exists, the existing metric will be returned instead. /// </summary> /// <param name="name">The name of the metric.</param> /// <param name="groupName">The group name of the metric.</param> /// <param name="obsolete">Whether the metric is obsolete.</param> public static AnalyticsMetric Register(string name, string groupName, bool obsolete) { if (All.TryGetValue(name, out var metric)) { return(metric); } metric = new AnalyticsMetric(name, groupName, obsolete); All.Add(metric.Name, metric); return(metric); }