Beispiel #1
0
        public static void LogExtentedWrapper(DumpOption bMode)
        {
            StringBuilder sb = new StringBuilder((bMode | DumpOption.GUIActive) == bMode ? (Mod.config.IncludePackageInfoInDump ? 262144 : 16384) : 8192);

            RefreshSourceData(bMode);
            buildTheString(sb, bMode);
            DumpStatsToLog(sb.ToString(), bMode);
        }
Beispiel #2
0
        /// <summary>
        /// Dumps our stats to a custom file or normal log file.
        /// </summary>
        /// <param name="strText">The string data.</param>
        /// <param name="bMode">The options flags that was used to create it (used to know if custom file or not)</param>
        public static void DumpStatsToLog(string strText, DumpOption bMode = 0)
        {
            try
            {
                string strTempPath = "";
                bool   bDumpToLog  = true;
                if ((bMode | DumpOption.UseSeperateFile) == bMode)
                {
                    if (Mod.DEBUG_LOG_LEVEL > 1)
                    {
                        dbgLog("-----Using Seperate file mode flagged" + bMode.ToString() + "-----\r\n");
                    }
                    if (Mod.config.UseCustomDumpFile)
                    {
                        if (Mod.DEBUG_LOG_LEVEL > 1)
                        {
                            dbgLog("\r\n--------------Using Seperate file enabled-----\r\n");
                        }
                        if (Mod.DEBUG_LOG_LEVEL > 1)
                        {
                            dbgLog("\r\n\r\n[debugdata] ---" + Mod.config.DumpStatsFilePath + " existspath: " +
                                   Path.GetDirectoryName(Mod.config.DumpStatsFilePath) + "  combopath: " +
                                   Path.Combine(DataLocation.executableDirectory.ToString(), Mod.config.DumpStatsFilePath));
                        }
                        strTempPath = System.IO.Directory.Exists(Path.GetDirectoryName(Mod.config.DumpStatsFilePath)) ? Mod.config.DumpStatsFilePath.ToString() : Path.Combine(DataLocation.executableDirectory.ToString(), Mod.config.DumpStatsFilePath);
                        bDumpToLog  = false; //flag us custom file.
                    }
                }

                if (bDumpToLog)
                {
                    if (Mod.DEBUG_LOG_ON)
                    {
                        dbgLog("\r\n Dumping to default game log.");
                    }
                    Debug.Log(strText);
                }
                else
                {
                    if (Mod.DEBUG_LOG_ON)
                    {
                        dbgLog("\r\n Dumping to custom log. " + strTempPath);
                    }
                    using (StreamWriter streamWriter = new StreamWriter(strTempPath, true))
                    {
                        streamWriter.WriteLine(strText);
                    }
                }
            }
            catch (Exception ex)
            {
                dbgLog("Error:\r\n", ex, true);
            }
        }
