public Question()
 {
     Value = "";
     selected = false;
     Tag = tag.off;
     Target = "";
 }
예제 #2
0
 CheckUniversalTag(tag, UniversalTagNumber.BitString);
 public Question(string entryValue, bool state)
 {
     Value = entryValue;
     selected = state;
     Tag = tag.off;
     Target = "";
 }
예제 #4
0
 public static void marshal_tag(Stream stream, tag tag)
 {
     Types.marshal_int(stream, (int)tag);
 }
예제 #5
0
 public static void marshal_tag(Stream stream, tag tag)
 {
     Types.marshal_int(stream, (int)tag);
 }
예제 #6
0
 public static void protocol_failure(string msg, tag t, thinCLIProtocol tCLIprotocol)
 {
     tCLIprotocol.dGlobalError("Protocol failure: Reading " + msg + ": unexpected tag: " + t);
     tCLIprotocol.dExit(1);
 }
예제 #7
0
 public void del_tag_from_path(tag t)
 {
     this.del_element(id_element: t.id.Value); t.del(this.path.id.Value); refresh_tags();
 }
예제 #8
0
    void OnCollisionEnter2D(Collision2D col)
    {
        tag asd = col.transfoasdarm.tag;

        CheckColliasdasdsionTagName(col);                                               // Sent the collision object to check the tag
    }
예제 #9
0
 public web_tag(path p, tag t)
 {
     this.path = p; this.tag = t; this.id_element = this.tag.id;
 }
예제 #10
0
 public void onTagCreated(tag tag)
 {
     mWindow.txtLog.AppendText("tag created: " + tag.name);
     mWindow.txtLog.AppendText(Environment.NewLine);
     mWindow.txtLog.AppendText(Environment.NewLine);
 }
예제 #11
0
        private async Task FetchItemGenreAndIonAsync(scan_pips_contributors item, Thumbnail thumbnail, IProgress progress, bool isTags, bool isIonContributors, bool isCategories)
        {
            if (progress.IsCancelled)
            {
                return;
            }
            thumbnail.ShowImage("http://node2.bbcimg.co.uk/iplayer/images/episode/" + item.pid + "_314_176.jpg");

            try
            {
                if (isTags || isIonContributors)
                {
                    WebClient client = new WebClient();
                    string    result = await client.DownloadStringTaskAsync("http://www.bbc.co.uk/iplayer/ion/episodedetail/episode/" + item.pid + "/format/xml");

                    XElement   episode = XElement.Parse(result);
                    XNamespace ion     = "http://bbc.co.uk/2008/iplayer/ion";
                    if (isIonContributors)
                    {
                        await TaskEx.Run(() =>
                        {
                            var contributors = episode.Elements(ion + "blocklist")
                                               .Elements(ion + "episode_detail")
                                               .Elements(ion + "contributors")
                                               .Elements(ion + "contributor");
                            var data = new ReduxEntities();
                            foreach (var contributor in contributors)
                            {
                                var ct = new contributor
                                {
                                    character_name = contributor.Element(ion + "character_name").Value,
                                    family_name    = contributor.Element(ion + "family_name").Value,
                                    given_name     = contributor.Element(ion + "given_name").Value,
                                    role           = contributor.Element(ion + "role").Value,
                                    role_name      = contributor.Element(ion + "role_name").Value,
                                    type           = contributor.Element(ion + "type").Value,
                                    contributor_id = Convert.ToInt32(contributor.Element(ion + "id").Value),
                                    pid            = item.pid
                                };
                                data.AddObject("contributors", ct);
                            }
                            data.SaveChanges();
                        });
                    }
                    if (isTags)
                    {
                        await TaskEx.Run(() =>
                        {
                            var tags = episode.Elements(ion + "blocklist")
                                       .Elements(ion + "episode_detail")
                                       .Elements(ion + "tag_schemes")
                                       .Elements(ion + "tag_scheme")
                                       .Elements(ion + "tags")
                                       .Elements(ion + "tag");
                            var data = new ReduxEntities();
                            foreach (var tag in tags)
                            {
                                var tg = new tag
                                {
                                    tag_id = tag.Element(ion + "id").Value,
                                    name   = tag.Element(ion + "name").Value,
                                    value  = tag.Element(ion + "value").Value,
                                    pid    = item.pid
                                };
                                data.AddObject("tags", tg);
                            }
                            data.SaveChanges();
                        });
                    }
                }
                if (isCategories)
                {
                    WebClient catClient = new WebClient();
                    var       catresult = await catClient.DownloadStringTaskAsync("http://www.bbc.co.uk/programmes/" + item.pid + ".xml");

                    var root = XElement.Parse(catresult);

                    await TaskEx.Run(() =>
                    {
                        var cats = from cat in root.XPathSelectElements("categories/category[@type != 'genre']")
                                   select new category()
                        {
                            pid    = item.pid,
                            type   = cat.Attribute("type").Value,
                            catkey = cat.Attribute("key").Value,
                            title  = cat.Element("title").Value
                        };
                        var db = new ReduxEntities();
                        foreach (var c in cats)
                        {
                            db.AddObject("categories", c);
                        }
                        db.SaveChanges();
                    });
                }
                item.scanned = true;
            }
            catch (WebException wex)
            {
                MessageBox.Show("Can't find programme " + item.pid);
                //throw new Exception("Couldn't find programme " + item.pid, wex);
            }
        }
