473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Custom Files?

My program writes text to a file. Currently the files have a suffix of
'.log' . I want to make sure that the user does not attempt to open a file
that was not originally created by my program.

I don't really want to write some code to the top of the text file that I'd
have to filter out each time I read it, so how else would I do it?

Would I perhaps:
i) create a custom file type with a custom suffix and get the system to
associate that suffix with my program (if so how??)
ii) set an attribute of the file (e.g. a "creator" attribute, if there is
one?) to my program name and check it prior to opening the file (again, if
so how??)

Dec 1 '05 #1
7 1339
You can try these things...

Dim FileProperties As FileVersionInfo =
FileVersionInfo.GetVersionInfo("FilePath")
Msgbox(FileProperties.ProductVersion)

/Lars


"Flashster" <fl***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
My program writes text to a file. Currently the files have a suffix of
'.log' . I want to make sure that the user does not attempt to open a
file that was not originally created by my program.

I don't really want to write some code to the top of the text file that
I'd have to filter out each time I read it, so how else would I do it?

Would I perhaps:
i) create a custom file type with a custom suffix and get the system to
associate that suffix with my program (if so how??)
ii) set an attribute of the file (e.g. a "creator" attribute, if there is
one?) to my program name and check it prior to opening the file (again, if
so how??)

Dec 1 '05 #2
Flashster wrote:
My program writes text to a file. Currently the files have a suffix of
'.log' . I want to make sure that the user does not attempt to open a file
that was not originally created by my program.

I don't really want to write some code to the top of the text file that I'd
have to filter out each time I read it, so how else would I do it?

Would I perhaps:
i) create a custom file type with a custom suffix and get the system to
associate that suffix with my program (if so how??)
ii) set an attribute of the file (e.g. a "creator" attribute, if there is
one?) to my program name and check it prior to opening the file (again, if
so how??)


Even if you made a custom file extension, someone could still open it in
notepad. So if you save the file in plan text, neither of your ideas
will suffice. To make sure nobody can read your file you will need to
encrypt it.

Chris
Dec 1 '05 #3
"Flashster" <fl***********@hotmail.com> schrieb:
i) create a custom file type with a custom suffix and get the system to
associate that suffix with my program (if so how??)


<URL:http://www.mentalis.org/soft/class.qpx?id=5>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 1 '05 #4
Flashster,
I would define a custom extension for you app. You can use a setup packed to
define the extension when you deploy the app.

To ensure that the file being read can be understood by my app, rather then
use plain text, I would use a "structured format", such as XML or Binary
Serialization.

This way when the program attempted to deserialize the document I would get
an exception if the document is not in the expected format...

As Chris suggests, encrypting the document can also be useful.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Flashster" <fl***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
| My program writes text to a file. Currently the files have a suffix of
| '.log' . I want to make sure that the user does not attempt to open a
file
| that was not originally created by my program.
|
| I don't really want to write some code to the top of the text file that
I'd
| have to filter out each time I read it, so how else would I do it?
|
| Would I perhaps:
| i) create a custom file type with a custom suffix and get the system to
| associate that suffix with my program (if so how??)
| ii) set an attribute of the file (e.g. a "creator" attribute, if there is
| one?) to my program name and check it prior to opening the file (again, if
| so how??)
|
|
|
Dec 1 '05 #5
Thanks. I'll look into the XML format I think. But regarding the custom file
extension: Do I need to apply to the relevent organisations to use a custom
file extension? In the Microsoft info below, it mentions submitting a
request to the IANA for the file type??

http://msdn.microsoft.com/library/de...file_types.asp

This is only a small application which is being provided to a small number
of individuals in a single organisation, so surely I don't have to do
this....do I?



"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:Op****************@TK2MSFTNGP10.phx.gbl...
Flashster,
I would define a custom extension for you app. You can use a setup packed
to
define the extension when you deploy the app.

To ensure that the file being read can be understood by my app, rather
then
use plain text, I would use a "structured format", such as XML or Binary
Serialization.

This way when the program attempted to deserialize the document I would
get
an exception if the document is not in the expected format...

As Chris suggests, encrypting the document can also be useful.

--
Hope this helps
Jay [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Flashster" <fl***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
| My program writes text to a file. Currently the files have a suffix of
| '.log' . I want to make sure that the user does not attempt to open a
file
| that was not originally created by my program.
|
| I don't really want to write some code to the top of the text file that
I'd
| have to filter out each time I read it, so how else would I do it?
|
| Would I perhaps:
| i) create a custom file type with a custom suffix and get the system to
| associate that suffix with my program (if so how??)
| ii) set an attribute of the file (e.g. a "creator" attribute, if there
is
| one?) to my program name and check it prior to opening the file (again,
if
| so how??)
|
|
|

Dec 1 '05 #6
My take on that article is if you plan on having a Public File type, then
yes you should register it with the IANA, however if you are planning a
Private File Type, then I wouldn't worry about it.

Of course not registering it, may mean another app would start using it &
potentially cause problems for you.

I would also consider my target audience in deciding to register the type or
not.

