private void MakeUniverses(string baseName, int universe, int startCh, int pixelCt, byte pixelOrder, bool reverseOrder) { channel newch; rgbChannel newRGBch; channelGroupList newGroup; channelGroupItem newGroupItem; savedIndex newSI; int curPixel = 1; int curUniverse = universe; int curCh = startCh; int track = Convert.ToInt16(txtTrack.Text) - 1; int nextSI = seq.highestSavedIndex + 1; int nextGI = seq.groupItemCount; // Add new channels - Pixel Count * 3 (1 each for red, green, blue) Array.Resize(ref seq.channels, seq.channelCount + pixelCt * 3 + 2); // Add new RGB Channel groups, Pixel Count Array.Resize(ref seq.rgbChannels, seq.rgbChannelCount + pixelCt + 2); Array.Resize(ref seq.trackItems, seq.trackItemCount + pixelCt + 2); Array.Resize(ref seq.savedIndexes, nextSI + pixelCt * 4 + 2); Array.Resize(ref seq.channelGroups, seq.groupCount + 3); Array.Resize(ref seq.channelGroupItems, seq.groupItemCount + pixelCt + 2); // ** Universe Group ** newGroup = new channelGroupList(); int ch2 = startCh + pixelCt * 3 - 2; // Temp, used only in the name // Name Format: BaseName001 (U001.001-003) newGroup.name = baseName + " Pixels001-" + pixelCt.ToString("000") + " (U" + curUniverse.ToString("00") + "." + startCh.ToString("000") + "-" + ch2.ToString("000") + ")"; newGroup.savedIndex = nextSI + pixelCt * 4; // *!* Double-Check correct saved index for group! for (int pixelNo = 1; pixelNo <= pixelCt; pixelNo++) { curPixel = pixelNo; if (pixelCt > 170) { if ((pixelNo > 150) && (pixelNo < 301)) { curPixel -= 150; curUniverse = universe + 1; curCh = curPixel * 3 - 2; } if ((pixelNo > 300) && (pixelNo < 450)) { curPixel -= 300; curUniverse = universe + 2; curCh = curPixel * 3 - 2; } if ((pixelNo > 450) && (pixelNo < 600)) { curPixel -= 450; curUniverse = universe + 3; curCh = curPixel * 3 - 2; } } // ** RGB Channel Group ** newRGBch = new rgbChannel(); ch2 = curCh + 2; // Temp, used only in the name // Name Format: BaseName001 (U001.001-003) newRGBch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + "-" + ch2.ToString("000") + ")"; // ** RED Channel ** // Create new channel for Red newch = new channel(); newch.deviceType = deviceType.DMX; newch.network = curUniverse; // Name Format: BaseName001 (U001.001) (R) newch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + ") (R)"; newch.circuit = curCh; newch.color = 255; // Red newch.savedIndex = nextSI; newRGBch.redSavedIndex = newch.savedIndex; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.channel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add new channel to array, and incr count seq.channels[seq.channelCount] = newch; seq.channelCount++; // Incr the DMX channel # startCh++; curCh++; // ** GREEN Channel ** // Create new channel for Green newch = new channel(); newch.deviceType = deviceType.DMX; newch.network = curUniverse; // Name Format: BaseName001 (U001.002) (G) newch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + ") (G)"; newch.circuit = curCh; newch.color = 65280; // Green newch.savedIndex = nextSI; newRGBch.grnSavedIndex = newch.savedIndex; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.channel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add new channel to array, and incr count seq.channels[seq.channelCount] = newch; seq.channelCount++; seq.highestSavedIndex++; // Incr the DMX channel # startCh++; curCh++; // ** BLUE Channel ** // Create new channel for Blue newch = new channel(); newch.deviceType = deviceType.DMX; newch.network = curUniverse; newch.name = baseName + " Pixel" + pixelNo.ToString("000") + " (U" + curUniverse.ToString("00") + "." + curCh.ToString("000") + ") (B)"; newch.circuit = curCh; newch.color = 16711680; // Blue newch.savedIndex = nextSI; newRGBch.bluSavedIndex = newch.savedIndex; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.channel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add new channel to array, and incr count seq.channels[seq.channelCount] = newch; seq.channelCount++; seq.highestSavedIndex++; // Incr the DMX channel # startCh++; curCh++; // ** RGB Channel Group ** // Add new RGB channel to array, and incr count newRGBch.savedIndex = nextSI; seq.rgbChannels[seq.rgbChannelCount] = newRGBch; seq.rgbChannelCount++; // update Saved Indexes newSI = new savedIndex(); newSI.objType = tableType.rgbChannel; newSI.objIndex = nextSI; seq.savedIndexes[nextSI] = newSI; nextSI++; // Add the RGB Channel Group to the Universe Group seq.channelGroupItems[seq.groupItemCount] = new channelGroupItem(); seq.channelGroupItems[seq.groupItemCount].channelGroupSavedIndex = newRGBch.savedIndex; seq.channelGroupItems[seq.groupItemCount].channelGroupListIndex = seq.groupCount; seq.groupItemCount++; } seq.channelGroups[seq.groupCount] = newGroup; seq.groupCount++; seq.trackItems[seq.trackItemCount] = new trackItem(); seq.trackItems[seq.trackItemCount].savedIndex = newGroup.savedIndex; seq.trackItems[seq.trackItemCount].trackIndex = track; seq.trackItemCount++; seq.tracks[track].trackItemCount++; seq.highestSavedIndex = nextSI; }
public int AddSavedIndex(savedIndex si, int position);