コード例 #1
0
        /// <summary>
        /// Location determination by name, indicating the quantity of objects to return and preference language.
        /// </summary>
        /// <param name="location">Name of a geographic location.</param>
        /// <param name="results">Maximum number of objects to return.</param>
        /// <param name="lang">Preference language for describing objects.</param>
        /// <example>Geocode("Moscow", 10, LangType.en_US);</example>
        /// <returns>Collection of found locations</returns>
        public static GeoObjectCollection Geocode(string location, short results, LangType lang)
        {
            string request_ulr =
                string.Format(REQUESRT_URL, StringMakeValid(location), results, LangTypeToStr(lang)) +
                (string.IsNullOrEmpty(_key) ? string.Empty : "&key=" + _key);

            return new GeoObjectCollection(DownloadString(request_ulr));   //new GeoObjectCollection(File.ReadAllText(@"C:\Users\***\Desktop\2.x.xml"));
        }
コード例 #2
0
		public FilterSource ()
		{
			// Initialize the linetype member.
			SrcLineType = LineType.None;
			SrcLangType = LangType.None;
			StrConstIdentifier = " ";

			SnippetMode = true;
			OriginalIsText = true;
			token = new StringBuilder ();
			SetFileType ("source");
		}
コード例 #3
0
        public virtual JsonResult Edit(int orderId, LangType langType, List <OrderItem> items)
        {
            var rep = _orderBusiness.Update(orderId, langType, items);

            if (!rep.IsSuccessful)
            {
                return(Json(new { IsSuccessful = false, rep.Message }));
            }
            rep.Result.OrderItems.ForEach(x => x.Order = null);
            return(Json(new
            {
                IsSuccessful = true,
                rep.Message,
                Result = rep.Result.OrderItems
            }));
        }
コード例 #4
0
ファイル: WeiXin.cs プロジェクト: Cold1986/GanXian
        /// <summary>
        /// 得到网页授权用户信息
        /// </summary>
        /// <param name="access_token">网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同</param>
        /// <param name="openid">用户的唯一标识</param>
        /// <param name="lang">返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语</param>
        /// <returns></returns>
        public static WebUserInfo GetWebUserInfo(string access_token, string openid, LangType lang)
        {
            string url = string.Format("https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang={2}", access_token, openid, lang.ToString());

            var json = Util.HttpGet2(url);

            if (json.IndexOf("errcode") > 0)
            {
                var ui = new WebUserInfo();
                ui.error = Util.JsonTo <ReturnCode>(json);
                return(ui);
            }
            else
            {
                return(Util.JsonTo <WebUserInfo>(json));
            }
        }
コード例 #5
0
        public static string HighlightToHTML(string source, LangType type, bool customProtectionTags)
        {
            SourceFormat sf = null;

            switch (type)
            {
            case LangType.C:
            case LangType.CPP:
                sf = new CppFormat();
                break;

            case LangType.CS:
                sf = new CSharpFormat();
                break;

            case LangType.Html:
            case LangType.Xml:
            case LangType.Asp:
                sf = new HtmlFormat();
                break;

            case LangType.JS:
                sf = new JavaScriptFormat();
                break;

            case LangType.Msh:
                sf = new MshFormat();
                break;

            case LangType.TSql:
                sf = new TsqlFormat();
                break;

            case LangType.VB:
                sf = new VisualBasicFormat();
                break;
            }

            if (sf == null)
            {
                return(source);
            }

            sf.CustomProtectedTags = customProtectionTags;
            return(sf.FormatCode(source));
        }
コード例 #6
0
ファイル: Language.cs プロジェクト: xdaker/TransTool
 public static string Translate(string text, LangType langType = LangType.zh)
 {
     lock (Lockobject)
     {
         if (langType == LangType.zh)
         {
             return(text);
         }
         var    strArray = SplitStrings(text);
         string result   = string.Empty;
         foreach (var str in strArray)
         {
             result += TransApi.GetTransResult(str, LangType.auto.ToString(), langType.ToString());
         }
         return(string.IsNullOrWhiteSpace(result) ? text : result);
     }
 }
