Exemplo n.º 1
0
        /// <summary>
        /// Constructor for the class.
        /// </summary>
        /// <param name="readSettingsFrom">Where to read registry values. Can be either 'GPO', so values will be read from "Software\Policies\PST Backup", or 'Local', so values will read from "Software\PST Backup".</param>
        public ApplicationSettings(SourceSettings readSettingsFrom)
        {
            _readSettingsFrom     = readSettingsFrom;
            Logger.IsLogActivated = true;
#if (DEBUG)
            Logger.MinimalSeverity = Logger.MessageSeverity.Debug;
#endif
            IsBackupAgentDontBackupThroughtWanDefine = false;

            IsEventLogSeverityDefine = false;

            IsFilesAndFoldersCompressFilesDefine = false;

            IsSchedulePolicyDefine     = false;
            IsScheduleintervalDefine   = false;
            IsScheduleUnitDefine       = false;
            IsScheduleDayOfWeekDefine  = false;
            IsScheduleDayOfMonthDefine = false;

            switch (_readSettingsFrom)
            {
            case SourceSettings.GPO:
                _baseKey = @"Software\Policies\PST Backup";
                break;

            case SourceSettings.Local:
                _baseKey = @"Software\PST Backup";
                break;
            }
            LoadSettingsFromRegistry();
        }
Exemplo n.º 2
0
        public static (SourceSettings, AwsDestinationSettings) Parse(HostConfigurator x)
        {
            string sourceDirectoryPath = string.Empty;
            int    sourceBufferSecs    = 2;
            string awsBucketName       = string.Empty;
            string awsBucketRegion     = string.Empty;
            string awsAccessKeyId      = string.Empty;
            string awsSecretkey        = string.Empty;

            x.AddCommandLineDefinition(nameof(sourceDirectoryPath), v => sourceDirectoryPath = v);
            x.AddCommandLineDefinition(nameof(sourceBufferSecs), v => sourceBufferSecs       = int.Parse(v));
            x.AddCommandLineDefinition(nameof(awsBucketName), v => awsBucketName             = v);
            x.AddCommandLineDefinition(nameof(awsBucketRegion), v => awsBucketRegion         = v);
            x.AddCommandLineDefinition(nameof(awsAccessKeyId), v => awsAccessKeyId           = v);
            x.AddCommandLineDefinition(nameof(awsSecretkey), v => awsSecretkey = v);
            x.ApplyCommandLine();

            var sourceSettings = new SourceSettings(sourceDirectoryPath, sourceBufferSecs);

            var destinationSettings = new AwsDestinationSettings(
                awsBucketName,
                awsBucketRegion,
                awsAccessKeyId,
                awsSecretkey);

            return(sourceSettings, destinationSettings);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Backup a repository in according to the source and destination.
        /// </summary>
        public void Backup()
        {
            DisplayHeader();

            SourceSettings srcSettings = new SourceSettings()
            {
                Repository    = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.Source).ConvertToSourceRepository(),
                Path          = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.SourcePath),
                CheckLevel    = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.Check).ConvertToCheckLevel(),
                NoCleaning    = ConsoleHelpers.CommandArgExists(_arguments, Arguments.NoCleaning),
                WideDisplay   = ConsoleHelpers.CommandArgExists(_arguments, Arguments.Wide),
                ApiKey        = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.SourceApiKey),
                NoLocalDelete = ConsoleHelpers.CommandArgExists(_arguments, Arguments.NoLocalDelete)
            };

            DestinationSettings dstSettings = new DestinationSettings()
            {
                Repository = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.Dest).ConvertToDestinationRepository(),
                Path       = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.DestPath),
                ApiKey     = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.DestApiKey)
            };

            TransformSettings trfSettings = new TransformSettings()
            {
                Kind = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.Transform).ConvertToTransformKind(),
                TripleDesFilename = ConsoleHelpers.GetCommandArgValue(_arguments, Arguments.CryptoKey)
            };

            IRepositorySource source = new RepositorySourceFactory(_logger, this).Create(srcSettings, dstSettings, trfSettings);

            WriteComponentLabels(source);
            source.Process();

            DisplayFooter();
        }