예제 #12
0
        private void Init()
        {
            thumbNail.Source       = h.thumb;
            thumbBrush.ImageSource = h.thumb;
            thumbNail.ToolTip      = GetToolTip(panel.Height);

            thumbNail.MouseDown += (object sender, MouseButtonEventArgs e) =>
            {
                Reader reader = new Reader(h);
                reader.Show();
            };

            nameLabel.Width   = panel.Width - border.Width;
            nameLabel.Content = System.IO.Path.GetFileName(h.dir);

            pageLabel.Content = h.page + "p";

            int           GB         = 1024 * 1024 * 1024;
            int           MB         = 1024 * 1024;
            int           KB         = 1024;
            DirectoryInfo info       = new DirectoryInfo(h.dir);
            double        FolderByte = info.EnumerateFiles().Sum(f => f.Length);

            sizeLabel.Content = Math.Round(FolderByte, 2) + "B";
            if (FolderByte > KB)
            {
                sizeLabel.Content = Math.Round(FolderByte / KB, 2) + "KB";
            }
            if (FolderByte > MB)
            {
                sizeLabel.Content = Math.Round(FolderByte / MB, 2) + "MB";
            }
            if (FolderByte > GB)
            {
                sizeLabel.Content = Math.Round(FolderByte / GB, 2) + "GB";
            }

            double SizePerPage = FolderByte / info.GetFiles().Length;

            sizeperpageLabel.Content = Math.Round(SizePerPage, 2) + "B";
            if (SizePerPage > KB)
            {
                sizeperpageLabel.Content = Math.Round(SizePerPage / KB, 2) + "KB";
            }
            if (SizePerPage > MB)
            {
                sizeperpageLabel.Content = Math.Round(SizePerPage / MB, 2) + "MB";
            }
            if (SizePerPage > GB)
            {
                sizeperpageLabel.Content = Math.Round(SizePerPage / GB, 2) + "GB";
            }

            ChangeColor(this);

            if (File.Exists(System.IO.Path.Combine(h.dir, "info.txt")))
            {
                HitomiInfoOrg hitomiInfoOrg = new HitomiInfoOrg();
                string[]      lines         = File.ReadAllLines(System.IO.Path.Combine(h.dir, "info.txt")).Where(x => x.Length > 0).ToArray();
                foreach (string line in lines)
                {
                    if (line.StartsWith("갤러리 넘버: "))
                    {
                    }
                    if (line.StartsWith("제목: "))
                    {
                    }
                    if (line.StartsWith("작가: "))
                    {
                    }
                    if (line.StartsWith("그룹: "))
                    {
                    }
                    if (line.StartsWith("타입: "))
                    {
                        hitomiInfoOrg.Types = line.Remove(0, "타입: ".Length);
                    }
                    if (line.StartsWith("시리즈: "))
                    {
                    }
                    if (line.StartsWith("캐릭터: "))
                    {
                    }
                    if (line.StartsWith("태그: "))
                    {
                        hitomiInfoOrg.Tags = line.Remove(0, "태그: ".Length);
                    }
                    if (line.StartsWith("언어: "))
                    {
                    }
                }
                HitomiInfo Hinfo = HitomiInfo.Parse(hitomiInfoOrg);
                foreach (HitomiInfo.Tag tag in Hinfo.Tags)
                {
                    tag tag1 = new tag
                    {
                        TagType = tag.types,
                        TagName = tag.name
                    };
                    switch (tag.types)
                    {
                    case HitomiViewer.Tag.Types.female:
                        tag1.TagColor = new SolidColorBrush(Color.FromRgb(255, 94, 94));
                        break;

                    case HitomiViewer.Tag.Types.male:
                        tag1.TagColor = new SolidColorBrush(Color.FromRgb(65, 149, 244));
                        break;

                    case HitomiViewer.Tag.Types.tag:
                    default:
                        tag1.TagColor = new SolidColorBrush(Color.FromRgb(153, 153, 153));
                        break;
                    }
                    tagPanel.Children.Add(tag1);
                }
            }
        }
        public async Task <IActionResult> Upload([FromForm] IFormCollection forms)
        {
            //只选取文件
            FormFileCollection Lifile = (FormFileCollection)forms.Files;

            //需要绑定图片名和图片id
            StringValues[] temp    = { "", "", "" };
            string[]       thagTag = { "tag", "tag1", "tag2" };
            //int[5] a;
            for (int i = 0; i < 3; ++i)
            {
                forms.TryGetValue(thagTag[i], out temp[i]);
            }

            StringValues information = "";

            forms.TryGetValue("p_Info", out information);

            StringValues userID = "";

            forms.TryGetValue("userId", out userID);

            StringValues price = "";

            forms.TryGetValue("price", out price);
            string tempsd = price;
            int    Prices = int.Parse(tempsd);



            var files = Request.Form.Files;


            long size = files.Sum(f => f.Length);

            //size > 100MB refuse upload !
            if (size > 104857600)
            {
                return(Ok(new
                {
                    Success = false,
                    Message = "pictures total size > 100MB , server refused !"
                }));
            }

            List <string> filePathResultList = new List <string>();

            //只能上传一张图片顺便贴标签
            var file = files[0];

            var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');

            //@
            string filePath = "C:" + @"\Pics\";

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }

            string suffix = fileName.Split('.')[1];


            //检查文件后缀名确保是图片而不是其他文件。
            if (!pictureFormatArray.Contains(suffix))
            {
                return(Ok(new
                {
                    Success = false,
                    Message = "the picture format not support ! you must upload files " +
                              "that suffix like 'png','jpg','jpeg','bmp','gif','ico'.",
                    Name = fileName
                }));
            }
            //文件名命名?
            //存取图片的时候以id为准
            //context.picture.Count();


            fileName = Guid.NewGuid() + "." + suffix;

            string fileFullName = filePath + fileName;

            int height = 0;
            int width  = 0;


            await using (FileStream fs = System.IO.File.Create(fileFullName))
            {
                file.CopyTo(fs);
                System.Drawing.Image image = System.Drawing.Image.FromStream(fs);
                height = image.Height;
                width  = image.Width;
                fs.Flush();
            }

            filePathResultList.Add($"/src/Pics/{fileName}");

            string message = $"{files.Count} file(s) /{size} bytes uploaded successfully!";

            //Json("tag1", temp[0].ToString());
            string OwnTags = "tag1:" + temp[0].ToString() + ",tag2:" + temp[1].ToString() + ",tag3:" + temp[2].ToString();

            //刷新为服务器的图片。
            fileFullName = "http://172.81.239.44:8002/" + fileName;

            picture tempPicture = new picture
            {
                p_id     = (context.tableCount.Find(1).picture + 1).ToString(),
                p_url    = fileFullName,
                p_info   = information,//还是要能用http访问,不是https
                p_height = height,
                p_width  = width,
                p_status = "OK",//图片状态不确定。
                price    = Prices,
                likes    = 0,
                dislikes = 0,
                comm_num = 0
            };
            //添加图片数量
            var tableCount = context.tableCount.Find(1);

            tableCount.picture += 1;
            context.tableCount.Attach(tableCount);
            context.SaveChanges();

            //承接前一步异步保存。
            context.picture.Add(tempPicture);
            await context.SaveChangesAsync();


            //List<tag> contextTag = context.tag.ToList();
            for (int i = 0; i < 3; ++i)
            {
                if (temp[i] != "")
                {
                    tag isLegal = context.tag.FirstOrDefault(p => p.tag_name == temp[i]);

                    if (isLegal == null)
                    {
                        //表示这是用户新增的tag
                        isLegal = new tag
                        {
                            tag_name = temp[i]
                        };
                        //因为外码依赖要先增加tag
                        context.tag.Add(isLegal);
                        await context.SaveChangesAsync();
                    }

                    ownTag tempTag = new ownTag
                    {
                        p_id     = tempPicture.p_id,
                        tag_name = temp[i]
                    };
                    context.ownTag.Add(tempTag);
                }
            }
            await context.SaveChangesAsync();



            publishPicture tempPublish = new publishPicture
            {
                u_id         = userID,
                p_id         = tempPicture.p_id,
                publish_time = DateTime.Now
            };

            context.publishPicture.Add(tempPublish);
            await context.SaveChangesAsync();



            return(Ok(new
            {
                Success = true,
                Message = message,
                PictureHeight = tempPicture.p_height,
                PictureWidth = tempPicture.p_width,
                Price = Prices,
                PictureURL = tempPicture.p_url,
                //fileList = filePathResultList,
                OwnTag = OwnTags
            }));
        }
