상속: Food
예제 #1
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (gameObject.tag == "PlayerHitBox" && collision.tag == "PlayerHurtBox")
        {
            return;
        }
        if (gameObject.tag == "EnemyHitBox" && collision.tag == "EnemyHurtBox")
        {
            return;
        }

        if (collision.transform.root.TryGetComponent(out CharacterBase Other))
        {
            if (!_isSoundPlayed && HitSound != "")
            {
                SoundManager.Instance.Play(HitSound);
                _isSoundPlayed = true;
            }
            if (Other.GetState() == CharacterBase.eState.Down ||
                Other.GetState() == CharacterBase.eState.Dead ||
                Other.GetState() == CharacterBase.eState.Wake)
            {
                return;
            }

            for (int i = 0; i < _CollidedObjects.Count; i++)             // 한 오브젝트가 두 번 충돌하는걸 방지
            {
                if (Other.gameObject == _CollidedObjects[i])
                {
                    return;
                }
            }
            _CollidedObjects.Add(Other.gameObject);

            MainCamera.Instance.CameraShake(_CameraShakeTime == -1 ? _HitStop * 2f : _CameraShakeTime, _CameraShakeForce);
            TimeManager.Instance.HitStop(_HitStop);
            _Knockback.x *= Mathf.Sign(transform.root.localScale.x);

            Other.DealDamage(_Damage, _StunTime, _Knockback, transform.root.gameObject);
        }
    }
예제 #2
0
 private void spBar_D_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     if (spBar_D.BytesToRead == 0)
     {
         return;
     }
     try
     {
         string sReceive = spBar_D.ReadTo(Other.Chr(13));
         spBar_D.DiscardInBuffer();
         sReceive = sReceive.Trim();
         this.Invoke((EventHandler)(delegate
         {
             updateMessage(lstMessage, "BarD->PC:" + sReceive);
             saveLog(p.LogType.SysLog, "BarD->PC:" + sReceive);
             updateMessage(lstMessage, "BarD:" + sReceive);
             saveLog(p.LogType.SysLog, "BarD:" + sReceive);
             updateMessage(lstBar, "BarD:" + sReceive);
             p.BarD = sReceive.Trim().ToUpper();
             txtBarD.Text = p.BarD;
             saveLog(p.LogType.SNLog, "BarD:" + p.BarD);
             //check A,B,C,D
             if (_runing)
             {
                 if (CheckAllBarComplete())
                 {
                     sendData(spPLC, "B");
                     updateMessage(lstMessage, "PC->PLC:B");
                     saveLog(p.LogType.SysLog, "PC->PLC:B");
                 }
                 else
                 {
                 }
             }
         }));
     }
     catch (Exception)
     {
         // throw;
     }
 }
        public async Task <IActionResult> Create(Other otherModel)
        {
            try
            {
                if (otherModel.ImageFile != null)
                {
                    otherModel.ImageTitle = otherModel.ImageFile.FileName;
                    otherModel.ImageData  = ImageManager.GetByteArrayFromImage(otherModel.ImageFile);
                }

                string accessToken = await this.HttpContext.GetTokenAsync("access_token");

                await ApiRequests.PostAsync(accessToken, string.Format("{0}/{1}", this.apiBaseUrl, this.apiController), otherModel);

                return(this.RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(this.View());
            }
        }
예제 #4
0
        private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            try
            {
                //This is used when trying to load missing assemblies, which are not located in same folder as the main executable.

                var name = args.Name.Split(',').First();

                if (!name.StartsWith("SharpDX"))
                    return null;

                var path = Other.AdjustPath(UserSettings.All.SharpDxLocationFolder ?? "");

                return Assembly.LoadFrom(System.IO.Path.Combine(path, $"{name}.dll"));
            }
            catch (Exception e)
            {
                LogWriter.Log(e, "Error loading assemblies");
                return null;
            }
        }
예제 #5
0
        public void TestGetOtherFundsNullableType_NullUSGovt()
        {
            string binationalCommission = "commission";
            string personal             = "peronsal";
            string evGovt = "ev gov";
            Other  other  = new Other("name", "amount");
            USGovernmentFunding  usGovt        = null;
            InternationalFunding international = new InternationalFunding(null, null, null, null, null, null);

            var otherFunds = new OtherFunds(
                exchangeVisitorGovernment: evGovt,
                binationalCommission: binationalCommission,
                personal: personal,
                usGovernmentFunding: usGovt,
                internationalFunding: international,
                other: other);
            var instance = otherFunds.GetOtherFundsNullableType();

            Assert.IsNotNull(instance);
            Assert.IsNull(otherFunds.USGovernmentFunding);
        }
