示例#1
0
        public ImageSchema(Models.ImageProfile imageProfile, string schemaType, Models.Image image = null)
        {
            string schema = null;

            //Only To display the main image specs file when not using a profile.
            if (image != null)
            {
                var path = Settings.PrimaryStoragePath + "images" + Path.DirectorySeparatorChar + image.Name + Path.DirectorySeparatorChar + "schema";
                if (File.Exists(path))
                {
                    using (StreamReader reader = new StreamReader(path))
                    {
                        schema = reader.ReadLine() ?? "";
                    }
                }
            }

            if (imageProfile != null)
            {
                if (!string.IsNullOrEmpty(imageProfile.CustomSchema) && schemaType == "deploy")
                {
                    schema = imageProfile.CustomSchema;
                }
                else if (!string.IsNullOrEmpty(imageProfile.CustomUploadSchema) && schemaType == "upload")
                {
                    schema = imageProfile.CustomUploadSchema;
                }
                else
                {
                    var path = Settings.PrimaryStoragePath + "images" + Path.DirectorySeparatorChar + imageProfile.Image.Name + Path.DirectorySeparatorChar +
                               "schema";
                    if (File.Exists(path))
                    {
                        using (StreamReader reader = new StreamReader(path))
                        {
                            schema = reader.ReadLine() ?? "";
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(schema))
            {
                _imageSchema = JsonConvert.DeserializeObject<Models.ImageSchema.GridView.ImageSchemaGridView>(schema);
            }
        }
示例#2
0
        public ImageSchema(Models.ImageProfile imageProfile, string schemaType, Models.Image image = null)
        {
            string schema = null;

            //Only To display the main image specs file when not using a profile.
            if (image != null)
            {
                var path = Settings.PrimaryStoragePath + "images" + Path.DirectorySeparatorChar + image.Name + Path.DirectorySeparatorChar + "schema";
                if (File.Exists(path))
                {
                    using (StreamReader reader = new StreamReader(path))
                    {
                        schema = reader.ReadLine() ?? "";
                    }
                }
            }

            if (imageProfile != null)
            {
                if (!string.IsNullOrEmpty(imageProfile.CustomSchema) && schemaType == "deploy")
                {
                    schema = imageProfile.CustomSchema;
                }
                else if (!string.IsNullOrEmpty(imageProfile.CustomUploadSchema) && schemaType == "upload")
                {
                    schema = imageProfile.CustomUploadSchema;
                }
                else
                {
                    var path = Settings.PrimaryStoragePath + "images" + Path.DirectorySeparatorChar + imageProfile.Image.Name + Path.DirectorySeparatorChar +
                               "schema";
                    if (File.Exists(path))
                    {
                        using (StreamReader reader = new StreamReader(path))
                        {
                            schema = reader.ReadLine() ?? "";
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(schema))
            {
                _imageSchema = JsonConvert.DeserializeObject <Models.ImageSchema.GridView.ImageSchemaGridView>(schema);
            }
        }