|
See this[^] on this page.
"Praying." Is this only what I can do for him ?
|
|
|
|
|
you can use multi Polymorphism,declare a base class with an abstract function
Item_Is_Cooked(),and also declare some subclass which implements the base's
Item_Is_Cooked(),so it ok
abstract class BaseClass
{
abstract bool Item_Is_Cooked();
}
class SubClass1:BaseClass
{
bool Item_Is_Cooked(){//implements};
}
|
|
|
|
|
Is clipboard class only used for copying strings or can I use it to copy treeview nodes from one treeview to another?
Thank you
|
|
|
|
|
Will they be copied as thier names?
"I am a liar." Is this statement true or false ?
|
|
|
|
|
As a deep copy (with all the children nodes).
|
|
|
|
|
i use this code to crypt the file i load with opendialog, i get a file 1k bigger the original:
FileStream stream = new FileStream(file_open_path, FileMode.Open, FileAccess.Read);
byte[] data = new Byte[stream.Length];
stream.Read(data, 0, (int)stream.Length);
FileStream writer = new FileStream(file_save_path, FileMode.Create, FileAccess.Write);
writer.Write(data, 0, (int)stream.Length);
stream.Close();
DESCryptoServiceProvider cryptic = new DESCryptoServiceProvider();
ASCIIEncoding ascii = new ASCIIEncoding();
cryptic.Key = ascii.GetBytes(key);
cryptic.IV = ascii.GetBytes(key);
CryptoStream crsStream = new CryptoStream(writer, cryptic.CreateEncryptor(), CryptoStreamMode.Write);
crsStream.Close();
writer.Close();
MessageBox.Show("Il Divx è stato criptato con successo!");
textBox1.Text = textBox2.Text = textBox3.Text = "";
openFileDialog1.FileName = saveFileDialog1.FileName = "";
then i use this one to dencrypt, but i don't free the file becouse i get the seme size and yet crypted, where do i wrong?:
FileStream stream = new FileStream(file_open_path, FileMode.Open, FileAccess.ReadWrite);
DESCryptoServiceProvider cryptic = new DESCryptoServiceProvider();
ASCIIEncoding ascii = new ASCIIEncoding();
cryptic.Key = ascii.GetBytes(key);
cryptic.IV = ascii.GetBytes(key);
CryptoStream crsStream = new CryptoStream(stream, cryptic.CreateDecryptor(), CryptoStreamMode.Read);
byte[] data = new Byte[stream.Length];
stream.Read(data, 0, (int)stream.Length);
int val = (int)stream.Length;
crsStream.Close();
stream.Close();
FileStream writer = new FileStream(file_save_path, FileMode.Create, FileAccess.Write);
writer.Write(data, 0, val);
writer.Close();
MessageBox.Show("Il Divx è stato decriptato con successo!");
textBox4.Text = textBox5.Text = textBox6.Text = "";
openFileDialog2.FileName = saveFileDialog2.FileName = "";
|
|
|
|
|
Sasuko wrote: CryptoStream crsStream = new CryptoStream(writer, cryptic.CreateEncryptor(), CryptoStreamMode.Write);
crsStream.Close();
You have to use the CrtptoStream instance to read and write. You cant use the original stream. You make the same mistake (in 2 different ways) in both your read and write sections.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
can you show me the right code?
|
|
|
|
|
Sasuko wrote: can you show me the right code?
Yes, look in MSDN, there are plenty samples on the correct usage of CryptoStream .
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Beta Exam Invitation
Beta Exam 71-528: TS: Microsoft® .NET Framework 2.0 - Web-based Client Development
[Beta version of Exam 70-528]
As an early adopter or someone who has expressed interest in Microsoft Certifications, you are invited to take the Beta (pre-release) version of Exam 70-528 and provide feedback. The Beta exam is FREE for you, and it will count towards certification in the same way as the final version of the exam. When the exam begins, you will be able to specify whether you want to take the exam in Visual Basic .NET or in C#.
Microsoft® is launching a New Generation of Certification. There are two series of credentials for .NET Framework developers: Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified Professional Developer (MCPD). The MCTS credential highlights your ability to develop Windows, Web, or distributed applications using the .NET Framework 2.0 and Visual Studio 2005. The MCPD credential highlights your job role, featuring your specific area of expertise and allowing you to distinguish yourself as an expert in Windows Development, Web Application Development, or Enterprise Applications Development.
Exam 70-528, is one of two exams required for the “Microsoft® Certified Technology Specialist: .NET Framework 2.0 Web Applications” credential. To achieve this credential you will also need to pass exam “70-536: TS: Microsoft® .NET Framework 2.0 - Application Development Foundation”. After achieving the Technology Specialist credential for Web applications, you will be able to achieve the “Microsoft® Certified Professional Developer: Web Developer” credential by passing one additional exam: “70-547: PRO: Designing and Developing Web Applications by Using the Microsoft® .NET Framework.”
You are being given advanced notification about this Beta exam. By participating in Beta exams, you have the opportunity to provide the Microsoft Certification Program with feedback about exam content, which is integral to development of a high quality exam. We depend on the contributions of experienced IT professionals and developers as we continually improve exam content and maintain the value of Microsoft certifications. You can expect to receive notification on whether or not you have passed the exam before the final exam is released.
SPECIAL OFFER: Candidates who take and achieve passing score in the beta exam will receive a free exam voucher* for any Microsoft Certification Exam. Vouchers will be sent after exam scores are tabulated.
The preparation information for this exam can be found at:
http://www.microsoft.com/learning/exams/70-528.asp
Beta exams have limited availability (approximately 500 seats worldwide), so please follow the registration information below to make your reservation.
**Registration Information**
Note: You will be given four hours to complete the Beta exam. Please plan accordingly.
Testing is held at Thomson Prometric and Pearson VUE testing centers worldwide, although this exam may not be available in all countries. You must register at least 24 hours prior to taking the exam. Contact your exam provider for seat availability, which is offered on a first-come, first-served basis. This exam will have limited availability and will be offered for a limited time.
Please register for the exam only if you intend to take the exam, and register as soon as you receive this notice. Registration will open October 17 2005 – ONCE AGAIN SEATING IS LIMITED.
Please read the following registration information carefully as the schedules vary depending on which testing center you choose:
Registration begins:
October 17 2005
Beta exam period runs:
November 7 2005 through November 18 2005
Please use the following promotional code when registering for the 70-528 Exam:
BTA528
This Beta exam period is subject to change.
To register for this exam or for information about testing centers in your area, call:
Thomson Prometric: (800) 755-EXAM (800-755-3926)
Pearson VUE: 800 TEST Registration (800-837-8734)
Outside the U.S./Canada, please visit the following Web sites for registration information:
Thomson Prometric: http://www.register.prometric.com/ClientInformation.asp
Pearson VUE: http://www.vue.com/ms/
NOTE : This Beta exam will not be available in China, India and Pakistan.
* Offer good only for people who pre-register for, and pass, Exam 71-582. Limit one gift per person. This offer is non-transferable. This offer expires on November 7, 2005, or when registration closes for this Beta exam. Beta exam registration has limited availability. This offer is not redeemable for cash. Taxes, if any, are the sole responsibility of the recipient. Any gift returned as non-deliverable will not be re-sent.
________________________________________________________________________
Microsoft Certification Program Information on the World Wide Web
For more information, visit the Microsoft Learning Web site at http://www.microsoft.com/mcp/, write to MCPHelp@microsoft.com or call 800-636-7544.
Specific pages that answer some frequently asked questions are listed below.
What is a Beta exam?
http://www.microsoft.com/learning/mcpexams/faq/procedures.asp
Where can I learn more about the registration process?
http://www.microsoft.com/learning/mcpexams/register/default.asp
How do I prepare for this exam?
http://www.microsoft.com/learning/exams/70-528.asp
When will my Beta exam results be available?
http://www.microsoft.com/learning/mcpexams/faq/procedures.asp#D
Where can I learn more about the Beta exam invitation process?
http://www.microsoft.com/learning/mcpexams/status/beta.asp
How can I learn more about the new and improved item types?
http://www.microsoft.com/learning/mcpexams/faq/innovations.asp
If you have further questions regarding this exam or the MCP program, send e-mail to MCPHelp@microsoft.com or call 800-636-7544.
MVP, MCAD
|
|
|
|
|
I just recently downloaded Windows Media Connect 2.0.
There is a DLL inside the installation (C:\Program Files\Windows Media Connect 2\wmcsci.dll) that I've imported as a reference to my C# project. I can see all the classes, and am actually able to do a number of things to interact with the Windows Media Connect server running locally. For example:
using WMCSCI;<br />
...<br />
WMCManager manager = new WMCManager();<br />
Console.WriteLine("WMC status: " + manager.Status);<br />
Devices devices = manager.GetDevices(DeviceAuthorization.AllDevices);<br />
Console.WriteLine("Devices: " + devices.Count);<br />
Libraries libraries = manager.SharedLibraries;<br />
Console.WriteLine("Shared Libraries: " + libraries.Count);<br />
All of the methods and properties seem to work -- with one exception. The COM interface defines get_Item() on a number of the interfaces, namely:
IWMCDevices<br />
IWMCLibraries<br />
IWMCProperties
(Here's a link to the get_Item() API method on IWMCDevices, for example.)
From C#, there are no "Item" or "getItem" methods, and the interfaces are not enumerable either. It requires that I use array notation to access indices in the collection.
object index = 0;<br />
IWMCDevices devices = manager.GetDevices(DeviceAuthorization.AllDevices);<br />
IWMCDevice device = devices[index];
However, the compiler requires a "ref object Index" argument when using this notation. And devices[ref index] doesn't work either.
How can I access the items in these collections? Is there some interop signature I can create to access the original get_Item() method, or is there something else that I'm missing?
Thanks!
David
|
|
|
|
|
dkarlton wrote: There is a DLL inside the installation (C:\Program Files\Windows Media Connect 2\wmcsci.dll) that I've imported as a reference to my C# project.
You should know better.
Use the UPnP COM object rather. Same thing/functionality AFAIK.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
That may be well and good to be able to use the UPnP interface to WMC. And I may be able to get the same functionality. But ultimately I want to use the WMC API, in part because it seems ridiculous that it's not possible to use .NET and C# to cleanly access the COM API's. If the workaround to this issue is "use a different tool" then my gut reaction is "why am I using broken tools in the first place?" Clearly, I am just stubborn. OK, enough of my ranting.
In the meantime, I've made a kludged reflection workaround to handle get_Item(). I'm still hoping there's someone out there who can offer a more elegant solution:
int index = 0;<br />
WMCManager manager = new WMCManager();<br />
Devices devices = manager.GetDevices(DeviceAuthorization.AllDevices);<br />
Device d = (Device)devices.GetType().InvokeMember("Item", BindingFlags.GetProperty, null, devices, new object[]{index});
And by the way, if I wanted to use UPnP instead of the WMC API, there's still an issue of using interop to handle events and asynchronous discovery:
[ComImport, Guid("415A984A-88B3-49F3-92AF-0508BEDF0D6C"),<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br />
internal interface IUPnPDeviceFinderCallback<br />
{<br />
void DeviceAdded(int lFindData, IUPnPDevice pDevice);<br />
void DeviceRemoved(int lFindData, string bstrUDN);<br />
void SearchComplete(int lFindData);<br />
}<br />
<br />
[ComImport, Guid("31fadca9-ab73-464b-b67d-5c1d0f83c8b8"),<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br />
public interface IUPnPServiceCallback<br />
{<br />
void StateVariableChanged(IUPnPService pus,<br />
[MarshalAs(UnmanagedType.LPWStr)] string pcwszStateVarName, object vaValue);<br />
void ServiceInstanceDied(IUPnPService pus);<br />
}<br />
Cheers,
David
|
|
|
|
|
Oh, and by the way, after further investigation, it is <bold>not possible to share libraries and/or authorize devices via UPnP (which is what we are ultimately trying to do). You can only use the Windows Media Connect application GUI, or the new WMC API. (As far as I can tell. Correct me if I'm wrong.)
David
|
|
|
|
|
I've got an ArrayList of objects. I call up a form to create a new object from one of the objects in the array.
User selects the object to create the new object from.
Now, I need to create a new object from the old object, so I thought this would work:
ArrayList objects = new Arraylist();
objects.Add(obj1);
obects.Add(obj2);
...
MyObject newobject = new MyObject();
{ ... iteratate through arraylist, find correct object }
newobject = correctObjectFromArrayList;
newobject.name = newobjectname;
objects.Add(newobject);
... and now I've modified both objects!
Both objects contain the changes I've made. Why is that?
In C++, if I did this, it would work.
It seems that C# uses references by default? I created a new object, not a pointer to an object.
I'm very confused. Can someone sort me out?
Thanks.
|
|
|
|
|
Why would that work in c++?
First you initialized newobject with a new MyObject instance, and promptly assigned the reference to an existing object in your collection. The new MyObject instance you created now has no reference to it. You haven't modified "both" objects, you've lost the second one and modified the first.
What exactly are you trying to do? Create the second object, initializing it with values from the first? If so, it sounds like you might want to look at the ICloneable interface. In that case, you'd find the object in your list that you want to clone, create a new object that's a clone of it and add that new object to the list. Unless you are intending something else?
Matt Gerrans
|
|
|
|
|
Thank you. I should have realized.
A MyObject object has quite a bit of dynamic data in it, set by the user. I do not want to be assigned a reference of it to another object.
Like you guessed, I need to be copying all the data from the second object, into the first. Sometimes I want to create blank MyObject objects, and sometimes I want to create MyObject objects initialized with data from another object.
I always add that MyObject back into the ArrayList after it's been created.
Will the ICloneable interface work for that? I've never used an interface, though I know a very little bit about them. Where would I start with this?
Thanks.
|
|
|
|
|
If you like the Java idiom, then you can use the IClonable interface and its Clone() method. Your object just needs to implement clone and copy the important elements to the other object.
If you like C++ idioms better, you can overload the equal operator and your assignment would work more like you expected; rather than assign the reference to the other object (the default behavior), it could essentially ocpy the object's attributes (to whatever exent you want it to, of course, since you can implement the operator as you see fit).
Matt Gerrans
|
|
|
|
|
AFAIK, you can't overload the assignment operator. Even if you did, doesn't that go against the reference semantics that other objects follow?
How about making the OP's class a struct instead?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Unfortunetly, my MyObject class makes use of quite a few member functions - so it can't be a class.
|
|
|
|
|
budidharma wrote: so it can't be a class.
Did you mean it can't be a struct? structs can also have member functions, so you should be fine.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Oh yes, that's what I meant. I didn't know structs could have member functions.
In that case, what's the difference between a struct and a class?
I thought structs were simply structures of data, no member functions allowed.
|
|
|
|
|
This[^] might help you understand structs bettter.
Essentially, structs are passed around by value, classes by reference. For example
struct A
{
public int x;
}
class B
{
public int x;
}
static void Main()
{
A structInstance = new A();
structInstance.x = 1;
A structInstance1 = structInstance;
structInstance1.x = 20;
B classInstance = new B();
classInstance.x = 1;
B classInstance1 = classInstance;
classInstance1.x = 20;
}
After executing the above code, structInstance.x will be 1 and structInstance1.x will be 20. However, classInstance.x and classInstance1.x will be 20. What it means is that when you say A structInstance1 = structInstance; a new instance of A is created and contents are copied from structInstance. When B classInstance1 = classInstance; executes, classInstance1 and classInstance begin referring to the same instance of B, therefore, changing x using any of the two references gets reflected in both.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Well, thank you very much for explaining that to me. That makes perfect sense - and yes, you were correct. I merely need to change my class to a struct and it will work the way intended.
Thanks Again.
|
|
|
|
|
Right. I don't know what I was thinking.
So you're left with Clone().
Matt Gerrans
|
|
|
|
|