예제 #6
0
파일: Program.cs 프로젝트: frankfg94/Bolter
        private static void ExecuteUACCommand(string commandName)
        {
            log.Info("Trying to execute command : " + commandName);
            switch (commandName.ToLower())
            {
            case "installadminservice":
            case "installservice":
                Admin.InstallService();
                break;

            case "startservice":
                Admin.StartService();
                break;

            default:
                var msg = "Unknown command : " + commandName;
                Other.Warn(msg);
                log.Warn(msg);
                break;
            }
        }
        public async Task RemoveAsync(Other other)
        {
            using (DbConnection connection = new NpgsqlConnection(_databaseSettings.DbConnection))
            {
                connection.Open();
                using (var transaction = connection.BeginTransaction())
                {
                    try
                    {
                        await connection.ExecuteAsync("DELETE FROM others WHERE other_id = @OtherId", new { other.OtherId }, transaction);

                        transaction.Commit();
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
        }
예제 #8
0
 public void Remove(Other other)
 {
     using (var context = DapperHelper.GetConnection())
     {
         context.Open();
         using (var transaction = context.BeginTransaction())
         {
             try
             {
                 context.Execute("DELETE FROM Others WHERE OtherId = @OtherId", new { other.OtherId }, transaction);
                 transaction.Commit();
             }
             catch (Exception e)
             {
                 Log.Error(e.ToString());
                 transaction.Rollback();
                 throw;
             }
         }
     }
 }
예제 #9
0
        /// <summary>
        /// Returns the symbolic represenation of this PathPermissions as a string.
        /// </summary>
        /// <returns>string.</returns>
        public string ToSymbolicPermissions()
        {
            var sb = new StringBuilder();

            sb.Append(Owner.ToSymbolicRolePermissions());
            sb.Append(Group.ToSymbolicRolePermissions());
            sb.Append(Other.ToSymbolicRolePermissions());

            if (StickyBit)
            {
                sb.Remove(8, 1);
                sb.Append('t');
            }

            if (ExtendedAcls)
            {
                sb.Append('+');
            }

            return(sb.ToString());
        }
예제 #10
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + ((AlertMessage == null) ? 0 : AlertMessage.GetHashCode());
         hash = hash * 23 + (Risk.GetHashCode());
         hash = hash * 23 + (Confidence.GetHashCode());
         hash = hash * 23 + ((Url == null) ? 0 : Url.GetHashCode());
         hash = hash * 23 + ((Other == null) ? 0 : Other.GetHashCode());
         hash = hash * 23 + ((Parameter == null) ? 0 : Parameter.GetHashCode());
         hash = hash * 23 + ((Attack == null) ? 0 : Attack.GetHashCode());
         hash = hash * 23 + ((Evidence == null) ? 0 : Evidence.GetHashCode());
         hash = hash * 23 + ((Description == null) ? 0 : Description.GetHashCode());
         hash = hash * 23 + ((Reference == null) ? 0 : Reference.GetHashCode());
         hash = hash * 23 + ((Solution == null) ? 0 : Solution.GetHashCode());
         hash = hash * 23 + CWEId.GetHashCode();
         hash = hash * 23 + WASCId.GetHashCode();
         return(hash);
     }
 }
예제 #11
0
        public void TestDynamicSelectByBool()
        {
            Other other = new Other();

            other.Bool = true;

            Other anOther = sqlMap.QueryForObject("DynamicSelectByBool", other) as Other;

            Assert.IsNotNull(anOther);
            Assert.AreEqual(2, anOther.Int);
            Assert.AreEqual(9999999999, anOther.Long);
            Assert.AreEqual(true, anOther.Bool);

            other.Bool = false;
            anOther    = sqlMap.QueryForObject("DynamicSelectByBool", other) as Other;

            Assert.IsNotNull(anOther);
            Assert.AreEqual(1, anOther.Int);
            Assert.AreEqual(8888888, anOther.Long);
            Assert.AreEqual(false, anOther.Bool);
        }
예제 #12
0
    public Item CreateResourceItem()
    {
        Item resourceItem;

        switch (itemType)
        {
        case ItemType.Other:
            resourceItem = new Other(itemName, cost);
            return(resourceItem);

        case ItemType.Consumable:
            resourceItem = new Consumable(itemName, cost);
            return(resourceItem);

        case ItemType.Equipment:
            resourceItem = new Equipment(itemName, cost);
            return(resourceItem);
        }

        return(null);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ConfigurationManager.AppSettings["access"].ToString() != ConfigurationManager.AppSettings["accessok"].ToString())
        {
            string page = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();
            if (Session["Role"] != null)
            {
                if (!Other.Get_UserAccess(page, Session["Role"].ToString()))
                {
                    Response.Redirect("dashboard.aspx");
                }
            }
        }
        EmpCode = Convert.ToString(Session["UserName"]);
        DataSet ds = new DataSet();

        ds = Customer_cs.GetSchool_Names(EmpCode);
        DdlCustomer.DataSource = ds;
        DdlCustomer.DataBind();
        DdlCustomer.Items.Insert(0, new ListItem("-Select-", "0"));
    }
        public void WriteHeader()
        {
            int    Address   = Block.GetAddressInBlock(StartByte);
            UInt32 NodeBlock = Block.GetNodeBlock(StartByte);

            byte[] EntryBlock = this.CurrPart.NewBlockArray(1);
            this.CurrPart.ReadBlock(NodeBlock, 1, EntryBlock);

            if (IsDeleted)
            {
                EntryBlock[Address] = 0x80;
            }
            else
            {
                EntryBlock[Address] = 0x50;
            }

            if (EntryType == Entry.Directory)
            {
                EntryBlock[Address + 1] = 0x0D;
            }
            else if (EntryType == Entry.File)
            {
                EntryBlock[Address + 1] = 0x0F;
            }

            Byte[] labelData = Other.StringToByte(EntryName);

            for (int i = Address + 2; i < Address + 2 + labelData.Length; i++)
            {
                EntryBlock[i] = labelData[i - 2 - Address];//File Name
            }

            for (int i = Address + 50; i < Address + 54; i++)
            {
                EntryBlock[i] = BitConverter.GetBytes((UInt32)BlockData.Length)[i - 50 - Address];
            }

            this.CurrPart.WriteBlock(NodeBlock, 1, EntryBlock);
        }
