Beispiel #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// ParseOptions
        ///
        /// <summary>
        /// オプション引数を解析します。
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void ParseOptions(string[] args)
        {
            var sources = new List <string>();
            var options = new List <string>();

            for (var i = 1; i < args.Length; ++i)
            {
                if (!args[i].StartsWith("/"))
                {
                    sources.Add(args[i]);
                }
                else
                {
                    options.Add(args[i]);
                    if (args[i] == "/m")
                    {
                        Mail = true;
                    }
                    else if (args[i] == "/p")
                    {
                        Password = true;
                    }
                    else if (args[i] == "/sr")
                    {
                        SuppressRecursive = true;
                    }
                    else if (args[i].StartsWith("/o"))
                    {
                        Location = GetLocation(args[i]);
                    }
                    else if (args[i].StartsWith("/drop"))
                    {
                        DropDirectory = GetTail(args[i]);
                    }
                }
            }

            var droppable = Location == SaveLocation.Unknown ||
                            Location == SaveLocation.Source;

            if (DropDirectory.HasValue() && droppable)
            {
                Location = SaveLocation.Drop;
            }

            Sources = sources;
            Options = options;
        }
Beispiel #2
0
        static IMessage OpenAsCdoMessage(string filePath)
        {
            IMessages msgs  = new DropDirectory().GetMessages(Path.GetDirectoryName(filePath));
            IMessage  found = null;


            foreach (IMessage m in msgs)
            {
                if (msgs.get_FileName(m) == filePath)
                {
                    found = m;
                    break;
                }
            }


            if (found == null)
            {
                Console.WriteLine("Failed to find message {0}.", filePath);
                return(null);
            }

            return(found);
        }