예제 #1
0
        /// <summary>
        /// Methode DoMap uses the class <see cref="DSMap"/> to get the mapped name of the giving Guid
        /// </summary>
        public void DoMap()
        {
            DisplayHeader();

            if (CheckParameter(args, mapParam))
            {
                DSMap dsMap = new DSMap(mapParam);
                try
                {
                    mapParam = dsMap.DoMapSchema();
                }
                catch (DSBindingException dsEx)
                {
                    DisplayErrorMsg(dsEx.Message);
                    mapParam = null;
                }
                catch (Exception ex)
                {
                    DisplayErrorMsg(ex.Message);
                    mapParam = null;
                }

                if (mapParam != null)
                {
                    DisplayMap(mapParam);
                }
            }
            else
            {
                DisplayHelp();
            }
        }
예제 #2
0
        /// <summary>
        /// Methode CheckParameter checkt the arguments of the command line and put them in mapParam
        /// if everything is alright. CheckParameter use the Parameter Class <see cref="Parameter"/>
        /// </summary>
        /// <param name="args"></param>
        /// <param name="mapParam"></param>
        /// <returns></returns>
        private bool CheckParameter(string[] args, MapParam mapParam)
        {
            const string DOMAINCON = "dc";
            const string DOMAIN    = "domain";
            const string GUID      = "guid";
            const string HELP      = "?";

            string errMsg = "";
            bool   error  = false;


            bool helpAsked = false;

            Parameter CommandLine = new Parameter(args);

            if (CommandLine[DOMAINCON] != null)
            {
                mapParam.DomainCon = CommandLine[DOMAINCON];
            }
            else
            {
                errMsg += "Domain Controller nicht definiert!\n";
            }

            if (CommandLine[DOMAIN] != null)
            {
                mapParam.Domain = CommandLine[DOMAIN];
            }
            else
            {
                errMsg += "Domain nicht definiert!\n";
            }

            if (CommandLine[GUID] != null)
            {
                mapParam.GuId = CommandLine[GUID];
            }
            else
            {
                errMsg += "GuID nicht definiert!\n";
            }

            helpAsked = CommandLine[HELP] != null;

            error = !string.IsNullOrEmpty(errMsg);

            if (helpAsked)
            {
                DisplayHelp();
            }
            else if (error)
            {
                DisplayParameterError(errMsg);
            }

            return(!error);
        }
예제 #3
0
        /// <summary>
        /// Function DisplayMap display the mapping of the <see cref="MapParam"/> object
        /// </summary>
        /// <param name="mapParam"></param>
        private void DisplayMap(MapParam mapParam)
        {
            Console.WriteLine();
            Console.WriteLine("GUID: {0}", mapParam.GuId);
            Console.WriteLine("Anzeigename: {0}", mapParam.DisplayName);
#if DEBUG
            Console.ReadKey();
#endif
        }