예제 #15
0
        public async Task <IActionResult> Create([FromForm] Other other)
        {
            try
            {
                if (other.File == null || other.File.Length <= 0)
                {
                    return(BadRequest("Image file is required"));
                }

                IList <string> allowedFileExtensions = new List <string> {
                    ".jpg", ".gif", ".png"
                };
                string extension = other.File.FileName.Substring(other.File.FileName.LastIndexOf('.')).ToLower();

                if (!allowedFileExtensions.Contains(extension))
                {
                    return(BadRequest("Not image file"));
                }

                string imageFolderPath = Path.Combine(Directory.GetCurrentDirectory(), "Images");
                string now             = DateTime.Now.ToString("yyyyMMdd-hhmmss.fff");
                string storedFileName  = $"{now}_{other.File.FileName}";

                using (FileStream fileStream = System.IO.File.Create(imageFolderPath + "/" + storedFileName))
                {
                    other.File.CopyTo(fileStream);
                    await fileStream.FlushAsync();
                }

                other.ImageUri = $"images/{storedFileName}";
                var createdOther = await otherServ.Create(other);

                return(Ok(createdOther));
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                return(StatusCode(500));
            }
        }
예제 #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (ConfigurationManager.AppSettings["access"].ToString() != ConfigurationManager.AppSettings["accessok"].ToString())
     {
         string page = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();
         if (Session["Role"] != null)
         {
             if (!Other.Get_UserAccess(page, Session["Role"].ToString()))
             {
                 //Response.Redirect("dashboard.aspx");
             }
         }
         if (Session["ChetanaCompanyName"] != "" || Session["ChetanaCompanyName"] != null)
         {
             if (Session["FY"] != "" || Session["FY"] != null)
             {
                 strChetanaCompanyName = Session["ChetanaCompanyName"].ToString();
                 strFY = Session["FY"].ToString();
             }
             else
             {
                 Session.Clear();
             }
         }
     }
     if (!Page.IsPostBack)
     {
         Session["tstlData"] = null;
         getDDLdata();
         txtcustomer.Focus();
     }
     // lblMessage.Visible = false;
     //fillReport();
     // ValidateDate();
     MaskedEditExtender2.CultureName = "en-GB";
     if (txtFromdate.Text != "" && txttoDate.Text != "")
     {
         getdata(2);
     }
 }