コード例 #7
0
ファイル: ResourceMSG.cs プロジェクト: radtek/MyExtendsTools
        /// <summary>
        /// 根据语言类型参数以及KEY键值获取资源文件中的消息
        /// </summary>
        /// <param name="langType">语言类型</param>
        /// <param name="key">资源文件的KEY键值</param>
        /// <returns>返回资源文件中的信息</returns>
        private static string GetMessage(LangType langType, string key)
        {
            switch (langType)
            {
            case LangType.CH:
            {
                return(SmartExtends.Resources.Exceptions.FrameCHExceptionResource.ResourceManager.GetString(key));
            }

            case LangType.EN:
            {
                return(SmartExtends.Resources.Exceptions.FrameENExceptionResource.ResourceManager.GetString(key));
            }

            default:
                return(SmartExtends.Resources.Exceptions.FrameCHExceptionResource.ResourceManager.GetString(key));
            }
        }
コード例 #8
0
    public static string Get(string id, LangType langType = LangType.NONE)
    {
        if (id == null)
        {
            return("");
        }

        LangType _langType;

        if (langType == LangType.NONE)
        {
            _langType = GetLangType();
        }
        else
        {
            _langType = langType;
        }
        var temp = Table.Language.Get(id);

        if (temp == null)
        {
            return("id:" + id);
        }

        string txt;

        switch (_langType)
        {
        case LangType.EN:
            txt = Table.Language.Get(id).EN;
            break;

        case LangType.CHN:
            txt = Table.Language.Get(id).CHA;
            break;

        default:
            txt = "No LangType";
            break;
        }

        txt = ReplaceNames(txt);
        return(txt);
    }
コード例 #9
0
            private static string LangTypeToStr(LangType lang)
            {
                switch (lang)
                {
                case LangType.ru_RU: return("ru-RU");

                case LangType.uk_UA: return("uk-UA");

                case LangType.be_BY: return("be-BY");

                case LangType.en_US: return("en-US");

                case LangType.en_BR: return("en-BR");

                case LangType.tr_TR: return("tr-TR");

                default: return("ru-RU");
                }
            }
コード例 #10
0
        protected string LangTypeToStr(LangType lang)
        {
            switch (lang)
            {
            case LangType.RU: return("ru-RU");

            case LangType.UA: return("uk-UA");

            case LangType.BY: return("be-BY");

            case LangType.US: return("en-US");

            case LangType.BR: return("en-BR");

            case LangType.TR: return("tr-TR");

            default: return("ru-RU");
            }
        }
コード例 #11
0
        protected override object VisitVariableDeclaration(VariableDeclarationSyntax node)
        {
            LangType t = _ResolveLangType(node.Type);

#if ROSLYN
            //if (t == null || t.DotnetType == null)
            //    throw new Exception("Roslyn powinien tozwiązać ten typ");
#endif
            var vars = node.Variables.Select(Visit).OfType <VariableDeclarator>().ToArray();
            if ((object)t.DotnetType == null)
            {
                if (vars.Any())
                {
                    t = new LangType(vars[0].Value.ValueType);
                }
                // Console.ForegroundColor
                Console.WriteLine("Brak typu dla {0} => {1}", node.ToString(), t);
            }
            return(new VariableDeclaration(t, vars));
        }
コード例 #12
0
        /// <summary>
        /// 得到用户基本信息
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="lang"></param>
        /// <param name="access_token"></param>
        /// <returns></returns>
        public static UserInfo GetUserInfo(string openid, LangType lang, string access_token)
        {
            string url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=";

            url = url + access_token + "&openid=" + openid + "&lang=" + lang.ToString();

            var json = Util.HttpGet2(url);

            if (json.IndexOf("errcode") > 0)
            {
                var ui = new UserInfo();
                ui.openid = openid;
                ui.error  = Util.JsonTo <ReturnCode>(json);
                return(ui);
            }
            else
            {
                return(Util.JsonTo <UserInfo>(json));
            }
        }
コード例 #13
0
ファイル: LanguageMgr.cs プロジェクト: wuhuolong/MaxBooks
    public void SwitchLanguage(LangType type)
    {
        if (GameConfig.Language == type)
        {
            return;
        }
        GameConfig.Language = type;
        var      ie = m_Txt_Dic.GetEnumerator();
        TextWrap txtitem;

        while (ie.MoveNext())
        {
            txtitem = ie.Current.Value;
            if (txtitem.Txt != null)
            {
                SetSelectedLang(txtitem);
            }
        }
        //TODO
        //ImgWrap imgitem;
    }
