Example #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( !abc.VerifyMultinameIndex( _Index ) )
     {
         throw new AbcVerifierException( "Invalid multiname index" );
     }
 }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( _ArgCount > 0xFFFF )
     {
         throw new AbcVerifierException( "Excessive array size: " + _ArgCount.ToString( "d" ) );
     }
 }
Example #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( _Index >= abc.Classes.Count )
     {
         throw new AbcVerifierException( "class index out of bounds: " + _Index.ToString("d") );
     }
 }
Example #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( ! abc.VerifyStringIndex( _Index ) )
     {
         throw new AbcVerifierException("String index out of bounds: " + _Index.ToString("d" ) );
     }
 }
Example #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( 0 == _SlotIndex )
     {
         throw new AbcVerifierException( "Slot index is 0" );
     }
 }
Example #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( _Index >= abc.ConstantPool.Integers.Count )
     {
         throw new AbcVerifierException( "Int index out of bounds: " + _Index.ToString( "d" ) );
     }
 }
Example #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( !abc.VerifyStringIndex( _Index ) )
     {
         throw new AbcVerifierException( "Invalid string index" );
     }
 }
Example #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( 0 == _SlotIndex )
     {
         throw new AbcVerifierException( "Slot index is 0" );
     }
     // how do we find the upper slot limit of the global scope?
 }
Example #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     // implicitly checks index
     if ( _ArgCount != abc.Methods[ ( int )_Index ].ParamType.Count )
     {
         throw new AbcVerifierException( "Number of arguments do not correspond to called method" );
     }
 }
Example #10
0
        public void ABCCreationTest()
        {
            ABC abc = new ABC(2, "cons", true, "air", "breath", 10, "circ", 15);

            Assert.AreEqual(abc.getConsciousness(), "cons");
            Assert.AreEqual(abc.getDisoriented(), true);
            Assert.AreEqual(abc.getAirways(), "air");
            Assert.AreEqual(abc.getBreathing(), "breath");
            Assert.AreEqual(abc.getBreathingFrequency(), 10);
            Assert.AreEqual(abc.getCirculation(), "circ");
            Assert.AreEqual(abc.getCirculationFrequency(), 15);
        }
Example #11
0
        public void DefaultABCCreationTest()
        {
            ABC abc = new ABC();

            Assert.AreEqual(abc.getConsciousness(), "notSet");
            Assert.AreEqual(abc.getDisoriented(), false);
            Assert.AreEqual(abc.getAirways(), "notSet");
            Assert.AreEqual(abc.getBreathing(), "notSet");
            Assert.AreEqual(abc.getBreathingFrequency(), -1);
            Assert.AreEqual(abc.getCirculation(), "notSet");
            Assert.AreEqual(abc.getCirculationFrequency(), -1);
        }
Example #12
0
    public bool MutateIs(ABC is_)
    {
        int o = __p.__offset(4); if (o != 0)

        {
            __p.bb.PutInt(o + __p.bb_pos, (int)is_); return(true);
        }
        else
        {
            return(false);
        }
    }
Example #13
0
        /// <summary>
        /// 连接网络设备
        /// </summary>
        public void LinkDevicesClient()
        {
            try
            {
                // 清空设备
                DataControl._mSocket.Close();
                // 获取设备设定档资讯
                String    sql = "select * from wcs_config_device where FLAG <> 'N' order by CREATION_TIME";
                DataTable dt  = DataControl._mMySql.SelectAll(sql);
                if (DataControl._mStools.IsNoData(dt))
                {
                    return;
                }
                List <WCS_CONFIG_DEVICE> devList = dt.ToDataList <WCS_CONFIG_DEVICE>();
                // 遍历加入网络设备
                foreach (WCS_CONFIG_DEVICE dev in devList)
                {
                    byte[] refreshB = null;
                    switch (dev.TYPE)
                    {
                    case DeviceType.固定辊台:
                        refreshB = FRT._GetData();
                        break;

                    case DeviceType.摆渡车:
                        refreshB = ARF._GetData();
                        break;

                    case DeviceType.行车:
                        refreshB = ABC._GetData();
                        break;

                    case DeviceType.运输车:
                        refreshB = RGV._GetData();
                        break;

                    default:
                        continue;
                    }
                    if (!DataControl._mSocket.AddClient(dev.DEVICE, dev.IP, dev.PORT, refreshB, out string result))
                    {
                        throw new Exception(result);
                    }
                }
            }
            catch (Exception ex)
            {
                // 记录LOG
                RecordTaskErrLog("LinkDevicesClient()", "连接网络设备", null, null, ex.ToString());
                MessageBox.Show("连接网络设备发生异常:" + ex.ToString(), "Error");
                System.Environment.Exit(0);
            }
        }
Example #14
0
    //main method
    public static void Main(string[] args)
    {
        //p is a type of pointer which will be used to call anonyms method
        //and here we are defining a method anonyms method delegate which body is defined below and it is taking string parameter
        ABC p = delegate(string mypet)
        {
            Console.WriteLine("My Favorite pet is {0}", mypet);
        };

        //anonyms method is called
        p("dog");
    }
Example #15
0
        private static ABC[] AOS作成()
        {
            Console.WriteLine("AOS作成開始");
            var AOS = new ABC[レコード数];

            for (var i = 0; i < AOS.Length; i++)
            {
                AOS[i].B = (Byte)i;
            }
            Console.WriteLine("AOS作成終了");
            return(AOS);
        }
Example #16
0
        public void GenerateABC()
        {
            string[] letters = ABC.Split('/');
            GenerateNumbers();
            StreamWriter sw = new StreamWriter("ABC.txt");

            foreach (var letter in letters)
            {
                sw.WriteLine(letter);
            }
            sw.Close();
        }
Example #17
0
		public static ABC GetCharWidthABC(char ch, Font font, System.Drawing.Graphics gr)
		{
			ABC[] _temp = new ABC[1];
			IntPtr hDC = gr.GetHdc();
			Font ft = (Font)font.Clone();
			IntPtr hFt = ft.ToHfont();
			SelectObject(hDC, hFt);
			GetCharABCWidthsW(hDC, ch, ch, _temp);
			DeleteObject(hFt);
			gr.ReleaseHdc();

			return _temp[0];
		}
Example #18
0
        public static ABC GetCharWidthABC(char ch, Font font, System.Drawing.Graphics gr)
        {
            ABC[] _temp = new ABC[1];
            IntPtr hDC = gr.GetHdc();
            Font ft = (Font)font.Clone();
            IntPtr hFt = ft.ToHfont();
            SelectObject(hDC, hFt);
            GetCharABCWidthsW(hDC, ch, ch, _temp);
            DeleteObject(hFt);
            gr.ReleaseHdc();

            return _temp[0];
        }
        public static void Main(String[] args)
        {
            // Accessing value in another assembly
            Potomak obj3 = new Potomak();

            // Member value is Accessible
            obj3.value = 9;
            Console.WriteLine("Value = " + obj3.value);

            ABC obj4 = new ABC();

            obj4.ProveriPristup();
        }
