private List<ControlObject> LoadControls() { List<ControlObject> controlList = new List<ControlObject>(); string lastChunkType = "NULL"; foreach (Chunk chunk in Chunks) { if (chunk.ChunkType != lastChunkType) { ControlObject obj = new ControlObject(); obj.Load(chunk); controlList.Add(obj); lastChunkType = chunk.ChunkType; } } return controlList; }
public void AddChunk(string chunkType) { var query = GroupChunksByFourCc(); foreach (var group in query) { if (group.Key == chunkType) { MessageBox.Show("The chunk type you selected already exists.", "Chunk Type Already Exists"); return; } } Chunk newChunk = new Chunk(); string searchString = chunkType.Remove(chunkType.Length - 1); newChunk.MakeEmptyChunkFromTemplate(ChunkTemplates.Find(x => x.ChunkID.Contains(searchString))); newChunk.ChunkType = chunkType; Chunks.Add(newChunk); ControlObject newControl = new ControlObject(); newControl.Load(newChunk); Controls.Add(newControl); UpdateTreeView(); }