Beispiel #3
0
        private static void RefreshSourceData(DumpOption bMode)
        {
            //Version & Platform data
            tmpVer = new object[] { Application.productName, Application.platform.ToString(),
                                    DataLocation.productName, DataLocation.productVersion.ToString(),
                                    DataLocation.productVersionString };
            //PathData
            tmpPaths = new object[] { DataLocation.applicationBase, DataLocation.executableDirectory,
                                      DataLocation.modsPath, DataLocation.saveLocation, DataLocation.gameContentPath, DataLocation.localApplicationData };


/*            //VehicleData
 *          tmpVehc = new object[]{ ((bMode | DumpOption.MapLoaded) == bMode)? Singleton<VehicleManager>.instance.m_vehicleCount.ToString() : "n\\a",
 *                  Mod.RESERVEAMOUNT.ToString(),
 *                  ((bMode | DumpOption.MapLoaded) == bMode) ? (Singleton<VehicleManager>.instance.m_vehicles.m_size - 1).ToString() : "16383",
 *                  (16383 - Mod.RESERVEAMOUNT).ToString(),Mod.timesReservedAttempted.ToString(),
 *                  Mod.timesReserveAttemptFailed.ToString(), Mod.timesLimitReached.ToString(),
 *                  Mod.timesFailedByReserve.ToString(), Mod.timesFailedToCreate.ToString(), Mod.timesCV_CalledTotal.ToString()};
 *
 */
            //debugdata
            tmpdbg = new object[] { Mod.DEBUG_LOG_ON.ToString(), Mod.DEBUG_LOG_LEVEL.ToString(), Mod.IsGuiEnabled.ToString(),
                                                                 Mod.UseAutoRefreshOption.ToString(), Mod.IsEnabled.ToString(), Mod.IsInited.ToString(),
                                                                 Loader.isGuiRunning.ToString(), Mod.UseAutoRefreshOption.ToString(),
                                                                 Mod.AutoRefreshSeconds.ToString("F2"), Mod.config.GuiOpacity.ToString("F04"), Mod.config.CheckStatsForLimitsEnabled.ToString(),
                                    Mod.config.UseCustomLogFile.ToString(), Mod.config.DumpStatsOnMapEnd.ToString(), Mod.config.UseCustomDumpFile,
                                    Mod.config.DumpStatsFilePath, Mod.config.CustomLogFilePath };

            if ((bMode | Helper.DumpOption.GUIActive) == bMode)
            {            //gui mode exclusive
                tmpGuiExtra2 = new object[] { (Singleton <SimulationManager> .instance.m_metaData != null) ? Singleton <SimulationManager> .instance.m_metaData.m_newGameAppVersion.ToString():"n/a",
                                              (Singleton <SimulationManager> .instance.m_metaData.m_CityName != null) ? Singleton <SimulationManager> .instance.m_metaData.m_CityName.ToString():"n/a",
                                              (Singleton <SimulationManager> .exists == true) ? Singleton <SimulationManager> .instance.SimulationPaused.ToString():"n/a",
                                              (Singleton <ToolManager> .instance != null) ? (Singleton <ToolManager> .instance.m_properties.CurrentTool != null ? Singleton <ToolManager> .instance.m_properties.m_mode.ToString():"n/a"):"n/a" };

                Helper.ExternalData Mytmp;
                Mytmp       = CSLShowMoreLimitsGUI.GetInternalData();
                tmpGuiExtra = Mytmp.ToStringArray();
                //CSLServiceReserveGUI.GetInternalData.ToStringArray();
            }
        }
Beispiel #4
0
        private static void RefreshSourceData(DumpOption bMode)
        {
            //Version & Platform data
            tmpVer = new object[] { Application.productName, Application.platform.ToString(),
                DataLocation.productName, DataLocation.productVersion.ToString(),
                DataLocation.productVersionString };
            //PathData
            tmpPaths = new object[]{DataLocation.applicationBase,DataLocation.executableDirectory,
                DataLocation.modsPath,DataLocation.saveLocation,DataLocation.gameContentPath,DataLocation.localApplicationData};

            //VehicleData
            tmpVehc = new object[]{ ((bMode | DumpOption.MapLoaded) == bMode)? Singleton<VehicleManager>.instance.m_vehicleCount.ToString() : "n\\a",
                    Mod.RESERVEAMOUNT.ToString(),
                    ((bMode | DumpOption.MapLoaded) == bMode) ? (Singleton<VehicleManager>.instance.m_vehicles.m_size - 1).ToString() : "16383",
                    (16383 - Mod.RESERVEAMOUNT).ToString(),Mod.timesReservedAttempted.ToString(),
                    Mod.timesReserveAttemptFailed.ToString(), Mod.timesLimitReached.ToString(),
                    Mod.timesFailedByReserve.ToString(), Mod.timesFailedToCreate.ToString(), Mod.timesCV_CalledTotal.ToString()};

            //debugdata
            tmpdbg = new object[]{Mod.DEBUG_LOG_ON.ToString(),Mod.DEBUG_LOG_LEVEL.ToString(),Mod.IsGuiEnabled.ToString() ,
                Mod.UseAutoRefreshOption.ToString(), Mod.RESERVEAMOUNT.ToString(),Mod.IsEnabled.ToString(),Mod.IsInited.ToString(),
                Loader.isGuiRunning.ToString(), Mod.IsRedirectActive.ToString(),Mod.UseAutoRefreshOption.ToString(),
                Mod.AutoRefreshSeconds.ToString("F2"),Mod.config.GuiOpacity.ToString("F04"), Mod.config.ResetStatsEveryXMinutesEnabled.ToString(),
                Mod.config.ResetStatsEveryXMin.ToString("f2"), Mod.config.UseCustomLogFile.ToString(),
                Mod.config.DumpStatsOnMapEnd.ToString(),Mod.config.UseCustomDumpFile,
                Mod.config.DumpStatsFilePath};

            if ((bMode | Helper.DumpOption.GUIActive) == bMode)
            {            //gui mode exclusive
                tmpGuiExtra2 = new object[]{(Singleton<SimulationManager>.instance.m_metaData != null) ? Singleton<SimulationManager>.instance.m_metaData.m_newGameAppVersion.ToString():"n/a",
                (Singleton<SimulationManager>.instance.m_metaData  != null) ? Singleton<SimulationManager>.instance.m_metaData.m_CityName.ToString():"n/a",
                (Singleton<SimulationManager>.exists == true) ? Singleton<SimulationManager>.instance.SimulationPaused.ToString():"n/a"};

                Helper.ExternalData Mytmp;
                Mytmp = CSLServiceReserveGUI.GetInternalData();
                tmpGuiExtra = Mytmp.ToStringArray();
                //CSLServiceReserveGUI.GetInternalData.ToStringArray();
            }
        }