예제 #14
0
 public tag getTagByName(string name)
 {
     var result= TagRY.GetTagByID(name);
     if (result == null)
         result = new tag();
     return result;
 }
예제 #15
0
 public void del_tag(tag t)
 {
     this.del_element(id_element: t.id.Value); t.del(); refresh_tags();
 }
예제 #16
0
 return(tag[..idx], tagOptions(tag[idx + 1L..]));
예제 #17
0
 await s.UpdatePropertiesAsync(tag, path, music, p, oneDriveFile);
예제 #18
0
        public IHttpActionResult PostNewtags(cls_tag tags)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            //List<int> ids = new List<int>();
            //foreach (string item in tags.tag_names)
            //{
            //    if (!db.tags.Any(x=>x.tag1==item))
            //    {
            //        tag tag_to_add = new tag();
            //        tag_to_add.tag1 = item;
            //        db.tags.Add(tag_to_add);
            //        db.SaveChanges();
            //        ids.Add(db.tags.OrderByDescending(x => x.id).FirstOrDefault().id);


            //    }
            //    else
            //    {
            //        ids.Add(db.tags.FirstOrDefault(x=>x.tag1==item).id);
            //    }
            //}
            if (tags.Type == "course")
            {
                foreach (string item in tags.tag_names)
                {
                    if (!db.tags.Any(x => x.tag1 == item))
                    {
                        tag tag_to_add = new tag();
                        tag_to_add.tag1 = item;
                        db.tags.Add(tag_to_add);
                        db.SaveChanges();
                        //ids.Add(db.tags.OrderByDescending(x => x.id).FirstOrDefault().id);

                        course_tags t = new course_tags
                        {
                            course_id = tags.TypeId,
                            tag_id    = db.tags.OrderByDescending(x => x.id).FirstOrDefault().id,
                            tag_name  = item
                        };
                        db.course_tags.Add(t);
                        db.SaveChanges();
                    }
                    else
                    {
                        //ids.Add(db.tags.FirstOrDefault(x => x.tag1 == item).id);
                        course_tags t = new course_tags
                        {
                            course_id = tags.TypeId,
                            tag_id    = db.tags.FirstOrDefault(x => x.tag1 == item).id,
                            tag_name  = item
                        };
                        db.course_tags.Add(t);
                        db.SaveChanges();
                    }
                }

                //foreach (int item in ids)
                //{
                //    course_tags t = new course_tags
                //    {
                //        course_id = tags.TypeId,
                //        tag_id =item
                //    };
                //    db.course_tags.Add(t);
                //    db.SaveChanges();
                //}
            }
            else if (tags.Type == "group")
            {
                foreach (string item in tags.tag_names)
                {
                    if (!db.tags.Any(x => x.tag1 == item))
                    {
                        tag tag_to_add = new tag();
                        tag_to_add.tag1 = item;
                        db.tags.Add(tag_to_add);
                        db.SaveChanges();
                        //ids.Add(db.tags.OrderByDescending(x => x.id).FirstOrDefault().id);

                        work_group_tags t = new work_group_tags
                        {
                            work_group_id = tags.TypeId,
                            tag_id        = db.tags.OrderByDescending(x => x.id).FirstOrDefault().id,
                            tag_name      = item
                        };
                        db.work_group_tags.Add(t);
                        db.SaveChanges();
                    }
                    else
                    {
                        //ids.Add(db.tags.FirstOrDefault(x => x.tag1 == item).id);
                        work_group_tags t = new work_group_tags
                        {
                            work_group_id = tags.TypeId,
                            tag_id        = db.tags.FirstOrDefault(x => x.tag1 == item).id,
                            tag_name      = item
                        };
                        db.work_group_tags.Add(t);
                        db.SaveChanges();
                    }
                }
                //foreach (int item in ids)
                //{
                //    work_group_tags t = new work_group_tags
                //    {
                //        work_group_id = tags.TypeId,
                //        tag_id = item
                //    };
                //    db.work_group_tags.Add(t);
                //    db.SaveChanges();
                //}
            }


            return(Ok(tags));
        }
