/// <summary> /// Gets the column. /// </summary> /// <param name="target">The target.</param> /// <param name="basedOn">The based on.</param> /// <returns></returns> public IQueryable <TagReference> GetColumn(string target, params IColumnSetup[] basedOn) { basedOn.Guard("setups"); var final = new TagReference[] { }.AsQueryable(); Expression <Func <StorableTaggedFile, Guid> > distinctor; Func <IEnumerable <Guid>, IReferenceAdapters, IQueryable <TagReference> > subSelector; var expression = BuildExpression(basedOn); if (null == expression) { return(final); } if (!distinctors.TryGetValue(target, out distinctor)) { return(final); } if (!subSelectors.TryGetValue(target, out subSelector)) { return(final); } return(new TagReference[] { new FilterAll() }.AsQueryable().Concat( subSelector(libraryManagerService.Find(expression).Select(distinctor).Distinct(), referenceAdapters).OrderBy(x => x.Name) ));//.Select(x => subSelector(referenceAdapters, x)).OrderBy(x => x.Name)); }
public override void ReadValue(EndianReader reader) { IsEnabled = true; try { reader.Seek(ValueAddress, SeekOrigin.Begin); referenceValue = new TagReference(item.Module, reader); if (referenceValue.TagId != -1 && referenceValue.Tag == null) { SelectedClass = ClassOptions[0]; SelectedItem = TagOptions[0]; } else { SelectedClass = ClassOptions.FirstOrDefault(i => i.Label == referenceValue.Tag?.ClassName); SelectedItem = TagOptions.FirstOrDefault(i => i.Context != null && i.Context == referenceValue.Tag); } IsDirty = false; } catch { IsEnabled = false; } }
private string[] ProcessItem(object o) { UniqueStringCollection deps = new UniqueStringCollection(); if (o is TagReference) { TagReference tagRef = (o as TagReference); if (tagRef.Value != null) { if (tagRef.Value.Length > 0) { string filename = tagRef.Value + TagFileName.GetFileExtension(tagRef.TagGroup); deps.Add(filename); } } } if (o is CollectionBase) { foreach (object child in (o as CollectionBase)) { if (child is IBlock) { string[] items = ProcessDependencies(child as IBlock); deps.AddRange(items); } } } if (o is IBlock) { string[] items = ProcessDependencies(o as IBlock); deps.AddRange(items); } return(deps.ToArray()); }
/// <summary> /// Processes this instance. /// </summary> protected async virtual Task <bool> Process() { var text = TagReference.InnerText; var ngModel = TagReference.GetAttributeValue("[(ngModel)]", null); var prefix = GenerateIdPrefix(); //if the element is bound to an ng model, use that as an id else use the inner text if (ngModel != null) { TagReference.Id = prefix + "_" + ngModel.ToLower(); return(true); } else if (!string.IsNullOrWhiteSpace(text)) { var scrubbedText = Regex.Replace(text, "[" + InvalidCharacters + "]", "", RegexOptions.None, TimeSpan.FromSeconds(1.5)); scrubbedText = Regex.Replace(scrubbedText, @"\s+", "").ToLower(); TagReference.Id = prefix + "_" + scrubbedText; return(true); } return(false); }
private void OnDoubleClicked(TagReference o) { if (null == o) { return; } OnItemDoubleClicked(o); }
private void ColumnOnItemDoubleClicked(TagReference tagReference) { if (null == results) { return; } OnPlayItems(); }
void StringIdFieldsInitialize(BlamLib.CheApe.ProjectState state) { if (StringIdFieldDefinition != null) return; // Will add itself to the import state in the ctor StringIdFieldDefinition = new TagReference(state, kStringIdFieldDefinitionName, true, kStringIdGroupTag); StringIdFieldHandlePadding = new Field(state, state.kTypeIndexPad, "", kStringIdPadSize.ToString()); }
/// <summary> /// Called when [item double clicked]. /// </summary> /// <param name="item">The item.</param> protected virtual void OnItemDoubleClicked(TagReference item) { if (null == ItemDoubleClicked) { return; } ItemDoubleClicked(item); }
/// <summary> /// Called when [item selected]. /// </summary> /// <param name="item">The item.</param> protected virtual void OnItemSelected(TagReference item) { if (null == ItemSelected) { return; } ItemSelected(item); }
/// <summary> /// Add a tag reference that is a child field of this tag's <see cref="TagDefinition"/> to this tag's list of bad child references /// </summary> /// <param name="tag_reference">Child field of this tag which contains a faulty tag reference</param> public void BadReferencesAdd(TagReference tag_reference) { if (badReferences == null) { badReferences = new List <TagReference>(); } badReferences.Add(tag_reference); }
private void ColumnOnItemDoubleClicked(TagReference tagReference) { if (null == results) { return; } playlistService.Clear(); playlistService.AddFiles(results); playerService.Next(); }
protected void TagReferencesToMemoryStream() { TagReference tr = new TagReference(); foreach (Import.TagReference tagr in OwnerState.Importer.References.Values) { tr.Reset(tagr); tr.Write(MemoryStream); } }
public static TagReference ReadTagReference(this BinaryReader reader) { // Read a TagReference object from the stream. TagReference reference = new TagReference(); reference.groupTag = reader.ReadGroupTag(); reference.datum = reader.ReadDatumIndex(); return(reference); }
/// <summary> /// Reset the import state so there are no present definitions /// </summary> public override void Reset() { base.Reset(); StringIdFieldDefinition = null; StringIdFieldHandlePadding = null; Structs.Clear(); Blocks.Clear(); Groups.Clear(); }
void StringIdFieldsInitialize(BlamLib.CheApe.ProjectState state) { if (StringIdFieldDefinition != null) { return; } // Will add itself to the import state in the ctor StringIdFieldDefinition = new TagReference(state, kStringIdFieldDefinitionName, true, kStringIdGroupTag); StringIdFieldHandlePadding = new Field(state, state.kTypeIndexPad, "", kStringIdPadSize.ToString()); }
private async void FirstColumnOnItemSelected(TagReference tagReference) { if (null == CurrentSecondColumn) { return; } if (null == firstColumn.SelectedItem) { return; } secondColumn.SetItems(await filteringService.GetColumnAsync(CurrentSecondColumn.Original, new ColumnSetup(CurrentFirstColumn.Original, firstColumn.SelectedItem.Id))); }
public static IIndexItem GetShaderDiffuse(TagReference tagRef, DependencyReader reader) { if (tagRef.Tag == null) { return(null); } int offset; switch (tagRef.Tag.ClassCode) { case "soso": offset = 176; break; case "senv": offset = 148; break; case "sgla": offset = 356; break; case "schi": offset = 228; break; case "scex": offset = 900; break; case "swat": case "smet": offset = 88; break; default: return(null); } reader.Seek(tagRef.Tag.MetaPointer.Address + offset, SeekOrigin.Begin); var bitmId = reader.ReadInt16(); if (bitmId == -1) { return(null); } else { return(tagRef.Tag.CacheFile.TagIndex[bitmId]); } }
public static dynamic GetReferenceObject(TagReference reference) { if (mapStream == null) { return(null); } if (reference.Ident == TagIdent.NullIdentifier) { return(null); } return(mapStream[reference.Ident].Deserialize( )); }
public static T GetReferenceObject <T>(TagReference reference) where T : class { if (mapStream == null) { return(null); } if (reference.Ident == TagIdent.NullIdentifier) { return(null); } return(mapStream[reference.Ident].Deserialize( )); }
public override void WriteValue(EndianWriter writer) { if (SelectedItem == null) //null during class transition { return; } var tag = SelectedItem.Context; referenceValue = new TagReference(context.Cache, tag.ClassId, tag.Id); writer.Seek(ValueAddress, SeekOrigin.Begin); referenceValue.Write(writer); }
protected async override Task <bool> Process() { var ngClick = TagReference.GetAttributeValue("(click)", null); var prefix = GenerateIdPrefix(); //if the element is bound to an ng model, use that as an id else use the inner text if (ngClick != null) { TagReference.Id = prefix + "_" + ReplaceInvalidChars(ngClick.ToLower()); return(true); } return(false); }
void ProcessTagReferences(ProjectState state, IO.XmlStream s) { foreach (XmlNode n in s.Cursor.ChildNodes) { if (n.Name != "Reference") { continue; } s.SaveCursor(n); var tagref = new TagReference(state, s); s.RestoreCursor(); string name_str = tagref.ToString(); try { References.Add(name_str, tagref); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "tag reference definition", name_str); } } }
public override void ReadValue(EndianReader reader) { IsBusy = true; IsEnabled = true; try { reader.Seek(ValueAddress, SeekOrigin.Begin); referenceValue = new TagReference(context.Cache, reader); SelectedClass = ClassOptions.FirstOrDefault(i => i.Label == referenceValue.Tag?.ClassName); SelectedItem = TagOptions.FirstOrDefault(i => i.Context != null && i.Context == referenceValue.Tag); IsDirty = false; } catch { IsEnabled = false; } IsBusy = false; }
public ContentItem Import(ImportSettings importSettings, object objectToImport, IContent parentContent) { TagReferences tagsToImport = (TagReferences)objectToImport; if (tagsToImport.TagReferenceList.Count == 0) { return(null); } var taxonomyPart = _taxonomyImportService.CreateTaxonomy("Tags"); var currentTerms = _taxonomyService.GetTermsForContentItem(parentContent.ContentItem.Id, "Tags").ToList(); foreach (var tagReference in tagsToImport.TagReferenceList) { if (string.IsNullOrWhiteSpace(tagReference.Title)) { continue; } var term = _taxonomyService.GetTermByName(taxonomyPart.Id, tagReference.Title); if (term == null) { TagReference reference = tagReference; term = _tags.GetOrAdd(reference.ID, (o) => _taxonomyImportService.CreateTermFor(taxonomyPart, reference.Title, reference.ID)); } var currentTerm = currentTerms.FirstOrDefault(o => o.Id == term.Id); if (currentTerm == null) { currentTerms.Add(term); } } _taxonomyService.UpdateTerms(parentContent.ContentItem, currentTerms, "Tags"); return(null); }
private void FindAllReferences(Block tagBlock, Dictionary <HaloTag, Group> tags) { HaloTag tag; foreach (var field in tagBlock) { switch (field) { case BlockField blockField: foreach (var block in blockField.BlockList) { FindAllReferences(block, tags); } break; case StructField structField: FindAllReferences(structField.Block, tags); break; case Abide.Tag.Cache.TagReferenceField tagReferenceField: TagReference tagReference = tagReferenceField.Reference; tag = Map.GetTagById(tagReference.Id); if (tag != null) { FindAllReferences(tag, tags); } break; case Abide.Tag.Cache.TagIndexField tagIdField: TagId tagId = tagIdField.Id; tag = Map.GetTagById(tagId); if (tag != null) { FindAllReferences(tag, tags); } break; } } }
protected async override Task <bool> Process() { var url = TagReference.GetAttributeValue("href", null); if (!string.IsNullOrWhiteSpace(url)) { Uri parsedUri; var uri = Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out parsedUri); if (parsedUri != null) { var lastSegment = parsedUri.Segments[parsedUri.Segments.Length - 1]; TagReference.SetAttributeValue("id", "link_" + lastSegment); return(true); } } else { return(await base.Process()); } return(false); }
/// <summary> /// Process a XML file containing CheApe definitions /// </summary> /// <param name="state"></param> /// <param name="s"></param> private void ProcessFile(ProjectState state, BlamLib.IO.XmlStream s) { int complexity = 1 + PreprocessXmlNodeComplexity(); BlamVersion def_engine = BlamVersion.Unknown; s.ReadAttribute("game", ref def_engine); if (def_engine != state.Definition.Engine) { Debug.Assert.If(false, "CheApe definition '{0}' is for {1}. Expected a {2} definition.", s.FileName, def_engine, state.Definition.Engine); } else { string name_str; foreach (XmlNode n in s.Cursor.ChildNodes) { switch (n.Name) { #region Enums case "enums": s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "Enum") { continue; } s.SaveCursor(n2); StringList list = new StringList(state, s); s.RestoreCursor(); name_str = list.ToString(); try { Enums.Add(name_str, list); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "enum definition", name_str); } } s.RestoreCursor(); break; #endregion #region Flags case "flags": s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "Flag") { continue; } s.SaveCursor(n2); StringList list = new StringList(state, s); s.RestoreCursor(); name_str = list.ToString(); try { Flags.Add(name_str, list); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "flag definition", name_str); } } s.RestoreCursor(); break; #endregion #region Tag References case "references": s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "Reference") { continue; } s.SaveCursor(n2); TagReference tagref = new TagReference(state, s); s.RestoreCursor(); name_str = tagref.ToString(); try { References.Add(name_str, tagref); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "tag reference definition", name_str); } } s.RestoreCursor(); break; #endregion #region Tag Data case "data": s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "TagData") { continue; } s.SaveCursor(n2); TagData tagdata = new TagData(state, s); s.RestoreCursor(); name_str = tagdata.ToString(); try { Data.Add(name_str, tagdata); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "tag data definition", name_str); } } s.RestoreCursor(); break; #endregion #region Script Functions case "scriptFunctions": if (state.scriptingInterface == null) { break; } s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "function") { continue; } s.SaveCursor(n2); ScriptFunction sc = new ScriptFunction(state, s); s.RestoreCursor(); name_str = sc.ToString(); if (state.scriptingInterface.Functions.Contains(name_str)) { Debug.LogFile.WriteLine("Engine already contains a {0} named '{1}', skipping...", "script function", name_str); continue; } try { ScriptFunctions.Add(name_str, sc); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "script function definition", name_str); } } s.RestoreCursor(); break; #endregion #region Script Globals case "scriptGlobals": if (state.scriptingInterface == null) { break; } s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "global") { continue; } s.SaveCursor(n2); ScriptGlobal sc = new ScriptGlobal(state, s); s.RestoreCursor(); name_str = sc.ToString(); if (state.scriptingInterface.Globals.Contains(name_str)) { Debug.LogFile.WriteLine("Engine already contains a {0} named '{1}', ignoring...", "script global", name_str); continue; } try { ScriptGlobals.Add(name_str, sc); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "script global definition", name_str); } } s.RestoreCursor(); break; #endregion #region Fix-ups case "fixups": s.SaveCursor(n); foreach (XmlNode n2 in s.Cursor.ChildNodes) { if (n2.Name != "fixup") { continue; } s.SaveCursor(n2); Fixup fu = new Fixup(state, s); s.RestoreCursor(); name_str = fu.ToString(); try { Fixups.Add(name_str, fu); } catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "fix-up definition", name_str); } } s.RestoreCursor(); break; #endregion default: ProcessDefinition(n, state, s); break; } } } }
private void ThirdColumnOnItemSelected(TagReference tagReference) { UpdateResults(); }
public ScenarioNetgameEquipmentBlock(BinaryReader binaryReader) { this.flags = (Flags)binaryReader.ReadInt32(); this.gameType1 = (GameType1)binaryReader.ReadInt16(); this.gameType2 = (GameType2)binaryReader.ReadInt16(); this.gameType3 = (GameType3)binaryReader.ReadInt16(); this.gameType4 = (GameType4)binaryReader.ReadInt16(); this.padding = binaryReader.ReadBytes(2); this.spawnTimeInSeconds0Default = binaryReader.ReadInt16(); this.respawnOnEmptyTimeSeconds = binaryReader.ReadInt16(); this.respawnTimerStarts = (RespawnTimerStarts)binaryReader.ReadInt16(); this.classification = (Classification)binaryReader.ReadByte(); this.padding0 = binaryReader.ReadBytes(3); this.padding1 = binaryReader.ReadBytes(40); this.position = binaryReader.ReadVector3(); this.orientation = new ScenarioNetgameEquipmentOrientationStruct(binaryReader); this.itemVehicleCollection = binaryReader.ReadTagReference(); this.padding2 = binaryReader.ReadBytes(48); }
public AiScenarioMissionDialogueBlock(BinaryReader binaryReader) { this.missionDialogue = binaryReader.ReadTagReference(); }
public GlobalUiMultiplayerLevelBlock(BinaryReader binaryReader) { this.mapID = binaryReader.ReadInt32(); this.bitmap = binaryReader.ReadTagReference(); this.skip = binaryReader.ReadBytes(576); this.skip0 = binaryReader.ReadBytes(2304); this.path = binaryReader.ReadString256(); this.sortOrder = binaryReader.ReadInt32(); this.flags = (Flags)binaryReader.ReadByte(); this.padding1 = binaryReader.ReadBytes(3); this.maxTeamsNone = binaryReader.ReadByte(); this.maxTeamsCTF = binaryReader.ReadByte(); this.maxTeamsSlayer = binaryReader.ReadByte(); this.maxTeamsOddball = binaryReader.ReadByte(); this.maxTeamsKOTH = binaryReader.ReadByte(); this.maxTeamsRace = binaryReader.ReadByte(); this.maxTeamsHeadhunter = binaryReader.ReadByte(); this.maxTeamsJuggernaut = binaryReader.ReadByte(); this.maxTeamsTerritories = binaryReader.ReadByte(); this.maxTeamsAssault = binaryReader.ReadByte(); this.maxTeamsStub10 = binaryReader.ReadByte(); this.maxTeamsStub11 = binaryReader.ReadByte(); this.maxTeamsStub12 = binaryReader.ReadByte(); this.maxTeamsStub13 = binaryReader.ReadByte(); this.maxTeamsStub14 = binaryReader.ReadByte(); this.maxTeamsStub15 = binaryReader.ReadByte(); }
public ScenarioStructureBspSphericalHarmonicLightingBlock(BinaryReader binaryReader) { this.bSP = binaryReader.ReadTagReference(); { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioSphericalHarmonicLightingPoint)); this.lightingPoints = new ScenarioSphericalHarmonicLightingPoint[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.lightingPoints[i] = new ScenarioSphericalHarmonicLightingPoint(binaryReader); } } } }
public ScenarioDecalPaletteBlock(BinaryReader binaryReader) { this.reference = binaryReader.ReadTagReference(); }
public HsReferencesBlock(BinaryReader binaryReader) { this.reference = binaryReader.ReadTagReference(); }
public AiConversationLineBlock(BinaryReader binaryReader) { this.flags = (Flags)binaryReader.ReadInt16(); this.participant = binaryReader.ReadShortBlockIndex1(); this.addressee = (Addressee)binaryReader.ReadInt16(); this.addresseeParticipantThisFieldIsOnlyUsedIfTheAddresseeTypeIsParticipant = binaryReader.ReadShortBlockIndex1(); this.padding = binaryReader.ReadBytes(4); this.lineDelayTime = binaryReader.ReadSingle(); this.padding0 = binaryReader.ReadBytes(12); this.variant1 = binaryReader.ReadTagReference(); this.variant2 = binaryReader.ReadTagReference(); this.variant3 = binaryReader.ReadTagReference(); this.variant4 = binaryReader.ReadTagReference(); this.variant5 = binaryReader.ReadTagReference(); this.variant6 = binaryReader.ReadTagReference(); }
public CharacterPaletteBlock(BinaryReader binaryReader) { this.reference = binaryReader.ReadTagReference(); }
public StylePaletteBlock(BinaryReader binaryReader) { this.reference = binaryReader.ReadTagReference(); }
public ScenarioDetailObjectCollectionPaletteBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadTagReference(); this.padding = binaryReader.ReadBytes(32); }
public ActionResult Add(Models.TomeViewModel tome) { string path = Server.MapPath(".."); try { if (!ModelState.IsValid) { TempData["Alert"] = "Fill all required fields."; return(RedirectToAction("Add")); } string currentUserId = User.Identity.GetUserId(); ApplicationUser currentUser = db.Users.FirstOrDefault(x => x.Id == currentUserId); var resultTomes = db.Tomes.Where(x => x.Name == tome.ReferredTome.Name).SingleOrDefault(); if (resultTomes != null) { TempData["Alert"] = "A tome with this name already exists."; return(RedirectToAction("Add")); } tome.ReferredTome.CreationDate = DateTime.Now; tome.ReferredTome.Name = tome.ReferredTome.Name.ToLower(); if (Request.IsAuthenticated) { tome.ReferredTome.ApplicationUser = currentUser; } else { // need to be null for anonymous users tome.ReferredTome.IsPrivate = false; tome.ReferredTome.ApplicationUser = null; } db.Tomes.Add(tome.ReferredTome); db.SaveChanges(); // check if tag is non empty if (tome.SelectedTag != 0) { Tag chosenTag = db.Tags.Find(tome.SelectedTag); TagReference newReference = new TagReference(); newReference.Tag = chosenTag; newReference.Tome = tome.ReferredTome; db.TagReferences.Add(newReference); } // create init history TomeHistory tomeHistory = new TomeHistory { Tome = tome.ReferredTome, FilePath = path + BASE_PATH + TOME_IDENTIFIER + (User.Identity.GetUserName().IsEmpty() ? ("anonymous" + Request.AnonymousID) : User.Identity.GetUserName()) + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".html", ModificationDate = DateTime.Now, ApplicationUser = currentUser }; db.TomeHistories.Add(tomeHistory); db.SaveChanges(); //Write content to file string content = tome.TomeContent.Content.Replace("\"../uploads/", "\"../../uploads/"); System.IO.File.WriteAllText(tomeHistory.FilePath, content); CurrentVersion currentVersion = new CurrentVersion { TomeHistory = tomeHistory, Tome = tome.ReferredTome }; db.CurrentVersions.Add(currentVersion); db.SaveChanges(); return(RedirectToAction("Show", new { id = tome.ReferredTome.TomeId })); } catch (Exception e) { TempData["Alert"] = "An error occured: TomeController Add Post"; Debug.WriteLine("An error occured: " + e); return(RedirectToAction("Index")); } }
public static void Write(this BinaryWriter writer, TagReference tag) { // Write a TagReference object to the stream. writer.Write((byte[])tag.groupTag); writer.Write(tag.datum); }
public ScenarioStructureBspReferenceBlock(BinaryReader binaryReader) { this.padding = binaryReader.ReadBytes(16); this.structureBSP = binaryReader.ReadTagReference(); this.structureLightmap = binaryReader.ReadTagReference(); this.padding0 = binaryReader.ReadBytes(4); this.uNUSEDRadianceEstSearchDistance = binaryReader.ReadSingle(); this.padding1 = binaryReader.ReadBytes(4); this.uNUSEDLuminelsPerWorldUnit = binaryReader.ReadSingle(); this.uNUSEDOutputWhiteReference = binaryReader.ReadSingle(); this.padding2 = binaryReader.ReadBytes(8); this.flags = (Flags)binaryReader.ReadInt16(); this.padding3 = binaryReader.ReadBytes(2); this.defaultSky = binaryReader.ReadShortBlockIndex1(); this.padding4 = binaryReader.ReadBytes(2); }
public ScenarioDecoratorSetPaletteEntryBlock(BinaryReader binaryReader) { this.decoratorSet = binaryReader.ReadTagReference(); }
public ScenarioAiResourceReferenceBlock(BinaryReader binaryReader) { this.reference = binaryReader.ReadTagReference(); }
public GlobalUiCampaignLevelBlock(BinaryReader binaryReader) { this.campaignID = binaryReader.ReadInt32(); this.mapID = binaryReader.ReadInt32(); this.bitmap = binaryReader.ReadTagReference(); this.skip = binaryReader.ReadBytes(576); this.skip0 = binaryReader.ReadBytes(2304); }
public StructureBspBackgroundSoundPaletteBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadString32(); this.backgroundSound = binaryReader.ReadTagReference(); this.insideClusterSoundPlayOnlyWhenPlayerIsInsideCluster = binaryReader.ReadTagReference(); this.padding = binaryReader.ReadBytes(20); this.cutoffDistance = binaryReader.ReadSingle(); this.scaleFlags = (ScaleFlags)binaryReader.ReadInt32(); this.interiorScale = binaryReader.ReadSingle(); this.portalScale = binaryReader.ReadSingle(); this.exteriorScale = binaryReader.ReadSingle(); this.interpolationSpeed1Sec = binaryReader.ReadSingle(); this.padding0 = binaryReader.ReadBytes(8); }
public ScenarioLevelDataBlock(BinaryReader binaryReader) { this.levelDescription = binaryReader.ReadTagReference(); { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(GlobalUiCampaignLevelBlock)); this.campaignLevelData = new GlobalUiCampaignLevelBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.campaignLevelData[i] = new GlobalUiCampaignLevelBlock(binaryReader); } } } { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(GlobalUiMultiplayerLevelBlock)); this.multiplayer = new GlobalUiMultiplayerLevelBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.multiplayer[i] = new GlobalUiMultiplayerLevelBlock(binaryReader); } } } }
public StructureBspSoundEnvironmentPaletteBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadString32(); this.soundEnvironment = binaryReader.ReadTagReference(); this.cutoffDistance = binaryReader.ReadSingle(); this.interpolationSpeed1Sec = binaryReader.ReadSingle(); this.padding = binaryReader.ReadBytes(24); }
public ScenarioScreenEffectReferenceBlock(BinaryReader binaryReader) { this.padding = binaryReader.ReadBytes(16); this.screenEffect = binaryReader.ReadTagReference(); this.primaryInputInterpolator = binaryReader.ReadStringID(); this.secondaryInputInterpolator = binaryReader.ReadStringID(); this.skip0 = binaryReader.ReadBytes(2); this.skip1 = binaryReader.ReadBytes(2); }
public StructureBspWeatherPaletteBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadString32(); this.weatherSystem = binaryReader.ReadTagReference(); this.padding = binaryReader.ReadBytes(2); this.padding0 = binaryReader.ReadBytes(2); this.padding1 = binaryReader.ReadBytes(32); this.wind = binaryReader.ReadTagReference(); this.windDirection = binaryReader.ReadVector3(); this.windMagnitude = binaryReader.ReadSingle(); this.padding2 = binaryReader.ReadBytes(4); this.windScaleFunction = binaryReader.ReadString32(); }
public ScenarioProfilesBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadString32(); this.startingHealthDamage01 = binaryReader.ReadSingle(); this.startingShieldDamage01 = binaryReader.ReadSingle(); this.primaryWeapon = binaryReader.ReadTagReference(); this.roundsLoaded = binaryReader.ReadInt16(); this.roundsTotal = binaryReader.ReadInt16(); this.secondaryWeapon = binaryReader.ReadTagReference(); this.roundsLoaded0 = binaryReader.ReadInt16(); this.roundsTotal0 = binaryReader.ReadInt16(); this.startingFragmentationGrenadeCount = binaryReader.ReadByte(); this.startingPlasmaGrenadeCount = binaryReader.ReadByte(); this.startingUnknownGrenadeCount = binaryReader.ReadByte(); this.startingUnknownGrenadeCount0 = binaryReader.ReadByte(); }
public ScenarioClusterDataBlock(BinaryReader binaryReader) { this.bSP = binaryReader.ReadTagReference(); { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioClusterBackgroundSoundsBlock)); this.backgroundSounds = new ScenarioClusterBackgroundSoundsBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.backgroundSounds[i] = new ScenarioClusterBackgroundSoundsBlock(binaryReader); } } } { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioClusterSoundEnvironmentsBlock)); this.soundEnvironments = new ScenarioClusterSoundEnvironmentsBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.soundEnvironments[i] = new ScenarioClusterSoundEnvironmentsBlock(binaryReader); } } } this.bSPChecksum = binaryReader.ReadInt32(); { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioClusterPointsBlock)); this.clusterCentroids = new ScenarioClusterPointsBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.clusterCentroids[i] = new ScenarioClusterPointsBlock(binaryReader); } } } { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioClusterWeatherPropertiesBlock)); this.weatherProperties = new ScenarioClusterWeatherPropertiesBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.weatherProperties[i] = new ScenarioClusterWeatherPropertiesBlock(binaryReader); } } } { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioClusterAtmosphericFogPropertiesBlock)); this.atmosphericFogProperties = new ScenarioClusterAtmosphericFogPropertiesBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.atmosphericFogProperties[i] = new ScenarioClusterAtmosphericFogPropertiesBlock(binaryReader); } } } }
public ScenarioAtmosphericFogPalette(BinaryReader binaryReader) { this.name = binaryReader.ReadStringID(); this.color = binaryReader.ReadColorR8G8B8(); this.spreadDistanceWorldUnitsHowFarFogSpreadsIntoAdjacentClusters0DefaultsTo1 = binaryReader.ReadSingle(); this.padding = binaryReader.ReadBytes(4); this.maximumDensity01FogDensityClampsToThisValue = binaryReader.ReadSingle(); this.startDistanceWorldUnitsBeforeThisDistanceThereIsNoFog = binaryReader.ReadSingle(); this.opaqueDistanceWorldUnitsFogBecomesOpaqueMaximumDensityAtThisDistanceFromViewer = binaryReader.ReadSingle(); this.color0 = binaryReader.ReadColorR8G8B8(); this.padding0 = binaryReader.ReadBytes(4); this.maximumDensity01FogDensityClampsToThisValue0 = binaryReader.ReadSingle(); this.startDistanceWorldUnitsBeforeThisDistanceThereIsNoFog0 = binaryReader.ReadSingle(); this.opaqueDistanceWorldUnitsFogBecomesOpaqueMaximumDensityAtThisDistanceFromViewer0 = binaryReader.ReadSingle(); this.padding1 = binaryReader.ReadBytes(4); this.planarColor = binaryReader.ReadColorR8G8B8(); this.planarMaxDensity01 = binaryReader.ReadSingle(); this.planarOverrideAmount01 = binaryReader.ReadSingle(); this.planarMinDistanceBiasWorldUnitsDontAsk = binaryReader.ReadSingle(); this.padding2 = binaryReader.ReadBytes(44); this.patchyColor = binaryReader.ReadColorR8G8B8(); this.padding3 = binaryReader.ReadBytes(12); this.patchyDensity01 = binaryReader.ReadSingle(); this.patchyDistanceWorldUnits = binaryReader.ReadRange(); this.padding4 = binaryReader.ReadBytes(32); this.patchyFog = binaryReader.ReadTagReference(); { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(ScenarioAtmosphericFogMixerBlock)); this.mixers = new ScenarioAtmosphericFogMixerBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.mixers[i] = new ScenarioAtmosphericFogMixerBlock(binaryReader); } } } this.amount01 = binaryReader.ReadSingle(); this.threshold01 = binaryReader.ReadSingle(); this.brightness01 = binaryReader.ReadSingle(); this.gammaPower = binaryReader.ReadSingle(); this.cameraImmersionFlags = (CameraImmersionFlags)binaryReader.ReadInt16(); this.padding5 = binaryReader.ReadBytes(2); }
public ScenarioPlanarFogPalette(BinaryReader binaryReader) { this.name = binaryReader.ReadStringID(); this.planarFog = binaryReader.ReadTagReference(); this.padding = binaryReader.ReadBytes(2); this.padding0 = binaryReader.ReadBytes(2); }
protected void TagReferencesToMemoryStream() { var tr = new TagReference(); foreach (Import.TagReference tagr in OwnerState.Importer.References.Values) { tr.Reset(tagr); tr.Write(MemoryStream); } }
public FlockDefinitionBlock(BinaryReader binaryReader) { this.bsp = binaryReader.ReadShortBlockIndex1(); this.padding = binaryReader.ReadBytes(2); this.boundingVolume = binaryReader.ReadShortBlockIndex1(); this.flags = (Flags)binaryReader.ReadInt16(); this.ecologyMarginWusDistanceFromEcologyBoundaryThatCreatureBeginsToBeRepulsed = binaryReader.ReadSingle(); { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(FlockSourceBlock)); this.sources = new FlockSourceBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.sources[i] = new FlockSourceBlock(binaryReader); } } } { var count = binaryReader.ReadInt32(); var address = binaryReader.ReadInt32(); var elementSize = Marshal.SizeOf(typeof(FlockSinkBlock)); this.sinks = new FlockSinkBlock[count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < count; ++i) { binaryReader.BaseStream.Position = address + i * elementSize; this.sinks[i] = new FlockSinkBlock(binaryReader); } } } this.productionFrequencyBoidsSecHowFrequentlyBoidsAreProducedAtOneOfTheSourcesLimitedByTheMaxBoidCount = binaryReader.ReadSingle(); this.scale = binaryReader.ReadRange(); this.creature = binaryReader.ReadTagReference(); this.boidCount = binaryReader.ReadInt32(); this.neighborhoodRadiusWorldUnitsDistanceWithinWhichOneBoidIsAffectedByAnother = binaryReader.ReadSingle(); this.avoidanceRadiusWorldUnitsDistanceThatABoidTriesToMaintainFromAnother = binaryReader.ReadSingle(); this.forwardScale01WeightGivenToBoidsDesireToFlyStraightAhead = binaryReader.ReadSingle(); this.alignmentScale01WeightGivenToBoidsDesireToAlignItselfWithNeighboringBoids = binaryReader.ReadSingle(); this.avoidanceScale01WeightGivenToBoidsDesireToAvoidCollisionsWithOtherBoidsWhenWithinTheAvoidanceRadius = binaryReader.ReadSingle(); this.levelingForceScale01WeightGivenToBoidsDesireToFlyLevel = binaryReader.ReadSingle(); this.sinkScale01WeightGivenToBoidsDesireToFlyTowardsItsSinks = binaryReader.ReadSingle(); this.perceptionAngleDegreesAngleFromForwardWithinWhichOneBoidCanPerceiveAndReactToAnother = binaryReader.ReadSingle(); this.averageThrottle01ThrottleAtWhichBoidsWillNaturallyFly = binaryReader.ReadSingle(); this.maximumThrottle01MaximumThrottleApplicable = binaryReader.ReadSingle(); this.positionScale01WeightGivenToBoidsDesireToBeNearFlockCenter = binaryReader.ReadSingle(); this.positionMinRadiusWusDistanceToFlockCenterBeyondWhichAnAttractingForceIsApplied = binaryReader.ReadSingle(); this.positionMaxRadiusWusDistanceToFlockCenterAtWhichTheMaximumAttractingForceIsApplied = binaryReader.ReadSingle(); this.movementWeightThresholdTheThresholdOfAccumulatedWeightOverWhichMovementOccurs = binaryReader.ReadSingle(); this.dangerRadiusWusDistanceWithinWhichBoidsWillAvoidADangerousObjectEGThePlayer = binaryReader.ReadSingle(); this.dangerScaleWeightGivenToBoidsDesireToAvoidDanger = binaryReader.ReadSingle(); this.randomOffsetScale01WeightGivenToBoidsRandomHeadingOffset = binaryReader.ReadSingle(); this.randomOffsetPeriodSeconds = binaryReader.ReadRange(); this.flockName = binaryReader.ReadStringID(); }
public ActionResult Edit(TomeViewModel editedTome) { string path = Server.MapPath("../.."); try { string currentUserId = User.Identity.GetUserId(); ApplicationUser currentUser = db.Users.FirstOrDefault(x => x.Id == currentUserId); Models.Tome tome = db.Tomes.Find(editedTome.ReferredTome.TomeId); tome.CreationDate = DateTime.Now; tome.IsPrivate = editedTome.ReferredTome.IsPrivate; TomeHistory tomeHistory = new TomeHistory { Tome = tome, FilePath = path + BASE_PATH + TOME_IDENTIFIER + (User.Identity.GetUserName().IsEmpty() ? ("anonymous" + Request.AnonymousID) : User.Identity.GetUserName()) + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".html", ModificationDate = DateTime.Now, ApplicationUser = currentUser }; if (!Request.IsAuthenticated && tome.IsPrivate) { return(RedirectToAction("NotFound", "Error")); } Models.TomeViewModel editTomeViewModel = new TomeViewModel(); var selectedTag = (from tag in db.TagReferences where tag.TomeId == tome.TomeId select tag).SingleOrDefault(); var SelectListItems = db.Tags.Select(x => new SelectListItem { Value = x.TagId.ToString(), Text = x.TagTitle }); var TagList = new List <SelectListItem>(SelectListItems); editTomeViewModel.TagList = TagList; if (selectedTag != null) { selectedTag.TagId = editedTome.SelectedTag; db.SaveChanges(); } else { TagReference newTagRef = new TagReference(); newTagRef.TomeId = editedTome.ReferredTome.TomeId; newTagRef.TagId = editedTome.SelectedTag; db.TagReferences.Add(newTagRef); } // insert into db db.TomeHistories.Add(tomeHistory); db.SaveChanges(); // create file and fill with content string content = editedTome.TomeContent.Content.Replace("\"../uploads/", "\"../../uploads/");; System.IO.File.WriteAllText(tomeHistory.FilePath, content); // update curent version var currentVersion = db.CurrentVersions.SingleOrDefault(m => m.Tome.TomeId == editedTome.ReferredTome.TomeId); currentVersion.TomeHistory = tomeHistory; db.SaveChanges(); } catch (Exception e) { TempData["Alert"] = "An error occured: TomeController Edit Post"; Console.WriteLine(e); throw; } return(RedirectToAction("Index")); }
public ScenarioCreaturePaletteBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadTagReference(); this.padding = binaryReader.ReadBytes(32); }
public AiAnimationReferenceBlock(BinaryReader binaryReader) { this.animationName = binaryReader.ReadString32(); this.animationGraphLeaveThisBlankToUseTheUnitsNormalAnimationGraph = binaryReader.ReadTagReference(); this.padding = binaryReader.ReadBytes(12); }
public ScenarioStartingEquipmentBlock(BinaryReader binaryReader) { this.flags = (Flags)binaryReader.ReadInt32(); this.gameType1 = (GameType1)binaryReader.ReadInt16(); this.gameType2 = (GameType2)binaryReader.ReadInt16(); this.gameType3 = (GameType3)binaryReader.ReadInt16(); this.gameType4 = (GameType4)binaryReader.ReadInt16(); this.padding = binaryReader.ReadBytes(48); this.itemCollection1 = binaryReader.ReadTagReference(); this.itemCollection2 = binaryReader.ReadTagReference(); this.itemCollection3 = binaryReader.ReadTagReference(); this.itemCollection4 = binaryReader.ReadTagReference(); this.itemCollection5 = binaryReader.ReadTagReference(); this.itemCollection6 = binaryReader.ReadTagReference(); this.padding0 = binaryReader.ReadBytes(48); }