Exemplo n.º 1
0
    /// <summary>
    /// Saves an data value.
    /// </summary>
    /// <param name="name">The name of the value you are trying to save.</param>
    /// <param name="value">What value should be saved under this name?</param>
    /// <param name="save">Should Read Write Save Manager save the value?</param>
    public void SetData(string name, bool value, bool save = false)
    {
        foreach (DataBool dataBool in bools)
        {
            if (dataBool.name == name)
            {
                dataBool.value = value;

                DebugPlus.Log("Set bool data value \"" + name + "\" to \"" + value + "\".", LogType.System, gameObject);

                if (save)
                {
                    Write();
                }

                return;
            }
        }

        bools.Add(new DataBool(name, value));

        DebugPlus.Log("Added bool data value \"" + name + "\" with a value of \"" + value + "\".", LogType.System, gameObject);

        if (save)
        {
            Write();
        }

        return;
    }
Exemplo n.º 2
0
        public T LoadJsonDataConfig <T>(string filePath) where T : new()
        {
            string path = "";

            if (ResourceManager.m_LoadFormAssetBundle)
            {
                path = JsonConfigPath.ConfigPath_Bundle + filePath;
            }
            else
            {
                path = JsonConfigPath.ConfigPath + filePath;
            }

            T data = new T();

            if (File.Exists(path))
            {
                StreamReader sr      = new StreamReader(path);
                string       jsonStr = sr.ReadToEnd();
                sr.Close();
                data = JsonMapper.ToObject <T>(jsonStr);
                return(data);
            }
            else
            {
                DebugPlus.LogError("JsonConfig Read Fail  Path=" + path);
            }
            return(default(T));
        }
