Ejemplo n.º 1
0
 void WriteFile(PlayerInfo info, string data)
 {
     if (info.writer != null)
         info.writer.WriteLine(data);
     else
         info.AddLog("debug", "WriteFile: info.writer = null");
 }
Ejemplo n.º 2
0
 void CloseFile(PlayerInfo info)
 {
     if (info.writer != null)
     {
         info.writer.WriteLine(info.writer.NewLine);
         info.writer.Close();
         info.writer = null;
     }
     else
         info.AddLog("debug", "WriteFile: info.writer = null");
 }
Ejemplo n.º 3
0
    void OpenFile(PlayerInfo info, string filename, bool overwrite)
    {       
#if SERVER_BUILD
        if (overwrite == true)
        {
            string test = info.filePath + "/" + info.userid + "-" + info.sessionid + "-" + filename;
            info.writer = System.IO.File.CreateText(test);
            info.AddLog("debug", "OpenFile(overwrite:=" + test + ")");
        }
        else
        {
            // get extension
            string extention = Path.GetExtension(filename);

            // make filename
            filename = Path.GetFileNameWithoutExtension(filename);

            int i = 0;
            while (true)
            {
                string test = info.filePath + "/" + info.userid + "-" + info.sessionid + "-" + filename + "-" + i.ToString() + extention;
                if (!File.Exists(test))
                {
                    info.AddLog("debug", "OpenFile(test=" + test + ")");
                    info.writer = File.CreateText(test);
                    break;
                }
                i++;
            }
        }
#endif
    }