Exemplo n.º 1
0
        private static GraphicPack Process(ZipArchiveEntry entry)
        {
            try
            {
                var entries = entry.Archive?.Entries;
                var files   = entries?.Where(x => Match(x, entry) && !x.FullName.Contains("Cheats")).ToList();

                var rules   = files?.Find(x => x.Name.ToLower() == "rules.txt")?.GetString();
                var sources = files?.Where(x => !x.Name.ToLower().Contains("rules.txt")).ToList();

                if (string.IsNullOrEmpty(rules))
                {
                    return(null);
                }

                var iniFile       = new IniManager(rules);
                var titleIdsValue = iniFile.GetValue("Definition", "titleIds", null);
                var nameValue     = iniFile.GetValue("Definition", "name", null);

                if (titleIdsValue == null || nameValue == null)
                {
                    return(null);
                }

                var value = titleIdsValue.ToUpper();
                if (string.IsNullOrEmpty(value))
                {
                    return(null);
                }

                var titleIds = value.Split(',');
                var name     = nameValue.Replace("\"", "").Trim();

                var pack = new GraphicPack {
                    Name = name, Rules = rules
                };
                pack.TitleIds.AddRange(titleIds);
                foreach (var source in sources)
                {
                    var graphicPackSource = new GraphicPack.GraphicPackSource
                    {
                        FileName = source.Name,
                        Data     = source.GetString()
                    };
                    pack.Sources.Add(graphicPackSource);
                }

                return(pack);
            }
            catch (Exception e)
            {
                TextLog.MesgLog.WriteLog($"{e.Message}\n{e.StackTrace}");
                return(null);
            }
        }
Exemplo n.º 2
0
        private void KeyCaptureConfig_Load(object sender, EventArgs e)
        {
            // must be in the load event to avoid the location being incorrect
            IniManager.RestoreState(this, m_zIniManager.GetValue(Name));

            // setup the various mouse output options
            comboBoxMouseOut.Items.Add("No Action");
            foreach (IODefinition.MouseButton sName in Enum.GetValues(typeof(IODefinition.MouseButton)))
            {
                comboBoxMouseOut.Items.Add(sName);
            }
            comboBoxMouseOut.SelectedIndex = 0;

            // set the notification icon accordingly
            notifyIcon.Icon = Resources.KeyCapIdle;
            Icon            = notifyIcon.Icon;

            // populate the previously loaded configurations
            var arrayFiles = m_zIniManager.GetValue(IniSettings.PreviousFiles).Split(new char[] { KeyCapConstants.CharFileSplit }, StringSplitOptions.RemoveEmptyEntries);

            if (0 < arrayFiles.Length)
            {
                foreach (var sFile in arrayFiles)
                {
                    m_listRecentFiles.Add(sFile);
                }
            }

            // initialize capture from command line specified file
            if (0 != m_sLoadedFile.Length)
            {
                btnStart_Click(sender, new EventArgs());
                new Thread(MinimizeThread)
                {
                    Name = "MinimizeThread"
                }.Start();
            }
        }