Exemplo n.º 3
0
    /// <summary>
    /// Reads save data from file.
    /// Will delete save file if the current data version is higher.
    /// </summary>
    public void Read()
    {
        if (File.Exists(path))
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            FileStream      fileStream      = File.Open(path, FileMode.Open);

            DataContainer savedData = (DataContainer)binaryFormatter.Deserialize(fileStream);

            if (version > savedData.version)
            {
                fileStream.Close();

                DebugPlus.Log("Save data version (" + savedData.version + ") does not match current data version (" + version + "). Wiping save data...", LogType.System, gameObject);

                Wipe();
            }
            else
            {
                dataContainer = savedData;

                DebugPlus.Log("Loaded save file at \"" + path + "\".", LogType.System, gameObject);

                ArrayToList();

                fileStream.Close();
            }
        }
        else
        {
            DebugPlus.Log("Could not find a save file at \"" + path + "\", creating one...", LogType.System, gameObject);

            Write();
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Converts the lists the game edits to the arrays in the data class.
    /// </summary>
    public void ListToArray()
    {
        dataContainer.bools = new DataBool[bools.Count];
        for (int i = 0; i < bools.Count; i++)
        {
            dataContainer.bools[i] = bools[i];
        }

        dataContainer.ints = new DataInt[ints.Count];
        for (int i = 0; i < ints.Count; i++)
        {
            dataContainer.ints[i] = ints[i];
        }

        dataContainer.floats = new DataFloat[floats.Count];
        for (int i = 0; i < floats.Count; i++)
        {
            dataContainer.floats[i] = floats[i];
        }

        dataContainer.strings = new DataString[strings.Count];
        for (int i = 0; i < strings.Count; i++)
        {
            dataContainer.strings[i] = strings[i];
        }

        DebugPlus.Log("Updated data array values.", LogType.System, gameObject);
    }
Exemplo n.º 5
0
    public void SaveGoldInfo(string patchID, string gameID, string encounterLevel, string roomName, string passiveGold, string overkillGold, string totalGoldAtRoomEnd)
    {
        if (RoomController.roomController.debug)
        {
            return;
        }

        string filePath = GetCombatPath() + "/gold_data_" + SystemInfo.deviceUniqueIdentifier + ".csv";

        DebugPlus.LogOnScreen(filePath).Duration(5);
        DebugPlus.LogOnScreen(SystemInfo.deviceUniqueIdentifier);
        //Debug.Log(filePath);

        if (!File.Exists(filePath))
        {
            File.WriteAllText(filePath, "deviceID,patchID,gameID,encounterLevel,roomName,passiveGold,overkillGold,totalGoldAtRoomEnd\n");
        }

        string delimiter = ",";
        string line      = SystemInfo.deviceUniqueIdentifier;

        line += delimiter + patchID;
        line += delimiter + gameID;
        line += delimiter + encounterLevel;
        line += delimiter + roomName;
        line += delimiter + passiveGold;
        line += delimiter + overkillGold;
        line += delimiter + totalGoldAtRoomEnd;

        File.AppendAllText(filePath, line + "\n");
    }
Exemplo n.º 6
0
        void Update()
        {
            pitch -= Input.GetAxis("Mouse Y");
            pitch  = Mathf.Clamp(pitch, -90, 90);
            yaw   += Input.GetAxis("Mouse X");

            Camera.main.transform.rotation = Quaternion.Euler(pitch, yaw, 0);

            bool space = Input.GetKey(KeyCode.Space);

            // some logs on screen
            DebugPlus.LogOnScreen(space ? "space key down !" : "space key up")
            .Color(space ? Color.green : Color.red)
            .Duration(1);
            DebugPlus.LogOnScreen("yaw: " + yaw + " pitch: " + pitch)
            .Color(pitch > 0 ? Color.blue : Color.green);

            // some gizmos
            if (space)
            {
                DebugPlus.DrawWireSphere(new Vector3(0, 1, -2), 0.8f)
                .Color(Color.red)
                .Duration(2);
                DebugPlus.DrawSphere(new Vector3(0, 1, 0), 1)
                .Color(Color.blue)
                .Duration(2);
                DebugPlus.DrawCube(Vector3.zero, new Vector3(1, 2, 1))
                .Color(Color.cyan)
                .Matrix(go.transform.localToWorldMatrix);
            }
        }
Exemplo n.º 7
0
    /// <summary>
    /// Converts the arrays in the data class to the lists the game edits.
    /// </summary>
    public void ArrayToList()
    {
        bools.Clear();
        for (int i = 0; i < dataContainer.bools.Length; i++)
        {
            bools.Add(dataContainer.bools[i]);
        }

        ints.Clear();
        for (int i = 0; i < dataContainer.ints.Length; i++)
        {
            ints.Add(dataContainer.ints[i]);
        }

        floats.Clear();
        for (int i = 0; i < dataContainer.floats.Length; i++)
        {
            floats.Add(dataContainer.floats[i]);
        }

        strings.Clear();
        for (int i = 0; i < dataContainer.strings.Length; i++)
        {
            strings.Add(dataContainer.strings[i]);
        }

        DebugPlus.Log("Updated list values.", LogType.System, gameObject);
    }
Exemplo n.º 8
0
    public void SaveDeckInfo(string patchID, string gameID, string encounterLevel, string cardColor, string cardName, string energyCost, string manaCost, string chosenFlag, string removedFlag, string finalDeckListFlag)
    {
        if (RoomController.roomController.debug)
        {
            return;
        }

        string filePath = GetCombatPath() + "/deck_data_" + SystemInfo.deviceUniqueIdentifier + ".csv";

        DebugPlus.LogOnScreen(filePath).Duration(5);
        DebugPlus.LogOnScreen(SystemInfo.deviceUniqueIdentifier);
        //Debug.Log(filePath);

        if (!File.Exists(filePath))
        {
            File.WriteAllText(filePath, "deviceID,patchID,gameID,encounterLevel,cardColor,cardName,energyCost,manaCost,chosenFlag,removedFlag,finalDeckListFlag\n");
        }

        string delimiter = ",";
        string line      = SystemInfo.deviceUniqueIdentifier;

        line += delimiter + patchID;
        line += delimiter + gameID;
        line += delimiter + encounterLevel;
        line += delimiter + cardColor;
        line += delimiter + cardName;
        line += delimiter + energyCost;
        line += delimiter + manaCost;
        line += delimiter + chosenFlag;
        line += delimiter + removedFlag;
        line += delimiter + finalDeckListFlag;

        File.AppendAllText(filePath, line + "\n");
    }
Exemplo n.º 9
0
        public bool DataCheck()
        {
            bool          result     = true;
            List <string> configName = new List <string>();

            for (int i = 0; i < configData.Count; i++)
            {
                if (configName.Contains(configData[i].configName))
                {
                    DebugPlus.LogError("[BlockConfigData] : Find Same Block Config Name ! configName=" + configData[i].configName);
                    result = false;
                    continue;
                }
                else
                {
                    configName.Add(configData[i].configName);
                }
                if (CheckDistrictData(configData[i].districtConfig) == false)
                {
                    result = false;
                    continue;
                }
            }

            return(result);
        }
Exemplo n.º 10
0
    /// <summary>
    /// Saves an data value.
    /// </summary>
    /// <param name="name">The name of the value you are trying to save.</param>
    /// <param name="value">What value should be saved under this name?</param>
    /// <param name="save">Should Read Write Save Manager save the value?</param>
    public void SetData(string name, string value, bool save = false)
    {
        foreach (DataString dataString in strings)
        {
            if (dataString.name == name)
            {
                dataString.value = value;

                DebugPlus.Log("Set string data value \"" + name + "\" to \"" + value + "\".", LogType.System, gameObject);

                if (save)
                {
                    Write();
                }

                return;
            }
        }

        strings.Add(new DataString(name, value));

        DebugPlus.Log("Added string data value \"" + name + "\" with a value of \"" + value + "\".", LogType.System, gameObject);

        if (save)
        {
            Write();
        }

        return;
    }
Exemplo n.º 11
0
    /// <summary>
    /// Saves an data value.
    /// </summary>
    /// <param name="name">The name of the value you are trying to save.</param>
    /// <param name="value">What value should be saved under this name?</param>
    /// <param name="save">Should Read Write Save Manager save the value?</param>
    public void SetData(string name, float value, bool save = false)
    {
        foreach (DataFloat dataFloat in floats)
        {
            if (dataFloat.name == name)
            {
                dataFloat.value = value;

                DebugPlus.Log("Set float data value \"" + name + "\" to \"" + value + "\".", LogType.System, gameObject);

                if (save)
                {
                    Write();
                }

                return;
            }
        }

        floats.Add(new DataFloat(name, value));

        DebugPlus.Log("Added float data value \"" + name + "\" with a value of \"" + value + "\".", LogType.System, gameObject);

        if (save)
        {
            Write();
        }

        return;
    }
Exemplo n.º 12
0
        private void MethodC()
        {
            DebugPlus.StartChronometer(showAverage: true);

            Thread.Sleep(10);

            DebugPlus.StopCurrentChronometer();
        }
Exemplo n.º 13
0
        private void MethodA()
        {
            DebugPlus.StartChronometer();

            MethodB();
            MethodC();

            DebugPlus.StopCurrentChronometer();
        }
Exemplo n.º 14
0
 private void Awake()
 {
     // some code timing
     MethodA();
     MethodA();
     MethodA();
     MethodA();
     MethodA();
     Debug.Log(DebugPlus.GetChronometerReport());
 }
Exemplo n.º 15
0
        public bool DataCheck()
        {
            bool result = true;

            if (gamePrepareConfig.prepareProperty == null)
            {
                DebugPlus.LogError("[GamePrepareConfig] : prepareProperty null!");
                return(false);
            }

            for (int i = 0; i < gamePrepareConfig.prepareProperty.Count; i++)
            {
                var item = gamePrepareConfig.prepareProperty[i];
                for (int j = 0; j < item.levelMax; j++)
                {
                    GamePreapre_ConfigItem.ConfigLevelMap mapData = null;
                    mapData = item.levelMap.Find(x => x.Level == j + 1);
                    if (mapData == null)
                    {
                        DebugPlus.LogError("[GamePrepareConfig] : levelMap Empty!  configName=" + item.configID + " levelID=" + (j + 1).ToString());
                        result = false;
                        continue;
                    }
                }

                if (item.defaultSelectLevel <= 0 || item.defaultSelectLevel > item.levelMax)
                {
                    DebugPlus.LogError("[GamePrepareConfig] : DefaultSelect Error!  configName=" + item.configID);
                }
            }

            for (int i = 0; i < gamePrepareConfig.AIPrepareConfig.Count; i++)
            {
                var item = gamePrepareConfig.AIPrepareConfig[i];
                for (int j = 0; j < item.levelMax; j++)
                {
                    GamePreapre_ConfigItem.ConfigLevelMap mapData = null;
                    mapData = item.levelMap.Find(x => x.Level == j + 1);
                    if (mapData == null)
                    {
                        DebugPlus.LogError("[GamePrepareConfig] : levelMap Empty!  configName=" + item.configID + " levelID=" + (j + 1).ToString());
                        result = false;
                        continue;
                    }
                }

                if (item.defaultSelectLevel <= 0 || item.defaultSelectLevel > item.levelMax)
                {
                    DebugPlus.LogError("[GamePrepareConfig] : DefaultSelect Error!  configName=" + item.configID);
                }
            }

            return(result);
        }
Exemplo n.º 16
0
    /// <summary>
    /// Resets the current save file's values.
    /// </summary>
    public void Wipe()
    {
        dataContainer = new DataContainer();

        ArrayToList();

        DebugPlus.Log("Wiped save data... Saving...", LogType.System, gameObject);

        Write();

        Read();
    }
Exemplo n.º 17
0
        void LoadGame()
        {
            var saveData = GameDataSaveManager.Instance.GetSaveData(currentGroupID, currentSaveIndexID);

            DebugPlus.Log("LoadSave Start");

            ScenesManager.Instance.LoadSceneStartCallBack = () =>
            {
                GameDataSaveManager.Instance.LoadAllSave(saveData);
            };
            ScenesManager.Instance.LoadingScene(UIPath.ScenePath.Scene_Test);
        }
Exemplo n.º 18
0
 public void DebugGrid()
 {
     DebugPlus.LogOnScreen("########").Duration(10);
     for (int y = 0; y < ySize; y++)
     {
         string s = "";
         for (int x = 0; x < xSize; x++)
         {
             s += objects[x, y].Count;
         }
         DebugPlus.LogOnScreen(s).Duration(10);
     }
 }
Exemplo n.º 19
0
        private bool CheckDistrictData(Block_District_Config config)
        {
            bool result = true;

            if (config == null)
            {
                return(false);
            }
            List <Vector2> posList = new List <Vector2>();

            for (int i = 0; i < config.gridConfig.Count; i++)
            {
                byte[] posArray = config.gridConfig[i].coordinate;
                if (posArray.Length != 2)
                {
                    DebugPlus.LogError("[BlockConfigData] : Pos FormatError! array= " + posArray.ToString() + " Name=" + config.configName);
                    result = false;
                    continue;
                }
                Vector2 pos = new Vector2(posArray[0], posArray[1]);
                if (posList.Contains(pos))
                {
                    DebugPlus.LogError("[BlockConfigData] : Find Same Coordinate! array=" + posArray.ToString() + " Name=" + config.configName);
                    result = false;
                    continue;
                }
            }

            ///Check Match
            for (int i = 0; i < config.areaX; i++)
            {
                for (int j = 0; j < config.areaY; j++)
                {
                    Vector2 pos = new Vector2(i, j);
                    if (!posList.Contains(pos))
                    {
                        DebugPlus.LogError("[BlockConfigData] : Find Empty Coordinate! posX=" + i + " ,  PosY= " + j + "Name = " + config.configName);
                        result = false;
                        continue;
                    }
                }
            }

            ///Check Size
            if (Utility.TryParseInt((config.realityRatio * config.areaX).ToString()) == 0 || Utility.TryParseInt((config.realityRatio * config.areaY).ToString()) == 0)
            {
                DebugPlus.LogError("[BlockConfigData] : DistrictRealSize is not interger!" + config.configName);
                result = false;
            }
            return(result);
        }
Exemplo n.º 20
0
        private void MethodB()
        {
            DebugPlus.StartChronometer();

            DebugPlus.StartChronometer("sub bloc");
            // your timed sub bloc
            Thread.Sleep(3);
            DebugPlus.StopCurrentChronometer();

            MethodC();
            MethodC();
            MethodC();

            DebugPlus.StopCurrentChronometer();
        }
Exemplo n.º 21
0
    /// <summary>
    /// Writes the data to a file.
    /// </summary>
    public void Write()
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      fileStream      = File.Create(path);

        ListToArray();

        dataContainer.version = version;

        binaryFormatter.Serialize(fileStream, dataContainer);
        fileStream.Close();

        DebugPlus.Log("Wrote save file to \"" + path + "\".", LogType.System, gameObject);

        OnWrite.Invoke();
    }
