Example #1
0
        public static bool GetStringW(HKey key, string value, out string result)
        {
            uint   cbData = 0;
            IntPtr resultData;
            bool   ret = false;

            if (QueryValueLengthW(key, value, ref cbData))
            {
                resultData = MemoryPool.Allocate((int)((2 * (cbData + 1)) | -((long)(cbData + 1) >> 31)));
                if (QueryValueStringW(key, value, resultData, cbData + 1))
                {
                    result = Marshal.PtrToStringUni(resultData);
                    ret    = true;
                }
                else
                {
                    result = null;
                }
            }
            else
            {
                result = null;
            }
            return(ret);
        }
Example #2
0
 /// <summary>
 /// 导出注册表信息中间过程。
 /// </summary>
 /// <param name="writer">
 /// XML写入控制器。
 /// </param>
 /// <param name="name">
 /// XML标记名。
 /// </param>
 protected void MidExport(XmlTextWriter writer, string name)
 {
     writer.WriteStartElement(name, Guid.ToString());
     writer.WriteAttributeString("hkey", AESCrypt.Encrypt(HKey.ToString()));
     writer.WriteAttributeString("lpsubkey", AESCrypt.Encrypt(LpSubKey));
     writer.WriteAttributeString("lpvaluename", AESCrypt.Encrypt(LpValueName));
 }
Example #3
0
        private List <ZObject> CreateInstrument(HKey directoryPath, string instrumentType, string difficulty, InstrumentTuning tuning)
        {
            // Sets directory name
            if (instrumentType == "guitar" || instrumentType == "bass")
            {
                directoryPath += (instrumentType == "guitar" ? ".gtr_" : ".bss_") + difficulty;
            }
            else
            {
                directoryPath += "." + instrumentType;
            }

            // Creates instrument
            Instrument instrument = new Instrument(directoryPath + ".instrument", directoryPath);

            instrument.InstrumentType = instrumentType == "vox" ? "vocals" : instrumentType;

            // Sets difficulty + tuning
            if (instrumentType == "vox" || instrumentType == "master")
            {
                instrument.Difficulty = "";
                instrument.Tuning     = InstrumentTuning.Guitar_EStandard;
            }
            else
            {
                instrument.Difficulty = difficulty;
                instrument.Tuning     = tuning;
            }

            // Creates tracks for instrument
            List <ZObject> objects;

            switch (instrumentType.ToLower())
            {
            case "bass":
            case "guitar":
                objects = GetGuitarObjects(directoryPath);
                break;

            case "master":
                // event, measure, section, tempo, timesignature
                objects = GetMasterObjects(directoryPath);
                break;

            case "vox":
                // vox, voxpushphrase, voxspread
                objects = GetVoxObjects(directoryPath);
                break;

            default:
                // Shouldn't really return anything
                return(new List <ZObject>());
            }

            objects.ForEach(x => instrument.TrackPaths.Add(x.FilePath));
            objects.Add(instrument);
            return(objects);
        }
Example #4
0
        public static bool GetDWord(HKey key, string value, out int result)
        {
            uint cbData = 4;

            AdvApi32.RegistryValueType type = AdvApi32.RegistryValueType.DWord;
            IntPtr resultValue = MemoryPool.Allocate(4);
            bool   ret         = false;

            if (AdvApi32.RegQueryValueExW(key, value, 0, ref type, resultValue, ref cbData) == 0)
            {
                result = Marshal.PtrToStructure <int>(resultValue);
                ret    = true;
            }
            else
            {
                result = 0;
            }
            MemoryPool.Free(resultValue);
            return(ret);
        }
Example #5
0
        public List <ZObject> ExportZObjects(HKey directory, InstrumentTuning leadGtr, InstrumentTuning rhythmGtr, InstrumentTuning bass)
        {
            List <ZObject> objects = new List <ZObject>();

            objects.AddRange(CreateInstrument(directory, "master", "", InstrumentTuning.Guitar_EStandard));
            objects.AddRange(CreateInstrument(directory, "vox", "", InstrumentTuning.Guitar_EStandard));

            // Guitar tracks
            objects.AddRange(CreateInstrument(directory, "guitar", "jam", rhythmGtr));
            objects.AddRange(CreateInstrument(directory, "guitar", "nov", rhythmGtr));
            objects.AddRange(CreateInstrument(directory, "guitar", "beg", rhythmGtr));
            objects.AddRange(CreateInstrument(directory, "guitar", "int", rhythmGtr));
            objects.AddRange(CreateInstrument(directory, "guitar", "rhy", rhythmGtr));
            objects.AddRange(CreateInstrument(directory, "guitar", "adv", leadGtr));

            // Bass tracks
            objects.AddRange(CreateInstrument(directory, "bass", "jam", bass));
            objects.AddRange(CreateInstrument(directory, "bass", "nov", bass));
            objects.AddRange(CreateInstrument(directory, "bass", "beg", bass));
            objects.AddRange(CreateInstrument(directory, "bass", "int", bass));
            objects.AddRange(CreateInstrument(directory, "bass", "adv", bass));

            return(objects);
        }
