コード例 #1
0
        public List <Track> getNewReleases()
        {
            TokenClass _Token = new TokenClass();
            string     token  = _Token.getToken();

            string url           = "https://api.spotify.com/v1/recommendations?limit=40&market=US&seed_genres=rock%2C%20pop%2C%20indie";
            var    Authorization = _Token.currentToken;

            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

            webRequest.Method      = "GET";
            webRequest.ContentType = "application/x-www-form-urlencoded";
            webRequest.Accept      = "application/json";
            webRequest.Headers.Add("Authorization:" + _Token.currentToken);
            webRequest.ContentLength = 0;
            HttpWebResponse            resp           = (HttpWebResponse)webRequest.GetResponse();
            String                     json           = "";
            DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(RecommendationsClass));

            using (Stream respStr = resp.GetResponseStream())
            {
                using (StreamReader rdr = new StreamReader(respStr, Encoding.UTF8))
                {
                    json = rdr.ReadToEnd();
                    rdr.Close();
                }
            }

            var recommendations = JsonConvert.DeserializeObject <Recommendation>(json).tracks;

            return(recommendations);
        }
コード例 #2
0
ファイル: TokenStream.cs プロジェクト: parhelia512/nginz
        public Token Expect(TokenClass clazz)
        {
            Token ret = null;

            if (Accept(clazz, ref ret))
            {
                return(ret);
            }
            Token offender = ReadToken();

            if (offender != null)
            {
                errorLog.AddError(ErrorType.ParserError, offender.Location,
                                  "Unexpected '{0}' (Expected '{1}')",
                                  offender.ToString(),
                                  Token.ClassToString(clazz));
            }
            else
            {
                errorLog.AddError(ErrorType.ParserError, offender.Location,
                                  "Unexpected end of file (Expected {0})",
                                  Token.ClassToString(clazz));
                throw new Exception("");
            }
            return(new Token(clazz, "", Location));
        }
コード例 #3
0
        private Token IncludeSpaces()
        {
            StringBuilder sString = new StringBuilder();

            sString.Append(_CurrentChar);
            char c = (char)LA(1);

            while (c != 39)
            {
                sString.Append(c);
                Consume();
                c = (char)LA(1);
            }
            Consume();

            string sTemp = sString.ToString();

            if (_TokenName.ContainsKey(sTemp.ToLower()))
            {
                TokenID    id  = (TokenID)_TokenName[sTemp.ToLower()];
                TokenClass cls = (TokenClass)_TokenClass[id];
                return(new Token(cls, id, sTemp));
            }

            c = RemoveWhiteSpace();
            if (c == '(')
            {
                return(new Token(TokenClass.CONTROL, TokenID.FUNCTION, sTemp));
            }

            return(new Token(TokenClass.REFERENCE, TokenID.IDENTIFIER, sTemp));
        }
コード例 #4
0
        // GET: Auth
        public async Task <ActionResult> fb(string code, string useremail)
        {
            var base64EncodedBytes = System.Convert.FromBase64String(useremail);
            var realuseremail      = System.Text.Encoding.UTF8.GetString(base64EncodedBytes);

            using (var client = new HttpClient())
            {
                var redirecturl = "http://webapplication16742.azurewebsites.net/auth/fb/" + useremail;
                var s1          = await client.GetStringAsync("https://graph.facebook.com/v2.3/oauth/access_token?client_id=619387381484849&redirect_uri=" + redirecturl + "&client_secret=1f22ecd5cfa27759fbf126531994531c&code=" + code);

                TokenClass token = JsonConvert.DeserializeObject <TokenClass>(s1);

                var s2 = await client.GetStringAsync("https://graph.facebook.com/v2.3/me?access_token=" + token.access_token);

                var fbme = JsonConvert.DeserializeObject <FbMe>(s2);

                var ac = new WebApplication1.Models.AccountInfo.SubAccount();
                ac.provider  = "fb";
                ac.token     = token.access_token;
                ac.useremail = realuseremail;
                ac.userid    = fbme.id;
                ac.username  = fbme.name;

                if (!TokenController.addTokenInternal(ac))
                {
                    return(HttpNotFound());
                }
            }

            return(Redirect("/home/index?user=" + realuseremail));
        }
コード例 #5
0
        private Token Identifier()
        {
            StringBuilder sString = new StringBuilder();

            sString.Append(_CurrentChar);

            char c = (char)LA(1);

            while (char.IsLetterOrDigit(c) || c == '_')
            {
                sString.Append(c);
                Consume();
                c = (char)LA(1);
            }

            string sTemp = sString.ToString();

            //DebugTrace("Token =",sTemp);

            if (_TokenName.ContainsKey(sTemp.ToLower()))
            {
                TokenID    id  = (TokenID)_TokenName[sTemp.ToLower()];
                TokenClass cls = (TokenClass)_TokenClass[id];
                return(new Token(cls, id, sTemp));
            }

            c = RemoveWhiteSpace();
            if (c == '(')
            {
                return(new Token(TokenClass.CONTROL, TokenID.FUNCTION, sTemp));
            }

            return(new Token(TokenClass.REFERENCE, TokenID.IDENTIFIER, sTemp));
        }
