From 52758d6ab4138dfa7cfe57e7b1ba10c6c085cb0f Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 15 Feb 2007 15:13:37 +0000 Subject: Renommé à distance --- getoptOLD/Arg.cs | 15 ++++++ getoptOLD/GetOpt.cs | 98 +++++++++++++++++++++++++++++++++++++ getoptOLD/getopt.csproj | 106 +++++++++++++++++++++++++++++++++++++++++ getoptOLD/getopt.csproj.user | 58 ++++++++++++++++++++++ getoptOLD/getopt.csproj.vspscc | 10 ++++ getoptOLD/getopt.sln | 19 ++++++++ getoptOLD/getopt.suo | Bin 0 -> 14336 bytes getoptOLD/mssccprj.scc | 5 ++ getoptOLD/vssver2.scc | Bin 0 -> 164 bytes 9 files changed, 311 insertions(+) create mode 100644 getoptOLD/Arg.cs create mode 100644 getoptOLD/GetOpt.cs create mode 100644 getoptOLD/getopt.csproj create mode 100644 getoptOLD/getopt.csproj.user create mode 100644 getoptOLD/getopt.csproj.vspscc create mode 100644 getoptOLD/getopt.sln create mode 100644 getoptOLD/getopt.suo create mode 100644 getoptOLD/mssccprj.scc create mode 100644 getoptOLD/vssver2.scc (limited to 'getoptOLD') diff --git a/getoptOLD/Arg.cs b/getoptOLD/Arg.cs new file mode 100644 index 0000000..0b86cad --- /dev/null +++ b/getoptOLD/Arg.cs @@ -0,0 +1,15 @@ +using System; + +namespace Gnu +{ + /// + /// An argument for GetOpt + /// + public class Arg + { + public char Flag; + public bool TakesParameter = false; + + public string Parameter = ""; + } +} diff --git a/getoptOLD/GetOpt.cs b/getoptOLD/GetOpt.cs new file mode 100644 index 0000000..a158073 --- /dev/null +++ b/getoptOLD/GetOpt.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Specialized; +using System.Collections.Generic; + +namespace Gnu +{ + /// + /// An implementation of the getopt standard, as used by Gnu GetOpt + /// + public class GetOpt + { + StringCollection m_params = new StringCollection(); + StringCollection m_extras = new StringCollection(); + List m_args = new List(); + + public GetOpt(string[] CommandLineArgs, string ParametersDescription) + { + // Import the string array into the collection + foreach(string s in CommandLineArgs) + { + m_params.Add(s); + } + + // Parse the params description + for(int i = 0; i < ParametersDescription.Length; i++) + { + Arg a = new Arg(); + a.Flag = ParametersDescription[i]; + if((ParametersDescription.Length > i + 1) && (ParametersDescription[i + 1] == ':')) + { + a.TakesParameter = true; + i++; + } + + m_args.Add(a); + } + } + + public Arg NextArg() + { + SnarfExtras(); + + if(m_params.Count == 0) + return null; + + foreach(Arg a in m_args) + { + if(a.Flag == m_params[0][1] && m_params[0][0] == '-' ) + { + Arg matched = a; + try + { + if(a.TakesParameter) + { + matched.Parameter = m_params[1]; + m_params.RemoveAt(1); + } + } + catch(Exception) + { + } + + m_params.RemoveAt(0); + return matched; + } + } + + if(m_params[0][0] == '-') + { + Arg tempa = new Arg(); + tempa.Flag = m_params[0][1]; + tempa.TakesParameter = false; + return tempa; + } + return null; + } + + public StringCollection Extras + { + get + { + SnarfExtras(); + + return m_extras; + } + } + + private void SnarfExtras() + { + // Parameters must start with a hyphen + while((m_params.Count > 0) && (m_params[0][0] != '-')) + { + m_extras.Add(m_params[0]); + m_params.RemoveAt(0); + } + } + } +} diff --git a/getoptOLD/getopt.csproj b/getoptOLD/getopt.csproj new file mode 100644 index 0000000..3cca427 --- /dev/null +++ b/getoptOLD/getopt.csproj @@ -0,0 +1,106 @@ + + + Local + 8.0.50727 + 2.0 + {228B5F0B-31AE-488F-A916-B7CBB269D25F} + Debug + AnyCPU + + + + + getopt + + + JScript + Grid + IE50 + false + Library + getopt + OnBuildSuccess + + + + + + + SAK + SAK + SAK + SAK + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.XML + + + + + Code + + + Code + + + + + + + + + + \ No newline at end of file diff --git a/getoptOLD/getopt.csproj.user b/getoptOLD/getopt.csproj.user new file mode 100644 index 0000000..cfcf828 --- /dev/null +++ b/getoptOLD/getopt.csproj.user @@ -0,0 +1,58 @@ + + + 7.10.3077 + Debug + AnyCPU + + + + + + + 0 + ProjectFiles + 0 + + + false + false + false + false + false + + + Project + + + + + + + + + + + true + + + false + false + false + false + false + + + Project + + + + + + + + + + + false + + \ No newline at end of file diff --git a/getoptOLD/getopt.csproj.vspscc b/getoptOLD/getopt.csproj.vspscc new file mode 100644 index 0000000..feffdec --- /dev/null +++ b/getoptOLD/getopt.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/getoptOLD/getopt.sln b/getoptOLD/getopt.sln new file mode 100644 index 0000000..3dab7ec --- /dev/null +++ b/getoptOLD/getopt.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "getopt", "getopt.csproj", "{228B5F0B-31AE-488F-A916-B7CBB269D25F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {228B5F0B-31AE-488F-A916-B7CBB269D25F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {228B5F0B-31AE-488F-A916-B7CBB269D25F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {228B5F0B-31AE-488F-A916-B7CBB269D25F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {228B5F0B-31AE-488F-A916-B7CBB269D25F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/getoptOLD/getopt.suo b/getoptOLD/getopt.suo new file mode 100644 index 0000000..fc0301d Binary files /dev/null and b/getoptOLD/getopt.suo differ diff --git a/getoptOLD/mssccprj.scc b/getoptOLD/mssccprj.scc new file mode 100644 index 0000000..2aeb91c --- /dev/null +++ b/getoptOLD/mssccprj.scc @@ -0,0 +1,5 @@ +SCC = This is a Source Code Control file + +[getopt.csproj] +SCC_Aux_Path = "C:\Users\fcolin\Documents\Visual Source Safe" +SCC_Project_Name = "$/CSharp/getopt", RBIAAAAA diff --git a/getoptOLD/vssver2.scc b/getoptOLD/vssver2.scc new file mode 100644 index 0000000..44d6a95 Binary files /dev/null and b/getoptOLD/vssver2.scc differ -- cgit v1.1