Exemplo n.º 1
0
    public static void DoReport()
    {
        DateTime now = DateTime.Now;
        string   str = string.Concat("report.", now.ToString(), ".txt");

        str = str.Replace('\\', '-');
        str = str.Replace('/', '-');
        str = str.Replace(' ', '\u005F');
        str = str.Replace(':', '.');
        now = DateTime.Now;
        File.WriteAllText(str, string.Concat("Report Generated ", now.ToString(), "\r\n"));
        ServerPerformance.ComponentReport(str, "All Objects", UnityEngine.Object.FindObjectsOfType <Transform>());
        ServerPerformance.ComponentReport(str, "Entities", UnityEngine.Object.FindObjectsOfType <BaseEntity>());
        ServerPerformance.ComponentReport(str, "Rigidbodies", UnityEngine.Object.FindObjectsOfType <Rigidbody>());
        string str1 = str;

        UnityEngine.Object[] array = (
            from x in (IEnumerable <Collider>)UnityEngine.Object.FindObjectsOfType <Collider>()
            where !x.enabled
            select x).ToArray <Collider>();
        ServerPerformance.ComponentReport(str1, "Disabled Colliders", array);
        string str2 = str;

        array = (
            from x in (IEnumerable <Collider>)UnityEngine.Object.FindObjectsOfType <Collider>()
            where x.enabled
            select x).ToArray <Collider>();
        ServerPerformance.ComponentReport(str2, "Enabled Colliders", array);
        if (SingletonComponent <SpawnHandler> .Instance)
        {
            SingletonComponent <SpawnHandler> .Instance.DumpReport(str);
        }
    }
Exemplo n.º 2
0
        // This is the entry point of UI. Initializes the maini window.
        public MainWindow()
        {
            InitializeComponent();
            ServerPerformance.Focus();
            Title = "UserInterface";
            setupChannel();
            XElement MessageStream = new XElement("MessageStream");  // An element is added in the above defined XMLDoc to initiate a message stream being sent.

            MessageXML.Add(MessageStream);                           // Client adds children to it. Children are queries along with the numbers and required paramaeters
        }
Exemplo n.º 3
0
 public static void ComponentReport(string filename, string Title, Object[] objects)
 {
     File.AppendAllText(filename, "\r\n\r\n" + Title + ":\r\n\r\n");
     using (IEnumerator <IGrouping <string, Object> > enumerator = ((IEnumerable <IGrouping <string, Object> >)((IEnumerable <Object>)objects).GroupBy <Object, string>((Func <Object, string>)(x => ServerPerformance.WorkoutPrefabName((x as Component).get_gameObject()))).OrderByDescending <IGrouping <string, Object>, int>((Func <IGrouping <string, Object>, int>)(x => ((IEnumerable <Object>)x).Count <Object>()))).GetEnumerator())
     {
         while (((IEnumerator)enumerator).MoveNext())
         {
             IGrouping <string, Object> current = enumerator.Current;
             File.AppendAllText(filename, "\t" + ServerPerformance.WorkoutPrefabName((((IEnumerable <Object>)current).ElementAt <Object>(0) as Component).get_gameObject()) + " - " + (object)((IEnumerable <Object>)current).Count <Object>() + "\r\n");
         }
     }
     File.AppendAllText(filename, "\r\nTotal: " + (object)((IEnumerable <Object>)objects).Count <Object>() + "\r\n\r\n\r\n");
 }
Exemplo n.º 4
0
 public static void ComponentReport(string filename, string Title, UnityEngine.Object[] objects)
 {
     File.AppendAllText(filename, string.Concat("\r\n\r\n", Title, ":\r\n\r\n"));
     foreach (IGrouping <string, UnityEngine.Object> strs in
              from x in (IEnumerable <UnityEngine.Object>) objects
              group x by ServerPerformance.WorkoutPrefabName((x as Component).gameObject) into x
              orderby x.Count <UnityEngine.Object>() descending
              select x)
     {
         File.AppendAllText(filename, string.Concat(new object[] { "\t", ServerPerformance.WorkoutPrefabName((strs.ElementAt <UnityEngine.Object>(0) as Component).gameObject), " - ", strs.Count <UnityEngine.Object>(), "\r\n" }));
     }
     File.AppendAllText(filename, string.Concat("\r\nTotal: ", objects.Count <UnityEngine.Object>(), "\r\n\r\n\r\n"));
 }
Exemplo n.º 5
0
    public static void DoReport()
    {
        string str = ("report." + DateTime.Now.ToString() + ".txt").Replace('\\', '-').Replace('/', '-').Replace(' ', '_').Replace(':', '.');

        File.WriteAllText(str, "Report Generated " + DateTime.Now.ToString() + "\r\n");
        ServerPerformance.ComponentReport(str, "All Objects", (Object[])Object.FindObjectsOfType <Transform>());
        ServerPerformance.ComponentReport(str, "Entities", (Object[])Object.FindObjectsOfType <BaseEntity>());
        ServerPerformance.ComponentReport(str, "Rigidbodies", (Object[])Object.FindObjectsOfType <Rigidbody>());
        ServerPerformance.ComponentReport(str, "Disabled Colliders", (Object[])((IEnumerable <Collider>)Object.FindObjectsOfType <Collider>()).Where <Collider>((Func <Collider, bool>)(x => !x.get_enabled())).ToArray <Collider>());
        ServerPerformance.ComponentReport(str, "Enabled Colliders", (Object[])((IEnumerable <Collider>)Object.FindObjectsOfType <Collider>()).Where <Collider>((Func <Collider, bool>)(x => x.get_enabled())).ToArray <Collider>());
        if (!Object.op_Implicit((Object)SingletonComponent <SpawnHandler> .Instance))
        {
            return;
        }
        ((SpawnHandler)SingletonComponent <SpawnHandler> .Instance).DumpReport(str);
    }
Exemplo n.º 6
0
        private static void ReceivePackage(Peer peer, byte[] data)
        {
            ServerPerformance package = data.Deserialize <ServerPerformance>();

            Client.UpdateServerPerformance(package);
        }
Exemplo n.º 7
0
 public static void report(ConsoleSystem.Arg args)
 {
     ServerPerformance.DoReport();
 }
Exemplo n.º 8
0
 public static void report(Arg args)
 {
     ServerPerformance.DoReport();
 }