Inheritance: ScriptableObject
        static private async Task<Images> download(string domain, string path, string pattern)
        {
            var result = new Images();
            var client = new RestClient(domain);
            var restTasks = new List<Task<IRestResponse>>();
            var response = client.Get(new RestRequest(path, Method.GET));

            foreach (Match match in Regex.Matches(response.Content, pattern))
            {
                string fileName = match.Captures[0].Value.Replace(">", "");
                result.Add(fileName, 0);
                if (!File.Exists(baseDir(path) + "\\" + fileName))
                {
                    var img = new RestRequest(path + fileName, Method.GET);
                    img.AddParameter("fileName", fileName);
                    restTasks.Add(client.ExecuteTaskAsync(img));
                }
            }

            foreach (var restTask in restTasks)
            {
                response = await restTask;
                string fileName = response.Request.Parameters[0].Value.ToString();
                result[fileName] = (int)response.StatusCode;
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    var fs = File.Create(baseDir(path) + "\\" + fileName);
                    await fs.WriteAsync(response.RawBytes, 0, response.RawBytes.Length);
                    fs.Close();
                }
            }
            return result;
        }
Esempio n. 2
0
    public void Page_Load(object sender, EventArgs e)
    {
        imageBasePage = (Page as Images);
        ImageProfile = imageBasePage.ImageProfile;
        Image = imageBasePage.Image;

        if (ImageProfile == null)
        {
            osx_profile.Visible = false;
            linux_profile.Visible = false;
            winpe_profile.Visible = false;
            return;
        }
        if (Image == null) Response.Redirect("~/", true);
        divProfiles.Visible = false;
        if (Image.Environment == "macOS")
        {
            osx_profile.Visible = true;
            linux_profile.Visible = false;
            winpe_profile.Visible = false;
        }
        else if(Image.Environment == "linux" || Image.Environment == "")
        {
            osx_profile.Visible = false;
            linux_profile.Visible = true;
            winpe_profile.Visible = false;
        }
        else if (Image.Environment == "winpe")
        {
            osx_profile.Visible = false;
            linux_profile.Visible = false;
            winpe_profile.Visible = true;
        }
    }
Esempio n. 3
0
 public ActionResult AddGroupPicture(UserGroup model, int id, HttpPostedFileBase file)
 {
     UserGroup group = db.UserGroups.Find(model.ID);
     if (group == null)
     {
         return HttpNotFound();
     }
     else
     {
         if (file != null)
         {
             string random = Helpers.DateHelper.GetTimeStamp();
             Images product_img = new Images();
             product_img.TID = model.ID;
             product_img.ImageType = ImageType.UserGroup;
             product_img.ContentType = file.ContentType;
             product_img.Time = DateTime.Now;
             string root = "~/GroupFile/" + group.GroupName + "/";
             var phicyPath = HostingEnvironment.MapPath(root);
             Directory.CreateDirectory(phicyPath);
             file.SaveAs(phicyPath + random + file.FileName);
             product_img.Path = "/GroupFile/" + group.GroupName + "/" + random + file.FileName;
             db.Images.Add(product_img);
             db.SaveChanges();
             return Redirect("/UserGroup/GroupPictureShow/" + group.ID);
         }
         else
         {
             ModelState.AddModelError("", "图片信息有问题,请重新上传");
             return Redirect("/UserGroup/GroupPictureShow/" + group.ID);
         }
     }
 }
 public SearchResultViewModel(
     SearchResult searchResult,
     Images.ImageCacheService imageCacheService)
 {
     _searchResult = searchResult;
     _imageCacheService = imageCacheService;
 }
Esempio n. 5
0
	bool ImageButton(float xpos, float ypos, Images image){
		Texture2D imageData = GetImage(image);
		if (GUI.Button(xpos,ypos,imageData.width,imageData.height)) {
			return true;
		}else{
			return false;	
		}
	}
Esempio n. 6
0
        public Image(uint id, string fullsizePath, string previewPath, Images images)
            : base(id)
        {
            _images = images;

            _fullsizeImage = MemoryImage.Create(Inventory,fullsizePath);
            _previewImage = MemoryImage.Create(Inventory,previewPath);
            _previewImage.Load();
        }
Esempio n. 7
0
		/**
		* Constructor
		*/
		public XmlBuilder(Form ownerForm, Images images)
		{
			this.Items = new ArrayList();
			this.Menus = new ArrayList();
			this.Buttons = new ArrayList();
			this.CheckBoxes = new ArrayList();
			this.ComboBoxes = new ArrayList();
			this.Shortcuts = new ArrayList();
			this.OwnerForm = ownerForm;
			this.Images = images;
		}
 public MyCommuteViewModel(
     Subscriptions.SubscriptionService subscriptions,
     Search.SearchService search,
     Images.ImageCacheService imageCacheService,
     CommuterApplication application,
     Media.MediaCacheService mediaCacheService)
 {
     _subscriptions = subscriptions;
     _search = search;
     _imageCacheService = imageCacheService;
     _application = application;
     _mediaCacheService = mediaCacheService;
 }
Esempio n. 9
0
 //------------------------------------------------------------
 //                       Common
 //------------------------------------------------------------
 public Item(uint id, Items items)
     : base(id)
 {
     Items = items;
     Images = new Images(this);
     Tags = new ItemTags(this);
     Tags.CollectionChanged += OnTagsChanged;
     Images.CollectionChanged += OnImagesChanged;
     Images.PropertyChanged += OnImagesChanged;
     PropertyChanged += OnUpdateCache;
     // needs to be called manually since the delegate
     // wasn't set when the id was changed.
     UpdateCache();
 }
Esempio n. 10
0
        public static Image Get(Images img)
        {
            Image result = null;

            Type objectType = (from asm in AppDomain.CurrentDomain.GetAssemblies()
                               from type in asm.GetTypes()
                               where type.IsClass && type.Name == "Printer" // identify by printer class because printer.cs is in this dll
                               select type).Single();

            using (Stream stream = objectType.Assembly.GetManifestResourceStream("FHoner.Kasse.Frontend.Controller.Resources.Images." + img.ToString() + ".png"))
            {
                result = Image.FromStream(stream);
            }
            return result;
        }
Esempio n. 11
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     string name = textName.Text.Trim();
     string number = textNumber.Text.Trim();
     string jf = textJf.Text.Trim();
     if (name == string.Empty)
     {
         Response.Write("<script>alert(\"名称不能为空\");</script>");
         textName.Focus();
         return;
     }
     try
     {
         Convert.ToInt32(number);
     }
     catch
     {
         Response.Write("<script>alert(\"数量输入错误\");</script>");
         textNumber.Text = "";
         textNumber.Focus();
         return;
     }
     try
     {
         Convert .ToInt32(jf);
     }
     catch
     {
         Response.Write("<script>alert(\"积分输入错误\");</script>");
         textJf.Text="";
         textJf .Focus();
         return;
     }
     moyu.Images myImg = new Images();
     string image = myImg.upLoadForExchange(FileUpload1.PostedFile, Server.MapPath("~"));
     moyu.Ecard.Living myLiving=new Ecard.Living();
     if(myLiving.exchangeAdd(name,Convert .ToInt32(number),Convert .ToInt32(jf),image))
     {
         Response.Write("<script>alert(\"添加陈功\");</script>");
         textJf.Text = "";
         textName.Text="";
         textNumber.Text="";
     }
     else
     {
         Response.Write("<script>alert(\"添加失败\");</script>");
     }
 }