Exemplo n.º 22
0
    public void SaveCombatInfo(string patchID, string gameID, string encounterLevel, string roomName, string turnID, string castOrder, string cardColor, string cardName, string heldFlag, string replacedFlag,
                               string unplayedFlag, string castFlag, string casterName, string targetCount, string targetName, string vitDamageDone, string shieldDamageDone, string manaGenerated, string manaUsed)
    {
        if (RoomController.roomController.debug)
        {
            return;
        }

        string filePath = GetCombatPath() + "/combat_data_" + SystemInfo.deviceUniqueIdentifier + ".csv";

        DebugPlus.LogOnScreen(filePath).Duration(5);
        DebugPlus.LogOnScreen(SystemInfo.deviceUniqueIdentifier);
        //Debug.Log(filePath);

        if (!File.Exists(filePath))
        {
            File.WriteAllText(filePath, "deviceID,patchID,gameID,encounterLevel,roomName,turnID,castOrder,cardColor,cardName,heldFlag,replacedFlag,unplayedFlag,castFlag,casterName,targetCount,targetName,vitDamageDone,shieldDamageDone,manaGenerated,manaUsed\n");
        }

        string delimiter = ",";
        string line      = SystemInfo.deviceUniqueIdentifier;

        line += delimiter + patchID;
        line += delimiter + gameID;
        line += delimiter + encounterLevel;
        line += delimiter + roomName;
        line += delimiter + turnID;
        line += delimiter + castOrder;
        line += delimiter + cardColor;
        line += delimiter + cardName;
        line += delimiter + heldFlag;
        line += delimiter + replacedFlag;
        line += delimiter + unplayedFlag;
        line += delimiter + castFlag;
        line += delimiter + casterName;
        line += delimiter + targetCount;
        line += delimiter + targetName;
        line += delimiter + vitDamageDone;
        line += delimiter + shieldDamageDone;
        line += delimiter + manaGenerated;
        line += delimiter + manaUsed;

        File.AppendAllText(filePath, line + "\n");
    }
