예제 #1
0
        /// <summary>
        /// Writes error to error log file.
        /// </summary>
        /// <param name="virtualServer">Virtual server name.</param>
        /// <param name="errorText">Error text to dump.</param>
        public static void DumpError(string virtualServer, string errorText)
        {
            try
            {
                DataSet ds = new DataSet("dsEvents");
                ds.Tables.Add("Events");
                ds.Tables["Events"].Columns.Add("ID");
                ds.Tables["Events"].Columns.Add("VirtualServer");
                ds.Tables["Events"].Columns.Add("CreateDate", typeof(DateTime));
                ds.Tables["Events"].Columns.Add("Type");
                ds.Tables["Events"].Columns.Add("Text");

                if (File.Exists(SysIO.PathFix(m_Path + "Settings\\Events.xml")))
                {
                    ds.ReadXml(SysIO.PathFix(m_Path + "Settings\\Events.xml"));
                }

                DataRow dr = ds.Tables["Events"].NewRow();
                dr["ID"]            = Guid.NewGuid().ToString();
                dr["VirtualServer"] = virtualServer;
                dr["CreateDate"]    = DateTime.Now;
                dr["Type"]          = 0;
                dr["Text"]          = errorText;
                ds.Tables["Events"].Rows.Add(dr);

                ds.WriteXml(SysIO.PathFix(m_Path + "Settings\\Events.xml"));
            }
            catch
            {
            }
        }
예제 #2
0
파일: QExtension.cs 프로젝트: nistec/MQueue
        //public static IQueueAck SendToQueue(this Message message, QueueHost target, int connectTimeout)
        //{
        //    message.HostAddress = target.RawHostAddress;
        //    QueueClient client = new QueueClient(target.HostName, target.ServerName);
        //    return client.Send(message, connectTimeout);
        //}

        //public static IQueueAck SendToFile(this Message message, QueueHost target)
        //{
        //    message.SaveToFile(target.QueuePath);
        //    return new MessageAck(message, MessageState.Received, (string)null);
        //}

        public static string GetFileName(this QueueItem message, string path)
        {
            return(SysIO.PathFix(path + "\\" + message.Filename));
        }