コード例 #14
0
 public static string getTemplate(LangType language)
 {
     lock (templates.SyncRoot)
     {
         if (templates[language] == null)
         {
             string path = @"plugins/SnippetExecutor/templates/" + language.ToString() + ".txt";
             string ret  = loadTemplate(path);
             if (ret == null)
             {
                 throw new Exception("No template for " + System.IO.Path.GetFullPath(path));
             }
             templates[language] = ret;
             return(ret);
         }
         else
         {
             return((string)templates[language]);
         }
     }
 }
コード例 #15
0
 /// <summary>
 /// Метод записывает список стран в поле "countries"
 /// </summary>
 /// <param name="mainTag"></param>
 private static void InitializeCountries(JObject mainTag)
 {
     if (mainTag.TryGetValue("countries", out JToken countriesToken))
     {
         JObject countriesObj = (JObject)countriesToken;
         foreach (string language in allAppLanguages)
         {
             if (countriesObj.TryGetValue(language, out JToken langToken))
             {
                 LangType currentLang = (LangType)Enum.Parse(typeof(LangType), language);
                 if (countries.ContainsKey(currentLang))
                 {
                     countries[currentLang] = (JArray)langToken;
                 }
                 else
                 {
                     countries.Add(currentLang, (JArray)langToken);
                 }
             }
         }
     }
 }
コード例 #16
0
        protected override void Given()
        {
            var ctx      = new Context();
            var langType = new LangType("ptr", null, null, 0, 0)
            {
                SubTypes = new List <LangType>
                {
                    new LangType("test_type", new List <VariableDeclaration> {
                        new VariableDeclaration(
                            "name", ParserContext.NativeTypes.LangString, null, 0, 0),
                        new VariableDeclaration(
                            "id", ParserContext.NativeTypes.LangInt, null, 0, 0),
                    }, null, 0, 0),
                    null,
                }
            };

            ctx.Variables.Add(new Variable
            {
                MemoryAddress       = "test_var_mem_addr",
                Name                = "test_var",
                VariableDeclaration = new VariableDeclaration(
                    "test_var",
                    langType,
                    null,
                    0,
                    0)
            });
            var node = new DerefArrow(new Identifier("test_var", null, 0, 0)
            {
                NodeType = langType
            },
                                      new Identifier("id", null, 0, 0), null, 0, 0);

            this.result = new DerefArrowEmitter().Transform(
                node,
                ctx
                );
        }
コード例 #17
0
        private static void AddInheritances(string resInfo, LangType lang, string name, XmlNode xNodeParent)
        {
            XmlNode node = xNodeParent.SelectSingleNode("Inheritances");

            if ((node != null) && (node.ChildNodes.Count != 0))
            {
                LangProperties lp = null;
                if (!FindResource(resInfo, lang, m_inheritName, ref lp))
                {
                    lp = new LangProperties();
                }
                foreach (XmlNode node2 in node.ChildNodes)
                {
                    string str = node2.Attributes["name"].Value;
                    if (str.Length != 0)
                    {
                        lp.AddItem(PropertyType.Inherit, str, name);
                    }
                }
                AddResource(resInfo, lang, m_inheritName, lp);
            }
        }
コード例 #18
0
        /// <summary>
        /// Метод добавляет все значения префикса по языкам в словарь "locationsPrfxs"
        /// </summary>
        /// <param name="prefixToken">Токен с префиксом</param>
        /// <param name="prefixName">Название токена</param>
        private static void AddPrfxs(JToken prefixToken, string prefixName)
        {
            JObject prefixObj = (JObject)prefixToken;

            if (!string.IsNullOrEmpty(prefixName))
            {
                foreach (string language in allAppLanguages)
                {
                    if (prefixObj.TryGetValue(language, out JToken langToken))
                    {
                        LangType currentLang = (LangType)Enum.Parse(typeof(LangType), language);
                        if (locationsPrfxs[prefixName].ContainsKey(currentLang))
                        {
                            locationsPrfxs[prefixName][currentLang] = (string)langToken;
                        }
                        else
                        {
                            locationsPrfxs[prefixName].Add(currentLang, (string)langToken);
                        }
                    }
                }
            }
        }
