int.Parse(string)

Here are the examples of the csharp api class int.Parse(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: GridDomain
Source File: Collection_nested_property_upgrade_by_constructor.cs
public override SubObject_V2 Convert(SubObject_V1 value)
            {
                return new SubObject_V2(int.Parse(value.Name), value.Value);
            }

2. Example

Project: GridDomain
Source File: Nested_property_upgrade.cs
public override SubObject_V2 Convert(SubObject_V1 value)
            {
                return new SubObject_V2 {number = int.Parse(value.Name), Value = value.Value};
            }

3. Example

Project: GridDomain
Source File: Nested_property_upgrade_with_custom_constructor.cs
public override SubObject_V2 Convert(SubObject_V1 value)
            {
                return new SubObject_V2(int.Parse(value.Name), value.Value);
            }

4. Example

Project: GridDomain
Source File: Upgrade_object_in_property.cs
public override SubObject_V2 Convert(SubObject_V1 value)
            {
                return new SubObject_V2 {number = int.Parse(value.Name), Value = value.Value};
            }

5. Example

Project: ContinuousTests
Source File: GuiSettingsPage.cs
private void recentFilesCountTextBox_Validated(object sender, System.EventArgs e)
		{
			int count = int.Parse( recentFilesCountTextBox.Text );
			Services.RecentFiles.MaxFiles = count;
            if (count == 0)
                loadLastProjectCheckBox.Checked = false;
		}

6. Example

Project: ContinuousTests
Source File: TestID.cs
public static TestID Parse( string s )
		{
			int id = Int32.Parse( s );
			return new TestID( id );
		}

7. Example

Project: ContinuousTests
Source File: GuiSettingsPage.cs
private void recentFilesCountTextBox_Validated(object sender, System.EventArgs e)
		{
			int count = int.Parse( recentFilesCountTextBox.Text );
			Services.RecentFiles.MaxFiles = count;
            if (count == 0)
                loadLastProjectCheckBox.Checked = false;
		}

8. Example

Project: ContinuousTests
Source File: TestID.cs
public static TestID Parse( string s )
		{
			int id = Int32.Parse( s );
			return new TestID( id );
		}

9. Example

Project: ContinuousTests
Source File: GuiSettingsPage.cs
private void recentFilesCountTextBox_Validated(object sender, System.EventArgs e)
		{
			int count = int.Parse( recentFilesCountTextBox.Text );
			Services.RecentFiles.MaxFiles = count;
            if (count == 0)
                loadLastProjectCheckBox.Checked = false;
		}

10. Example

Project: ContinuousTests
Source File: TestID.cs
public static TestID Parse( string s )
		{
			int id = Int32.Parse( s );
			return new TestID( id );
		}

11. Example

Project: tracer
Source File: OutParamClass.cs
public void SetParamInt(string input, out int mypara)
        {
            mypara = Int32.Parse(input);
        }

12. Example

Project: tracer
Source File: OutParamClass.cs
public void SetParamInt(string input, out int mypara)
        {
            mypara = Int32.Parse(input);
        }

13. Example

Project: tracer
Source File: OutParamClass.cs
public void SetParamInt(string input, out int mypara)
        {
            mypara = Int32.Parse(input);
        }

14. Example

Project: Unity3D.Amqp
Source File: Program.cs
public static Binding GetBinding() {
            //return new WSHttpBinding();

            return new RabbitMQBinding(System.Configuration.ConfigurationManager.AppSettings["manual-test-broker-hostname"],
                                       int.Parse(System.Configuration.ConfigurationManager.AppSettings["manual-test-broker-port"]),
                                       RabbitMQ.Client.Protocols.DefaultProtocol);
        }

15. Example

Project: Unity3D.Amqp
Source File: Program.cs
public static Binding GetBinding() {
            //return new WSHttpBinding();

            return new RabbitMQBinding(System.Configuration.ConfigurationManager.AppSettings["manual-test-broker-hostname"],
                                       int.Parse(System.Configuration.ConfigurationManager.AppSettings["manual-test-broker-port"]),
                                       RabbitMQ.Client.Protocols.DefaultProtocol);
        }

16. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "start/{id}")]
        public void StartWorkflow(string id)
        {
            WexflowWindowsService.WexflowEngine.StartWorkflow(int.Parse(id));
        }

17. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "stop/{id}")]
        public void StopWorkflow(string id)
        {
            WexflowWindowsService.WexflowEngine.StopWorkflow(int.Parse(id));
        }

18. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "suspend/{id}")]
        public void SuspendWorkflow(string id)
        {
            WexflowWindowsService.WexflowEngine.PauseWorkflow(int.Parse(id));
        }

19. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "resume/{id}")]
        public void ResumeWorkflow(string id)
        {
            WexflowWindowsService.WexflowEngine.ResumeWorkflow(int.Parse(id));
        }

20. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "workflow/{id}")]
        public WorkflowInfo GetWorkflow(string id)
        {
            var wf = WexflowWindowsService.WexflowEngine.GetWorkflow(int.Parse(id));
            if (wf != null)
            {
                return new WorkflowInfo(wf.Id, wf.Name, (LaunchType) wf.LaunchType, wf.IsEnabled, wf.Description,
                    wf.IsRunning, wf.IsPaused, wf.Period.ToString(@"dd\.hh\:mm\:ss") , wf.WorkflowFilePath, wf.IsExecutionGraphEmpty);
            }

            return null;
        }

21. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "xml/{id}")]
        public string GetWorkflowXml(string id)
        {
            var wf = WexflowWindowsService.WexflowEngine.GetWorkflow(int.Parse(id));
            if (wf != null)
            {
                return wf.XDoc.ToString();
            }
            return string.Empty;
        }

22. Example

Project: Wexflow
Source File: WexflowService.cs
[WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "isWorkflowIdValid/{id}")]
        public bool IsWorkflowIdValid(string id)
        {
            var workflowId = int.Parse(id);
            foreach (var workflow in WexflowWindowsService.WexflowEngine.Workflows)
            {
                if (workflow.Id == workflowId) return false;
            }
            return true;
        }

23. Example

Project: RoslynPad
Source File: HostProgram.cs
private static void Main(string[] args)
        {
            if (args.Length != 3) return;
            ExecutionHost.RunServer(args[0], args[1], int.Parse(args[2]));
        }

24. Example

Project: mcs-ICodeCompiler
Source File: settings.cs
void SetWarningLevel (string s, CompilerSettings settings)
		{
			int level = -1;

			try {
				level = int.Parse (s);
			} catch {
			}
			if (level < 0 || level > 4) {
				report.Error (1900, "Warning level must be in the range 0-4");
				return;
			}
			settings.WarningLevel = level;
		}

25. Example

Project: dataexplorer
Source File: StringToIntegerConverter.cs
public object Convert(object source)
        {
            if ((string) source == string.Empty)
                return null;

            return Int32.Parse((string) source);
        }

26. Example

Project: Extend
Source File: String.ToInt32.cs
[Pure]
        [PublicAPI]
        public static Int32 ToInt32( [NotNull] this String value )
        {
            value.ThrowIfNull( nameof(value) );

            return Int32.Parse( value );
        }

27. Example

Project: SharpNative
Source File: test-211.cs
public static int Main ()
	{
		int a = 5;
		Y y = (Y) (X) a;

		//.
		// Compile this:
		//

		int b = (System.Int32)int.Parse ("1");
		return 0;
	}

28. Example

Project: SharpNative
Source File: gtest-256.cs
public IEnumerator<string> GetEnumerator ()
	{
		yield return "TEST";
		try {
			int.Parse (arg);
		} catch {
			yield break;
		}
		yield return "TEST2";
	}

29. Example

Project: DOLSharp
Source File: ConfigElement.cs
public int GetInt()
		{
			return int.Parse(_value ?? "0");
		}

30. Example

Project: DOLSharp
Source File: ConfigElement.cs
public int GetInt(int defaultValue)
		{
			return _value != null ? int.Parse(_value) : defaultValue;
		}

31. Example

Project: DOLSharp
Source File: gmrelic.cs
public void OnCommand(GameClient client, string[] args)
		{
			if (args.Length != 3 || (args[1] != "magic" && args[1] != "strength"))
			{
				DisplaySyntax(client);
				return;
			}

			DBRelic relic = new DBRelic();

			relic.Heading = client.Player.Heading;
			relic.OriginalRealm = int.Parse(args[2]);
			relic.Realm = 0;
			relic.Region = client.Player.CurrentRegionID;
			relic.relicType = (args[1] == "strength") ? 0 : 1;
			relic.X = client.Player.X;
			relic.Y = client.Player.Y;
			relic.Z = client.Player.Z;
			relic.RelicID = Util.Random(100);
			GameServer.Database.AddObject(relic);
			RelicMgr.Init();
		}

32. Example