Esempio n. 12
0
        public async void ReadMyXML(string albumid)
        {
            Images = new Images();
            AllImages = new Images();

            Progress<int> progress = new Progress<int>((p) => { ProgressPercent = p; });

            BasicFileDownloader bidl = new BasicFileDownloader(ToAbsoluteUri("xmlonealbum.aspx?ah=" + albumid));
            IRandomAccessStream s = await bidl.DownloadAsync(progress);

            XmlReaderSettings settings = new XmlReaderSettings();
            settings.ConformanceLevel = ConformanceLevel.Fragment;
            settings.IgnoreWhitespace = true;
            settings.IgnoreComments = true;
            settings.Async = true;
            XmlReader reader = XmlReader.Create(s.AsStream(), settings);
            reader.ReadStartElement("Model");
            reader.ReadStartElement("PhotoList");
            Count = 0;
            string albumtitle = "";
            while (reader.IsStartElement())
            {
                string main = reader[3];
                albumtitle = reader[2];
                string phototitle = reader[1];
                string str = reader[0];
                str = str.Replace(".jpg", "");

                OneImage oi = new OneImage(phototitle, str, Count);
                AllImages.Add(oi);
                if (char.ToUpper(main[0]) == 'Y')
                {
                    MainImage = oi;
                }
                else
                {
                    Images.Add(oi);
                }
                //var donotuse = oi.MediumSizeStream; // Access it here - so that the download for it kicks off
                Count++;

                await reader.ReadAsync();
            }
            AlbumTitle = albumtitle;
        }
		public ActionResult Save()
		{

			foreach (string name in Request.Files)
			{
				HttpPostedFileBase file = Request.Files[name];

				string fileName = System.IO.Path.GetFileName(file.FileName);

				Image image = new Image(fileName, Request["description"]);

				Images model = new Images();
				model.Add(image, file);

			}

			return RedirectToAction("index");

		}
Esempio n. 14
0
 public Form1(Images myimglist, Form2 Splash)
 {
     formSplash = Splash;
     InitializeComponent(); 
     ControlExtensions.DoubleBuffering(lstvw_Display, true);//Enable double buffering for Display listview to reduce flickering
     picbx_MasterDLs.AllowDrop = true;
     picbx_Trash.AllowDrop = true;
     picbx_Newhdd.AllowDrop = true;
     picbx_Laptop.AllowDrop = true;
     LastLocation[0] = "Newest Shows";
      
     tskLoadImgs = Task.Run(() =>
     {
         myImgs = myimglist;
         if (myImgs.LoadedImageList != null & myImgs.LoadedImageList.Images.Count > 0)
             lstvw_Display.LargeImageList = myImgs.LoadedImageList;
     });
     tskShowlist = Task.Run(() => LoadShowlist(), ctsShowlist.Token);
     tskShowlist.ContinueWith(_ => sl.UpdateShowlist(), ctsShowlist.Token);  
     progbarNewestShows.Visible = true; 
 } 
Esempio n. 15
0
 public ActionResult AddBusinessPicture(Business model, HttpPostedFileBase file)
 {
     Business business = db.Businesses.Find(model.ID);
     if (business != null)
     {
         if (file != null)
         {
             try
             {
                 string random = DateHelper.GetTimeStamp();
                 Images product_img = new Images();
                 product_img.TID = model.ID;
                 product_img.ImageType = ImageType.Business;
                 product_img.ContentType = file.ContentType;
                 product_img.Time = DateTime.Now;
                 string root = "~/BusinessFile/" + business.BusinessName + "/";
                 var phicyPath = HostingEnvironment.MapPath(root);
                 Directory.CreateDirectory(phicyPath);
                 file.SaveAs(phicyPath + random + file.FileName);
                 product_img.Path = "/BusinessFile/" + business.BusinessName + "/" + random + file.FileName;
                 db.Images.Add(product_img);
                 db.SaveChanges();
                 return Redirect("/Business/BusinessPictureShow/" + business.ID);
             }
             catch (Exception ex)
             {
                 log.Error(new LogContent("商户宣传图片增加出错", HttpHelper.GetIPAddress()), ex);
                 return Redirect("/Business/AddBusinessPicture/"+model.ID);
             }
         }
         else
         {
             return Redirect("/Business/BusinessPictureShow/" + business.ID);
         }
     }
     else
     {
         return Redirect("/Shared/Info?msg=该商户不存在,请不要不合理操作");
     }
 }
Esempio n. 16
0
 public void Train()
 {
     model.Train(Images.Select(i => i.MNISTData));
 }
 internal static Microsoft.SPOT.Bitmap GetBitmap(Images.BitmapResources id)
 {
     return ((Microsoft.SPOT.Bitmap)(Microsoft.SPOT.ResourceUtility.GetObject(ResourceManager, id)));
 }
Esempio n. 18
0
 public void UpdateVm(VM vm)
 {
     Vm = vm;
     cellImage.Value = Images.GetImage16For(vm);
     cellVm.Value    = vm.Name();
 }
