public void TestWriteAfterDisposeShouldNotThrow()
        {
            var target = new TextWriterTraceListener(_stream);
            target.Dispose();

            target.WriteLine(TestMessage);
            target.Write(TestMessage);
            target.Flush();
        }
        public void TestWriteLine()
        {
            using (var target = new TextWriterTraceListener(_stream))
            {
                target.WriteLine(TestMessage);
            }

            string expected = TestMessage + Environment.NewLine;
            Assert.Contains(expected, File.ReadAllText(_fileName));
        }
 private void TraceBejegyzes(string msg)
 {
     myListener.WriteLine("-" + DateTime.Now + ": " + msg);
     myListener.Flush();
     myListener.Close();
 }
示例#4
0
 public override void WriteLine(string message)
 {
     textTraceListener.WriteLine(message);
 }
示例#5
0
 public static void EmptyLine() => _textWriterTraceListener.WriteLine("");
示例#6
0
        /// <summary>
        /// Debug message - with format
        /// </summary>
        /// <param name="strFormat">String format</param>
        /// <param name="args">Parameter list</param>
        public virtual void Debug(string strFormat, params object[] args)
        {
            StringBuilder msgDebug = new StringBuilder();

            try
            {
                lock (debugListener)
                {
                    if (debugListener != null)
                    {
                        if (debugEnabled)
                        {
                            msgDebug.Append(GetMessage(Priority.DEBUG, ""));
                            if (this.GetParamCount(strFormat) != 0)
                            {
                                msgDebug.AppendFormat(strFormat, args);
                            }
                            else
                            {
                                msgDebug.Append(strFormat);
                            }

                            debugListener.WriteLine(msgDebug.ToString());
                            debugListener.Flush();
                        }
                    }
                }
            }
            catch (Exception)
            {
                debugListener = null;
            }
        }
示例#7
0
 /// <summary>
 /// Write a new entry to the application log file.
 /// </summary>
 /// <param name="format"></param>
 /// <param name="args"></param>
 public static void Log(string format, params object[] args)
 {
     listener.WriteLine("[" + DateTime.Now + "]  " + string.Format(format, args));
 }
 private void TraceBejegyzes(string msg)
 {
     myListener.WriteLine("Tagsági okiratok rögzítése - " + DateTime.Now + ": " + msg);
     myListener.Flush();
     myListener.Close();
 }
示例#9
0
 public void WriteLineToLog(string str)
 {
     traceLog.WriteLine(str);
 }
示例#10
0
 public void WriteLineToLog(string str)
 {
     debugLog.WriteLine(str);
 }