Project: DOLSharp
Source File: mob.cs
private void aggro(GameClient client, GameNPC targetMob, string[] args)
		{
			int aggroLevel;

			try
			{
				aggroLevel = int.Parse(args[2]);
			}
			catch (Exception)
			{
				DisplaySyntax(client, args[1]);
				return;
			}

			if (targetMob.Brain is IOldAggressiveBrain)
			{
				((IOldAggressiveBrain)targetMob.Brain).AggroLevel = aggroLevel;
				targetMob.SaveIntoDatabase();
				DisplayMessage(client, "Mob aggro changed to " + aggroLevel);
			}
			else
				DisplayMessage(client, "Selected mob does not have an aggressive brain.");
		}

33. Example

Project: DOLSharp
Source File: mob.cs
private void range(GameClient client, GameNPC targetMob, string[] args)
		{
			try
			{
				IOldAggressiveBrain aggroBrain = targetMob.Brain as IOldAggressiveBrain;

				if (aggroBrain != null)
				{
					int range = int.Parse(args[2]);
					aggroBrain.AggroRange = range;
					targetMob.SaveIntoDatabase();
					DisplayMessage(client, "Mob aggro range changed to {0}", aggroBrain.AggroRange);
				}
				else
				{
					DisplayMessage(client, "Selected mob does not have an aggressive brain.");
				}
			}
			catch
			{
				DisplaySyntax(client, args[1]);
				return;
			}
		}

34. Example

Project: DOLSharp
Source File: path.cs
private void PathSpeed(GameClient client, string[] args)
		{
			int speedlimit = 80;

			if (args.Length < 3)
			{
				DisplayMessage(client, "No valid speedlimit '{0}'!", args[2]);
				return;
			}

			try
			{
				speedlimit = int.Parse(args[2]);
			}
			catch
			{
				DisplayMessage(client, "No valid speedlimit '{0}'!", args[2]);
				return;
			}

			PathPoint pathpoint = (PathPoint)client.Player.TempProperties.getProperty<object>(TEMP_PATH_FIRST, null);

			if (pathpoint == null)
			{
				DisplayMessage(client, "No path created yet! Use /path create first!");
				return;
			}

			pathpoint.MaxSpeed = speedlimit;

			while (pathpoint.Next != null)
			{
				pathpoint = pathpoint.Next;
				pathpoint.MaxSpeed = speedlimit;
			}

			DisplayMessage(client, "All path points set to speed {0}!", args[2]);
		}

35. Example

Project: DOLSharp
Source File: houseface.cs
public void OnCommand(GameClient client, string[] args)
		{
			int housenumber = 0;
			if (args.Length > 1)
			{
				try
				{
					housenumber = int.Parse(args[1]);
				}
				catch
				{
					DisplaySyntax(client);
					return;
				}
			}
			else HouseMgr.GetHouseNumberByPlayer(client.Player);

			if (housenumber == 0)
			{
				DisplayMessage(client, "No house found.");
				return;
			}

			House house = HouseMgr.GetHouse(housenumber);

			ushort direction = client.Player.GetHeading(house);
			client.Player.Heading = direction;
			client.Out.SendPlayerJump(true);
			DisplayMessage(client, "You face house " + housenumber);
		}

36. Example

