예제 #1
0
        public static void Run(string[] args)
        {
            #region Start
            Console.Title = "OpenYS PreRelease Script v1.0";
            Console.WriteLine(ConsoleColor.Cyan, "OpenYS PreRelease Script v1.0");
            Console.WriteLine();
            #endregion

            #region Update BuildVersion.txt
            //This Exe location is... $(SolutionDir)/__Executables/_-_Launcher/Bin/$(Config)/
            //We move back down towards $(SolutionDir), then climb into the utilities folder...
            string VersionFile = "../../../../_OpenYS-Library/Utilities/BuildVersion.txt";
            string Prefix      = "";
            string Suffix      = "";

            string[] Formatted = OYS_DateTime.ToOYSFormat(DateTime.Now);
            string[] BuildInfo = new string[] { Prefix + Formatted[0] + Formatted[1] + Formatted[2] + "(" + Formatted[3] + Formatted[4] + ")" + Suffix };

            Files.FileDelete(VersionFile);
            Files.FilePrepare(VersionFile);
            Files.FileAppend(VersionFile, BuildInfo);


            Console.WriteLine(ConsoleColor.DarkCyan, "Updated Build Version to: &b" + BuildInfo[0]);
            #endregion

            #region Terminate
            Console.WriteLine();
            Console.WriteLine(ConsoleColor.Cyan, "Press any key to continue...");
            Console.Reader.Abort();
            System.Console.ReadKey(true);
            System.Environment.Exit(0);
            #endregion
            return;
        }
예제 #2
0
 /// <summary>
 /// Logs the provided Exception as Error Output
 ///
 /// TO BE USED TO LOG Exceptions ONLY
 /// </summary>
 /// <param name="e">Exception to output</param>
 /// <returns>True if log successful</returns>
 public static bool Error(Exception e)
 {
     lock (Threads.GenericThreadSafeLock)
     {
         Directories.DirectoryPrepare("./Logs/");
         Directories.DirectoryPrepare("./Logs/ErrorLogs/");
         string LogFile = "./Logs/ErrorLogs/" + OYS_DateTime.ToOYSLongDateTime(TimeStarted).ReplaceAll("/", "_").ReplaceAll(" ", "_").ReplaceAll(":", "_") + ".html";
         Files.PrepareHTMLLog(LogFile);
         System.Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", "./Debug/");
         var    st     = new StackTrace(e, true);
         var    frame  = st.GetFrame(0);
         string output = "";
         output += "&cMESSAGE:      &e" + e.Message + "\n";
         output += "&cSTART TRACE:  \n";
         foreach (StackFrame Frame in st.GetFrames())
         {
             output += "&c    METHOD:       &e" + frame.GetMethod() + "\n";
             output += "&c        LINENUMBER:   &e" + frame.GetFileLineNumber() + "\n";
             output += "&c        COLUMNNUMBER: &e" + frame.GetFileColumnNumber() + "\n";
         }
         output += "&cEND TRACE.\n";
         output += "\n";
         List <string> MessagesOut = new List <string>();
         foreach (string Line in output.Split('\n'))
         {
             MessagesOut.Add(String.Format("{0}: {1}", OYS_DateTime.ToOYSLongDateTime(DateTime.Now), Line));
         }
         Files.FileHTMLAppend(LogFile, MessagesOut.ToArray());
     }
     return(true);
 }
예제 #3
0
        /// <summary>
        /// Logs the provided string as Console Output
        ///
        /// TO BE USED TO LOG CONSOLE OUTPUT ONLY
        /// </summary>
        /// <param name="Input">String to output</param>
        /// <returns>True if log successful</returns>
        public static bool ConsoleOutput(string Input, params object[] args)
        {
            if (args == null)
            {
                args = new object[0];
            }
            if (args.Length > 0)
            {
                try
                {
                    Input = String.Format(Input, args);
                }
                catch (Exception e)
                {
                    Input = e.StackTrace + "\n" + Input;
                }
            }

            lock (Threads.GenericThreadSafeLock)
            {
                Directories.DirectoryPrepare("./Logs/");
                Directories.DirectoryPrepare("./Logs/ConsoleLogs/");
                string LogFile = "./Logs/ConsoleLogs/" + OYS_DateTime.ToOYSLongDateTime(TimeStarted).ReplaceAll("(", "_").ReplaceAll(" ", "_").ReplaceAll(")", "_") + ".html";
                Files.PrepareHTMLLog(LogFile);
                string[] MessageOut = { String.Format("{0}: {1}", OYS_DateTime.ToOYSLongDateTime(DateTime.Now), Input) };
                Files.FileHTMLAppend(LogFile, MessageOut);
            }
            return(true);
        }
