|
There is nothing in the .NET BCL that will do this without loading the file. You'd have to either write your own, or use a third party library that can get the attributes directly from the file without loading it. I, myself, don't know of any because image processing isn't in my main line of work.
|
|
|
|
|
With FileInfo.Attributes I found that the tiff image is an archive. Is there anyway to do a filecount inside of an archive within .NET, without of course moving the whole file into memory.
|
|
|
|
|
Lord_Veralix wrote: Is there anyway to do a filecount inside of an archive within .NET, without of course moving the whole file into memory.
No, and no. Again, a third party library. You simply have no way of doing this without writing your code code, or using a third party library, to read the file and parse the .TIFF data.
|
|
|
|
|
Shell32.ShellClass sc = new Shell32.ShellClass();
Shell32.Folder folder = sc.NameSpace(fromFile.Substring(0,fromFile.Length - fileName.Length));
Shell32.FolderItem folderItem = folder.ParseName(fileName);
Console.WriteLine(folder.GetDetailsOf(folderItem, 13));
|
|
|
|
|
And this has what to do with getting the data out of a TIFF file?? Nothing, I asure you...
|
|
|
|
|
Actually, this does exactly what I needed. It gets the frame/page count from the header without loading the entire file into memory. I found it when trying to read up how to retrieve ID3 tags from an Mp3. I don't quite understand why you're so adamant about how it's not possible, but here you go... Found my own solution. Thanks for your help I guess.
|
|
|
|
|
Because I would expect it to not know the TIFF file format.
|
|
|
|
|
Lord_Veralix wrote: without of course moving the whole file into memory
Maybe. Here's what I would try:
1. Find a specification for tiff file format somewhere on the Internet.
2. Read the spec. until you find where in the file it stores the frame count. (I'm assuming this will be stored in one or two bytes near the beginning of the file.)
3. Open the tiff file and read enough of it to get the relevant byte(s.)
4. Close the file.
5. Convert the relevant bytes to frame count.
Assume from step 2 above that the frame count is in two bytes at offset 14. Then do something like this:
FileStream stream = File.Open (path, FileMode.Open, FileAccess.Read);
byte [] buffer = new byte [16];
stream.Read (buffer, 0, 16);
stream.Close();
frameCount = (int) (buffer [15] * 256);
frameCount += (int) (buffer [14]);
I'm just guessing that the frame count is stored in the file header, but it might not be. Hope that helps, and good luck!
BDF
|
|
|
|
|
I want the user to be able to minimize to the taskbar and exit. but not resize or fit to screen.. There doesn't seem to be a form property to do this. Any help for the new guy? thanks.
|
|
|
|
|
Hi, I know of three ways to get this:
1.
Choose one of the fixed FormBorderStyles, say FixedSingle. And set MaximizeBox to false.
2.
Set MaximumSize and MinimumSize to the same value as Size.
Now Maximize will be selectable but fail, Minimize will succeed,
resizing will be selectable but fail.
3.
Choose whatever you want, and in the Resize handler if something is happening that you
don't like, undo it (check WindowState, if not Minimized force Size back to its desired value).
1. is the preferred approach since that form best shows what is and is not possible.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
You're awesome. I looked 100 times and I guess I just overlooked the MaximizeBox property. *walks back to his keyboard, embarassed..*
|
|
|
|
|
I was wondering if anyone else had this issue with the MonthCalendar.
My layout is this, I have a grid and a MonthCalendar control.
Once the select a date the grid is filled with data based on that date.
If you edit a cell in the datagrid, and leave it in edit mode for 2 minutes or more, the grid refreshes and it goes out of edit mode.
I put a break inside the MonthCalendars DateChanged event and indeed it is firing every few minutes. No code is causing this - I've looked everywhere.
Anyone have any ideas?
Thanks
EDIT: It doesnt have to be in edit mode to fire every two minutes. The MonthCalendar control refreshes automatically regardless..anyone know how to make it stop?
Steve Welborn
Software Engineer
Inrange Consulting
|
|
|
|
|
The answer if anyone runs into the same problem is to use the DateSelected event instead of the DateChanged event. This event fires only when a user clicks on the date they want, not when you are scrolling through the months or changing the month/date like DateChanged does.
Steve Welborn
Software Engineer
Inrange Consulting
|
|
|
|
|
Hi all,
I have a little problem.... I have a C# Winforms app that sends serialised data to a Pocket PC via TCP/IP, the transmission isnt the problem, but the library Objects.dll was built as a windows library, and even though they are simple objects Visual Studio 2005 wont let me add the project reference to the Pocket PC application because its not a Smart Device Library....
How can i get round this problem? Ideally i want one single assembly that will work for both Winforms and PocketPC client (.net2), using vs2005
Cheers guys!
Will
|
|
|
|
|
Hi Will,
Create a new Smart Device (PDA) class library project in your solution.
Right-click the project and select Add->Existing Items. Navigate to the directory that contains your library files, and select them. In the navigation window, rather than clicking the "Add" button, click the small dropdown arrow on the side of the "Add" button. It will show a menu that says "Add as Link." Select that option.
You'll see the files show up in your project with small shortcut icons attached to them. When you compile this project, it will compile the files using the Compact Framework compiler to this Smart Device project's output directory (not to the original WinForms project's directory).
This way, you have two separate projects with the same source files, that will compile to their respective target frameworks. Making edits in the files will show up in both projects.
NOTE:
If you open the files from the desktop project, you will get Intellisense for the full framework. If you open the files from the PDA project, you will get Intellisense for the Compact Framework. Even though it is exactly the same files, Visual Studio will determine which editing environment to use based on which project opened the files.
ALSO:
If you need code specific to either framework, define a symbol in your Compact Framework project properties that you can use for #if..#endif pragmas. This way you can add custom code for each framework that won't interfere with the compiled code in the other framework.
For example:
Say you define a symbol "NET_CF" in your Compact Framework project. In your code you can do something like this:
#if NET_CF
... CF code...
#else
... Desktop code...
#endif
Hope this helps
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee
|
|
|
|
|
that is spot on! thanks for your time dude!
Cheers
Will
|
|
|
|
|
I had to do the same thing recently. Glad I could help
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee
|
|
|
|
|
I'm attempting to split a file containing records into a number of substrings. The file spec allows for the normal delimiter (') to be escaped within a record by being prefixed with a question mark. Unless there is some trick to it, I guess this rules out using String.Split() so I wrote the following
static ArrayList DealWithEscapedCharacters(StreamReader inputStream, char segmentTerminator, char escapeCharacter)
{
ArrayList results = new ArrayList();
string tempBuffer = "";
char previousChar = ' ';
char currentChar;
while (!inputStream.EndOfStream)
{
currentChar = (char)inputStream.Read();
if (currentChar == segmentTerminator && previousChar != escapeCharacter)
{
tempBuffer += currentChar;
results.Add(tempBuffer);
tempBuffer = "";
}
else
{
tempBuffer += currentChar;
}
previousChar = currentChar;
}
return results;
}
This works, and is very quick even on my laptop. However, can anyone suggest a better/more flexible/even more performant approach?
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
There should be a performance gain in using List<string> as supposed to ArrayList where the strings will be boxed.
Larantz-
|
|
|
|
|
Is there any way in which I can use WCF and NetNamedPipeBinding for Interprocess communication? If yes then can someone share the idea of how it can be done?
I want to communicate with different processes on the same machine and processes will also be the instance of the same application.
Krunal C
|
|
|
|
|
I've never used it but according to the documentation yes.
KrunalC wrote: If yes then can someone share the idea of how it can be done?
Is the example in the documentation lacking? If so what is missing?
|
|
|
|
|
led mike wrote: Is the example in the documentation lacking? If so what is missing?
Document only explains the how service and client(consumer) can be configured but don't explain how it can be used for inter process communication.
|
|
|
|
|
|
Hi
In recent times I often get an application error that it is impossible to create a new control object, because there are no more window handles left. The application is written in C# (.Net 1.1) and is used to create extensive content specific dialogues. At the moment I’m not quite sure how to identify the source of error. Within my object model, I use every time dispose() to destroy any existing graphical object. But it seems that this process doesn’t work correct. It is possible to retrieve the number of window handles that are currently used by an application? Last week I read a thread that states to locate the application process and then use the MainWindowHandle property in relation with EnumWindows to get the total count of all window handles. Unfortunately, I’ have no idea how to implement this procedure (especially how shall I use EnumWindows). Does anyone knows how to perform this task or does anyone have another idea to determine the total count of used window handles?
Thanks in advance
Erik
|
|
|
|
|