This file contains hidden or 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 void WriteToFile(string filePath, List<Honda2ObjFinal> list) | |
{ | |
string json = JsonConvert.SerializeObject(list, Formatting.Indented); | |
// cái đoạn code dùng StreamWriter này éo biết vì sao sẽ hỏng đi 300 line cuối cùng. | |
//FileStream fs = new FileStream(filePath, FileMode.CreateNew); | |
//Encoding utf8WithoutBom = new UTF8Encoding(false); | |
//StreamWriter sw = new StreamWriter(fs, utf8WithoutBom); | |
//sw.Write(json); |
This file contains hidden or 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 class FileDirChecker | |
{ | |
public bool isDirectory(string path) | |
{ | |
bool ret = false; | |
// get the file attributes for file or directory | |
FileAttributes attr = File.GetAttributes(path); | |
if (attr.HasFlag(FileAttributes.Directory)) | |
ret = true; |
This file contains hidden or 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 class FileDirChecker | |
{ | |
public bool isDirectory(string path) | |
{ | |
bool ret = false; | |
// get the file attributes for file or directory | |
FileAttributes attr = File.GetAttributes(path); | |
if (attr.HasFlag(FileAttributes.Directory)) | |
ret = true; |
This file contains hidden or 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
/// <summary> | |
/// Provides methods for Serialization and Deserialization of XML/Extensible Markup Language documents. | |
/// </summary> | |
public class XmlSerialization | |
{ | |
/// <summary> | |
/// Serializes an object to an XML/Extensible Markup Language string. | |
/// </summary> | |
/// <typeparam name="T">The type of the object to serialize.</typeparam> | |
/// <param name="value">The object to serialize.</param> |
This file contains hidden or 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
/// <summary> | |
/// Provides methods for Serialization and Deserialization of JSON/JavaScript Object Notation documents. | |
/// </summary> | |
public class JsonSerialization | |
{ | |
/// <summary> | |
/// Serializes an object to a JSON/JavaScript Object Notation string. | |
/// </summary> | |
/// <typeparam name="T">The type of the object to serialize.</typeparam> | |
/// <param name="value">The object to serialize.</param> |
This file contains hidden or 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
For i=1 to n { // file count là n=1000 | |
Xử lí file thứ i | |
Hiển thị label "1/n đang dc xử lí" | |
Application.DoEvents(); | |
} |
This file contains hidden or 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
using DAL; | |
using Emgu.CV; | |
using Emgu.CV.CvEnum; | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; |
This file contains hidden or 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
static void DirSearch(string sDir) | |
{ | |
try | |
{ | |
foreach (string d in Directory.GetDirectories(sDir)) | |
{ | |
foreach (string f in Directory.GetFiles(d)) | |
{ | |
Console.WriteLine(f); | |
} |
This file contains hidden or 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
IEnumerable<SomeType> data = ... | |
DataTable table = new DataTable(); | |
using(var reader = ObjectReader.Create(data)) { | |
table.Load(reader); | |
} | |
IEnumerable<SomeType> data = ... | |
DataTable table = new DataTable(); | |
using(var reader = ObjectReader.Create(data, "Id", "Name", "Description")) { | |
table.Load(reader); |
This file contains hidden or 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
DataView dv; | |
dv = new DataView(ds.Tables[0], "type = 'business' ", "type Desc", DataViewRowState.CurrentRows); | |
dataGridView1.DataSource = dv; |