Beispiel #1
0
        private static int Main()
        {
            string executableName = Program.GetExecutableName();

            try
            {
                SOP.ResultCodes resultCodes1 = SOP.SOP_RemoveProfile("FEZ");
                SOP.ResultCodes resultCodes2 = SOP.SOP_SetProfile("FEZ", executableName);
                if (!Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FEZ")))
                {
                    Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FEZ"));
                }
                using (FileStream fileStream = File.Open(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FEZ\\Debug Log.txt", FileMode.Append))
                {
                    using (StreamWriter streamWriter = new StreamWriter((Stream)fileStream))
                    {
                        streamWriter.WriteLine("({0}) [{1}] {2}", (object)DateTime.Now.ToString("HH:mm:ss.fff"), (object)"Optimus Fix", (object)string.Concat(new object[4]
                        {
                            (object)"SOP_Remove returned ",
                            (object)resultCodes1,
                            (object)" for ",
                            (object)executableName
                        }));
                        streamWriter.WriteLine("({0}) [{1}] {2}", (object)DateTime.Now.ToString("HH:mm:ss.fff"), (object)"Optimus Fix", (object)string.Concat(new object[4]
                        {
                            (object)"SOP_Set returned ",
                            (object)resultCodes2,
                            (object)" for ",
                            (object)executableName
                        }));
                    }
                }
            }
            catch (Exception ex)
            {
                using (FileStream fileStream = File.Open(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FEZ\\Debug Log.txt", FileMode.Append))
                {
                    using (StreamWriter streamWriter = new StreamWriter((Stream)fileStream))
                        streamWriter.WriteLine("({0}) [{1}] {2}", (object)DateTime.Now.ToString("HH:mm:ss.fff"), (object)"Optimus Fix", (object)string.Concat(new object[4]
                        {
                            (object)"SOP raised exception : ",
                            (object)ex,
                            (object)" for ",
                            (object)executableName
                        }));
                }
            }
            return(0);
        }