Example #20
0
 public void Commit()
 {
     Snap.Commit();
     Blocks.Commit();
     Heights.Commit();
     Transfers.Commit();
     Accounts.Commit();
     Contracts.Commit();
     Storages.Commit();
     BlockChains.Commit();
     StoragesMap.Commit();
     ABC.Commit();
     List.Commit();
 }
Example #21
0
    void Awake()
    {
        if (instanceABC == null)
        {
            instanceABC = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
Example #22
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     if ( !abc.VerifyMultinameIndex( _Index ) )
     {
         throw new AbcVerifierException( "Invalid multiname index" );
     }
     if (
         ( abc.ConstantPool.Multinames[ ( int )_Index ].Type == ABC.MultinameType.RTQName ) ||
         ( abc.ConstantPool.Multinames[ ( int )_Index ].Type == ABC.MultinameType.RTQNameL )
         )
     {
         throw new AbcVerifierException( "Multiname is runtime name, not allowed" );
     }
 }
Example #23
0
        static void Main(string[] args)
        {
            // AULA 3.01 - CONVERSORES IMPLÍCITOS E EXPLÍCITOS
            // implicit
            //Dolar d = 100.40;
            //double valor = d;

            // explicit
            //Dolar d = (Dolar)100.40;
            //double valor = (double)d;

            // AULA 3.02 - SOBRECARGA DE OPERADOR
            DateTime agora      = DateTime.Now;
            DateTime nascimento = new DateTime(1988, 4, 19);
            TimeSpan ts         = agora - nascimento;

            DolarSobrecarga ds1 = 100.40;
            DolarSobrecarga ds2 = 150.50;
            DolarSobrecarga ds3 = ds1 + ds2;
            DolarSobrecarga ds4 = ds3 - 100;

            // AULA 3.03 - DLL's e NameSpaces - vide novo namespace ao final deste namespace CursoCSharpContinueGoldAula3
            ABC abc = new ABC();

            abc.Nome = "Teste";

            // quando há uma chamada ambígua, ou seja, com dois namesspaces iguais devemos fazer o seguinte, para chamar o desejado
            // supondo que tivessemos:
            // using System.Windows.Forms,
            // using System.Threading,
            // em ambos temos o objeto Timer.
            // para acessar a instância desejada no código, fazemos:
            // System.Windows.Forms.Timer t = new System.Windows.Forms.Timer()
            // System.Threading.Timer t = new System.Threading.Timer()
            // ou ainda
            // using thr = System.Threading
            // thr.Timer tmr = new thr.Timer()

            // para acessarmos uma dll de outro projeto, da mesma solução
            // entre na references do projetos, onde deseja chamar uma classe de outro projeto,
            // clique com o botão direito, Add Reference, solution, escolha o namespace desejado, ok.
            // pesquisar ConfigurationManager msdn

            // AULA 3.04 - Interoperabilidade
            // este código seria para um windows forms
            // colocar esta chamada, dentro do código de um button
            FormInterop.MessageBoxTimeout(IntPtr.Zero, "a", "b", 1, 0, 4000);
        }
Example #24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="abc"></param>
        public override void Verify( ABC.AbcFile abc )
        {
            if ( !abc.VerifyStringIndex( _Index ) )
            {
                throw new AbcVerifierException( "Invalid string index" );
            }

            try
            {
                UriBuilder urib = new UriBuilder( abc.ConstantPool.Strings[ ( int )_Index ] );
            }
            catch ( UriFormatException urie )
            {
                throw new AbcVerifierException( "dxns URI format error: " + abc.ConstantPool.Strings[ ( int )_Index ], urie );
            }
        }
Example #25
0
		public static ABC GetCharWidthABC(char ch, Font font, System.Drawing.Graphics gr)
		{
			ABC[] _temp = new ABC[1];
			var nativFont = CreateFont (font.Name, font.Size, font.Style, font.GdiCharSet, font.GdiVerticalFont);
			var atts = buildAttributedString(ch.ToString(), nativFont);
			// for now just a line not sure if this is going to work
			CTLine line = new CTLine(atts);

			float ascent;
			float descent;
			float leading;
			_temp[0].abcB = (uint)line.GetTypographicBounds(out ascent, out descent, out leading);


			return _temp[0];
		}
Example #26
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show(String.Format("Are you sure you want to remove {0}", lkItems.Text), "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ABC abc     = new ABC();
                int storeID = Convert.ToInt32(lkStores.EditValue);
                int itemID  = Convert.ToInt32(lkItems.EditValue);
                abc.LoadQuery(string.Format("delete from Disposal where ItemID = {0} and StoreID = {1}", itemID, storeID));
                abc.LoadQuery(string.Format("delete from YearEnd where ItemID = {0} and StoreID = {1}", itemID, storeID));
                abc.LoadQuery(string.Format("delete from IssueDoc where ItemID = {0} and StoreID = {1}", itemID, storeID));
                abc.LoadQuery(string.Format("delete from ReceiveDoc where ItemID = {0} and StoreID = {1}", itemID, storeID));

                XtraMessageBox.Show("The Item Has been removed!");
                lkStores_EditValueChanged(null, null);
            }
        }