コード例 #6
0
ファイル: RTF.cs プロジェクト: radtek/WasmWinforms
        public RTF(Stream stream)
        {
            source = new StreamReader(stream);

            text_buffer = new StringBuilder(1024);
            //pushed_text_buffer = new StringBuilder(1024);

            rtf_class    = TokenClass.None;
            pushed_class = TokenClass.None;
            pushed_char  = unchecked ((char)-1);

            line_num      = 0;
            line_pos      = 0;
            prev_char     = unchecked ((char)-1);
            bump_line     = false;
            font_list     = null;
            charset_stack = null;

            cur_charset = new Charset();

            destination_callbacks = new DestinationCallback();
            class_callbacks       = new ClassCallback();

            destination_callbacks [Minor.OptDest]   = new DestinationDelegate(HandleOptDest);
            destination_callbacks[Minor.FontTbl]    = new DestinationDelegate(ReadFontTbl);
            destination_callbacks[Minor.ColorTbl]   = new DestinationDelegate(ReadColorTbl);
            destination_callbacks[Minor.StyleSheet] = new DestinationDelegate(ReadStyleSheet);
            destination_callbacks[Minor.Info]       = new DestinationDelegate(ReadInfoGroup);
            destination_callbacks[Minor.Pict]       = new DestinationDelegate(ReadPictGroup);
            destination_callbacks[Minor.Object]     = new DestinationDelegate(ReadObjGroup);
        }
コード例 #7
0
        //Get token from google OAUTH to get the user details
        private TokenClass GetAccesToken(string code)
        {
            string clientid        = _config.GetSection("GoogleAuthentication").GetSection("ClinetID").Value;
            string clientsecret    = _config.GetSection("GoogleAuthentication").GetSection("ClientSecret").Value;
            string redirection_url = _config.GetSection("GoogleAuthentication").GetSection("Redirect_URL").Value;
            string url             = "https://accounts.google.com/o/oauth2/token";

            string poststring = "grant_type=authorization_code&code=" + code + "&client_id=" + clientid + "&client_secret=" +
                                clientsecret + "&redirect_uri=" + redirection_url + "";
            var request = (System.Net.HttpWebRequest)WebRequest.Create(url);

            request.ContentType = "application/x-www-form-urlencoded";
            request.Method      = "POST";
            UTF8Encoding utfenc = new UTF8Encoding();

            byte[] bytes        = utfenc.GetBytes(poststring);
            Stream outputstream = null;

            try
            {
                request.ContentLength = bytes.Length;
                outputstream          = request.GetRequestStream();
                outputstream.Write(bytes, 0, bytes.Length);
            }
            catch { }
            var        response           = (HttpWebResponse)request.GetResponse();
            var        streamReader       = new StreamReader(response.GetResponseStream());
            string     responseFromServer = streamReader.ReadToEnd();
            TokenClass obj = JsonConvert.DeserializeObject <TokenClass>(responseFromServer);

            return(obj);
        }
コード例 #8
0
        public Albums getNewReleases()
        {
            TokenClass _Token = new TokenClass();

            string token = _Token.getToken();

            string url           = "https://api.spotify.com/v1/browse/new-releases?limit=48";
            var    Authorization = _Token.currentToken;

            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

            webRequest.Method      = "GET";
            webRequest.ContentType = "application/x-www-form-urlencoded";
            webRequest.Accept      = "application/json";
            webRequest.Headers.Add("Authorization:" + _Token.currentToken);
            webRequest.ContentLength = 0;
            HttpWebResponse            resp           = (HttpWebResponse)webRequest.GetResponse();
            String                     json           = "";
            DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(SpotifyNewReleasesClass));

            using (Stream respStr = resp.GetResponseStream())
            {
                using (StreamReader rdr = new StreamReader(respStr, Encoding.UTF8))
                {
                    json = rdr.ReadToEnd();
                    rdr.Close();
                }
            }

            var album = JsonConvert.DeserializeObject <RootObject>(json).albums;

            return(album);
        }
コード例 #9
0
ファイル: Language.cs プロジェクト: anthrax3/xacc.ide
        protected void OverrideToken(Location loc, TokenClass newclass)
        {
            loc.callback = delegate(IToken tok)
            {
                //if (tok.Class != TokenClass.Keyword)
                {
                    tok.Class = newclass;
                    if (newclass == TokenClass.Type)
                    {
                        parsedtypes[tok.Text] = tok.Location;
                    }
                    else
                    {
                        if (parsedtypes.ContainsKey(tok.Text))
                        {
                            parsedtypes.Remove(tok.Text);
                        }
                    }
                }
            };

            locstack.Push(loc);

            //if (cb != null)
            //{
            //  cb.Invoke(loc);
            //}
        }
コード例 #10
0
        public bool Parse(SourceIterator iterator, out IToken token)
        {
            token = null;
            string           content = string.Empty;
            TokenSubTypeEnum subtype;

            if (Char.IsLetter(iterator.Current) || iterator.Current == '_')
            {
                CodeInformation information = iterator.CodeInformation.Clone();
                content = iterator.GetLettersAndDigits();

                if (!_table.TryGetValue(content, out subtype))
                {
                    subtype = TokenSubTypeEnum.NA;
                }

                token = new TokenClass()
                {
                    Content         = content,
                    CodeInformation = information,
                    Type            = TokenTypeEnum.IDENTIFIER,
                    SubType         = subtype
                };

                return(true);
            }
            return(false);
        }
