Beispiel #1
0
        public static void Main(string[] args)
        {
            #if DEBUG
            args = new string[]{"SafeBox", "Repo", "watchTest", "Bob"};
            #else
            if (args.Length != 4) {
                Console.WriteLine ("Usage: Watcher.exe <directory path> <repo> <prefix> <recipient key>");
                return;
            }
            #endif

            string path = args [0];
            Repo repo = Repo.Create (args [1]);
            string prefix = args [2];
            string recipientName = args [3];

            Directory.CreateDirectory (path);

            KeyStorage keyStorage = KeyStorage.Default;

            PublicKey recipientKey = null;
            if (recipientName != null) {
                recipientKey = keyStorage.GetPublic (recipientName);
                EncryptedRepo er = new EncryptedRepo (repo, keyStorage);
                er.AddKey (recipientKey);
                repo = er;
            }

            DirectoryWatcher dw = new DirectoryWatcher (path, repo, prefix);
            dw.Run ();
        }
        public void LoadRuntime(string path)
        {
            DirectoryInfo dir = new DirectoryInfo(path);
            var searchFiles = dir.GetFiles("*.py", SearchOption.AllDirectories);
            foreach(var file in searchFiles)
            {
                runtime.AddController(file.FullName);
            }

            directoryWatcher = new DirectoryWatcher(path,"*.py");
            directoryWatcher.OnFileChanged += DirectoryWatcher_OnFileChanged;
            directoryWatcher.Start();
        }