예제 #17
0
파일: Program.cs 프로젝트: Telorath/Capers
        static void Event()
        {
            List <Character> CHARDATABASE = Database.GetActiveDatabase().CharList();

            if (CHARDATABASE.Count < 2)
            {
                return;
            }
            for (int i = 0; i < CHARDATABASE.Count; i++)
            {
                if (CHARDATABASE[i].SPD == 0)
                {
                    CHARDATABASE[i].SPD = 2;
                }
            }
            Character First = CHARDATABASE[prng.Next(0, CHARDATABASE.Count)];
            Character Other;

            while (true)
            {
                Other = CHARDATABASE[prng.Next(0, CHARDATABASE.Count)];
                if (Other != First)
                {
                    break;
                }
            }
            int var = prng.Next(1, 101);

            if (var < 1)
            {
                Console.WriteLine("You meet up with " + Other.Name + " and some stuff happens. Nobody kills each other though!");
            }
            else
            {
                Console.WriteLine("You run into " + Other.Name + " out on the street and a fight breaks out between you!");
                First.FullHeal();
                Other.FullHeal();
                MockBattle(First, Other);
            }
        }
예제 #18
0
        public async Task GumiPic(CommandContext ctx)
        {
            var c   = new HttpClient();
            var res = JsonConvert.DeserializeObject <Entities.MeekMoe>(await c.GetStringAsync($"https://api.meek.moe/gumi"));
            var img = new MemoryStream(await c.GetByteArrayAsync(Other.resizeLink(res.url)))
            {
                Position = 0
            };
            var emim = new DiscordEmbedBuilder
            {
                Description = $"[Full Source Image Link]({res.url})",
                ImageUrl    = $"attachment://image.{MimeGuesser.GuessExtension(img)}"
            };

            if (res.creator.Length != 0)
            {
                emim.AddField("Creator", res.creator);
            }
            emim.WithAuthor(name: "via api.meek.moe", url: "https://api.meek.moe/");
            emim.WithFooter("Requested by " + ctx.Message.Author.Username, ctx.Message.Author.AvatarUrl);
            await ctx.RespondWithFileAsync(fileName : $"image.{MimeGuesser.GuessExtension(img)}", fileData : img, embed : emim.Build());
        }
예제 #19
0
        private void button2_Click(object sender, EventArgs e)
        {
            Other a = new Other();
            Other b = new Other();

            a.Value = 10;
            b.Value = 20;

            MessageBox.Show("a=" + a.Value);
            MessageBox.Show("b=" + b.Value);

            // 参照型が同じ場所になる
            a = b;

            MessageBox.Show("a=" + a.Value);
            MessageBox.Show("b=" + b.Value);

            b.Value = 30;

            MessageBox.Show("a=" + a.Value);
            MessageBox.Show("b=" + b.Value);
        }
예제 #20
0
        public ActionResult Edit(Other other)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    AssetService assetService = new AssetService();
                    int          res          = assetService.UpdateOther(other);
                    if (res > 0)
                    {
                        ViewBag.Msg = "Data Updated successfully....";
                        //return RedirectToAction("Others");
                    }

                    return(View(other));
                }
                catch
                {
                }
            }
            return(View());
        }