コード例 #19
0
ファイル: Highlighter.cs プロジェクト: ridhouan/teamlab.v6.5
        public static string HighlightToHTML(string source, LangType type, bool CustomProtectionTags)
        {
            SourceFormat sf = null;
            
            switch(type)
            {
                case LangType.C:
                case LangType.CPP:
                    sf = new CppFormat();
                    break;
                case LangType.CS:
                    sf = new CSharpFormat();
                    break;
                case LangType.Html:
                case LangType.Xml:
                case LangType.Asp:
                    sf = new HtmlFormat();
                    break;
                case LangType.JS:
                    sf = new JavaScriptFormat();
                    break;
                case LangType.Msh:
                    sf = new MshFormat();
                    break;
                case LangType.TSql:
                    sf = new TsqlFormat();
                    break;
                case LangType.VB:
                    sf = new VisualBasicFormat();
                    break;
            }

            if (sf == null)
                return source;
            sf.CustomProtectedTags = CustomProtectionTags;
            return sf.FormatCode(source);
        }
コード例 #20
0
ファイル: XmlDataReader.cs プロジェクト: TommyAGK/Flex
        // ReSharper disable once UnusedParameter.Local
        private void ReadLanguage(LangType lang)
        {
            // Set path to Language.xml
                        if (lang.Equals(LangType.CustomProfile))
                            {
                                _path = Directory.GetCurrentDirectory() + String.Format(@"\Dependency\Profile\{0}.xml", _dataStrings[2]);
                            }
                        else
                            {
                                _path = Directory.GetCurrentDirectory() + @"\Dependency\Config\Language.xml";
                            }

                                // Create and load XML document
                                XmlDocument xmldoc = new XmlDocument();
                                xmldoc.Load(new StreamReader(_path));
                                if (xmldoc.DocumentElement == null)
                                    return;

                                // Find languages tags
                                var nodeList = xmldoc.DocumentElement.SelectNodes("Language");

                                // Populate lang words
                                // TODO: nodeList[x] is hard coded for now. Should find current index for lang instead.
                                switch (lang)
                                {
                                    case LangType.Fin:
                                        ReadWords(ref nodeList, LangType.Fin, 1);
                                        break;
                                    case LangType.Nor:
                                        ReadWords(ref nodeList, LangType.Nor, 2);
                                        break;
                                    case LangType.Rus:
                                        ReadWords(ref nodeList, LangType.Rus, 3);
                                        break;
                                    case LangType.Swe:
                                        ReadWords(ref nodeList, LangType.Swe, 4);
                                        break;
                                    case LangType.CustomProfile:
                                        ReadWords(ref nodeList, LangType.CustomProfile, 0);
                                        break;
                                    case LangType.Eng:
                                    default:
                                        ReadWords(ref nodeList, LangType.Eng, 0);
                                        break;
                                }
        }
コード例 #21
0
 public void SetCurrentLanguage(LangType language)
 {
     Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int)language);
 }
コード例 #22
0
 private static string LangTypeToStr(LangType lang)
 {
     switch (lang)
     {
         case LangType.ru_RU: return "ru-RU";
         case LangType.uk_UA: return "uk-UA";
         case LangType.be_BY: return "be-BY";
         case LangType.en_US: return "en-US";
         case LangType.en_BR: return "en-BR";
         case LangType.tr_TR: return "tr-TR";
         default: return "ru-RU";
     }
 }
コード例 #23
0
 public NotepadPPGateway SetCurrentLanguage(LangType language)
 {
     Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int)language);
     return(this);
 }
コード例 #24
0
        public static string GetGachaItemsUrl(GameRegionType region, LangType lang)
        {
            var project = "hk4e";

            return($"{Host}/{project}/gacha_info/{GameRegionTypeConverter.ConvToStr(region)}/items/{lang.ToFullStr()}.json");
        }
コード例 #25
0
		public void SetCurrentLanguage(LangType language)
		{
			Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language);
		}
コード例 #26
0
 private string GeLanguageFlagImageSource(LangType langType)
 {
     return(string.Format("flag_{0}.png", Translation.GetLangExt(langType)).Replace('-', '_'));
 }