Esempio n. 19
0
        private void generatePoolHABox(Pool pool)
        {
            if (!pool.ha_enabled)
            {
                restartHBInitializationTimer = true;
                return;
            }

            if (restartHBInitializationTimer)
            {
                restartHBInitializationTimer = false;
                SetNetworkHBInitDelay();
            }

            // 'High Availability' heading
            CustomListRow header = CreateHeader(Messages.HA_CONFIGURATION_TITLE);

            customListPanel.AddRow(header);
            AddRow(header, GetFriendlyName("pool.ha_enabled"), pool, getPoolHAStatus, false);
            {
                // ntol row. May be red and bold.
                bool redBold = pool.ha_host_failures_to_tolerate == 0;

                CustomListRow newChild = CreateNewRow(Messages.HA_CONFIGURED_CAPACITY, new ToStringWrapper <Pool>(pool, getNtol), redBold);
                header.AddChild(newChild);

                if (redBold)
                {
                    newChild.Items[1].ForeColor = Color.Red;
                    ToolStripMenuItem editHa = new ToolStripMenuItem(Messages.CONFIGURE_HA_ELLIPSIS);
                    editHa.Click += delegate { EditHA(pool); };
                    newChild.MenuItems.Add(editHa);
                    newChild.DefaultMenuItem = editHa;
                }
                else
                {
                    newChild.Items[1].ForeColor = BaseTabPage.ItemValueForeColor;
                }
            }

            {
                // plan_exists_for row needs some special work: the text may be red and bold
                bool          redBold  = haStatusRed(pool);
                CustomListRow newChild = CreateNewRow(Messages.HA_CURRENT_CAPACITY, new ToStringWrapper <Pool>(pool, getPlanExistsFor), redBold);
                header.AddChild(newChild);

                if (redBold)
                {
                    newChild.Items[1].ForeColor = Color.Red;
                    ToolStripMenuItem editHa = new ToolStripMenuItem(Messages.CONFIGURE_HA_ELLIPSIS);
                    editHa.Click += delegate { EditHA(pool); };
                    newChild.MenuItems.Add(editHa);
                    newChild.DefaultMenuItem = editHa;
                }
                else
                {
                    newChild.Items[1].ForeColor = BaseTabPage.ItemValueForeColor;
                }
            }
            AddBottomSpacing(header);

            // 'Heartbeating status' heading
            header = CreateHeader(Messages.HEARTBEATING_STATUS);
            customListPanel.AddRow(header);

            // Now build the heartbeat target health table

            List <SR> heartbeatSRs = pool.GetHAHeartbeatSRs();

            // Sort heartbeat SRs using NaturalCompare
            heartbeatSRs.Sort((Comparison <SR>) delegate(SR a, SR b)
            {
                return(StringUtility.NaturalCompare(a.Name, b.Name));
            });

            List <Host> members = new List <Host>(pool.Connection.Cache.Hosts);

            // Sort pool members using NaturalCompare
            members.Sort((Comparison <Host>) delegate(Host a, Host b)
            {
                return(StringUtility.NaturalCompare(a.Name, b.Name));
            });
            int numCols = 1 + 2 + (2 * heartbeatSRs.Count); // Hostnames col, then 2 each for each HB target (network + SRs)
            int numRows = 1 + members.Count;

            // Create rows and cols
            tableLatencies.SuspendLayout();
            tableLatencies.ColumnCount = numCols;
            tableLatencies.ColumnStyles.Clear();
            for (int i = 0; i < numCols; i++)
            {
                tableLatencies.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            }
            tableLatencies.RowCount = numRows;
            tableLatencies.RowStyles.Clear();
            for (int i = 0; i < numRows; i++)
            {
                tableLatencies.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            }

            {
                // Network icon
                PictureBox p = new PictureBox();
                p.Image    = Images.GetImage16For(Icons.Network);
                p.SizeMode = PictureBoxSizeMode.AutoSize;
                p.Padding  = new Padding(0);
                tableLatencies.Controls.Add(p);
                tableLatencies.SetCellPosition(p, new TableLayoutPanelCellPosition(1, 0));
                // Network text
                Label l = new Label();
                l.Padding   = new Padding(0, 5, 5, 5);
                l.Font      = BaseTabPage.ItemLabelFont;
                l.ForeColor = BaseTabPage.ItemLabelForeColor;
                l.AutoSize  = true;
                l.Text      = Messages.NETWORK;
                tableLatencies.Controls.Add(l);
                tableLatencies.SetCellPosition(l, new TableLayoutPanelCellPosition(2, 0));
            }

            for (int i = 0; i < heartbeatSRs.Count; i++)
            {
                // SR icon
                PictureBox p = new PictureBox();
                p.Image    = Images.GetImage16For(heartbeatSRs[i].GetIcon);
                p.SizeMode = PictureBoxSizeMode.AutoSize;
                p.Padding  = new Padding(0);
                tableLatencies.Controls.Add(p);
                tableLatencies.SetCellPosition(p, new TableLayoutPanelCellPosition((2 * i) + 3, 0));
                // SR name
                Label l = new Label();
                l.Padding      = new Padding(0, 5, 5, 5);
                l.Font         = BaseTabPage.ItemLabelFont;
                l.ForeColor    = BaseTabPage.ItemLabelForeColor;
                l.AutoSize     = false;
                l.Size         = new Size(200, 25);
                l.AutoEllipsis = true;
                l.Text         = heartbeatSRs[i].Name;
                tableLatencies.Controls.Add(l);
                tableLatencies.SetCellPosition(l, new TableLayoutPanelCellPosition((2 * i) + 4, 0));
            }

            for (int i = 0; i < members.Count; i++)
            {
                // Server name label
                Label l = new Label();
                l.Padding   = new Padding(5);
                l.Font      = BaseTabPage.ItemLabelFont;
                l.ForeColor = BaseTabPage.ItemLabelForeColor;
                l.AutoSize  = true;
                l.Text      = members[i].Name.Ellipsise(30);
                tableLatencies.Controls.Add(l);
                tableLatencies.SetCellPosition(l, new TableLayoutPanelCellPosition(0, i + 1));

                // Network HB status
                l           = new Label();
                l.Padding   = new Padding(0, 5, 0, 5);
                l.Font      = BaseTabPage.ItemValueFont;
                l.AutoSize  = true;
                l.ForeColor = (members[i].ha_network_peers.Length == members.Count && initializationDelayElapsed) ? Color.Green : BaseTabPage.ItemValueForeColor;

                if (initializationDelayElapsed)
                {
                    if (members[i].ha_network_peers.Length == 0)
                    {
                        l.Text = Messages.HA_HEARTBEAT_UNHEALTHY;
                    }
                    else if (members[i].ha_network_peers.Length == members.Count)
                    {
                        l.Text = Messages.HA_HEARTBEAT_HEALTHY;
                    }
                    else
                    {
                        l.Text = String.Format(Messages.HA_HEARTBEAT_SERVERS, members[i].ha_network_peers.Length, members.Count);
                    }
                }
                else
                {
                    l.Text = Messages.HA_HEARTBEAT_SERVERS_INITIALISING;
                }

                tableLatencies.Controls.Add(l);
                tableLatencies.SetCellPosition(l, new TableLayoutPanelCellPosition(1, i + 1));
                tableLatencies.SetColumnSpan(l, 2);

                // For each heartbeat SR, show health from this host's perspective
                for (int j = 0; j < heartbeatSRs.Count; j++)
                {
                    l           = new Label();
                    l.Padding   = new Padding(0, 5, 0, 5);
                    l.Font      = BaseTabPage.ItemValueFont;
                    l.ForeColor = BaseTabPage.ItemValueForeColor;
                    l.AutoSize  = true;
                    l.Text      = Messages.HA_HEARTBEAT_UNHEALTHY;
                    foreach (string opaqueRef in members[i].ha_statefiles)
                    {
                        XenRef <VDI> vdiRef = new XenRef <VDI>(opaqueRef);
                        VDI          vdi    = pool.Connection.Resolve(vdiRef);
                        if (vdi == null)
                        {
                            continue;
                        }
                        SR sr = pool.Connection.Resolve(vdi.SR);
                        if (sr == null)
                        {
                            continue;
                        }
                        if (sr == heartbeatSRs[j])
                        {
                            l.ForeColor = Color.Green;
                            l.Text      = Messages.HA_HEARTBEAT_HEALTHY;
                            break;
                        }
                    }
                    tableLatencies.Controls.Add(l);
                    tableLatencies.SetCellPosition(l, new TableLayoutPanelCellPosition((2 * j) + 2, i + 1));
                    tableLatencies.SetColumnSpan(l, 2);
                }
            }

            tableLatencies.ResumeLayout();
            tableLatencies.PerformLayout();
        }