Exemplo n.º 23
0
        public bool DataCheck()
        {
            bool result = true;

            if (shield_slot_unlock_energycost_map == null || shield_slot_unlock_energycost_map.Length == 0)
            {
                DebugPlus.LogError("[MainShipBasePropertyConfig] : shield_slot_unlock_energycost_map config is null");
                return(false);
            }
            if (shieldLevelMap == null || shieldLevelMap.Count == 0)
            {
                DebugPlus.LogError("[MainShipBasePropertyConfig] : shieldLevelMap config is null!");
                return(false);
            }
            List <int> levelMapList = new List <int>();

            for (int i = 0; i < shieldLevelMap.Count; i++)
            {
                if (levelMapList.Contains(shieldLevelMap[i].Level))
                {
                    DebugPlus.LogError("[MainShipShieldLevelMap] : find same levelID!  levelID=" + shieldLevelMap[i].Level);
                    result = false;
                    continue;
                }
            }
            ///Check Range
            if (shield_slot_unlock_energycost_map[shield_slot_unlock_energycost_map.Length - 1] > shield_energy_total_max_limit)
            {
                DebugPlus.LogError("[shield_slot_unlock_energycost_map] : Out of Range! max=" + shield_energy_total_max_limit);
                result = false;
            }
            ///Check Data
            for (int i = 0; i <= shield_energy_total_max_limit; i++)
            {
                if (!levelMapList.Contains(i))
                {
                    DebugPlus.LogError("[MainShipShieldLevelMap] : find empty config ! Level=" + i);
                    result = false;
                    continue;
                }
            }
            return(result);
        }
