Ejemplo n.º 1
0
        public static void WriteEndscriptLine(string line)
        {
            if (!File.Exists(EndFileDir))
            {
                Properties.Settings.Default.EnableEndscriptLog = false;
            }
            if (Properties.Settings.Default.EnableEndscriptLog)
            {
                try
                {
                    FileStream   ModStream;
                    StreamWriter ModWriter;

                    ModStream = File.Open(EndFileDir, FileMode.Append, FileAccess.Write);
                    ModWriter = new StreamWriter(ModStream);
                    ModWriter.WriteLine(line);
                    ModWriter.Close();
                    ModWriter.Dispose();
                    ModStream.Dispose();
                }
                catch (Exception)
                {
                    Properties.Settings.Default.EnableEndscriptLog = false;
                }
            }
        }
Ejemplo n.º 2
0
        public static void CreateEndscriptFile(string filename)
        {
            EndFileDir = filename;
            try
            {
                bool         NewFileMake = !File.Exists(EndFileDir);
                FileStream   ModStream;
                StreamWriter ModFile;

                if (Properties.Settings.Default.EnableStaticEnd || NewFileMake)
                {
                    ModStream = File.Open(EndFileDir, FileMode.Create);
                    ModFile   = new StreamWriter(ModStream);

                    ModFile.WriteLine("// Binary Endscript File");
                    ModFile.WriteLine("// File created on: " + DateTime.Now.ToString());
                    ModFile.WriteLine("// ------------------------------------------------------------------------------");

                    ModFile.Close();
                    ModFile.Dispose();
                    ModStream.Dispose();
                }
                else
                {
                    ModStream = File.Open(EndFileDir, FileMode.Append, FileAccess.Write);
                    ModFile   = new StreamWriter(ModStream);

                    ModFile.WriteLine("");
                    ModFile.WriteLine("");
                    ModFile.WriteLine("");
                    ModFile.WriteLine("// ------------------------------------------------------------------------------");
                    ModFile.WriteLine("// File continued on: " + DateTime.Now.ToString());
                    ModFile.WriteLine("// ------------------------------------------------------------------------------");

                    ModFile.Close();
                    ModFile.Dispose();
                    ModStream.Dispose();
                }
            }
            catch (Exception) { }
        }