Exemplo n.º 4
0
 private async void _obs_SourceCreated(OBSWebsocket sender, SourceSettings settings)
 {
     Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         SliderInit();
         MixerInit();
     });
 }
        private List <CategoryItem> CreateCategories()
        {
            var categories = new List <CategoryItem>();

#pragma warning disable IDE0008 // Use explicit type
            foreach (var t in Enum.GetValues(typeof(DeviceType)))
            {
#pragma warning restore IDE0008

                string       name     = t.ToString();
                CategoryItem category = new CategoryItem()
                {
                    Category = "Devices", Name = name,
                };

                switch (name)
                {
                case nameof(DeviceType.Display):
                    var dui = new DisplaySettings();
                    dui.ItemChanged   += SettingsItemChanged;
                    category.UIElement = dui;
                    break;

                case nameof(DeviceType.InputSwitch):
                    var iui = new InputSwitchSettings();
                    iui.ItemChanged   += SettingsItemChanged;
                    category.UIElement = iui;
                    break;

                case nameof(DeviceType.MediaInfo):
                    var mui = new MediaInfoSettings();
                    mui.ItemChanged   += SettingsItemChanged;
                    category.UIElement = mui;
                    break;

                case nameof(DeviceType.Processor):
                    var pui = new ProcessorSettings();
                    pui.ItemChanged   += SettingsItemChanged;
                    category.UIElement = pui;
                    break;

                case nameof(DeviceType.Serial):
                    var sui = new SerialSettings();
                    sui.ItemChanged   += SettingsItemChanged;
                    category.UIElement = sui;
                    break;

                case nameof(DeviceType.Source):
                    var srui = new SourceSettings();
                    srui.ItemChanged  += SettingsItemChanged;
                    category.UIElement = srui;
                    break;
                }
                categories.Add(category);
            }

            return(categories);
        }
Exemplo n.º 6
0
        public Task <bool> ModifyImageSource(string sourceName, string fileName, int autoHideSeconds)
        {
            return(Task.Run(() =>
            {
                if (String.IsNullOrEmpty(sourceName))
                {
                    Logger.Instance.LogMessage(TracingLevel.ERROR, $"ModifyImageSource failed. Missing source name");
                    return false;
                }

                if (IsConnected)
                {
                    try
                    {
                        obs.SetSourceRender(sourceName, false);
                        SourceSettings sourceSettings = obs.GetSourceSettings(sourceName);
                        if (sourceSettings == null)
                        {
                            Logger.Instance.LogMessage(TracingLevel.ERROR, $"ModifyImageSource: GetSourceSettings return null for source {sourceName}");
                            return false;
                        }

                        if (sourceSettings.SourceType != "image_source")
                        {
                            Logger.Instance.LogMessage(TracingLevel.ERROR, $"ModifyImageSource: Source {sourceName} is not an image source: {sourceSettings.SourceType}");
                            return false;
                        }

                        sourceSettings.Settings["file"] = fileName;
                        obs.SetSourceSettings(sourceName, sourceSettings.Settings);
                        Thread.Sleep(200);
                        obs.SetSourceRender(sourceName, true);

                        if (autoHideSeconds > 0)
                        {
                            Task.Run(() =>
                            {
                                Thread.Sleep(autoHideSeconds * 1000);
                                obs.SetSourceRender(sourceName, false);
                                Logger.Instance.LogMessage(TracingLevel.INFO, $"ModifyImageSource AutoHid source {sourceName} after {autoHideSeconds} seconds");
                            });
                        }

                        return true;
                    }
                    catch (Exception ex)
                    {
                        Logger.Instance.LogMessage(TracingLevel.ERROR, $"ModifyImageSource for image {fileName} failed. Exception: {ex}");
                    }
                }
                else
                {
                    Logger.Instance.LogMessage(TracingLevel.ERROR, $"ModifyImageSource for image {fileName} failed. OBS is not connected");
                }
                return false;
            }));
        }
Exemplo n.º 7
0
        public static IContainer Create(SourceSettings sourceSettings, IModule destinationModule)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(sourceSettings);
            builder.RegisterType <SourceActor>().AsSelf();
            builder.RegisterModule <NLogModule>();
            builder.RegisterModule(destinationModule);

            return(builder.Build());
        }