Exemplo n.º 24
0
    public Vector2 FindNearestEmptyLocation(Vector2 startingLoc, List <Vector2> occupiedLocations, int size)
    {
        Dictionary <int, Vector2> locations = new Dictionary <int, Vector2>();

        for (int x = -3; x < 3; x++)
        {
            for (int y = -3; y < 3; y++)
            {
                Vector2 newLoc = GetRoundedVector(startingLoc, size) + new Vector2(x, y);
                //Debug.Log(newLoc);
                List <Vector2> newLocs = new List <Vector2>();
                foreach (Vector2 loc in occupiedLocations)
                {
                    newLocs.Add(newLoc + loc);
                }
                if (!CheckIfOutOfBounds(newLocs) && GetObjectAtLocation(newLocs).Count == 0)
                {
                    locations[GetManhattanDistance(startingLoc, newLoc)] = newLoc;
                }
            }
        }
        DebugPlus.LogOnScreen(locations.Keys.ToString()).Duration(10);
        return(locations[locations.Keys.Min()]);
    }
Exemplo n.º 25
0
 /// <summary>
 /// 实时添加日志
 /// </summary>
 /// <param name="message">提示信息</param>
 /// <param name="isStackTrace">是否包含调用堆栈</param>
 /// <param name="cacheTypeEnum">是否缓存</param>
 public void Real(string message, bool isStackTrace, CacheTypeEnum cacheTypeEnum)
 {
     var value = new DebugPlus
     {
         StackTrace = isStackTrace ? new StackTrace() : null,
         StackFrame = isStackTrace ? null : new StackFrame(1),
         Message = message
     };
     if (_cache == CacheTypeEnum.None || CheckCache(value, _cache == CacheTypeEnum.Queue)) RealOutput(value);
 }
