Example #1
0
        /// <summary>检查指定目录下是否有同名静态库</summary>
        /// <param name="di"></param>
        /// <param name="root"></param>
        /// <returns></returns>
        private Boolean CheckPartial(DirectoryInfo di, String root)
        {
            var fi = di.GetAllFiles("*.lib;*.a").FirstOrDefault();

            if (fi != null && fi.Exists)
            {
                if (!Libs.Contains(fi.FullName))
                {
                    var lib = new LibFile(fi.FullName);
                    WriteLog("发现静态库:{0, -12} {1}".F(lib.Name, fi.FullName));
                    Libs.Add(fi.FullName);
                }
                return(true);
            }

            var p = di.Parent;

            if (p == null || p == di)
            {
                return(false);
            }
            // 截止到当前目录
            if (p.FullName.EnsureEnd("\\").EqualIgnoreCase(root.GetFullPath().EnsureEnd("\\")))
            {
                return(false);
            }

            return(CheckPartial(p, root));
        }
Example #2
0
        public override void LoadCurrent(Project prj)
        {
            var p = ManagedProject = prj as DProject;

            if (p == null)
            {
                return;
            }

            if (p.DMDVersion == DVersion.D1)
            {
                Combo_DVersion.SelectedIndex = 0;
            }
            else
            {
                Combo_DVersion.SelectedIndex = 1;
            }

            Check_Release.IsChecked = p.IsRelease;

            Libs.Clear();
            foreach (var l in p.LinkedLibraries)
            {
                Libs.Add(l);
            }

            if (Libs.Count > 0)
            {
                List_Libs.SelectedIndex = 0;
            }

            comboBox_PrjType.SelectedIndex = (int)p.OutputType;
        }
Example #3
0
        public override void LoadCurrent()
        {
            textBox_BaseDirectory.Text = Config.BaseDirectory;

            textBox_SrcCompiler.Text   = Config.SoureCompiler;
            textBox_Win32Linker.Text   = Config.Win32ExeLinker;
            textBox_ConsoleLinker.Text = Config.ExeLinker;
            textBox_DllLinker.Text     = Config.DllLinker;
            textBox_LibLinker.Text     = Config.LibLinker;

            Libs.Clear();
            foreach (var l in Config.DefaultLinkedLibraries)
            {
                Libs.Add(l);
            }

            if (Libs.Count > 0)
            {
                List_DefaultLibs.SelectedIndex = 0;
            }
        }
Example #4
0
        /// <summary>添加库文件</summary>
        /// <param name="path"></param>
        /// <param name="filter"></param>
        /// <param name="allSub"></param>
        public void AddLibs(String path, String filter = null, Boolean allSub = false)
        {
            path = path.GetFullPath();
            if (!Directory.Exists(path))
            {
                return;
            }

            if (filter.IsNullOrEmpty())
            {
                filter = "*.lib;*.a";
            }
            //var opt = allSub ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
            foreach (var item in path.AsDirectory().GetAllFiles(filter, allSub))
            {
                // 不包含,直接增加
                if (!Libs.Contains(item.FullName))
                {
                    var lib = new LibFile(item.FullName);
                    WriteLog("发现静态库:{0, -12} {1}".F(lib.Name, item.FullName));
                    Libs.Add(item.FullName);
                }
            }
        }
        public void analyzeCommands()
        {
            string currentFlag     = "";
            bool   processingFiles = false;

            foreach (string word in words)
            {
                if (word.StartsWith("/") || word.StartsWith("-"))
                {
                    if (word.Contains(flag_dll) || word.Contains(flag_dll.ToUpper()))
                    {
                        isDll = true;
                    }
                    else if (word.Contains(flag_exe) || word.Contains(flag_exe.ToUpper()))
                    {
                        isExe = true;
                    }
                    else if (word.Contains(flag_out) || word.Contains(flag_out.ToUpper()))
                    {
                        Output = word.Substring(flag_out.Length + 1);
                        Options.Add(new KeyValuePair <string, string>(flag_out, Output));
                        currentFlag = flag_out;
                    }
                    else if (word.Contains(flag_def) || word.Contains(flag_def.ToUpper()))
                    {
                        Def = word.Substring(flag_def.Length + 1);
                        Options.Add(new KeyValuePair <string, string>(flag_def, Def));
                        currentFlag = flag_def;
                    }
                    else if (word.Contains(flag_entry) || word.Contains(flag_entry.ToUpper()))
                    {
                        Entry = word.Substring(flag_entry.Length + 1);
                        Options.Add(new KeyValuePair <string, string>(flag_entry, Entry));
                        currentFlag = flag_entry;
                    }
                    else
                    {
                        Options.Add(new KeyValuePair <string, string>(word, Entry));
                    }
                }
                else if (word.Contains(".obj"))
                {
                    Objs.Add(word);
                    processingFiles = true;
                }
                else if (word.Contains(".lib"))
                {
                    Libs.Add(word);
                    processingFiles = true;
                }
                else if (word.Contains(".res"))
                {
                }
                else if (currentFlag != "")
                {
                }
                else
                {
                    //Unrecognized command
                }

                if (word.ToLower().Equals("link") || word.ToLower().Equals("link.exe"))
                {
                }
                else if (!processingFiles)
                {
                    if (!word.Equals(""))
                    {
                        LinkOptionsLiteral += word + " ";
                        LinkOptionsLiteral_Words.Add(word);
                    }
                }
            }
            LinkOptionsLiteral = LinkOptionsLiteral.Trim();
        }