Geeks With Blogs

News
WinToolZone - Spelunking Microsoft Technologies
I work as a developer on the Common Language Runtime (CLR) team, specifically in the areas of exception handling and CLR hosting.
Disclaimer

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Inside and Out... An attempt to understand technology better...

I am nearing the completion of implementing the CEFile class that will represent a file on the Windows CE device:


CEFile file =
new CEFile("\\My documents\\myfile.txt");

Once the object is created, we can get various details of the file, like its attributes, size, amongst other things. Also, we can move or copy the file within the device or to the desktop. In addition, functionality has been added to launch the object. The Launch method of CEFile will attempt to open the file present on the device using the shell file-type associations. Below is a snippet as to how the CEFile object can be worked upon:

Console.WriteLine("Filename: {0}",file.Path); // complete path including the file name

Console.WriteLine("Folder: {0}",file.Folder);

Console.WriteLine("File: {0}",file.Filename); // only the file name

Console.WriteLine("Archive: {0}",file.IsArchive.ToString());

Console.WriteLine("Created on: {0}",file.CreationTime.ToString());

Console.WriteLine("LastAccessed on: {0}",file.LastAccessTime.ToString());

Console.WriteLine("LastWritten on: {0}",file.LastWriteTime.ToString());

Console.WriteLine("Size: {0}",file.Size.ToString());

Console.WriteLine("OID on: {0}",file.OID.ToString());

Console.WriteLine("LaunchFile: {0}",file.Launch().ToString());

Console.WriteLine("CopyToDesktop: {0}",file.CopyTo(CEFileSystemDestination.ToDesktop,

"c:\\"+arrFiles[0]).ToString());

Console.WriteLine("MoveFile:{0}",file.MoveTo(CEFileSystemDestination.WithinDevice,

rootFolder.Path+"\\Newfile.txt").ToString());

Console.WriteLine("DeleteFile: {0}",file.Delete());


Hopefully, by the end of this week, I will be able to release the updated component :)

Posted on Thursday, March 3, 2005 9:48 AM VS.NET 2002/2003 , .NET Compact Framework , Embedded Development | Back to top


Comments on this post: CERapi - Working with files using CEFile

# re: CERapi - Working with files using CEFile
Requesting Gravatar...
Any way to figure out why a false would be returned? Other than the obvious of course. I am simply trying to move it to the application on the desktop's path. Code is:
CEFile f = new CEFile(cef.Path + "\\" + file);
string s = Application.StartupPath + "\\temp\\" + folders[0];
bool b = f.MoveTo(CEFileSystemDestination.ToDesktop, s);
if (!b)
MessageBox.Show("Move of file did not succeed");
Left by David White on Jul 03, 2005 5:13 AM

Your comment:
 (will show your gravatar)


Copyright © Gaurav Khanna | Powered by: GeeksWithBlogs.net