I would also consider if the documents are going potentially to be placed on
web servers as hyper links...

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Flashster" <fl***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Thanks. I'll look into the XML format I think. But regarding the custom
file
| extension: Do I need to apply to the relevent organisations to use a
custom
| file extension? In the Microsoft info below, it mentions submitting a
| request to the IANA for the file type??
|
|
http://msdn.microsoft.com/library/de...file_types.asp
|
| This is only a small application which is being provided to a small number
| of individuals in a single organisation, so surely I don't have to do
| this....do I?
|
|
|
|
|
|
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
| message news:Op****************@TK2MSFTNGP10.phx.gbl...
| > Flashster,
| > I would define a custom extension for you app. You can use a setup
packed
| > to
| > define the extension when you deploy the app.
| >
| > To ensure that the file being read can be understood by my app, rather
| > then
| > use plain text, I would use a "structured format", such as XML or Binary
| > Serialization.
| >
| > This way when the program attempted to deserialize the document I would
| > get
| > an exception if the document is not in the expected format...
| >
| > As Chris suggests, encrypting the document can also be useful.
| >
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley - http://www.tsbradley.net
| >
| >
| > "Flashster" <fl***********@hotmail.com> wrote in message
| > news:%2****************@TK2MSFTNGP11.phx.gbl...
| > | My program writes text to a file. Currently the files have a suffix of
| > | '.log' . I want to make sure that the user does not attempt to open a
| > file
| > | that was not originally created by my program.
| > |
| > | I don't really want to write some code to the top of the text file
that
| > I'd
| > | have to filter out each time I read it, so how else would I do it?
| > |
| > | Would I perhaps:
| > | i) create a custom file type with a custom suffix and get the system
to
| > | associate that suffix with my program (if so how??)
| > | ii) set an attribute of the file (e.g. a "creator" attribute, if there
| > is
| > | one?) to my program name and check it prior to opening the file
(again,
| > if
| > | so how??)
| > |
| > |
| > |
| >
| >
|
|
Dec 1 '05 #7
Thanks Jay. I'll use a fairly long file suffix so its less likely to clash
with anything and its only for a limited number of users anyway.

"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:%2******************@TK2MSFTNGP12.phx.gbl...
My take on that article is if you plan on having a Public File type, then
yes you should register it with the IANA, however if you are planning a
Private File Type, then I wouldn't worry about it.

Of course not registering it, may mean another app would start using it &
potentially cause problems for you.

I would also consider my target audience in deciding to register the type
or
not.

I would also consider if the documents are going potentially to be placed
on
web servers as hyper links...

--
Hope this helps
Jay [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Flashster" <fl***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Thanks. I'll look into the XML format I think. But regarding the custom
file
| extension: Do I need to apply to the relevent organisations to use a
custom
| file extension? In the Microsoft info below, it mentions submitting a
| request to the IANA for the file type??
|
|
http://msdn.microsoft.com/library/de...file_types.asp
|
| This is only a small application which is being provided to a small
number
| of individuals in a single organisation, so surely I don't have to do
| this....do I?
|
|
|
|
|
|
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
| message news:Op****************@TK2MSFTNGP10.phx.gbl...
| > Flashster,
| > I would define a custom extension for you app. You can use a setup
packed
| > to
| > define the extension when you deploy the app.
| >
| > To ensure that the file being read can be understood by my app, rather
| > then
| > use plain text, I would use a "structured format", such as XML or
Binary
| > Serialization.
| >
| > This way when the program attempted to deserialize the document I
would
| > get
| > an exception if the document is not in the expected format...
| >
| > As Chris suggests, encrypting the document can also be useful.
| >
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > .NET Application Architect, Enthusiast, & Evangelist
| > T.S. Bradley - http://www.tsbradley.net
| >
| >
| > "Flashster" <fl***********@hotmail.com> wrote in message
| > news:%2****************@TK2MSFTNGP11.phx.gbl...
| > | My program writes text to a file. Currently the files have a suffix
of
| > | '.log' . I want to make sure that the user does not attempt to open
a
| > file
| > | that was not originally created by my program.
| > |
| > | I don't really want to write some code to the top of the text file
that
| > I'd
| > | have to filter out each time I read it, so how else would I do it?
| > |
| > | Would I perhaps:
| > | i) create a custom file type with a custom suffix and get the system
to
| > | associate that suffix with my program (if so how??)
| > | ii) set an attribute of the file (e.g. a "creator" attribute, if
there
| > is
| > | one?) to my program name and check it prior to opening the file
(again,
| > if
| > | so how??)
| > |
| > |
| > |
| >
| >
|
|

Dec 1 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nadav | last post by:
Hi, I have to read files generated by 3rd party application, these files are in a propriotary format ( not generated using the .NET framework ), I want to implement a custom DeSerializer to read...
16
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
5
by: rdcpro | last post by:
In reading MSDN docs on creating custom Configuration sections, I found this page: ...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
1
by: aspnet20vb_mike | last post by:
I have a Custom Control which inherits from GridView. I call it GridViewSort and it is in a namespace "PDS.WebControls". I add it to the Toolbox, drop it on my WebForm and it shows up and...
1
by: Gene | last post by:
I would like to know if the following is even possible with the visual studio.net Setup and Deployment project. 1. During the deployment after creation of application directory the setup needs...
13
by: Matt F | last post by:
I have a deployment project that I'm setting up. I need to perform a different custom action based on whether this is a first time install or an update. Does anyone have any idea if it's possible...
0
by: benjamin11 | last post by:
Hi all, A few questions regarding the custom setup program in C#: 1. How do I make the custom setup copy a few files (image files, icon files, or text files), into the application...
0
by: mk189 | last post by:
Hi, I am trying to create XML schema of custom markup language, enriched by XHTML. In simplified version, the XML documet could look like that: <a:alarm-manual xmlns:a="alarm-manual"...
5
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
Using VS2005: We have created custom class projects that output to DLL files. In our App, we add these to the list of Solution References and include them in the code. When the App...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.