Пример #1
0
        public static void Dump(object data, string filename)
        {
            string dir      = SettingPath.GetDllFolder();
            var    fullpath = Path.Combine(dir, filename);

            try
            {
                // XAMLで書き出し
                var text = System.Windows.Markup.XamlWriter.Save(data);
                DebugModel.WriteLine(text);
                System.IO.File.WriteAllText(fullpath + ".xaml", text);

                //XMLで書き出し
                var xmls = new XmlSerializer(data.GetType());
                using (var writer = new StreamWriter(fullpath + ".xml", false, Encoding.UTF8))
                {
                    xmls.Serialize(writer, data);
                    writer.Flush();
                }
            }
            catch (Exception e)
            {
                DebugModel.WriteLine(e);
            }
        }
Пример #2
0
        private static void Init()
        {
            //DefaultTraceListenerオブジェクトを取得
            DefaultTraceListener drl = (DefaultTraceListener)Trace.Listeners["Default"];
            //LogFileNameを変更する
            string dir = SettingPath.GetDllFolder();

            drl.LogFileName = Path.Combine(dir, "debug.txt");

            //デバッグログを見やすくするために空行を入れる
            Debug.WriteLine("");
        }