当前位置: 首页>>代码示例>>C#>>正文


C# FileInfo.AppendText方法代码示例

本文整理汇总了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();
    }
开发者ID:aminebenali,项目名称:dancing-cell-code,代码行数:28,代码来源:GestureTest.cs

示例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 ();
    }
开发者ID:ChuHaiLing,项目名称:UGUI_pro,代码行数:27,代码来源:SaveTest.cs

示例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;
    }
开发者ID:backspace229,项目名称:NUIMolecularModel,代码行数:31,代码来源:PrintPosition.cs

示例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 ();
				}
			}
开发者ID:oznetmaster,项目名称:SSMonoDiagnosticsLibrary,代码行数:29,代码来源:DefaultTraceListener.cs

示例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(); // 销毁流
	}
开发者ID:gmfnasg,项目名称:GGJ2016TaipeiTeamK,代码行数:35,代码来源:TestBehaviourScript.cs

示例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);
 }
开发者ID:satoaki131,项目名称:SlidePuzzle,代码行数:8,代码来源:DataStream.cs

示例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();
    }
开发者ID:k3foru,项目名称:CsvHelper,代码行数:10,代码来源:LogFIle.cs

示例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 ();
    }
开发者ID:HiromichiYamada,项目名称:YawDriftChecker,代码行数:11,代码来源:Debugger.cs

示例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();
 }
开发者ID:nosaj0926,项目名称:4takuhakase,代码行数:12,代码来源:data_backup.cs

示例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();
    }
开发者ID:coolyangzc,项目名称:IndirectGestureKeyboard,代码行数:14,代码来源:Touchscreen.cs

示例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();
 }
开发者ID:mail2chensh,项目名称:unityCode,代码行数:16,代码来源:ReadWriteFile.cs

示例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();
 }
开发者ID:xinwei2016,项目名称:test,代码行数:17,代码来源:GameScoreManager.cs

示例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;
 }
开发者ID:nai-r-olf,项目名称:EplanScriptingProjectBySuplanus,代码行数:18,代码来源:Eventlogger.cs

示例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);
	}
开发者ID:ziyihu,项目名称:Tower-Defence,代码行数:18,代码来源:InformationSave.cs

示例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();
    }
开发者ID:DormantDreams,项目名称:video-game-level-scanner,代码行数:20,代码来源:LevelSaving.cs


注:本文中的FileInfo.AppendText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。