コード例 #27
0
ファイル: WeiXin.cs プロジェクト: Cold1986/GanXian
 public static UserInfo GetUserInfo(string openid, LangType lang)
 {
     CheckGlobalCredential();
     return(GetUserInfo(openid, lang, AppID, AppSecret));
 }
コード例 #28
0
ファイル: XmlDataReader.cs プロジェクト: TommyAGK/Flex
        public string GetLang(LangType lang)
        {
            //get { return LangStrings[numOfLangs, numOfxmlNodes ] ;}

                        return LangStrings[(int)lang,0]; //defaults to last index of selected language
        }
コード例 #29
0
        public static string GetCurrentLanguage() // Code::Stats
        {
            LangType langType    = GetCurrentLangType();
            string   currentFile = GetCurrentFile();
            string   extension   = "";

            extension = Path.GetExtension(currentFile).TrimStart('.');

            bool   found    = false;
            string language = "";

            if (!String.IsNullOrWhiteSpace(extension))
            {
                /*if (extensionMapping.TryGetValue(extension, out language))
                 * {
                 *  // Found
                 *  found = true;
                 * }
                 * else
                 * {
                 *  // Not found
                 *  found = false;
                 * }*/// - doesn't work for some reason
                try
                {
                    language = extensionMapping[extension];
                    found    = true;
                }
                catch (KeyNotFoundException)
                {
                    Logger.Debug("Extension \"" + extension + "\" is not found in extension mappings file, using language type selected in Notepad++ instead.");
                    found = false;
                }
            }

            if (!found)
            {
                switch (langType)
                {
                case LangType.L_ADA: language = "Ada"; break;

                //case LangType.L_ASCII: language = "ASCII"; break; // maybe Plain text?
                case LangType.L_ASM: language = "Assembler"; break;

                case LangType.L_ASP: language = "ASP"; break;

                case LangType.L_AU3: language = "AutoIt"; break;

                case LangType.L_BASH: language = "Shell Script"; break;     // or Shell Script, probably called Shell in NPP (long desc: Unix script file)

                case LangType.L_BATCH: language = "Batch"; break;

                case LangType.L_C: language = "C"; break;

                case LangType.L_CAML: language = "Caml"; break;

                case LangType.L_CMAKE: language = "CMake"; break;

                case LangType.L_COBOL: language = "COBOL"; break;

                case LangType.L_COFFEESCRIPT: language = "CoffeeScript"; break;

                case LangType.L_CPP: language = "C++"; break;

                case LangType.L_CS: language = "C#"; break;

                case LangType.L_CSS: language = "CSS"; break;

                case LangType.L_D: language = "D"; break;

                case LangType.L_DIFF: language = "Diff"; break;

                //case LangType.L_EXTERNAL: language = ""; break;
                case LangType.L_FLASH: language = "Flash"; break;

                case LangType.L_FORTRAN: language = "Fortran"; break;     // fixed?

                case LangType.L_FORTRAN_77: language = "Fortran"; break;  // free?

                case LangType.L_GUI4CLI: language = "Gui4Cli"; break;

                case LangType.L_HASKELL: language = "Haskell"; break;

                case LangType.L_HTML: language = "HTML"; break;

                case LangType.L_INI: language = "Ini"; break;

                case LangType.L_INNO: language = "INNO"; break;

                case LangType.L_JAVA: language = "Java"; break;

                case LangType.L_JAVASCRIPT: language = "JavaScript"; break;

                case LangType.L_JS: language = "JavaScript"; break;

                case LangType.L_JSON: language = "JSON"; break;

                case LangType.L_JSP: language = "JSP"; break;

                case LangType.L_KIX: language = "KIXtart"; break;

                case LangType.L_LISP: language = "LISP"; break;

                case LangType.L_LUA: language = "Lua"; break;

                case LangType.L_MAKEFILE: language = "Makefile"; break;

                case LangType.L_MATLAB: language = "Matlab"; break;

                case LangType.L_NSIS: language = "NSIS"; break;

                case LangType.L_OBJC: language = "Objective-C"; break;

                case LangType.L_PASCAL: language = "Pascal"; break;

                case LangType.L_PERL: language = "Perl"; break;

                case LangType.L_PHP: language = "PHP"; break;

                case LangType.L_POWERSHELL: language = "PowerShell"; break;

                case LangType.L_PROPS: language = "Properties"; break;

                case LangType.L_PS: language = "PostScript"; break;

                case LangType.L_PYTHON: language = "Python"; break;

                case LangType.L_R: language = "R"; break;

                case LangType.L_RC: language = "Resource"; break;

                case LangType.L_RUBY: language = "Ruby"; break;

                case LangType.L_SCHEME: language = "Scheme"; break;

                //case LangType.L_SEARCHRESULT: language = ""; break; // it should be fine as plaintext
                case LangType.L_SMALLTALK: language = "Smalltalk"; break;

                case LangType.L_SQL: language = "SQL"; break;

                case LangType.L_TCL: language = "TCL"; break;

                case LangType.L_TEX: language = "TeX"; break;

                case LangType.L_VB: language = "Visual Basic"; break;

                case LangType.L_VERILOG: language = "Verilog"; break;

                case LangType.L_VHDL: language = "VHDL"; break;

                case LangType.L_XML: language = "XML"; break;

                case LangType.L_YAML: language = "YAML"; break;

                case LangType.L_TEXT:
                case LangType.L_USER:     // User defined language
                default:
                    language = "Plain text";
                    break;
                }
            }

            return(language);
        }