Example #27
0
        private void OnRank(object sender, System.EventArgs e)
        {
            m_Undo = (Bitmap)m_Bitmap.Clone();
            BitmapFilter.GrayToBlack(m_Bitmap, BRIGHT);
            Bitmap[]   arr = FontMethods.ImageToTextR1(m_Bitmap);
            Bitmap[][] br  = new Bitmap[arr.Length][];
            Bitmap[]   cr  = new Bitmap[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                br[i] = FontMethods.ImageToTextR2(arr[i]);
                cr[i] = FontMethods.JoinBitmap(br[i]);
            }
            m_Bitmap               = FontMethods.JoinBitmapH(cr);
            this.AutoScroll        = true;
            this.AutoScrollMinSize = new Size((int)(m_Bitmap.Width * Zoom), (int)(m_Bitmap.Height * Zoom));
            this.Invalidate();

            Bitmap[][] brcop   = new Bitmap[arr.Length][];
            List <ABC> listABC = new List <ABC>();

            for (int i = 0; i < arr.Length; i++)
            {
                Bitmap[] bbcop = new Bitmap[br[i].Length];
                for (int j = 0; j < br[i].Length; j++)
                {
                    bbcop[j] = (Bitmap)br[i][j].Clone();
                    bbcop[j] = FontMethods.BoundCore(bbcop[j]);
                    int[] fra = FontMethods.Fragment(bbcop[j]);

                    //FontMethods.ImageToBackBone(br[i][j]);
                    br[i][j] = FontMethods.BoundCore(br[i][j]);
                    double[]   d      = FontMethods.AverageSquare(br[i][j]);
                    double[][] ad     = FontMethods.Margin(br[i][j]);
                    ABC        strABC = new ABC();
                    strABC.AverageSquare    = d;
                    strABC.ProportionSquare = strABC.AverageSquare[1] == 0 ? 0 : strABC.AverageSquare[0] / strABC.AverageSquare[1];
                    strABC.Margin           = ad;
                    strABC.Fragment         = fra;
                    listABC.Add(strABC);
                }
            }
            string mes = String.Join("\n", listABC);

            Clipboard.SetText(mes);
            MessageBox.Show(mes);
        }
        public static ABC GetCharWidthABC(char ch, Font font, System.Drawing.Graphics gr)
        {
            ABC[] _temp     = new ABC[1];
            var   nativFont = CreateFont(font.Name, font.Size, font.Style, font.GdiCharSet, font.GdiVerticalFont);
            var   atts      = buildAttributedString(ch.ToString(), nativFont);
            // for now just a line not sure if this is going to work
            CTLine line = new CTLine(atts);

            float ascent;
            float descent;
            float leading;

            _temp[0].abcB = (uint)line.GetTypographicBounds(out ascent, out descent, out leading);


            return(_temp[0]);
        }
Example #29
0
        /// <summary>
        /// 放货
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UnloadBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (CBdev.SelectedIndex == -1)
                {
                    Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info);
                    return;
                }
                if (string.IsNullOrEmpty(xlocation.Text.Trim()) || string.IsNullOrEmpty(ylocation.Text.Trim()) || string.IsNullOrEmpty(zlocation.Text.Trim()))
                {
                    Notice.Show("请填写目的坐标!", "提示", 3, MessageBoxIcon.Info);
                    return;
                }
                string dev = CBdev.Text;

                ABC abc = new ABC(dev);
                if (abc.ActionStatus() == ABC.Run)
                {
                    Notice.Show("指令发送失败:设备运行中!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }
                if (abc.DeviceStatus() == ABC.DeviceError)
                {
                    Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }

                int    x     = Convert.ToInt32(xlocation.Text.Trim());
                int    y     = Convert.ToInt32(ylocation.Text.Trim());
                int    z     = Convert.ToInt32(zlocation.Text.Trim());
                byte[] order = ABC._TaskControl(ABC.TaskRelease, abc.ABCNum(), DataControl._mStools.IntToBytes(x), DataControl._mStools.IntToBytes(y), DataControl._mStools.IntToBytes(z));
                if (!DataControl._mSocket.SendToClient(dev, order, out string result))
                {
                    Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error);
                    return;
                }
                Notice.Show("放货任务 指令发送成功!", "成功", 3, MessageBoxIcon.Success);
                DataControl._mSocket.SwithRefresh(dev, false);
            }
            catch (Exception ex)
            {
                Notice.Show("指令发送失败:" + ex.ToString(), "错误", 3, MessageBoxIcon.Error);
            }
        }
Example #30
0
        private int GetGlyphs(IntPtr hdc, Run run, ushort[] glyphs, int[] widths, int maxGlyphs, bool rtl)
        {
            // initialize structures
            SCRIPT_ANALYSIS psa = run.analysis;

            ushort[] pwLogClust = new ushort[maxGlyphs];
            int      pcGlyphs   = 0;

            SCRIPT_VISATTR[] psva     = new SCRIPT_VISATTR[maxGlyphs];
            GOFFSET[]        pGoffset = new GOFFSET[maxGlyphs];
            ABC pABC = new ABC();

            // make glyphs
            ScriptShape(hdc, ref FUSCache, run.text, run.text.Length, glyphs.Length, ref psa, glyphs, pwLogClust, psva, ref pcGlyphs);
            // make widths
            ScriptPlace(hdc, ref FUSCache, glyphs, pcGlyphs, psva, ref psa, widths, pGoffset, ref pABC);
            return(pcGlyphs);
        }
Example #31
0
 private void CreateSections(int sections)
 {
     if (sections < 2 || sections > 26)
     {
         return;
     }
     dataGridView1.Columns.Clear();
     for (int i = 0; i < sections - 1; i++)
     {
         ABC abc1 = (ABC)i;
         ABC abc2 = (ABC)i + 1;
         var abc  = Convert.ToString(abc1) + "+" + Convert.ToString(abc2);
         dataGridView1.Columns.Add(Convert.ToString(abc), Convert.ToString(abc));
     }
     this.dataGridView1.RowCount                 = 2;
     this.dataGridView1.RowHeadersWidth          = 70;
     this.dataGridView1.Rows[0].HeaderCell.Value = "Wert";
     this.dataGridView1.Rows[1].HeaderCell.Value = "Menge";
 }
Example #32
0
        public void getterSetterTest()
        {
            ABC abc = new ABC();

            abc.setConsciousness("set");
            Assert.AreEqual(abc.getConsciousness(), "set");
            abc.setDisoriented(true);
            Assert.AreEqual(abc.getDisoriented(), true);
            abc.setAirways("set");
            Assert.AreEqual(abc.getAirways(), "set");
            abc.setBreathing("set");
            Assert.AreEqual(abc.getBreathing(), "set");
            abc.setBreathingFrequency(5);
            Assert.AreEqual(abc.getBreathingFrequency(), 5);
            abc.setCirculation("set");
            Assert.AreEqual(abc.getCirculation(), "set");
            abc.setCirculationFrequency(55);
            Assert.AreEqual(abc.getCirculationFrequency(), 55);
        }
Example #33
0
        public async Task <ActionResult <BaseResponse> > Get(int id)
        {
            ABC abc = await _context.ABCs.AsNoTracking().FirstOrDefaultAsync(x => x.Id == id);

            if (abc == null)
            {
                return(NotFound());
            }
            else
            {
                //string domainUrl = Request.Scheme + "://" + Request.Host.ToString();
                //string path = domainUrl + "/Data/" + abc.Avatar;
                abc.Avatar = Utils.Helper.GetBaseUrl(Request) + "/Data/" + abc.Avatar;
                return(new BaseResponse
                {
                    data = abc
                });
            }
        }
Example #34
0
 public bool ContainsInterface(string qualifiedName)
 {
     if (Super.Name != "Object")
     {
         ASInstance superInstance = ABC.GetFirstInstance(Super.Name);
         if (superInstance.ContainsInterface(qualifiedName))
         {
             return(true);
         }
     }
     foreach (ASMultiname @interface in GetInterfaces())
     {
         if (@interface.Name != qualifiedName)
         {
             continue;
         }
         return(true);
     }
     return(false);
 }
