public async Task F**k(CommandContext ctx, [Description("Usuário que você quer foder.")][RemainingText] DiscordUser usuario = null) { bool especial = false; if (ctx.Guild != null) { Servidores servidor = await new ServidoresDAO().Get(new Servidores { ID = ctx.Guild.Id }); especial = ((byte)servidor.Especial >= (byte)TiposServidores.LolisEdition); } F**k f**k = await new FuckDAO().Get(new F**k { Explicit = especial }); await ctx.RespondAsync(embed : new DiscordEmbedBuilder { Color = DiscordColor.HotPink, ImageUrl = f**k.Url, Title = (usuario == null) ? $"{ctx.User.Username} está se masturbando." : $"{ctx.User.Username} está fodendo {usuario.Username}." }); }
public async Task <F**k> Get(F**k f) { using Kurosawa_DiaContext context = new Kurosawa_DiaContext(); if (f.Explicit) { F**k[] f***s = await context.F**k.ToArrayAsync(); if (f***s.Count() == 0) { return(null); } Random random = new Random(); return(f***s[random.Next(f***s.Length)]); } else { F**k[] f***s = await context.F**k.Where(x => !x.Explicit).ToArrayAsync(); if (f***s.Count() == 0) { return(null); } Random random = new Random(); return(f***s[random.Next(f***s.Length)]); } //return (await context.F**k.FromSqlRaw("call GetFuck({0})", f**k.Explicit).ToListAsync()).FirstOrDefault(); }
private void Fuck_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) { if (!F**k.IsFocused) { return; } if (e.Key == Key.Right) { if (config.CanNextChapter) { GoChapter(config.CurrentChapter + 1); } } else if (e.Key == Key.Left) { if (config.CanPreChapter) { GoChapter(config.CurrentChapter - 1); } } else if (e.Key == Key.Up) { F**k.ScrollToVerticalOffset(F**k.VerticalOffset - F**k.ViewportHeight / 3.0); } else if (e.Key == Key.Down) { F**k.ScrollToVerticalOffset(F**k.VerticalOffset + F**k.ViewportHeight / 3.0); } else if (e.Key == Key.Space) { SwitchAuto(); } }
public static void MakeFuck(MySqlConnection sql, int femaleId, int maleId, int daysPast, int worker, bool syntetic) { OneRabbit f = RabbitGetter.GetRabbit(sql, femaleId); String type = F**k.GetFuckTypeStr(FuckType.Sluchka); string when = DBHelper.DaysPastSqlDate(daysPast); if (syntetic) { type = F**k.GetFuckTypeStr(FuckType.Syntetic); } else if (f.Status > 0) { type = F**k.GetFuckTypeStr(FuckType.Vyazka); } MySqlCommand cmd = new MySqlCommand(String.Format("UPDATE f***s SET f_last=0 WHERE f_rabid={0:d};", femaleId), sql); cmd.ExecuteNonQuery(); cmd.CommandText = String.Format(@"INSERT INTO f***s(f_rabid,f_date,f_partner,f_state,f_type,f_last,f_notes,f_worker) VALUES({0:d},{1:s},{2:d},'sukrol','{3:s}',1,'',{4:d});", femaleId, when, maleId, type, worker); cmd.ExecuteNonQuery(); // cmd.CommandText = String.Format("SELECT r_status,TODAYS(r_last_fuck_okrol FROM rabbits WHERE r_id="); cmd.CommandText = String.Format("UPDATE rabbits SET r_event_date={0:s}, r_event='{1:s}', r_rate=r_rate+IF(MONTH(r_event_date) BETWEEN 8 AND 12,{3:d},0) WHERE r_id={2:d};", when, type, femaleId, Rate.AUTUMN_FUCK_RATE); cmd.ExecuteNonQuery(); if (!syntetic)///если ИО то не ставим, что самец работал { cmd.CommandText = String.Format("UPDATE rabbits SET r_last_fuck_okrol={0:s}, r_rate=r_rate+1 WHERE r_id={1:d};", when, maleId); cmd.ExecuteNonQuery(); } }
private void GoChapter(int toGo) { CatalogGrid.Visibility = Visibility.Collapsed; SettingGrid.Visibility = Visibility.Collapsed; if (toGo > -1 && toGo <= config.ChaptersCount) { config.CurrentChapter = toGo; F**k.Document.Blocks.Clear(); F**k.AppendText(bookReading.titles[toGo]); if (bookReading.chapters[toGo].Length > config.DivideLimit && !config.ChapterDivide) { Paragraph graph = new Paragraph(); NovelContent.Blocks.Add(graph); Action action = new Action(() => { ReadText(graph, bookReading.chapters[toGo]); }); action.BeginInvoke(null, null); } else { F**k.AppendText(bookReading.chapters[toGo]); } F**k.Selection.Select(F**k.Document.ContentStart, F**k.Document.ContentStart); F**k.ScrollToHome(); wait = -config.WaitBefore; preOffSet = 0.0; F**k.Focus(); } else { GoChapter(0); } }
/// <summary> /// 图片等分函数 /// </summary> /// <param name="imgPath">图片路径</param> /// <param name="subWidth">等分的宽</param> /// <param name="subHeight">等分的高</param> /// <param name="subImageNum">宽高几等分</param> public bool crop(string imgPath, int subWidth, int subHeight, int subImageNum) { int num = 1; try { byte[] photoBytes = File.ReadAllBytes(imgPath); using (MemoryStream inStream = new MemoryStream(photoBytes)) { // Initialize the ImageFactory using the overload to preserve EXIF metadata. using (ImageFactory imageFactory = new ImageFactory(preserveExifData: true)) { // Load, resize, set the format and quality and save an image. Point startPoint = new Point(0, 0); Size partSize = new Size(subWidth, subHeight); for (int i = 0; i < subImageNum; i++) // 我是横行 { for (int j = 0; j < subImageNum; j++) //我是纵向 { using (MemoryStream outStream = new MemoryStream()) { if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } if (!cbCrop.Checked) { imageFactory.Load(inStream) .Crop(new Rectangle(startPoint, partSize)) .Save(outStream); Image.FromStream(outStream).Save(Path.Combine(savePath, Path.GetFileNameWithoutExtension(imgPath) + "-" + num + Path.GetExtension(imgPath))); } F**k ff = new F**k(); ff.rectangle = new RTree.Rectangle(startPoint.X, startPoint.Y, startPoint.X + partSize.Width, startPoint.Y + partSize.Height, 0, 0); ff.point = new Point(startPoint.X, startPoint.Y); cropRRectangles.Add(ff); } num++; startPoint = new Point(startPoint.X + subWidth, startPoint.Y); } startPoint = new Point(0, startPoint.Y + subHeight); } } photoBytes = null; // Do something with the stream. } } catch (Exception er) { } if (num >= subImageNum * subImageNum) { return(true); } return(false); }
public void Test1() { // arrange // act // assert F**k.YouFuckedUp("I'm not f*****g testing this."); }
private void Default_Click(object sender, RoutedEventArgs e) { var flag = (!config.LongDivide || !config.ChapterDivide || config.Rg != "\\b第([0-9]{1,4}|[一二三四五六七八九十两百千零○〇廿卅卌]{1,7})[章节回]( .*)?(?=\\r\\n)" || 12800 != config.DivideLimit); config.BackToDefault(); if (flag) { OpenText(bookReading.filePath); } SettingGrid.Visibility = Visibility.Collapsed; F**k.Focus(); }
private void bookMark_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var bookmark = (sender as System.Windows.Controls.ListViewItem).Content as BookMark; OpenText(bookmark.BookPath); GoChapter(bookmark.CurrentChapter); MainTab.Focus(); if (config.LongDivide || config.ChapterDivide) { F**k.ScrollToVerticalOffset(bookmark.CurrentOffSet * (F**k.ExtentHeight - F**k.ViewportHeight)); } }
private void AutoRead(object sender, EventArgs e) { if (F**k.VerticalOffset == 0.0) { if (preOffSet != 0.0) { wait = -config.WaitBefore; preOffSet = 0.0; AutoBtn.Content = getAutoReadButtonName(); return; } if (wait < 0) { wait++; AutoBtn.Content = getAutoReadButtonName(); return; } } if (wait < 0 && F**k.VerticalOffset != 0.0) { goto IL_00ea; } if (wait > 0 && Math.Abs(F**k.ExtentHeight - F**k.VerticalOffset - F**k.ViewportHeight) >= 1E-05) { goto IL_00ea; } goto IL_00fb; IL_00ea: AutoBtn.Content = getAutoReadButtonName(); goto IL_00fb; IL_00fb: F**k.ScrollToVerticalOffset(F**k.VerticalOffset + 20.0); if (Math.Abs(F**k.ExtentHeight - F**k.VerticalOffset - F**k.ViewportHeight) < 1E-05) { if (config.CurrentChapter == config.ChaptersCount) { SwitchAuto(); } wait = ((wait >= 0) ? (wait + 1) : 0); AutoBtn.Content = getAutoReadButtonName(); if (wait >= config.WaitAfter) { GoChapter(config.CurrentChapter + 1); goto IL_01aa; } return; } goto IL_01aa; IL_01aa: preOffSet = F**k.VerticalOffset; }
private void ChapterList_Click(object sender, RoutedEventArgs e) { if (CatalogGrid.Visibility == Visibility.Collapsed) { CatalogGrid.Visibility = Visibility.Visible; Catalog.ScrollIntoView(Catalog.Items[config.CurrentChapter]); Catalog.SelectedItem = Catalog.Items[config.CurrentChapter]; } else { CatalogGrid.Visibility = Visibility.Collapsed; } F**k.Focus(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (config.HistoryBooks.Count > 0 && bookReading.filePath == "") { var bookmark = config.HistoryBooks[config.HistoryBooks.Count - 1]; OpenText(bookmark.BookPath); GoChapter(bookmark.CurrentChapter); MainTab.Focus(); if (config.LongDivide || config.ChapterDivide) { F**k.ScrollToVerticalOffset(bookmark.CurrentOffSet * (F**k.ExtentHeight - F**k.ViewportHeight)); } config.HistoryBooks.Remove(bookmark); } }
/// <summary> /// Отменяет Прохолост, т.е. продолжает сукрольность. /// </summary> public static void cancelFuckEnd(MySqlConnection sql, int fuckId) { MySqlCommand cmd = new MySqlCommand("", sql); /// достаем информацию, которую нужно востановить в таблице rabbits по данной крольчихе cmd.CommandText = String.Format("SELECT {0:s} FROM f***s f WHERE f_id={1:d};", fuckFields(true), fuckId); MySqlDataReader rd = cmd.ExecuteReader(); F**k f = null; if (rd.Read()) { f = fillFuck(rd); //rabID = rd.GetInt32("f_rabid"); //if (!rd.IsDBNull(rd.GetOrdinal("f_date"))) // ev_date = rd.GetDateTime("f_date"); //else // ev_date = DateTime.Now.AddDays(-30); //type = rd.GetString("f_type"); //status = F**k.ParceFuckEndType(rd.GetString("f_state")); } else { rd.Close(); return; } rd.Close(); int rate = 2; if (f.FEndType == FuckEndType.Sukrol) { return; } if (f.FEndType == FuckEndType.Okrol) { rate = -(Math.Abs(f.Children - 8) - f.Dead); cmd.CommandText = String.Format(@"UPDATE rabbits SET r_rate=r_rate+{0:d} WHERE r_id={1:d};", rate, f.PartnerId); cmd.ExecuteNonQuery(); } cmd.CommandText = String.Format("UPDATE f***s SET f_end_date=null, f_state='sukrol', f_notes='{1:s} cancel', f_children=0,f_dead=0,f_added=0,f_killed=0 WHERE f_id={0:#};", fuckId, F**k.GetFuckEndTypeStr(f.FEndType)); cmd.ExecuteNonQuery(); cmd.CommandText = String.Format("UPDATE rabbits SET r_event_date='{0}',r_event='{2}',r_rate=r_rate+{3:d} WHERE r_id={1:d};", f.EventDate.ToString("yyyy-MM-dd"), f.FemaleId, F**k.GetFuckTypeStr(f.FType), rate ); cmd.ExecuteNonQuery(); }
private static void CastToAnything() { // cast to anything var human = new Human() { Name = "Filip" }; human.SayHi(); human.BeADouchebag(); Console.ReadLine(); var oven = F**k.It <Oven>(human); oven.SayHi(); oven.Bake(); }
private void ToNightMode_Click(object sender, RoutedEventArgs e) { if (!config.NightMode) { config.tempColor = config.BackgroundColor; MainGrid.Background = OtherGrid.Background = Catalog.Background = Shelf.Background = BookMark.Background = Brushes.Black; NovelContent.Foreground = Catalog.Foreground = Shelf.Foreground = BookMark.Foreground = Brushes.DimGray; config.BackgroundColor = "#323232"; } else { config.BackgroundColor = config.tempColor; NovelContent.Foreground = config.FontBrush; Catalog.Background = MainGrid.Background = Shelf.Background = BookMark.Background = OtherGrid.Background = Brushes.White; Catalog.Foreground = Shelf.Foreground = BookMark.Foreground = Brushes.Black; } config.NightMode = !config.NightMode; config.OnPropertyChanged("LabelColor"); F**k.Focus(); }
private void Yes_Click(object sender, RoutedEventArgs e) { config.MaxDisplayWidth = Config.DoubleParse(MaxDisplayWidthSet.Text); config.LineHeight = Config.DoubleParse(LineHeightSet.Text); config.ParaGap = Config.DoubleParse(ParaGapSet.Text); double num = Math.Max((ReadingArea.ActualWidth - config.MaxDisplayWidth) / 2.0, 5.0); F**k.Document.PagePadding = new Thickness(num, 0.0, num, 0.0); config.Interval = Config.IntParse(Gap.Text); config.WaitAfter = Config.IntParse(After.Text); config.WaitBefore = Config.IntParse(Before.Text); if (CutOff.IsChecked != config.LongDivide || DivideChapter.IsChecked != config.ChapterDivide || config.Rg != Principle.Text || LimitNumber.Text != config.DivideLimit.ToString()) { config.LongDivide = (CutOff.IsChecked ?? true); config.ChapterDivide = (DivideChapter.IsChecked ?? true); config.Rg = Principle.Text; config.DivideLimit = Config.IntParse(LimitNumber.Text); OpenText(bookReading.filePath); } SettingGrid.Visibility = Visibility.Collapsed; F**k.Focus(); }
public async Task Add(F**k f) { using Kurosawa_DiaContext context = new Kurosawa_DiaContext(); Usuarios usuarios = await context.Usuarios.SingleOrDefaultAsync(x => x.ID == f.Usuario.ID); f.Usuario = usuarios; await context.F**k.AddAsync(f); await context.SaveChangesAsync(); //IDbContextTransaction transation = await context.Database.BeginTransactionAsync(IsolationLevel.Snapshot); //await context.Database.ExecuteSqlRawAsync("call AddFuck({0}, {1}, {2})", f**k.Usuario.ID, f**k.Url, f**k.Explicit); //_ = context.F**k.FromSqlRaw("call AddFuck({0}, {1}, {2})", f**k.Usuario.ID, f**k.Url, f**k.Explicit); //await transation.CommitAsync(); //MySqlCommand command = await context.GetMysqlCommand(); //command.CommandText = "call AddFuck(@ui, @u, @e)"; //command.Parameters.AddWithValue("@ui", f**k.Usuario.ID); //command.Parameters.AddWithValue("@u", f**k.Url); //command.Parameters.AddWithValue("@e", f**k.Explicit); //await command.ExecuteNonQueryAsync(); }
public Event(DateTime ClockStart, DateTime ClockEnd, int ClockRunTime, System.Xml.Linq.XDocument XMLEvents, ref CrashHandler Crash) { ch = Crash; events = new Dictionary<string, List<EventItem>>(); clock = new PartyClock(ClockStart, ClockEnd, ClockRunTime); Util.ShowClock = true; sound = new Sound(true); text = new Text2D(); chess = new Chess(); sf = new Starfield(150); intro = new Intro(ref sound, ref text); outro = new Outro(ref sound); advent = new Advent(ref sound); birthday = new Birthday(ref sound, ref text, ref chess); xmas = new Christmas(ref sound); smurf = new Datasmurf(ref sound, ref text); // random dif = new Dif(ref chess, ref sound); // random fbk = new Fbk(ref sound); // random hw = new Halloween(ref chess, ref sound, 25); lucia = new Lucia(ref chess, ref sound); newyear = new NewYear(); richard = new RMS(ref sound, ref text); // random scroller = new Scroller(ref chess, ref sf, ref text); // random semla = new Semla(); sune = new SuneAnimation(ref sound, ref text); tl = new TurboLogo(ref sound, ref chess, (OpenGL.Util.SpringOrFall.Equals("Spring")? true:false)/*((ClockStart.Month >= 1 && ClockStart.Month <= 8)? false:true)*/ ); // vilken termin är det? jan till början av augusti VT, resten HT... random valentine = new Valentine(ref sound); wl = new WinLinux(ref chess); //random creators = new Self(ref sound); // random bb = new BB(ref sound); // random GM = new GummiBears(ref sound); NDay = new National(ref chess, ref sound); easter = new Easter(ref sound); hajk = new Hajk(ref sound); mid = new Midsummer(ref sound); vaf = new Vaffla(); wp = new Walpurgis(); crayfish = new CrayFish(); ts = new TeknatStyle(ref chess, ref sound, ref text); m = new Matrix(ref text); q = new Quiz(ref text, false, ref sound); talepsin = new Talespin(ref sound); cd = new ChipAndDale(ref sound, ref chess); nerd = new Nerdy(ref chess, ref sound); trex = new Trex(ref sound); sailormoon = new Sailormoon(ref sound,ref chess); gb = new GhostBusters(ref sound); zelda = new Zelda(ref sound, ref chess); tardis = new Tardis(ref sound); f**k = new F**k(ref sound, ref chess); silverFang = new SilverFang(ref sound); mt = new MoraT(ref sound); swine = new Swine(ref chess, ref text); tjall = new Tjall(ref chess, ref text); ronja = new Ronja(ref sound); emil = new Emil(ref sound); djungelboken = new Djungelboken(ref sound); fabbe = new Fabbe(ref sound); drink = new Drink(ref sound); frozen = new Frozen(ref sound); eventCurrent = null; // event item for events to be triggerd in clock_NewDate //randomEvent = new List<string>(new string[] { "starfield", "SuneAnimation", "TurboLogo", "Datasmurf", "WinLinux", "Scroller", "BB", "GummiBears", "TeknatStyle", "Matrix"}); randomEvent = new List<string>(new string[] { "starfield", "Nerdy", "Talespin", "Sailormoon", "GhostBusters", "Zelda", "Tardis", "F**k", "SilverFang", "MoraT" }); //new stuff List<UtilXML.EventData> ed = UtilXML.Loadeffectdata(); // TODO: Make a clean list with all events allowed to be used implement so that it is actaully usable instead of a switch at the bottom of this file. Dictionary<string, Effect> effects = new Dictionary<string, Effect>() { {"SuneAnimation", new Effect(sune, ed.Find(e => e.Name == "SuneAnimation"))}, {"Dif",new Effect(dif, ed.Find(e => e.Name == "Dif"))}, {"Fbk",new Effect(fbk, ed.Find(e => e.Name == "Fbk"))}, {"TurboLogo",new Effect(tl, ed.Find(e => e.Name == "TurboLogo"))}, {"Datasmurf", new Effect(smurf, ed.Find(e => e.Name == "Datasmurf"))}, {"RMS",new Effect(richard, ed.Find(e => e.Name == "RMS"))}, {"WinLinux",new Effect(wl, ed.Find(e => e.Name == "WinLinux"))}, {"Scroller",new Effect(scroller, ed.Find(e => e.Name == "Scroller"))}, {"Self",new Effect(creators, ed.Find(e => e.Name == "Self"))}, {"BB",new Effect(bb, ed.Find(e => e.Name == "BB"))}, {"GummiBears",new Effect(GM, ed.Find(e => e.Name == "GummiBears"))}, {"Hajk",new Effect(hajk, ed.Find(e => e.Name == "Hajk"))}, {"TeknatStyle",new Effect(ts, ed.Find(e => e.Name == "TeknatStyle"))}, {"Matrix",new Effect(m, ed.Find(e => e.Name == "Matrix"))}, {"Quiz",new Effect(q, ed.Find(e => e.Name == "Quiz"))}, {"Talespin",new Effect(talepsin, ed.Find(e => e.Name == "Talespin"))}, {"ChipDale",new Effect(cd, ed.Find(e => e.Name == "ChipDale"))}, {"Nerdy",new Effect(nerd, ed.Find(e => e.Name == "Nerdy"))}, /* {"Trex",new Effect(trex, ed.Find(e => e.Name == "Trex"))},*/ {"Sailormoon",new Effect(sailormoon, ed.Find(e => e.Name == "Sailormoon"))}, {"GhostBusters",new Effect(gb, ed.Find(e => e.Name == "GhostBusters"))}, {"Zelda",new Effect(zelda, ed.Find(e => e.Name == "Zelda"))}, {"Tardis",new Effect(tardis, ed.Find(e => e.Name == "Tardis"))}, {"F**k",new Effect(f**k, ed.Find(e => e.Name == "F**k"))}, {"SilverFang",new Effect(silverFang, ed.Find(e => e.Name == "SilverFang"))}, {"MoraT",new Effect(mt, ed.Find(e => e.Name == "MoraT"))}, {"Ronja",new Effect(ronja, ed.Find(e => e.Name == "Ronja"))}, {"Emil",new Effect(emil, ed.Find(e => e.Name == "Emil"))}, {"Djungelboken",new Effect(djungelboken, ed.Find(e => e.Name == "Djungelboken"))}, {"Fabbe",new Effect(fabbe, ed.Find(e => e.Name == "Fabbe"))}, {"Drink",new Effect(drink, ed.Find(e => e.Name == "Drink"))}, {"Frozen",new Effect(drink, ed.Find(e => e.Name == "Frozen"))} }; runEffectInMonth = new Dictionary<string, List<objdata>>(); string[] months = Util.monthlist(); int counter; foreach (KeyValuePair<string, Effect> pair in effects) { counter = 0; foreach (bool b in pair.Value.RunAllowedlist) { if (b == true) { if (!runEffectInMonth.ContainsKey(months[counter])) { runEffectInMonth.Add(months[counter], new List<objdata>()); } runEffectInMonth[months[counter]].Add(new objdata(pair.Key, pair.Value.Vetolist[counter], pair.Value.Priolist[counter], pair.Value.Runslist[counter])); } counter++; } } clock.NewDate += clock_NewDate; // Event listener if (ch.CrashDialogResult == System.Windows.Forms.DialogResult.Yes) { clock.clock = ch.CrashClock; } string name, date, type; // Event dates setup foreach (var item in XMLEvents.Descendants("event")) { name = item.Element("name").Value; date = item.Element("date").Value; type = item.Element("type").Value.ToLower(); EventItem ei = new EventItem(name, type, date); if (!events.ContainsKey(date)) { List<EventItem> list = new List<EventItem>(); // seems most bad in my eyes... events.Add(date, list); } for (int i = 0; i < events[date].Count; i++) { EventItem e = events[date][i]; if ("birthday".Equals(e.Type) && "birthday".Equals(ei.Type)) { e.Name += "\n\n" + ei.Name; events[date][i] = e; } } events[date].Add(ei); name = date = type = string.Empty; } // this needs to be fixed nicer... if (events.ContainsKey(ClockEnd.ToShortDateString())) { events[ClockEnd.ToShortDateString()].Clear(); // force this to be top.. events[ClockEnd.ToShortDateString()].Add( new EventItem("outro", "outro", ClockEnd.ToShortDateString()) ); } else { events.Add(ClockEnd.ToShortDateString(), new List<EventItem>() { new EventItem("outro", "outro", ClockEnd.ToShortDateString()) }); } // Random effects on dates with no effects and check against new list of allowed things for them... DateTime dt = ClockStart; bool star = (Util.Rnd.Next(0, 1000) < 500 ? true:false); // make this random at the start too? int num = 0; while (dt <= ClockEnd) { date = dt.ToShortDateString(); if (!events.ContainsKey(date)) { EventItem ei; if (num == 0 || num == 1) { ei = new EventItem("starfield", "random", date); } else { //ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); string month = ""; if (dt != null) month = dt.Month.ToString(); switch (month) { case "1": month = "jan"; break; case "2": month = "feb"; break; case "3": month = "mar"; break; case "4": month = "apr"; break; case "5": month = "maj"; break; case "6": month = "jun"; break; case "7": month = "jul"; break; case "8": month = "aug"; break; case "9": month = "sep"; break; case "10": month = "okt"; break; case "11": month = "nov"; break; case "12": month = "dec"; break; }//switch if (runEffectInMonth.ContainsKey(month)) { List<objdata> mobj = runEffectInMonth[month]; List<objdata> vetolist = new List<objdata>(); List<objdata> novetolist = new List<objdata>(); foreach (objdata n in mobj) { if ("Quiz".Equals(n.Name) && eventnum == 4) { n.vetoAgain(); eventnum = 0; } if (n.Veto == true) { if (n.Runs > 0) vetolist.Add(n); } else { if (n.Runs > 0) novetolist.Add(n); } } vetolist.Sort(); novetolist.Sort(); if (vetolist.Count > 0) { ei = new EventItem(vetolist[0].Name, "random", date); vetolist[0].noMoreVeto(); } else if (novetolist.Count > 0) { ei = new EventItem(novetolist[0].Name, "random", date); novetolist[0].decRuns(); if (eventnum < 4) eventnum++; } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } num++; if (num == 3) { num = 0; } ei = new EventItem("Self", "random", date); // this is for debuging new events events.Add(date, new List<EventItem>()); events[date].Add(ei); } dt = dt.AddDays(1); date = string.Empty; } }
private void button1_Click(object sender, EventArgs e) { savePath = tbSavePath.Text.Trim(); jsonVersion = tbJsonVersion.Text.Trim(); shift = Int32.Parse(tbShift.Text.Trim()); subImageNum = Int32.Parse(this.tbSubImageNum.Text.Trim()); basePath = System.IO.Path.GetDirectoryName(tbPath.Text); if (Directory.Exists(savePath)) { DeleteADirectory(savePath); } System.IO.Directory.CreateDirectory(savePath); //读取文件内容 StreamReader sr = new StreamReader(tbPath.Text, System.Text.Encoding.Default); json = sr.ReadToEnd().TrimStart(); sr.Close(); JObject finaljObject = new JObject(); JObject onlyAssets = new JObject(); //string json = "{\"orderId\":\"000001\",\"goodsId[0]\":\"001\",\"goodsId[3]\":\"003\",\"goodsId[10]\":\"new data\"}"; JObject jsonObj = (JsonConvert.DeserializeObject(json) as JObject)["assets"] as JObject; finaljObject.Add(new JProperty("tags", (JsonConvert.DeserializeObject(json) as JObject)["tags"])); foreach (var p in jsonObj.Properties().ToArray()) { string id = p.Name; OneAsset one = JsonConvert.DeserializeObject <OneAsset>(p.Value.ToString()); if (one.state == 0) { LogHelper.WriteLog(one.name + " 未查看,直接跳过截图"); continue; } #region 这里读取图片进行等分 //等分数量 //int subImageNum = Int32.Parse(this.tbSubImageNum.Text.Trim()); //得到原图的宽高 int subWidth, subHeight; //srcHeight = 2056; ////获取原图宽、高 //srcWidth = 2456; subWidth = one.size.width / subImageNum + shift; subHeight = one.size.height / subImageNum + shift; if (!crop(Path.Combine(basePath, HttpUtility.UrlDecode(one.name)), subWidth, subHeight, subImageNum)) { continue; } #endregion #region //所有缺陷框 RTree.RTree <Region> tree = new RTree.RTree <Region>(); if (one.state == 2)//这里需要操作素材打的框 { #region 这里写单个的区块的素材操作了 string oneJsonFile = Path.Combine(basePath, id + "-asset.json"); using (StreamReader srTemp = new StreamReader(oneJsonFile, System.Text.Encoding.Default)) { OneAssetWithRegions oneAR = JsonConvert.DeserializeObject <OneAssetWithRegions>(srTemp.ReadToEnd().TrimStart()); #region 重头戏来了,这里处理完救赎 foreach (var f**k in oneAR.regions) { tree.Add(new RTree.Rectangle(f**k.boundingBox.left, f**k.boundingBox.top, f**k.boundingBox.left, f**k.boundingBox.top, 0, 0), f**k); } #endregion } #endregion } #endregion string oldName = one.name; #region 这里做一些逻辑判断 for (int n = 1; n <= subImageNum * subImageNum; n++) { one.id = id + n; one.size = new AssetsSize() { width = subWidth, height = subHeight }; // 这里其实写不写无所谓,但追求完美还是写!!!!注意如果下次还要等分,这里还是写完整 one.name = Path.GetFileNameWithoutExtension(oldName) + "-" + n + Path.GetExtension(oldName); one.path = "file:${path}" + one.name; if (tree.Count > 0) { //判断所有的边框是否存在在裁剪后的边框内 F**k f**k = cropRRectangles[n - 1]; var objects = tree.Contains(f**k.rectangle); if (objects.Count > 0)//有边框那么,改状态,还要生成本地json文件 { one.state = 2; OneAssetWithRegions fuckOne = new OneAssetWithRegions(); fuckOne.asset = one; fuckOne.version = jsonVersion; foreach (var re in objects) { re.boundingBox = new BoundingBox() { left = re.boundingBox.left - f**k.point.X, top = re.boundingBox.top - f**k.point.Y, width = re.boundingBox.width, height = re.boundingBox.height }; re.points.Clear(); re.points.Add(new AssetPoint() { x = re.boundingBox.left, y = re.boundingBox.top }); re.points.Add(new AssetPoint() { x = re.boundingBox.left + re.boundingBox.width, y = re.boundingBox.top }); re.points.Add(new AssetPoint() { x = re.boundingBox.left + re.boundingBox.width, y = re.boundingBox.top + re.boundingBox.height }); re.points.Add(new AssetPoint() { x = re.boundingBox.left, y = re.boundingBox.top + re.boundingBox.height }); } fuckOne.regions = objects; File.WriteAllText(Path.Combine(savePath, id + n + "-asset.json"), JsonConvert.SerializeObject(fuckOne)); onlyAssets.Add(new JProperty(one.id, JObject.Parse(JsonConvert.SerializeObject(one)))); LogHelper.WriteLog("ng " + HttpUtility.UrlDecode(one.name)); } else//没有那么 { one.state = 1; if (cbSaveOk.Checked) { onlyAssets.Add(new JProperty(one.id, JObject.Parse(JsonConvert.SerializeObject(one)))); } LogHelper.WriteLog("ok " + HttpUtility.UrlDecode(one.name)); } } //if (one.state == 1)//这里不用判断素材框, 直接草他个等分数的平方 //{ //} //else //#region 这里处理完了就可以知道 图片等分出来的区块的state,然后新建个-asset.json,然后再吧assets新增 ////one.state = 2; //#endregion } #endregion //写入一个字符串 int o = 0; } finaljObject.Add(new JProperty("assets", onlyAssets)); string bb = finaljObject.ToString(); File.WriteAllText(Path.Combine(savePath, "import.power-ai"), bb); MessageBox.Show("处理完成"); // ////////给原图分块 // for (int j = 0; j < subImageNum; j++) // { // for (int i = 0; i < subImageNum; i++) // { // if (j < subImageNum - 1 && i < subImageNum - 1) // { // cv::Mat temImage(subHeight, subWidth, CV_8UC3, cv::Scalar(0,0,0)); // cv::Mat imageROI = src(cv::Rect(i * subWidth, j * subHeight, temImage.cols, temImage.rows)); // cv::addWeighted(temImage, 1.0, imageROI, 1.0, 0., temImage); // subImages.push_back(temImage); // }else{ // cv::Mat temImage(srcHeight - (subImageNum - 1) * subHeight, srcWidth - (subImageNum - 1) * subWidth, CV_8UC3, cv::Scalar(0,0,0)); // cv::Mat imageROI = src(cv::Rect(i * subWidth, j * subHeight, temImage.cols, temImage.rows)); // cv::addWeighted(temImage, 1.0, imageROI, 1.0, 0., temImage); // subImages.push_back(temImage); // } //} //std::cout<<subImages[0]<<std::endl; //测试语句,打印出子图矩阵 }
private void Cancel_Click(object sender, RoutedEventArgs e) { SettingGrid.Visibility = Visibility.Collapsed; F**k.Focus(); }
private void SwitchAuto() { timer.Enabled = !timer.Enabled; AutoBtn.Content = getAutoReadButtonName(); F**k.Focus(); }