コード例 #11
0
ファイル: Token.cs プロジェクト: johnmbaughman/ClassicBasic
 /// <summary>
 /// Initializes a new instance of the <see cref="Token"/> class.
 /// If the text parameter starts with a letter, marked as a variable otherwise it's a number.
 /// </summary>
 /// <param name="text">Value typed in by the user.</param>
 public Token(string text)
 {
     _text       = text;
     _tokenClass = char.IsLetter(text[0]) ?
                   TokenClass.Variable :
                   TokenClass.Number;
 }
コード例 #12
0
ファイル: Token.cs プロジェクト: SplittyDev/Iodine-Library
 /// <summary>
 /// Initializes a new instance of the <see cref="Iodine.Compiler.Token"/> class.
 /// </summary>
 /// <param name="clazz">Token class.</param>
 /// <param name="value">Value.</param>
 /// <param name="doc">Documentation string.</param>
 /// <param name="location">Location.</param>
 public Token(TokenClass clazz, string value, string doc, SourceLocation location)
 {
     Class         = clazz;
     Value         = value;
     Documentation = doc;
     Location      = location;
 }
コード例 #13
0
ファイル: Token.cs プロジェクト: SplittyDev/Iodine-Library
        /// <summary>
        /// Converts a TokenClass enum to its string representation
        /// </summary>
        /// <returns>The string representation of the TokenClass enum.</returns>
        /// <param name="clazz">Token class.</param>
        public static string ClassToString(TokenClass clazz)
        {
            switch (clazz)
            {
            case TokenClass.CloseBrace:
                return("}");

            case TokenClass.OpenBrace:
                return("{");

            case TokenClass.CloseParan:
                return(")");

            case TokenClass.OpenParan:
                return("(");

            case TokenClass.Comma:
                return(",");

            case TokenClass.OpenBracket:
                return("[");

            case TokenClass.CloseBracket:
                return("]");

            case TokenClass.SemiColon:
                return(";");

            case TokenClass.Colon:
                return(":");

            default:
                return(clazz.ToString());
            }
        }
コード例 #14
0
ファイル: Language.cs プロジェクト: anthrax3/xacc.ide
        /// <summary>
        /// Gets ColorInfo for a token type
        /// </summary>
        /// <param name="tokentype">the token type</param>
        /// <returns>the color info</returns>
        public static ColorInfo GetColorInfo(int tokentype)
        {
            TokenClass t = (TokenClass)tokentype;

            if ((t & TokenClass.Custom) != 0)
            {
                if (!typemapping.ContainsKey(t))
                {
                    int       v  = tokentype & ~(int)TokenClass.Custom;
                    ColorInfo ci = new ColorInfo(
                        Color.FromKnownColor((KnownColor)(v >> 16 & 0xff)),
                        Color.FromKnownColor((KnownColor)(v >> 8 & 0xff)),
                        Color.FromKnownColor((KnownColor)(v & 0xff)),
                        (FontStyle)(v >> 25 & 0xff));

                    typemapping.Add(t, ci);
                }
            }

            if (typemapping.ContainsKey(t))
            {
                return((ColorInfo)typemapping[t]);
            }
            else
            {
                return((ColorInfo)typemapping[TokenClass.Any]);
            }
        }
コード例 #15
0
        public string getSpotifyToken()
        {
            TokenClass _Token = new TokenClass();
            string     token  = _Token.getToken();

            return(token);
        }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:XenonCore.Lexeme"/> class.
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="unit">Unit.</param>
 /// <param name="value">Value.</param>
 /// <param name="literal">Literal.</param>
 public Lexeme(TokenClass type, SourceUnit unit, string value, object literal = null)
 {
     Type         = type;
     Value        = value;
     LiteralValue = literal ?? value;
     Location     = unit.Location;
 }
コード例 #17
0
    private IEnumerator getBonificacion()
    {
        //Token
        Dictionary <string, string> headers = new Dictionary <string, string> ();

        headers.Add("Content-Type", "application/json");
        headers.Add("Cookie", "Interceramic");
        headers.Add("Authorization", "Basic U09LT0xBQlM6U09LT0xBQlNQUjBEMTIzIw==");
        headers.Add("pClaveApp", "MIARQ");

        WWW www = new WWW("https://swsp.interceramic.com/ords/miarqws_sa/genera/token", null, headers);

        yield return(www);

        tokenProp = JsonUtility.FromJson <TokenClass> (www.text);

        //Bonificacion
        Dictionary <string, string> headersPrecio = new Dictionary <string, string> ();

        headersPrecio.Add("Content-Type", "application/json");
        headersPrecio.Add("pClaveApp", "MIARQ");
        headersPrecio.Add("Authorization", "Bearer " + tokenProp.Token);

        WWW wwwPrecio = new WWW("https://swsp.interceramic.com/ords/miarqws_sa/consulta/bonificacion", null, headersPrecio);

        yield return(wwwPrecio);

        print("bonificacionResp: " + wwwPrecio.text);
        bonificacion = JsonUtility.FromJson <PrecioResp> (wwwPrecio.text);
        cantidad     = bonificacion.MONTO.ToString();
    }
コード例 #18
0
        /// <summary>
        /// Парсер даты и строк.
        /// </summary>
        /// <param name="iterator"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public bool Parse(SourceIterator iterator, out IToken token)
        {
            token = null;
            string content = string.Empty;

            CodeInformation information = iterator.CodeInformation.Clone();

            if (ParseDate(iterator, out content))
            {
                token = new TokenClass()
                {
                    Content         = content,
                    CodeInformation = information,
                    Type            = TokenTypeEnum.LITERAL,
                    SubType         = TokenSubTypeEnum.L_DATE
                };
                return(true);
            }

            if (ParseString(iterator, out content))
            {
                token = new TokenClass()
                {
                    Content         = content,
                    CodeInformation = information,
                    Type            = TokenTypeEnum.LITERAL,
                    SubType         = TokenSubTypeEnum.L_STRING
                };
                return(true);
            }

            return(false);
        }
コード例 #19
0
        /// <summary>
        /// Accept the specified token and value.
        /// </summary>
        /// <param name="token">Token.</param>
        /// <param name="strval">Strval.</param>
        public bool Accept(TokenClass token, string strval)
        {
            var match = Match(token) && Match(strval);

            Skip(match ? 1 : 0);
            return(match);
        }
コード例 #20
0
    async Task <int> UserSelectedDamage(int damage, Spirit damagePicker, Present present, params TokenClass[] allowedTypes)
    {
        if (damage == 0)
        {
            return(0);
        }
        if (allowedTypes == null || allowedTypes.Length == 0)
        {
            allowedTypes = new TokenClass[] { Invader.Explorer, Invader.Town, Invader.City }
        }
        ;

        Token[] invaderTokens;
        int     damageInflicted = 0;

        while (damage > 0 && (invaderTokens = Tokens.OfAnyType(allowedTypes).ToArray()).Length > 0)
        {
            var invaderToDamage = (HealthToken)await damagePicker.Action.Decision(Select.Invader.ForAggregateDamage(Space, invaderTokens, damage, present));

            if (invaderToDamage == null)
            {
                break;
            }
            await ApplyDamageTo1(1, invaderToDamage);

            --damage;
            ++damageInflicted;
        }
        return(damageInflicted);
    }
コード例 #21
0
        public void GetToken(string code)
        {
            string poststring = "grant_type=authorization_code&code=" + code + "&client_id=" + clientid + "&client_secret=" + clientsecret + "&redirect_uri=" + redirection_url + "";
            var    request    = (HttpWebRequest)WebRequest.Create(url);

            request.ContentType = "application/x-www-form-urlencoded";
            request.Method      = "POST";
            UTF8Encoding utfenc = new UTF8Encoding();

            byte[] bytes        = utfenc.GetBytes(poststring);
            Stream outputstream = null;

            try
            {
                request.ContentLength = bytes.Length;
                outputstream          = request.GetRequestStream();
                outputstream.Write(bytes, 0, bytes.Length);
            }
            catch { }
            var    response           = (HttpWebResponse)request.GetResponse();
            var    streamReader       = new StreamReader(response.GetResponseStream());
            string responseFromServer = streamReader.ReadToEnd();
            JavaScriptSerializer js   = new JavaScriptSerializer();
            TokenClass           obj  = js.Deserialize <TokenClass>(responseFromServer);

            GetuserProfile(obj.access_token);
        }
コード例 #22
0
        public async Task <object> CreateZoomMeeting(TokenClass payload)
        {
            var request = new HttpRequestMessage(HttpMethod.Post, "https://api.zoom.us/v2/users/me/meetings");

            request.Content = new StringContent(JsonSerializer.Serialize(new RequestMeeting {
                agenda     = payload.agenda,
                start_time = payload.start_time,
                timezone   = payload.timezone,
                topic      = payload.topic,
                type       = payload.type,
                duration   = payload.duration,
                password   = payload.password
            }));
            request.Content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");

            var client = _httpClient.CreateClient();

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", payload.accesstoken);


            var response = await client.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                var responseStream = await response.Content.ReadAsStreamAsync();

                var Branches = JsonSerializer.DeserializeAsync <CreateMeetingResponse>(responseStream);
                return(Branches);
            }
            else
            {
                return(null);
            }
        }
コード例 #23
0
        /// <summary>
        /// Accept the specified token.
        /// </summary>
        /// <param name="token">Token.</param>
        public bool Accept(TokenClass token)
        {
            var match = Match(token);

            Skip(match ? 1 : 0);
            return(match);
        }
コード例 #24
0
 static async Task GatherLike(TargetSpaceCtx ctx, TokenClass tokenTypeOfInterest)
 {
     if (ctx.Tokens.HasAny(tokenTypeOfInterest))
     {
         await ctx.GatherUpTo(1, tokenTypeOfInterest);
     }
 }
