|
Hi,
Do you want to use some component for this or through pure .Net.
If you dont want to use components, then have a look at java.util.zip namespace. remember that on ur machine J# Redistributable package must be installed. This is part of J# libraries.
For more details, please take a look at following link
http://msdn.microsoft.com/msdnmag/issues/03/06/ZipCompression/[^]
If you want to use a component the search for Xceed Zip components on google.
Hope this helps you !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
|
Hi,
I have a wmv file in which I wnat to add a text data as attribute. The data is >64k.
I have written following code but it gives "The parameter is incorrect." error.
try
{
// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();
IWMMetadataEditor metadataEditor = null;
try
{
//create encoder object
Qlikkit.WMFSDKWrapper.Functions.WMCreateEditor(out metadataEditor);
}
catch(Exception ex)
{
string str = ex.Message;
int mydata = 0;
}
// open wmv file
try
{
metadataEditor.Open("d:\\3333.wmv");
}
catch(System.Runtime.InteropServices.COMException ex)
{
string mystr = ex.Message;
string mystr2 = ex.StackTrace;
int jj=0;
}
// get the IWMHeaderInfo3 interface
IWMHeaderInfo3 headerInfo = metadataEditor as IWMHeaderInfo3;
// get attribute count
ushort Outindex = 0;
headerInfo.GetAttributeCount(0,out Outindex);
IWMEncDisplayInfo displayInfo = Encoder.DisplayInfo;
readMetadataStream();
String mydaya22 = "data" ;
System.Text.StringBuilder mydata33 = new System.Text.StringBuilder(mydaya22);
Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE attrDataType2 = new Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE();//Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE.WMT_TYPE_STRING;
attrDataType2 = Qlikkit.WMFSDKWrapper.WMT_ATTR_DATATYPE.WMT_TYPE_STRING;
try
{
// add attribute
headerInfo.AddAttribute(0,
"Author",
out Outindex,
attrDataType2,
0,
//myDataptr,
mydata33,
(uint)metadataSIze
);
}
catch(Exception ex2)
{
// TODO: Handle exceptions.
string str = ex2.Message;
}
Also My defination of IWMHeaderInfo3.AddAttribute is
void AddAttribute(
[In] ushort wStreamNum,
[In, MarshalAs(UnmanagedType.LPWStr)] string pszName,
[Out] out ushort pwIndex,
[In] WMT_ATTR_DATATYPE Type,
[In] ushort wLangIndex,
//IntPtr pValue,
[In, MarshalAs(UnmanagedType.LPWStr)] StringBuilder data,
[In] uint dwLength);
is it correct?
Regards,
Hemant.
|
|
|
|
|
<br />
XmlDocument SVGPlot;<br />
SVGPlot = new XmlDocument();<br />
SVGPlot.Load("template.svg");<br />
<br />
...<br />
<br />
XmlElement e = SVGPlot.CreateElement("rect");<br />
...<br />
SVGPlot.DocumentElement.FirstChild.AppendChild(e);<br />
My root element has the namespace URI xmlns="http://www.w3.org/2000/svg"
The problem is that every element e I add is like:
<br />
<rect x="100" y="40" width="40" height="10" style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)" xmlns="" />
The xmlns="" makes my svg not to work and I don't think of a way to lose it Please help me
|
|
|
|
|
I've written a program that uses full text searching through Microsoft Indexing Services. The full text search does not search for RTF files. Does anyone know how I can get it to search RTF files. THANKS!
|
|
|
|
|
Hi,
I have a custom windows form with FormBorderStyle=NONE in Windows XP. If I maximize it with WindowState = FormWindowState.Maximized, I see a short animation until this is done. While this animation I see for a short moment the blue title bar. I just tryed ControlBox=false. How can I maximize and normalize this form without seeing the title bar while the animation?
Regards,
Andreas
|
|
|
|
|
Hello,
I have been trying to insert a string at the caret position of a richtextbox using following method
<br />
int indexOfCaret = this.rtb.SelectionLength;<br />
this.rtb.Text = this.rtb.Text.Insert(indexOfCaret, "Test");<br />
But when the text in the richtextbox exceeds, say 1 page, the flickering starts...because I am replacing the text everytime.
Please suggest another way out of this.
Thank you,
Anshuman
Plain old Coder
|
|
|
|
|
The index of the caret is actually SelectionStart, I believe.
If you're having to replace the text, I don't see a way around the fact that it gets replaced every time you replace it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
dont run your insertion directly in textbox.take the current text in some variable and do you replacement there and after that replace whole text of textbox with new value
sameer
|
|
|
|
|
hi
Try this
this.rtb.SelectedText="Text To insert";
hope this works...
Nitin...
|
|
|
|
|
Thank you very much Nitin...this works...
Plain Old Coder
|
|
|
|
|
I am trying to find a class to get the system info (i.e. memory usage, disk space...). I have seen several references to a System.Mangament class but its not list in the .net MSDN help files and doing a "using System.Management;" creates an error. Any ideas.
|
|
|
|
|
sj_h1 wrote: I have seen several references to a System.Mangament class but its not list in the .net MSDN help files
If you are looking for "System.Mangament" I can understand that your search results were sparse. Perhaps if you look for "System.Management[^]" instead...
---
b { font-weight: normal; }
|
|
|
|
|
very funny...now try to be helpful
|
|
|
|
|
sj_h1 wrote: very funny...now try to be helpful
I marked the reply as "Answer" because it is supposed to be helpful, eventhough the joke is on you for misspelling the namespace.
Just click on the link that I included in my post, and you will come to the documentation.
---
b { font-weight: normal; }
|
|
|
|
|
Before you can add a
using System.Management; using directive in your code, you'll need to add a reference to the System.Management.dll
|
|
|
|
|
Thats the very information I need. How do I do that.
|
|
|
|
|
How do you add a reference to your project? That's pretty basic: in Visual Studio, in the Solution Explorer window, under your project, right-click the References folder, then click add reference. In the window that pops up, scroll down to the System.Management.dll, select it, and hit OK.
|
|
|
|
|
|
I want to generate a svg using c# and DOM. I have:
<br />
XmlDocument mySvg = new XmlDocument();<br />
XmlDeclaration declaration = mySvg.CreateXmlDeclaration("1.0", "UTF-8", "no");<br />
mySvg.AppendChild(declaration);<br />
XmlDocumentType doctype = mySvg.CreateDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null);<br />
mySvg.AppendChild(doctype);<br />
The problem is that the DTD is retrieved from the internet and that gives a huge overhead to my application. I downloaded the DTD and I want to make it SYSTEM instead of PUBLIC but I haven't found a way to do this using CreateDocumentType. The only alternative I could think of is mySvg.Load(LongStringWithXML).
|
|
|
|
|
Hi,
can someone help me with replacing a value in a XML file? The whole cycle starting with the filename - i.e. load/replace/save, or however this should be done)
The value is the contents of a simple tag,
<FOO><BAR>...<BAZ>0</BAZ>...</BAR></FOO>
(I want to set the BAZ value to 1)
thanks in advance!
|
|
|
|
|
This should work:
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.Load( "myxml.xml" );<br />
<br />
XmlNode node = xmlDoc.SelectSingleNode( "/foo/bar/baz" );<br />
<br />
if ( node != null )<br />
{<br />
node.InnerText = "1";<br />
}<br />
<br />
xmlDoc.Save("myxml.xml");<br />
as long as there's only one baz element, otherwise you need to iterate over the nodes using SelectNodes or use xpath to determine which unique baz you want, like: xmlDoc.SelectSingleNode( "//foo/bar/baz[@id='123']" ).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
This almost works
The document gets loaded correctly (according to the debugger) - but the selectsinglenode doesn't work.
Here's the XML:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>8.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>8.0</Version>
</HostApplication>
<Addin>
<FriendlyName>peterchens Linkify</FriendlyName>
<Description>Link source code comments to external documentation</Description>
<AboutBoxDetails>For more information, see the respective article at codeporject.com\r\n\r\nCopyright (c) 2006 Peter Hauptmann</AboutBoxDetails>
<AboutIconData>(blubber blubber)</AboutIconData>
<Assembly>D:\Sources\C#\Linkify\bin\Linkify.dll</Assembly>
<FullClassName>Linkify.Connect</FullClassName>
<LoadBehavior>1</LoadBehavior>
<CommandPreload>1</CommandPreload>
<CommandLineSafe>0</CommandLineSafe>
</Addin>
</Extensibility>
I need the LoadBehavior and CommandPreload elements, but SelectSingleNode("/Extensibility/Addin/LoadBehavior") returns a null node. can you help?
|
|
|
|
|
Hmph. If I change the xml files encoding to "UTF-8", and remove the xmlns attribute, it works for me.
I don't know much about Unicode, so maybe you need to adjust those two attributes, or change the parameter of SelectSingleNode (again, I don't know how to tell it its unicoded).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
<br />
XmlDocument document = new XmlDocument();<br />
document.Load("YourXML.xml"); <br />
<br />
XmlNodeList nodeList = document.SelectNodes("//BAZ");<br />
foreach (XmlNode node in nodeList)<br />
node.InnerText = "1";<br />
document.Save(".\YourXML.xml");<br />
I am sure you can work with that to enhance it (This code assumes that you have the XML file in the same folder with the executable file. It also assumes that you want to modify all the <baz> nodes values if there are more than one.)
Good luck coding
//I posted at the same time
|
|
|
|