예제 #19
0
 public void Update(tag author)
 {
     throw new NotImplementedException();
 }
예제 #20
0
 public static void marshal_response(Stream stream, tag t)
 {
     Types.marshal_int(stream, 4 + 4);
     marshal_tag(stream, tag.Response);
     marshal_tag(stream, t);
 }
예제 #21
0
파일: DevHelper.cs 프로젝트: PMDCollab/PMDC
 addMonster(found, index, tag, encounter);
예제 #22
0
 public static void protocol_failure(string msg, tag t, thinCLIProtocol tCLIprotocol)
 {
     tCLIprotocol.dGlobalError("Protocol failure: Reading " + msg + ": unexpected tag: " + t);
     tCLIprotocol.dExit(1);
 }
예제 #23
0
 => (Grid, Key, Tag, Name, Modifiers) = (grid, key, Modify(tag, modifiers), name, modifiers);
예제 #24
0
 public static void marshal_response(Stream stream, tag t)
 {
     Types.marshal_int(stream, 4 + 4);
     marshal_tag(stream, tag.Response);
     marshal_tag(stream, t);
 }
예제 #25
0
        // GET: Stream
        public ActionResult Index(int?id, string selected = "All")
        {
            ViewBag.Ajax = "Original Page";
            //GET LOGGED IN USER
            var loggedInUserId = User.Identity.GetUserId().ToString();
            var thing          = db.users.Where(n => n.user_asp_id == loggedInUserId);
            int loggedIn       = 0;

            foreach (var LoggedInUser in thing)
            {
                loggedIn = LoggedInUser.user_id;
            }
            ViewBag.Thing = thing;
            //GET ALL CONNECTIONS AND FOLLOWERS
            var Follows = db.connections.Where(c => (c.user_id == loggedIn || c.connection_user == loggedIn)).ToList().OrderBy(s => s.connection_id).Reverse();

            ViewBag.Connections = Follows;
            List <int?> User_Ids = new List <int?>();

            foreach (var u in Follows)
            {
                if (u.user_id == loggedIn)
                {
                    User_Ids.Add(u.user_id);
                }
                else
                {
                    User_Ids.Add(u.connection_user);
                }
            }
            DateTime dateForButton = DateTime.Now.AddDays(-30);

            //GET ALL CIRCULATIONS
            var circulated = db.circulates.Where(c => c.circulate_date > dateForButton).ToList().OrderBy(s => s.circulate_id).Reverse();

            ViewBag.Circulate = circulated;

            //GET ALL COMMENTS AND LIKES
            var responses = db.responses.Where(r => r.response_date > dateForButton).ToList().OrderBy(p => p.response_id).Reverse();

            ViewBag.responses = responses;
            ViewBag.reactions = db.reactions.ToList().OrderBy(s => s.reaction_id).Reverse().Take(1000);

            //GET ALL USERS
            var users = db.users.ToList();

            ViewBag.users = users;

            //GET ALL TAGS
            var TagD  = db.tags;
            var TagDB = TagD.ToList().OrderBy(s => s.tag_id).Reverse();

            ViewBag.Tags = TagDB;

            //GET ALL TAG MAPS
            var tagmapDB = db.tagmaps.ToList();

            ViewBag.tagmap = tagmapDB;
            //ViewBag.content_id = new SelectList(db.contents, "content_id");
            var contents = db.contents.Include(c => c.user);

            var cont = contents.Where(c => c.content_date > dateForButton).ToList().OrderBy(p => p.content_id).Reverse();

            if (id == null)
            {
                //GET ALL POSTS FOR PAGE
                ViewBag.content = cont;
            }
            else
            {
                //GET ALL POSTS FOR PAGE
                tag         tag    = TagD.Find(id);
                List <int?> contID = new List <int?>();
                foreach (var m in tagmapDB)
                {
                    if (m.tag_id == tag.tag_id)
                    {
                        contID.Add(m.content_id);
                    }
                }
                cont            = cont.Where(c => contID.Contains(c.content_id)).ToList().OrderBy(p => p.content_id).Reverse();
                ViewBag.content = cont;
            }

            //get trending tags
            Trending.trending.Clear();
            int numberOfTags = 0;
            int count        = 0;

            foreach (var tagq in TagDB)
            {
                count = 0;
                if (numberOfTags == 100)
                {
                    break;
                }
                else
                {
                    foreach (var tagmapq in tagmapDB.OrderBy(s => s.tagmap_id).Reverse().Take(100))
                    {
                        if (tagq.tag_id == tagmapq.tag_id)
                        {
                            foreach (var post in cont)
                            {
                                if (tagmapq.content_id == post.content_id)
                                {
                                    count++;
                                    numberOfTags++;
                                }
                            }
                        }
                    }
                }
                Trending.trending.Add(new Trending(count, tagq.tag_id, tagq.tag_title));
            }
            ViewBag.Trending = Trending.trending.ToList().OrderBy(s => s.number).Reverse().Take(15);
            return(View());
        }
 public Question(string entryValue)
 {
     Value = entryValue;
     selected = false;
     Tag = tag.off;
     Target = "";
 }
        private relation ConvertRowToOSMRelation(IRow currentRow, IWorkspace featureWorkspace, int tagsFieldIndex, int osmIDFieldIndex, int changesetIDFieldIndex, int osmVersionFieldIndex, int userIDFieldIndex, int userNameFieldIndex, int timeStampFieldIndex, int visibleFieldIndex, int membersFieldIndex, int extensionVersion)
        {
            if (currentRow == null)
            {
                throw new ArgumentNullException("currentRow");
            }

            relation      osmRelation   = new relation();
            object        featureValue  = DBNull.Value;
            List <object> relationItems = new List <object>();

            if (membersFieldIndex != -1)
            {
                member[] members = _osmUtility.retrieveMembers(currentRow, membersFieldIndex);
                relationItems.AddRange(members);
            }

            if (osmIDFieldIndex != -1)
            {
                osmRelation.id = Convert.ToString(currentRow.get_Value(osmIDFieldIndex));
            }

            if (changesetIDFieldIndex != -1)
            {
                featureValue = currentRow.get_Value(changesetIDFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmRelation.changeset = Convert.ToString(currentRow.get_Value(changesetIDFieldIndex));
                }
            }

            if (osmVersionFieldIndex != -1)
            {
                featureValue = currentRow.get_Value(osmVersionFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmRelation.version = Convert.ToString(featureValue);
                }
            }

            if (userIDFieldIndex != -1)
            {
                featureValue = currentRow.get_Value(userIDFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmRelation.uid = Convert.ToString(featureValue);
                }
            }

            if (userNameFieldIndex != -1)
            {
                featureValue = currentRow.get_Value(userNameFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmRelation.user = Convert.ToString(featureValue);
                }
            }

            if (timeStampFieldIndex != -1)
            {
                featureValue = currentRow.get_Value(timeStampFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmRelation.timestamp = Convert.ToDateTime(featureValue).ToUniversalTime().ToString("u");
                }
            }

            if (visibleFieldIndex != -1)
            {
                featureValue = currentRow.get_Value(visibleFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmRelation.visible = Convert.ToString(featureValue);
                }
            }

            if (tagsFieldIndex > -1)
            {
                tag[] tags = null;
                tags = _osmUtility.retrieveOSMTags((IRow)currentRow, tagsFieldIndex, featureWorkspace);

                // if the row is of type IFeature and a polygon then add the type=multipolygon tag
                if (currentRow is IFeature)
                {
                    IFeature currentFeature = currentRow as IFeature;

                    if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                    {
                        tag mpTag = new tag();
                        mpTag.k = "type";
                        mpTag.v = "multipolygon";

                        relationItems.Add(mpTag);
                    }
                }

                if (tags.Length != 0)
                {
                    relationItems.AddRange(tags);
                }
            }

            // add all items (member and tags) to the relation element
            osmRelation.Items = relationItems.ToArray();

            return(osmRelation);
        }
        private void dataGridView1_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
        {

            if (m_editor == null)
                return;

            if (e.RowIndex == 0)
                return;

            if (m_enumRow == null)
                return;

            List<tag> currentTagList = new List<tag>();

            // loop through all the tags listed in the grid
            for (int rowIndex = 0; rowIndex < dataGridView1.RowCount; rowIndex++)
            {
                string tagKeyValue = dataGridView1[0, rowIndex].Value as string;
                string tagValueValue = dataGridView1[1, rowIndex].Value as string;

                if ((String.IsNullOrEmpty(tagKeyValue) == false) || (String.IsNullOrEmpty(tagValueValue) == false))
                {
                    tag newTag = new tag();
                    newTag.k = tagKeyValue;
                    newTag.v = tagValueValue;

                    currentTagList.Add(newTag);
                }
            }

            if (currentTagList.Count > 1)
            {

                if (((IWorkspaceEdit2)m_editor.EditWorkspace).IsInEditOperation)
                {
                }
                else
                {
                    //   MessageBox.Show(resourceManager.GetString("OSMEditor_FeatureInspector_operationwarningcaption"), resourceManager.GetString("OSMClassExtension_FeatureInspector_operationwarningcaption"));
                    m_editor.StartOperation();
                }

                try
                {
                    // persist the collection in the blob/xml field
                    m_enumRow.Reset();

                    IFeature currentFeature = null;

                    while ((currentFeature = m_enumRow.Next() as IFeature) != null)
                    {
                        int tagCollectionFieldIndex = currentFeature.Fields.FindField("osmTags");

                        if (tagCollectionFieldIndex != -1)
                        {
                            _osmUtility.insertOSMTags(tagCollectionFieldIndex, (IRow)currentFeature, currentTagList.ToArray(), m_editor.EditWorkspace);

                            currentFeature.Store();
                        }
                    }
                }
                catch
                {
                }
                finally
                {
                    m_editor.StopOperation(resourceManager.GetString("OSMEditor_FeatureInspector_operationmenu"));
                }
            }
        }
