예제 #1
0
 public YoutubeContentProvider(FavouriteContentProvider parent, string host)
 {
     Parent = parent;
     _lastUpdate = DateTime.Now.AddDays(-1);
     Settings sett = new Settings(Plugin.SelfPath + "/pluginfavourites.xml");
     _playlist = sett.GetValue("settings", "youtubeplaylist");
     _quality = ushort.Parse(sett.GetValue("settings", "youtubequality") ?? "0");
     _contents = new List<IPluginContent>();
     _host = host;
 }
예제 #2
0
 public FormSettings()
 {
     InitializeComponent();
     _set = new Settings(Plugin.SelfPath + "/pluginfavourites.xml");
     textBox1.Text = _set.GetValue("settings", "filepath") ?? "";
     string ytq = _set.GetValue("settings", "youtubequality") ?? "1280";
     int index = comboBox1.Items.IndexOf(ytq);
     comboBox1.SelectedIndex =  index < 0 ? comboBox1.Items.IndexOf("1280") : index;
     textBox2.Text = _set.GetValue("settings", "youtubeplaylist") ?? "";
     textBox3.Text = _set.GetValue("settings", "torrentpath") ?? "";
 }
예제 #3
0
        public void SetConfigData()
        {
            // used to create a new config.xml file
            if (m_settings == null)
            {
                m_settings = new Settings("config.xml");
            }

            m_settings.SetValue("MAIN", "DBServerName", "HTS-WAVEFRONT\\SQLEXPRESS");
            m_settings.SetValue("MAIN", "DBName", "WaveguideDB");
            m_settings.SetValue("MAIN", "DBUsername", "sa");
            m_settings.SetValue("MAIN", "DBPassword", "wavefront");

            m_settings.SetValue("MAIN", "MaxPixelValue", (65535).ToString());
        }
예제 #4
0
        public VlcClient()
        {
            _sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
            Settings settings = new Settings(Path.Combine(TtvProxy.ApplicationDataFolder, "settings.xml"));

            if (!int.TryParse(settings.GetValue("vlc", "vlcport"), out _vlcport))
            {
                settings.SetValue("vlc", "vlcport", "4212");
                _vlcport = 4212;
            }

            _passw = settings.GetValue("vlc", "vlcpassw");
            if (string.IsNullOrEmpty(_passw))
            {
                _passw = "admin";
                settings.SetValue("vlc", "vlcpassw", _passw);
            }

            if (!int.TryParse(settings.GetValue("vlc", "vlcbroadcastport"), out _broadcastport))
            {
                _broadcastport = 8082;
                settings.SetValue("vlc", "vlcbradcastport", "8082");
            }

            if (!int.TryParse(settings.GetValue("vlc", "vlccache"), out VlcClient.Cache))
            {
                VlcClient.Cache = 2000;
                settings.SetValue("vlc", "vlccache", "4000");
            }

            if (!int.TryParse(settings.GetValue("vlc", "vlcmuxcache"), out VlcClient.MuxCache))
            {
                VlcClient.MuxCache = 0;
                settings.SetValue("vlc", "vlcmuxcache", "0");
            }

            if (!int.TryParse(settings.GetValue("vlc", "rtspport"), out _rtspport))
            {
                _rtspport = 5554;
                settings.SetValue("vlc", "rtspport", _rtspport.ToString());
            }

            bool.TryParse(settings.GetValue("vlc", "vlcext"), out _extvlc);
            _extvlcpath = settings.GetValue("vlc", "vlcpath");
            if (string.IsNullOrEmpty(_extvlcpath) || !File.Exists(_extvlcpath))
                _extvlc = false;
            _broadcasts = new Dictionary<string, string>();
        }
예제 #5
0
        public void GetConfigData()
        {
            m_settings = new Settings("settings.xml");

            string serverName = m_settings.GetValue("MAIN", "DBServerName");
            string dbName     = m_settings.GetValue("MAIN", "DBName");
            string Username   = m_settings.GetValue("MAIN", "DBUsername");
            string Password   = m_settings.GetValue("MAIN", "DBPassword");

            GlobalVars.Instance.DatabaseConnectionString = "Data Source=" + serverName +
                                                           ";Initial Catalog=" + dbName +
                                                           ";User ID=" + Username +
                                                           ";Password="******"MAIN", "MaxPixelValue"));
        }