Exemplo n.º 8
0
	public BuildfileProviderLoader (string basis, string decl_loc,
					SourceSettings ss, string srcrel) : base (basis, decl_loc)
	{
	    this.ss = ss;

	    if (srcrel != null)
		this.srcrel = srcrel;
	    else
		this.srcrel = Path.Combine (SourceSettings.BasisToSubpath (basis), 
					    ss.BuildfileName);
	}
Exemplo n.º 9
0
        /// <summary>
        /// Get the settings from a source item
        /// </summary>
        /// <param name="sourceName">Source name</param>
        /// <param name="sourceType">Type of the specified source. Useful for type-checking to avoid settings a set of settings incompatible with the actual source's type.</param>
        /// <returns>settings</returns>
        public SourceSettings GetSourceSettings(string sourceName, string sourceType = null)
        {
            var request = new JObject();

            request.Add("sourceName", sourceName);
            if (sourceType != null)
            {
                request.Add("sourceType", sourceType);
            }

            JObject        result   = SendRequest("GetSourceSettings", request);
            SourceSettings settings = new SourceSettings(result);

            return(settings);
        }
Exemplo n.º 10
0
        public BuildfileProviderLoader(string basis, string decl_loc,
                                       SourceSettings ss, string srcrel) : base(basis, decl_loc)
        {
            this.ss = ss;

            if (srcrel != null)
            {
                this.srcrel = srcrel;
            }
            else
            {
                this.srcrel = Path.Combine(SourceSettings.BasisToSubpath(basis),
                                           ss.BuildfileName);
            }
        }
Exemplo n.º 11
0
        protected ProviderLoaderBase(string basis, string decl_loc)
        {
            if (basis == null || basis[0] != '/' || basis[basis.Length - 1] != '/')
            {
                throw ExHelp.Argument(basis, "Invalid basis string `{0}'", basis);
            }

            this.basis = basis;

            if (decl_loc == null)
            {
                this.decl_loc = SourceSettings.BasisToSubpath(basis);
            }
            else
            {
                this.decl_loc = decl_loc;
            }
        }
Exemplo n.º 12
0
        private void SetCurrentReplayTextSource()
        {
            try
            {
                List <SourceInfo> sourceList = obs.GetSourcesList();
                SourceInfo        replayInfo = sourceList.Find(source => source.Name.Equals(settings.OBS.InfoSourceName));

                if (replayInfo != null)
                {
                    SourceSettings sourceSettings = obs.GetSourceSettings(replayInfo.Name);
                    sourceSettings.sourceSettings["read_from_file"] = true;
                    sourceSettings.sourceSettings["file"]           = Path.Combine(context.Current.Directory.FullName, settings.OBS.InfoFileName);
                    obs.SetSourceSettings(replayInfo.Name, sourceSettings.sourceSettings);
                }
            }
            catch (Exception e)
            {
                logger.LogError(e, $"Could not update the Tier for OBS.");
            }
        }
Exemplo n.º 13
0
        private bool TrySetBrowserSourceSegment(List <SourceInfo> sourceList, ReportScene segment)
        {
            var url    = segment.SourceUrl.ToString().Replace("[ID]", context.Current.LoadedReplay.ReplayId.Value.ToString());
            var source = sourceList.Find(si => si.Name.Equals(segment.SourceName, StringComparison.OrdinalIgnoreCase));

            if (source != null)
            {
                try
                {
                    SourceSettings sourceSettings  = obs.GetSourceSettings(source.Name);
                    JObject        browserSettings = sourceSettings.sourceSettings;
                    browserSettings["url"] = url;
                    obs.SetSourceSettings(source.Name, browserSettings);
                    return(true);
                }
                catch (Exception e)
                {
                    logger.LogError(e, $"could not set {segment.SceneName} URL to: {url}");
                }
            }

            return(false);
        }