Exemplo n.º 26
0
 /// <summary>
 /// 实时添加日志并抛出异常
 /// </summary>
 /// <param name="message">提示信息</param>
 /// <param name="isStackTrace">是否包含调用堆栈</param>
 /// <param name="cacheTypeEnum">是否缓存</param>
 public void ThrowReal(string message, bool isStackTrace, CacheTypeEnum cacheTypeEnum)
 {
     var value = new DebugPlus
     {
         StackTrace = isStackTrace ? new StackTrace() : null,
         StackFrame = isStackTrace ? null : new StackFrame(1),
         Message = message
     };
     if (cacheTypeEnum == CacheTypeEnum.None || CheckCache(value, cacheTypeEnum == CacheTypeEnum.Queue)) RealOutput(value);
     throw new Exception(ExceptionPrefix + message);
 }
Exemplo n.º 27
0
 /// <summary>
 /// 检测缓存是否存在
 /// </summary>
 /// <param name="value">日志信息</param>
 /// <param name="isQueue">是否缓存队列</param>
 /// <returns>是否继续输出日志</returns>
 private bool CheckCache(DebugPlus value, bool isQueue)
 {
     hashString key = value.ToString();
     if (isQueue)
     {
         interlocked.NoCheckCompareSetSleep0(ref _cacheLock);
         try
         {
             if (_cache.Get(key, false)) return false;
             _cache.Set(key, true);
             if (_cache.Count > _maxCacheCount) _cache.Pop();
         }
         finally { _cacheLock = 0; }
         return true;
     }
     if (key.Equals(_lastCache)) return false;
     _lastCache = key;
     return true;
 }