コード例 #30
0
            /// <summary>
            /// Location determination by name, indicating the quantity of objects to return and preference language.
            /// </summary>
            /// <param name="location">Name of a geographic location.</param>
            /// <param name="results">Maximum number of objects to return.</param>
            /// <param name="lang">Preference language for describing objects.</param>
            /// <example>Geocode("Moscow", 10, LangType.en_US);</example>
            /// <returns>Collection of found locations</returns>
            public static GeoObjectCollection Geocode(string location, short results, LangType lang)
            {
                string request_ulr =
                    string.Format(REQUESRT_URL, StringMakeValid(location), results, LangTypeToStr(lang)) +
                    (string.IsNullOrEmpty(_key) ? string.Empty : "&key=" + _key);

                return(new GeoObjectCollection(DownloadString(request_ulr)));   //new GeoObjectCollection(File.ReadAllText(@"C:\Users\***\Desktop\2.x.xml"));
            }
コード例 #31
0
ファイル: Main.cs プロジェクト: gburgett/SnippetExecutor
        private static ISnippetCompiler getCompilerForLanguage(LangType langType)
        {
            switch (langType)
            {
                case LangType.L_TEXT:
                case LangType.L_CS:
                    return new CSharpCompiler();

                case LangType.L_VB:
                    return new VBCompiler();

                default:
                    throw new Exception("No compiler for language " + langType.ToString());
            }
        }
コード例 #32
0
            /// <summary>
            /// Location determination by name, indicating the quantity of objects to return and preference language.
            /// Allows limit the search or affect the issuance result.
            /// </summary>
            /// <param name="location">Name of a geographic location.</param>
            /// <param name="results">Maximum number of objects to return.</param>
            /// <param name="lang">Preference language for describing objects.</param>
            /// <param name="search_area">Search geographical area, affects to issuance of results.</param>
            /// <param name="rspn">Allows limit the search (true) or affect the issuance result (false - default).</param>
            /// <returns>Collection of found locations</returns>
            public static GeoObjectCollection Geocode(string location, short results, LangType lang, SearchArea search_area, bool rspn = false)
            {
                string request_ulr =
                    string.Format(REQUESRT_URL, StringMakeValid(location), results, LangTypeToStr(lang)) +
                    string.Format("&ll={0}&spn={1}&rspn={2}", search_area.LongLat.ToString("{0},{1}"), search_area.Spread.ToString("{0},{1}"), rspn ? 1 : 0) +
                    (string.IsNullOrEmpty(_key) ? string.Empty : "&key=" + _key);

                return(new GeoObjectCollection(DownloadString(request_ulr)));
            }
コード例 #33
0
ファイル: Main.cs プロジェクト: gburgett/SnippetExecutor
        public static string getTemplate(LangType language)
        {
            lock (templates.SyncRoot)
            {

                if (templates[language] == null)
                {
                    string path = @"plugins/SnippetExecutor/templates/" + language.ToString() + ".txt";
                    string ret = loadTemplate(path);
                    if (ret == null)
                    {
                        throw new Exception("No template for " + System.IO.Path.GetFullPath(path));
                    }
                    templates[language] = ret;
                    return ret;
                }
                else
                {
                    return (string) templates[language];
                }
            }
        }
