예제 #1
0
        public static List <Product> loadThemeSaveByName(string name)
        {
            try
            {
                List <Product> lsProduct = new List <Product>();
                string         fileName  = Path.Combine(currentFolderUser, "TCP\\" + name + ".txt");

                string data    = File.ReadAllText(fileName);
                var    jsArray = JArray.Parse(data);
                foreach (var item in jsArray)
                {
                    Product p = new Product();
                    p._Id       = item["_Id"].ToString();
                    p.Name      = item["Name"].ToString();
                    p.PrintSize = item["PrintSize"].ToString();
                    p.Price     = double.Parse(item["Price"].ToString());
                    var colors = JArray.Parse(item["Colors"].ToString());
                    p.Colors = new List <OColor>();
                    foreach (var color in colors)
                    {
                        OColor c = new OColor();
                        c.Name  = color["Name"].ToString();
                        c.Hex   = color["Hex"].ToString();
                        c.Image = color["Image"].ToString();
                        p.Colors.Add(c);
                    }
                    lsProduct.Add(p);
                }
                return(lsProduct);
            }
            catch
            {
                XtraMessageBox.Show("File not found...!", "Message");
                return(null);
            }
        }
예제 #2
0
 public override string ToString()
 {
     return($"    T=[{TColor.ToString()}]\n    J=[{JColor.ToString()}]\n    Z=[{ZColor.ToString()}]\n    O=[{OColor.ToString()}]\n    S=[{SColor.ToString()}]\n    L=[{LColor.ToString()}]\n    I=[{IColor.ToString()}]");
 }