示例#11
0
    // Update is called once per frame
    void LateUpdate()
    {
        if (VRCenter.VRPresent)
        {
            Quaternion quatRot = VRCenter.rotation;
            Vector3    vecPos  = VRCenter.position;

            Vector3 currHeadRot = headTransform.localRotation.eulerAngles;

            // output to listener

            //float scale = 0.1f;
            Vector3 optionalRigPosOffset = new Vector3(0, 0, 1);
            Vector3 optionalRigRotation  = new Vector3(0, 180, 0);
            Vector3 recRigPosOffset      = new Vector3(0, 0.055f, 0.1f);

            rotationNeeded = quatRot.eulerAngles;
            positionNeeded = vecPos;


            //camFindTransform.localPosition = -positionNeeded + (recRigPosOffset)/scale;


            //spineTransform.localRotation = Quaternion.Euler(Mathf.Atan(positionNeeded.z / distSpineToHead) / Mathf.PI * 180.0f, spineTransform.localRotation.eulerAngles.y, Mathf.Atan(positionNeeded.x / distSpineToHead) / Mathf.PI * 180.0f);

            riftZ = positionNeeded.z;
            riftY = positionNeeded.y + distHipsToHead;

            h = Mathf.Abs(distHipsToNeck - riftY);
            k = riftY - h - distHipsToSpine;


            p = Mathf.Sqrt(Mathf.Abs(Mathf.Pow(distSpineToNeck, 2) - Mathf.Pow(k, 2)));
            q = riftZ - p;

            //UnityEngine.Debug.Log("h: " + h + ", k: " + k + ", p: " + p + ", q: " + q );
            //UnityEngine.Debug.Log("vecposz: " + vecPos.z);

            rotSpine = Mathf.Acos(k / distSpineToNeck) * Mathf.Rad2Deg;
            rotNeck  = Mathf.Atan2(q, h) * Mathf.Rad2Deg;

            //UnityEngine.Debug.Log("spine: " + rotSpine);
            //UnityEngine.Debug.Log("neck: " + rotNeck);

            //spineTransform.localRotation = Quaternion.Euler(new Vector3(/*spineTransform.localRotation.eulerAngles.x*/0, spineTransform.localRotation.eulerAngles.y, rotSpine/* - 90*/));
            //neckTransform.localRotation = Quaternion.Euler(new Vector3(rotNeck + 90, neckTransform.localRotation.eulerAngles.y, neckTransform.localRotation.eulerAngles.z));

            // Possibly subtract/add sum of above rotations to headTransform


            cameraRigTransform.localRotation = Quaternion.Euler(-rotationNeeded /*+ optionalRigRotation*/);
            rotationNeeded.Set(rotationNeeded.x, rotationNeeded.y /*- rotNeck - rotSpine*/, rotationNeeded.z);
            headTransform.localRotation = Quaternion.Euler(/*initHeadRot +*/ currHeadRot + rotationNeeded);
            //cameraRigTransform.localPosition = -positionNeeded /*+ optionalRigPosOffset*/ + recRigPosOffset;

            //cameraRigTransform.localPosition = rigPos;
            //UnityEngine.Debug.Log(distSpineToHead);
            //UnityEngine.Debug.Log("HeadPos: " + vecPos);

            if (logging)
            {
                listener.WriteLine("HeadRotQuat: " + quatRot + ", HeadRotAngles: " + quatRot.eulerAngles);
                listener.WriteLine("HeadPos: " + vecPos);
                listener.WriteLine("CamRotQuat: " + cameraTransform.localRotation + ", CamRotAngles: " + cameraTransform.localRotation.eulerAngles);
                listener.WriteLine("CamPos: " + cameraTransform.localPosition);
                listener.WriteLine("spineRotQuat: " + spineTransform.localRotation + ", spineRotAngles: " + spineTransform.localRotation.eulerAngles + ", distSpineToNeck: " + distSpineToNeck);
            }

            /*if (Input.GetButtonDown("LeftShoulder"))
             * {
             *  listener.WriteLine("----Looking Directly Left---");
             * }*/

            if (Input.GetButtonDown("LeftShoulder") && logging)
            {
                listener.WriteLine("----Leaning forward---");
            }


            if (Input.GetButtonDown("LeftShoulder"))
            {
                VRCenter.Recenter();
                listener.WriteLine("---Recentering InputTracking---");
            }
        }
    }
