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


C# Properties.getProperty方法代码示例

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


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

示例1: Main

        public static void Main(string[] args)
        {
            Properties pps = new Properties();

            if ( System.IO.File.Exists(DEFAULT_FILE) )
                LoadLeapPropertiesFile();
            else
                p = new ProfileImpl();

            if (args.Length > 0)
            {
                pps = jade.Boot.parseCmdLineArgs(args);

                if (pps != null)
                {
                    java.util.Enumeration en = pps.keys();
                    while ( en.hasMoreElements() )
                    {
                        string key = (string) en.nextElement();
                        string prop = pps.getProperty(key);
                        p.setParameter(key, prop);
                    }//End WHILE block
                }//End IF block
            }//End IF block

            /* VERSIONE 3.2 */
            jade.wrapper.AgentContainer mc = null;
            /* VERSIONE 3.1 */
            //jade.wrapper.MainContainer mc = null;

            try
            {
                if (p.getParameter("main", "true").Equals("false"))
                    mc = Runtime.instance().createAgentContainer(p);
                else
                    mc = Runtime.instance().createMainContainer(p);
            }
            catch(Exception exc)
            {
                Console.WriteLine( "\n----------- INIZIO ECCEZIONE ------------------" );
                Console.WriteLine( exc.Message );
                Console.WriteLine( exc.InnerException );
                Console.WriteLine( "\n----------- FINE ECCEZIONE ------------------" );
            }
            Console.ReadLine();
        }
开发者ID:hoang8f,项目名称:wifi-direct-chat,代码行数:46,代码来源:AgentBooterCSharp.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        props = new Properties(filename);
        Camera.main.orthographicSize = System.Convert.ToSingle(props.getProperty("cameraSize"));
        float offset = Camera.main.aspect * Camera.main.orthographicSize;
        float cameraX = System.Convert.ToSingle(props.getProperty("cameraX"));
        float cameraY = System.Convert.ToSingle(props.getProperty("cameraY"));
        float cameraZ = System.Convert.ToSingle(props.getProperty("cameraZ"));
        int cameraNumber = System.Convert.ToInt32(props.getProperty("cameraNumber"));
        //Camera.main.transform.position = new Vector3(cameraX, cameraY, cameraZ);
        if(cameraNumber == 0){				// server camera
            Camera.main.transform.position = new Vector3(cameraX, cameraY, cameraZ);
        } else if(cameraNumber == 1){	// #1 client camera
            Camera.main.transform.position = new Vector3(0 - offset, cameraY, cameraZ);
        } else if(cameraNumber == 2){	// #2 client camera
            Camera.main.transform.position = new Vector3(offset, cameraY, cameraZ);
        }

        float cameraRoll = System.Convert.ToSingle(props.getProperty("cameraRoll"));
        float cameraPitch = System.Convert.ToSingle(props.getProperty("cameraPitch"));
        float cameraYaw = System.Convert.ToSingle(props.getProperty("cameraYaw"));
        Camera.main.transform.Rotate(cameraPitch, cameraYaw, cameraRoll);
    }
开发者ID:damonseeley,项目名称:electroland_repos,代码行数:24,代码来源:SystemProperties.cs

示例3: getControllers

 /**
  * Creates a vector of SampleController plugins.
  *
  * @param properties
  *            The properties with information about the samplers
  * @return The Controllers value
  */
 // TODO - does not appear to be called directly
 public static Vector<Object> getControllers(Properties properties)
 {
     String name = "controller."; // $NON-NLS-1$
     Vector<Object> v = new Vector<Object>();
     Enumeration<?> names = properties.keys();
     while (names.hasMoreElements()) {
         String prop = (String) names.nextElement();
         if (prop.startsWith(name)) {
             Object o = instantiate(properties.getProperty(prop),
                     "org.apache.jmeter.control.SamplerController"); // $NON-NLS-1$
             v.addElement(o);
         }
     }
     return v;
 }
开发者ID:RalphC,项目名称:NetMeter,代码行数:23,代码来源:NetMeterUtils.cs

