Beispiel #1
0
        /// <summary>  simple Init - Get the key</summary>
        public override void Init(IRuntimeServices rs, IInternalContextAdapter context, INode node)
        {
            base.Init(rs, context, node);

            log = rs.Log;

            /*
             * default max depth of two is used because intentional recursion is
             * unlikely and discouraged, so make unintentional ones end fast
             */
            maxDepth = rs.GetInt(NVelocity.Runtime.RuntimeConstants.DEFINE_DIRECTIVE_MAXDEPTH, 2);

            /*
             * first token is the name of the block. We don't even check the format,
             * just assume it looks like this: $block_name. Should we check if it has
             * a '$' or not?
             */
            key = node.GetChild(0).FirstToken.Image.Substring(1);

            /**
             * No checking is done. We just grab the second child node and assume
             * that it's the block!
             */
            block = node.GetChild(1);

            /**
             * keep tabs on the template this came from
             */
            definingTemplate = context.CurrentTemplateName;
        }
Beispiel #2
0
        private void InitView()
        {
            Text = "Log List";
            var logs = ConfigurationProvider.Get();

            foreach (var log in logs)
            {
                var l = new Log.Log();
                l.Init(new FileLocateConfig()
                {
                    Directories = log.Paths,
                    FileMasks   = log.FileMasks
                });
                l.Type  = log.Type;
                l.Title = log.Title;
                l.Group = log.Group;
                l.LocateFiles();
                if (l.Files.Any())
                {
                    _logs.Add(l);
                }
            }

            colTitle.AspectGetter           = o => ((ITreeViewItem)o).Title;
            treeListFiles.ChildrenGetter    = o => ((ITreeViewItem)o).GetChildren();
            treeListFiles.CanExpandGetter   = o => ((ITreeViewItem)o).IsExpandable;
            treeListFiles.CellToolTipGetter = (o, e) => ((ITreeViewItem)e).Tooltip;

            treeListFiles.HyperlinkStyle.Visited.ForeColor = treeListFiles.HyperlinkStyle.Normal.ForeColor;

            BuildModel();
        }
Beispiel #3
0
 public void Log(LogType logType, HttpRequestMessage request, string message)
 {
     using (Log.Log log = new Log.Log(logType, request, message))
     {
         this.rabbitMQ.BootStrap("log", "topic_exchange_log").SendMessage(log.ToJson());
     }
 }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="PerimetroExclusion"></param>
        /// <param name="Metodo"></param>
        /// <returns></returns>
        public bool TriangularMalla(Poligono PerimetroExclusion, List <Linea> LineasRuptura, List <Punto3D> Puntos, TipoTriangulado Metodo = TipoTriangulado.Delaunay)
        {
            IList <Triangulo> ResTriang = new List <Triangulo>();

            int currentManagedThread = Environment.CurrentManagedThreadId;
            int processorCount       = Environment.ProcessorCount;

            TriangulacionMultiProceso TrianguladorMultiProceso = new TriangulacionMultiProceso(processorCount)
            {
                TipoTriangulado = Metodo,
                Perimetro       = PerimetroExclusion,
                LineasRuptura   = LineasRuptura,
                Puntos3D        = Puntos
            };

            TrianguladorMultiProceso.IniciarProceso();

            while (TrianguladorMultiProceso.EstadoProceso == TriangulacionMultiProceso.Estado.EnEjecucion)
            {
                System.Threading.Thread.Sleep(300);
            }

            if (TrianguladorMultiProceso.EstadoProceso == TriangulacionMultiProceso.Estado.Terminado)
            {
                _Resultado        = TrianguladorMultiProceso.Resultado.Resultado;
                _logTriangulacion = TrianguladorMultiProceso.LogMultiProceso;
                return(true);
            }
            else
            {
                //Informar de cada uno de los errores que an detenido cada uno de los procesos
                _logTriangulacion = TrianguladorMultiProceso.LogMultiProceso;
                return(false);
            }
        }