Exemplo n.º 14
0
        public static GraphBuilder Compile(SourceSettings pwdsrc, IWarningLogger log)
        {
            GraphBuilder gb = new GraphBuilder();

            Queue toload = new Queue();

            toload.Enqueue(new BuildfileProviderLoader("/", pwdsrc));

            while (toload.Count > 0)
            {
                ProviderLoaderBase pl = (ProviderLoaderBase)toload.Dequeue();
                WrenchProvider     wp;

                //Console.WriteLine ("popped off: {0}, {1}, {2}", pl.Basis, pl.DeclarationLoc, pl);
                wp = (WrenchProvider)gb.EnsureProvider(pl.Basis, pl.DeclarationLoc);

                if (pl.Initialize(wp, log, toload))
                {
                    // parse errors or something
                    return(null);
                }

                if (wp.Finish(gb.Bundles, log))
                {
                    return(null);
                }
            }

            // check that all referenced providers were created

            if (gb.Finish(log))
            {
                return(null);
            }

            return(gb);
        }
Exemplo n.º 15
0
        private bool TrySetBrowserSourceSegment(int replayId, OBSWebsocket obs, List<SourceInfo> sourceList, ReportScene segment)
        {
            var url = segment.SourceUrl.Replace("[ID]", replayId.ToString());
            var source = sourceList.Find(si => si.Name.Equals(segment.SourceName, StringComparison.OrdinalIgnoreCase));

            if (source != null)
            {
                try
                {
                    SourceSettings sourceSettings = obs.GetSourceSettings(source.Name);
                    JObject browserSettings = sourceSettings.sourceSettings;
                    browserSettings["url"] = url;
                    obs.SetSourceSettings(source.Name, browserSettings);
                    logger.LogDebug($"set {segment.SceneName} URL to: {url}");
                    return true;
                }
                catch (Exception e)
                {
                    logger.LogError(e, $"could not set {segment.SceneName} URL to: {url}");
                }
            }

            return false;
        }
Exemplo n.º 16
0
 public virtual void Initialize(SourceSettings settings)
 {
     this.settings = settings;
 }
