Пример #1
0
    public static bool load(ref SolutionOrganizer set, bool draw, string name, List <Directories> hierarchie = null, bool use_install_folder = false)
    {
        hierarchie ??= new List <Directories>();
        hierarchie.AddRange(hierVal.AsEnumerable());

        string path = CreatePathToFile(out bool loadable, name + endingVal, "JSON", hierarchie, use_install_folder);

        if (!loadable)
        {
            hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count);
            return(false);
        }


        FactOrganizer save = StageStatic.stage.factState;

        StageStatic.stage.factState = new SolutionOrganizer(false) as FactOrganizer;

        loadable = FactOrganizer.load(ref StageStatic.stage.player_record.factState
                                      , draw, name + endingSol, hierarchie, use_install_folder, out Dictionary <string, string> old_to_new);

        if (loadable)
        {
            set          = (SolutionOrganizer)StageStatic.stage.factState;
            set.path_Val = path;
        }

        StageStatic.stage.factState = save;
        hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count);
        if (!loadable)
        {
            return(false);
        }


        var JsonTmp = JSONManager.ReadFromJsonFile <List <SubSolution> > (path);

        foreach (var element in JsonTmp)
        // Parse and add
        {
            element.MasterIDs = new HashSet <string>(element.MasterIDs.Select(k => old_to_new[k]));
            set.ValidationSet.Add(element);
        }

        return(true);
    }
Пример #2
0
    public static bool load(ref FactOrganizer set, bool draw, string name, List<Directories> hierarchie, bool use_install_folder, out Dictionary<string, string> old_to_new)
    {
        old_to_new = null;
        hierarchie ??= new List<Directories>();
        hierarchie.AddRange(hierState.AsEnumerable());

        string path = CreatePathToFile(out bool loadable, name, "JSON", hierarchie, use_install_folder);
        hierarchie.RemoveRange(hierarchie.Count - hierState.Count, hierState.Count);
        if (!loadable)
            return false;

        PublicFactOrganizer de_json = JSONManager.ReadFromJsonFile<PublicFactOrganizer>(path);
        FactOrganizerFromPublic(ref set, de_json, draw, out old_to_new);
        set.path = path;

        return true;
    }
Пример #3
0
    public static bool ShallowLoad(ref Stage set, string path)
    {
        if (!System.IO.File.Exists(path))
        {
            return(false);
        }

        set      = JSONManager.ReadFromJsonFile <Stage>(path);
        set.path = path;

        set.hierarchie ??= new List <Directories>();
        set.hierarchie.AddRange(hierStage.AsEnumerable());
        //if (!set.player_record.load(set.hierarchie))
        //    set.player_record = new PlayerRecord(set.record_name);
        set.hierarchie.RemoveRange(set.hierarchie.Count - hierStage.Count, hierStage.Count);

        return(true);
    }