Hi everybody,
I am problem with restoring data of byte[] type to be loaded on an Ink
object. The data
was earlier converted to byte[] then finally to hexadecimal data and store
on a text file.
Is there anyone who can help me solve this problem. Thanks.
Note: The Ink object is from Microsoft.Ink namespace.
Code:
private void LoadXML()
{
try
{
// This object will encode our byte data to a UTF8 string
UTF8Encoding utf8 = new UTF8Encoding();
Ink loadedInk = new Ink();
string filePath = Application.Sta rtupPath + "\\siganture.tx t" +
StreamReader sreader = new StreamReader(fi lePath);
string Signature = sreader.ReadToE nd();
// load the ink into a new ink object
// once an ink object has been "dirtied" it can never load ink again
loadedInk.Load( utf8.GetBytes(s trSignature)); <- Error Occurs here
// temporarily disable the ink collector and swap ink objects
ic.Enabled = false;
ic.Ink = loadedInk;
ic.Enabled = true;
// Repaint the inkable region
this.pictureBox .Invalidate();
}
catch (Exception ex)
{
//error handling processes
}
}
Error Message:
"System.Runtime .InteropService s.COMException (0x8000FFFF): Catastrophic
failure\r\n at Microsoft.Ink.I nkDispClass.Loa d(Object Data)\r\n at
Microsoft.Ink.I nk.Load(Byte[] inkdata)\r\n at SignatureForm.L oadSiganture()
in c:\\....\\signa tureform.cs:lin e 2163\r\n at
signatureForm.b tnCancel_Click( Object sender, EventArgs e) in
c:\\...\\signat ureform.cs:line 705\r\n at
System.Windows. Forms.Control.O nClick(EventArg s e)\r\n at
System.Windows. Forms.Button.On Click(EventArgs e)\r\n at
System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)\r\n at
System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons button,
Int32 clicks)\r\n at System.Windows. Forms.Control.W ndProc(Message& m)\r\n
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)\r\n at
System.Windows. Forms.Button.Wn dProc(Message& m)\r\n at
System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)\r\n
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)\r\n at
System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)\r\n at
System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G& msg)\r\n at
System.Windows. Forms.Component Manager.System. Windows.Forms.U nsafeNativeMeth ods+IMsoCompone ntManager.FPush MessageLoop(Int 32
dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at
System.Windows. Forms.ThreadCon text.RunMessage LoopInner(Int32 reason,
ApplicationCont ext context)\r\n at
System.Windows. Forms.ThreadCon text.RunMessage Loop(Int32 reason,
ApplicationCont ext context)\r\n at
System.Windows. Forms.Applicati on.Run(Form mainForm)\r\n at MainForm.Main()
in c:\\....\\mainf orm.cs:line 557"
den2005
--
MCP Year 2005, Philippines 1 1925
den 2005 <de*****@discus sions.microsoft .com> wrote: Hi everybody, I am problem with restoring data of byte[] type to be loaded on an Ink object. The data was earlier converted to byte[] then finally to hexadecimal data and store on a text file. Is there anyone who can help me solve this problem. Thanks.
Okay, your problem has nothing to do with ink. It's just converting
between text data and binary data.
You've got binary data which has been hex-encoded. So to get back to
the binary data, you need to *decode* it from hex - currently you're
just getting the string encoded in UTF-8. See http://www.pobox.com/~skeet/csharp/unicode.html for information about
encodings to understand what's going on.
Now, there's nothing built into the framework (as far as I know) to
decode a whole hex string. If you can change the format of the file, it
would be easier to use Base64 - then you can use Convert.ToBase6 4String
and Convert.FromBas e64String.
Otherwise, just loop through pairs of characters, converting each to a
byte. I'm sure I had some code somewhere on a newsgroup to do this, but
I can't find it right now...
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pushpendra |
last post by:
I am storing the encrypted password in xml file which I have saved in unicode format. While I try to read the xml file and create a dataset from it, it shows me the following error
System.Xml.XmlException: The '{' character, hexadecimal value 0x7B, cannot begin with a name.
The xml tag that I want to read is below:
<DSNNAME>, ($»<{Š`Ê®A]]'Ï</DSNNAME>
I will be very much thakful If someone writes about the solution for this...
|
by: lonnie.lewis |
last post by:
Hi all,
I'm a consumer of a web service which is defining an output parameter
as an "xsd:anyType":
<message name="MyTransaction.IsWebServicesDataValid">
...
<part name="varDisplayMessage" type="xsd:anyType"/>
<part name="varErrorOccurred" type="xsd:anyType"/>
<part name="varErrorDescription" type="xsd:anyType"/>
</message>
|
by: Vijay |
last post by:
Hi ,
I am doing a small project in c.
I have a Hexadecimal file and want to convert into ascii value.
(i.e., Hexadecimal to Ascii conversion from a file).
Could anyone help me?
Thanks in adv.
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why does parseInt('09') give an error?
-----------------------------------------------------------------------
The parseInt function decides what base the number is by looking
at the number. By convention it assumes that any number beginning
with 0x is Hexadecimal, and otherwise any number beginning with
0 is Octal. To force use of base 10 add a second...
|
by: Troels Arvin |
last post by:
Hello,
Every so often, I'm asked to help people recover data from tables that
were either dropped or where to much data was DELETEed.
The complications related to restoring data are a problem. The SAS users
are laughing because they can (to a certain extend) easily go back to an
earlier SAS table by simply starting dsm. Of course, a flat file table is
different than a relational table; but still, the trouble related to
restoring DB2...
| |
by: Andrea |
last post by:
Hi,
suppose that I have a string that is an hexadecimal number, in order
to print this string I have to do:
void print_hex(unsigned char *bs, unsigned int n){
int i;
for (i=0;i<n;i++){
printf("%02x",bs);
}
}
|
by: sweeet_addiction16 |
last post by:
hello
Im writin a code in c...
can sum1 pls help me out in writing a c code to convert decimalnumber
to hexadecimal number.The hexadecimal number generated has to be an
unsigned long.
|
by: keerthikarani |
last post by:
hi,
I m using the following code in vb.net, but it shows me some error, can u explain why this error occurs and how to rectify it, but the following code works fine in vb
Private Declare Function SQLDataSources Lib "odbc32.dll" _
(ByVal hEnv As Long, _
ByVal fDirection As Integer, _
ByVal szDSN As String, _
ByVal cbDSNMax As Integer, _
ByVal pcbDSN As Integer, _
|
by: babu |
last post by:
Hi all
I am trying to take exchange server 2003 backup and restore
programmatically.
My backup function works fine. But i am in problem in restoring
database. My HrESERestoreAddDatabase is not working well. The
HrESERestoreAddDatabase is returning HRESULT -939587631.
Will anyone give me any link related exchange server 2003 backup? Or
can anyone give me sample code or link to sample code related to
HrESERestoreAddDatabase() method?...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |