예제 #1
0
        private void lvIcons_Dropped(object sender, OlvDropEventArgs e)
        {
            DataObject d = (DataObject)e.DataObject;

            if (d.GetDataPresent(DataFormats.FileDrop, false) == true)
            {
                try
                {
                    string[]          data  = (string[])d.GetData(DataFormats.FileDrop);
                    List <IconObject> icons = new List <IconObject>();
                    foreach (string file in data)
                    {
                        if (Path.GetFileName(file).Contains(".ico"))
                        {
                            string     name      = Path.GetFileName(file).Replace(Path.GetExtension(file), "");
                            string     extension = Path.GetExtension(file);
                            string     path      = file;
                            long       length    = new FileInfo(file).Length;
                            string     size      = length.ToFileSize();
                            string     status    = "Idle";
                            IconObject io        = new IconObject(name, extension, path, size, length.ToString(), status);
                            icons.Add(io);
                        }
                    }

                    if (icons.Count > 0)
                    {
                        lvIcons.AddObjects(icons);
                    }

                    if (lvIcons.Items.Count == 0)
                    {
                        lvIcons.View      = View.SmallIcon;
                        btnInject.Enabled = false;
                    }
                    else
                    {
                        lvIcons.View = View.Details;
                        if (txtAssemblyPath.Text == "")
                        {
                            btnInject.Enabled = false;
                        }
                        else
                        {
                            btnInject.Enabled = true;
                        }
                    }
                }
                catch { }
            }
        }
예제 #2
0
        private void conAdd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect      = true;
            ofd.Title            = "Choose Icons to Inject";
            ofd.Filter           = "Icon File (*.ico)|*.ico";
            ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                List <IconObject> icons = new List <IconObject>();
                foreach (string file in ofd.FileNames)
                {
                    string     name      = Path.GetFileName(file).Replace(Path.GetExtension(file), "");
                    string     extension = Path.GetExtension(file);
                    string     path      = file;
                    long       length    = new FileInfo(file).Length;
                    string     size      = length.ToFileSize();
                    string     status    = "Idle";
                    IconObject io        = new IconObject(name, extension, path, size, length.ToString(), status);
                    icons.Add(io);
                }
                lvIcons.AddObjects(icons);

                if (lvIcons.Items.Count == 0)
                {
                    lvIcons.View      = View.SmallIcon;
                    btnInject.Enabled = false;
                }
                else
                {
                    lvIcons.View = View.Details;
                    if (txtAssemblyPath.Text == "")
                    {
                        btnInject.Enabled = false;
                    }
                    else
                    {
                        btnInject.Enabled = true;
                    }
                }
            }
        }
예제 #3
0
        public frmMain()
        {
            InitializeComponent();

            // Change the material skin color.
            var instance = MaterialSkin.MaterialSkinManager.Instance;

            instance.AddFormToManage(this);
            MaterialSkin.ColorScheme scheme = new MaterialSkin.ColorScheme(MaterialSkin.Primary.PGrey900, MaterialSkin.Primary.PGrey900,
                                                                           MaterialSkin.Accent.PGrey900, MaterialSkin.TextShade.BLACK);
            instance.ColorScheme = scheme;
            instance.RemoveFormToManage(this);

            // Create text overlays with colors to match our theme.
            TextOverlay fileOverlay = lvIcons.EmptyListMsgOverlay as TextOverlay;

            fileOverlay.BorderWidth = 0f;
            fileOverlay.Font        = new Font(Font.FontFamily, 12);
            fileOverlay.TextColor   = Color.DimGray;
            fileOverlay.BackColor   = Color.FromArgb(255, 255, 255);
            fileOverlay.BorderColor = Color.FromArgb(40, 146, 255);

            // Create our HotTracking decoration.
            RowBorderDecoration rbd = new RowBorderDecoration();

            rbd.BorderPen                   = new Pen(Color.FromArgb(64, Color.White), 0);
            rbd.FillBrush                   = new SolidBrush(Color.FromArgb(64, SystemColors.Highlight));
            rbd.BoundsPadding               = new Size(0, 0);
            rbd.CornerRounding              = 0.0f;
            lvIcons.HotItemStyle            = new HotItemStyle();
            lvIcons.HotItemStyle.Decoration = rbd;

            // Create a custom column sorter.
            lvIcons.CustomSorter = CustomSorter;

            // Set our image selection delegates for both of our listviews.
            colStatus.ImageGetter = delegate(object x)
            {
                IconObject casted = (IconObject)x;
                switch (casted.Status)
                {
                case "Injected":
                    return(0);

                case "Idle":
                    return(1);

                case "Warning":
                    return(2);

                case "Error":
                    return(3);

                default:
                    return(1);
                }
            };

            // Set listview column aspects programmatically since we're utilizing executable encryption.
            colName.AspectGetter += delegate(object x)
            { return(((IconObject)x).Name); };
            colExtension.AspectGetter += delegate(object x)
            { return(((IconObject)x).Extension); };
            colPath.AspectGetter += delegate(object x)
            { return(((IconObject)x).Path); };
            colSize.AspectGetter += delegate(object x)
            { return(((IconObject)x).Size); };
            colLength.AspectGetter += delegate(object x)
            { return(((IconObject)x).Length); };
            colStatus.AspectGetter += delegate(object x)
            { return(((IconObject)x).Status); };
        }