예제 #6
0
파일: Program.cs 프로젝트: shibayan/kudu
        private static int Main(string[] args)
        {
            // Turn flag on in app.config to wait for debugger on launch
            if (ConfigurationManager.AppSettings["WaitForDebuggerOnStart"] == "true")
            {
                while (!Debugger.IsAttached)
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (System.Environment.GetEnvironmentVariable(SettingsKeys.DisableDeploymentOnPush) == "1")
            {
                return 0;
            }

            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]");
                return 1;
            }

            // The post receive hook launches the exe from sh and intereprets newline differently.
            // This fixes very wacky issues with how the output shows up in the console on push
            System.Console.Error.NewLine = "\n";
            System.Console.Out.NewLine = "\n";

            string appRoot = args[0];
            string wapTargets = args[1];
            string deployer = args.Length == 2 ? null : args[2];

            IEnvironment env = GetEnvironment(appRoot);
            ISettings settings = new XmlSettings.Settings(GetSettingsPath(env));
            IDeploymentSettingsManager settingsManager = new DeploymentSettingsManager(settings);

            // Setup the trace
            TraceLevel level = settingsManager.GetTraceLevel();
            ITracer tracer = GetTracer(env, level);
            ITraceFactory traceFactory = new TracerFactory(() => tracer);

            // Calculate the lock path
            string lockPath = Path.Combine(env.SiteRootPath, Constants.LockPath);
            string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile);

            IOperationLock deploymentLock = new LockFile(deploymentLockPath, traceFactory);

            if (deploymentLock.IsHeld)
            {
                return PerformDeploy(appRoot, wapTargets, deployer, lockPath, env, settingsManager, level, tracer, traceFactory, deploymentLock);
            }

            // Cross child process lock is not working on linux via mono.
            // When we reach here, deployment lock must be HELD! To solve above issue, we lock again before continue.
            try
            {
                return deploymentLock.LockOperation(() =>
                {
                    return PerformDeploy(appRoot, wapTargets, deployer, lockPath, env, settingsManager, level, tracer, traceFactory, deploymentLock);
                }, "Performing deployment", TimeSpan.Zero);
            }
            catch (LockOperationException)
            {
                return -1;
            }
        }
예제 #7
0
        static int Main(string[] args)
        {
            // Turn flag on in app.config to wait for debugger on launch
            if (ConfigurationManager.AppSettings["WaitForDebuggerOnStart"] == "true")
            {
                while (!Debugger.IsAttached)
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]");
                return 1;
            }

            // The post receive hook launches the exe from sh and intereprets newline differently.
            // This fixes very wacky issues with how the output shows up in the conosle on push
            System.Console.Error.NewLine = "\n";
            System.Console.Out.NewLine = "\n";

            System.Environment.SetEnvironmentVariable("GIT_DIR", null, System.EnvironmentVariableTarget.Process);

            string appRoot = args[0];
            string wapTargets = args[1];
            string deployer = args.Length == 2 ? null : args[2];

            IEnvironment env = GetEnvironment(appRoot);
            ISettings settings = new XmlSettings.Settings(GetSettingsPath(env));
            IDeploymentSettingsManager settingsManager = new DeploymentSettingsManager(settings);

            // Adjust repo path
            env.RepositoryPath = Path.Combine(env.SiteRootPath, settingsManager.GetRepositoryPath());

            // Setup the trace
            IFileSystem fileSystem = new FileSystem();
            TraceLevel level = settingsManager.GetTraceLevel();
            ITracer tracer = GetTracer(env, level, fileSystem);
            ITraceFactory traceFactory = new TracerFactory(() => tracer);

            // Calculate the lock path
            string lockPath = Path.Combine(env.SiteRootPath, Constants.LockPath);
            string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile);
            string statusLockPath = Path.Combine(lockPath, Constants.StatusLockFile);
            IOperationLock deploymentLock = new LockFile(deploymentLockPath, traceFactory, fileSystem);
            IOperationLock statusLock = new LockFile(statusLockPath, traceFactory, fileSystem);

            IBuildPropertyProvider buildPropertyProvider = new BuildPropertyProvider();
            ISiteBuilderFactory builderFactory = new SiteBuilderFactory(buildPropertyProvider, env);

            IRepository gitRepository = new GitExeRepository(env, settingsManager, traceFactory);

            var logger = new ConsoleLogger();
            IDeploymentManager deploymentManager = new DeploymentManager(builderFactory,
                                                          env, 
                                                          fileSystem, 
                                                          traceFactory, 
                                                          settingsManager,
                                                          new DeploymentStatusManager(env, fileSystem, statusLock),
                                                          deploymentLock,
                                                          GetLogger(env, level, logger));

            var step = tracer.Step("Executing external process", new Dictionary<string, string>
            {
                { "type", "process" },
                { "path", "kudu.exe" },
                { "arguments", appRoot + " " + wapTargets }
            });

            using (step)
            {
                try
                {
                    deploymentManager.Deploy(gitRepository, changeSet: null, deployer: deployer, clean: false);
                }
                catch (Exception e)
                {
                    System.Console.Error.WriteLine(e.Message);
                    System.Console.Error.WriteLine(Resources.Log_DeploymentError);
                    return 1;
                }
            }

            if (logger.HasErrors)
            {
                System.Console.Error.WriteLine(Resources.Log_DeploymentError);
                return 1;
            }

            return 0;
        }
