コード例 #1
0
ファイル: Installer.cs プロジェクト: zvonimir/corral
        public static void CheckSelfInstall(RunParConfig config)
        {
            var root = config.root;

            CheckFileExists(root, "corral\\corral.exe");
            CheckFileExists(root, "iz3\\z3.exe");
            foreach (var files in config.BoogieFiles)
            {
                CheckFolderExists(
                    System.IO.Path.Combine(config.root, System.IO.Path.GetDirectoryName(files.value)));
            }

            // Get location of RunParClient
            var loc = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

            CheckFileExists(loc, "RunParClient.exe");

            // Copy it root\RunParClient
            Console.WriteLine("Installing Binaries");
            System.IO.Directory.CreateDirectory(System.IO.Path.Combine(root, "Binaries"));
            foreach (var f in System.IO.Directory.GetFiles(loc, "*.exe").Concat(
                         System.IO.Directory.GetFiles(loc, "*.dll")))
            {
                //Console.WriteLine("copy {0} {1}", f, System.IO.Path.Combine(root, "Binaries", System.IO.Path.GetFileName(f)));
                System.IO.File.Copy(f, System.IO.Path.Combine(root, "Binaries", System.IO.Path.GetFileName(f)), true);
            }

            foreach (var util in config.Utils)
            {
                CheckFileExists(root, util.value);
            }

            // pstools
            CheckFileExists(root, "pstools\\psexec.exe");
        }
コード例 #2
0
ファイル: Utils.cs プロジェクト: zvonimir/corral
        public static void ReadFiles(RunParConfig config, out List <Tuple <string, string> > bpls, out List <string> filemaps)
        {
            bpls     = new List <Tuple <string, string> >();
            filemaps = new List <string>();
            var filemapMap = new Dictionary <string, Dictionary <string, Tuple <string, string> > >();

            // get negative files first
            var negativeFiles = new HashSet <string>();

            foreach (var f in config.BoogieFiles)
            {
                if (!f.IsNegative())
                {
                    continue;
                }
                negativeFiles.UnionWith(System.IO.Directory.GetFiles(config.root, f.value));
            }

            foreach (var f in config.BoogieFiles)
            {
                if (f.IsNegative())
                {
                    continue;
                }

                var files =
                    System.IO.Directory.GetFiles(config.root, f.value);

                var map1 = new Dictionary <string, string>();
                files.Where(s => !negativeFiles.Contains(s))
                .Iter(s => map1.Add(System.IO.Path.GetFileName(s), s));

                // find the file_map.txt
                var d = System.IO.Path.Combine(config.root, f.value);
                while (true)
                {
                    d = System.IO.Path.GetDirectoryName(d);
                    if (d.Length < config.root.Length)
                    {
                        break;
                    }
                    if (!System.IO.File.Exists(System.IO.Path.Combine(d, "file_map.txt")))
                    {
                        continue;
                    }

                    if (!filemaps.Contains(System.IO.Path.Combine(d, "file_map.txt")))
                    {
                        var contents = System.IO.File.ReadAllLines(System.IO.Path.Combine(d, "file_map.txt"));
                        var map2     = new Dictionary <string, Tuple <string, string> >();
                        foreach (var line in contents)
                        {
                            var tokens = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                            var key    = System.IO.Path.GetFileName(tokens[0]);
                            var prop   = tokens[2];
                            var a      = "";
                            for (int i = 3; i < tokens.Length; i++)
                            {
                                a += tokens[i] + " ";
                            }
                            map2.Add(key, Tuple.Create(prop, a));
                        }
                        filemapMap.Add(System.IO.Path.Combine(d, "file_map.txt"), map2);
                        filemaps.Add(System.IO.Path.Combine(d, "file_map.txt"));
                    }

                    var mapf = filemapMap[System.IO.Path.Combine(d, "file_map.txt")];
                    foreach (var kvp in map1)
                    {
                        if (!mapf.ContainsKey(kvp.Key))
                        {
                            continue;
                        }
                        var prop = mapf[kvp.Key].Item1;
                        var a    = mapf[kvp.Key].Item2;
                        if (!config.HasProperty(prop))
                        {
                            continue;
                        }
                        bpls.Add(Tuple.Create(kvp.Value, a));
                    }
                }
            }
        }