|
Ahh I was thinking since it was talking about a MSI installer it only did MSI. I don't really have any code. I used reflector to look at the code to see what they were doing. I can try to explain this..
Ok there are agents and each agent have a "location" (city, town, etc). Now there are templates assigned to each location. These templates can contain stuff such as the server address, port, location id, tray icon file, etc. So in the control center application you create your locations and pick the template that goes with them. When you create a location and set the template it creates a link on the webpage for that installer (so it automatically creates a custom installer)
So on the web interface where you download the agent EXE file, it is going to a Deployment.aspx page and is passed the LocationID as a query string. You download the EXE file, install it, and now your computer shows up automatically under the correct location.
So after digging around in reflector I noticed that the installer is default for all of them. The only thing that changes is the embedded resource Template.xml. So what I think is happening is the Deployment.aspx page is querying the database for the locationid template information and creating a new Template.xml file. It is then replacing the Template.xml that is already in the agent installer with this new Template.xml. So when you install it, it is setting all the information in the template.
So my question is if I have a EXE that I created, how do I replace the embedded resource with a updated file? This means I would have to open the EXE file and somehow figure out where the embedded resource file is and replace it programmically.
|
|
|
|
|
Get a look to Wix.
It's essentialy an XML file that contains instructions for generating an MSI. So you could create an XML base template, customize it with the data required by the specific installer you need and then build id by using MSBuild.
|
|
|
|
|
Ahhh I'll take a look at that too.
Note: I removed the code since it is not mine. It is code I found using reflector. I feel that I might of violated some license agreement by posting snippets of the code that I found. Although I would love to learn how they were capable of reading the bytes of the executable and replacing only the bytes that related to the Template.xml.... it is not worth being sued over lol
modified on Monday, November 22, 2010 7:08 PM
|
|
|
|
|
Hello i have this grayscale image and i wan to convert the pixel black all to white.
for (int i = 0; i < grayImage.Height; i++)
{
for (int j = 0; j < grayImage.Width; j++)
{
if (grayImage.GetPixel(j, i).A.ToString() == "0" && grayImage.GetPixel(j,
i).B.ToString() == "0" && grayImage.GetPixel(j, i).G.ToString() ==
"0" && grayImage.GetPixel(j, i).R.ToString() == "0")
{
grayImage.SetPixel(j, i, Color.White);
}
}
}
pictureBox5.Image = grayImage;
i use the above code however it dont seems like it is working when i assign the grayscale image to another pictureBox it appear as the original image.
needing help!
modified on Sunday, November 21, 2010 11:00 AM
|
|
|
|
|
Don't put that pixel.A stuff in there as it will only work if all pixels are totally transparent (alpha == coverage ==> zero coverage == everything is transparent)
If you want to check for black only use the components R, G and B and leave A out.
And one more thing: Get rid of this ToString stuff. We're dealing with numbers here, so use those instead of comparing with string literals.
cheers
Manfred
modified on Sunday, November 21, 2010 11:10 AM
|
|
|
|
|
Set a breakpoint on this line to be sure it is executing:
grayImage.SetPixel(j, i, Color.White);
|
|
|
|
|
thank you ManfredRBihy and Richard Andrew x64. it works!
now my image is this http://i51.tinypic.com/9uvvag.jpg
how do i further process it till i only get the grey portion?
|
|
|
|
|
If you used really gray scale images, I mean, with pixel format set to Format8bppIndexed, you might do most of these things just changing and playing with the palette. For example, for changing black pixels to white ones, assuming the black color is in the first position of the palette:
ColorPalette pal = bmp.Palette;
pal.Entries[0] = Color.White;
bmp.Palette = pal;
But it seems that you are using the default Format32bppArgb, so you will have to iterate over the pixels once and again. For the further processing you need, you will just have to discard the pixels which are too light or too dark, iterating over all of them again.
|
|
|
|
|
Hi all,
I got a problem on calling acmStreamOpen() in C#.When I 'm calling acmStreamOpen(), on WAVEFORMATEXsrc and WAVEFORMATEXdest are both with the wFormatTag of WAVE_FORMAT_PCM,it returns 0(Successful).but if I changed any of them (or both )to be WAVE_FORMAT_ALAW, I got a 512 error. Did I miss something on defining the ALAW WAVAFORMATEX?Thanks.
CWavConvertor.WAVEFORMATEX WAVEFORMATEXsrc = new CWavConvertor.WAVEFORMATEX();
WAVEFORMATEXsrc.wFormatTag = CWavConvertor.WAVE_FORMAT_PCM;
WAVEFORMATEXsrc.nChannels = 1;
WAVEFORMATEXsrc.nSamplesPerSec = 22050;
WAVEFORMATEXsrc.wBitsPerSample = 16;
WAVEFORMATEXsrc.nBlockAlign = Convert.ToUInt16(WAVEFORMATEXsrc.nChannels * WAVEFORMATEXsrc.wBitsPerSample / 8);
WAVEFORMATEXsrc.nAvgBytesPerSec = WAVEFORMATEXsrc.nSamplesPerSec * WAVEFORMATEXsrc.nBlockAlign;
CWavConvertor.WAVEFORMATEX WAVEFORMATEXdest = new CWavConvertor.WAVEFORMATEX();
WAVEFORMATEXdest.wFormatTag = CWavConvertor.WAVE_FORMAT_ALAW;
WAVEFORMATEXdest.nChannels = 1;
WAVEFORMATEXdest.nSamplesPerSec = 8000;
WAVEFORMATEXdest.wBitsPerSample = 8;
WAVEFORMATEXdest.nBlockAlign = Convert.ToUInt16(WAVEFORMATEXdest.nChannels * WAVEFORMATEXdest.wBitsPerSample / 8);
WAVEFORMATEXdest.nAvgBytesPerSec = WAVEFORMATEXdest.nSamplesPerSec * WAVEFORMATEXdest.nBlockAlign;
WAVEFORMATEXdest.cbSize = 0;
CWavConvertor.WAVEFILTER wfltr = new CWavConvertor.WAVEFILTER();
IntPtr mystreamptr = IntPtr.Zero;
int a = CWavConvertor.acmStreamOpen(out mystreamptr, IntPtr.Zero, ref WAVEFORMATEXsrc, ref WAVEFORMATEXdest, wfltr, 0, 0, CWavConvertor.ACM_STREAMOPENF_NONREALTIME);
|
|
|
|
|
I am not familiar with any of this, however:
1.
getting 0 (success) on some parameter values is good, it indicates your P/Invoke stuff could be correct (or pretty close).
2.
A little Google action led to pages such as this one[^] which states:
All newly defined WAVE types must contain both a fact chunk and an extended wave format description within the 'fmt' chunk. RIFF WAVE files of type WAVE_FORMAT_PCM need not have the extra chunk nor the extended wave format description.
That might be a strong clue, although I couldn't tell you what it really means.
|
|
|
|
|
Is the codec for WAVE_FORMAT_ALAW installed?
Next, some codecs can be used for playback only, not for recording or conversion. On Windows XP, you could try to do the conversion with Windows Audio Recorder in order to find out if it is possible at all.
You might also have a look at NAudio: http://naudio.codeplex.com/[^]
|
|
|
|
|
Bernhard Hiller wrote: Next, some codecs can be used for playback only, not for recording or conversion. On Windows XP, you could try to do the conversion with Windows Audio Recorder in order to find out if it is possible at all.
I'm sure it can be converted.
Bernhard Hiller wrote: Is the codec for WAVE_FORMAT_ALAW installed?
Do you know how to check out if a codec is installed?I am pretty new about this.
|
|
|
|
|
can anyone help please
i am stil trying to read and save images in mysql using C# but no luck... anyone has a resource or sample code in C# ploease
|
|
|
|
|
|
This link[^] discusses what you are looking for.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
hello, with ref to this: A simple histogram displaying control [^ ]
It is a tutorial teaching how to display grey scale histogram of the picture. i manage to do a histogram for separate channel, red, green, blue as shown here: http://yfrog.com/n4histogramj [^ ]
having a qns here how do i get the most occurred min and max value of red, green and blue?
before i can do a comparison and get the min and max, i list the values of the histogram into a list box.
Histogram: http://img220.imageshack.us/i/22953975.jpg/
Listbox: http://img694.imageshack.us/i/64724501.jpg/
i suppose the largest value would be 255 however there is values tt is larger than 255.
needing help.
modified on Saturday, November 20, 2010 11:18 AM
|
|
|
|
|
I'm working in a C# app that uses GhostScript. It's creating black & white TIFF's. I need it to create color TIFF's, but I don't know the appropriate command line switches for that. Any know?
Everything makes sense in someone's mind
|
|
|
|
|
You might get an answer here, but I suggest you post your question on a ghost-script forum in the mean-time. You have a higher chance of getting results there as almost everyone on GhostScript forums are, by definition, solving problems with GhostScript.
|
|
|
|
|
Hi all,
I have tried to open an existing Word 2k10 document in mail merge format.
private object tArg = true;
private object fArg = false;
private object wOriginalFormat = Microsoft.Office.Interop.Word.WdOriginalFormat.wdOriginalDocumentFormat;
sourceDoc = word.Documents.Open(ref oSourceFile,
ref mArg,
ref mArg,
ref mArg,
ref mArg,
ref mArg,
ref mArg,
ref mArg,
ref mArg,
ref wdOpenFormatAllWord,
ref fArg,
ref mArg,
ref mArg,
ref mArg,
ref mArg,
ref mArg);
and then added some tables in it and then save it and close it using .
sourceDoc.Save();
((Microsoft.Office.Interop.Word._Document)sourceDoc).Close(ref tArg, ref wdOriginalFormat, ref fArg);
I am getting an exception on doing the close and HRESULT points to 0x800A140C. Can somebody suggest me any solution for this
|
|
|
|
|
|
Hello Kushagra,
what is the value ofthe variable mArg. It's being used in some places where a boolean is expected, but also as the last parameter where no boolean is expected.
Parameter 11 has to do with encoding (as far as the comments go at least) but it's passed a boolean (fArg). Are your sure all the parameters are of the proper
type and have a meaningfull value?
Supplying a wrong parameter might still allow opening the document, but a subsequent save could fail.
Best Regards,
Manfred
|
|
|
|
|
ManfredRBihy wrote: what is the value ofthe variable mArg. It's being used in some places where a boolean is expected, but also as the last parameter where no boolean is expected.
mArg is nothing but NULL which specifies missing value to let the function decide its own default value. I will look for replacing the right parameters .. meanwhile if you find some good solution on this .. please let me know.
-Kushagra
|
|
|
|
|
I haven't worked with the Word Interop, but I've done quite a bit with Excel Interop, which I would guess is similar...
Instead of using dummy variables for parameters you don't want, use "Type.Missing" instead. For example, here's a line from one of my production systems that saves a file in Excel:
Ref.SaveAs(outputFile, -4143, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
"Ref" points to a Microsoft.Office.Interop.Excel.Workbook, outputFile is just a plain string variable. You shouldn't need to use dummy variables and "ref" keywords for everything.
|
|
|
|
|
I finally got this sorted ... Looks there is some issue with Save() api of WOrd 2010 where its not able to decide which format to save the document in ... I used SaveAs() instead and then closed the Document... which worked wonders in my case..
-Kushagra
|
|
|
|
|
Apparently this issue occurs because the Compatibility Mode feature in Office 2010 (Word, Excel, etc.) has been turned off. I guess there are two ways you can fix this. Turn the Compatibility Mode feature back on or like the previous post mentions use the SaveAs() method instead. Using the SaveAs() method fixed the issue for me:
Microsoft.Office.Interop.Word._Document msWord = new Document();
object filename = "C:\\SomeWordFile.doc";
// Open the document. Perform operations on the msWord object.
// ...
// ...
// When it comes to close the document do something like this:
object fileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument;
object missing = System.Reflection.Missing.Value;
object notTrue = false;
msWord.SaveAs(ref filename,
ref fileFormat,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing);
msWord.Close(ref notTrue, ref missing, ref missing);
Hope this helps.
|
|
|
|
|