CompletelyOptional/OptionInterface_DataAPI.cs
/// <summary>
/// Load your raw data from ConfigMachine Mod.
/// Call this by your own.
/// Check <see cref="progDataTinkered"/> to see if saved data is tinkered or not.
/// </summary>
Load your raw data from ConfigMachine Mod.
Call this by your own.
Check  to see if saved data is tinkered or not.
Load your raw data from ConfigMachine Mod . Call this by your own . Check to see if saved data is tinkered or not .
public virtual void LoadData()
        {
            _data = defaultData;
            if (!directory.Exists) { DataOnChange(); return; }
            try
            {
                string data = string.Empty;
                foreach (FileInfo file in directory.GetFiles())
                {
                    if (file.Name != "data.txt") { continue; }
                    data = File.ReadAllText(file.FullName, Encoding.UTF8);
                    string key = data.Substring(0, 32);
                    data = data.Substring(32, data.Length - 32);
                    if (Custom.Md5Sum(data) != key)
                    {
                        Debug.Log($"CompletelyOptional) {rwMod.ModID} data file has been tinkered!");
                        dataTinkered = true;
                    }
                    else { dataTinkered = false; }
                    _data = Crypto.DecryptString(data, CryptoDataKey);
                    DataOnChange();
                    return;
                }
            }
            catch (Exception ex) { Debug.LogException(new LoadDataException(ex.ToString())); }
            DataOnChange();
        }
public virtual void LoadData ( ) { _data = defaultData ; if ( ! directory . Exists ) { DataOnChange ( ) ; return ; } try { string data = string . Empty ; foreach ( FileInfo file in directory . GetFiles ( ) ) { if ( file . Name != " " ) { continue ; } data = File . ReadAllText ( file . FullName , Encoding . UTF8 ) ; string key = data . Substring ( 0 , 32 ) ; data = data . Substring ( 32 , data . Length - 32 ) ; if ( Custom . Md5Sum ( data ) != key ) { Debug . Log ( $" CompletelyOptional)  { rwMod . ModID }  data file has been tinkered! " ) ; dataTinkered = true ; } else { dataTinkered = false ; } _data = Crypto . DecryptString ( data , CryptoDataKey ) ; DataOnChange ( ) ; return ; } } catch ( Exception ex ) { Debug . LogException ( new LoadDataException ( ex . ToString ( ) ) ) ; } DataOnChange ( ) ; }
Load your raw data from ConfigMachine Mod.
Load your raw data from ConfigMachine Mod .
//LoadData: