示例#1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Title,Description,codeSnippet,Language")] code code)
        {
            if (id != code.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(code);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!codeExists(code.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(code));
        }
示例#2
0
        public void update_statelist_code()  ///UPDATE STATE CODE IN DATABASE
        {
            code temp = (from x in objentities.codes select x).FirstOrDefault();

            temp.state_id = temp.state_id + 1;
            objentities.SaveChanges();
        }
示例#3
0
        public void update_item_unit_code()   ///UPDATE ITEM UNIT CODE IN DATABASE
        {
            code temp = (from x in objentities.codes select x).FirstOrDefault();

            temp.unit_id = temp.unit_id + 1;
            objentities.SaveChanges();
        }
示例#4
0
        public string read_item_unit_code()  ///READ ITEM UNIT CODE FROM DATABASE
        {
            code   temp          = (from x in objentities.codes select x).FirstOrDefault();
            string item_uni_code = "IUC" + temp.unit_id;

            return(item_uni_code);
        }
示例#5
0
        public string read_state_code()    ///READ STATE CODE FROM DATABASE
        {
            code   temp       = (from x in objentities.codes select x).FirstOrDefault();
            string state_code = "SC-" + temp.state_id;

            return(state_code);
        }
示例#6
0
        public void update_item_company_code()  ///UPDATE ITEM COMPANY CODE IN DATABASE
        {
            code temp = (from x in objentities.codes select x).FirstOrDefault();

            temp.company_id = temp.company_id + 1;
            objentities.SaveChanges();
        }
示例#7
0
        public string read_item_group_code()  ///READ ITEM GROUP CODE FROM DATABASE
        {
            code   temp          = (from x in objentities.codes select x).FirstOrDefault();
            string item_gro_code = "IGC-" + temp.group_id;

            return(item_gro_code);
        }
示例#8
0
        public string read_barcode()      ////READ BARCODE FRORM DATABASE
        {
            code   temp   = (from x in objentities.codes select x).FirstOrDefault();
            string result = temp.barcode.ToString();

            return(result);
        }
示例#9
0
        ebmsEntities objentities = new ebmsEntities(); /// object of entities
        public string read_item_company_code()         /// READ ITEM COMPANY CODE FROM DATABASE
        {
            code   temp          = (from x in objentities.codes select x).FirstOrDefault();
            string item_com_code = "ICC-" + temp.company_id;

            return(item_com_code);
        }
示例#10
0
        public string read_article_no()   ///READ ARTICLE NUMBER FROM DATABASE
        {
            code   temp   = (from x in objentities.codes select x).FirstOrDefault();
            string result = temp.article_no.ToString();

            return(result);
        }
示例#11
0
 public void setResults(code t)
 {
     result.keyWords                    = t.keywordsLL1(t);
     result.operations                  = t.operatorsLL1(t);
     result.datatypes                   = t.datatypesLL1(t);
     result.values                      = t.ValuesLL1(t);
     result.vars                        = t.VarsLL1(t);
     result.pointrs                     = t.pointersLL1(t);
     result.arrays                      = t.ArraysLL1(t);
     result.libraries                   = libraries;
     result.specialChars                = t.specialCharList(t);
     result.codeFunctionCalls           = t.codeFuncCalls(t);
     result.frequentlyUsedFunctionCalls = t.freqUsedFuncCalls(t);
     result.commentLetters              = commentLetters;
     result.commentLines                = commentLines;
     result.setOpAll();
     result.setAllCodeFuncCalls();
     //result.setAllVars();
     result.setKWAll();
     result.setDTAll();
     result.setValuesAll();
     result.setAllfreqUsedFuncCalls();
     result.setSpecialCahrAll();
     result.tokens    = t.scopeTokens(t);
     result.allTokens = new List <token>(holeCodeTokens);
     result.ERROR     = t.error;
     result.errormsg  = t.errormsg;
     code.zeroStatics();
 }
        /// <summary>
        /// 触发器添加动作
        /// </summary>
        /// <param name="whichTrigger"></param>
        /// <param name="actionFunc"></param>
        /// <returns></returns>
        public static triggeraction TriggerAddAction(trigger whichTrigger, code actionFunc)
        {
            triggeraction addAction = new triggeraction()
            {
                action = (Action)actionFunc
            };

            whichTrigger.actions.Add(addAction);
            return(addAction);
        }
示例#13
0
        public async Task <IActionResult> Create([Bind("Id,Title,Description,codeSnippet,Language")] code code)
        {
            if (ModelState.IsValid)
            {
                code.Id = Guid.NewGuid();
                _context.Add(code);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(code));
        }
示例#14
0
        public bool save(string context, UserBean u)
        {
            filehelper f    = new filehelper();
            code       c    = new code(u.Password, DateTime.Now.ToString("yyyyMMdd"));
            string     name = f.writefile(c.encodefile(context), u);

            Console.WriteLine(name);
            if (f.filesize(name) != 0)
            {
                return(true);
            }
            return(false);
        }
示例#15
0
 public JsonResult CancelarTurno(int id_turno)
 {
     try
     {
         code code = db.codes.Where(x => x.id_turn == id_turno).ToList <code>()[0];
         db.codes.Remove(code);
         db.SaveChanges();
         turn turn = db.turns.Where(x => x.id == id_turno).ToList <turn>()[0];
         turn.last = false;
         db.SaveChanges();
         return(Json(true));
     }catch (Exception e)
     {
         return(Json(false + "  " + e));
     }
 }
示例#16
0
        public JsonResult saveTurn(int id_frecuency, string id_client)
        {
            try
            {
                var frecuencias = db.frequencies.Where(x => x.id == id_frecuency).ToList <frequency>();

                if (checkTurn(id_client, (TimeSpan)frecuencias[0].hour))
                {
                    turn turn = new turn()
                    {
                        code = GetRandomAlphaNumeric(50), date = DateTime.Today, hour = frecuencias[0].hour, last = true, id_place = frecuencias[0].id_place, id_bus = frecuencias[0].id_bus, id_client = id_client
                    };

                    db.turns.Add(turn);
                    db.SaveChanges();

                    code code = new code()
                    {
                        id_turn = turn.id, turncode = turn.code, assisted = false
                    };
                    db.codes.Add(code);
                    db.SaveChanges();
                    QrTurn qr = new QrTurn()
                    {
                        code = turn.code, saved = true
                    };
                    return(Json(qr));
                }
                else
                {
                    QrTurn qr = new QrTurn()
                    {
                        code = "", saved = false
                    };
                    return(Json(false));
                }
            }
            catch (Exception e)
            {
                return(Json(false + "" + e));
            }
        }
示例#17
0
 /// <summary>
 ///  向数据库插入生成激活码
 /// </summary>
 private void InsertCode()
 {
     try
     {
         var num = Convert.ToInt32(this.txt_activation_count.Text);
         for (int i = 0; i < num; i++)
         {
             var entity = new code {
                 state = 0, user_key = Guid.NewGuid().ToString()
             };
             entity.Save();
         }
         DisplayGlobal.log.Write("激活码生成完毕");
         MessageBox.Show("激活码生成完毕");
     }
     catch (Exception ex)
     {
         DisplayGlobal.log.Write(ex.Message);
     }
 }
示例#18
0
        public cppFile(string codestr, string filename)
        {
            codestr   = RemoveCommentsAndSpaces(codestr); //delete comments
            codestr   = codestr.Replace("ü", "u");        //yazi= yazi.Replace("eski değer","yeni değer") anlamına gelir.Yani yazi değişkenindeki eski değer ile yeni değiştirip tekrardan yazi değişkenime yeni değerimi atıyorum
            codestr   = codestr.Replace("ı", "i");
            codestr   = codestr.Replace("ö", "o");
            codestr   = codestr.Replace("ü", "u");
            codestr   = codestr.Replace("ş", "s");
            codestr   = codestr.Replace("ğ", "g");
            codestr   = codestr.Replace("ç", "c");
            codestr   = codestr.Replace("Ü", "U");
            codestr   = codestr.Replace("İ", "I");
            codestr   = codestr.Replace("Ö", "O");
            codestr   = codestr.Replace("Ü", "U");
            codestr   = codestr.Replace("Ş", "S");
            codestr   = codestr.Replace("Ğ", "G");
            codestr   = codestr.Replace("Ç", "C");
            this.cStr = codestr;                    //add hole code to cStr string
            this.name = filename;                   //filename or class or struct name
            Analyzer temp = new Analyzer();         // anlyzer class is the class that analyze code to tokens and lexemes

            holeCodeTokens = temp.Result2(codestr); //analyze code to tokens and lexemes to this list
            try
            {
                findLibrariesAndDefines();

                code = new code(codestr, filename, ++code.idno, holeCodeTokens, this, "GS");
            }
            catch (Exception e)
            { result.ERROR = true; result.errormsg = e.ToString(); System.Windows.Forms.MessageBox.Show(e.ToString()); }
            try
            {
                code.recognizeIdentifiers(code);
            }
            catch (Exception e)
            { result.ERROR = true; result.errormsg = e.ToString(); System.Windows.Forms.MessageBox.Show(e.ToString()); }
            code.countAllScopes(code);
            setResults(code);
            result.filename = code.filename;
            token.zeroIdCounter();
        }
示例#19
0
        internal bool TrySetCode(object item)
        {
            bool result = false;
            code code   = item as code;

            if (code != null)
            {
                result = true;
                StringBuilder txt = new StringBuilder();
                code.Text.Each(s =>
                {
                    txt.Append(s);
                });

                CodeInfo info = new CodeInfo();
                info.Code     = txt.ToString();
                info.Language = code.language;
            }

            return(result);
        }
示例#20
0
 VerifyDiagnostic(code, Atmosphere.Default, Expected);
示例#21
0
		// ushort* lens -> ushort[] lens + int lens_ind
		// code** table -> code[] table + ref int table_ind
		private static int inflate_table(codetype type, ushort[] lens, int lens_ind, uint codes, code[] table, ref int table_ind, ref uint bits, ushort[] work)
		{
			uint len;				// a code's length in bits
			uint sym;				// index of code symbols
			uint min, max;			// minimum and maximum code lengths
			uint root;				// number of index bits for root table
			uint curr;				// number of index bits for current table
			uint drop;				// code bits to drop for sub-table
			int left;				// number of prefix codes available
			uint used;				// code entries in table used
			uint huff;				// Huffman code
			uint incr;				// for incrementing code, index
			uint fill;				// index for replicating entries
			uint low;				// low bits for current root entry
			uint mask;				// mask for low root bits
			code here;				// table entry for duplication
			int next;				// next available space in table
			ushort[] _base;			// base value table to use
			int base_ind;			// index in _base
			ushort[] extra;			// extra bits table to use
			int extra_ind;			// index in extra
			int end;				// use base and extra for symbol > end
			ushort[] count=new ushort[MAXBITS+1];	// number of codes of each length
			ushort[] offs=new ushort[MAXBITS+1];	// offsets in table for each length

			// Process a set of code lengths to create a canonical Huffman code.  The
			// code lengths are lens[0..codes-1].  Each length corresponds to the
			// symbols 0..codes-1.  The Huffman code is generated by first sorting the
			// symbols by length from short to long, and retaining the symbol order
			// for codes with equal lengths.  Then the code starts with all zero bits
			// for the first code of the shortest length, and the codes are integer
			// increments for the same length, and zeros are appended as the length
			// increases.  For the deflate format, these bits are stored backwards
			// from their more natural integer increment ordering, and so when the
			// decoding tables are built in the large loop below, the integer codes
			// are incremented backwards.

			// This routine assumes, but does not check, that all of the entries in
			// lens[] are in the range 0..MAXBITS.  The caller must assure this.
			// 1..MAXBITS is interpreted as that code length.  zero means that that
			// symbol does not occur in this code.

			// The codes are sorted by computing a count of codes for each length,
			// creating from that a table of starting indices for each length in the
			// sorted table, and then entering the symbols in order in the sorted
			// table.  The sorted table is work[], with that space being provided by
			// the caller.

			// The length counts are used for other purposes as well, i.e. finding
			// the minimum and maximum length codes, determining if there are any
			// codes at all, checking for a valid set of lengths, and looking ahead
			// at length counts to determine sub-table sizes when building the
			// decoding tables.

			// accumulate lengths for codes (assumes lens[] all in 0..MAXBITS)
			for(len=0; len<=MAXBITS; len++) count[len]=0;
			for(sym=0; sym<codes; sym++) count[lens[lens_ind+sym]]++;

			// bound code lengths, force root to be within code lengths
			root=bits;
			for(max=MAXBITS; max>=1; max--) if(count[max]!=0) break;
			if(root>max) root=max;

			if(max==0)
			{								// no symbols to code at all
				here=new code(64, 1, 0);	// invalid code marker
				table[table_ind++]=here.Clone();	// make a table to force an error
				table[table_ind++]=here.Clone();
				bits=1;
				return 0;					// no symbols, but wait for decoding to report error
			}

			for(min=1; min<max; min++) if(count[min]!=0) break;
			if(root<min) root=min;

			// check for an over-subscribed or incomplete set of lengths
			left=1;
			for(len=1; len<=MAXBITS; len++)
			{
				left<<=1;
				left-=count[len];
				if(left<0) return -1; // over-subscribed
			}
			if(left>0&&(type==codetype.CODES||max!=1)) return -1; // incomplete set

			// generate offsets into symbol table for each length for sorting
			offs[1]=0;
			for(len=1; len<MAXBITS; len++) offs[len+1]=(ushort)(offs[len]+count[len]);

			// sort symbols by length, by symbol order within each length
			for(sym=0; sym<codes; sym++)
				if(lens[lens_ind+sym]!=0) work[offs[lens[lens_ind+sym]]++]=(ushort)sym;

			// Create and fill in decoding tables. In this loop, the table being
			// filled is at next and has curr index bits. The code being used is huff
			// with length len. That code is converted to an index by dropping drop
			// bits off of the bottom. For codes where len is less than drop + curr,
			// those top drop + curr - len bits are incremented through all values to
			// fill the table with replicated entries.

			// root is the number of index bits for the root table. When len exceeds
			// root, sub-tables are created pointed to by the root entry with an index
			// of the low root bits of huff. This is saved in low to check for when a
			// new sub-table should be started. drop is zero when the root table is
			// being filled, and drop is root when sub-tables are being filled.

			// When a new sub-table is needed, it is necessary to look ahead in the
			// code lengths to determine what size sub-table is needed.  The length
			// counts are used for this, and so count[] is decremented as codes are
			// entered in the tables.

			// used keeps track of how many table entries have been allocated from the
			// provided *table space.  It is checked for LENS and DIST tables against
			// the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
			// the initial root table size constants. See the comments in inftrees.h
			// for more information.

			// sym increments through all symbols, and the loop terminates when
			// all codes of length max, i.e. all codes, have been processed. This
			// routine permits incomplete codes, so another loop after this one fills
			// in the rest of the decoding tables with invalid code markers.

			// set up for code type
			switch(type)
			{
				case codetype.CODES:
					base_ind=extra_ind=0;
					_base=extra=work;	// dummy value--not used
					end=19;
					break;
				case codetype.LENS:
					_base=lbase;
					base_ind=-257;
					extra=lext;
					extra_ind=-257;
					end=256;
					break;
				default:				// DISTS
					base_ind=extra_ind=0;
					_base=dbase;
					extra=dext;
					end=-1;
					break;
			}

			// initialize state for loop
			huff=0;				// starting code
			sym=0;				// starting code symbol
			len=min;			// starting code length
			next=table_ind;		// current table to fill in
			curr=root;			// current table index bits
			drop=0;				// current bits to drop from code for index
			low=uint.MaxValue;	// trigger new sub-table when len > root
			used=1U<<(int)root;	// use root table entries
			mask=used-1;		// mask for comparing low

			// check available table space
			if((type==codetype.LENS&&used>=ENOUGH_LENS)||(type==codetype.DISTS&&used>=ENOUGH_DISTS)) return 1;

			// process all codes and make table entries
			for(; ; )
			{
				// create table entry
				here=new code(0, (byte)(len-drop), 0);
				if((int)(work[sym])<end)
				{
					here.op=0;
					here.val=work[sym];
				}
				else if((int)(work[sym])>end)
				{
					here.op=(byte)(extra[extra_ind+work[sym]]);
					here.val=_base[base_ind+work[sym]];
				}
				else
				{
					here.op=32+64;		// end of block
					here.val=0;
				}

				// replicate for those indices with low len bits equal to huff
				incr=1U<<(int)(len-drop);
				fill=1U<<(int)curr;
				min=fill;				// save offset to next table
				do
				{
					fill-=incr;
					table[next+(huff>>(int)drop)+fill]=here.Clone();
				} while(fill!=0);

				// backwards increment the len-bit code huff
				incr=1U<<(int)(len-1);
				while((huff&incr)!=0) incr>>=1;

				if(incr!=0)
				{
					huff&=incr-1;
					huff+=incr;
				}
				else huff=0;

				// go to next symbol, update count, len
				sym++;
				if(--(count[len])==0)
				{
					if(len==max) break;
					len=lens[lens_ind+work[sym]];
				}

				// create new sub-table if needed
				if(len>root&&(huff&mask)!=low)
				{
					// if first time, transition to sub-tables
					if(drop==0) drop=root;

					// increment past last table
					next+=(int)min;			// here min is 1 << curr

					// determine length of next table
					curr=len-drop;
					left=1<<(int)curr;
					while(curr+drop<max)
					{
						left-=count[curr+drop];
						if(left<=0) break;
						curr++;
						left<<=1;
					}

					// check for enough space
					used+=1U<<(int)curr;
					if((type==codetype.LENS&&used>=ENOUGH_LENS)||(type==codetype.DISTS&&used>=ENOUGH_DISTS)) return 1;

					// point entry in root table to sub-table
					low=huff&mask;
					table[table_ind+low]=new code((byte)curr, (byte)root, (ushort)(next-table_ind));
				}
			}

			// Fill in rest of table for incomplete codes.  This loop is similar to the
			// loop above in incrementing huff for table indices.  It is assumed that
			// len is equal to curr + drop, so there is no loop needed to increment
			// through high index bits.  When the current sub-table is filled, the loop
			// drops back to the root table to fill in any remaining entries there.

			here=new code(64, (byte)(len-drop), 0); // invalid code marker
			while(huff!=0)
			{
				// when done with sub-table, drop back to root table
				if(drop!=0&&(huff&mask)!=low)
				{
					drop=0;
					len=root;
					next=table_ind;
					here.bits=(byte)len;
				}

				// put invalid code marker in table
				table[next+huff>>(int)drop]=here.Clone();

				// backwards increment the len-bit code huff
				incr=1U<<(int)(len-1);
				while((huff&incr)!=0) incr>>=1;
				if(incr!=0)
				{
					huff&=incr-1;
					huff+=incr;
				}
				else huff=0;
			}

			// set return parameters
			table_ind+=(int)used;
			bits=root;
			return 0;
		}
示例#22
0
 get => getString(ref code, Constants.Unspecified);
示例#23
0
 IsNotNull(code, nameof(code)),
示例#24
0
 VerifyDiagnostic(
     code,
     Atmosphere.Default
示例#25
0
 public cbc(ref ptr <aesCipherAsm> b = default, code c = default, array <byte> iv = default)
 {
     this.b  = b;
     this.c  = c;
     this.iv = iv;
 }
示例#26
0
 VerifyDiagnostic(
     code,
     Atmosphere.Default.WithExcludeIds(ignoreIds),
 => (new Stock(code, market, code), new Quota(code, market, code)
 {
     CurrentPrice = (this.random.NextDouble() * 5) + 15
 });
 => (new Stock(code, market, code), new Quota(code, market, code)
示例#29
0
 // cryptBlocks invokes the cipher message (KM) instruction with
 // the given function code. This is equivalent to AES in ECB
 // mode. The length must be a multiple of BlockSize (16).
 //go:noescape
 private static void cryptBlocks(code c, ptr <byte> key, ptr <byte> dst, ptr <byte> src, long length)
 ;
示例#30
0
 VerifyDiagnosticAndFix(code, Atmosphere.Default, Expected, fix);
 I also added this code in DbContext file(` ProviderQualityContext `)