コード例 #25
0
        public Playlists getPlayLists()
        {
            TokenClass _Token = new TokenClass();

            string token = _Token.getToken();

            string url           = "https://api.spotify.com/v1/browse/featured-playlists?country=US&locale=sv_US&timestamp=2020-05-01T09%3A00%3A00&limit=10";
            var    Authorization = _Token.currentToken;

            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

            webRequest.Method      = "GET";
            webRequest.ContentType = "application/x-www-form-urlencoded";
            webRequest.Accept      = "application/json";
            webRequest.Headers.Add("Authorization:" + _Token.currentToken);
            webRequest.ContentLength = 0;
            HttpWebResponse            resp           = (HttpWebResponse)webRequest.GetResponse();
            String                     json           = "";
            DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(PlayListsClass));

            using (Stream respStr = resp.GetResponseStream())
            {
                using (StreamReader rdr = new StreamReader(respStr, Encoding.UTF8))
                {
                    json = rdr.ReadToEnd();
                    rdr.Close();
                }
            }

            var playlists = JsonConvert.DeserializeObject <PlayList>(json).playlists;

            return(playlists);
        }
コード例 #26
0
        public StyleElement(Style s, TokenClass token_class, Major major, Minor minor, int param, string text)
        {
            this.token_class = token_class;
            this.major       = major;
            this.minor       = minor;
            this.param       = param;
            this.text        = text;

            lock (s)
            {
                if (s.Elements == null)
                {
                    s.Elements = this;
                }
                else
                {
                    StyleElement se = s.Elements;
                    while (se.next != null)
                    {
                        se = se.next;
                    }
                    se.next = this;
                }
            }
        }
コード例 #27
0
ファイル: Tokenizer.cs プロジェクト: josh-127/Iodine
        Token ReadHexNumber()
        {
            var accum = new StringBuilder();

            source.Skip(2);

            while (source.See() && IsHexNumber(source.Peek()))
            {
                accum.Append(source.Read());
            }

            var val = accum.ToString();

            bool isBigInt = source.Peek() == 'L';

            bool fitsInInteger = false;

            if (isBigInt)
            {
                source.Skip();
                BigInteger valBig;
                fitsInInteger = BigInteger.TryParse(
                    "0" + val,
                    System.Globalization.NumberStyles.HexNumber,
                    null,
                    out valBig
                    );

                val = valBig.ToString();
            }
            else
            {
                long val64;
                fitsInInteger = long.TryParse(
                    val,
                    System.Globalization.NumberStyles.HexNumber,
                    null,
                    out val64
                    );

                val = val64.ToString();
            }

            if (!fitsInInteger)
            {
                errorLog.Add(Errors.IntegerOverBounds, source.Location);
            }

            TokenClass tokenClass = isBigInt ?
                                    TokenClass.BigIntLiteral :
                                    TokenClass.IntLiteral;

            if (string.IsNullOrEmpty(val))
            {
                errorLog.Add(Errors.IllegalSyntax, source.Location);
            }

            return(new Token(tokenClass, val, lastDocStr, source.Location));
        }
コード例 #28
0
    protected void BtnDeleteRuta_Click(object sender, EventArgs e)
    {
        TokenClass token = new TokenClass();

        logClass = new LogClass();
        //logClass.AnularRutaAsign( HdnIdAsignruta.Value,token.TokenId);
        Response.Redirect("~/View/Logistica/AdministracionRutas?ID=" + HdnIdInventario.Value + "&TOKEN=" + token.TokenId);
    }
コード例 #29
0
ファイル: ClassDelegate.cs プロジェクト: nlhepler/mono
		public ClassDelegate this[TokenClass c] {
			get {
				return callbacks[(int)c];
			}

			set {
				callbacks[(int)c] = value;
			}
		}
コード例 #30
0
    protected void BtnDownLoadExcel_Click(object sender, EventArgs e)
    {
        token    = new TokenClass();
        logclass = new LogClass();
        Inventario inventario = logclass.GetVariables(HdnIdInventario.Value);

        ExportarExcel(logclass.GetDetailInventory(HdnIdInventario.Value, token.TokenId), inventario.Name);
        Response.Redirect("~/View/Logistica/DetalleInventario?ID=" + HdnIdInventario.Value + "&TOKEN=" + token.TokenId);
    }
コード例 #31
0
ファイル: RTF.cs プロジェクト: radtek/WasmWinforms
        public bool CheckCMM(TokenClass rtf_class, Major major, Minor minor)
        {
            if ((this.rtf_class == rtf_class) && (this.major == major) && (this.minor == minor))
            {
                return(true);
            }

            return(false);
        }
コード例 #32
0
		public RTFException(RTF rtf, string error_message) {
			this.pos = rtf.LinePos;
			this.line = rtf.LineNumber;
			this.token_class = rtf.TokenClass;
			this.major = rtf.Major;
			this.minor = rtf.Minor;
			this.param = rtf.Param;
			this.text = rtf.Text;
			this.error_message = error_message;
		}
