Hello There, Guest!
View New Posts  |  View Today's Posts
[SOLVED] Help in embedding files

  • 0 Vote(s) - 0 Average
Thread Closed 


04-15-2013, 09:39 PM #1
Kate
Junior Member
**
Posts: 18 Threads:4 Joined: Mar 2013 Reputation: 0

Help in embedding files
Is there a way that i can compile my .dll's, .exe, database in one exe in vb.net and put it into designated folder on runtime?

I don't want to use installer creator or packer.

I need help on this.
This post was last modified: 04-17-2013, 06:55 PM by Kate.

04-15-2013, 10:02 PM #2
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: Help in embedding files
dlls can be combined using something like ILmerge.

As far as you DB is concerned, you could store a blank one in the resources (to keep the filesize down) and write it to disk.

04-15-2013, 10:13 PM #3
Kate
Junior Member
**
Posts: 18 Threads:4 Joined: Mar 2013 Reputation: 0

RE: Help in embedding files
(04-15-2013, 10:02 PM)KoBE Wrote:  dlls can be combined using something like ILmerge.

As far as you DB is concerned, you could store a blank one in the resources (to keep the filesize down) and write it to disk.
Does it mean i can also add database with some data in it?, File size doesn't matter.
This post was last modified: 04-15-2013, 10:13 PM by Kate.

04-15-2013, 10:28 PM #4
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: Help in embedding files
If file size doesn't matter, then yes. You can add whatever file you want to your resources. I wouldn't do it that way personally because I'm not a big fan of unnecessarily large file sizes.

04-15-2013, 11:28 PM #5
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: Help in embedding files
(04-15-2013, 10:13 PM)Kate Wrote:  
(04-15-2013, 10:02 PM)KoBE Wrote:  dlls can be combined using something like ILmerge.

As far as you DB is concerned, you could store a blank one in the resources (to keep the filesize down) and write it to disk.
Does it mean i can also add database with some data in it?, File size doesn't matter.

Filesize should matter.. This is why programmers came up with compression algorithms, and furthermore, one of the reasons why dll's even exist. The filesize however, should never be affected by an expandable embedded database. That's about one of the worst things to do. Why not try to use an SQL database? .NET provides you with easy interaction with Access DB's as well if you want it locally stored, but still should never be within the program itself.

cheers
This post was last modified: 04-15-2013, 11:33 PM by AceInfinity.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

04-16-2013, 04:46 AM #6
Kate
Junior Member
**
Posts: 18 Threads:4 Joined: Mar 2013 Reputation: 0

RE: Help in embedding files
Thanks for the response.

I did what kobe said.
I use my needed files (exe, database, my main project) as a resource on a New Project.
My New project will extract the embedded files to designated folder. And it checked if  the folder and files is exist and if not it will extract else it will run my main project in runtime.

You guys resolved my problem.
But I came again with another problem. Instead of creating a new thread and I think it will be annoying so decided that I post it here.

I scratch my head many times with this problem and dig Google but I didn't get what i want.

I want to format my string "1A2B3D4E" to "1A:2B:3D:43" how can i do that?
Split and join function gives me a lengthy lines of codes. Is there a way that i can lessen the code lines?

04-16-2013, 02:14 PM #7
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: Help in embedding files
Is there any structure to your string? Or do you simply want a a colon every two characters?

Here's a quick example I drew up.
Code:
' original string
Dim sOriginal As String = "1A2B3D4E"

' string builder (used for performance, you could use a string)
Dim sbTest As New System.Text.StringBuilder

' make sure the length of the string is even
If sOriginal.Length Mod 2 = 0 Then
    ' loop through the orignal and append
    ' every two characters followed by a colon
    For i As Integer = 0 To sOriginal.Length - 2 Step 2
        sbTest.Append(sOriginal.Substring(i, 2) & ":")
    Next
    ' remove the excess colon
    sbTest.Remove(sbTest.Length - 1, 1)

    ' print to screen
    Console.WriteLine(sbTest)
End If

04-16-2013, 04:55 PM #8
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: Help in embedding files
(04-16-2013, 04:46 AM)Kate Wrote:  Thanks for the response.

I did what kobe said.
I use my needed files (exe, database, my main project) as a resource on a New Project.
My New project will extract the embedded files to designated folder. And it checked if  the folder and files is exist and if not it will extract else it will run my main project in runtime.

You guys resolved my problem.
But I came again with another problem. Instead of creating a new thread and I think it will be annoying so decided that I post it here.

I scratch my head many times with this problem and dig Google but I didn't get what i want.

I want to format my string "1A2B3D4E" to "1A:2B:3D:43" how can i do that?
Split and join function gives me a lengthy lines of codes. Is there a way that i can lessen the code lines?

How large is that string? Because it looks like binary data for a file, in hexadecimal. So that's where I would be doing what KoBE has done and used a StringBuilder. He's got a good method there.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

04-16-2013, 07:02 PM #9
Kate
Junior Member
**
Posts: 18 Threads:4 Joined: Mar 2013 Reputation: 0

RE: Help in embedding files
Sorry i don't know why quote didn't work.

@Kobe
Is there any structure to your string? Or do you simply want a a colon every two characters?

Yeph I just want to add colon every 2 characters.Both Thumbs Up 

Your code works perfectly. Thanks kobe.

@Ace
How large is that string? Because it looks like binary data for a file, in hexadecimal. So that's where I would be doing what KoBE has done and used a StringBuilder. He's got a good method there.

Actually its consist only of 12 alphanumeric characters. I just want to convert those characters to mac address in case that the user inputs 12 alphanumeric characters that is not formatted already. So it is called string builder. Hmm, I'm loving this forums very much.


By the way I don't see any thanks button to hit.
This post was last modified: 04-16-2013, 07:06 PM by Kate.

04-16-2013, 08:00 PM #10
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: Help in embedding files
Since it's only 12 characters, it wouldn't be a huge impact if you just wanted to use a String instead of the StringBuilder class.

The reason I would recommend StringBuilder is so you're not re-creating a String object EVERY TIME that you want to change it's value (which is basically what it does). And in that loops you're doing it 6 times (for 12 characters). Technically, you're creating a new string every time you use SubString as well, which doubles the amount of times you create a new string, making it a grand total of 12 new string objects that have to be created and disposed of by the .Net Framework.

That may be way over your head (no offense), so if it confuses you then you can disregard it. But, basically when you change a string .Net is creating a brand new string which it then has to clean up later. StringBuilder however, doesn't do work the same way.

Ace, feel free to correct me if I'm wrong.. but I'm pretty sure that's how things work.

(04-16-2013, 07:02 PM)Kate Wrote:  By the way I don't see any thanks button to hit.

We don't have a 'like' system. We use a Rep system that you can give to users in general or by post.


Thread Closed 


Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
   Credit/Token Application [VB.Net/PHP files incl] Error helpme pls DN Angel2 1 1,265 03-19-2015, 11:51 PM
Last Post: AceInfinity
   Credit/Token Application [VB.Net/PHP files incl] KoBE 32 15,611 03-19-2015, 11:51 PM
Last Post: AceInfinity
  Embedding objects in classes wazzi 3 1,660 09-25-2014, 01:55 PM
Last Post: AceInfinity
   HWID System [VB.Net/PHP files included] KoBE 84 54,262 12-08-2013, 02:26 AM
Last Post: KoBE
  [C#]Rename Files on a Folder ! Omegastarscream15 4 3,196 05-11-2013, 01:45 AM
Last Post: Omegastarscream15


Users browsing this thread: 1 Guest(s)