Beispiel #1
0
    public static byte[] GetBytes(string name, byte[] defaultValue, bool useSlots = true)
    {
        string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name;

        if (!File.Exists(path))
        {
            return(defaultValue);
        }
        return(File.ReadAllBytes(path));
    }
Beispiel #2
0
    public static string GetString(string name, string defaultValue = "", bool useSlots = true)
    {
        string path = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name;

        if (!File.Exists(path))
        {
            return(defaultValue);
        }
        return(File.ReadAllText(path));
    }
Beispiel #3
0
    public static void DeleteKey(string name, bool useSlots = true)
    {
        string path     = ((!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath()) + name;
        string filename = ((!useSlots) ? string.Empty : SaveSlotUtils.GetCloudSlotPath()) + name;
        bool   flag     = File.Exists(path);
        bool   flag2    = CoopSteamCloud.CloudFileExist(filename);

        if (flag)
        {
            File.Delete(path);
        }
        if (flag2 && CoopSteamCloud.ShouldUseCloud())
        {
            CoopSteamCloud.CloudDelete(filename);
        }
    }
Beispiel #4
0
    public static void SetBytes(string name, byte[] data, bool useSlots = true)
    {
        string text  = (!useSlots) ? SaveSlotUtils.GetUserPath() : SaveSlotUtils.GetLocalSlotPath();
        string text2 = text + name;

        if (!Directory.Exists(text))
        {
            Directory.CreateDirectory(text);
        }
        if (File.Exists(text2))
        {
            string text3 = text2 + "prev";
            if (File.Exists(text3))
            {
                File.Delete(text3);
            }
            File.Move(text2, text3);
        }
        File.WriteAllBytes(text2, data);
        if (CoopSteamCloud.ShouldUseCloud())
        {
            CoopSteamCloud.CloudSave(((!useSlots) ? string.Empty : SaveSlotUtils.GetCloudSlotPath()) + name, data);
        }
    }