Esempio n. 20
0
        public ActionResult AddProduct(bool Condition, string Description, string Name, decimal Price,
            string SubCategories_Categories_Name, string SubCategories, string image)
        {
            Service1Client client = new Service1Client();
            Guid g = Guid.NewGuid();
            Images ima = new Images()
            {
                User = (BuyNet.User)Session["User"],
                img = "~/pics/" + g,
                UserId = int.Parse((string)Session["LogUserId"])

            };
            client.AddImage(ima);
            Product product = new Product()
            {
                Condition = Condition,
                Description = Description,
                Name = Name,
                Price = Price,
            };
            client.AddProduct(product);

            return View("index", client.GetCategories());
        }
Esempio n. 21
0
        public ActionResult SellNewProduct(string productName, int categoryId, int? subCategoryId, bool? itemCondiation, decimal price,
            string productDescription, HttpPostedFileBase[] files)
        {
            Product p = new Product()
            {
                CategoryId = subCategoryId,
                Condition = itemCondiation ?? true,
                Price = price,
                Description = productDescription,
                Category = client.SubCategory(subCategoryId ?? 1)
            };
            client.AddProduct(p);
            if (Request.Files.Count > 0)
            {

                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];

                    if (file != null && file.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(file.FileName);
                        Guid g = Guid.NewGuid();
                        var path = Path.Combine(Server.MapPath("~/pics/"), g.ToString() + fileName);

                        string directory = @"/pics/" + g.ToString() + fileName;

                        Images ima = new Images()
                        {
                            img = directory,
                            ProductId = client.GetProducts().FirstOrDefault(pr => pr == p).Id
                        };
                        client.AddImage(ima);
                        file.SaveAs(path);
                    }
                }

            }

            foreach (var photovar in Request.Files)
            {
                if (photovar is HttpPostedFileBase)
                {
                    HttpPostedFileBase photo = (HttpPostedFileBase)photovar;

                    if (photo != null && photo.ContentLength > 0)
                    {
                        Guid g = Guid.NewGuid();
                        string directory = @"~/pics/" + g;

                        Images ima = new Images()
                        {
                            img = directory,
                            ProductId = client.GetProducts().FirstOrDefault(pr => pr == p).Id
                        };

                        if (photo.ContentLength > 10240)
                        {
                            ModelState.AddModelError("photo", "The size of the file should not exceed 10 KB");
                            return View();
                        }

                        var supportedTypes = new[] { "jpg", "jpeg", "png" };

                        var fileExt = System.IO.Path.GetExtension(photo.FileName).Substring(1);

                        if (!supportedTypes.Contains(fileExt))
                        {
                            ModelState.AddModelError("photo", "Invalid type. Only the following types (jpg, jpeg, png) are supported.");
                            return View();
                        }

                        var fileName = Path.GetFileName(photo.FileName);
                        photo.SaveAs(Path.Combine(directory, fileName));
                    }

                }
            }

            return View();
        }
        public static void Seed(AppDBContext db)
        {
            List <Images> images = new List <Images>();

            if (db.Images.Count() == 0)
            {
                Images image1 = new Images()
                {
                    ImagePath = "~/Images/1.jpg"
                };
                images.Add(image1);
                Images image2 = new Images()
                {
                    ImagePath = "~/Images/2.jpg"
                };
                images.Add(image2);
                Images image3 = new Images()
                {
                    ImagePath = "~/Images/3.jpg"
                };
                images.Add(image3);
                Images image4 = new Images()
                {
                    ImagePath = "~/Images/4.jpg"
                };
                images.Add(image4);
                Images image5 = new Images()
                {
                    ImagePath = "~/Images/5.jpg"
                };
                images.Add(image5);
                Images image6 = new Images()
                {
                    ImagePath = "~/Images/6.jpg"
                };
                images.Add(image6);
                Images WhiteSpace = new Images()
                {
                    ImagePath = "~/Images/WhiteSpace.jpg"
                };
                images.Add(WhiteSpace);
                foreach (var img in images)
                {
                    db.Add(img);
                }
                db.SaveChanges();
            }

            ICollection <CardModel>  Cards      = new List <CardModel>();
            ICollection <EmailModel> seedEmails = new List <EmailModel>();
            ICollection <EmailModel> TempEmails = new List <EmailModel>();

            if (db.Emails.FirstOrDefault(e => e.Email == "*****@*****.**") == null)
            {
                EmailModel mail1 = new EmailModel()
                {
                    Email     = "*****@*****.**",
                    FirstName = "Rowan",
                    LastName  = "Brouwer"
                };
                seedEmails.Add(mail1);

                foreach (var mail in seedEmails)
                {
                    db.Add(mail);
                    TempEmails.Add(mail);
                }

                db.SaveChanges();

                if (db.Cards.Count() == 0)
                {
                    CardModel card1 = new CardModel()
                    {
                        FontType = FontType.IOnlyKnow2FontTypes,
                        Message  = "Hello from the organised side",
                        Emails   = TempEmails,
                        Image    = db.Images.FirstOrDefault(i => i.Id == 2),
                    };
                    Cards.Add(card1);

                    foreach (var card in Cards)
                    {
                        db.Add(card);
                    }
                }
            }
            db.SaveChanges();
        }
Esempio n. 23
0
        public static async void RegisterToCosmosdb([ActivityTrigger] IDurableActivityContext context, ILogger log)
        {
            var feedOptions = new FeedOptions
            {
                MaxItemCount = 1,
                EnableCrossPartitionQuery = true
            };

            var input = context.GetInput <(string user_id, string url, string score, string image_id)>();

            var httpClient = HttpStart.GetInstance();
            var userInfo   = await httpClient.GetAsync($"https://api.line.me/v2/bot/profile/{input.user_id}");

            var data = JsonConvert.DeserializeObject <LineUserInfoInterface>(userInfo);

            TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");

            var item = new DocumentInterface()
            {
                ImageId         = input.image_id,
                User            = data.Name,
                UserIcon        = data.PictureUrl,
                PictureUrl      = input.url.Replace(AppSettings.Instance.BLOB_URL, AppSettings.Instance.PROXY_URL),
                Score           = double.Parse(input.score),
                GoodCnt         = 0,
                CreatedDatatime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.Now.ToUniversalTime(), tst),
                UpdatedDatatime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.Now.ToUniversalTime(), tst)
            };

            var ducumentClient = HttpStart.GetDocumentInstance();
            await ducumentClient.CreateDatabaseIfNotExistsAsync(new Database { Id = AppSettings.Instance.DATABASE_ID });

            PartitionKeyDefinition pkDefn = new PartitionKeyDefinition()
            {
                Paths = new Collection <string>()
                {
                    "/image_id"
                }
            };
            await ducumentClient.CreateDocumentCollectionIfNotExistsAsync(
                UriFactory.CreateDatabaseUri(AppSettings.Instance.DATABASE_ID), new DocumentCollection { Id = AppSettings.Instance.COLLECTION_ID, PartitionKey = pkDefn },
                new RequestOptions { OfferThroughput = 400, PartitionKey = new PartitionKey("/image_id") });

            await ducumentClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(AppSettings.Instance.DATABASE_ID, AppSettings.Instance.COLLECTION_ID), item);

            var documentQuery = ducumentClient.CreateDocumentQuery <DocumentInterface>(UriFactory.CreateDocumentCollectionUri(AppSettings.Instance.DATABASE_ID, AppSettings.Instance.COLLECTION_ID), feedOptions)
                                .OrderByDescending(x => x.Score)
                                .ToList();

            var rank = new RankResponseInterface();

            rank.Images = new List <Images>();
            var count = 0;

            foreach (var res in documentQuery)
            {
                var image = new Images
                {
                    ImageId    = res.ImageId,
                    User       = res.User,
                    UserIcon   = res.UserIcon,
                    PictureUrl = res.PictureUrl,
                    Score      = res.Score,
                    GoodCnt    = res.GoodCnt,
                    Rank       = count += 1
                };
                rank.Images.Add(image);
            }

            await httpClient.PostJsonAsync <RankResponseInterface>(AppSettings.Instance.SIGNALR_URL, rank);
        }