コード例 #33
0
		/// <summary>
		/// Gets the <see cref="HighlightColor"/> for the specified class of
		/// token.
		/// </summary>
		/// <param name="p_ttpTokenClass">The token class for which the
		/// <see cref="HighlightColor"/> is to be returned.</param>
		/// <returns>The <see cref="HighlightColor"/> for the specified class of
		/// token.</returns>
		public HighlightColor GetColorFor(TokenClass p_ttpTokenClass)
		{
			switch (p_ttpTokenClass)
			{
				case TokenClass.Operator:
					return new HighlightColor(Color.ForestGreen, false, false);
				case TokenClass.String:
					return new HighlightColor(Color.Maroon, false, false);
				case TokenClass.Keyword:
					return new HighlightColor(Color.Red, false, false);
				case TokenClass.Variable:
					return new HighlightColor(Color.Blue, false, false);
				default:
					return defaultHighlightingStrategy.GetColorFor("DefaultColor");
			}
		}
コード例 #34
0
ファイル: StyleElement.cs プロジェクト: KonajuGames/SharpLang
		public StyleElement(Style s, TokenClass token_class, Major major, Minor minor, int param, string text) {
			this.token_class = token_class;
			this.major = major;
			this.minor = minor;
			this.param = param;
			this.text = text;

			lock (s) {
				if (s.Elements == null) {
					s.Elements = this;
				} else {
					StyleElement se = s.Elements;
					while (se.next != null)
						se = se.next;
					se.next = this;
				}
			}
		}
コード例 #35
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		public void SetToken(TokenClass cl, Major maj, Minor min, int par, string text) {
			this.rtf_class = cl;
			this.major = maj;
			this.minor = min;
			this.param = par;
			if (par == NoParam) {
				this.text_buffer = new StringBuilder(text);
			} else {
				this.text_buffer = new StringBuilder(text + par.ToString());
			}
		}
コード例 #36
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		public void UngetToken() {
			if (this.pushed_class != TokenClass.None) {
				throw new RTFException(this, "Cannot unget more than one token");
			}

			if (this.rtf_class == TokenClass.None) {
				throw new RTFException(this, "No token to unget");
			}

			this.pushed_class = this.rtf_class;
			this.pushed_major = this.major;
			this.pushed_minor = this.minor;
			this.pushed_param = this.param;
			//this.pushed_text_buffer = new StringBuilder(this.text_buffer.ToString());
		}
コード例 #37
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		public void Lookup(string token) {
			Object		obj;
			KeyStruct	key;

			obj = key_table[token.Substring(1)];
			if (obj == null) {
				rtf_class = TokenClass.Unknown;
				major = (Major) -1;
				minor = (Minor) -1;
				return;
			}

			key = (KeyStruct)obj;
			this.rtf_class = TokenClass.Control;
			this.major = key.Major;
			this.minor = key.Minor;
		}
コード例 #38
0
ファイル: Token.cs プロジェクト: simonegli8/Silversite
 public Token()
     : base()
 {
     Identation = string.Empty; tokenClass = TokenClass.Whitespace; stringClass = Html.StringClass.DoubleQuote; serverTagClass = Html.ServerTagClass.Expression; Value = string.Empty;
     Line = 1; Column = 1; Start = 0; End = 0;
 }
コード例 #39
0
ファイル: RTF.cs プロジェクト: nlhepler/mono
		/// <summary>Return the next token in the stream</summary>
		public TokenClass GetToken() {
			if (pushed_class != TokenClass.None) {
				this.rtf_class = this.pushed_class;
				this.major = this.pushed_major;
				this.minor = this.pushed_minor;
				this.param = this.pushed_param;
				this.pushed_class = TokenClass.None;
				return this.rtf_class;
			}

			GetToken2();

			if (this.rtf_class == TokenClass.Text) {
				this.minor = (Minor)this.cur_charset[(int)this.major];
				if (encoding == null) {
					encoding = Encoding.GetEncoding (encoding_code_page);
				}
				encoded_text = new String (encoding.GetChars (new byte [] { (byte) this.major }));
			}

			if (this.cur_charset.Flags == CharsetFlags.None) {
				return this.rtf_class;
			}

			if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) {
				encoding_code_page = param;

				// fallback to the default one in case we have an invalid value
				if (encoding_code_page < 0 || encoding_code_page > 65535)
					encoding_code_page = DefaultEncodingCodePage;
			}

			if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
				this.cur_charset.ReadMap();
			} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
				Font	fp;

				fp = Font.GetFont(this.font_list, this.param);

				if (fp != null) {
					if (fp.Name.StartsWith("Symbol")) {
						this.cur_charset.ID = CharsetType.Symbol;
					} else {
						this.cur_charset.ID = CharsetType.General;
					}
				} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
					switch(this.major) {
						case Major.BeginGroup: {
							this.charset_stack.Push(this.cur_charset);
							break;
						}

						case Major.EndGroup: {
							this.cur_charset = (Charset)this.charset_stack.Pop();
							break;
						}
					}
				}
			}

			return this.rtf_class;
		}
コード例 #40
0
ファイル: TokenStream.cs プロジェクト: iwatakeshi/Iodine
 public Token Expect(TokenClass clazz, string val)
 {
     Token ret = PeekToken ();
     if (Accept (clazz, val)) {
         return ret;
     }
     Token offender = ReadToken ();
     if (offender != null) {
         errorLog.AddError (ErrorType.ParserError, offender.Location,
             "Unexpected '{0}' (Expected '{1}')", offender.ToString (), Token.ClassToString (
             clazz));
     } else {
         errorLog.AddError (ErrorType.ParserError, offender.Location,
             "Unexpected end of file (Expected {0})", Token.ClassToString (clazz));
         throw new Exception ("");
     }
     return new Token (clazz, "", Location);
 }