コード例 #34
0
        /// <summary>
        /// Location determination by name, indicating the quantity of objects to return and preference language.
        /// Allows limit the search or affect the issuance result.
        /// </summary>
        /// <param name="location">Name of a geographic location.</param>
        /// <param name="results">Maximum number of objects to return.</param>
        /// <param name="lang">Preference language for describing objects.</param>
        /// <param name="search_area">Search geographical area, affects to issuance of results.</param>
        /// <param name="rspn">Allows limit the search (true) or affect the issuance result (false - default).</param>
        /// <returns>Collection of found locations</returns>
        public static GeoObjectCollection Geocode(string location, short results, LangType lang, SearchArea search_area, bool rspn = false)
        {
            string request_ulr =
                string.Format(REQUESRT_URL, StringMakeValid(location), results, LangTypeToStr(lang)) +
                string.Format("&ll={0}&spn={1}&rspn={2}", search_area.LongLat.ToString("{0},{1}"), search_area.Spread.ToString("{0},{1}"), rspn ? 1 : 0) +
                (string.IsNullOrEmpty(_key) ? string.Empty : "&key=" + _key);

            return new GeoObjectCollection(DownloadString(request_ulr));
        }
コード例 #35
0
 // Methods
 public LanguageCompiler(LangType lang, bool generateExecutable, bool generateInMemory, bool includeDebugInformation)
 {
     language = lang;
     this.parameters = new CompilerParameters ();
     this.parameters.GenerateExecutable = generateExecutable;
     this.parameters.GenerateInMemory = generateInMemory;
     this.parameters.IncludeDebugInformation = includeDebugInformation;
 }
コード例 #36
0
 public static extern IntPtr SendMessage(IntPtr hWnd, NppMsg Msg, int wParam, ref LangType lParam);
コード例 #37
0
            public CodeDomProvider createLanguageCompiler(LangType lang)
            {
                switch (lang) {
                case LangType.CSharp:
                    return  new CSharpCodeProvider (new Dictionary<string, string>() { { "CompilerVersion", "v3.5" }});

                }
                return null;
            }
コード例 #38
0
 public static string HighlightToHTML(string source, LangType type)
 {
     return(HighlightToHTML(source, type, false));
 }
コード例 #39
0
ファイル: Demo.cs プロジェクト: BdR76/NppPluginLexerExample
        static internal void doInsertHtmlCloseTag(char newChar)
        {
            LangType docType = LangType.L_TEXT;

            Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTLANGTYPE, 0, ref docType);
            bool isDocTypeHTML = (docType == LangType.L_HTML || docType == LangType.L_XML || docType == LangType.L_PHP);

            if (!doCloseTag || !isDocTypeHTML)
            {
                return;
            }

            if (newChar != '>')
            {
                return;
            }

            int bufCapacity = 512;
            var pos         = editor.GetCurrentPos();
            int currentPos  = pos;
            int beginPos    = currentPos - (bufCapacity - 1);
            int startPos    = (beginPos > 0) ? beginPos : 0;
            int size        = currentPos - startPos;

            if (size < 3)
            {
                return;
            }

            using (TextRange tr = new TextRange(startPos, currentPos, bufCapacity))
            {
                editor.GetTextRange(tr);
                string buf = tr.lpstrText;

                if (buf[size - 2] == '/')
                {
                    return;
                }

                int pCur = size - 2;
                while ((pCur > 0) && (buf[pCur] != '<') && (buf[pCur] != '>'))
                {
                    pCur--;
                }

                if (buf[pCur] == '<')
                {
                    pCur++;

                    var insertString = new StringBuilder("</");

                    while (regex.IsMatch(buf[pCur].ToString()))
                    {
                        insertString.Append(buf[pCur]);
                        pCur++;
                    }
                    insertString.Append('>');

                    if (insertString.Length > 3)
                    {
                        editor.BeginUndoAction();
                        editor.ReplaceSel(insertString.ToString());
                        editor.SetSel(pos, pos);
                        editor.EndUndoAction();
                    }
                }
            }
        }