Beispiel #5
0
        private static string buildTheString(StringBuilder sb,DumpOption bMode)
        {
            try
            {
            //                Debug.Log(string.Concat("[CSLServiceReserve.Helper] elements tmpVer:", tmpVer.Length.ToString(),
            //                    " tmpPaths:", tmpPaths.Length.ToString()," tmpVehc:", tmpVehc.Length.ToString(),
            //                    " tmpdbg:",tmpdbg.Length.ToString()," tmpGuiExtra:", tmpGuiExtra.Length.ToString(), " tmpguiExtra2:",tmpGuiExtra2.Length.ToString() ));

                // Do our header & Mod version info if Default.
                sb.Append(DumpStatsHeader);

                if ((bMode | DumpOption.Default) == bMode)
                {
                    sb.Append(String.Format(DumpVersion,Mod.VERSION_BUILD_NUMBER ,DateTime.Now.ToString()));
                    sb.AppendLine(String.Format("CSLAppFullVersion: {0}  AppDataFormatVersion: {1}\r\n", BuildConfig.applicationVersionFull.ToString(), BuildConfig.DATA_FORMAT_VERSION.ToString()));
                }

                //dump Version and Path data if DebugInfo enabled.
                if ((bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append("raw commandline: " + CommandLine.raw.ToString() + "\r\n");
                    sb.Append(string.Format(dbgGameVersion, tmpVer));
                    sb.Append(String.Format(dbgDumpPaths, tmpPaths));
                }

                //dump VechData if enabled.
                if ((bMode | DumpOption.VehicleData) == bMode)
                {
                    sb.AppendFormat(String.Concat(DumpV0 , DumpV1, DumpV2, DumpV3, DumpV4, DumpV5, DumpV6,
                        Dumpv7, Dumpv8, Dumpv9), tmpVehc);

                }

                //debug into
                if ((bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append(String.Format(string.Concat(dbgDumpstr1,dbgDumpstr2, dbgDumpstr3,
                    dbgDumpstr4,dbgDumpstr5,dbgDumpstr6), tmpdbg));
                }

                //gui | map for sure loaded related things.
                if ((bMode | DumpOption.GUIActive) == bMode & (bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append(String.Format(dbgDumpstrGUIExtra1 ,tmpGuiExtra));
                    sb.Append(String.Format(dbgDumpstrGUIExtra2, tmpGuiExtra2));
                    AddLimitData(sb);
                }

                //dump pluging\mod info
                if ((bMode | DumpOption.ExtendedInfo) == bMode)
                {
                    AddGetPluginList(sb);
                }
                sb.AppendLine("--------End Dump--------\r\n");

            }
            catch (Exception ex)
            {
                dbgLog("Error:\r\n",ex,true);
            }

            if (Mod.DEBUG_LOG_ON & Mod.DEBUG_LOG_LEVEL >= 2) dbgLog("Built the log string to dump.");
            return sb.ToString();
        }
Beispiel #6
0
 public static void LogExtentedWrapper(DumpOption bMode)
 {
     StringBuilder sb = new StringBuilder((bMode | DumpOption.GUIActive) == bMode ? 8192 : 4096);
     RefreshSourceData(bMode);
     buildTheString(sb,bMode);
     DumpStatsToLog(sb.ToString(),bMode);
 }
Beispiel #7
0
        /// <summary>
        /// Dumps our stats to a custom file or normal log file.
        /// </summary>
        /// <param name="strText">The string data.</param>
        /// <param name="bMode">The options flags that was used to create it (used to know if custom file or not)</param>
        public static void DumpStatsToLog(string strText, DumpOption bMode = 0)
        {
            try
            {
                string strTempPath = "";
                bool bDumpToLog = true;
                if ((bMode | DumpOption.UseSeperateFile) == bMode)
                {
                    if (Mod.DEBUG_LOG_LEVEL > 1) dbgLog("\r\n-----Using Seperate file mode flagged" + bMode.ToString() + "-----\r\n");
                    if (Mod.config.UseCustomDumpFile)
                    {
                        if (Mod.DEBUG_LOG_LEVEL > 1) { dbgLog("\r\n\r\n--------------Using Seperate file enabled-----\r\n"); }
                        if (Mod.DEBUG_LOG_LEVEL > 1)
                        {
                            dbgLog("\r\n\r\n[debugdata] ---" + Mod.config.DumpStatsFilePath + " existspath: " +
                            Path.GetDirectoryName(Mod.config.DumpStatsFilePath) + "  combopath: " +
                            Path.Combine(DataLocation.executableDirectory.ToString(), Mod.config.DumpStatsFilePath));
                        }
                        strTempPath = System.IO.Directory.Exists(Path.GetDirectoryName(Mod.config.DumpStatsFilePath)) ? Mod.config.DumpStatsFilePath.ToString() : Path.Combine(DataLocation.executableDirectory.ToString(), Mod.config.DumpStatsFilePath);
                        bDumpToLog = false; //flag us custom file.
                    }
                }

                if (bDumpToLog)
                {
                    if (Mod.DEBUG_LOG_ON) { dbgLog("\r\n Dumping to default game log."); }
                    Debug.Log(strText);
                }
                else
                {
                    if (Mod.DEBUG_LOG_ON) { dbgLog("\r\n Dumping to custom log. " + strTempPath); }
                    using (StreamWriter streamWriter = new StreamWriter(strTempPath, true))
                    {
                        streamWriter.WriteLine(strText);
                    }
                }
            }
            catch (Exception ex)
            {
                dbgLog("Error:\r\n",ex,true);
            }
        }
Beispiel #8
0
        private static string buildTheString(StringBuilder sb, DumpOption bMode)
        {
            try
            {
//                Debug.Log(string.Concat("[CSLServiceReserve.Helper] elements tmpVer:", tmpVer.Length.ToString(),
//                    " tmpPaths:", tmpPaths.Length.ToString()," tmpVehc:", tmpVehc.Length.ToString(),
//                    " tmpdbg:",tmpdbg.Length.ToString()," tmpGuiExtra:", tmpGuiExtra.Length.ToString(), " tmpguiExtra2:",tmpGuiExtra2.Length.ToString() ));

                // Do our header & Mod version info if Default.
                sb.Append(DumpStatsHeader);

                if ((bMode | DumpOption.Default) == bMode)
                {
                    sb.Append(String.Format(DumpVersion, Mod.VERSION_BUILD_NUMBER, DateTime.Now.ToString()));
                    sb.AppendLine(String.Format("CSLAppFullVersion: {0}  AppDataFormatVersion: {1}", BuildConfig.applicationVersionFull.ToString(), BuildConfig.DATA_FORMAT_VERSION.ToString()));
                    if (PlatformService.active)
                    {
                        sb.AppendLine(String.Concat("ContentAllowed: ", PlatformService.appID.ToString(), PlatformService.IsDlcInstalled(346791) ? ", Deluxe" : "",
                                                    PlatformService.IsDlcInstalled(365040) ? ", preorder extras?" : "", PlatformService.IsDlcInstalled(369150) ? ", AfterDark" : "", "\r\n"));
                    }
                }

                //dump Version and Path data if DebugInfo enabled.
                if ((bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append("raw commandline: " + CommandLine.raw.ToString() + "\r\n");
                    sb.Append(string.Format(dbgGameVersion, tmpVer));
                    sb.Append(String.Format(dbgDumpPaths, tmpPaths));
                }


                //debug into
                if ((bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append(String.Format(string.Concat(dbgDumpstr1, dbgDumpstr2, dbgDumpstr3,
                                                          dbgDumpstr4, dbgDumpstr5, dbgDumpstr6), tmpdbg));
                }

                //gui | map for sure loaded related things.
                if ((bMode | DumpOption.GUIActive) == bMode & (bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append(String.Format(dbgDumpstrGUIExtra1, tmpGuiExtra));
                    sb.Append(String.Format(dbgDumpstrGUIExtra2, tmpGuiExtra2));
                }
                if ((bMode | DumpOption.MapLoaded) == bMode)
                {
                    AddLimitData(0, sb);
                }

                //dump pluging\mod info
                if ((bMode | DumpOption.ExtendedInfo) == bMode)
                {
                    AddGetPluginList(sb);

                    if (Mod.config.IncludePackageInfoInDump & (bMode | DumpOption.GUIActive) == bMode)
                    {
                        sb.Append(DoAllPackages().ToString());
                    }
                }
                sb.AppendLine("--------End Dump--------\r\n");
            }
            catch (Exception ex)
            {
                dbgLog("Error:\r\n", ex, true);
            }

            if (Mod.DEBUG_LOG_ON & Mod.DEBUG_LOG_LEVEL >= 2)
            {
                dbgLog("Built the log string to dump.");
            }
            return(sb.ToString());
        }
Beispiel #9
0
        private static string buildTheString(StringBuilder sb,DumpOption bMode)
        {
            try
            {
            //                Debug.Log(string.Concat("[CSLServiceReserve.Helper] elements tmpVer:", tmpVer.Length.ToString(),
            //                    " tmpPaths:", tmpPaths.Length.ToString()," tmpVehc:", tmpVehc.Length.ToString(),
            //                    " tmpdbg:",tmpdbg.Length.ToString()," tmpGuiExtra:", tmpGuiExtra.Length.ToString(), " tmpguiExtra2:",tmpGuiExtra2.Length.ToString() ));

                // Do our header & Mod version info if Default.
                sb.Append(DumpStatsHeader);

                if ((bMode | DumpOption.Default) == bMode)
                {
                    sb.Append(String.Format(DumpVersion, Mod.VERSION_BUILD_NUMBER, DateTime.Now.ToString()));
                    sb.AppendLine(String.Format("CSLAppFullVersion: {0}  AppDataFormatVersion: {1}", BuildConfig.applicationVersionFull.ToString(), BuildConfig.DATA_FORMAT_VERSION.ToString()));
                    if (PlatformService.active)
                    {
                        sb.AppendLine(String.Concat("ContentAllowed: ", PlatformService.appID.ToString(), PlatformService.IsDlcInstalled(346791) ? ", Deluxe" : "",
                            PlatformService.IsDlcInstalled(365040) ? ", preorder extras?" : "", PlatformService.IsDlcInstalled(369150) ? ", AfterDark" : "", "\r\n"));
                    }
                }

                //dump Version and Path data if DebugInfo enabled.
                if ((bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append("raw commandline: " + CommandLine.raw.ToString() + "\r\n");
                    sb.Append(string.Format(dbgGameVersion, tmpVer));
                    sb.Append(String.Format(dbgDumpPaths, tmpPaths));
                }

                //debug into
                if ((bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append(String.Format(string.Concat(dbgDumpstr1,dbgDumpstr2, dbgDumpstr3,
                    dbgDumpstr4,dbgDumpstr5,dbgDumpstr6), tmpdbg));
                }

                //gui | map for sure loaded related things.
                if ((bMode | DumpOption.GUIActive) == bMode & (bMode | DumpOption.DebugInfo) == bMode)
                {
                    sb.Append(String.Format(dbgDumpstrGUIExtra1 ,tmpGuiExtra));
                    sb.Append(String.Format(dbgDumpstrGUIExtra2, tmpGuiExtra2));
                }
                if ((bMode | DumpOption.MapLoaded) == bMode)
                {
                    AddLimitData(0, sb);
                }

                //dump pluging\mod info
                if ((bMode | DumpOption.ExtendedInfo) == bMode)
                {
                    AddGetPluginList(sb);

                    if (Mod.config.IncludePackageInfoInDump & (bMode | DumpOption.GUIActive) == bMode)
                    {
                        sb.Append(DoAllPackages().ToString());
                    }
                }
                sb.AppendLine("--------End Dump--------\r\n");

            }
            catch (Exception ex)
            {
                dbgLog("Error:\r\n",ex,true);
            }

            if (Mod.DEBUG_LOG_ON & Mod.DEBUG_LOG_LEVEL >= 2) dbgLog("Built the log string to dump.");
            return sb.ToString();
        }
Beispiel #10
0
 public static void LogExtentedWrapper(DumpOption bMode)
 {
     StringBuilder sb = new StringBuilder((bMode | DumpOption.GUIActive) == bMode ? (Mod.config.IncludePackageInfoInDump ? 262144 : 16384) : 8192);
     RefreshSourceData(bMode);
     buildTheString(sb,bMode);
     DumpStatsToLog(sb.ToString(),bMode);
 }