예제 #21
0
        public void FillForm(JObject obj)
        {
            jsClick(add);
            //if(obj["position"].ToString() == "0") {
            //    Click(buttonKiemSatVien);
            //} else Click(buttonDieuTraVien);

            Click(textBoxKiemSatVien);
            SendKeys(obj["ksvHoTen"].ToString(), textBoxKiemSatVien);
            SendKeys(Keys.Enter, textBoxKiemSatVien);

            Click(textBoxQuyetDinhPhanCongSo);
            Other _textBoxKiemSatVien = new Other("họ tên", "//*[@id='bodyForm:inspcodef_hinput']", "");

            var    firstName = FindElementByXPath(_textBoxKiemSatVien);
            string value     = firstName.GetAttribute("value");

            if (value == null || value == "")
            {
                Clear(textBoxKiemSatVien);
                SendKeys(" ", textBoxKiemSatVien);
                SendKeys(Keys.Enter, textBoxKiemSatVien);
            }

            Click(textBoxQuyetDinhPhanCongSo);
            SendKeys(obj["ksvSoQuyetDinh"].ToString(), textBoxQuyetDinhPhanCongSo);

            Click(textBoxNgayPhanCong);
            SendKeys(obj["ksvNgayPhanCong"].ToString(), textBoxNgayPhanCong);

            Click(textBoxNgayKetThuc);
            SendKeys(obj["ksvNgayKetThuc"].ToString(), textBoxNgayKetThuc);
            Sleep();

            jsClick(save);
            Sleep();
            jsClick(back);
            Sleep();
        }
예제 #22
0
파일: AV.cs 프로젝트: qiuguoqiang/BiliDuang
        public void DownloadDanmaku(string saveto)
        {
            //todo
            //savedir+".ass"
            //"https://api.bilibili.com/x/v1/dm/list.so?oid="+ cid
            WebClient MyWebClient = new WebClient();

            MyWebClient.Credentials = CredentialCache.DefaultCredentials;//获取或设置用于向Internet资源的请求进行身份验证的网络凭据
            string content = Other.GetHtml("https://api.bilibili.com/x/v1/dm/list.so?oid=" + cid);

            Byte[] pageData = MyWebClient.DownloadData("https://api.bilibili.com/x/v1/dm/list.so?oid=" + cid); //从指定网站下载数据
            string xmlname  = saveto + "\\" + name + ".xml";

            File.WriteAllText(xmlname, content);
            string    back = Other.HTTPGetXML("https://api.bilibili.com/x/v1/dm/list.so?oid=" + cid);
            XDocument xml  = XDocument.Parse(back);

            //Console.WriteLine(xml.Element("i").Element("chatserver").Value);
            //xml.Element("i").Elements("d");
            return;
            //TODO
        }
