예제 #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Properties.Settings.Default.Reload();


            WorkingDirectory = Environment.CurrentDirectory;
            BatDir           = Path.Combine(WorkingDirectory, "Bat");
            // or: Directory.GetCurrentDirectory() gives the same result

            // This will get the current PROJECT directory
            string blogSiteRoot     = Properties.Settings.Default.BlogSiteRoot;
            string initblogSiteRoot = Properties.Settings.Default.CBlogSiteRoot;

            CategorisIn_data = Properties.Settings.Default.CategorisIn_data;

            //string blogSiteRoot = (string)Properties.Settings.Default["BlogSiteRoot"];
            //string initblogSiteRoot = (string)Properties.Settings.Default["CBlogSiteRoot"];
            //CategorisIn_data  = (bool)Properties.Settings.Default["CategorisIn_data"];

            if (blogSiteRoot == initblogSiteRoot)
            {
                firstRun = true;
            }
            else
            {
                firstRun = false;
            }
            if (firstRun)
            {
                frmSettings frmSettings = new frmSettings();
                frmSettings.ShowDialog();
            }

            BlogSiteRoot = blogSiteRoot;
            Layouts      = new List <string>();
            string layoutsFolder = Path.Combine(BlogSiteRoot, "_layouts");

            if (Directory.Exists(layoutsFolder))
            {
                string[] layoutsArray = Directory.GetFiles(layoutsFolder, "*.html");
                var      layoutnames  = from l in layoutsArray select Path.GetFileNameWithoutExtension(l);

                Layouts = layoutnames.ToList <string>();
                if (Layouts.Contains("post"))
                {
                    Layouts.Remove("postpage");
                    Layouts.Insert(0, "postpage");
                }
                if (Layouts.Contains("default"))
                {
                    Layouts.Remove("post");
                    Layouts.Insert(0, "post");
                }
                if (Layouts.Contains("default"))
                {
                    Layouts.Remove("default");
                    Layouts.Insert(0, "default");
                }
                if (Layouts.Contains("page"))
                {
                    Layouts.Remove("page");
                    Layouts.Insert(0, "page");
                }
            }
            if (Layouts.Count == 0)
            {
                Layouts.AddRange(new List <string>()
                {
                    "default", "page"
                });
            }

            if (Directory.Exists(BlogSiteRoot))
            {
                LoadYaml();
            }

            try
            {
                for (int i = 0; i < args.Length - 1; i = i + 2)
                {
                    switch (args[i].ToLower())
                    {
                    case "filename":
                    case "-fn":
                        srcFilename = args[i + 1];
                        srcPath     = Path.Combine(srcFilename, srcFilename);
                        break;

                    case "directory":
                    case "-d":
                        srcFolder = args[i + 1];
                        srcPath   = Path.Combine(srcFolder, srcFilename);
                        break;

                    case "path":
                    case "-p":
                        string pth = args[i + 1];
                        //MessageBox.Show(pth);
                        srcFilename = Path.GetFileName(pth);
                        //MessageBox.Show(srcFilename);
                        srcPath = Path.GetFullPath(srcFilename);
                        //MessageBox.Show(srcPath);
                        srcFolder = srcPath.Replace("\\" + srcFilename, "");
                        //MessageBox.Show(srcFolder);
                        break;

                    case "topic":
                    case "-t":
                        topic = args[i + 1];
                        break;

                    case "subtopic":
                    case "-st":
                        subTopic = args[i + 1];
                        break;

                    case "category":
                    case "-cat":
                        category = args[i + 1];
                        break;

                    case "categories":
                    case "-cats":
                        categories = args[i + 1];
                        break;

                    case "startFilter":
                    case "-sf":
                        startFilters = args[i + 1];
                        break;

                    case "skipFilter":
                    case "-skip":
                        skipFilters = args[i + 1];
                        break;

                    case "endFilter":
                    case "-ef":
                        endFilters = args[i + 1];
                        break;
                    }
                }
                Application.Run(new MDIParent1());
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSettings frmSettings = new frmSettings();

            frmSettings.ShowDialog();
        }