示例#12
0
        public override void Execute()
        {
            string tmpPath       = Path.Combine(@"E:\Temp\", Guid.NewGuid().ToString());
            string uncookPath    = Path.Combine(tmpPath, "Uncook");
            string uncookLogPath = Path.Combine(tmpPath, "Uncook.txt");
            string cookingPath   = Path.Combine(tmpPath, "Cooking");

            if (!Directory.Exists(tmpPath))
            {
                Directory.CreateDirectory(tmpPath);
            }

            if (!Directory.Exists(uncookPath))
            {
                Directory.CreateDirectory(uncookPath);
            }

            string modsPath = @"E:\Steam\steamapps\common\The Witcher 3\mods";

            string[] mods = new[]
            {
                "modHorseDustAndControls",
                "modNextGenHayStack",
                "modPiecesofFilth",
                "modTrissAppearanceOverhaulTattoos",
                "modCharacterFaces",
                "modCharacterTextures",
                "modEyes4Everyone",
                "modRealisticEyes",
                "modRealisticEyes_BloodAndWine",
                "modNewGeraltBoat_v2",
                "mod4kGrassTextures",
                "modNewBeautifulGrass",
                "modTheButcherOfBlaviken1_9Witheyes",
                "modWolfMedallion_Rounded",
                "modNoScreenFX",
                "modE3Flares",
                "modGeraltCloak",
                "modAdditionalArmorStands",
                "modAdditionalStashLocations",
                "modLampOnBoat_NGB",
                "modsezonburz",
                "mod_FixCompleteAnimations",
                "modHQFacesV3",
                "modYenneferPubes",
                "modyenoutfit_v7"
            };

            FileStream uncookLogStream = File.Create(uncookLogPath);

            TextWriterTraceListener logTracer = new TextWriterTraceListener(uncookLogStream);

            Trace.Listeners.Add(logTracer);

            string modName = "mod000_MergedMods";

            string cookWorkspacePath   = Path.Combine(cookingPath, modName);
            string cookingMoveLocation = Path.Combine(cookWorkspacePath, modName, "content");

            Directory.CreateDirectory(Path.Combine(cookWorkspacePath, modName, "scripts"));

            Directory.CreateDirectory(cookingMoveLocation);

            foreach (string mod in mods)
            {
                string cookedModPath = Path.Combine(modsPath, mod);

                string modContentPath = Path.Combine(cookedModPath, "content");

                Console.WriteLine("[UNCOOKING :: " + mod);
                string uncookModPath = Path.Combine(uncookPath, mod);
                // var uncookModPathContent = Path.Combine(uncookModPath, "content");

                if (!Directory.Exists(uncookModPath))
                {
                    Directory.CreateDirectory(uncookModPath);
                }

                Process process = new Process()
                {
                    StartInfo = new ProcessStartInfo()
                    {
                        WorkingDirectory       = Path.GetFullPath(Path.Combine(@"E:\Modding\TheWitcher3\ModKit", "bin/x64")),
                        FileName               = Path.Combine(Path.GetFullPath(Path.Combine(@"E:\Modding\TheWitcher3\ModKit", "bin/x64")), "wcc_lite.exe"),
                        Arguments              = $"uncook -indir=\"{modContentPath}\" -outdir=\"{uncookModPath}\" -imgfmt=tga",
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        RedirectStandardError  = true,
                        CreateNoWindow         = true
                    }
                };

                process.OutputDataReceived += (s, e) =>
                {
                    Console.WriteLine(e.Data);
                    logTracer.WriteLine(e.Data);
                };

                process.ErrorDataReceived += (s, e) =>
                {
                    Console.WriteLine(e.Data);
                    logTracer.WriteLine(e.Data);
                };

                process.Start();

                process.BeginOutputReadLine();
                process.BeginErrorReadLine();

                process.WaitForExit();

                Console.WriteLine("[QUICKBMS] :: " + mod);

                //quickbms.exe - o - f "*.bundle" witcher3.bms $mod_content_folder$ $mod_content_folder$

                var bmsFile = @"E:\Modding\TheWitcher3\QuickBMS\witcher3.bms";

                foreach (string bundle in Directory.EnumerateFiles(modContentPath, "*.bundle", SearchOption.TopDirectoryOnly))
                {
                    Console.WriteLine("[QUICKBMS BUNDLE FILE] :: " + bundle);

                    var process2 = new Process()
                    {
                        StartInfo = new ProcessStartInfo()
                        {
                            WorkingDirectory = Path.GetFullPath(@"E:\Modding\TheWitcher3\QuickBMS"),
                            FileName         = Path.Combine(Path.GetFullPath(@"E:\Modding\TheWitcher3\QuickBMS"), "quickbms.exe"),
                            //Arguments = string.Format(@"-o -f \"{}.bundle\" ")
                            Arguments              = $"-o \"{bmsFile}\" \"{bundle}\" \"{uncookModPath}\"",
                            UseShellExecute        = false,
                            RedirectStandardOutput = true,
                            RedirectStandardError  = true,
                            CreateNoWindow         = true
                        }
                    };

                    process2.OutputDataReceived += (s, e) =>
                    {
                        Console.WriteLine(e.Data);
                    };

                    process2.ErrorDataReceived += (s, e) =>
                    {
                        Console.WriteLine(e.Data);
                    };

                    process2.Start();

                    process2.BeginOutputReadLine();
                    process2.BeginErrorReadLine();

                    process2.WaitForExit();
                }

                Console.WriteLine("[MOVING FILES] :: " + mod);

                foreach (string file in Directory.EnumerateFiles(uncookModPath, "*.*", SearchOption.AllDirectories))
                {
                    string newScriptPath = Path.Combine(cookingMoveLocation, file.Replace(uncookModPath, "").Substring(1));

                    Directory.CreateDirectory(Path.GetDirectoryName(newScriptPath));

                    if (File.Exists(newScriptPath))
                    {
                        Console.WriteLine("[IGNORED]" + newScriptPath);
                    }
                    else
                    {
                        try
                        {
                            File.Copy(file, newScriptPath, false);
                        }
                        catch
                        {
                        }
                    }
                }
            }

            Trace.Flush();

            uncookLogStream.Close();

            Process.Start("explorer.exe", uncookPath);

            Console.WriteLine("Job done!");

            Console.ReadLine();

            string gamePath = @"E:\Steam\steamapps\common\The Witcher 3";

            Command.Execute(new CookCommand(), new[] { "--cook", gamePath, @"E:\Modding\TheWitcher3\ModKit", cookWorkspacePath });

            Console.WriteLine("Job done 2!");

            Console.ReadLine();

            Directory.Delete(tmpPath, true);

            //var process = new Process()
            //{
            //    StartInfo = new ProcessStartInfo()
            //    {
            //        WorkingDirectory = modKitPath,
            //        FileName = "wcc_lite.exe",
            //        Arguments = $"uncook -indir=\"{modPath}\" -outdir=\"{uncookPath}\" -imgfmt={textureFormat}"
            //    }
            //};
        }