예제 #4
0
 /// <summary>
 /// Logs the provided string as a debug message
 ///
 /// TO BE USED TO LOG DEBUGGING OUTPUT ONLY
 /// (WHEN DEBUGGING WITH OPENYS PARTICIPANTS AND NOT ON LOCAL SYSTEM.)
 ///
 /// ****
 ///
 /// TO DEBUG ON LOCAL SYSTEM, USE INSTEAD DEBUG.WRITELINE() AND
 /// THE MESSAGE WILL BE OUTPUT TO VISUAL STUDIO OUTPUT FEED!
 ///
 /// ****
 /// </summary>
 /// <param name="Out">String to output</param>
 /// <returns>True if log successful</returns>
 public static bool Debug(string Out, params object[] args)
 {
     if (args == null)
     {
         args = new object[0];
     }
     if (args.Length > 0)
     {
         try
         {
             Out = String.Format(Out, args);
         }
         catch (Exception e)
         {
             Out = e.StackTrace + "\n" + Out;
         }
     }
     lock (Threads.GenericThreadSafeLock)
     {
         Directories.DirectoryPrepare("./Logs/");
         Directories.DirectoryPrepare("./Logs/DebuggingLogs/");
         string LogFile = "./Logs/DebuggingLogs/" + OYS_DateTime.ToOYSLongDateTime(TimeStarted).ReplaceAll("/", "_").ReplaceAll(" ", "_").ReplaceAll(":", "_") + ".html";
         Files.PrepareHTMLLog(LogFile);
         List <string> MessagesOut = new List <string>();
         MessagesOut.Add(String.Format("{0}: {1}", OYS_DateTime.ToOYSLongDateTime(DateTime.Now), Out));
         Files.FileHTMLAppend(LogFile, MessagesOut.ToArray());
     }
     return(true);
 }
예제 #5
0
 /// <summary>
 /// Logs the provided string as a Data Dump
 ///
 /// TO BE USED TO LOG DATA DUMPS FROM THE /DUMP COMMAND ONLY
 /// </summary>
 /// <param name="Out">String to output</param>
 /// <returns>True if log successful</returns>
 public static bool DataDump(string Input)
 {
     lock (Threads.GenericThreadSafeLock)
     {
         Directories.DirectoryPrepare("./Logs/");
         Directories.DirectoryPrepare("./Logs/DumpLogs/");
         string LogFile = "./Logs/DumpLogs/" + OYS_DateTime.ToOYSLongDateTime(DumpTime).ReplaceAll("/", "_").ReplaceAll(" ", "_").ReplaceAll(":", "_") + ".html";
         Files.PrepareHTMLLog(LogFile);
         String[] MessageOut = { String.Format("{0}: {1}", OYS_DateTime.ToOYSLongDateTime(DumpTime), Input) };
         Files.FileHTMLAppend(LogFile, MessageOut);
     }
     return(true);
 }
예제 #6
0
 /// <summary>
 /// Logs the provided Packets List as a Packet Log.
 ///
 /// TO BE USED TO LOG PACKETS ONLY
 /// </summary>
 /// <param name="Out">String to output</param>
 /// <returns>True if log successful</returns>
 public static bool Packets(List <string> Out)
 {
     lock (Threads.GenericThreadSafeLock)
     {
         Directories.DirectoryPrepare("./Logs/");
         Directories.DirectoryPrepare("./Logs/PacketLogs/");
         string LogFile = "./Logs/PacketLogs/" + OYS_DateTime.ToOYSLongDateTime(DateTime.Now).ReplaceAll("/", "_").ReplaceAll(" ", "_").ReplaceAll(":", "_") + ".html";
         Files.PrepareHTMLLog(LogFile);
         List <string> MessagesOut = new List <string>();
         foreach (string ThisString in Out)
         {
             MessagesOut.Add(String.Format("{0}: {1}", OYS_DateTime.ToOYSLongDateTime(DateTime.Now), ThisString));
         }
         Files.FileHTMLAppend(LogFile, MessagesOut.ToArray());
     }
     return(true);
 }