Hack Forums
[C#] How to clone assembly info! - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] How to clone assembly info! (/showthread.php?tid=5362513)



How to clone assembly info! - ForceJew - Aug 3, 2016

What you need:
VisualStudio(i use 2015)
Basic knowledge

First, Make a new form with 8 text boxes and 8 labels.
Put the labels behind the text boxes and name them the names of the assembly info.
Title
Description
Company
Product
Version
FVersion
Copyright
Trademark
and you should name the text boxes to their infos i do this
"txtTitle" - for the title text box

When you are done
Make a button with the text "clone" and name it something like "btnClone"
Double click on the button and go to its code.
Nows the fun part:
First we will make a OpenFileDialog for the user to pick a file to clone:
PHP Code

<?php 
using
(OpenFileDialog ofd = new OpenFileDialog())
{
} 
Inside of that we will write a Filter
PHP Code

<?php 
ofd
.Filter = "Excutables|*.exe"; 
and we will write an if
PHP Code

<?php 
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
} 
for now should look like this:
PHP Code

<?php 
using 
(OpenFileDialog ofd = new OpenFileDialog())
            {
                
ofd.Filter = "Excutables|*.exe";
                if (
ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                }
            } 
Inside of the if we write this:
PHP Code

<?php 
FileVersionInfo myFileVersionInfo 
=
                    
FileVersionInfo.GetVersionInfo(ofd.FileName);
                    
//Changing the text boxes test to be the assembly information of the file we selected
                    
txtFVersion.Text = myFileVersionInfo.FileVersion;
                    
txtVersion.Text = myFileVersionInfo.ProductVersion;
                    
txtProduct.Text = myFileVersionInfo.CompanyName;
                    
txtDescription.Text = myFileVersionInfo.FileDescription;
                    
txtCopyright.Text = myFileVersionInfo.LegalCopyright;
                    
txtTrademark.Text = myFileVersionInfo.LegalTrademarks;
                    
txtProduct.Text = myFileVersionInfo.ProductName;
                    
txtTitle.Text = myFileVersionInfo.InternalName;
                    
txtCompany.Text = myFileVersionInfo.CompanyName; 
Okay first we create a FilVersionInfo.GetVersionInfo(ofd.FileName) that gives us all the assembly information of the file the user selected
Then we change all of the text in our textboxs to the matching values.
The textbox of the title will get the title.

Thats it try it for your self:)
I'm sorry if i explained badly or the code is poorly wrotten its kind of hard without formatted code.
Try and write everything without copying to learn better!
Thanks for reading my guide


* - 帖子作者 - Aug 3, 2016

Looks good, I'm sure this will help a lot of people :)


* - ForceJew - Aug 3, 2016

(Aug 3, 2016 01:50 PM)Scorpi0n Wrote:  Looks good, I'm sure this will help a lot of people :)

Thanks awesome to get that from you:)
I have defiantly seen alot of how to copy assembly? here
So i made this:)


* - Ghzt- - Aug 3, 2016

Thanks for the turorial, Helped me out alot! 🤝


* - ForceJew - Aug 4, 2016

(Aug 3, 2016 07:13 PM)Ghzt- Wrote:  Thanks for the turorial, Helped me out alot! 🤝

No problem!


* - 0xDEAD10CC - Aug 5, 2016

Easier way would be to just extract the manifest, plus it would probably be more accurate too. You're not cloning anything btw, all you're doing is displaying specific properties.


* - ForceJew - Aug 6, 2016

(Aug 5, 2016 06:24 PM)0xDEAD10CC Wrote:  Easier way would be to just extract the manifest, plus it would probably be more accurate too. You're not cloning anything btw, all you're doing is displaying specific properties.

Well after you display you can put this properties in your stub.


* - 0xDEAD10CC - Aug 6, 2016

(Aug 6, 2016 01:57 AM)mrmutt Wrote:  Well after you display you can put this properties in your stub.

The point was that you don't have to manually grab each property, you can just grab the entire section at once and you don't even have to know what properties exist. This is not the way I'd do it.


* - ForceJew - Aug 6, 2016

(Aug 6, 2016 08:45 AM)0xDEAD10CC Wrote:  The point was that you don't have to manually grab each property, you can just grab the entire section at once and you don't even have to know what properties exist. This is not the way I'd do it.

I will take a look on that.
Thanks:)


* - Velo - Aug 7, 2016

Great tutorial, do you have one for C#?


* - ForceJew - Aug 8, 2016

(Aug 7, 2016 08:32 PM)Ditkovich Wrote:  Great tutorial, do you have one for C#?

It is c#