Esempio n. 24
0
        public void Draw(Graphics g, Font font, Color foreColor)
        {
            Battle battle;
            User   founder;

            if (!GetBattleAndFounder(out battle, out founder))
            {
                return;
            }

            var x = 1; // margin
            var y = 3;

            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            Action newLine = () =>
            {
                x  = 1;
                y += 16;
            };
            Action <string> drawString = text =>
            {
                TextRenderer.DrawText(g, text, font, new Point(x, y), foreColor);
                x += (int)Math.Ceiling((double)TextRenderer.MeasureText(g, text, font).Width);
            };
            Action <Image, int, int> drawImage = (image, w, h) =>
            {
                g.DrawImage(image, x, y, w, h);
                x += w + 3;
            };

            founder = battle.Founder;
            drawString("Founder: " + battle.Founder);
            newLine();
            drawString("Map: " + battle.MapName);
            newLine();
            drawString("Players: " + battle.NonSpectatorCount);
            drawString("Spectators: " + battle.SpectatorCount);
            drawString("Friends: " + battle.Users.Count(u => Program.FriendManager.Friends.Contains(u.Name)));
            newLine();

            if (battle.Rank > 0)
            {
                drawImage(Images.GetRank(battle.Rank), 16, 16);
                var rankText = battle.Rank == 0 ? "Beginner" : string.Format(" > {0} hours", User.RankLimits[battle.Rank]);
                drawString("Minimum Rank: " + rankText);
                newLine();
            }

            if (founder.IsInGame)
            {
                drawImage(ZklResources.boom, 16, 16);
                var timeString = DateTime.Now.Subtract(founder.InGameSince.Value).PrintTimeRemaining();
                drawString("The battle has been going on for at least " + timeString + ".");
                newLine();
            }
            if (battle.IsPassworded)
            {
                drawImage(ZklResources._lock, 16, 16);
                drawString("Joining requires a password.");
                newLine();
            }

            if (battle.IsReplay)
            {
                drawImage(ZklResources.replay, 16, 16);
                drawString("Battle is replay.");
                newLine();
            }

            if (battle.IsLocked)
            {
                drawImage(ZklResources.redlight, 16, 16);
                drawString("Battle is locked.");
                newLine();
            }
            newLine();


            foreach (var player in battle.Users)
            {
                var user = Program.TasClient.ExistingUsers[player.Name];
                var icon = TextImage.GetUserImage(user.Name);
                drawImage(icon, 16, 16);
                Image flag;
                y += 3;
                if (Images.CountryFlags.TryGetValue(user.Country, out flag) && flag != null)
                {
                    drawImage(flag, flag.Width, flag.Height);
                }
                else
                {
                    x += 19;
                }
                y -= 3;
                if (!user.IsBot)
                {
                    drawImage(Images.GetRank(user.Level), 16, 16);
                    var clan = ServerImagesHandler.GetClanOrFactionImage(user);

                    if (clan.Item1 != null)
                    {
                        drawImage(clan.Item1, 16, 16);
                    }
                }

                /*
                 * if (user.IsZkLobbyUser)
                 * {
                 *  drawImage(Resources.ZK_logo_square, 16, 16);
                 * }*/
                drawString(player.Name);

                var top10 = Program.SpringieServer.GetTop10Rank(user.Name);
                if (top10 > 0)
                {
                    var oldx = x;
                    drawImage(ZklResources.cup, 16, 16);
                    x -= 17;
                    drawString(top10.ToString());
                    x = oldx + 16;
                }

                if (!user.IsBot)
                {
                    if (user.IsAway)
                    {
                        drawImage(ZklResources.away, 16, 16);
                    }
                    if (user.IsInGame)
                    {
                        drawImage(ZklResources.ingame, 16, 16);
                    }
                }
                newLine();
            }
            if (Program.TasClient.MyBattle != null && battle.BattleID == Program.TasClient.MyBattle.BattleID && !String.IsNullOrEmpty(Program.ModStore.ChangedOptions))
            {
                newLine();
                drawString("Game Options:");
                newLine();
                foreach (var line in Program.ModStore.ChangedOptions.Lines().Where(z => !string.IsNullOrEmpty(z)))
                {
                    drawString("  " + line);
                    newLine();
                }
            }
        }
Esempio n. 25
0
 public static object GetIcon(IEvent @event)
 {
     return(Images.GetIcon(MemberIcon.Event, MethodTreeNode.GetOverlayIcon(@event.Accessibility), @event.IsStatic));
 }
Esempio n. 26
0
        private static IEnumerable <InlineQueryResultArticle> ConvertImagesToInlineQueryResultPhoto(Images images)
        {
            if (images == null)
            {
                return(new List <InlineQueryResultArticle>());
            }
            var imagesValues = images.Value;
            var result       = imagesValues.Select(i => new InlineQueryResultArticle()
            {
                Id                  = Guid.NewGuid().ToString(),
                Title               = i.Name,
                Url                 = i.ContentUrl,
                Description         = i.Name,
                ThumbUrl            = i.ThumbnailUrl,
                InputMessageContent = new InputTextMessageContent
                {
                    MessageText = i.ContentUrl
                }
            });

            return(result.ToArray());
        }
Esempio n. 27
0
 protected virtual void SetImage()
 {
     Image = Images.GetImage16For(TheSR);
 }
 public static Images CreateImages(int imageID) {
     Images images = new Images();
     images.ImageID = imageID;
     return images;
 }
