Сообщения
Сообщения за февраль, 2016
C# обрезка символов в String
- Получить ссылку
- X
- Электронная почта
- Другие приложения
Обрезка текста из String var sub = "4.454878486468".Substring(5, sub.Leght - 5); // записать первые 5 сивола по последний string = string.Remove(3, 3)); // обрезает с 3 символа по 6 string.Replace("id=", ""); заменяет определённый текст на шаблон , заменяет везде (вначале, в середине, в конце) -------------------------- if (string.IndexOf("abcdef") == 0) // если содержит if (Query.text.StartsWith("abcdef")) // если начинается if (Query.text.EndsWith("abcdef")) // если заканчивается string.Trim(); // обрезает лишние символы пробелов // https://msdn.microsoft.com/ru-ru/library/t97s7bs3(v=vs.100).aspx string test = "ТестТест"; -> test = test.Insert(3, "Пример"); // вставит Пример между ТестТест -------------------------- string.ToLower(); // переводит в нижний регистр string.ToUpper(); // в верхний регистр
C# Get File Directory + all Catalogs
- Получить ссылку
- X
- Электронная почта
- Другие приложения
C# Get File in all Catalogs || Directory // File in all Catalogs || Directory var dirss = Directory.GetFiles(Path.Text, "*.*", SearchOption.AllDirectories); foreach (string file in dirss) { // listBox1.Items.Add(file.Replace(Path.Text + "\\", "")); // listBox1.Items.Add(file.Remove(0, Path.Text.Length + 1)); dataGridView1.Rows.Add(file.Replace(Path.Text + "\\", ""), file.Length); } // File Only Directory Leve2 v1 DirectoryInfo info = new DirectoryInfo(Path.Text); DirectoryInfo[] dirs = info.GetDirectories(); //FileInfo[] files = info.GetFiles(); foreach (DirectoryInfo level0 in dirs) { foreach (FileInfo file in level0.GetFiles()) { listBox1.Items.Add(level0 + "\\" + file); } } foreach (FileInfo file in info.GetFiles()) { listBox1.Items.Add(file); } // File Only Directory Leve2 v2 Di...
HTML 5 Startup JavaScript
- Получить ссылку
- X
- Электронная почта
- Другие приложения
HTML 5 Startup JavaScript v1.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript"> window.onload = function() { // Script } </script> </head> <body> // HTML </body> </html> v2.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript"> function FuncA() { // Script } </script> </head> <body onload="FuncA()"> // HTML </body> </html>
JavaScript edit onClick
- Получить ссылку
- X
- Электронная почта
- Другие приложения
JavaScript edit onClick onClick.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>JavaScript edit onClick</title> <script type="text/javascript"> function FunA() { var button = document.getElementById('A') button.id = 'idB' button.className = 'classB' button.setAttribute('onclick','FunB()') button.innerHTML = 'Выполнить FunB' } function FunB() { var button = document.getElementById('B') button.id = 'idA' button.className = 'classA' button.setAttribute('onclick','FunA()') button.innerHTML = 'Выполнить FunA' } </script> </head> <body> <button id="idA" class="classA" onclick="FunA()" >Выполнить FunA</button> </body> </html>
JavaScript jQuery edit onClick
- Получить ссылку
- X
- Электронная почта
- Другие приложения
JavaScript jQuery edit onClick jQuery.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <title>JQuery-замена onclick</title> <script type="text/javascript"> function f1() { $("#button").attr("onClick","f2()"); $("#div").css("display", "block"); } function f2() { $("#button").attr("onClick","f1()"); $("#div").css("display", "none"); } </script> </head> <body> <button id="b...
HTML 5 OpenFileDialog and FolderBrowserDialog
- Получить ссылку
- X
- Электронная почта
- Другие приложения
C# Rynosce Updater , WebClient , HttpWebRequest , HttpWebResponse , FileInfo
- Получить ссылку
- X
- Электронная почта
- Другие приложения
[C# Rynosce Updater] C# WebClient FileInfo and HttpWebRequest HttpWebResponse FileInfo using System ; using System.Net ; using System.IO ; using System.Windows.Forms ; using System.Globalization ; public class Update { public static string url = "http://127.0.0.1/update.exe" ; static Int64 thisSize, newSize ; static DateTime thisTime, newTime ; public static void Version1 ( ) { try { WebClient temp = new WebClient ( ) ; temp . OpenRead ( url ) ; newSize = Convert . ToInt64 ( temp . ResponseHeaders [ "Content-Length" ] ) ; newTime = DateTime . Parse ( temp . ResponseHeaders [ "Last-Modified" ] ) ; ...
C# Console Application FolderBrowserDialog and OpenFileDialog TopMost
- Получить ссылку
- X
- Электронная почта
- Другие приложения
C# Console Application Folder Browser Dialog and Open File Dialog TopMost using System.Threading; using System.Windows.Forms; [ STAThread ] static void Main ( string [ ] args ) { var threadFolderBrowserDialog = new Thread ( voidFolderBrowserDialog ) ; threadFolderBrowserDialog . IsBackground = true ; threadFolderBrowserDialog . SetApartmentState ( ApartmentState . STA ) ; threadFolderBrowserDialog . Start ( ) ; Console . WriteLine ( "Запуск выбора папки и файла в новом потоке" ) ; bool Exit = false ; while ( ! Exit ) { var exit = Console . ReadLine ( ) == "exit" ? Exit = true : Exit = false ; ...
C# CRC32
- Получить ссылку
- X
- Электронная почта
- Другие приложения
CRC32.cs using System; using System.Security.Cryptography; using System.IO; using System.Net; using System.Windows.Forms; public class CRC32 : HashAlgorithm { public const UInt32 DefaultPolynomial = 0xedb88320; public const UInt32 DefaultSeed = 0xffffffff; private UInt32 hash; private UInt32 seed; private UInt32[] table; private static UInt32[] defaultTable; public static string Start(string FilePath) { if (FilePath == string.Empty) FilePath = Application.ExecutablePath; CRC32 crc32 = new CRC32(); String result = string.Empty; try { using (FileStream fs = File.OpenRead(FilePath)) { foreach (byte b in crc32.ComputeHash(fs)) { result += b.ToString("x2").ToLower(); } return result; } } catch { return result; } } public CRC32() { table = Ini...
C# File Info
- Получить ссылку
- X
- Электронная почта
- Другие приложения
C# File Info static void FileInfo1 () { FileStream fs = File. OpenRead( Application .ExecutablePath); Console . WriteLine ( "FS.Length: " + fs.Length ); } static void FileInfo2 () { DateTime GetCreationTime = File . GetCreationTime ( Application . ExecutablePath ); Console . WriteLine ( "GetCreationTime: " + GetCreationTime ); DateTime GetLastWriteTime = File . GetLastWriteTime ( Application . ExecutablePath ); Console . WriteLine ( "GetLastWriteTime: " + GetLastWriteTime ); DateTime GetLastAccessTime = File . GetLastAccessTime ( Application . ExecutablePath ); Console . WriteLine ( "GetLastAccessTime: " + GetLastAccessTime ); } static void FileInfo3 () { FileInfo file = new FileInfo ( Application . ExecutablePath ); Console . WriteLine ( "File Info: " + file ); Console . WriteLine ( "File Length: " + file. Length ); Con...
Смайлики из текста
- Получить ссылку
- X
- Электронная почта
- Другие приложения
Наткнулся на интересную статью о смайликах из текста : Happy Kaomojis (●´∀`●) (`・ω・´)” ヽ(;▽;)ノ ヽ(;▽;)ノ (*´・v・) (((o(*゚▽゚*)o))) ☆*:.。. o(≧▽≦)o .。.:*☆ (⌒▽⌒)☆ ⊂((・▽・))⊃ (≧∇≦)/ (´∇ノ`*)ノ (・◇・) ( ´ ▽ ` )ノ (^_^) ( ̄ー ̄) (*^▽^*) (^▽^) (’-’*) ∩( ・ω・)∩ (*≧▽≦) \(^ ^)/ O(≧∇≦)O ( ´∀`) (^~^) \(@ ̄∇ ̄@)/ (☆^O^☆) (★^O^★) (☆^ー^☆) (´ω`★) \(T∇T)/ ヽ(*≧ω≦)ノ *(*´∀`*)☆ O(≧▽≦)O ヽ(*⌒∇⌒*)ノ d=(´▽`)=b \(*T▽T*)/ ヽ(‘ ∇‘ )ノ (*^ワ^*) ヽ(^Д^)ノ (´∀`) (°◇°;) (゜▽゜;) (/^▽^)/ (ノ´ー`)ノ ヽ(´ー`)ノ ( ^∇^) \( `.∀´)/ (●⌒∇⌒●) o(≧∇≦o) ヽ(`◇´)/ ヽ(*・ω・)ノ (^ω^) 。◕‿◕。 ⊙ω⊙ ⊙△⊙ ⊙▽⊙ o (◡‿◡✿) (◕‿◕✿) (∩_∩) 。◕‿◕。 (•ิ_•ิ) (/•ิ_•ิ)/ (ΦωΦ) (*^^*) (^⊆^) (-^〇^-) (ノ*゜▽゜*) ヾ(´▽`;)ゝ (゜▼゜*) ( ̄个 ̄) \(^▽^@)ノ (“⌒∇⌒”) へ(゜∇、°)へ (-^〇^-) (>y<) ヽ(^。^)丿 ...