Ejemplo n.º 1
0
    private void Awake()
    {
        m_dialogTextCtr = DialogText.GetComponent <LocalizedText>();
        if (m_dialogTextCtr == null)
        {
            Debug.LogError("m_dialogTextCtr is null!");
            return;
        }

        m_nameTextCtr = NameText.GetComponent <LocalizedText>();
        if (m_nameTextCtr == null)
        {
            Debug.LogError("m_nameTextCtr is null!");
            return;
        }

        if (IconCollection == null)
        {
            Debug.LogError("IconCollection is null!");
            return;
        }

        // сохраняем информацию о иконках в Dictionary для организации быстрого доступа
        for (int i = 0; i < IconCollection.Length; i++)
        {
            IcoContainer container = IconCollection[i];
            m_icoDictionary[container.Type] = container.Ico;
        }

        // прячем диалог по дефолту
        HideDialog();
    }
Ejemplo n.º 2
0
        // adds main icon to screensaver
        private static void InjectIcon(IUpdateIconArgs args)
        {
            byte[] icon;
            try
            {
                // read icon data
                icon = File.ReadAllBytes(args.IconPath);
            }
            catch (Exception ex)
            {
                var message = string.Format(Localization.InjectIconFileRead,
                                            args.IconPath, ex.Message);
                throw new IOException(message, ex);
            }

            IcoContainer ico;

            try
            {
                // parse ico from data
                ico = new IcoContainer(icon);
            }
            catch (Exception ex)
            {
                var message = string.Format(Localization.InjectIconParseICO,
                                            args.IconPath, ex.Message);
                throw new IOException(message, ex);
            }

            try
            {
                // convert ico representation to pe
                var pe = ico.ToPe();

                // update pe icon
                pe.ToFile(args.OutputPath, Constants.MainGroupIconName);
            }
            catch (Exception ex)
            {
                var message = string.Format(Localization.InjectIconPEToFile,
                                            args.OutputPath, ex.Message);
                throw new IOException(message, ex);
            }
        }