コード例 #40
0
    public static void LangLoad()
    {
        string jsonString;

#if UNITY_ANDROID && !UNITY_EDITOR
        string path   = Path.Combine(Application.streamingAssetsPath, "Languages/" + LangType.ToString().ToLower() + ".json");
        WWW    reader = new WWW(path);
        while (!reader.isDone)
        {
        }
        jsonString = reader.text.Trim();
#else
        jsonString = File.ReadAllText(Application.streamingAssetsPath + "/Languages/" + LangType.ToString().ToLower() + ".json");
#endif
        try
        {
            Language = JsonUtility.FromJson <Language>(jsonString);
        }
        catch (System.Exception ex)
        {
            GameObject.Find("InfoText").GetComponent <UnityEngine.UI.Text>().text = ex.ToString();
        }
        if (ChangeLanguage != null)
        {
            ChangeLanguage();
        }
    }
コード例 #41
0
 public int CalculateTotalCopyPrice(LangType langType) => Count * Copy * (langType == LangType.Fa_En ? CopyPrice : CopyPrice_OthersLang);
コード例 #42
0
ファイル: Highlighter.cs プロジェクト: ridhouan/teamlab.v6.5
 public static string HighlightToHTML(string source, LangType type)
 {
     return HighlightToHTML(source, type, false);
 }
コード例 #43
0
ファイル: XmlDataReader.cs プロジェクト: TommyAGK/Flex
        private void ReadWords(ref XmlNodeList node, LangType lang, int XmlLangIndex)
        {
            try
                            {
                            LangStrings[(int)lang, (int)LangWord.CustLang] = node[XmlLangIndex].SelectSingleNode("Lang").InnerText;
                            LangStrings[(int)lang, (int)LangWord.DayStart] = node[XmlLangIndex].SelectSingleNode("DayStart").InnerText;
                            LangStrings[(int)lang, (int)LangWord.LunchStart] = node[XmlLangIndex].SelectSingleNode("LunchStart").InnerText;
                            LangStrings[(int)lang, (int)LangWord.LunchEnd] = node[XmlLangIndex].SelectSingleNode("LunchEnd").InnerText;
                            LangStrings[(int)lang, (int)LangWord.DayEnd] = node[XmlLangIndex].SelectSingleNode("DayEnd").InnerText;
                            LangStrings[(int)lang, (int)LangWord.WeekEnd] = node[XmlLangIndex].SelectSingleNode("WeekEnd").InnerText;
                            LangStrings[(int)lang, (int)LangWord.ErrorFlex] = node[XmlLangIndex].SelectSingleNode("ErrorFlex").InnerText;
                            LangStrings[(int)lang, (int)LangWord.LunchComment] = node[XmlLangIndex].SelectSingleNode("LunchComment").InnerText;
                            LangStrings[(int)lang, (int)LangWord.SignOutComment] = node[XmlLangIndex].SelectSingleNode("SignOutComment").InnerText;
                            LangStrings[(int)lang, (int)LangWord.BufferTime] = node[XmlLangIndex].SelectSingleNode("BufferTime").InnerText;
                            LangStrings[(int)lang, (int)LangWord.DoubleLogin] = node[XmlLangIndex].SelectSingleNode("DoubleLogin").InnerText;
                            LangStrings[(int)lang, (int)LangWord.DoubleLunch] = node[XmlLangIndex].SelectSingleNode("DoubleLunch").InnerText;
                            LangStrings[(int)lang, (int)LangWord.TooSoon] = node[XmlLangIndex].SelectSingleNode("TooSoon").InnerText;
                            LangStrings[(int)lang, (int)LangWord.NoEntryThisHour] = node[XmlLangIndex].SelectSingleNode("NoEntryThisHour").InnerText;
                            LangStrings[(int)lang, (int)LangWord.UnExpectedError9000] = node[XmlLangIndex].SelectSingleNode("UnExpectedError9000").InnerText;

                            }
                        catch (Exception)
                            {
                                Speaker sp = new Speaker();
                                sp.Speak("Error Reading XML language file");

                            }
        }
コード例 #44
0
 public static extern IntPtr SendMessage(IntPtr hWnd, NppMsg Msg, int wParam, ref LangType lParam);
コード例 #45
0
 public static string GetLangExt(LangType langType)
 {
     return(GetLangExt(langType.ToString()));
 }