当前位置: 首页>>代码示例>>C#>>正文


C# Properties.getKeyset方法代码示例

本文整理汇总了C#中Properties.getKeyset方法的典型用法代码示例。如果您正苦于以下问题:C# Properties.getKeyset方法的具体用法?C# Properties.getKeyset怎么用?C# Properties.getKeyset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Properties的用法示例。


在下文中一共展示了Properties.getKeyset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: appendstrings

    /**
     * Loads the strings of the application from the given set of XML properties
     * files.
     *
     * @param languageFiles
     *            List with the names of the file containing the text
     */
    //public static void loadstrings(string[] languageFiles)
    //{
    //    if (languageFiles != null && languageFiles.length > 0)
    //    {
    //        loadstrings(languageFiles[0]);
    //        for (int i = 1; i < languageFiles.length; i++)
    //            appendstrings(languageFiles[i]);
    //    }
    //    else {
    //        guistrings = new Properties();
    //    }
    //}
    /**
     * Loads the strings of the application from the given set of XML properties
     * files.
     *
     * @param languageFiles
     *            List with the names of the file containing the text
     */
    //public static void loadstrings(InputStream[] languageFiles)
    //{
    //    if (languageFiles != null && languageFiles.length > 0)
    //    {
    //        loadstrings(languageFiles[0]);
    //        for (int i = 1; i < languageFiles.length; i++)
    //            appendstrings(languageFiles[i]);
    //    }
    //    else {
    //        guistrings = new Properties();
    //    }
    //}
    /**
     * Loads the strings of the application from the given XML properties file.
     *
     * @param languageFile
     *            Name of the file containing the text
     */
    //public static void loadstrings(InputStream languageFile)
    //{
    //    guistrings = new Properties();
    //    try
    //    {
    //        guistrings.loadFromXML(languageFile);
    //    }
    //    // If the file is bad formed
    //    catch (InvalidPropertiesFormatException e)
    //    {
    //        JOptionPane.showMessageDialog(null, "The language file is bad-formed, please try to use another language file.\nAlthough you may still be able to use the adventure editor, you might get occasional problems or get some unreadable texts.\nIf you get this error again, please try reinstalling the application.", "Error loading the language file", JOptionPane.ERROR_MESSAGE);
    //    }
    //    // If the file was not found
    //    catch (FileNotFoundException e)
    //    {
    //        JOptionPane.showMessageDialog(null, "The language file was not found, please verify that the language files are on the disk.\nAlthough you may still be able to use the adventure editor, you might get occasional problems or get some unreadable texts.\nIf you get this error again, please try reinstalling the application.", "Error loading the language file", JOptionPane.ERROR_MESSAGE);
    //    }
    //    // If there was a I/O exception
    //    catch (IOException e)
    //    {
    //        JOptionPane.showMessageDialog(null, "There has been an error loading the language file, please check for problem accessing the files.\nAlthough you may still be able to use the adventure editor, you might get occasional problems or get some unreadable texts.\nIf you get this error again, please try reinstalling the application.", "Error loading the language file", JOptionPane.ERROR_MESSAGE);
    //    }
    //}
    /**
     * Loads the language file specified as argument but does not clear the
     * properties structure, appending both contents. The results are equivalent
     * to: properties = properties.append(propertiesFromNewFile)
     */
    //public static void appendstrings(string languageFile)
    //{
    //    try
    //    {
    //        appendstrings(languageFile);
    //    }
    //    catch (FileNotFoundException e)
    //    {
    //        Debug.Log(
    //            "One of the language file required was not found, please verify that the language files are on the disk.\nAlthough you may still be able to use the adventure editor, you might get occasional problems or get some unreadable texts.\nIf you get this error again, please try reinstalling the application.\n Error loading the language file");
    //    }
    //}
    /**
     * Loads the language file specified as argument but does not clear the
     * properties structure, appending both contents. The results are equivalent
     * to: properties = properties.append(propertiesFromNewFile)
     */
    public static void appendstrings(string languageFile)
    {
        try
        {
            Properties newstrings = new Properties(languageFile);
            foreach (string key in newstrings.getKeyset())
            {
                if (guistrings.ContainsKey(key))
                    guistrings.Remove(key);
                guistrings.Add(key, newstrings.getProperty(key));
            }
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:TC.cs


注:本文中的Properties.getKeyset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。