예제 #23
0
 public void Add(Other other)
 {
     using (var context = new MicrobrewitContext())
     {
         context.Entry(other).State = EntityState.Added;
         try
         {
             context.SaveChanges();
         }
         catch (DbEntityValidationException dbEx)
         {
             foreach (var validationErrors in dbEx.EntityValidationErrors)
             {
                 foreach (var validationError in validationErrors.ValidationErrors)
                 {
                     Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                     Log.DebugFormat("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                 }
             }
         }
     }
 }
예제 #24
0
        public void JsonSerialization()
        {
            var cm = new ConverterManager(); // empty

            cm.AddConverter <string, Wrapper>(str => new Wrapper {
                Value = str
            });

            var objSrc = new Other {
                Value2 = "abc"
            };

            // Json Serialize: (Other --> string)
            // custom          (string -->Wrapper)
            var     func = cm.GetConverter <Other, Wrapper, Attribute>();
            Wrapper obj2 = func(objSrc, null);

            string json    = obj2.Value;
            var    objSrc2 = JsonConvert.DeserializeObject <Other>(json);

            Assert.Equal(objSrc.Value2, objSrc2.Value2);
        }
예제 #25
0
 public void Add(Other other)
 {
     using (var context = DapperHelper.GetConnection())
     {
         context.Open();
         using (var transaction = context.BeginTransaction())
         {
             try
             {
                 var otherId = context.Query <int>("INSERT Others(Name,Type,Custom) VALUES(@Name, @Type, @Custom); SELECT CAST(SCOPE_IDENTITY() as int)",
                                                   new { other.Name, other.Type, other.Custom }, transaction);
                 other.OtherId = otherId.SingleOrDefault();
                 transaction.Commit();
             }
             catch (Exception e)
             {
                 Log.Error(e.ToString());
                 transaction.Rollback();
             }
         }
     }
 }
예제 #26
0
        public UserInfoForm()
        {
            InitializeComponent();

            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);


            if (Other.IsDarkMode())
            {//Dark Mode
                materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey500, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
                materialSkinManager.Theme       = MaterialSkinManager.Themes.DARK;
            }
            else
            {
                materialSkinManager.ColorScheme = new ColorScheme(Primary.Indigo500, Primary.Indigo500, Primary.Indigo500, Accent.LightBlue200, TextShade.WHITE);
                materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            }
            User.RefreshUserInfo();
            UserNameBox.Text  = User.name;
            pictureBox1.Image = Image.FromFile(User.face);
            UserLevel.Text    = "LV" + User.UserJson.data.level;
            if (User.UserJson.data.vip.type == 2)
            {
                VipType.Text = "年度大会员";
            }
            else if (User.UserJson.data.vip.type == 1)
            {
                VipType.Text = "大会员";
            }
            else
            {
                VipType.Text = "";
            }
            coinBox.Text = "硬币:" + User.UserJson.data.coins.ToString();
            RefreshBangumiData();
            RefreshLikeList();
        }
예제 #27
0
 /// <summary>
 /// 打开条码枪串口,并保存log
 /// </summary>
 /// <param name="sp">串口控件</param>
 /// <param name="str2">log前缀,如”PC->BarA:"</param>
 private void closeScanner(SerialPort sp, string str2)
 {
     //sp.PortName = portname;
     if (p.Send_Command_Use_Hex)
     {
         sendHex(sp, p.Close_Scan_Command);
     }
     else
     {
         if (p.Close_Add_Enter)
         {
             sendData(sp, p.Close_Scan_Command + Other.Chr(13));
         }
         else
         {
             sendData(sp, p.Close_Scan_Command);
         }
     }
     updateMessage(lstMessage, str2 + p.Close_Scan_Command);
     saveLog(p.LogType.SysLog, str2 + p.Close_Scan_Command);
     closeSerialPort(sp);
 }
예제 #28
0
        public override bool Equals(object obj)
        {
            var other = obj as AdditionalLocatorsDataItem;

            if (other == null)
            {
                return(false);
            }


            if (Other == null && other.Other != null || Other != null && other.Other == null)
            {
                return(false);
            }

            if (Other != null && (Other.Count != other.Other.Count || Other.Exists(locator => !other.Other.Contains(locator))))
            {
                return(false);
            }

            return(GalileoHostLocator == other.GalileoHostLocator && HostLocator == other.HostLocator && HostSupplier == other.HostSupplier);
        }
예제 #29
0
 public void Update(Other other)
 {
     using (var context = DapperHelper.GetConnection())
     {
         context.Open();
         using (var transaction = context.BeginTransaction())
         {
             try
             {
                 context.Execute("UPDATE Others set Name=@Name, Type=@Type, Custom=@Custom WHERE OtherId = @Id;",
                                 new { other.Name, other.Type, other.Custom, Id = other.OtherId }, transaction);
                 transaction.Commit();
             }
             catch (Exception exception)
             {
                 Log.Error(exception.ToString());
                 transaction.Rollback();
                 throw;
             }
         }
     }
 }
예제 #30
0
        public LikeSelect(string id)
        {
            InitializeComponent();
            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);


            if (Other.IsDarkMode())
            {//Dark Mode
                materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey500, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
                materialSkinManager.Theme       = MaterialSkinManager.Themes.DARK;
            }
            else
            {
                materialSkinManager.ColorScheme = new ColorScheme(Primary.Indigo500, Primary.Indigo500, Primary.Indigo500, Accent.LightBlue200, TextShade.WHITE);
                materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            }

            //https://api.bilibili.com/medialist/gateway/base/info?media_id=295080471
            WebClient MyWebClient = new WebClient();

            MyWebClient.Credentials = CredentialCache.DefaultCredentials;//获取或设置用于向Internet资源的请求进行身份验证的网络凭据
            MyWebClient.Headers.Add("Cookie", User.cookie);
            MyWebClient.Headers.Add("Origin", "https://space.bilibili.com");
            MyWebClient.Headers.Add("Referer", "https://www.bilibili.com/medialist/detail/ml" + id);
            LikeDataRAW = Encoding.UTF8.GetString(MyWebClient.DownloadData("https://api.bilibili.com/medialist/gateway/base/resource/ids?media_id=" + id)); //如果获取网站页面采用的是UTF-8,则使用这句
            LikeJSON    = JsonConvert.DeserializeObject <JSONCallback.LikeBoxItem.LikeBoxItem>(LikeDataRAW);
            int lasty = 0;

            foreach (JSONCallback.LikeBoxItem.DataItem data in LikeJSON.data)
            {
                string         avid = Other.TextGetCenter("/av", "?", data.short_link);
                LikeSelectItem item = new LikeSelectItem(avid);
                panel1.Controls.Add(item);
                item.Location = new Point(0, lasty);
                lasty        += item.Size.Height;
            }
        }
 public Other(Other source, string value)
 {
 }