示例4: GenericADODataModel

		/**
		 * <p>Specifies all SQL queries in a {@link Properties} object. See the <code>*_KEY</code>
		 * constants in this class (e.g. {@link #GET_USER_SQL_KEY}) for a list of all keys which
		 * must map to a value in this object.</p>
		 *
		 * @param props {@link Properties} object containing values
		 * @if anything goes wrong during initialization
		 */
		public GenericADODataModel(Properties props)
            :	base(            
			      props.getProperty(GET_USER_SQL_KEY),
			      props.getProperty(GET_NUM_USERS_SQL_KEY),
			      props.getProperty(GET_NUM_ITEMS_SQL_KEY),
			      props.getProperty(SET_PREFERENCE_SQL_KEY),
				  props.getProperty(REMOVE_PREFERENCE_SQL_KEY),
			      props.getProperty(GET_USERS_SQL_KEY),
			      props.getProperty(GET_ITEMS_SQL_KEY),
			      props.getProperty(GET_ITEM_SQL_KEY),
			      props.getProperty(GET_PREFS_FOR_ITEM_SQL_KEY),
			      props.getProperty(GET_USERS_PREFERRING_ITEM_SQL_KEY))

		{
            this.ConnectionString = props.getProperty(CONNECTION_STRING_KEY);
		}
开发者ID:ccollie,项目名称:taste.net,代码行数:24,代码来源:GenericADODataModel.cs

示例5: 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

示例6: Main

        public static void Main(string[] args)
        {
            Properties arguments = new Properties();
            string error = "";
            bool ok = args.Length > 0;

            if (ok)
            {
                arguments.setProperty("Trace", "Off");
                arguments.setProperty("Rule", "xri");

                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].Equals("-trace"))
                        arguments.setProperty("Trace", "On");
                    else if (args[i].Equals("-visitor"))
                        arguments.setProperty("Visitor", args[++i]);
                    else if (args[i].Equals("-file"))
                        arguments.setProperty("File", args[++i]);
                    else if (args[i].Equals("-string"))
                        arguments.setProperty("String", args[++i]);
                    else if (args[i].Equals("-rule"))
                        arguments.setProperty("Rule", args[++i]);
                    else
                    {
                        error = "unknown argument: " + args[i];
                        ok = false;
                    }
                }
            }

            if (arguments.getProperty("File") == null &&
                arguments.getProperty("String") == null)
            {
                error = "insufficient arguments";
                ok = false;
            }

            if (!ok)
            {
                Logger.Info("error: " + error);
                Logger.Info("usage: Parser [-rule rulename] [-trace] <-file file | -string string> [-visitor visitor]");
            }
            else
            {
                try
                {
                    Parser parser = new Parser();
                    Rule rule = null;

                    parser.traceOff();
                    if (arguments.getProperty("Trace").Equals("On"))
                        parser.traceOn();

                    if (arguments.getProperty("File") != null)
                        rule = parser.parse(arguments.getProperty("Rule"), File.OpenRead(arguments.getProperty("File")));
                    else if (arguments.getProperty("String") != null)
                        rule = parser.parse(arguments.getProperty("Rule"), arguments.getProperty("String"));

                    if (arguments.getProperty("Visitor") != null)
                    {
                        Visitor visitor =
                          (Visitor)Activator.CreateInstance(Type.GetType(arguments.getProperty("Visitor")));
                        visitor.visit(rule);
                    }
                }
                catch (ArgumentException e)
                {
                    Logger.Info("argument error: " + e.Message);
                }
                catch (IOException e)
                {
                    Logger.Info("io error: " + e.Message);
                }
                catch (ParserException e)
                {
                    Logger.Info("parser error: " + e.Message);
                }
                catch (TypeLoadException e)
                {
                    Logger.Info("visitor error: class not found - " + e.Message);
                }
                catch (MethodAccessException e)
                {
                    Logger.Info("visitor error: illegal access - " + e.Message);
                }
                catch (TargetInvocationException e)
                {
                    Logger.Info("visitor error: instantiation failure - " + e.Message);
                }
            }
        }
开发者ID:AArnott,项目名称:dotnetxri,代码行数:92,代码来源:Parser.cs


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