예제 #8
0
        private static int Main(string[] args)
        {
            // Turn flag on in app.config to wait for debugger on launch
            if (ConfigurationManager.AppSettings["WaitForDebuggerOnStart"] == "true")
            {
                while (!Debugger.IsAttached)
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (System.Environment.GetEnvironmentVariable(SettingsKeys.DisableDeploymentOnPush) == "1")
            {
                return(0);
            }

            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]");
                return(1);
            }

            // The post receive hook launches the exe from sh and intereprets newline differently.
            // This fixes very wacky issues with how the output shows up in the console on push
            System.Console.Error.NewLine = "\n";
            System.Console.Out.NewLine   = "\n";

            System.Environment.SetEnvironmentVariable("GIT_DIR", null, System.EnvironmentVariableTarget.Process);

            // Skip SSL Certificate Validate
            OperationClient.SkipSslValidationIfNeeded();

            string appRoot    = args[0];
            string wapTargets = args[1];
            string deployer   = args.Length == 2 ? null : args[2];

            IEnvironment env      = GetEnvironment(appRoot);
            ISettings    settings = new XmlSettings.Settings(GetSettingsPath(env));
            IDeploymentSettingsManager settingsManager = new DeploymentSettingsManager(settings);

            // Adjust repo path
            env.RepositoryPath = Path.Combine(env.SiteRootPath, settingsManager.GetRepositoryPath());

            // Setup the trace
            TraceLevel    level        = settingsManager.GetTraceLevel();
            ITracer       tracer       = GetTracer(env, level);
            ITraceFactory traceFactory = new TracerFactory(() => tracer);

            // Calculate the lock path
            string lockPath           = Path.Combine(env.SiteRootPath, Constants.LockPath);
            string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile);
            string statusLockPath     = Path.Combine(lockPath, Constants.StatusLockFile);
            string hooksLockPath      = Path.Combine(lockPath, Constants.HooksLockFile);

            IOperationLock deploymentLock = new LockFile(deploymentLockPath, traceFactory);
            IOperationLock statusLock     = new LockFile(statusLockPath, traceFactory);
            IOperationLock hooksLock      = new LockFile(hooksLockPath, traceFactory);

            IBuildPropertyProvider buildPropertyProvider = new BuildPropertyProvider();
            ISiteBuilderFactory    builderFactory        = new SiteBuilderFactory(buildPropertyProvider, env);

            IRepository gitRepository;

            if (settingsManager.UseLibGit2SharpRepository())
            {
                gitRepository = new LibGit2SharpRepository(env, settingsManager, traceFactory);
            }
            else
            {
                gitRepository = new GitExeRepository(env, settingsManager, traceFactory);
            }

            IServerConfiguration serverConfiguration = new ServerConfiguration();
            IAnalytics           analytics           = new Analytics(settingsManager, serverConfiguration, traceFactory);

            IWebHooksManager         hooksManager            = new WebHooksManager(tracer, env, hooksLock);
            IDeploymentStatusManager deploymentStatusManager = new DeploymentStatusManager(env, analytics, statusLock);
            IAutoSwapHandler         autoSwapHander          = new AutoSwapHandler(deploymentStatusManager, env, settingsManager, traceFactory);
            var functionManager = new FunctionManager(env, traceFactory);
            var logger          = new ConsoleLogger();
            IDeploymentManager deploymentManager = new DeploymentManager(builderFactory,
                                                                         env,
                                                                         traceFactory,
                                                                         analytics,
                                                                         settingsManager,
                                                                         deploymentStatusManager,
                                                                         deploymentLock,
                                                                         GetLogger(env, level, logger),
                                                                         hooksManager,
                                                                         autoSwapHander,
                                                                         functionManager);

            var step = tracer.Step(XmlTracer.ExecutingExternalProcessTrace, new Dictionary <string, string>
            {
                { "type", "process" },
                { "path", "kudu.exe" },
                { "arguments", appRoot + " " + wapTargets }
            });

            using (step)
            {
                try
                {
                    deploymentManager.DeployAsync(gitRepository, changeSet: null, deployer: deployer, clean: false)
                    .Wait();
                }
                catch (Exception e)
                {
                    tracer.TraceError(e);

                    System.Console.Error.WriteLine(e.GetBaseException().Message);
                    System.Console.Error.WriteLine(Resources.Log_DeploymentError);
                    return(1);
                }
            }

            if (logger.HasErrors)
            {
                System.Console.Error.WriteLine(Resources.Log_DeploymentError);
                return(1);
            }

            return(0);
        }
