11 Replies - 1310 Views - Last Post: 11 July 2009 - 09:25 AM

#1 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2583
  • View blog
  • Posts: 15,612
  • Joined: 24-September 08

Custom extentions?

Post icon  Posted 09 July 2009 - 02:38 PM

I was wondering how the hell do companies make them? Like Gimp has their own file extensions, Adobe has PDFs... how does this happen?
Is This A Good Question/Topic? 0
  • +

Replies To: Custom extentions?

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1137
  • View blog
  • Posts: 7,099
  • Joined: 07-September 06

Re: Custom extentions?

Posted 09 July 2009 - 02:45 PM

You know. I have been wondering about this for a while to. I have always thought it interesting that various companies create new extensions for their programs (Blizzard has mpqs, Gimp has xcf, Photoshop has psd, etc.)

I think it is just how you encode the document that is different, but I really have no idea how it is done.
Was This Post Helpful? 0
  • +
  • -

#3 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Custom extentions?

Posted 09 July 2009 - 02:49 PM

What exactly??

File formats are generally just a standardised (to this format) way to store data, could include different compression of the data within (JPEG vs GIF vs PNG, etc., or RAR vs ZIP vs 7z, etc.).

To register your own file extension you just set it up in the registry when your application is installed.

EDIT: For example... Our CMS Base system stores client records in a *.mcr (Mage(UK) Contact Record) file, that can be read/interpreted via the program, just by using that we can go through directories that contain other files searching just for contact records. That file extension is however a 3DS Max Macro file, so nothing's registered for either, it's just another file name.

This post has been edited by MageUK: 09 July 2009 - 02:51 PM

Was This Post Helpful? 0
  • +
  • -

#4 AdaHacker  Icon User is offline

  • Resident Curmudgeon

Reputation: 452
  • View blog
  • Posts: 811
  • Joined: 17-June 08

Re: Custom extentions?

Posted 09 July 2009 - 04:22 PM

View PostNeoTifa, on 9 Jul, 2009 - 03:38 PM, said:

I was wondering how the hell do companies make them? Like Gimp has their own file extensions, Adobe has PDFs... how does this happen?

What, did you think there was some kind of special process to this? Not at all - they just make them up! The programmers come up with the format that they're going to use to serialize their data to disk and then they make up an extension to give those flies. That's all there is to it.

File extensions are nothing but a naming convention used to help identify the content of a file. There's nothing to stop anyone from coming up with a format of data file and making up a new extension for it. It doesn't even have to be a new file format! It might be a regular old text file that's just structured in a certain way, or maybe a ZIP archive where the contents are organized or named in a certain way. The extension doesn't even have to be unique! Programs can, and often do, generate files with the same extension, but a radically different format. It's just a convention to try to make things easier to manage.
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Custom extentions?

Posted 09 July 2009 - 04:53 PM

They do it by creating/alerting file associations in the Registry. Whenever a link, icon, shortcut (or anything of the like) Windows checks the registry to see if it's a valid extension (which are generally created/altered during the programs installation) then opens the appropriate application for that file type.
Was This Post Helpful? 0
  • +
  • -

#6 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2583
  • View blog
  • Posts: 15,612
  • Joined: 24-September 08

Re: Custom extentions?

Posted 09 July 2009 - 05:42 PM

Ah, I'd like to know how to make your program read them. Thanks a lot guys.
Was This Post Helpful? 0
  • +
  • -

#7 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Custom extentions?

Posted 09 July 2009 - 07:42 PM

All you have to do is discover the format of the file you want to open. Like a bitmap has a specific file format that you can find if you search it on the Internet. You would use some sort of binary file reader/writer to read and write the file. You would decode the file using the format as a template and write the file using the template.

It would be like any type of file that you would open. Like when a web browser opens an HTML file. The web browser knows the format of the HTML file and knows how to read it in and process it. It would be the same for Java bytecode. The Java platform know the format of the bytecode and can execute the programs. The Java compiler writes it out in the proper format.
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil  Icon User is online

  • Dic Head
  • member icon

Reputation: 5167
  • View blog
  • Posts: 26,850
  • Joined: 10-May 07

Re: Custom extentions?

Posted 09 July 2009 - 07:48 PM

View PostPsychoCoder, on 9 Jul, 2009 - 05:53 PM, said:

They do it by creating/alerting file associations in the Registry.

Exactly!

When you double click an icon (or file) the OS (Windows) has a centralized repository of what program is associated (or will execute to handle) that file.

So you could theoretically make your own dat reader to open every .dat file you download. Or when you install WinZip (or WinRar) Windows will use whatever compression reader that you assign to it, thus changing the displayed icon in explorer.
Was This Post Helpful? 0
  • +
  • -

#9 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2583
  • View blog
  • Posts: 15,612
  • Joined: 24-September 08

Re: Custom extentions?

Posted 09 July 2009 - 08:24 PM

... what? XD Those are really big words...
Was This Post Helpful? 0
  • +
  • -

#10 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Custom extentions?

Posted 10 July 2009 - 02:25 AM

View PostNeoTifa, on 9 Jul, 2009 - 07:24 PM, said:

... what? XD Those are really big words...

You open it like a .txt file.
Was This Post Helpful? 0
  • +
  • -

#11 no2pencil  Icon User is online

  • Dic Head
  • member icon

Reputation: 5167
  • View blog
  • Posts: 26,850
  • Joined: 10-May 07

Re: Custom extentions?

Posted 10 July 2009 - 02:40 AM

View PostMageUK, on 10 Jul, 2009 - 03:25 AM, said:

View PostNeoTifa, on 9 Jul, 2009 - 07:24 PM, said:

... what? XD Those are really big words...

You open it like a .txt file.

That. :pirate:
Was This Post Helpful? 0
  • +
  • -

#12 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2583
  • View blog
  • Posts: 15,612
  • Joined: 24-September 08

Re: Custom extentions?

Posted 11 July 2009 - 09:25 AM

Oh ok. Now explaining how to make them and have your program read them in that kind of termanology would be nice.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1