示例#1
0
    private void Load()
    {
        if (System.IO.File.Exists(GetFilePath()))
        {
            string text = System.IO.File.ReadAllText(GetFilePath());
            Data = FullserializerAPI.Deserialize <AppData>(text);
        }
        if (Data == null)
        {
            Data = new AppData();
        }

        if (Data != null)
        {
            if (Data.Customers == null)
            {
                Data.Customers = new List <AppData.Order>();
            }

            if (Data.Customers.Count == 0)
            {
                CreateCustomer();
            }
            else
            {
                if (Data.Customers[Data.Customers.Count - 1].Data.Count > 0)
                {
                    CreateCustomer();
                }
            }

            for (int i = 0; i < Data.Customers.Count; i++)
            {
                SpawnOrder(Data.Customers[i]);
            }

            if (Data.Teammembers == null)
            {
                Data.Teammembers = new Dictionary <string, AppData.Order>();
            }
            foreach (var item in Data.Teammembers)
            {
                SpawnTeamMember(item.Key);
            }
        }
    }
示例#2
0
    private void Save()
    {
        string text = FullserializerAPI.Serialize <AppData>(Data);

        System.IO.File.WriteAllText(GetFilePath(), text);
    }