This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string str=@".....文件路径........"; | |
Path.GetFileName(Str)//返回文件名 | |
Path.GetFileNameWithoutExtension(Str)//返回文件名且没扩展名 | |
Path.GetExtension()//获得扩展名 | |
Path.GetDirectoryName()//获得所在文件夹的名称,就是去除文件名的部分 | |
Path.GetFullPath()//从 获得所在文件的全路径,支持..\a\b的方式获得路径 | |
Path.Combine(string,string)//连接两个字符串,自动处理路径分隔符的问题自动增加 \ | |
string path=Application.StartupPath获得exe文件所在路径 | |
string ChangeExtension(string path, string extension)//修改扩展名 | |
Path.GetTempPath()//获得临时文件夹目录 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T DeepClone<T>(T obj) | |
{ | |
using (var ms = new MemoryStream()) | |
{ | |
var formatter = new BinaryFormatter(); | |
formatter.Serialize(ms, obj); | |
ms.Position = 0; | |
return (T) formatter.Deserialize(ms); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"mystring".replace(/someString/g,"otherString") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -m SimpleHTTPServer 80 | |
python.exe -m http.server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
│ cmdutils.h | |
│ config.h | |
│ ffmpeg.h | |
│ | |
├─compat | |
│ │ getopt.c | |
│ │ os2threads.h | |
│ │ strtod.c | |
│ │ va_copy.h | |
│ │ w32pthreads.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).keydown(function (e) { | |
if (e.ctrlKey & e.keyCode == 83) { | |
toastr.success('', '保存成功', { positionClass: "toast-bottom-right" }) | |
e.preventDefault(); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hasClass( elements,cName ){ | |
return !!elements.className.match( new RegExp( "(\\s|^)" + cName + "(\\s|$)") ); | |
}; | |
function addClass( elements,cName ){ | |
if( !hasClass( elements,cName ) ){ | |
elements.className += " " + cName; | |
}; | |
}; | |
function removeClass( elements,cName ){ | |
if( hasClass( elements,cName ) ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ("createEvent" in document) { | |
var evt = document.createEvent("HTMLEvents"); | |
evt.initEvent("change", false, true); | |
element.dispatchEvent(evt); | |
} | |
else | |
element.fireEvent("onchange"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool IsPortOpen(string host, int port, TimeSpan timeout) | |
{ | |
try | |
{ | |
using (var client = new TcpClient()) | |
{ | |
var result = client.BeginConnect(host, port, null, null); | |
var success = result.AsyncWaitHandle.WaitOne(timeout); | |
if (!success) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet("mobile/{*urlParams}")] | |
[HttpGet("msg/{*urlParams}")] | |
public IActionResult RedirecToNewUrl(string urlParams) | |
{ | |
var encodedStrBuilder=new StringBuilder(); | |
foreach (var fragment in urlParams.Split('/')) | |
{ | |
encodedStrBuilder.AppendFormat("{0}/", TryUrlEncode(fragment)); | |
} | |
encodedStrBuilder.Remove(encodedStrBuilder.Length - 1, 1); |
OlderNewer