示例#1
0
        internal static void Main(string[] args)
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
            Program_Start_Args = Environment.GetCommandLineArgs().ToList();

            if (Program_Start_Args.Count > 1)
            {
                Start_EVTX_Process();
            }
            else if (Program_Start_Args.Count < 2 && Program_Start_Args.Count > 1)
            {
                Settings.SHOW_Help_Menu();
            }
            else
            {
                try
                {
                    if (System_Info.Is_SWELF_Running() == false)
                    {
                        Thread THREAD_APP_RUN_TIMER = new Thread(CHECK_If_App_Has_Run_To_Long);//kills app for running to long
                        THREAD_APP_RUN_TIMER.IsBackground = true;
                        THREAD_APP_RUN_TIMER.Start();
                        Start_Live_Process();
                    }
                    else
                    {
                        Settings.Stop(0, "MAIN() System_Performance_Info.Is_SWELF_Running()", "SWELF tried to run but another instance was already running. Closing this instance of " + Settings.SWELF_PROC_Name.ProcessName + ".", "");
                    }
                }
                catch (Exception e)
                {
                    Settings.Stop(Settings.SWELF_CRIT_ERROR_EXIT_CODE, "Start_Live_Process()", e.Message.ToString() + ", Also the app halted.", e.StackTrace.ToString());
                }
            }
        }
示例#2
0
        internal static void Start_Process_Live_Method()
        {
            if (System_Info.Is_SWELF_Running() == false)
            {
                Thread THREAD_APP_RUN_TIMER = new Thread(CHECK_If_App_Has_Run_To_Long);//Run thread while app runs that kills app for running to long
                THREAD_APP_RUN_TIMER.IsBackground = true;
                THREAD_APP_RUN_TIMER.Start();

                Run_Live_Process_Workflow();
            }
            else
            {
                Settings.Stop(0, "MAIN() System_Performance_Info.Is_SWELF_Running()", "SWELF tried to run but another instance was already running. Closing this instance of " + Settings.SWELF_PROC_Name.ProcessName + ".", "");
            }
        }
示例#3
0
        internal static decimal CHECK_Total_Memory_Useage()
        {
            Int64 phav = System_Info.GetPhysicalAvailableMemoryInMiB();
            Int64 tot  = System_Info.GetTotalMemoryInMiB();

            percentFree               = ((decimal)phav / (decimal)tot) * 100;
            percentOccupied           = 100 - percentFree;
            Available_Physical_Memory = phav;
            Total_Memory              = tot;
            Percent_Free              = percentFree;
            Percent_Used              = percentOccupied;

            if (phav < 0 || tot < 0 || Available_Physical_Memory < 0)
            {
                return(-1);
            }
            return(percentFree);
        }