本文整理汇总了C#中FileInfo.AppendText方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.AppendText方法的具体用法?C# FileInfo.AppendText怎么用?C# FileInfo.AppendText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileInfo
的用法示例。
在下文中一共展示了FileInfo.AppendText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveJson
public void SaveJson(string txt)
{
string path=Application.dataPath+"//Resource//";
path = "./Assets/Resources/TXT/Edit_NewGesture.txt";
string file = path;
StreamWriter sw;
FileInfo t = new FileInfo(file);
if(!t.Exists)
{
// Debug.LogError("SaveJson1: " + path);
sw = t.CreateText();
}
else
{
//Debug.LogError("SaveJson2: " + path);
sw = t.AppendText();
}
sw.WriteLine(txt);
sw.Close();
sw.Dispose();
}
示例2: CreateFile
//
void CreateFile(string sPath, string sName, string sInfo)
{
// 文件流信息
StreamWriter sw;
FileInfo t = new FileInfo (sPath + "//" + name);
if (!t.Exists)
{
// 如果此文件不存在創建
sw = t.CreateText ();
}
else
{
// 如果此文件存在,則打開該文件
sw = t.AppendText();
}
//以行的形式寫入信息
sw.WriteLine (sInfo);
// 關閉流
sw.Close ();
// 銷毀流
sw.Dispose ();
}
示例3: ExportPosition
// 1オブジェクトごとに書き出し
int ExportPosition(GameObject obj, int ReferLine)
{
// メモリストリーム作成
FileInfo fi = new FileInfo(PATH);
using (StreamWriter sw = fi.AppendText())
//using (StreamWriter sw = new StreamWriter(PATH))
{
//
if (0 == ReferLine)
{
sw.WriteLine("");
sw.Write("Export_" + exportXYZ.nowtime + ".xyz");
}
float x, y, z;
x = obj.transform.position.x;
y = obj.transform.position.y;
z = -(obj.transform.position.z);
// //if 入れる
sw.Write("\n" +
obj.name + " " +
x.ToString() + " " +
y.ToString() + " " +
z.ToString()
);
sw.Close();
}
return ++ReferLine;
}
示例4: WriteLogFile
private void WriteLogFile (string message, string logFile)
{
string fname = logFile;
if (string.IsNullOrEmpty (fname))
return;
FileInfo info = new FileInfo (fname);
StreamWriter sw;
// Open the file
try
{
if (info.Exists)
sw = info.AppendText ();
else
sw = info.CreateText ();
}
catch
{
// We weren't able to open the file for some reason.
// We can't write to the log file; so give up.
return;
}
using (sw)
{
sw.Write (message);
sw.Flush ();
}
}
示例5: fnCreateFile
void fnCreateFile()
{
StreamWriter t_sStreamWriter; // 文件流信息
FileInfo t_fFileInfo = new FileInfo(Application.dataPath + "//" + "儀式的條件.txt");
if (!t_fFileInfo.Exists)
{
t_sStreamWriter = t_fFileInfo.CreateText();
// 如果此文件不存在则创建
}
else
{
t_sStreamWriter = t_fFileInfo.AppendText(); // 如果此文件存在则打开
}
for(int i=0 ; i < 6 ; i++)
{
t_sStreamWriter.Write("第");
t_sStreamWriter.Write((i+1).ToString());
t_sStreamWriter.WriteLine("組");
t_sStreamWriter.WriteLine(@"------------------------------------------------------");
for(int j = 0 ; j < 3 ; j++)
{
t_sStreamWriter.WriteLine(Objlist[j+i*3]);
}
t_sStreamWriter.Write("拿取");
t_sStreamWriter.WriteLine(Targetlist[i]);
t_sStreamWriter.WriteLine(@"------------------------------------------------------");
}
// 以行的形式写入信息
t_sStreamWriter.Close(); //关闭流
t_sStreamWriter.Dispose(); // 销毁流
}
示例6: WriteFile
public void WriteFile(string text)
{
FileInfo fi = new FileInfo(Application.dataPath + "/Data/Data.txt");
if (fi == null) return;
using (StreamWriter sw = fi.AppendText())
sw.WriteLine(text);
Debug.Log(text);
}
示例7: ResultLog
public void ResultLog(String csvURL, String browserURL, String expectedURL, String textResult)
{
var outtxt = new FileInfo(LogLocation);
var logline = outtxt.AppendText();
logline.WriteLine("{0},{1},{2},{3}", csvURL, browserURL, expectedURL, textResult);
// flush and close file.
logline.Flush();
logline.Close();
}
示例8: Start
// Use this for initialization
void Start()
{
fileInfo = new FileInfo (Application.dataPath + "/Log.csv");
Debug.Log (Application.dataPath + "/Log.csv");
writer = fileInfo.AppendText ();
DateTime thisDay = DateTime.Now;
writer.WriteLine("Start, {0}", thisDay.ToString("G"));
writer.Flush ();
}
示例9: write
// 書き込み
public void write(string text)
{
//FileInfo fi = new FileInfo(Application.dataPath+"/test.txt");
FileInfo fi = new FileInfo("/sdcard/external_sd/data/test.txt");
//write
StreamWriter sw = fi.AppendText();
//sw.Write(text); // 未改行
sw.WriteLine(text); // 改行
sw.Flush();
sw.Close();
}
示例10: CreateFile
void CreateFile(string Path, string name, string info)
{
StreamWriter sw;
FileInfo t = new FileInfo(Path + "//" + name);
if (!t.Exists)
sw = t.CreateText();
else
sw = t.AppendText();
debugInfo.text = t.FullName;
sw.WriteLine(info);
sw.Close();
sw.Dispose();
}
示例11: writeContent
void writeContent(string filePath, string fileName, string content)
{
StreamWriter swrite;
FileInfo file = new FileInfo(filePath + "//" + fileName);
if (!file.Exists)
{
swrite = file.CreateText();
}
else
{
swrite = file.AppendText();
}
swrite.WriteLine(content);
swrite.Close();
swrite.Dispose();
}
示例12: CreateDoc
public void CreateDoc(string path, string name, string info)
{
StreamWriter sw;
FileInfo f = new FileInfo(path + "\\" + name);
if (!f.Exists)
{
sw = f.CreateText();
}
else
{
sw = f.AppendText();
}
//EncryptString(info, 4);
sw.WriteLine(info);
sw.Close();
sw.Dispose();
}
示例13: MyEventHandlerFunction2
public long MyEventHandlerFunction2(IEventParameter iEventParameter)
{
try
{
EventParameterString oEventParameterString = new EventParameterString(iEventParameter);
String strActionName = oEventParameterString.String;
StreamWriter sw;
FileInfo fi = new FileInfo(@"C:\Test\Events.txt");
sw = fi.AppendText();
sw.WriteLine("oCLI.Execute(\"onActionEnd.String.{0}\");", strActionName);
sw.Close();
}
catch (InvalidCastException exc)
{
System.Windows.Forms.MessageBox.Show("Parameter error: " + exc.Message, "MyEventHandler");
}
return 0;
}
示例14: CreateAndWriteDoc
void CreateAndWriteDoc(string s){
StreamWriter sw;
string path = Application.dataPath+"/TechTree.txt";
FileInfo t = new FileInfo (path);
if (!t.Exists) {
sw = t.CreateText();
} else {
sw = t.AppendText();
}
sw.WriteLine (s);
sw.Close ();
sw.Dispose ();
// FileStream myFileStream = new FileStream (path, FileMode.OpenOrCreate);
// myChar = s.ToCharArray ();
// Encoder myEncoder = Encoding.UTF8.GetEncoder ();
// myEncoder.GetBytes (myChar, 0, myChar.Length, myByte, 0, true);
// myFileStream.Write (myByte, 0, myByte.Length);
}
示例15: SaveFile
public void SaveFile(FileInfo file)
{
JsonBuilder = new StringBuilder();
JsonBuilder.AppendLine("{");
AppendName(JsonBuilder);
AppendDate(JsonBuilder);
AppendMatrix(JsonBuilder);
AppendHeight(JsonBuilder);
AppendWidth(JsonBuilder);
AppendRooms(JsonBuilder);
AppendDoors(JsonBuilder);
JsonBuilder.AppendLine("}");
var fileStream = file.AppendText();
fileStream.Write(JsonBuilder.ToString());
fileStream.Close();
}