protected void SetLanguage(string strTag, bool nValue) { var tagArray = DataArrayUtl.FindTagArray(mData, "languages"); if (DataArrayUtl.FindTagInt(tagArray, strTag) != 0 == nValue) { return; } DataArrayUtl.SetTagInt(tagArray, strTag, nValue ? 1 : 0); OnChangeToUnsavedData(); }
protected void SetGamedataInt(string strTag, int nValue) { var tagArray = DataArrayUtl.FindTagArray(mData, "gamedata"); if (DataArrayUtl.FindTagInt(tagArray, strTag) == nValue) { return; } DataArrayUtl.SetTagInt(tagArray, strTag, nValue); OnChangeToUnsavedData(); }
public void SetTrack(TrackInfo track) { var tagArray = DataArrayUtl.FindTagArray(DataArrayUtl.FindTagArray(mData, "tracks"), track.TrackType); DataArrayUtl.ReleaseContents(tagArray); DataArrayUtl.InsertTagIntAtEnd(tagArray, "enabled", track.Enabled ? 1 : 0); DataArrayUtl.InsertTagIntAtEnd(tagArray, "channels", track.NumChannels); if (track.TrackType == "vocals") { DataArrayUtl.SetTagInt(DataArrayUtl.FindTagArray(DataArrayUtl.FindTagArray(mData, "dry_vox"), "part0"), "enabled", track.Enabled ? 1 : 0); } switch (track.NumChannels) { case 0: DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", 0.0f); DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", 0.0f); break; case 1: DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", track.PanLeft); DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", track.VolLeft); break; case 2: DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", track.PanLeft); DataArrayUtl.AddTagFloatAtEnd(tagArray, "pan", track.PanRight); DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", track.VolLeft); DataArrayUtl.AddTagFloatAtEnd(tagArray, "vol", track.VolRight); break; default: throw new MagmaException("Invalid NumChannels: " + track.NumChannels); } DataArrayUtl.InsertTagStrAtEnd(tagArray, "file", track.Filename); mTrackCache[track.TrackType] = track; OnChangeToUnsavedData(); }