Project: DOLSharp
Source File: settitle.cs
public void OnCommand(GameClient client, string[] args)
		{
			if (IsSpammingCommand(client.Player, "settitle"))
				return;

			int index = -1;
			if (args.Length > 1)
			{
				try { index = int.Parse(args[1]); }
				catch { }

				IPlayerTitle current = client.Player.CurrentTitle;
				if (current != null && current.IsForced(client.Player))
					client.Out.SendMessage("You cannot change the current title.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				else
				{
					var titles = client.Player.Titles.ToArray();
					if (index < 0 || index >= titles.Length)
						client.Player.CurrentTitle = PlayerTitleMgr.ClearTitle;
					else
						client.Player.CurrentTitle = (IPlayerTitle)titles[index];
				}
			}
			else
			{
				client.Out.SendPlayerTitles();
			}
		}

37. Example

Project: CloudNotes
Source File: BooleanValue.cs
public static BooleanValue XmlToValue(XElement type_el)
		{
			int num = int.Parse(type_el.Value);
			bool value = num != 0;
			return new BooleanValue(value);
		}

38. Example

Project: CloudNotes
Source File: IntegerValue.cs
public static IntegerValue XmlToValue(XElement parent)
		{
			return new IntegerValue(int.Parse(parent.Value));
		}

39. Example

Project: daxnet-blog
Source File: XmlRpcService.cs
private List<object> ParseInt(XElement type)
    {
      return new List<object> { int.Parse(type.Value) };
    }

40. Example

Project: hfmcmd
Source File: ProcessFlow.cs
protected void GetGroupPhase(POV pov, out int group, out int phase)
        {
            string sGroup = null, sPhase = null;
            if(HFM.HasVariableCustoms) {
#if HFM_11_1_2_2
                HFM.Try("Retrieving submission group and phase",
                        () => _hsvProcessFlow.GetGroupPhaseFromCellExtDim(pov.HfmPovCOM,
                                     out sGroup, out sPhase));
#else
                HFM.ThrowIncompatibleLibraryEx();
#endif
            }
            else {
                HFM.Try("Retrieving submission group and phase",
                        () => _hsvProcessFlow.GetGroupPhaseFromCell(pov.Scenario.Id, pov.Year.Id,
                                     pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id,
                                     pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id,
                                     pov.Custom3.Id, pov.Custom4.Id, out sGroup, out sPhase));
            }
            group = int.Parse(sGroup);
            phase = int.Parse(sPhase);
        }

41. Example

Project: OutlookPrivacyPlugin
Source File: GeneralName.cs
private void parseIPv4Mask(string mask, byte[] addr, int offset)
		{
			int maskVal = Int32.Parse(mask);

			for (int i = 0; i != maskVal; i++)
			{
				addr[(i / 8) + offset] |= (byte)(1 << (i % 8));
			}
		}

42. Example

Project: OutlookPrivacyPlugin
Source File: GeneralName.cs
private int[] parseMask(string mask)
		{
			int[] res = new int[8];
			int   maskVal = Int32.Parse(mask);

			for (int i = 0; i != maskVal; i++)
			{
				res[i / 16] |= 1 << (i % 16);
			}
			return res;
		}

43. Example

Project: OutlookPrivacyPlugin
Source File: IPAddress.cs
private static bool IsMaskValue(
			string	component,
			int		size)
		{
			int val = Int32.Parse(component);
			try
			{
				return val >= 0 && val <= size;
			}
			catch (FormatException) {}
			catch (OverflowException) {}
			return false;
		}

44. Example

Project: ReadableExpressions
Source File: WhenTranslatingLambdas.cs
[TestMethod]
        public void ShouldTranslateAMultipleParameterLambda()
        {
            Expression<Func<string, string, int>> convertStringsToInt = (str1, str2) => int.Parse(str1) + int.Parse(str2);

            var translated = convertStringsToInt.ToReadableString();

            Assert.AreEqual("(str1, str2) => int.Parse(str1) + int.Parse(str2)", translated);
        }

45. Example

Project: Phalanger
Source File: Utils.CLR.cs
public static int ParseInteger(string value, int min, int max, XmlNode node)
		{
			int result;
			try
			{
				result = Int32.Parse(value);
			}
			catch (System.Exception e)
			{
				throw new ConfigurationErrorsException(e.Message, node);
			}

			if (result < min || result > max)
				throw new ConfigurationErrorsException(CoreResources.GetString("out_of_range", min, max), node);

			return result;
		}

46. Example

Project: Widget-Manager---Unity3D
Source File: EditorDisplayButton.cs
private void DrawVec3Actor() 
    {
        GUI.color = Color.yellow;
        if (LoopType == eeGame/n ..... /n //View Source file for more details /n }

47. Example

Project: HL7Fuse
Source File: EndPointConfigurationHandler.cs
private IEndPoint GetMLLPClientEndPoint(XmlNode node)
        {
            string host = node.Attributes["host"].Value;
            int port = int.Parse(node.Attributes["port"].Value);
            string serverCommunicationName = node.Attributes["serverCommunicationName"].Value;
            string serverEnvironment = node.Attributes["serverEnvironment"].Value;

            return new MLLPClientEndPoint(host, port, serverCommunicationName, serverEnvironment);
        }

48. Example

Project: prologdotnet
Source File: CallInstruction.cs
public override void Process(object[] arguments)
        {
            _arguments = arguments;
            _label = (string)arguments[0];
            _arity = Int32.Parse((string)arguments[1]);
        }

49. Example

Project: prologdotnet
Source File: ExecuteInstruction.cs
public override void Process(object[] arguments)
        {
            _arguments = arguments;
            _label = (string)arguments[0];
            _arity = Int32.Parse((string)arguments[1]);
        }

50. Example

Project: prologdotnet
Source File: ProcedureInstruction.cs
public override void Process(object[] arguments)
        {
            _procedureName = (string)arguments[0];
            _arity = Int32.Parse((string)arguments[1]);
        }