Exemplo n.º 28
0
 /// <summary>
 /// 日志信息写文件
 /// </summary>
 /// <param name="value">日志信息</param>
 private void RealOutput(DebugPlus value)
 {
     if (_isDisposed == 0)
     {
         if (_fileStream == null)
         {
             Console.WriteLine(@" " + date.NowSecond.toString() + " : " + value.ToString());
         }
         else
         {
             memoryPool.pushSubArray data = _fileStream.GetBytes(@" " + date.NowSecond.toString() + " : " + value.ToString() + @" ");
             if (Interlocked.CompareExchange(ref _fileLock, 1, 0) != 0)
             {
                 Thread.Sleep(0);
                 while (Interlocked.CompareExchange(ref _fileLock, 1, 0) != 0) Thread.Sleep(1);
             }
             try
             {
                 if (_fileStream.UnsafeWrite(data) >= MaxSize && MaxSize > 0) MoveBakBase();
                 else _fileStream.Flush(true);
             }
             finally { _fileLock = 0; }
         }
     }
 }
 private void Update()
 {
     DebugPlus.LogOnScreen("OnGround: " + IsGrounded());
     DebugPlus.LogOnScreen("GroundType: " + GetGroundTypeBelow());
     DebugPlus.LogOnScreen("IsOnSlide: " + IsOnSlide());
 }
Exemplo n.º 30
0
 public void SetLogType(LogType _logType)
 {
     DebugPlus.SetLogType(_logType);
 }
Exemplo n.º 31
0
 /// <summary>
 /// 实时添加日志并抛出异常
 /// </summary>
 /// <param name="error">错误异常</param>
 /// <param name="message">提示信息</param>
 /// <param name="cacheTypeEnum">是否缓存</param>
 public void ThrowReal(Exception error, string message, CacheTypeEnum cacheTypeEnum)
 {
     if (error != null && error.Message.StartsWith(ExceptionPrefix, StringComparison.Ordinal)) error = null;
     if (error == null)
     {
         if (message != null) ThrowReal(message, true, cacheTypeEnum);
     }
     else
     {
         var value = new DebugPlus
         {
             Exception = error,
             Message = message
         };
         if (cacheTypeEnum == CacheTypeEnum.None || CheckCache(value, cacheTypeEnum == CacheTypeEnum.Queue)) RealOutput(value);
         throw error != null ? new Exception(ExceptionPrefix + message, error) : new Exception(ExceptionPrefix + message);
     }
 }
Exemplo n.º 32
0
 /// <summary>
 /// 添加日志
 /// </summary>
 /// <param name="message">提示信息</param>
 /// <param name="isStackTrace">是否包含调用堆栈</param>
 /// <param name="cacheTypeEnum">缓存类型</param>
 public void Add(string message, bool isStackTrace, CacheTypeEnum cacheTypeEnum)
 {
     DebugPlus value = new DebugPlus
     {
         StackTrace = isStackTrace ? new StackTrace() : null,
         StackFrame = isStackTrace ? null : new StackFrame(1),
         Message = message
     };
     if (cacheTypeEnum == CacheTypeEnum.None || CheckCache(value, cacheTypeEnum == CacheTypeEnum.Queue)) Output(value);
 }
Exemplo n.º 33
0
 /// <summary>
 /// 实时添加日志并抛出异常
 /// </summary>
 /// <param name="error">异常类型</param>
 public void ThrowReal(ExceptionTypeEnum error)
 {
     var value = new DebugPlus
     {
         StackTrace = new StackTrace(),
         Type = error
     };
     if (CheckCache(value, true)) RealOutput(value);
     throw new Exception(ExceptionPrefix + value.ToString());
 }