コード例 #1
0
        /// <summary>
        /// Reports exception that none catched
        /// </summary>
        /// <param name="e"></param>
        /// <param name="client"></param>
        public static void reportUnhandledException(Exception e, IAceLogable client)
        {
            unhandledExceptionCount++;

            String msg = e.LogException("Unhandled Exception :: " + appManager.AppInfo.applicationName + ")");

            if (client != null)
            {
                msg += "Instance: " + client.GetType().Name + " " + Environment.NewLine;
                client.log(msg);
                msg += "----------------- log content ----------------" + Environment.NewLine;
                msg += client.logContent;
            }
            else
            {
                msg += "Instance: null" + Environment.NewLine;
            }
            String filename = "_crash_report_" + unhandledExceptionCount.ToString("D3") + DateTime.Now.ToString("MM-dd") + ".txt";

            String path = appManager.Application.folder_logs.pathFor(filename, getWritableFileMode.autoRenameExistingToBack);

            File.WriteAllText(path, msg);

            if (unhandledExceptionCount > 10)
            {
                Environment.Exit(0);
                //AppDomain.CurrentDomain.
            }
            aceLog.saveAllLogs(true);

            throw (e);
        }
コード例 #2
0
        public void onMenuCalled(IAceCommand _command, aceCommandEventArgs _args)
        {
            IAceLogable logable = _args.logableCaller;
            //if (logable == null) logable = aceCommons.terminal;

            //logable.log("Command menu:");
            //foreach (var __comm in this.Values)
            //{
            //    logable.log("   -" + __comm.commandShortName + "  (" + __comm.commandFullname + ") : " + __comm.description);
            //}

            //IAceLogableWithInput logableInput = logable as IAceLogableWithInput;
            //String selectedCommand = "";
            //if (logableInput == null)
            //{
            //    selectedCommand = Console.ReadLine();
            //} else
            //{
            //    selectedCommand = logableInput.getInputLine();
            //}

            //commandExpression expression = new commandExpression(selectedCommand, format);

            //aceCommandEventArgs args = MakeArguments(expression, this);
            //args.command.callCommand(args);
        }
コード例 #3
0
        public aceProjectToolBase(IAceComponent __component, IAceLogable __terminal = null)
        {
            _component = __component;

            if (__terminal != null)
            {
                terminal = __terminal as IAceLogable;
            }
            else
            {
            }

            Console.OutputEncoding = Encoding.UTF8;
            // Change current culture
            CultureInfo culture;

            culture = CultureInfo.CreateSpecificCulture("en-US");

            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;
        }
コード例 #4
0
        /// <summary>
        /// Gets the log content from object.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns></returns>
        protected String getLogContentFromObject(Object input)
        {
            if (input == null)
            {
                return("Silent Exception : [null] object sent as input provider --> aceLog / aceLogRegistry");
            }

            if (input is ITextRender)
            {
                ITextRender input_ITextRender = (ITextRender)input;
                return(input_ITextRender.ContentToString());
            }

            if (input is IAceLogable)
            {
                IAceLogable input_IAceLogable = (IAceLogable)input;
                return(input_IAceLogable.logContent);
            }

            //if (input is IAutosaveEnabled)
            //{
            //    IAutosaveEnabled input_IAceLogable = (IAutosaveEnabled)input;
            //    return input_IAceLogable.logContent;
            //}


            if (input is StringBuilder)
            {
                StringBuilder input_StringBuilder = (StringBuilder)input;
                return(input_StringBuilder.ToString());
            }

            if (input is String)
            {
                String input_String = (String)input;
                return(input_String);
            }

            return("Silent Exception : [unsupported] object (" + input.GetType().Name + ") send as input provider --> aceLog / aceLogRegistry");
        }
コード例 #5
0
 /// <summary>
 /// The main constructor.
 /// </summary>
 /// <param name="__terminal">AceTerminal instance</param>
 public aceFileToolBase(IAceComponent __component, IAceLogable __terminal) : base(__component, __terminal)
 {
     //terminal = __terminal;
 }
コード例 #6
0
 public ncFileTool(IAceLogable __terminal) : base(null, __terminal)
 {
     terminal = __terminal;
 }
コード例 #7
0
        /// <summary>
        /// Sets the object by source, but only ValueTypes and string and only properties declared at top inherence level. Returns dictionary with updated properties (only if value changed)
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="source">The source.</param>
        /// <param name="loger">The loger.</param>
        /// <returns></returns>
        public static Dictionary <PropertyInfo, Object> setObjectValueTypesBySource(this Object target, Object source, IAceLogable loger = null)
        {
            Dictionary <PropertyInfo, Object> output = new Dictionary <PropertyInfo, object>();

            Int32 c    = 0;
            var   vals = target.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);

            foreach (PropertyInfo pi in vals)
            {
                if (pi.PropertyType.IsValueType || pi.PropertyType == typeof(String))
                {
                    Object cur = target.imbGetPropertySafe(pi, null);
                    Object tmp = source.imbGetPropertySafe(pi, cur);
                    if (!tmp.isNullOrEmptyString())
                    {
                        target.imbSetPropertySafe(pi, tmp, true);
                    }

                    if (cur != tmp)
                    {
                        output.Add(pi, tmp);
                        if (loger != null)
                        {
                            loger.log("Property [" + pi.Name + "] changed to: " + tmp.ToString());
                        }
                    }
                }
            }

            return(output);
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="deliveryUnitItemLogOutput"/> class.
 /// </summary>
 /// <param name="__log">The log.</param>
 /// <param name="__outputPath">The output path.</param>
 public deliveryUnitItemLogOutput(IAceLogable __log, string __outputPath, deliveryUnitItemContentTemplated __templateOutput = null) : base(deliveryUnitItemType.content)
 {
     setup(__log, __outputPath);
     templateOutput = __templateOutput;
 }