|
I don't get an error in code. I just do not get my file to become invisible. (Yes I have windows set to hide invisible files and yes I have checked the file at the command prompt to verify the attrib's assigned to the file. It gives no indication that the file is hidden.
|
|
|
|
|
JollyMansArt wrote: I don't get an error in code.
In your original post you said:
it give me a access denied #5 and invalid parameter #87.
which is why I asked about errors.
Never mind.
Some of the methods of Bitmap behave in a rather thuggish manner, in that they don't always release files that they have accessed. So I would suggest that you dispose your bitmap before trying the FileAttributes part.
Something like this:
Bitmap bitmap = new Bitmap(1, 1);
bitmap.Save(BMP_Path);
bitmap = null;
bitmap.Dispose();
if ((File.GetAttributes(BMP_Path) & FileAttributes.Hidden) != FileAttributes.Hidden)
{
File.SetAttributes(BMP_Path, File.GetAttributes(BMP_Path) | FileAttributes.Hidden);
File.SetAttributes(BMP_Path, File.GetAttributes(BMP_Path) & FileAttributes.Hidden);
}
I cannot guarantee that this will work, I have not tested it. It is based purely on known behaviour of Bitmap.
I do hope that you only use one of your attribute setting lines at a time, otherwise you cannot tell what is and what is not working.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
That worked thanks.
I did only use one in each test. And both lines will result in the same way.
But when disposing the bitmap that fixed it thanks.
|
|
|
|
|
Recently a friend told me that their is a compiler aviable for C# that enables us to generate execuitable for a C# program written in windows to be executed in Linux (i.e. the .cs file written in windows while the execuitable are generated for linux). Is it true? If true which compiler, is it a freeware and where can i find it.
I have also noted that when i open my .cs file in gedit (a text editor) in Ubuntu (a linux based operating system), all the keywords that would high lighted(marked in different color) in VS2K8(Visual Studio 2008) IDE are also high lighted in this text editor. Why is this so?
|
|
|
|
|
Ishaan Karnik wrote: Is it true? If true which compiler, is it a freeware and where can i find it.
Yes. Take a look at MONO project. It is open-source.
Ishaan Karnik wrote: Why is this so?
Gedit supports syntax coloring for C# style code. View -> Highlight mode -> Sources will show all the available languages which Gedit supports.
|
|
|
|
|
hello sir
i m a student of BS
i have a problem that i m unable to show an image( that is stored in the Debug folder )on a crystal report at run time
can anybody help me please.........?
|
|
|
|
|
tanweer akhtar wrote: i m a student of BS
Then you have come to the right place to ask your question.
I regret that I am unable to help you, but there are several BS experts here on CP, and I'm sure that one of them will offer you some advice.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
i want to the code using c# for making a se;lected text superscript and subscript
|
|
|
|
|
santosh_anu wrote: i want to the code using c# for making a se;lected text superscript and subscript
You'd change the Font [^] of the selection.
"I want" isn't a good start for a request though. We all want something
I are Troll
|
|
|
|
|
santosh_anu wrote: i want to the code using c# for making a se;lected text superscript and subscript
Which text?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hello everyone!
I'm developing a simple app that would allow me to index .cs files based on classes and methods, for example:
I would like to supply a .cs file and get as a result a list of all classes and methods, related to those classes (including their source and line numbers).
I tried using some regex but was unsuccessful.
Could some one please help me finding the right regex for that, or maybe there is even a better way to accomplish that?
Thanks, Leon.
|
|
|
|
|
I think this would need more than simple regex scanning, and actually requires some sort of parser to find all the tokens that help identify class and method declarations. I have used This[^] to solve a similar problem in the past, and is probably a good starting point. Unfortunately I don't have my sample code as it belongs to my ex employer.
|
|
|
|
|
I guess EnvDTE.FileCodeModel interface is what you need. This link[^] might as well be of your interest.
You can also make use of NRefactory[^] if you can afford a third party tool.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
modified on Sunday, September 13, 2009 10:27 AM
|
|
|
|
|
Thanks for your reply.
EnvDTE.FileCodeModel does seem to be the solution, however I'm having trouble understanding how to work with it.
Is it possible to see a code snippet that for example loads a .cs file from the disk and displays the class names in it?
Thank you very much
|
|
|
|
|
EnvDTE.FileCodeModel is for Visual Studio addins.
If you app isn't a Visual Studio addin, you'll have to use NRefactory (which, BTW, is free).
If you take a look at NRefactory, don't forget to look at samples\NRefactoryDemo in the SharpDevelop source code download. That's a better example than the "NRefactoryExample" in that video.
|
|
|
|
|
Thanks..
Unfortunately I'm not allowed to use 3rd parties in this project...
So I guess there is no way to use EnvDTE.FileCodeModel in a regular winform app...
I'm back to regex now..
Any help with that?
|
|
|
|
|
You are trying to create a language parser and it won't be possible with a simple regex. Are you not allowed to use open-source projects as well?
modified on Sunday, September 13, 2009 2:48 PM
|
|
|
|
|
It is provably impossible to parse C# code using regular expressions.
Parsing method signatures requires matching nested parenthesis (there might be attributes on the parameters); and matching parenthesis is impossible for regular expressions. See pumping lemma[^].
You might be able to find some approximations, though.
To really solve this problem, you need to use/write a real parser; but that's going to be hard with your "no 3rd parties" restriction (normally parsers are created using parser generator tools).
|
|
|
|
|
Not sure about replacing that "active document" thing by your file name (in EnvDTE). Sorry. As far as regex is concerned, you can handle classes by just taking care of " class " in you file. But methods are diverse. They can be declared in ample amount of ways. Hence you will need something what compiler does to identify things.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Create custom Attributes, decorate your classes and methods with them, and then use them in your search.
|
|
|
|
|
Hello,
I want to design a software for check printing in c#.net. With the forms and design where the user can draw the labels. Is there any sample code available. Please send accross to me.
inform_ashok@yahoo.com
|
|
|
|
|
Read this[^].
You are in a wrong place.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Ashokref wrote: Is there any sample code available.
There may be if you try and look for it!
|
|
|
|
|
yes i have the code to print but it is leanthy if u have c#profetionals 2008 then see page no othereise i send you withen two days
|
|
|
|
|