Exemplo n.º 17
0
    public int Launch()
    {
#if EXPERIMENTAL_INSTALL
        if (install_mode)
        {
            int ret = PrepareInstallMode();

            if (ret != 0)
            {
                return(ret);
            }
        }
#endif

        BuildfileParser.DebugParser      = debug_parser;
        ActionLog.DebugEvents            = debug_logs;
        ProjectManager.ProfileStateUsage = profile_graph;
        Monkeywrench.Compiler.XmlGraphSerializer.DebugOutput = true;         // FIXME
        string here = "/";

        ProjectManager pm = new ProjectManager();
        pm.OnRecompile += NotifyRecompile;

        if (init_srcdir == null)
        {
            // Should be able to recover the source settings

            if (pm.LoadSource(log))
            {
                // FIXME: recover if there are neighboring directories
                // with valid logs
                Console.Error.WriteLine("Couldn't recover source directory information. " +
                                        "You probably need to initialize this directory as a build directory:");
                Console.Error.WriteLine("    \"mbuild -i [path to top source directory]\"");
                return(1);
            }

            here = SourceSettings.SubpathToBasis(pm.SourceSettings.CurrentSubpath);
        }
        else
        {
            Console.WriteLine("Initializing with source directory `{0}\' " +
                              "and buildfiles called `{1}\'", init_srcdir,
                              buildfile_name);

            if (pm.CreateToplevel(init_srcdir, buildfile_name, log))
            {
                Console.Error.WriteLine("If you have already initialized this build directory, giving");
                Console.Error.WriteLine("the `-i' flag is illegal. To recheck the build prerequisites, run:");
                Console.Error.WriteLine("    \"mbuild --force +prereq\"");
                return(1);
            }
        }

        if (pm.LoadRest(log))
        {
            return(1);
        }

        if (query_mode)
        {
            return(RunQuery(here, pm));
        }

        if (last_mode)
        {
            return(ShowLog(pm));
        }

        if (import_reader != null)
        {
            int res = ImportXml(here, pm);

            if (exit_after_import)
            {
                pm.Dispose();
                return(res);
            }
        }

        WrenchOperations.BeforeBuild      += new OperationFunc(BeforeBuildEvent);
        WrenchOperations.BeforeSkip       += new OperationFunc(BeforeSkipEvent);
        WrenchOperations.BeforeClean      += new OperationFunc(BeforeCleanEvent);
        WrenchOperations.BeforeInstall    += new OperationFunc(BeforeInstallEvent);
        WrenchOperations.BeforeUninstall  += new OperationFunc(BeforeInstallEvent);
        WrenchOperations.BeforeDistribute += new OperationFunc(BeforeDistributeEvent);

        if (pm.Project != null)
        {
            try {
                DoOperation(here, pm);
            } catch (Exception e) {
                log.Error(3009, "Unhandled exception during operation", e.ToString());
            }
        }

#if EXPERIMENTAL_INSTALL
        if (install_mode)
        {
            install_svc.DoneInstalling();
            install_client.WaitForExit();

            if (install_client.ExitCode != 0)
            {
                log.Error(3022, "Install process exited with an error code: " +
                          install_client.ExitCode, null);
            }
        }
#endif

        if (numcleaned > 0)
        {
            Console.WriteLine("Cleaned {0} targets", numcleaned);
        }
        // this gets a little annoying
        //if (numbuilt > 0 || numskipped > 0)
        if (numbuilt > 0)
        {
            Console.WriteLine("Built {0} targets, {1} did not need rebuilding (with dups).", numbuilt, numskipped);
        }
        if (numdisted > 0)
        {
            Console.WriteLine("Copied {0} targets for distribution", numdisted);
        }
        if (numinstalled > 0)
        {
            if (install_is_uninstall)
            {
                Console.WriteLine("Uninstalled {0} targets", numinstalled);
            }
            else
            {
                Console.WriteLine("Installed {0} targets", numinstalled);
            }
        }
        if (log.NumWarnings > 0 || log.NumErrors > 0)
        {
            Console.Error.WriteLine("{0} warnings, {1} errors",
                                    log.NumWarnings, log.NumErrors);
        }

        if (init_srcdir != null)
        {
            //string self = Environment.CommandLine.Split (' ')[0];
            // FIXME: the above returns the exe name, not the argv[0] of the
            // mono process (which the wrapper script sets to $0 of the wrapper,
            // which is what we want)

            if (log.NumErrors > 0)
            {
                Console.WriteLine("After you fix the problems reported above, you can");
                Console.WriteLine("continue checking the build prerequisites by running:");
                Console.WriteLine("   \"mbuild +prereq\"");
                Console.WriteLine("To recheck ALL of the build prerequisites, run: ");
                Console.WriteLine("   \"mbuild --force +prereq\"");
            }
            else
            {
                Console.WriteLine("To recheck the build prerequisites, run: ");
                Console.WriteLine("   \"mbuild --force +prereq\"");
            }
        }

        pm.Dispose();
        return(this.log.NumErrors);
    }
Exemplo n.º 18
0
 public static Source <CommittableMessage <TKey, TValue>, IAsyncDisposable> Committable <TKey, TValue>(
     SourceSettings <TKey, TValue> settings, ISubscription subscription)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 19
0
 public override void Initialize(SourceSettings settings)
 {
     base.Initialize(settings);
     ircSettings = settings as IrcSettings;
 }
Exemplo n.º 20
0
 public static Source <KeyValuePair <RdKafka.TopicPartition, Source <CommittableMessage <TKey, TValue>, NotUsed> >, IAsyncDisposable> PartitionedCommittable <TKey, TValue>(
     SourceSettings <TKey, TValue> settings, ITopicSubscription subscription)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 21
0
 public SourceActor(SourceSettings sourceSettings)
 {
     _logger         = Logging.GetAkkaLogger(Context);
     _sourceSettings = sourceSettings;
 }
Exemplo n.º 22
0
	public BuildfileProviderLoader (string basis, string decl_loc, 
					SourceSettings ss) : this (basis, decl_loc, ss, null)
	{}
Exemplo n.º 23
0
	public BuildfileProviderLoader (string basis, SourceSettings ss) : this (basis, null, ss, null)
	{}
Exemplo n.º 24
0
 public BuildfileProviderLoader(string basis, SourceSettings ss) : this(basis, null, ss, null)
 {
 }
Exemplo n.º 25
0
 public BuildfileProviderLoader(string basis, string decl_loc,
                                SourceSettings ss) : this(basis, decl_loc, ss, null)
 {
 }