|
Hi,
The structs you mentioned exist in a .bmp file, not in a JPEG file.
And before you ask, no I dont have a BMP Viewer yet.
As for WMI, I dont think WMI would help looking at JPEGs; it is involved in system resources.
|
|
|
|
|
I know that WMI is for system resources, but I saw an example while I was doing online research where somebody went to the WMI classes for the owner of a specific file (I think he went to one of the Operating System's Win32_Security classes) ...I was just thinking that the information might be included with it *somewhere*
Welcome my son...Welcome..to the Machine
|
|
|
|
|
right...I knew that the BITMAPINFOHEADER was for a bmp & not a jpg ...but I was hoping that something could be done to mimic its usage. (My bmp viewer is in C++...never ported it to .NET) ...bmp's are actually extremely simple, barely a step up from a PPM.
I'm sure you could find it yourself, but the header just looks like this:
height field
bits per pixel field
compression field
colors field
important colors field
...then you just have to remember that bitmaps are encoded as BGR values instead of RGB, so you have to map them accordingly
Welcome my son...Welcome..to the Machine
|
|
|
|
|
ok...one thing I absolutely hate is how .NET throws this for the code you provided:
Error 6 Control cannot fall through from one case label ('case 207:') to another D:\XNA\Files\Projects\Terrain\TerrainWIP\Terrain\Terrain\JPEG.cs 61 58 Terrain
Was your code C#.NET code? How were you able to force it to fall through the cases?
Welcome my son...Welcome..to the Machine
|
|
|
|
|
Hi,
I did not actually run the code I posted, but it seems OK to me.
cases should be empty (that is how you can list cases to share all their code)
or end on a change-of-flow (break, return, throw...)
Did you somehow change the code and violate the above ?
I guess you did, since 207 is 0xCF and that one ended on return...
|
|
|
|
|
no...identical code. Cut & pasted it. .NET's saying that it won't let a case fall through to execute code from another case. ...OxCF was the case that actually had code to execute. ..the others fell through to 0xCF.
Welcome my son...Welcome..to the Machine
|
|
|
|
|
lol...I saw what it was. You forgot your break in the 0xCF code, so it was saying it couldn't fall from 0xCF to the default code.
Welcome my son...Welcome..to the Machine
|
|
|
|
|
...even if you have a return, it still wants you to have the break after it
Welcome my son...Welcome..to the Machine
|
|
|
|
|
My Visual Studio C# 2005 Express Edition is happy without a break after a return,
and produces a warning "unreachable code" if there is such a break; both seem logical to me.
Are you using an different, maybe older, IDE ?
|
|
|
|
|
I have now tried with Visual Studio 7.1 and it behaves identically:
return without break is fine, return+break gives warning.
|
|
|
|
|
I'm using VS 2005. return without break gives the error that I provided. ...break after return compiles with a warning
Welcome my son...Welcome..to the Machine
|
|
|
|
|
...same in Visual C# 2005 Express
Welcome my son...Welcome..to the Machine
|
|
|
|
|
Well, that's a small mystery, one we will not solve easily, but I guess you can live with it ?
Anyway, I trust you got the code up and running...
|
|
|
|
|
yeah, I can live with it...I'm having a new problem though:
if (code != 0xFF) throw new ApplicationException(
"Unexpected value in file " + filename);
throws ....code equaled 216. What exactly is that check for? Do you know what the value of 216 means in this context? The first pass through, "code" was 255, then the next value was ...[Fixed it before I finished the post]
...Since the only thing I'm wanting to do is determine the width & height of the file, I just place a check for them inside the code check so it's now looking for
if(code != 0xFF && width == 0 && height == 0)
{
throw;
}
so now it will only throw if the width & height haven't been set yet..if they've been set, then I simply break when the code is not 0xFF. ...Is 0xFF like a key value for the header or something like that?
Welcome my son...Welcome..to the Machine
|
|
|
|
|
Hi,
the FF-check is for protection (I want the code to fail on something that isnt a
JPEG at all!); so far all valid packets have a two-byte code that looks like 0xFFXX,
and my code did return as soon as size was seen; you should not continue
scanning the file after that ! (typically the size info is in the first few % of the file,
and the scanner as is probably is unable to handle everything that might follow it).
If there is any more trouble, please publish the entire method again. If you think there
are some valid JPEG files that my code does not handle well, then mail me one or two of them.
|
|
|
|
|
yeah...I didn't remove the return from your case code, but it was definitely not hitting it, which is extremely odd. ...It was definitely continuing past the point that it determined the width & height, which is why doing the assignment checks for width & height automagically switched the block. I'll look into what I did when I get home from work...and I'll post a screenshot of what I got completed.
Welcome my son...Welcome..to the Machine
|
|
|
|
|
hi
i want to convert follow VB.NET code to C# :
if ((bByte <= 1FH) || (bByte >= &H7F))
return ".";
can you help me?
tanks
|
|
|
|
|
if ((bByte <= byte.Parse("1F", System.Globalization.NumberStyles.HexNumber)) || (bByte >= byte.Parse("7F", System.Globalization.NumberStyles.HexNumber)))
return ".";

|
|
|
|
|
There is no || operator in VB, I guess that you mean or .
if (bByte <= 0x1f || bByte >= 0x7f) return ".";
or why not use decimal numbers:
if (bByte <= 31 || bByte >= 127) return ".";
---
single minded; short sighted; long gone;
|
|
|
|
|
Hey Guys,
I'm new to C#... Have never used Microsoft Visual Studio. It was my first day today to install it and attempt to open a new project, whatever I chose (console application, windows application) as soon as I press ok it displays "The filename, directory name or volume label syntax is incorrecr". I dont understand what that means or whats wrong.
Second I have an assignment to do. I need to compile a library management system and the assignment was due a few hours ago and I really have no idea where to start or what to do. Any help would be appreciated.
Thanks
Diana
|
|
|
|
|
Hi,
It is a your assignment ........and you know what is a purpose of an assignment .........i amaze that you install visual studio "today" and your teacher give "Library management system" assignment.......teacher would not be wrong......it's means you are not new in C#(otherwise teacher does'nt) !!!
Anyway....you should purchse visual Studio C# books......you can download the free ebooks of C# from internet.
please ask the more spesific question related your problem......i am also new in C#,but i never need whole coding of any program....i just want "Hint"........i know ther is thousands of sites where i get the any program's code....but there is not right way........i always struggle to improve the my coding and my logics......
logic or technique is basic things otherwise there are thousand cmmands/syntax etc.. you can't learn that at once.
i advise that you breakup the your problem/assignment into small parts/targets,and then try to achieve these targets step by step.
like ..in 1st step you try that how open the Form in C# ?and how you can close that Form ?in 2nd step you learn that how you can use the Buttons in C#...and so on
THANKS
|
|
|
|
|
Which version of Visual Studio do you have? Do you have Express? Pro? ...For help on something like that, open up Visual Studio and document the EXACT steps that you take to get the error. I prefer to see them as pipe delimited, so post them something like this: (And make up some shorthand notation for some of the repetitive words) (...pretend that the ampersands aren't there.)
&< C &> = Clicked
&< C &> File | New Project | Class Library
Named the class library "foo" | &< C &> OK
Visual Studio barfed...
Try to describe exactly what it is that is causing your problem and maybe someone could help you.
Welcome my son...Welcome..to the Machine
|
|
|
|
|
Hi everyone, I've been writing a class that I want to be able to enumerate over different types in a foreach statement. I've tried googling with no luck, and I was hoping that someone here could help me out.
|
|
|
|
|
You can write enumerators for different types, within the class, so that the class is able to be enumerated over using different types, via different properties. Is that what you want ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I think so. Do you know of an example anywhere that you could point me to?
Right now, I have something like:
<code>
IndexType IEnumerator<IndexType>.Current{...}
KeyValuePair<IndexType, T> IEnumerator<KeyValuePair<IndexType, T>>.Current{...}
</code>
and I am getting the error
<code>Error 1 foreach statement cannot operate on variables of type 'Myclass<int,int>' because it implements multiple instantiations of 'System.Collections.Generic.IEnumerable<T>', try casting to a specific interface instantiation 232</code>
The foreach statement is
<code>foreach (int i in info)</code>
where info is of type Myclass<int,int>
|
|
|
|