Example #6
0
 public bool KeyPressed(HKey key)
 {
     return Keyboard.IsKeyPressed((Key)key);
 }
Example #7
0
        private List <ZObject> CreateSongObjects(FusedSong input)
        {
            List <ZObject> objects       = new List <ZObject>();
            HKey           songDirectory = "songs." + input.Identifier;

            // Create song object
            Song song = new Song(songDirectory + ".song", songDirectory)
            {
                Title       = input.Title,
                Artist      = input.Artist,
                Description = input.Description,
                Album       = input.Album,

                LegendTag = "Tags.Legends.NoLegend.Tag",
                EraTag    = "Tags.Eras.Timeless.Tag",
                Year      = input.Year,

                GuitarIntensity = input.GuitarIntensity,
                BassIntensity   = input.BassIntensity,
                VoxIntensity    = input.BassIntensity,

                SongLength = input.SongLength
            };

            // Imports note tracks
            // TODO: Check if RB import vs custom spec
            MIDIImport mid    = new MIDIImport(GetFilePath(input.TabPath));
            var        tracks = mid.ExportZObjects(songDirectory, input.LeadGuitarTuning, input.RhythmGuitarTuning, input.BassTuning);

            // Adds instrument file paths
            foreach (ZObject instrument in tracks.Where(x => x is Instrument))
            {
                song.InstrumentPaths.Add(instrument.FilePath);
            }

            objects.AddRange(tracks);

            // Adds audio paths
            song.PreviewPath           = songDirectory + ".preview.audio";
            song.BackingAudioPath      = songDirectory + ".gamestems.back.audio";
            song.BassAudioPath         = songDirectory + ".gamestems.bass.audio";
            song.DrumsAudioPath        = songDirectory + ".gamestems.drums.audio";
            song.LeadGuitarAudioPath   = songDirectory + ".gamestems.gtr1.audio";
            song.RhythmGuitarAudioPath = songDirectory + ".gamestems.gtr2.audio";
            song.VoxAudioPath          = songDirectory + ".gamestems.vox.audio";

            // Adds video path
            song.VideoPath = songDirectory + ".musicvideo.video";

            // Create texture path
            // TODO: Add texture conversion
            //song.TexturePath = songDirectory + ".texture";
            song.TexturePath = "textures.albumart.bandfuse.originalcontent.texture";

            // Adds tags
            song.Labels.Add("BFForever");
            song.GenreTags.Add("Tags.Genres.rock.Tag"); // TODO: Read from json input
            song.MetadataTags = CreateMetadataTags(song);

            objects.Add(song);
            return(objects);
        }
Example #8
0
 public static IntPtr GetRootKey(HKey key)
 {
     return(new IntPtr((int)key));
 }
Example #9
0
 public static bool OpenKey(HKey key, string subKey, out HKey result)
 {
     return(AdvApi32.RegOpenKeyExW(key, subKey, 0, AdvApi32.RegistryKeyAccess.Read, out result) == 0);
 }
Example #10
0
 private static bool QueryValueStringW(HKey hKey, string lpValueName, IntPtr lpData, uint cbData)
 {
     AdvApi32.RegistryValueType type = AdvApi32.RegistryValueType.Sz;
     return(AdvApi32.RegQueryValueExW(hKey, lpValueName, 0, ref type, lpData, ref cbData) == 0);
 }
Example #11
0
 private static bool QueryValueLengthW(HKey hKey, string lpValueName, ref uint lpcbData)
 {
     AdvApi32.RegistryValueType type = AdvApi32.RegistryValueType.Binary;
     return(AdvApi32.RegQueryValueExW(hKey, lpValueName, 0, ref type, IntPtr.Zero, ref lpcbData) == 0);
 }
Example #12
0
 protected abstract List <ZObject> GetGuitarObjects(HKey directoryPath);
Example #13
0
 protected abstract List <ZObject> GetVoxObjects(HKey directoryPath);
Example #14
0
 protected abstract List <ZObject> GetMasterObjects(HKey directoryPath);
Example #15
0
 public static IntPtr GetRootKey(HKey key)
 {
     return new IntPtr((int)key);
 }