예제 #29
0
        internal Rarity(int rarity, tag tag)
        {
            Ressources.Pictures.Rarities.Gen1_2.WeaponsIcons weaponsIconsGen1_2 = new Ressources.Pictures.Rarities.Gen1_2.WeaponsIcons();
            Ressources.Pictures.Rarities.Gen3_4.WeaponsIcons weaponsIconsGen3_4 = new Ressources.Pictures.Rarities.Gen3_4.WeaponsIcons();
            Ressources.Pictures.Rarities.MHW.WeaponsIcons    weaponsIconsGen5   = new Ressources.Pictures.Rarities.MHW.WeaponsIcons();
            this.rarity = rarity;
            switch ((int)tag)
            {
            case 001:
                icon = weaponsIconsGen1_2.Great_Sword[rarity];
                break;

            case 002:
                icon = weaponsIconsGen1_2.Sword_and_Shield[rarity];
                break;

            case 003:
                icon = weaponsIconsGen1_2.Dual_Blades[rarity];
                break;

            case 004:
                icon = weaponsIconsGen1_2.Hammer[rarity];
                break;

            case 005:
                icon = weaponsIconsGen1_2.Hunting_Horn[rarity];
                break;

            case 006:
                icon = weaponsIconsGen1_2.Lance[rarity];
                break;

            case 007:
                icon = weaponsIconsGen1_2.Gunlance[rarity];
                break;

            case 008:
                icon = weaponsIconsGen1_2.Light_Bowgun[rarity];
                break;

            case 009:
                icon = weaponsIconsGen1_2.Heavy_Bowgun[rarity];
                break;

            case 010:
                icon = weaponsIconsGen3_4.Great_Sword[rarity];
                break;

            case 011:
                icon = weaponsIconsGen3_4.Long_Sword[rarity];
                break;

            case 012:
                icon = weaponsIconsGen3_4.Sword_and_Shield[rarity];
                break;

            case 013:
                icon = weaponsIconsGen3_4.Dual_Blades[rarity];
                break;

            case 014:
                icon = weaponsIconsGen3_4.Hammer[rarity];
                break;

            case 015:
                icon = weaponsIconsGen3_4.Hunting_Horn[rarity];
                break;

            case 016:
                icon = weaponsIconsGen3_4.Lance[rarity];
                break;

            case 017:
                icon = weaponsIconsGen3_4.Gunlance[rarity];
                break;

            case 018:
                icon = weaponsIconsGen3_4.Switch_Axe[rarity];
                break;

            case 019:
                icon = weaponsIconsGen3_4.Charge_Blade[rarity];
                break;

            case 020:
                icon = weaponsIconsGen3_4.Insect_Glaive[rarity];
                break;

            case 021:
                icon = weaponsIconsGen3_4.Light_Bowgun[rarity];
                break;

            case 022:
                icon = weaponsIconsGen3_4.Heavy_Bowgun[rarity];
                break;

            case 023:
                icon = weaponsIconsGen3_4.Bow[rarity];
                break;

            case 024:
                icon = weaponsIconsGen3_4.Kinsect.Cutting;
                break;

            case 025:
                icon = weaponsIconsGen3_4.Kinsect.Blunt;
                break;

            case 026:
                icon = weaponsIconsGen5.Great_Sword[rarity];
                break;

            case 027:
                icon = weaponsIconsGen5.Long_Sword[rarity];
                break;

            case 028:
                icon = weaponsIconsGen5.Sword_and_Shield[rarity];
                break;

            case 029:
                icon = weaponsIconsGen5.Dual_Blades[rarity];
                break;

            case 030:
                icon = weaponsIconsGen5.Hammer[rarity];
                break;

            case 031:
                icon = weaponsIconsGen5.Hunting_Horn[rarity];
                break;

            case 032:
                icon = weaponsIconsGen5.Lance[rarity];
                break;

            case 033:
                icon = weaponsIconsGen5.Gunlance[rarity];
                break;

            case 034:
                icon = weaponsIconsGen5.Switch_Axe[rarity];
                break;

            case 035:
                icon = weaponsIconsGen5.Charge_Blade[rarity];
                break;

            case 036:
                icon = weaponsIconsGen5.Insect_Glaive[rarity];
                break;

            case 037:
                icon = weaponsIconsGen5.Light_Bowgun[rarity];
                break;

            case 038:
                icon = weaponsIconsGen5.Heavy_Bowgun[rarity];
                break;

            case 039:
                icon = weaponsIconsGen5.Bow[rarity];
                break;

            case 040:
                icon = weaponsIconsGen5.Kinsect.Cutting[rarity];
                break;

            case 041:
                icon = weaponsIconsGen5.Kinsect.Blunt[rarity];
                break;
            }
        }