Esempio n. 29
0
        /// <summary>
        /// Fetches the images.
        /// </summary>
        /// <param name="person">The person.</param>
        /// <param name="searchResult">The search result.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        private async Task FetchImages(Person person, Images searchResult, CancellationToken cancellationToken)
        {
            if (searchResult != null && searchResult.profiles.Count > 0)
            {
                //get our language
                var profile =
                    searchResult.profiles.FirstOrDefault(
                        p =>
                        !string.IsNullOrEmpty(GetIso639(p)) &&
                        GetIso639(p).Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage,
                                          StringComparison.OrdinalIgnoreCase));
                if (profile == null)
                {
                    //didn't find our language - try first null one
                    profile =
                        searchResult.profiles.FirstOrDefault(
                            p =>
                                !string.IsNullOrEmpty(GetIso639(p)) &&
                            GetIso639(p).Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage,
                                              StringComparison.OrdinalIgnoreCase));

                }
                if (profile == null)
                {
                    //still nothing - just get first one
                    profile = searchResult.profiles[0];
                }
                if (profile != null && !person.HasImage(ImageType.Primary))
                {
                    var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);

                    await DownloadAndSaveImage(person, tmdbSettings.images.base_url + ConfigurationManager.Configuration.TmdbFetchedProfileSize + profile.file_path,
                                             MimeTypes.GetMimeType(profile.file_path), cancellationToken).ConfigureAwait(false);
                }
            }
        }
 public void AddToImages(Images images) {
     base.AddObject("Images", images);
 }
 private IEnumerable<Still> GetPosters(Images images)
 {
     return images.stills ?? new List<Still>();
 }
Esempio n. 32
0
        private Hashtable[] getImageRequestItems(Hashtable userData)
        {
            Hashtable[] rt = new Hashtable[1];
            rt[0] = new Hashtable();
            rt[0]["id"] = 0;
            rt[0]["messageType"] = 1;
            rt[0]["title"] = "图片上传失败";
            rt[0]["body"] = "啊噢,图片上传失败了。。。\n" +
                "失败的具体原因是:";
            rt[0]["picSmall"] = getPicUrl(false);
            rt[0]["picBig"] = getPicUrl(true);
            rt[0]["url"] = "http://www.ai0932.com/mobile/robot-group-kewWordsShow.aspx?type=group&tag=-1";
            rt[0]["orders"] = 0;
            WebClient wc = new WebClient();
            HttpWebResponse res;
            string folderPath=System.DateTime.Now.Year + "/" + System.DateTime.Now.Month + "/" + System.DateTime.Now.Day + "/";
            string savePath = HttpContext.Current.Server.MapPath("~/upload/userImages/" + folderPath);
            if (!Directory.Exists(savePath))
            {
                Directory.CreateDirectory(savePath);
            }
            res = (HttpWebResponse)WebRequest.Create(userData["@PicUrl"].ToString()).GetResponse();
            if (res.StatusCode != HttpStatusCode.OK)
            {
                //链接不正常
                rt[0]["body"] = rt[0]["body"] + "服务器连接失败";
                return rt;
            }
            string contentType=res.ContentType.ToLower();
            if (contentType.IndexOf("image") == -1)
            {
                //不是图片
                rt[0]["body"] = rt[0]["body"] + "你上传的好像不是图片";
                return rt;
            }
            string fileName="";
            if (contentType.IndexOf("png") > -1)
            {
                fileName = ".png";
            }
            else if (contentType.IndexOf(".gif") > -1)
            {
                fileName = ".gif";
            }
            else if (contentType.IndexOf("jpeg") > -1 || contentType.IndexOf("jpg") > -1)
            {
                fileName = ".jpg";
            }
            if (fileName.Length == 0)
            {
                //未知图片格式
                rt[0]["body"] = rt[0]["body"] + "不支持的图片格式";
                return rt;
            }

            fileName = System.Guid.NewGuid().ToString("N") + fileName;
            wc.DownloadFile(userData["@PicUrl"].ToString(), savePath + fileName);

            string fileNameThumbnail ="s_"+ System.Guid.NewGuid().ToString("N") + fileName;
            moyu.Images myImg = new Images();
            moyu.Images.MakeThumbnail(savePath+fileName,savePath+fileNameThumbnail,300,0,"W");

            int uid=getWeiUserId(userData["@FromUserName"].ToString());
            string imgUrl = "http://www.ai0932.com/upload/userImages/" + folderPath + fileNameThumbnail;
            Information.group myGroup = new Information.group();
            int tid = myGroup.topicNewByWeixin("爆照", ("我在" + System.DateTime.Now.ToShortTimeString() + "在左邻分享了一张照片"), -1, uid, "<img src=\"" + imgUrl + "\"/>");
            moyu.User.Functions myUser=new User.Functions();
            int pid = myUser.upLoadImg(uid, savePath+ fileName, tid.ToString(), imgUrl);
            Hashtable[] rtSuccess = new Hashtable[1];
            rtSuccess[0] = new Hashtable();
            rtSuccess[0]["id"] = 0;
            rtSuccess[0]["messageType"] = 2;
            rtSuccess[0]["body"] = "图片分享成功";
            rtSuccess[0]["title"] = "成功分享了一张图片@" + System.DateTime.Now.ToShortTimeString() + "\n" +
                " 点这里为图片添加文字说明并查看分享的图片";
            rtSuccess[0]["picSmall"] = getPicUrl(false);
            rtSuccess[0]["picBig"] = imgUrl;
            rtSuccess[0]["url"] = "http://www.ai0932.com/mobile/addPicIntroduce.aspx?tid=" + tid + "&pid=" + pid;
            rtSuccess[0]["orders"] = 10;

            //rtSuccess[1] = new Hashtable();
            //rtSuccess[1]["id"] = 0;
            //rtSuccess[1]["messageType"] = 2;
            //rtSuccess[1]["title"] = "为图片添加文字说明?点击这里去给图片添加文字说明";
            //rtSuccess[1]["body"] = "为图片添加文字说明?点击这里去给图片添加文字说明";
            //rtSuccess[1]["picSmall"] = getPicUrl(false);
            //rtSuccess[1]["picBig"] = getPicUrl(true);
            //rtSuccess[1]["url"] = "http://www.ai0932.com/mobile/addPicIntroduce.aspx?tid="+tid+"&pid="+pid;
            //rtSuccess[1]["orders"] = 6;
            User.Functions myFunction = new User.Functions();
            myFunction.givePostPoint(uid, "发图积分", 1);
            return rtSuccess;
        }
        public void CreateBucket(BucketArgs args)
        {
            Event.RaiseEvent("item:bucketing:starting", args, this);
            var            contextItem = args.Item;
            MultilistField editors     = contextItem.Fields["__Editors"];

            using (new EditContext(contextItem, SecurityCheck.Disable))
            {
                if (!editors.Items.Contains(Util.Constants.SearchEditor))
                {
                    var tempEditors = editors.GetItems();
                    tempEditors.ToList().ForEach(tempEditor => editors.Remove(tempEditor.ID.ToString()));
                    editors.Add(Util.Constants.SearchEditor);
                    tempEditors.ToList().ForEach(tempEditor => editors.Add(tempEditor.ID.ToString()));
                }
            }

            Shell.Applications.Dialogs.ProgressBoxes.ProgressBox.Execute(Util.Constants.BucketingText, Util.Constants.BucketingProgressText, Images.GetThemedImageSource("Business/16x16/chest_add.png"), this.StartProcess, new object[] { contextItem });
            Context.ClientPage.SendMessage(this, "item:load(id=" + contextItem.ID + ")");
            Context.ClientPage.SendMessage(this, "item:refreshchildren(id=" + contextItem.Parent.ID + ")");
        }