Example #35
0
        public void AddMethod(ASMethod method, string qualifiedName)
        {
            var qname = new ASMultiname(ABC.Pool);

            qname.NameIndex      = ABC.Pool.AddConstant(qualifiedName);
            qname.Kind           = MultinameKind.QName;
            qname.NamespaceIndex = 1; // Public

            int methodIndex = ABC.AddMethod(method);
            int qnameIndex  = ABC.Pool.AddConstant(qname);

            var trait = new ASTrait(ABC);

            trait.Kind        = TraitKind.Method;
            trait.QNameIndex  = qnameIndex;
            trait.MethodIndex = methodIndex;

            method.Trait     = trait;
            method.Container = this;
            Traits.Add(trait);
        }
Example #36
0
        /// <summary>
        /// 终止
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TerminateBtn_Click(object sender, RoutedEventArgs e)
        {
            string dev = "";

            byte[] order = null;
            try
            {
                if (CBdev.SelectedIndex == -1)
                {
                    Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info);
                    return;
                }
                dev = CBdev.Text;
                ABC abc = new ABC(dev);
                if (abc.DeviceStatus() == ABC.DeviceError)
                {
                    Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error);
                    return;
                }

                order = ABC._StopTask(abc.ABCNum());

                if (!DataControl._mSocket.SendToClient(dev, order, out string result))
                {
                    Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error);
                    // LOG
                    DataControl._mTaskTools.RecordTaskErrLog("TerminateBtn_Click()", "行车-终止任务[ABC,指令]", dev, DataControl._mStools.BytetToString(order), result.ToString());
                    return;
                }
                Notice.Show("终止任务 指令发送成功!", "成功", 3, MessageBoxIcon.Success);
                DataControl._mSocket.SwithRefresh(dev, true);
            }
            catch (Exception ex)
            {
                Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error);
                // LOG
                DataControl._mTaskTools.RecordTaskErrLog("TerminateBtn_Click()", "行车-终止任务[ABC,指令]", dev, DataControl._mStools.BytetToString(order), ex.Message);
            }
        }
Example #37
0
        private void OnDictionary(object sender, System.EventArgs e)
        {
            string[]   arrdic  = new String[] { "田", "字", "奉", "膂", "雪", "こ", "や", "至", "一", "雪", "雪", "だ", "や", "ほ", "’", "ん", "と", "や" };
            Bitmap[]   br      = new Bitmap[arrdic.Length];
            Bitmap[]   brcop   = new Bitmap[arrdic.Length];
            List <ABC> listABC = new List <ABC>();

            for (int i = 0; i < arrdic.Length; i++)
            {
                br[i] = (Bitmap)FontMethods.Render(arrdic[i]);
                BitmapFilter.GrayToBlack(br[i], BRIGHT);
                brcop[i] = (Bitmap)br[i].Clone();
                brcop[i] = FontMethods.BoundCore(brcop[i]);
                int[] fra = FontMethods.Fragment(brcop[i]);

                //FontMethods.ImageToBackBone(br[i]);
                br[i] = FontMethods.BoundCore(br[i]);
                double[]   d      = FontMethods.AverageSquare(br[i]);
                double[][] ad     = FontMethods.Margin(br[i]);
                ABC        strABC = new ABC();
                strABC.KEY              = arrdic[i];
                strABC.AverageSquare    = d;
                strABC.ProportionSquare = strABC.AverageSquare[1] == 0 ? 0 : strABC.AverageSquare[0] / strABC.AverageSquare[1];
                strABC.Margin           = ad;
                strABC.Fragment         = fra;
                listABC.Add(strABC);
            }

            m_Bitmap               = FontMethods.JoinBitmap(brcop);
            this.AutoScroll        = true;
            this.AutoScrollMinSize = new Size((int)(m_Bitmap.Width * Zoom), (int)(m_Bitmap.Height * Zoom));
            this.Invalidate();

            string mes = String.Join("\n", listABC);

            Clipboard.SetText(mes);
            MessageBox.Show(mes);
        }
Example #38
0
 private void InitializeData()
 {
     foreach (GroupedData data in Acces.groupedData.OrderBy(a => a.Group))
     {
         Output outputData = new Output();
         outputData.ID           = data.Data.ID;
         outputData.Bezeichnung  = data.Data.Bezeichnung;
         outputData.Menge        = data.Data.Menge;
         outputData.MengeProzent = MengeProzent(data.Data.Menge);
         outputData.Wert         = WertGesamMt(data.Data.Wert, data.Data.Menge);
         outputData.WertProzent  = WertProzent(data.Data.Wert, data.Data.Menge);
         ABC abc = (ABC)data.Group;
         outputData.Kategorie = abc;
         Acces.OutputData.Add(outputData);
     }
     for (int i = 0; i < Acces.Setting.Seperations; i++)
     {
         var menge = KumulativMenge(i);
         var wert  = KumulativWert(i);
         Acces.OutputData.Last(f => f.Kategorie == (ABC)i).AnteilMenge = menge;
         Acces.OutputData.Last(f => f.Kategorie == (ABC)i).AnteilWert  = wert;
     }
 }
Example #39
0
        public static BayesianNetworkClassifier CreateABCClassifier(int seed, int iterations, int colonySize, int convergence, Dataset trainingSet, DataMining.ClassificationMeasures.IClassificationQualityMeasure measure, bool performLocalSearch, bool fireEvents)
        {
            DataMining.Utilities.RandomUtility.Initialize(seed);

            VariableTypeAssigmentInvalidator       invalidator             = new VariableTypeAssigmentInvalidator();
            BayesianClassificationQualityEvaluator evaluator               = new BayesianClassificationQualityEvaluator(measure);
            VariableTypeAssignmentLocalSearch      localSearch             = new VariableTypeAssignmentLocalSearch(evaluator);
            DefaultHeuristicCalculator <VariableTypeAssignment> calculator = new DefaultHeuristicCalculator <VariableTypeAssignment>();
            Problem <VariableTypeAssignment> problem = new Problem <VariableTypeAssignment>(invalidator, calculator, evaluator, localSearch);

            ABC abc = new ABC(iterations, colonySize, convergence, problem, trainingSet, performLocalSearch);


            if (fireEvents)
            {
                abc.OnPostAntSolutionContruction += new EventHandler(abclassifier_OnPostAntSolutionContruction);
                abc.OnPostColonyIteration        += new EventHandler(abclassifier_OnPostColonyIteration);
            }


            BayesianNetworks.Model.BayesianNetworkClassifier bnclassifier = abc.CreateClassifier() as BayesianNetworkClassifier;
            return(bnclassifier);
        }