Beispiel #5
0
        private unsafe void btnExtractContent_Click(object sender, EventArgs e)
        {
            // Checking if we have the data that we need to get started.
            if (this.InputOk())
            {
                // Marks the reseted flag to false.
                // This will cause the progress bar to be reseted once the thread dies.
                this.reseted = false;

                // Disabling the controls.
                this.ChangeControlsStatus(false);

                // Creates the log.
                this.myLog = new Log.Log(txtLogPath.Text);

                // Check if the status variable isn't already allocated.
                if (this.status != null)
                {
                    Marshal.FreeHGlobal((IntPtr)status);
                }

                //Creates the status variable.
                this.status = (float *) Marshal.AllocHGlobal(sizeof(float));

                this.extractionThread = new Thread(new ThreadStart(ExtractionThread));

                // Enables the timer that updates the progress bar.
                tmrExporterThread.Enabled = true;

                // Starts the thread.
                this.extractionThread.Start();
            }
        }
Beispiel #6
0
 public void Log(LogType logType)
 {
     using (Log.Log log = new Log.Log(logType))
     {
         this.rabbitMQ.BootStrap("log", "topic_exchange_log").SendMessage(log.ToJson());
     }
 }
 public CardModel RemoveRound(Card objCard)
 {
     if (objCard.LastTimeAddRound != null)
     {
         TimeSpan?x       = (DateTime.Now - objCard.LastTimeAddRound);
         double   daysDif = x.Value.TotalDays;
         if (daysDif <= 30 && objCard.CardRoundBalance != 0)
         {
             objCard.CardRoundBalance = objCard.CardRoundBalance - 1;
             Log.Log objLog = new Log.Log();
             objLog.CardId      = (int)objCard.Id;
             objLog.TypeId      = objCard.TypeId;
             objLog.RemoveRound = 1;
             objLog.CreatedTime = DateTime.Now;
             Database.Logs.Add(objLog);
             Database.SaveChanges();
             //return "หักรอบสำเร็จ รอบคงเหลือ " + objCard.CardRoundBalance + " รอบ";
             return(objCard.Adapt <CardModel>());
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Beispiel #8
0
        private void btnAddFile_Click(object sender, EventArgs e)
        {
            var dlg = new OpenFileDialog()
            {
                Multiselect = true
            };

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var newFiles = new List <LogFile>();

            foreach (var dlgFileName in dlg.FileNames)
            {
                var component = ConfigurationProvider.GetTypeByFileName(dlgFileName);
                if (component == ComponentType.NotDefined)
                {
                    continue;
                }

                var log = _addedFiles.FirstOrDefault(l => l.Type == component);
                if (log == null)
                {
                    log = new Log.Log()
                    {
                        Type  = component,
                        Title = component.ToString()
                    };
                    _addedFiles.Add(log);
                }

                var files = log.Files?.ToList() ?? new List <LogFile>();

                var newFile = new LogFile()
                {
                    Type     = component,
                    FileInfo = new FileInfo(dlgFileName)
                };

                files.Add(newFile);
                newFiles.Add(newFile);

                log.Files = files;
            }

            if (_addedFilesGroup != null)
            {
                treeListFiles.RemoveObject(_addedFilesGroup);
            }

            _addedFilesGroup = new GroupViewModel("Added files", _addedFiles, ViewMode.TreeView);
            treeListFiles.AddObject(_addedFilesGroup);
            treeListFiles.Expand(_addedFilesGroup);

            newFiles.ForEach(f => EventBus.Bus.GetEvent <OpenLogFile>().Publish(f));
        }
Beispiel #9
0
        public Exporter(string logPath, string sqlServerAddress, string databaseName, string logDescription)
        {
            BaseLog = new Log.Log(logPath);
            SqlServerAddress = sqlServerAddress;
            DatabaseName = databaseName;
            LogDescription = logDescription;

            this.status = (float*)Marshal.AllocHGlobal(sizeof(float));
        }
Beispiel #10
0
        public Dashboard()
        {
            InitializeComponent();

            var vm = VM.Navigator.I;

            DataContext = vm;

            Log     = new Log.Log();
            Overlay = new Overlay();
        }
Beispiel #11
0
        /// <summary> This initialization is used by all resource
        /// loaders and must be called to set up common
        /// properties shared by all resource loaders
        /// </summary>
        /// <param name="rs">
        /// </param>
        /// <param name="configuration">
        /// </param>
        public virtual void CommonInit(IRuntimeServices rs, ExtendedProperties configuration)
        {
            this.rsvc = rs;
            this.log  = rsvc.Log;

            /*
             *  these two properties are not required for all loaders.
             *  For example, for ClasspathLoader, what would cache mean?
             *  so adding default values which I think are the safest
             *
             *  don't cache, and modCheckInterval irrelevant...
             */

            try
            {
                isCachingOn = configuration.GetBoolean("cache", false);
            }
            catch (System.Exception e)
            {
                isCachingOn = false;
                string msg = "Exception parsing cache setting: " + configuration.GetString("cache");
                log.Error(msg, e);
                throw new VelocityException(msg, e);
            }
            try
            {
                modificationCheckInterval = configuration.GetLong("modificationCheckInterval", 0);
            }
            catch (System.Exception e)
            {
                modificationCheckInterval = 0;
                string msg = "Exception parsing modificationCheckInterval setting: " + configuration.GetString("modificationCheckInterval");
                log.Error(msg, e);
                throw new VelocityException(msg, e);
            }

            /*
             * this is a must!
             */
            className = typeof(ResourceCacheImpl).FullName;
            try
            {
                className = configuration.GetString("class", className);
            }
            catch (System.Exception e)
            {
                string msg = "Exception retrieving resource cache class name";
                log.Error(msg, e);
                throw new VelocityException(msg, e);
            }
        }
Beispiel #12
0
        public static string ToFileName(string Filename)
        {
            string result = $@"{Directory.GetCurrentDirectory()}\Oregonlog.log";

            try
            {
                result = $@"{Directory.GetCurrentDirectory()}\{Filename}.log";
            }
            catch (Exception e)
            {
                Log.Log log = new Log.Log($"Error-{GetFileTime()}");
                log.WriteLogLine(e.ToString());
            }

            return(result);
        }
Beispiel #13
0
        public CardModel AddMoney(CardModel card, Log.Log btsCost)
        {
            Card objCard = Database.Cards.Where(a => a.Id == card.Id).FirstOrDefault();

            if (objCard.TypeId == (int)CardType.RabbitBCard)
            {
                objCard.CardValueBalance = objCard.CardValueBalance + btsCost.AddMoney;
                Log.Log objLog = new Log.Log();
                objLog.CardId      = (int)objCard.Id;
                objLog.TypeId      = objCard.TypeId;
                objLog.AddMoney    = btsCost.AddMoney;
                objLog.CreatedTime = DateTime.Now;

                Database.Logs.Add(objLog);
                Database.SaveChanges();
                return(objCard.Adapt <CardModel>());
            }
            return(objCard.Adapt <CardModel>());
        }
Beispiel #14
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ///////////////// Dock Pannels

            this.dockPanel      = new WeifenLuo.WinFormsUI.Docking.DockPanel();
            this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.Controls.Add(this.dockPanel);
            this.graph = new Editor();
            graph.Text = "dddddddddd";
            graph.Show(this.dockPanel, DockState.Document);

            this.log = new Log.Log();
            log.Text = "dddddddddd";
            log.Show(this.dockPanel, DockState.DockBottom);
            if (log.init())
            {
            }
            //logger.Info("Модуль логгера инициализирован");
            //else   logger.Error("Ошибка инициализации модуля логгера");

            this.tools = new Toolbox();
            tools.Text = "Типы объектов";
            tools.Show(this.dockPanel, DockState.DockLeft);
            ///////////////////////////////


            new Thread(new ThreadStart(new Action(() =>
            {
                while (!stopAllThreads)
                {
                    logger.Log(LogLevel.Debug, "debug mes");
                    logger.Log(LogLevel.Trace, "debug mes");
                    Thread.Sleep(500);
                    logger.Log(LogLevel.Info, "info mes");
                    logger.Log(LogLevel.Warn, "inhhhfo mes");
                    logger.Log(LogLevel.Error, "info mes");
                    logger.Log(LogLevel.Fatal, "info mes");
                    Thread.Sleep(500);
                }
            }))).Start();
        }
Beispiel #15
0
        public CardModel AddRound(CardModel card, Log.Log addRound)
        {
            Card objCard = Database.Cards.Where(a => a.Id == card.Id).FirstOrDefault();

            if (objCard.TypeId == (int)CardType.RabbitACard)
            {
                if (objCard.LastTimeAddRound != null)
                {
                    TimeSpan?x       = (DateTime.Now - objCard.LastTimeAddRound);
                    double   daysDif = x.Value.TotalDays;
                    if (daysDif <= 30)
                    {
                        //กรณีวันที่เติมครั้งสุดท้ายไม่ถึง 30 วัน
                        objCard.CardRoundBalance = card.CardRoundBalance + addRound.AddRound;
                        objCard.LastTimeAddRound = DateTime.Now;
                    }
                    else
                    {
                        //กรณีวันที่เติมครั้งสุดท้ายเกิน 30 วัน
                        objCard.CardRoundBalance = addRound.AddRound;
                        objCard.LastTimeAddRound = DateTime.Now;
                    }
                }
                else
                {
                    //กรณียังไม่เคยเติม
                    objCard.CardRoundBalance = addRound.AddRound;
                    objCard.LastTimeAddRound = DateTime.Now;
                }

                Log.Log objLog = new Log.Log();
                objLog.CardId      = (int)objCard.Id;
                objLog.AddRound    = addRound.AddRound;
                objLog.TypeId      = objCard.TypeId;
                objLog.CreatedTime = DateTime.Now;
                Database.Logs.Add(objLog);
                Database.SaveChanges();
            }
            return(objCard.Adapt <CardModel>());
        }
Beispiel #16
0
 public CardModel RemoveMoney(Card objCard)
 {
     objCard.StationStartcode     = "S2";
     objCard.StationTerminatecode = "E1";
     if (objCard.CardValueBalance >= 15)
     {
         int fee = CalFee(objCard.StationStartcode, objCard.StationTerminatecode);
         objCard.CardValueBalance = objCard.CardValueBalance - fee;
         Log.Log objLog = new Log.Log();
         objLog.CardId      = (int)objCard.Id;
         objLog.TypeId      = objCard.TypeId;
         objLog.RemoveMoney = fee;
         objLog.CreatedTime = DateTime.Now;
         Database.Logs.Add(objLog);
         Database.SaveChanges();
         // return "หักเงินสำเร็จ ยอดคงเหลือ " + objCard.CardValueBalance + " บาท";
         return(objCard.Adapt <CardModel>());
     }
     else
     {
         return(null);
     }
 }
Beispiel #17
0
 public CreateRaceCommand()
 {
     Logger = new Log.Log();
 }
Beispiel #18
0
 public GameHub()
 {
     _logger = new Log.Log();
     _save   = new DB();
 }
Beispiel #19
0
        /// <summary> Initialize the ResourceManager.
        ///
        /// </summary>
        /// <param name="rsvc"> The Runtime Services object which is associated with this Resource Manager.
        ///
        /// </param>
        /// <throws>   Exception </throws>
        public virtual void Initialize(IRuntimeServices rsvc)
        {
            lock (syncOjb)
            {
                if (isInit)
                {
                    log.Debug("Re-initialization of ResourceLoader attempted and ignored.");
                    return;
                }

                ResourceLoader resourceLoader = null;

                this.rsvc = rsvc;
                log       = rsvc.Log;

                log.Trace("Default ResourceManager initializing. (" + this.GetType() + ")");

                AssembleResourceLoaderInitializers();


                for (IEnumerator it = sourceInitializerList.GetEnumerator(); it.MoveNext();)
                {
                    /**
                     * Resource loader can be loaded either via class name or be passed
                     * in as an instance.
                     */

                    ExtendedProperties configuration = (ExtendedProperties)it.Current;

                    string         loaderClass    = StringUtils.NullTrim(configuration.GetString("class"));
                    ResourceLoader loaderInstance = (ResourceLoader)configuration["instance"];

                    if (loaderInstance != null)
                    {
                        resourceLoader = loaderInstance;
                    }
                    else if (loaderClass != null)
                    {
                        resourceLoader = ResourceLoaderFactory.GetLoader(rsvc, loaderClass);
                    }
                    else
                    {
                        string msg = "Unable to find '" + configuration.GetString(RESOURCE_LOADER_IDENTIFIER) + ".resource.loader.class' specification in configuration." + " This is a critical value.  Please adjust configuration.";
                        log.Error(msg);
                        throw new System.Exception(msg);
                    }

                    resourceLoader.CommonInit(rsvc, configuration);
                    resourceLoader.Init(configuration);
                    resourceLoaders.Add(resourceLoader);
                }

                /*
                 * now see if this is overridden by configuration
                 */

                logWhenFound = rsvc.GetBoolean(NVelocity.Runtime.RuntimeConstants.RESOURCE_MANAGER_LOGWHENFOUND, true);

                /*
                 *  now, is a global cache specified?
                 */

                string cacheClassName = rsvc.GetString(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS);

                object cacheObject = null;

                if (!string.IsNullOrEmpty(cacheClassName))
                {
                    try
                    {
                        cacheObject = System.Activator.CreateInstance(Type.GetType(cacheClassName.Replace(';', ',')));
                    }
                    catch (System.Exception cnfe)
                    {
                        string msg = "The specified class for ResourceCache (" + cacheClassName + ") does not exist or is not accessible to the current classloader.";
                        log.Error(msg, cnfe);
                        throw cnfe;
                    }

                    if (!(cacheObject is IResourceCache))
                    {
                        string msg = "The specified resource cache class (" + cacheClassName + ") must implement " + typeof(IResourceCache).FullName;
                        log.Error(msg);
                        throw new System.SystemException(msg);
                    }
                }

                /*
                 *  if we didn't Get through that, just use the default.
                 */
                if (cacheObject == null)
                {
                    cacheObject = new ResourceCacheImpl();
                }

                globalCache = (IResourceCache)cacheObject;

                globalCache.Initialize(rsvc);

                log.Trace("Default ResourceManager initialization complete.");
            }
        }
Beispiel #20
0
 public DB()
 {
     _logger = new Log.Log();
 }
Beispiel #21
0
        /// <exception cref="MyException"></exception>
        public void Inserir()
        {
            ValidarNome();

            if (DaoCliente.ExisteNomenclaturaInformada(this))
                throw new MyException("Já existe o Nome informado!");

            Status = Status.Ativo;
            Id = DaoCliente.Inserir(this);

            ILog log = new Log.Log(Operacao.Inserir);
            DaoClienteLog.Inserir(this, log);
        }
Beispiel #22
0
        public CardModel AddMoneyToCard(CardModel card, Log.Log objAddRemoveMoneyRound)
        {
            var models = _storage.AddMoney(card, objAddRemoveMoneyRound).Adapt <CardModel>();

            return(models);
        }
Beispiel #23
0
 public LogViewModel(Log.Log log)
 {
     _log      = log;
     _children = _log.Files.Select(f => new FileViewModel(f)).ToList();
 }
 /// <summary>
 /// initialisiert Protokoll
 /// </summary>
 public static void Initialize(string moduleName, bool logEnabled, string logLevel)
 {
     _log = new Log.Log(moduleName, logEnabled, logLevel);
 }