Esempio n. 34
0
        public ActionResult UserPicUpload(HttpPostedFileBase imge)
        {
            if (Request.Files.Count > 0)
            {
                var file = Request.Files[0];

                if (file != null && file.ContentLength > 0)
                {

                    var fileName = Path.GetFileName(file.FileName);
                    Guid g = Guid.NewGuid();
                    var local_path = "/pics/" + g.ToString() + fileName;
                    var root_path = Path.Combine(Server.MapPath("~/pics/"), g.ToString() + fileName);
                    //
                    // string directory = @"~/pics/" + g;
                    BuyNet.User user = (BuyNet.User)Session["User"];
                    Images ima = new Images()
                    {
                        img = local_path,
                        UserId = user.Id
                    };
                    client.AddImage(ima);
                    file.SaveAs(root_path);

                }

            }
            return RedirectToAction("UserP");
        }
Esempio n. 35
0
        public MockInventoryDetails()
        {
            CurrentSection = "11057 - EAST BAY - D501003 INTERIOR DISTRIBUTION SERVICES dry-type, 480V primary 120/208V secondary, 225kVA";

            DetailSelectors.Add("FL2 - TL12412C - GE - Rm207 - DAMAGED - The nameplate on component was missing ...");
            DetailSelectors.Add("AB3 - GH504xx - AP - Rm111 - DAMAGE - Scratched and defaced");
            DetailSelectors.Add("XY8 - OP583C - PD - Rm456 - SOMET - In very poor taste");

            DetailSelector = "FL2 - TL12412C - GE - Rm207 - DAMAGED - The nameplate on component was missing ...";

            DetailIdNumber = "N/A";

            Location = "Rm 107";

            Model = "TL12412C";

            SerialNumber = "";

            Manufacturers.Collection.AddRange(new []
            {
                "GE",
                "Westinghouse",
                "Craftsman",
                "Whirlpool"
            });
            Manufacturers.SelectedIndex = 0;

            Capacity = "200 amp";

            EquipmentType = "MLO Panel";

            EquipmentMakes.Collection.AddRange(new []
            {
                "GE",
                "Westinghouse",
                "Craftsman",
                "Whirlpool"
            });
            EquipmentMakes.SelectedIndex = 0;

            var dateMfg = new DateTime(1956, 8, 18, 01, 13, 45);

            DateManufactured = dateMfg.ToShortDateString();

            YearInstalled = "2007";

            ControlTypeMake = "N/A";

            WarrantyCompany  = string.Empty;
            WarrantyDate     = string.Empty;
            WarrantyCompany2 = string.Empty;
            WarrantyDate2    = string.Empty;

            DetailComments.Add(new CommentBase
            {
                EntryUser = new Person()
                {
                    FirstName = "Kurt", LastName = "Benson"
                },
                EntryTime   = new DateTime(2019, 1, 17, 10, 13, 03),
                CommentText = "The nameplate on the component was missing certain Section Detail fields." +
                              " Section Detail fields have been populated and fields with NA represent data not found."
            });

            InventoryDetails = "What is supposed to go here?";

            Images.AddRange(new[]
            {
                new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/th2.jpg")),
                new BitmapImage(new Uri(@"pack://application:,,,/Images/th3.jpg"))
            });
        }
Esempio n. 36
0
 public ActionResult DelGroupPicture(int id)
 {
     Images image = new Images();
     image = db.Images.Find(id);
     if (image != null)
     {
         var phicyPath = HostingEnvironment.MapPath(image.Path);
         System.IO.File.Delete(phicyPath);
         db.Images.Remove(image);
         db.SaveChanges();
         return Content("ok");
     }
     else
     {
         return Content("err");
     }
 }
Esempio n. 37
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
          if (Request.TotalBytes > 0)
          {
        string uid = Request.QueryString["uid"];
        string vid = Request.QueryString["vid"];
        string isUpdate = Request.QueryString["isUpdate"];
        string imgId = Request.QueryString["imgId"];
        byte[] fileData = Request.BinaryRead(Request.TotalBytes);
        string filePath = Guid.NewGuid().ToString().Substring(0, 8);

        string fileName;
        if (isUpdate == "1")
        {
          int id = Int32.Parse(imgId);
          Images img = ContextHelper.DataContext.Images.First(o => o.ImageId == id);
          fileName = img.ImageName + "E";
        }
        else
        {
          fileName = GetNextImageNumber(uid);
        }

        ImageHelper.SaveImage(uid, fileName + ".jpg", fileData);

        if (isUpdate == "1")
        {
          int id = Int32.Parse(imgId);
          Images img = ContextHelper.DataContext.Images.First(o => o.ImageId == id);

          //File.Delete(Server.MapPath("~/" + img.ThumbPath));

          //string setEditPath = filePath.Replace("~/", "");
          //string setThumbPath = thumbPath.Replace("~/", "");

          //img.ThumbPath = fileName;
          img.ImagePath = fileName + ".jpg";
          img.IsEdit = true;

          Videos video = ContextHelper.DataContext.Videos.First(o => o.VideoId == vid);
          video.IsCompile = false;
          video.IsError = false;

          ContextHelper.DataContext.SaveChanges();
          string url = ImageHelper.GetImageUrl(img);
          //workaround for flash component which incorrectly build url
          url = url.Replace("http://www.timeflies.by/", "");
          url = url.Replace("http://localhost/", "");

          Response.Write(url);
          return;
        }
        else
        {
          Images img = new Images();
          img.ImagePath = fileName + ".jpg";
          //img.ThumbPath = thumbPath.Replace("~/", "");
          img.ImageName = fileName;
          img.VideoId = vid;
          img.UserId = uid;
          img.DateAdded = DateTime.Now;
          img.IsRead = false;
          img.IsInvalid = false;
          img.IsEdit = false;
          img.IsDelete = false;
          ContextHelper.DataContext.AddToImages(img);

          Videos video = ContextHelper.DataContext.Videos.First(o => o.VideoId == vid);
          video.IsCompile = false;
          video.IsError = false;

          ContextHelper.DataContext.SaveChanges();

          int imageCount = ContextHelper.DataContext.Images.Count(o => o.VideoId == video.VideoId);
          if (imageCount == 1)
          {
            DisableTabs = "true";
          }
          Response.Write(ImageHelper.GetImageUrl(img) + "_" + DisableTabs);
        }
          }
        }
        catch (Exception ex)
        {
          EmailService.ErrorEmail(ex.ToString());
          Response.Write(ex.Message + "----------------" + ex.InnerException);
        }
    }
