Пример #1
0
        static int Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: CodeSync <configPath>");
                return 1;
            }
            Config config;

            try
            {
                config = Config.LoadFromFile(args[0]);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error parsing config: {e.Message}");
                return 1;
            }

            Project project = new Project(config.Path, config.SyncLocation, config.SyncedExtensions);
            ProjectServer server = new ProjectServer(project, config.Port);
            server.Start();
            Console.Read();
            server.Stop();

            return 0;
        }
Пример #2
0
 public ProjectServer(Project project, int port)
 {
     this.project = project;
     server = new LocalServer(port);
     server.AddHandler("list", SendFileList);
     server.AddHandler("changes", SendChanges);
     server.AddHandler("read", ReadFile);
     server.AddHandler("info", GetSyncDetails);
 }