コード例 #41
0
ファイル: ExpressionRegistry.cs プロジェクト: bcr/sdf
 public TokenExpression()
 {
     this.token = new TokenClass(this);
 }
コード例 #42
0
ファイル: Token.cs プロジェクト: hbarve1/Cobalt
 public Token(TokenClass clazz, object val, int line)
 {
     this.tokenClass = clazz;
     this.tokenValue = val;
     this.line = line;
 }
コード例 #43
0
ファイル: Token.cs プロジェクト: simonegli8/Silversite
 public void CopyFrom(Token t)
 {
     Start = t.Start; End = t.End; Line = t.Line; Column = t.Column; Identation = t.Identation; tokenClass = t.tokenClass; stringClass = t.stringClass; serverTagClass = t.serverTagClass; Value = t.Value;
 }
コード例 #44
0
ファイル: TokenStream.cs プロジェクト: iwatakeshi/Iodine
 public bool Match(TokenClass clazz, string val)
 {
     return PeekToken () != null &&
         PeekToken ().Class == clazz &&
         PeekToken ().Value == val;
 }
コード例 #45
0
ファイル: TokenStream.cs プロジェクト: iwatakeshi/Iodine
 public bool Match(TokenClass clazz1, TokenClass clazz2)
 {
     return PeekToken () != null && PeekToken ().Class == clazz1 &&
         PeekToken (1) != null &&
         PeekToken (1).Class == clazz2;
 }
コード例 #46
0
ファイル: TokenStream.cs プロジェクト: iwatakeshi/Iodine
 public bool Match(TokenClass clazz)
 {
     return PeekToken () != null && PeekToken ().Class == clazz;
 }
コード例 #47
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		private void GetToken2() {
			char	c;
			int	sign;

			this.rtf_class = TokenClass.Unknown;
			this.param = NoParam;

			this.text_buffer.Length = 0;

			if (this.pushed_char != EOF) {
				c = this.pushed_char;
				this.text_buffer.Append(c);
				this.pushed_char = EOF;
			} else if ((c = GetChar()) == EOF) {
				this.rtf_class = TokenClass.EOF;
				return;
			}

			if (c == '{') {
				this.rtf_class = TokenClass.Group;
				this.major = Major.BeginGroup;
				return;
			}

			if (c == '}') {
				this.rtf_class = TokenClass.Group;
				this.major = Major.EndGroup;
				return;
			}

			if (c != '\\') {
				if (c != '\t') {
					this.rtf_class = TokenClass.Text;
					this.major = (Major)c;	// FIXME - typing?
					return;
				} else {
					this.rtf_class = TokenClass.Control;
					this.major = Major.SpecialChar;
					this.minor = Minor.Tab;
					return;
				}
			}

			if ((c = GetChar()) == EOF) {
				// Not so good
				return;
			}

			if (!Char.IsLetter(c)) {
				if (c == '\'') {
					char c2;

					if ((c = GetChar()) == EOF) {
						return;
					}

					if ((c2 = GetChar()) == EOF) {
						return;
					}

					this.rtf_class = TokenClass.Text;
					this.major = (Major)((Char)((Convert.ToByte(c.ToString(), 16) * 16 + Convert.ToByte(c2.ToString(), 16))));
					return;
				}

				// Escaped char
				if (c == ':' || c == '{' || c == '}' || c == '\\') {
					this.rtf_class = TokenClass.Text;
					this.major = (Major)c;
					return;
				}

				Lookup(this.text_buffer.ToString());
				return;
			}

			while (Char.IsLetter(c)) {
				if ((c = GetChar()) == EOF) {
					break;
				}
			}

			if (c != EOF) {
				this.text_buffer.Length--;
			}

			Lookup(this.text_buffer.ToString());

			if (c != EOF) {
				this.text_buffer.Append(c);
			}

			sign = 1;
			if (c == '-') {
				sign = -1;
				c = GetChar();
			}

			if (c != EOF && Char.IsDigit(c)) {
				this.param = 0;
				while (Char.IsDigit(c)) {
					this.param = this.param * 10 + Convert.ToByte(c) - 48;
					if ((c = GetChar()) == EOF) {
						break;
					}
				}
				this.param *= sign;
			}

			if (c != EOF) {
				if (c != ' ') {
					this.pushed_char = c;
				}
				this.text_buffer.Length--;
			}
		}