Esempio n. 38
0
 protected void Awake()
 {
     this.images = GetComponent<Images>();
     Debug.Log("UIEquitem Start");
 }
Esempio n. 39
0
        public void Load(string filename)
        {
            StreamReader reader = new StreamReader(filename);

            try
            {
                this.Name = reader.ReadLine();
                string dir = filename.Substring(0, filename.Length - 4);
                if (!Directory.Exists(dir))
                {
                    reader.Close();
                    return;
                }

                string   subdir = dir + "\\Classes\\";
                string[] items  = Directory.GetFiles(subdir);
                Classes.Clear();
                GC_Class currentClass;
                foreach (string c in items)
                {
                    currentClass = new GC_Class(c.Substring(0, c.Length - 4), this);
                    currentClass.Load(c);
                    Classes.Add(currentClass);
                }

                subdir = dir + "\\Images\\";
                items  = Directory.GetFiles(subdir);
                Images.Clear();
                GC_Image currentImage;
                foreach (string i in items)
                {
                    currentImage = new GC_Image(i.Substring(0, i.Length - 4), this);
                    currentImage.Load(i);
                    Images.Add(currentImage);
                }

                subdir = dir + "\\Objects\\";
                items  = Directory.GetFiles(subdir);
                Objects.Clear();
                GC_Object currentObject;
                foreach (string o in items)
                {
                    currentObject = new GC_Object(o.Substring(0, o.Length - 4), this);
                    currentObject.Load(o);
                    Objects.Add(currentObject);
                }

                subdir = dir + "\\Levels\\";
                items  = Directory.GetFiles(subdir);
                Levels.Clear();
                GC_Level currentLevel;
                foreach (string l in items)
                {
                    currentLevel = new GC_Level(l.Substring(0, l.Length - 4), this);
                    currentLevel.Load(l);
                    Levels.Add(currentLevel);
                }

                reader.Close();
            }
            catch
            {
                reader.Close();
                MessageBox.Show(Application.Current.FindResource("FileCorrupt").ToString());
            }
        }
Esempio n. 40
0
		/**
		* Builds the main menu and toolbar from xml file
		*/
		public void InitializeCommandBarMenus()
		{
			try 
			{
				this.images = new Images(FilePaths.Images, 16);
				this.xmlBuilder = new XmlBuilder(this, this.images);
				this.itemFinder = new ItemFinder(this.xmlBuilder);
				this.commandBarManager = new CommandBarManager();
				this.editorMenu = this.xmlBuilder.GenerateContextMenu(FilePaths.ScintillaMenu);
				this.tabMenu = this.xmlBuilder.GenerateContextMenu(FilePaths.TabMenu);
				this.commandBarManager.CommandBars.Add(this.xmlBuilder.GenerateMainMenu(FilePaths.MainMenu));
				if (this.settings.GetBool("FlashDevelop.ViewToolBar"))
				{
					this.commandBarManager.CommandBars.Add(this.xmlBuilder.GenerateToolBar(FilePaths.ToolBar));
				}
				this.Controls.Add(this.commandBarManager);
			} 
			catch (Exception ex)
			{
				ErrorHandler.ShowError("Error while building menus.", ex);
			}
		}
Esempio n. 41
0
 public static ImageSource GetIcon(IProperty property)
 {
     return(Images.GetIcon(property.IsIndexer ? MemberIcon.Indexer : MemberIcon.Property,
                           MethodTreeNode.GetOverlayIcon(property.Accessibility), property.IsStatic));
 }
Esempio n. 42
0
 public static void SetNodeImage(TreeNode treeNode, Images.Enums.TreeImage Img)
 {
     SetNodeImageIndex(treeNode, (int)Img);
 }
Esempio n. 43
0
 public object Clone() => new CombinedImages((PositionedImage[])Images.Clone(), TextureWidth, TextureHeight, TextureFormat, IsMipChain, WrapMode, InitTransparentBackground);
Esempio n. 44
0
 public ListProposalFilmViewModel(Images image)
 {
     Image = image;
 }
Esempio n. 45
0
        static void DoLaunchButtons(
            bool isPlasticExeAvailable,
            WorkspaceInfo wkInfo,
            ViewSwitcher viewSwitcher,
            bool isGluonMode)
        {
            //TODO: Codice - beta: hide the diff button until the behavior is implemented

            /*GUILayout.Button(PlasticLocalization.GetString(
             *  PlasticLocalization.Name.DiffWindowMenuItemDiff),
             *  EditorStyles.toolbarButton,
             *  GUILayout.Width(UnityConstants.REGULAR_BUTTON_WIDTH));*/

            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.Changesets))
            {
                viewSwitcher.ChangesetsTab.DrawDateFilter();
            }
            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.Branches))
            {
                viewSwitcher.BranchesTab.DrawDateFilter();
            }

            Texture refreshIcon        = Images.GetRefreshIcon();
            string  refreshIconTooltip = PlasticLocalization.GetString(
                PlasticLocalization.Name.RefreshButton);

            if (DrawLaunchButton(refreshIcon, refreshIconTooltip))
            {
                viewSwitcher.RefreshSelectedView();
            }

            if (viewSwitcher.IsViewSelected(ViewSwitcher.SelectedTab.PendingChanges))
            {
                Texture2D icon    = Images.GetImage(Images.Name.IconUndo);
                string    tooltip = PlasticLocalization.GetString(
                    PlasticLocalization.Name.UndoSelectedChanges);

                if (DrawLaunchButton(icon, tooltip))
                {
                    TrackFeatureUseEvent.For(
                        PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
                        TrackFeatureUseEvent.Features.UndoIconButton);

                    viewSwitcher.PendingChangesTab.UndoForMode(wkInfo, isGluonMode);
                }
            }

            if (isGluonMode)
            {
                string label = PlasticLocalization.GetString(PlasticLocalization.Name.ConfigureGluon);
                if (DrawActionButton.For(label))
                {
                    LaunchTool.OpenWorkspaceConfiguration(wkInfo, isGluonMode);
                }
            }
            else
            {
                Texture2D icon    = Images.GetImage(Images.Name.IconBranch);
                string    tooltip = PlasticLocalization.GetString(PlasticLocalization.Name.Branches);
                if (DrawLaunchButton(icon, tooltip))
                {
                    ShowBranchesContextMenu(
                        wkInfo,
                        viewSwitcher,
                        isGluonMode);
                }
            }

            //TODO: Add settings button tooltip localization
            if (DrawLaunchButton(Images.GetSettingsIcon(), string.Empty))
            {
                ShowSettingsContextMenu(
                    wkInfo,
                    isGluonMode);
            }
        }
 public object Get(Images request)
 {
     return Directory.GetFiles(UploadsDir).Map(x => x.SplitOnLast(Path.DirectorySeparatorChar).Last());
 }
Esempio n. 47
0
 public Image LargestImage()
 {
     return(Images.OrderByDescending(image => image.Size).FirstOrDefault());
 }