예제 #9
0
        private static int Main(string[] args)
        {
            // Turn flag on in app.config to wait for debugger on launch
            if (ConfigurationManager.AppSettings["WaitForDebuggerOnStart"] == "true")
            {
                while (!Debugger.IsAttached)
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (System.Environment.GetEnvironmentVariable(SettingsKeys.DisableDeploymentOnPush) == "1")
            {
                return(0);
            }

            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]");
                return(1);
            }

            // The post receive hook launches the exe from sh and interprets newline differently.
            // This fixes very wacky issues with how the output shows up in the console on push
            System.Console.Error.NewLine = "\n";
            System.Console.Out.NewLine   = "\n";

            string appRoot    = args[0];
            string wapTargets = args[1];
            string deployer   = args.Length == 2 ? null : args[2];
            string requestId  = System.Environment.GetEnvironmentVariable(Constants.RequestIdHeader);

            IEnvironment env      = GetEnvironment(appRoot, requestId);
            ISettings    settings = new XmlSettings.Settings(GetSettingsPath(env));
            IDeploymentSettingsManager settingsManager = new DeploymentSettingsManager(settings);

            // Setup the trace
            TraceLevel    level        = settingsManager.GetTraceLevel();
            ITracer       tracer       = GetTracer(env, level);
            ITraceFactory traceFactory = new TracerFactory(() => tracer);

            // Calculate the lock path
            string lockPath           = Path.Combine(env.SiteRootPath, Constants.LockPath);
            string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile);

            IOperationLock deploymentLock = new LockFile(deploymentLockPath, traceFactory);

            if (deploymentLock.IsHeld)
            {
                return(PerformDeploy(appRoot, wapTargets, deployer, lockPath, env, settingsManager, level, tracer, traceFactory, deploymentLock));
            }

            // Cross child process lock is not working on linux via mono.
            // When we reach here, deployment lock must be HELD! To solve above issue, we lock again before continue.
            try
            {
                return(deploymentLock.LockOperation(() =>
                {
                    return PerformDeploy(appRoot, wapTargets, deployer, lockPath, env, settingsManager, level, tracer, traceFactory, deploymentLock);
                }, "Performing deployment", TimeSpan.Zero));
            }
            catch (LockOperationException)
            {
                return(-1);
            }
        }