Example #40
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="abc"></param>
 public override void Verify( ABC.AbcFile abc )
 {
     uint etype = abc.MethodBodies[ _MethodID ].Exceptions[ ( int )_Index ]._ExceptionType;
     etype++;
 }
Example #41
0
        public static ABC[] GetCharABCWidths(Font font, char[] chars)
        {
            int count = chars.GetLength(0);
            if (count <= 0)
            {
                throw new ArgumentException("chars count invalid");
            }

            ABC[] abc = new ABC[count];

            using (FontDC dc = new FontDC(font))
            {
                int idx = 0;
                foreach (char ch in chars)
                {
                    ABC _abc;
                    if (!GetCharABCWidths(dc.handle, ch, ch, out _abc))
                    {
                        throw new Exception("GetCharABCWidths failed");
                    }
                    abc[idx++] = _abc;
                }
            }
            return abc;
        }
Example #42
0
 public static void GetCharABCWidths(Font font, char ch, out ABC abc)
 {
     char[] chars = new char[1];
     chars[0] = ch;
     ABC[] _abc = GetCharABCWidths(font, chars);
     abc = _abc[0];
 }
            // This article provides a real-world tutorial of how to actually use the API, including
            // a discussion of many gotchas not identified in the MSDN documentation.
            // http://www.catch22.net/tuts/uniscribe-mysteries
            // http://www.catch22.net/tuts/more-uniscribe-mysteries
            // http://www.catch22.net/tuts/drawing-styled-text-uniscribe
            // From the developer of Google Chrome's uniscribe client:
            // https://maxradi.us/documents/uniscribe/
            // Arabic embedded (RTL) example:
            // http://blogs.msdn.com/b/vsarabic/archive/2011/08/21/text-rendering.aspx
            // Devanagari example:
            // http://www.omniglot.com/language/articles/devanagari.htm
            // UTF16 non-zero plane exahere:
            // https://en.wikipedia.org/wiki/UTF-16#Examples
            // http://www.i18nguy.com/unicode-example-plane1.html
            // "Displaying Text with Uniscribe"
            // https://msdn.microsoft.com/en-us/library/windows/desktop/dd317792%28v=vs.85%29.aspx
            internal static TextItems AnalyzeText(
                TextServiceUniscribe service,
                IntPtr hdc,
                IntPtr hText,
                FontRunInfo[] fontRuns)
            {
                TextItems o = new TextItems(service);
                try
                {

                    o.fontRuns = fontRuns;
                    for (int i = 0; i < fontRuns.Length; i++)
                    {
                        o.count += fontRuns[i].count;
                        o.lineHeight = Math.Max(o.lineHeight, fontRuns[i].fontHeight);
                    }
                    if (o.count == 0)
                    {
                        return o;
                    }

                    int hr;

                    // Lay Out Text Using Uniscribe

                    // 1. Call ScriptRecordDigitSubstitution only when starting or when receiving a WM_SETTINGCHANGE message.

                    // 2. (Optional) Call ScriptIsComplex to determine if the paragraph requires complex processing.
                    hr = ScriptIsComplex(
                        hText,
                        o.count,
                        ScriptIsComplexFlags.SIC_ASCIIDIGIT | ScriptIsComplexFlags.SIC_COMPLEX);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }
                    // Optional: if S_FALSE (1) is returned, one can fall back to TextRenderer and simplified hit testing

                    // 3. (Optional) If using Uniscribe to handle bidirectional text and/or digit substitution, call
                    // ScriptApplyDigitSubstitution to prepare the SCRIPT_CONTROL and SCRIPT_STATE structures as inputs
                    // to ScriptItemize. If skipping this step, but still requiring digit substitution, substitute
                    // national digits for Unicode U+0030 through U+0039 (European digits). For information about digit
                    // substitution, see Digit Shapes.
                    hr = ScriptApplyDigitSubstitution(
                        IntPtr.Zero,
                        out o.sControl,
                        out o.sState);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }

                    // 4. Call ScriptItemize to divide the paragraph into items. If not using Uniscribe for digit
                    // substitution and the bidirectional order is known, for example, because of the keyboard layout
                    // used to enter the character, call ScriptItemize. In the call, provide null pointers for the
                    // SCRIPT_CONTROL and SCRIPT_STATE structures. This technique generates items by use of the shaping
                    // engine only, and the items can be reordered using the engine information.
                    // Note: Typically, applications that work only with left-to-right scripts and without any digit
                    // substitution should pass null pointers for the SCRIPT_CONTROL and SCRIPT_STATE structures.

                    {
                        int cMaxItems = 8;
                        SCRIPT_ITEM[] sItems;
                        OPENTYPE_TAG[] sTags;
                        while (true)
                        {
                            sItems = new SCRIPT_ITEM[cMaxItems + 1]; // method adds terminator;
                            sTags = new OPENTYPE_TAG[cMaxItems];
                            hr = ScriptItemizeOpenType(
                                hText,
                                o.count,
                                cMaxItems,
                                ref o.sControl,
                                ref o.sState,
                                sItems,
                                sTags,
                                out o.cItems);
                            if (hr == E_OUTOFMEMORY)
                            {
                                cMaxItems *= 2;
                                continue;
                            }
                            if (hr < 0)
                            {
                                Marshal.ThrowExceptionForHR(hr);
                            }
                            break;
                        }

                        o.sItems = sItems;
                        o.sTags = sTags;
                    }

                    // 5. Merge the item information with the run information to produce ranges.
                    {
                        int fontRunOffset = 0;
                        int f = 0;
                        int i = 0;
                        while ((f < o.fontRuns.Length) && (i < o.cItems))
                        {
                            if (fontRunOffset + o.fontRuns[f].count > o.sItems[i + 1].iCharPos)
                            {
                                // run is longer - current item remains intact; advance to next
                                i++;
                                continue;
                            }
                            else if (fontRunOffset + o.fontRuns[f].count < o.sItems[i + 1].iCharPos)
                            {
                                // item too long - split

                                Array.Resize(ref o.sItems, o.cItems + 1 + 1);
                                Array.Copy(o.sItems, i, o.sItems, i + 1, o.sItems.Length - (i + 1));
                                Array.Resize(ref o.sTags, o.cItems + 1);
                                Array.Copy(o.sTags, i, o.sTags, i + 1, o.sTags.Length - (i + 1));
                                o.cItems++;

                                o.sItems[i + 1].iCharPos = fontRunOffset + o.fontRuns[f].count;
                            }
                            Debug.Assert(fontRunOffset + o.fontRuns[f].count == o.sItems[i + 1].iCharPos);
                            fontRunOffset += o.fontRuns[f].count;
                            f++;
                            i++;
                        }
                        Debug.Assert(fontRunOffset == o.count);
                        Debug.Assert(o.sItems[o.cItems].iCharPos == o.count);
                    }

                    // 6. Call ScriptShape to identify clusters and generate glyphs.
                    o.sItemsExtra = new ItemInfo[o.cItems];
                    o.logAttrs = new SCRIPT_LOGATTR[o.count];
                    for (int i = 0; i < o.cItems; i++)
                    {
                        int start = o.sItems[i].iCharPos;
                        int length = o.sItems[i + 1].iCharPos - start;

                        Font font = null;
                        for (int f = 0, pos = 0; f < o.fontRuns.Length; pos += o.fontRuns[f].count, f++)
                        {
                            font = o.fontRuns[f].font;
                            if (pos < start + length)
                            {
                                break;
                            }
                        }

                        int cMaxGlyphs = (3 * o.count / 2) + 16; // recommended starting value
                        short[] glyphs;
                        short[] logicalClusters;
                        SCRIPT_VISATTR[] visAttrs; // superceded by glyphProps
                        SCRIPT_GLYPHPROP[] glyphProps;
                        int cGlyphs;
                        int fallbackLevel = 0;
                        Font fallbackFont = null;
                        SCRIPT_CHARPROP[] charProps = new SCRIPT_CHARPROP[length];
                        while (true)
                        {
                            glyphs = new short[cMaxGlyphs];
                            logicalClusters = new short[cMaxGlyphs];
                            visAttrs = new SCRIPT_VISATTR[cMaxGlyphs];
                            glyphProps = new SCRIPT_GLYPHPROP[cMaxGlyphs];

                            bool needFallback = false;
                            int fontCacheIndex = service.FontCacheIndex(font);

                            GDIFont gdiFont;
                            if (!service.fontToHFont.TryGetValue(font, out gdiFont))
                            {
                                gdiFont = new GDIFont(font);
                                service.fontToHFont.Add(font, gdiFont);
                            }
                            GDI.SelectObject(hdc, gdiFont);

                #if false // choose old or OpenType API
                        hr = ScriptShape(
                            hdc,
                            ref service.caches[fontCacheIndex].cache,
                            new IntPtr(hText.ToInt64() + start * 2),
                            length,
                            cMaxGlyphs,
                            ref o.sItems[i].a,
                            glyphs,
                            logicalClusters,
                            visAttrs,
                            out cGlyphs);
                #else
                            hr = ScriptShapeOpenType(
                                hdc,
                                ref service.caches[fontCacheIndex].cache,
                                ref o.sItems[i].a,
                                o.sTags[i], // tagScript
                                o.sTags[i], // tagLangSys -- right thing to pass here?
                                null, // rcRangeChars
                                null, // rpRangeProperties
                                0, // cRanges
                                new IntPtr(hText.ToInt64() + start * 2),
                                length,
                                cMaxGlyphs,
                                logicalClusters,
                                charProps,
                                glyphs,
                                glyphProps, // supercedes visAttrs
                                out cGlyphs);
                #endif
                            if (hr == E_OUTOFMEMORY)
                            {
                                cMaxGlyphs *= 2;
                                glyphs = new short[cMaxGlyphs];
                                logicalClusters = new short[cMaxGlyphs];
                                visAttrs = new SCRIPT_VISATTR[cMaxGlyphs];
                                continue;
                            }
                            if (hr == USP_E_SCRIPT_NOT_IN_FONT)
                            {
                                needFallback = true;
                                goto FontFallback;
                            }
                            if (hr < 0)
                            {
                                Marshal.ThrowExceptionForHR(hr);
                            }
                            // 7. If ScriptShape returns the code USP_E_SCRIPT_NOT_IN_FONT or S_OK with the output containing
                            // missing glyphs, select characters from a different font. Either substitute another font or disable
                            // shaping by setting the eScript member of the SCRIPT_ANALYSIS structure passed to ScriptShape to
                            // SCRIPT_UNDEFINED. For more information, see Using Font Fallback.
                            SCRIPT_FONTPROPERTIES sfp;
                            ScriptGetFontProperties(
                                hdc,
                                ref service.caches[fontCacheIndex].cache,
                                out sfp);
                            for (int j = 0; j < cGlyphs; j++)
                            {
                                if (glyphs[j] == sfp.wgDefault)
                                {
                                    needFallback = true;
                                    break;
                                }
                            }
                        FontFallback:
                            if (needFallback)
                            {
                                // What worked:
                                // https://code.google.com/p/chromium/codesearch#chromium/src/ui/gfx/font_fallback_win.cc&q=uniscribe&sq=package:chromium&l=283&dr=CSs
                                // http://stackoverflow.com/questions/16828868/how-to-automatically-choose-most-suitable-font-for-different-language
                                // What didn't work:
                                // The totally unhelpful Uniscribe font/script fallback documentation:
                                // https://msdn.microsoft.com/en-us/library/windows/desktop/dd374105%28v=vs.85%29.aspx
                                // MSDN Globalization how-to page about font fallback:
                                // https://msdn.microsoft.com/en-us/goglobal/bb688134.aspx
                                // ScriptShape page:
                                // https://msdn.microsoft.com/en-us/library/windows/desktop/dd368564(v=vs.85).aspx

                                fallbackLevel++;
                                switch (fallbackLevel)
                                {
                                    case 1:
                                        GDI.LOGFONT fallbackLF;
                                        if (GetUniscribeFallbackFont(
                                            font,
                                            new IntPtr(hText.ToInt64() + 2 * start),
                                            length,
                                            out fallbackLF))
                                        {
                                            fallbackFont = null;
                                            foreach (KeyValuePair<GDI.LOGFONT, Font> item in service.fallbackFonts)
                                            {
                                                if (String.Equals(item.Key.lfFaceName, fallbackLF.lfFaceName)
                                                    && (item.Key.lfCharSet == fallbackLF.lfCharSet)
                                                    && (item.Key.lfHeight == fallbackLF.lfHeight))
                                                {
                                                    fallbackFont = item.Value;
                                                    break;
                                                }
                                            }
                                            if (fallbackFont == null)
                                            {
                                                fallbackFont = Font.FromLogFont(fallbackLF);
                                                service.fallbackFonts.Add(new KeyValuePair<GDI.LOGFONT, Font>(fallbackLF, fallbackFont));
                                            }
                                            font = fallbackFont;
                                            continue;
                                        }
                                        continue;

                                    case 2:
                                        if (o.sItems[i].a.eScript != SCRIPT_UNDEFINED)
                                        {
                                            o.sItems[i].a.eScript = SCRIPT_UNDEFINED;
                                        }
                                        continue;

                                    default:
                                        // give up
                                        break;
                                }
                            }

                            break;
                        }

                        // 8. Call ScriptPlace to generate advance widths and x and y positions for the glyphs in each
                        // successive range. This is the first step for which text size becomes a consideration.
                        int[] iAdvances = new int[cGlyphs];
                        GOFFSET[] goffsets = new GOFFSET[cGlyphs];
                        ABC abc = new ABC();
                        {
                            int fontCacheIndex = service.FontCacheIndex(font);
                #if false // choose old or OpenType API
                        hr = ScriptPlace(
                            hdc,
                            ref service.caches[fontCacheIndex].cache,
                            glyphs,
                            cGlyphs,
                            visAttrs,
                            ref o.sItems[i].a,
                            iAdvances,
                            goffsets,
                            out abc);
                #else
                            hr = ScriptPlaceOpenType(
                                hdc,
                                ref service.caches[fontCacheIndex].cache,
                                ref o.sItems[i].a,
                                o.sTags[i], // tagScript
                                o.sTags[i], // tagLangSys -- right thing to pass here?
                                null, // rcRangeChars
                                null, // rpRangeProperties
                                0, // cRanges
                                new IntPtr(hText.ToInt64() + start * 2),
                                logicalClusters,
                                charProps,
                                length,
                                glyphs,
                                glyphProps,
                                cGlyphs,
                                iAdvances,
                                goffsets,
                                out abc);
                #endif
                            if (hr < 0)
                            {
                                Marshal.ThrowExceptionForHR(hr);
                            }
                        }

                        o.sItemsExtra[i].glyphs = glyphs;
                        o.sItemsExtra[i].logicalClusters = logicalClusters;
                        o.sItemsExtra[i].visAttrs = visAttrs;
                        o.sItemsExtra[i].cGlyphs = cGlyphs;
                        o.sItemsExtra[i].charProps = charProps;
                        o.sItemsExtra[i].glyphProps = glyphProps;

                        o.sItemsExtra[i].iAdvances = iAdvances;
                        o.sItemsExtra[i].goffsets = goffsets;
                        o.sItemsExtra[i].abc = abc;

                        o.sItemsExtra[i].fallbackFont = fallbackFont;

                        // 9. Sum the range sizes until the line overflows.

                        // 10. Break the range on a word boundary by using the fSoftBreak and fWhiteSpace members in the
                        // logical attributes. To break a single character cluster off the run, use the information returned
                        // by calling ScriptBreak.
                        // Note: Decide if the first code point of a range should be a word break point because the last
                        // character of the previous range requires it. For example, if one range ends in a comma, consider
                        // the first character of the next range to be a word break point.
                        SCRIPT_LOGATTR[] logAttrs1 = new SCRIPT_LOGATTR[o.count];
                        hr = ScriptBreak(
                            new IntPtr(hText.ToInt64() + 2 * start),
                            length,
                            ref o.sItems[i].a,
                            logAttrs1);
                        if (hr < 0)
                        {
                            Marshal.ThrowExceptionForHR(hr);
                        }
                        Array.Copy(logAttrs1, 0, o.logAttrs, o.sItems[i].iCharPos, length);

                        // 11. Repeat steps 6 through 10 for each line in the paragraph. However, if breaking the last run
                        // on the line, call ScriptShape to reshape the remaining part of the run as the first run on the
                        // next line.
                    }

                    // Display Text Using Uniscribe

                    // 1. For each run, do the following:
                    // a. If the style has changed since the last run, update the handle to the device context by releasing
                    //    and getting it again.
                    // b. Call ScriptShape to generate glyphs for the run.
                    // c. Call ScriptPlace to generate an advance width and an x,y offset for each glyph.

                    // 2. Do the following to establish the correct visual order for the runs in the line:
                    // a. Extract an array of bidirectional embedding levels, one per range. The embedding level is
                    //    given by (SCRIPT_ITEM) si.(SCRIPT_ANALYSIS) a. (SCRIPT_STATE) s.uBidiLevel.
                    // b. Pass this array to ScriptLayout to generate a map of visual positions to logical positions.
                    byte[] bidiEmbeddingLevels = new byte[o.cItems];
                    for (int i = 0; i < o.cItems; i++)
                    {
                        bidiEmbeddingLevels[i] = (byte)o.sItems[i].a.s.uBidiLevel;
                    }
                    o.iVisualToLogical = new int[o.cItems];
                    o.iLogicalToVisual = new int[o.cItems];
                    hr = ScriptLayout(
                        o.cItems,
                        bidiEmbeddingLevels,
                        o.iVisualToLogical,
                        o.iLogicalToVisual);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }

                    for (int i = 0; i < o.cItems; i++)
                    {
                        for (int j = 0; j < o.sItemsExtra[i].iAdvances.Length; j++)
                        {
                            o.sItemsExtra[i].totalWidth += o.sItemsExtra[i].iAdvances[j];
                        }
                    }
                }
                catch (Exception)
                {
                    o.Dispose();
                    throw;
                }

                return o;
            }
