public static MetadataDictionary FromStream(BinaryReader stream) { var value = new MetadataDictionary(); while (true) { byte key = stream.ReadByte(); if (key == 127) { break; } byte type = (byte)((key & 0xE0) >> 5); byte index = (byte)(key & 0x1F); var entry = EntryTypes[type](); if (index == 17) { entry = new MetadataLong { id = type }; } entry.FromStream(stream); entry.Index = index; value[index] = entry; } return(value); }
public static MetadataDictionary FromStream(BinaryReader reader) { Stream stream = reader.BaseStream; MetadataDictionary metadata = new MetadataDictionary(); { var count = VarInt.ReadInt32(stream); for (int i = 0; i < count; i++) { int index = VarInt.ReadInt32(stream); int type = VarInt.ReadInt32(stream); var entry = EntryTypes[type](); entry.FromStream(reader); entry.Index = (byte)index; metadata[index] = entry; } } return(metadata); return(null); }
public static Entry Create(string head, string text, Guid topicId, EntryTypes type) { return(Create(Guid.NewGuid(), head, text, topicId, type)); }
/// <summary> /// Appends <paramref name="data"/> to the <see cref="Payload"/> <see cref="MemoryStream"/>. /// </summary> /// <param name="data">The data object.</param> /// <returns>The current <see cref="IMessage"/>.</returns> public IMessage Append(EntryTypes data) { using (BinaryWriter bw = new BinaryWriter(Payload, Encoding.Default, true)) { bw.Write((Int32)data); } return(this); }
void ConstructorThrows(EntryTypes type, String instruction, String message, String paramName) { ITestEntry entry = default; TestX.If.Action.ThrowsException(() => entry = new TestEntry(type, instruction, message), out ArgumentException argEx); TestX.If.Value.IsEqual(argEx.ParamName, paramName); TestX.If.Object.IsNull(entry); }
public void UpdateDataEntry(EntryTypes type, int amount = 1) { //Update the data. _statisticsEntries[(int)type].UpdateData(amount); //Update the final score as well. StatsScore += _statisticsEntries[(int)type].EntryValue * (StatsValueModifier); }
public JournalEntry(EntryTypes type, string text, Quest quest = null, NPC npc = null, bool upwards = false) { entryType = type; entryText = text; entryQuest = quest; entryNpc = npc; entryUpwards = upwards; }
/// <summary> /// Factory method for creating new instances of <see cref="XmlRenderer"/>. Instantiates /// the correct renderer forthe specied document map <see cref="Entry"/>. /// </summary> /// <param name="entry">The entry in the document map to render.</param> /// <param name="exporter">The exporter.</param> /// <returns>A valid renderer or null.</returns> public static XmlRenderer Create(Entry entry, Document document) { XmlRenderer renderer = null; if (document == null) { throw new ArgumentNullException("document"); } if (entry.Item is ReflectedMember) { if (entry.Item is TypeDef && string.IsNullOrEmpty(entry.SubKey)) { renderer = new TypeXmlRenderer(entry); } else if (entry.Item is MethodDef) { renderer = new MethodXmlRenderer(entry); } else if (entry.Item is FieldDef) { renderer = new FieldXmlRenderer(entry); } else if (entry.Item is PropertyDef) { renderer = new PropertyXmlRenderer(entry); } else if (entry.Item is EventDef) { renderer = new EventXmlRenderer(entry); } } else if (entry.Item is KeyValuePair <string, List <TypeDef> > ) { // namespace renderer = new NamespaceXmlRenderer(entry); } else if (entry.Item is List <PropertyDef> || entry.Item is List <MethodDef> || entry.Item is List <FieldDef> || entry.Item is List <EventDef> ) { renderer = new TypeMembersXmlRenderer(entry); } else if (entry.Item is EntryTypes) { EntryTypes type = (EntryTypes)entry.Item; switch (type) { case EntryTypes.NamespaceContainer: renderer = new NamespaceContainerXmlRenderer(entry); break; } } renderer.Document = document; return(renderer); }
void Constructor(EntryTypes type, String instruction, String message, EntryTypes expected_type, String expected_instruction, String expected_message) { ITestEntry entry = default; TestX.IfNot.Action.ThrowsException(() => entry = new TestEntry(type, instruction, message), out Exception ex); TestX.IfNot.Object.IsNull(entry); TestX.If.Value.IsEqual(entry.EntryType, expected_type); TestX.If.Value.IsEqual(entry.Instruction, expected_instruction); TestX.If.Value.IsEqual(entry.Message, expected_message); }
void FromResult(Boolean result, String instruction, String message, EntryTypes expected_type, String expected_instruction, String expected_message) { ITestEntry entry = default; TestX.IfNot.Action.ThrowsException(() => entry = TestEntry.FromResult(result, instruction, message), out Exception ex); TestX.IfNot.Object.IsNull(entry); TestX.If.Value.IsEqual(entry.EntryType, expected_type); TestX.If.Value.IsEqual(entry.Instruction, expected_instruction); TestX.If.Value.IsEqual(entry.Message, expected_message); }
public void LogMessage(EntryTypes entryType, string message) { this._db.LogMessage.Add(new LogMessage() { Id = Guid.NewGuid(), EntryType = entryType, LogTime = DateTime.Now, Message = message }); this._db.SaveChanges(); }
public static string GetControllerNameByEntryType(this HtmlHelper html, EntryTypes type) { if (type == EntryTypes.Issue) { return("Voting"); } if (type == EntryTypes.User) { return("Account"); } return(type.ToString()); }
internal TestEntry(EntryTypes type, String instruction, String message) { if (type == EntryTypes.ResultOk || type == EntryTypes.ResultFail) { Throw.If.String.IsNullOrWhiteSpace(instruction, nameof(instruction)); Instruction = instruction; } Throw.If.String.IsNullOrWhiteSpace(message, nameof(message)); EntryType = type; Message = message; }
public IEnumerable <FileInfo> SearchFiles(string searchTerm, EntryTypes searchType) { IEnumerable <FileInfo> fileList = GetFileInfos(filePath, searchType); // Search the contents of each file. IEnumerable <FileInfo> queryMatchingFiles = from file in fileList let fileText = GetFileText(file) where fileText.Contains(searchTerm) select file; return(queryMatchingFiles); }
public static MetadataDictionary FromStream(IMinecraftStream stream) { var value = new MetadataDictionary(); while (true) { byte key = stream.ReadUInt8(); if (key == 127) { break; } byte type = (byte)((key & 0xE0) >> 5); byte index = (byte)(key & 0x1F); var entry = EntryTypes[type](); entry.FromStream(stream); entry.Index = index; value[index] = entry; } return(value); }
public void SetDataEntry(EntryTypes type, int number) { //Exception for highest combo, need not set if the nubmer is lower than current. if (type == EntryTypes.HighestCombo) { if (_statisticsEntries[(int)type].Data > number) { return; } } _statisticsEntries[(int)type].SetData(number); //Tally up the score of the number set by the value. }
//public virtual ReadOnlyCollection<Link> Links { get { return links.AsReadOnly(); } } #region Static methods public static Entry Create(string head, string text, int topicId, EntryTypes type) { var note = new Entry { Head = head, Text = text, TopicId = topicId, Type = type, CreationTime = DateTime.Now }; return(note); }
public EntryPoint(string name, Vector3 pos, EntryTypes type, List <Vector3> helipads, Vector3 planeSpawn, float planeSpawnHeading, Vector3 approach, Vector3 runwayStart, Vector3 runwayEnd, float heading) { Name = name; Position = pos; Type = type; Heading = heading; Helipads = new List <Vector3>(helipads); PlaneSpawn = planeSpawn; PlaneSpawnHeading = planeSpawnHeading; Approach = approach; RunwayStart = runwayStart; RunwayEnd = runwayEnd; }
public DataEntry GetEntryData(EntryTypes type) { //If we are asking for accuracy we have to calculate it if (type == Statistics.EntryTypes.HitPercentage) { //Get the data we need (ball shit. hehe) int ballsfired = _statisticsEntries[(int)EntryTypes.PlayerShotsFired].Data; int ballshit = _statisticsEntries[(int)EntryTypes.PlayerShotsHit].Data; float accuracy = 0.0f; if (ballsfired != 0) { //Calculate the accuracy here. accuracy = ((float)ballshit / (float)ballsfired) * 100.0f; } //Set the data in teh statistics before returning. _statisticsEntries[(int)EntryTypes.HitPercentage].SetData((int)accuracy); } //If we are asking for gems percentage we calculate it here. if (type == Statistics.EntryTypes.GemsPercentage) { //Get the data we need (ball shit. hehe) int ballsfired = _statisticsEntries[(int)EntryTypes.GemsCollected].Data + _statisticsEntries[(int)EntryTypes.GemsLost].Data; int ballshit = _statisticsEntries[(int)EntryTypes.GemsLost].Data; float accuracy = 0.0f; if (ballsfired != 0) { //Calculate the accuracy here. accuracy = ((float)ballshit / (float)ballsfired) * 100.0f; } //Set the data in teh statistics before returning. _statisticsEntries[(int)EntryTypes.GemsPercentage].SetData((int)accuracy); } //Return the data being asked for. return(_statisticsEntries[(int)type]); }
public EntryPoint(string name, Vector3 pos, EntryTypes type, List<Vector3> helipads, Vector3 planeSpawn, float planeSpawnHeading, Vector3 approach, Vector3 runwayStart, Vector3 runwayEnd, float heading) { Name = name; Position = pos; Type = type; Heading = heading; Helipads = new List<Vector3>(helipads); PlaneSpawn = planeSpawn; PlaneSpawnHeading = planeSpawnHeading; Approach = approach; RunwayStart = runwayStart; RunwayEnd = runwayEnd; }
public IDbEntry New(string newId, Type entryType = null) { if (Find(newId) != null) { throw new Exception($"Entry with Id '{newId}' already exist."); } if (entryType == null) { entryType = EntryTypes.FirstOrDefault(); } var newEntry = Create(entryType); newEntry.Id = newId; Add(newEntry); return(newEntry); }
public void InitEntry(GameObject _leftBlock, GameObject _rightBlock, EntryTypes _entryType, int _ID) { entryType = _entryType; leftBlock = _leftBlock; leftRectTransform = leftBlock.GetComponent <RectTransform>(); valueDisplayer = leftBlock.GetComponent <ValueDisplayer>(); leftBlock.GetComponent <ValueDisplayer>().Init(this); // to estatblish a link back to here rightBlock = _rightBlock; rightRectTransform = rightBlock.GetComponent <RectTransform>(); startHeight = rightRectTransform.rect.height; ID = _ID; Debug.Log("InitEntry index:" + _ID); }
private void PrimeOnTypes(List <JournalEntry> entries, EntryTypes entryType) { selectedPrimed = false; foreach (JournalEntry entry in entries) { if (entry.entryType == entryType || entryType == EntryTypes.Entry) { if (!selectedPrimed) { SelectEntry(entry); } PrimeEntry(entry); } } if (selectedJournalEntry.entryDisplay == null) { selectedJournalEntry.Empty(); } selectedPrimed = false; }
public async Task DeleteStoreSecretAsync(EntryTypes EntryType, HttpContext Context) { try { SqlConnection.Open(); SqlCommand command = new SqlCommand() { Connection = SqlConnection, CommandType = CommandType.StoredProcedure, CommandText = "[Store].[DeleteStoreSecret]" }; command.Parameters.AddWithValue("@EntryType", EntryType.GetHashCode()); command.Parameters.AddRange(QueryParameters(Context)); SqlDataReader reader = await command.ExecuteReaderAsync().ConfigureAwait(false); if (reader.HasRows) { ResultTable.Load(reader); } await reader.CloseAsync().ConfigureAwait(false); await reader.DisposeAsync().ConfigureAwait(false); await command.DisposeAsync().ConfigureAwait(false); await SqlConnection.CloseAsync().ConfigureAwait(false); } catch (Exception exception) { if (SqlConnection.State.Equals("Open")) { await SqlConnection.CloseAsync(); } DictionaryLog.Add("Exception", exception.HResult); DictionaryLog.Add("Exception Message", exception.Message); } }
public EntryPoint(string name, Vector3 pos, EntryTypes type, float heading) : this(name, pos, type, new List<Vector3>(), new Vector3(0,0,0), 0f, new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), heading) { }
public static void DeleteEntry(int entryID, EntryTypes entryType, int portfolioID) { string commandText = "DELETE FROM Calendar_EntriesUsers WHERE EntryID = " + entryID; CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText); if (entryType == EntryTypes.Event) { commandText = "DELETE FROM Calendar_Events WHERE EntryID = " + entryID; } else if (entryType == EntryTypes.Task) { commandText = "DELETE Calendar_TaskStatusesUsers FROM Calendar_TaskStatusesUsers ctu "; commandText += "INNER JOIN Calendar_Tasks ct ON ctu.TaskID = ct.TaskID "; commandText += "WHERE ct.EntryID = " + entryID + " "; commandText += "AND ctu.PortfolioID = " + portfolioID.ToString() + ";"; commandText += "DELETE FROM Calendar_Tasks WHERE EntryID = " + entryID; } CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText); commandText = "DELETE FROM Calendar_Entries WHERE EntryID = " + entryID; CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText); }
public static ClassTypes CreateClassType(String longName, String shortName, EntryTypes entryType, int ordID, int chargeType, int showID) { ClassTypes classType = new ClassTypes(); classType.LongName = longName; classType.ShortName = shortName; classType.EntryTypeID = (int)entryType; classType.OrdID = ordID; classType.ChargeType = chargeType; classType.ShowID = showID; classType.Save(); return classType; }
public EntryPoint(string name, Vector3 pos, EntryTypes type, List<Vector3> helipads) : this(name, pos, type, helipads, new Vector3(0, 0, 0), 0f, new Vector3(0, 0, 0), new Vector3(0, 0, 0), new Vector3(0, 0, 0), 0f) { }
// ==================================================================================================== public void Init(TimeLineEntry _timeLineEntry) { timeLineEntry = _timeLineEntry; entryType = timeLineEntry.entryType; }
public IEnumerable <FileInfo> GetAllFiles(EntryTypes searchType) { return(GetFileInfos(filePath, searchType)); }
public virtual ActionResult GetNextGetCommentSupportersPage(int?pageIndex, string entryId, string commentId, EntryTypes type, string parentId) { if (!pageIndex.HasValue) { return(Json(null)); } SimpleListContainerModel model = null; if (type == EntryTypes.Issue) { var service = (VotingService)ServiceLocator.Resolve(typeof(VotingService)); model = service.GetCommentSupporters(pageIndex.Value, entryId, commentId, parentId); } else if (type == EntryTypes.Idea) { var service = (IdeaService)ServiceLocator.Resolve(typeof(IdeaService)); model = service.GetCommentSupporters(pageIndex.Value, entryId, commentId, parentId); } else if (type == EntryTypes.Problem) { var service = (ProblemService)ServiceLocator.Resolve(typeof(ProblemService)); model = service.GetCommentSupporters(pageIndex.Value, entryId, commentId, null); } else { return(Json(null)); } var json = new { Content = RenderPartialViewToString(MVC.Shared.Views.SimpleList, model.List.List), model.List.HasMoreElements }; return(Json(json)); }
private IEnumerable <FileInfo> GetFileInfos(string startFolder, EntryTypes searchType) { DirectoryInfo dir = new DirectoryInfo(startFolder); return(dir.GetFiles("*" + searchType.ToString() + ".txt", SearchOption.AllDirectories)); }
public EntryPoint(string name, Vector3 pos, EntryTypes type, Vector3 planeSpawn, float planeSpawnHeading, Vector3 approach, Vector3 runwayStart, Vector3 runwayEnd) : this(name, pos, type, new List<Vector3>(), planeSpawn, planeSpawnHeading, approach, runwayStart, runwayEnd, 0f) { }
public static void DeleteEntry(int entryID, EntryTypes entryType, int portfolioID) { string commandText = "Update App_ChecklistItem set EntryID=null where EntryID=" + entryID; commandText += ";DELETE FROM Calendar_EntriesUsers WHERE EntryID = " + entryID; CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText); if (portfolioID == 0) { // Deleting a CAMS entry so get rid of all of the criteria stuff string AdminCriteriaID = CCLib.Common.DataAccess.GetValue("Select AdminCriteriaID from Calendar_AdminCriteria where EntryID=" + entryID).ToString(); commandText = "DELETE FROM Calendar_AdminCriteriaGrades where AdminCriteriaID=" + AdminCriteriaID; commandText += ";DELETE FROM Calendar_AdminCriteria where EntryID=" + entryID; CCLib.Common.DataAccess.ExecuteDb(commandText); } if (entryType == EntryTypes.Event) { commandText = "DELETE FROM Calendar_Events WHERE EntryID = " + entryID; } else if (entryType == EntryTypes.Task) { commandText = "DELETE Calendar_TaskStatusesUsers FROM Calendar_TaskStatusesUsers ctu "; commandText += "INNER JOIN Calendar_Tasks ct ON ctu.TaskID = ct.TaskID "; commandText += "WHERE ct.EntryID = " + entryID + " "; commandText += "AND ctu.PortfolioID = " + portfolioID.ToString() + ";"; commandText += "DELETE FROM Calendar_Tasks WHERE EntryID = " + entryID; } CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText); commandText = "DELETE FROM Calendar_Entries WHERE EntryID = " + entryID; CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText); }
public void UpdateIndex(MongoObjectId id, EntryTypes type) { if (id == null) { return; } Lucene.Net.Index.IndexModifier modifier = null; try { if (searcher != null) { try { searcher.Close(); } catch (Exception e) { logger.Error("Exception closing lucene searcher:" + e.Message, e); throw; } searcher = null; } modifier = new Lucene.Net.Index.IndexModifier(CustomAppSettings.SearchIndexFolder, analyzer, false); // same as build, but uses "modifier" instead of write. // uses additional "where" clause for bugid modifier.DeleteDocuments(new Lucene.Net.Index.Term("id", id.ToString())); using (var noSqlSession = noSqlSessionFactory()) { switch (type) { case EntryTypes.Idea: var idea = noSqlSession.GetById <Idea>(id); if (idea != null) { modifier.AddDocument(CreateDoc(id, CreateSearchText(idea), idea.Subject, type)); } break; case EntryTypes.Issue: var issue = noSqlSession.GetById <Issue>(id); if (issue != null) { modifier.AddDocument(CreateDoc(id, CreateSearchText(issue), issue.Subject, type)); } break; case EntryTypes.User: var user = noSqlSession.GetById <User>(id); if (user != null) { modifier.AddDocument(CreateDoc(id, user.FullName, user.FullName, type)); } break; case EntryTypes.Organization: var org = noSqlSession.GetById <Organization>(id); if (org != null) { modifier.AddDocument(CreateDoc(id, org.Name, org.Name, type)); } break; case EntryTypes.Problem: var prob = noSqlSession.GetById <Problem>(id); if (prob != null) { modifier.AddDocument(CreateDoc(id, CreateSearchText(prob), prob.Text.LimitLength(100), type)); } break; default: break; } } } catch (Exception e) { logger.Error("exception updating Lucene index: " + e.Message, e); } finally { try { if (modifier != null) { modifier.Flush(); modifier.Close(); } } catch (Exception e) { logger.Error("exception updating Lucene index: " + e.Message, e); } } }
private Lucene.Net.Documents.Document CreateDoc(MongoObjectId id, string text, string subject, EntryTypes type) { Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document(); doc.Add(new Lucene.Net.Documents.Field( "text", new System.IO.StringReader(text.StripHtml()))); doc.Add(new Lucene.Net.Documents.Field( "id", id.ToString(), Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.UN_TOKENIZED)); doc.Add(new Lucene.Net.Documents.Field( "subject", subject, Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.UN_TOKENIZED)); doc.Add(new Lucene.Net.Documents.Field( "type", type.ToString(), Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.UN_TOKENIZED)); // For the highlighter, store the raw text doc.Add(new Lucene.Net.Documents.Field( "raw_text", text.StripHtml(), Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.UN_TOKENIZED)); return(doc); }