예제 #10
0
 public SettingManager(string path)
 {
     _settings = new Settings(path);
 }
예제 #11
0
 public LocalFileContentProvider(IPluginContainer parent)
 {
     var settings = new Settings(Plugin.SelfPath + "/pluginfavourites.xml");
     files_path = settings.GetValue("settings", "filepath") ?? "";
     _parent = parent;
 }
예제 #12
0
 public TorrentContentProvider(IPluginContainer parent)
 {
     Parent = parent;
     var settings = new Settings(Plugin.SelfPath + "/pluginfavourites.xml");
     _path = settings.GetValue("settings", "torrentpath") ?? "";
 }
예제 #13
0
        static int Main(string[] args)
        {
            // Turn flag on in app.config to wait for debugger on launch
            if (ConfigurationManager.AppSettings["WaitForDebuggerOnStart"] == "true")
            {
                while (!Debugger.IsAttached)
                {
                    System.Threading.Thread.Sleep(100);
                }
            }

            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: kudu.exe appRoot wapTargets [deployer]");
                return(1);
            }

            // The post receive hook launches the exe from sh and intereprets newline differently.
            // This fixes very wacky issues with how the output shows up in the conosle on push
            System.Console.Error.NewLine = "\n";
            System.Console.Out.NewLine   = "\n";

            System.Environment.SetEnvironmentVariable("GIT_DIR", null, System.EnvironmentVariableTarget.Process);

            string appRoot    = args[0];
            string wapTargets = args[1];
            string deployer   = args.Length == 2 ? null : args[2];

            IEnvironment env      = GetEnvironment(appRoot);
            ISettings    settings = new XmlSettings.Settings(GetSettingsPath(env));
            IDeploymentSettingsManager settingsManager = new DeploymentSettingsManager(settings);

            // Adjust repo path
            env.RepositoryPath = Path.Combine(env.SiteRootPath, settingsManager.GetRepositoryPath());

            // Setup the trace
            IFileSystem   fileSystem   = new FileSystem();
            TraceLevel    level        = settingsManager.GetTraceLevel();
            ITracer       tracer       = GetTracer(env, level, fileSystem);
            ITraceFactory traceFactory = new TracerFactory(() => tracer);

            // Calculate the lock path
            string         lockPath           = Path.Combine(env.SiteRootPath, Constants.LockPath);
            string         deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile);
            string         statusLockPath     = Path.Combine(lockPath, Constants.StatusLockFile);
            IOperationLock deploymentLock     = new LockFile(deploymentLockPath, traceFactory, fileSystem);
            IOperationLock statusLock         = new LockFile(statusLockPath, traceFactory, fileSystem);

            IBuildPropertyProvider buildPropertyProvider = new BuildPropertyProvider();
            ISiteBuilderFactory    builderFactory        = new SiteBuilderFactoryDispatcher(buildPropertyProvider, env);

            IRepository gitRepository = new GitExeRepository(env, settingsManager, traceFactory);

            var logger = new ConsoleLogger();
            IDeploymentManager deploymentManager = new DeploymentManager(builderFactory,
                                                                         env,
                                                                         fileSystem,
                                                                         traceFactory,
                                                                         settingsManager,
                                                                         new DeploymentStatusManager(env, fileSystem, statusLock),
                                                                         deploymentLock,
                                                                         GetLogger(env, level, logger));

            var step = tracer.Step("Executing external process", new Dictionary <string, string>
            {
                { "type", "process" },
                { "path", "kudu.exe" },
                { "arguments", appRoot + " " + wapTargets }
            });

            using (step)
            {
                try
                {
                    deploymentManager.Deploy(gitRepository, changeSet: null, deployer: deployer, clean: false);
                }
                catch (Exception e)
                {
                    System.Console.Error.WriteLine(e.Message);
                    System.Console.Error.WriteLine(Resources.Log_DeploymentError);
                    return(1);
                }
            }

            if (logger.HasErrors)
            {
                System.Console.Error.WriteLine(Resources.Log_DeploymentError);
                return(1);
            }

            return(0);
        }