C # write a good resource manager

Source: Internet
Author: User

The icon for getting the file is that I used the class of someone else and still don't understand me at the learning stage:

Create folder

 

String wnapt = combbb. Text + "\" + "new folder ";
Int I = 0;
String newpath = wnapt;
While (directory. exists (newpath ))
{

Newpath = wnapt + I. tostring ();
I ++;
}
Directory. createdirectory (newpath );
CC (New directoryinfo (combbb. Text. tostring ()));

 

 

 

 

 

 

 

 

Also, copy, paste, and cut are simple. I will not write the source code ··

 

There is also a feature of some diaries, which is actually very simple. There are still many bugs that haven't been written yet ··

It is to write the text to the class and save it as a file ··

 

// Save the text to the class. Save the Class Writer file.
Private void savetoolstripmenuitem_click (Object sender, eventargs E)
{
String name = application. startuppath + @ "\ ntobook" + "\" + "riji ";
Int I = 0;
String nname = Name;
While (file. exists (nname ))
{
Nname = Name + I. tostring ();
I ++;
}
Wang W = new Wang (textbox1.text );
Filestream FS = new filestream (nname, filemode. Create, fileaccess. Write );
Binaryformatter BF = new binaryformatter ();
BF. serialize (FS, W );
FS. Close ();
Notbook ();


}
[Serializable]
Public class Wang
{
Public Wang (string txt)
{

This. txt = txt;

}

String txt;

Public String txt
{
Get {return txt ;}
Set {TXT = value ;}
}

}


 

The most interesting thing is renaming. I have read many methods on the Internet, such as using file. Move ··

 

I use cmd, haha ·

 

 

Private void rename toolstripmenuitem_click (Object sender, eventargs E)
{
Listview1.labeledit = true;
Listview1.selecteditems [0]. beginedit (); // You can edit it when you click rename.

}

Private void listviewappsafterlabeledit (Object sender, labelediteventargs E)
{// In this event
// After editing .. Run cmd to get the name.
Process. start ("cmd", "/C" + "Ren" + listview1.selecteditems [0]. tag. tostring () + "" + E. label. tostring () + "");

}


 

I learned C # the code I wrote was not long ago. Sorry ······

 

 

Source program download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.