Example #44
0
    void Start()
    {
        //Human Shuibian = new Human("陳水扁", 58);
        // Human ChiaWei = new Human("林家緯", 25);
        Human Shuibian = new Human("亞洲人", 160, "陳水扁", 58);
        Human ChiaWei  = new Human("亞洲人", 180, "林家緯", 25);
        //ChiaWei.SayMySelf();

        Human Kobe = new Human("北美洲人", 198, "摳逼不萊恩特", 39);


        Human JKRowLing = new Human("JK羅琳");

        Human.PassHeight = 200;



        Kobe.SayMySelf();
        JKRowLing.SayMySelf();

        Debug.Log(ChiaWei.Talk(Shuibian));
        Debug.Log(Shuibian.Talk(ChiaWei));
        Debug.Log(Kobe.Talk(ChiaWei));
        Debug.Log(JKRowLing.Talk(Kobe));


        Debug.Log(Human.SayPassHeight());

        Debug.Log(ChiaWei.name + "的身高是否及格:" + ChiaWei.PassforMyHeight());

        Human.PassHeight = 170;
        Debug.Log(Human.SayPassHeight());
        Debug.Log(ChiaWei.name + "的身高是否及格:" + ChiaWei.PassforMyHeight());

        ABC.ABCC();                       //靜態Class
        Debug.Log(Human.SayThisMethod()); //這個Class裡面的靜態method

        User MyUser = new User("林家緯", "1233334");

        Debug.Log(MyUser.GetUserName());
        Debug.Log(MyUser.GetPassword());

        Debug.Log(MyUser.Username);
        MyUser.Username = "******";//向Set存入
        Debug.Log(MyUser.Username);


        ///練習題目
        Player player = new Player();

        player.pickAGold();
        player.HungerRate += 10; // 餓了,飢餓度上升
        Debug.Log("飢餓度:" + player.HungerRate);

        player.pickASilver();
        player.HungerRate += 10; // 餓了,飢餓度上升
        Debug.Log("飢餓度:" + player.HungerRate);
        player.pickASilver();
        player.HungerRate += 10; // 餓了,飢餓度上升


        Debug.Log("飢餓度:" + player.HungerRate + ",身上物品總值:" + player.TotalValue);

        player.pickACopper();
        player.HungerRate -= 60; // 吃了一個可以減少 60 飢餓度的東西
        Debug.Log("飢餓度:" + player.HungerRate);
        player.pickAGold();
        player.HungerRate -= 60; // 吃了一個可以減少 60 飢餓度的東西


        Debug.Log("飢餓度:" + player.HungerRate + ",身上物品總值:" + player.TotalValue);

        Moster ms = new Moster(75, "大頭怪", 100);

        Debug.Log(ms.HP);
        ms.HP -= 10;
        Debug.Log(ms.HP);
        ms.HP += 90;
        Debug.Log(ms.HP);
        ms.HP -= 56;
        Debug.Log(ms.HP);
        Debug.Log(ms.SayMyname());
        Debug.Log(ms.Walk());



        Bot bt = new Bot(95, "阿諾", 100);

        Debug.Log(bt.HP);
        // bt.InJured(ms.AttAck);
        ms.AttAck(bt);
        Debug.Log(bt.HP);

        ms.SetAttAck = 200;
        //bt.InJured(ms.AttAck);
        ms.AttAck(bt);
        Debug.Log(bt.HP);
        Debug.Log(bt.SayMyname());
        Debug.Log(bt.Walk());
    }