예제 #32
0
 public void DoStuff(Other.IDemo remotingDemo)
 {
     remotingDemo.ProcessString("in");
 }
예제 #33
0
				private static AdjustableDataLut GetPresentationDataLut(Other applicator)
				{
					IDicomVoiLutsProvider voiLutsProvider = applicator.DicomVoiLutsProvider;
					if (voiLutsProvider == null)
						return null;

					AutoVoiDataLut dataLut = AutoPresentationVoiDataLut.CreateFrom(voiLutsProvider);
					if (dataLut == null)
						return null;
					return new AdjustableAutoVoiDataLut(dataLut);
				}
 public Other(Other source)
 {
 }
예제 #35
0
				private static AutoVoiLutLinear GetPresentationLinearLut(Other applicator)
				{
					IDicomVoiLutsProvider voiLutsProvider = applicator.DicomVoiLutsProvider;
					if (voiLutsProvider == null)
						return null;
					return AutoPresentationVoiLutLinear.CreateFrom(voiLutsProvider);
				}
        public void JsonSerialization()
        {
            var cm = new ConverterManager(); // empty             
            
            cm.AddConverter<string, Wrapper>(str => new Wrapper { Value = str });

            var objSrc = new Other { Value2 = "abc" };

            // Json Serialize: (Other --> string)
            // custom          (string -->Wrapper)
            var func = cm.GetConverter<Other, Wrapper, Attribute>();
            Wrapper obj2 = func(objSrc, null);

            string json = obj2.Value;
            var objSrc2 = JsonConvert.DeserializeObject<Other>(json);
            Assert.Equal(objSrc.Value2, objSrc2.Value2);            
        }
예제 #37
0
파일: PivotPage1.xaml.cs 프로젝트: DISD/2UG
        private void OnSearchBoxShow(object sender, EventArgs e)
        {
            TransportSearchBox t_SearchBox = sender as TransportSearchBox;
            if (t_SearchBox.DialogResult == true)
            {
                int pivotActiveItem = transportPivot.SelectedIndex;
                int searchCretria = t_SearchBox.SearchCretria;
                string searchText = t_SearchBox.SearchText;

                if (!searchText.Equals(""))
                {

                    if (pivotActiveItem == 0)
                    {

                        var specialHireData = retrieveSpecialHireData(searchText, searchCretria);
                        if (specialHireData.Any() == false)
                        {
                            SpecialHire spHire = new SpecialHire();
                            spHire.Name = "No special Hire found!";

                            specialHireData = new[] { spHire };
                        }

                        specialHireList.ItemsSource = specialHireData;
                        transportPivot.SelectedItem = specialHirePivot;
                    }
                    else if (pivotActiveItem == 1)
                    {
                        var tourNTravelData = retrieveTourTravelData(searchText, searchCretria);
                        if (tourNTravelData.Any() == false)
                        {
                            TourTravel tTravel = new TourTravel();
                            tTravel.Name = "No travel n travel found!";

                            tourNTravelData = new[] { tTravel };
                        }


                        tourTravelList.ItemsSource = tourNTravelData;
                        transportPivot.SelectedItem = tourNTravelPivot;

                    }
                    else if (pivotActiveItem == 2)
                    {
                        var otherData = retrieveOtherData(searchText, searchCretria);
                        if (otherData.Any() == false)
                        {
                            Other other = new Other();
                            other.Name = "No record found!";

                            otherData = new[] { other };
                        }

                        otherList.ItemsSource = otherData;
                        transportPivot.SelectedItem = otherPivot;
                    }
                }

                enableApplicationBarButton();

            }
            else
            {
                enableApplicationBarButton();
            }
        }
예제 #38
0
				public IVoiLut GetLut(Other applicator)
				{
					return _lutGetter(applicator);
				}