コード例 #48
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		/// <summary>Return the next token in the stream</summary>
		public TokenClass GetToken() {
			if (pushed_class != TokenClass.None) {
				this.rtf_class = this.pushed_class;
				this.major = this.pushed_major;
				this.minor = this.pushed_minor;
				this.param = this.pushed_param;
				this.pushed_class = TokenClass.None;
				return this.rtf_class;
			}

			GetToken2();

			if (this.rtf_class == TokenClass.Text) {
				this.minor = (Minor)this.cur_charset[(int)this.major];
			}

			if (this.cur_charset.Flags == CharsetFlags.None) {
				return this.rtf_class;
			}

			if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
				this.cur_charset.ReadMap();
			} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
				Font	fp;

				fp = Font.GetFont(this.font_list, this.param);

				if (fp != null) {
					if (fp.Name.StartsWith("Symbol")) {
						this.cur_charset.ID = CharsetType.Symbol;
					} else {
						this.cur_charset.ID = CharsetType.General;
					}
				} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
					switch(this.major) {
						case Major.BeginGroup: {
							this.charset_stack.Push(this.cur_charset);
							break;
						}

						case Major.EndGroup: {
							this.cur_charset = (Charset)this.charset_stack.Pop();
							break;
						}
					}
				}
			}

			return this.rtf_class;
		}
コード例 #49
0
ファイル: TokenStream.cs プロジェクト: iwatakeshi/Iodine
 public bool Accept(TokenClass clazz, ref Token token)
 {
     if (PeekToken () != null && PeekToken ().Class == clazz) {
         token = ReadToken ();
         return true;
     }
     return false;
 }
コード例 #50
0
ファイル: Token.cs プロジェクト: iwatakeshi/Iodine
 /// <summary>
 /// Converts a TokenClass enum to its string representation
 /// </summary>
 /// <returns>The string representation of the TokenClass enum.</returns>
 /// <param name="clazz">Token class.</param>
 public static string ClassToString(TokenClass clazz)
 {
     switch (clazz) {
     case TokenClass.CloseBrace:
         return "}";
     case TokenClass.OpenBrace:
         return "{";
     case TokenClass.CloseParan:
         return ")";
     case TokenClass.OpenParan:
         return "(";
     case TokenClass.Comma:
         return ",";
     case TokenClass.OpenBracket:
         return "[";
     case TokenClass.CloseBracket:
         return "]";
     case TokenClass.SemiColon:
         return ";";
     case TokenClass.Colon:
         return ":";
     default:
         return clazz.ToString ();
     }
 }
コード例 #51
0
ファイル: TokenStream.cs プロジェクト: iwatakeshi/Iodine
 public bool Accept(TokenClass clazz, string val)
 {
     if (PeekToken () != null && PeekToken ().Class == clazz && PeekToken ().Value == val) {
         ReadToken ();
         return true;
     }
     return false;
 }
コード例 #52
0
 public void Set(TokenClass tokenClass, string value = "")
 {
     Class = tokenClass;
     Value = value;
 }
コード例 #53
0
ファイル: Token.cs プロジェクト: iwatakeshi/Iodine
 /// <summary>
 /// Initializes a new instance of the <see cref="Iodine.Compiler.Token"/> class.
 /// </summary>
 /// <param name="clazz">Token class.</param>
 /// <param name="value">Value.</param>
 /// <param name="location">Location.</param>
 public Token(TokenClass clazz, string value, Location location)
 {
     this.Class = clazz;
     this.Value = value;
     this.Location = location;
 }
コード例 #54
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		public RTF(Stream stream) {
			source = new StreamReader(stream);

			text_buffer = new StringBuilder(1024);
			//pushed_text_buffer = new StringBuilder(1024);

			rtf_class = TokenClass.None;
			pushed_class = TokenClass.None;
			pushed_char = unchecked((char)-1);

			line_num = 0;
			line_pos = 0;
			prev_char = unchecked((char)-1);
			bump_line = false;

			cur_charset = new Charset();

			destination_callbacks = new DestinationCallback();
			class_callbacks = new ClassCallback();

			destination_callbacks [Minor.OptDest] = new DestinationDelegate (HandleOptDest);
			destination_callbacks[Minor.FontTbl] = new DestinationDelegate(ReadFontTbl);
			destination_callbacks[Minor.ColorTbl] = new DestinationDelegate(ReadColorTbl);
			destination_callbacks[Minor.StyleSheet] = new DestinationDelegate(ReadStyleSheet);
			destination_callbacks[Minor.Info] = new DestinationDelegate(ReadInfoGroup);
			destination_callbacks[Minor.Pict] = new DestinationDelegate(ReadPictGroup);
			destination_callbacks[Minor.Object] = new DestinationDelegate(ReadObjGroup);
		}
コード例 #55
0
ファイル: RTF.cs プロジェクト: ArsenShnurkov/beagle-1
		public bool CheckCMM(TokenClass rtf_class, Major major, Minor minor) {
			if ((this.rtf_class == rtf_class) && (this.major == major) && (this.minor == minor)) {
				return true;
			}

			return false;
		}
コード例 #56
0
ファイル: Token.cs プロジェクト: GruntTheDivine/Iodine
		/// <summary>
		/// Initializes a new instance of the <see cref="Iodine.Compiler.Token"/> class.
		/// </summary>
		/// <param name="clazz">Token class.</param>
		/// <param name="value">Value.</param>
		/// <param name="location">Location.</param>
		public Token (TokenClass clazz, string value, SourceLocation location)
		{
			Class = clazz;
			Value = value;
			Location = location;
		}
コード例 #57
0
ファイル: Token.cs プロジェクト: simonegli8/Silversite
 public Token(TokenClass tokenClass)
     : this()
 {
     Class = tokenClass;
 }