Example #45
0
 public Container(String name, ABC abc, DEF def)
 {
     Name = name;
     Abc  = abc;
     Def  = def;
 }
    public static void Main()
    {
        var abc = new ABC
        {
            LA = new List <A>
            {
                new A
                {
                    LB = new List <B>
                    {
                        new B
                        {
                            LC = new List <C>
                            {
                                new C {
                                    x = 1, y = 2, z = 3
                                },
                                new C {
                                    x = 1, y = 2, z = 3
                                }
                            }
                        },
                        new B
                        {
                            LC = new List <C>
                            {
                                new C {
                                    x = 1, y = 2, z = 3
                                },
                                new C {
                                    x = 1, y = 2, z = 3
                                }
                            }
                        }
                    }
                },
                new A
                {
                    LB = new List <B>
                    {
                        new B
                        {
                            LC = new List <C>
                            {
                                new C {
                                    x = 1, y = 2, z = 3
                                },
                                new C {
                                    x = 1, y = 2, z = 3
                                }
                            }
                        },
                        new B
                        {
                            LC = new List <C>
                            {
                                new C {
                                    x = 1, y = 2, z = 3
                                },
                                new C {
                                    x = 1, y = 2, z = 3
                                }
                            }
                        }
                    }
                }
            }
        };

        Console.WriteLine(abc.LA.Sum(xabc => xabc.LB.Sum(xb => xb.LC.Count)));
    }
Example #47
0
 public static extern bool GetCharABCWidths(HDC hdc, uint chFirst, uint chLast, out ABC abc);
Example #48
0
        public GlyphDescriptorCollection CollectGlyphs(IAtlasDescriptor descriptor, Action<float> progress, CancellationTokenSource cts)
        {
            ValidateSettings(descriptor);
            GlyphDescriptorCollection glyphs = new GlyphDescriptorCollection();

            HashSet<char> chars = null;

            if (descriptor.UseFonts)
            {
                chars = new HashSet<char>();

                // build set of characters
                foreach (ICharSet charSet in descriptor.CharSets)
                {
                    foreach (char ch in charSet.Characters)
                    {
                        chars.Add(ch);
                    }
                }
            }

            int count = 0;
            count += (descriptor.UseImages) ? descriptor.Images.Count : 0;
            count += (chars != null) ? chars.Count : 0;
            int current = 0;

            if (descriptor.UseImages)
            {
                int ch = descriptor.StartCode;

                foreach (ImageInfo ii in descriptor.Images)
                {
                    int width = ii.Image.Width;
                    int height = ii.Image.Height;

                    Vec2i offset;
                    Image image = CropImage(ii.Image, out offset);

                    ABC abc = new ABC();
                    abc.abcA = -(int)ii.Offset.X;
                    abc.abcB = (uint)(width + ii.Offset.X);
                    abc.abcC = 0;

                    ii.SortCode = ii.HasCustomCode ? ii.Code : UniqueCode(ref ch, descriptor.Images);
                    var gi = new GlyphDescriptor((char)ii.SortCode, abc, image, descriptor.Spacing * 2);
                    gi.Offset = offset - (Vec2i)ii.Offset;
                    gi.ImageInfo = ii;
                    glyphs.Add(gi);

                    if (progress != null)
                    {
                        progress((float)(++current) / count);
                    }

                    if (cts != null)
                    {
                        cts.Token.ThrowIfCancellationRequested();
                    }
                }
            }

            if (descriptor.UseFonts)
            {
                // build image for each glyph
                var gm = new GLYPHMETRICS();
                foreach (char ch in chars)
                {
                    Image image = null;

                    try
                    {
                        if (ch == 159)
                        {
                        }

                        image = TextHelper.GetGlyphOutlineImage(descriptor.Font, ch, out gm);
                        if (image == null)
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        if (image != null)
                        {
                            image.Dispose();
                        }

                        // skip glyph
                        continue;
                    }

                    // flip Y offset
                    ABC abc = new ABC();
                    TextHelper.GetCharABCWidths(descriptor.Font, ch, out abc);

                    GlyphDescriptor glyph = new GlyphDescriptor(ch, abc, image, descriptor.Spacing * 2);
                    glyph.Offset = new Vec2i(gm.gmptGlyphOrigin.X, -gm.gmptGlyphOrigin.Y);
                    glyphs.Add(glyph);

                    if (progress != null)
                    {
                        progress((float)(++current) / count);
                    }

                    if (cts != null)
                    {
                        cts.Token.ThrowIfCancellationRequested();
                    }
                }

                if (descriptor.ForceSpace && glyphs.Find(32) == null)
                {
                    ABC abc = new ABC();
                    TextHelper.GetCharABCWidths(descriptor.Font, (char)32, out abc);
                    abc.abcB = (uint)(abc.abcA + abc.abcB + abc.abcC);
                    abc.abcC = 0;
                    glyphs.Add(new GlyphDescriptor((char)32, abc));
                }
            }

            return glyphs;
        }
Example #49
0
    public void Entrance()
    {
        ABC a = new ABC();

        a.eventX += new ABC.X(this.callback);
    }
Example #50
0
 private static extern bool GetCharABCWidths(IntPtr hdc, uint firstChar, uint lastChar, out ABC abc);