Esempio n. 1
0
        static void ServiceStartup(StartupType type)
        {
            Process          process   = new System.Diagnostics.Process();
            ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();

            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.FileName    = "cmd.exe";
            //process start type
            string startstring = "";

            if (type == StartupType.Automatic)
            {
                startstring = "auto";
            }
            else if (type == StartupType.AutomaticDelayed)
            {
                startstring = "delayed-auto";
            }
            else if (type == StartupType.Manual)
            {
                startstring = "demand";
            }
            else
            {
                return;
            }
            //run command
            startInfo.Arguments = String.Format("/C sc config udp_rx start= {0}", startstring);
            process.StartInfo   = startInfo;
            process.Start();
        }
Esempio n. 2
0
        static StartupMetadata GetStartupMetadata(StartupInfo startupInfo, IPlatformTelemetryDetails platformDetails, Dictionary <string, long> timings)
        {
            var         assetType   = StartupAssetType.FromStartupInfo(startupInfo);
            StartupType startupType = StartupType.Normal;

            if (startupInfo.Restarted && !IdeApp.IsInitialRunAfterUpgrade)
            {
                startupType = StartupType.ConfigurationChange;                 // Assume a restart without upgrading was the result of a config change
            }
            else if (IdeApp.IsInitialRun)
            {
                startupType = StartupType.FirstLaunch;
            }
            else if (IdeApp.IsInitialRunAfterUpgrade)
            {
                startupType = StartupType.FirstLaunchAfterUpgrade;
            }
            else if (Debugger.IsAttached)
            {
                startupType = StartupType.DebuggerPresent;
            }

            return(new StartupMetadata {
                CorrectedStartupTime = startupTimer.ElapsedMilliseconds,
                StartupType = Convert.ToInt32(startupType),
                AssetTypeId = assetType.Id,
                AssetTypeName = assetType.Name,
                IsInitialRun = IdeApp.IsInitialRun,
                IsInitialRunAfterUpgrade = IdeApp.IsInitialRunAfterUpgrade,
                TimeSinceMachineStart = platformDetails.TimeSinceMachineStart.Seconds,
                TimeSinceLogin = platformDetails.TimeSinceLogin.Seconds,
                Timings = timings
            });
        }
Esempio n. 3
0
 private void IntroDialog_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.DialogResult == DialogResult.Cancel)
     {
         Start = StartupType.None;
     }
 }
Esempio n. 4
0
 public ExternalApp(string name, string path, string parameters, bool runAsAdmin, StartupType startupType) {
     Name = name;
     Path = path;
     Parameters = parameters;
     RunAsAdmin = runAsAdmin;
     StartupType = startupType;
 }
Esempio n. 5
0
        /// <summary>
        /// 执行开始程序
        /// </summary>
        public void RunningStartup(StartupType startupType, params string[] args)
        {
            switch (startupType)
            {
            case StartupType.MVTMClientStartup:
                // 读取StartupConfiguration.xml
                AppSettings.StartupConfiguration = new VTMC.Utils.Models.StartupConfiguration();
                //AnalysisStartupConfiguration();
                // add by fdp 180521
                AnalysisStartupConfiguration(args);
                break;

            case StartupType.MVTMC:
                // 读取ComonConfiguration.xml
                AppSettings.CommonConfiguration = new VTMC.Utils.Models.CommonConfiguration();
                AnalysisComonConfiguration();
                // 读取并更新到每个User目录下客户端数据
                AppSettings.UserConfiguration = new VTMC.Utils.Models.UserConfiguration();
                UpdateUserConfiguration();
                break;

            case StartupType.VideoRecordTool:
                break;

            default:
                break;
            }
        }
Esempio n. 6
0
 public udp_rx_install_runner(string ExePath = "c:\\program files\\udp_rx", string ConfAndKeysPath = "c:\\programdata\\udp_rx", StartupType _startType = StartupType.Manual)
 {
     //TODO: validate paths
     _programfilespath = ExePath;
     _programdatapath  = ConfAndKeysPath;
     StartType         = _startType;
 }
Esempio n. 7
0
 /// <summary>
 ///     Creates the startup registeration to the current software and to it's launching path.
 /// </summary>
 public static AppStartupRegisteration CreateToThisExecutable(StartupType type)
 {
     if (type == StartupType.Null)
     {
         return(null);
     }
     return(new AppStartupRegisteration(type, Assembly.GetExecutingAssembly().CodeBase, AppDomain.CurrentDomain.FriendlyName));
 }
Esempio n. 8
0
 public ExternalApp(string name, string path, string parameters, bool runAsAdmin, StartupType startupType)
 {
     Name        = name;
     Path        = path;
     Parameters  = parameters;
     RunAsAdmin  = runAsAdmin;
     StartupType = startupType;
 }
Esempio n. 9
0
        public IntroDialog(bool recoverVisible)
        {
            InitializeComponent();

            Start = StartupType.None;

            rdbtnLoadAutosave.Visible  = recoverVisible;
            lblDescAutoRecover.Visible = recoverVisible;
        }
Esempio n. 10
0
 public StartupAttribute(StartupType type, Type parentType, string prefabURL = "")
 {
     this.Type       = type;
     this.ParentType = parentType;
     this.PrefabURL  = prefabURL;
     if (this.PrefabURL == null)
     {
         prefabURL = "";
     }
 }
Esempio n. 11
0
 public ArrayList GetItems(StartupType type)
 {
     ArrayList ItemList = new ArrayList();
     foreach (StartupItem Item in Items) {
         if (Item.type == type) {
             ItemList.Add(Item);
         }
     }
     return ItemList;
 }
Esempio n. 12
0
        /// <summary>
        /// Validates the startup type
        /// </summary>
        /// <param name="startupType">The startup type.</param>
        /// <returns></returns>
        public bool ValidateStartupType(StartupType startupType)
        {
            if (startupType == StartupType.NotSet)
            {
                this.ErrorMessages.Add("Startup type must be set");
                return(false);
            }

            return(true);
        }
Esempio n. 13
0
 public void AddStartupItem(string path, string name, StartupType startupType)
 {
     SendTo(CurrentSession, MessageHead.S_STARTUP_ADD_ITEM,
            new StartupItemPack()
     {
         Name = name,
         Path = path,
         Type = startupType
     });
 }
Esempio n. 14
0
 public StartupItem(string name, string path, string args, StartupFileInfo fileInfo, StartupType startupType, object icon)
 {
     Path              = path;
     CmdArguments      = args;
     Name              = name;
     IsSignatureExists = fileInfo.SignatureExists;
     IsSignatureValid  = fileInfo.SignatureValid;
     StartupType       = startupType;
     Icon              = icon;
     CompanyName       = fileInfo.CompanyName;
 }
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if (ServiceDisplayName.Expression != null)
            {
                targetCommand.AddParameter("DisplayName", ServiceDisplayName.Get(context));
            }

            if (Description.Expression != null)
            {
                targetCommand.AddParameter("Description", Description.Get(context));
            }

            if (StartupType.Expression != null)
            {
                targetCommand.AddParameter("StartupType", StartupType.Get(context));
            }

            if (Status.Expression != null)
            {
                targetCommand.AddParameter("Status", Status.Get(context));
            }

            if (InputObject.Expression != null)
            {
                targetCommand.AddParameter("InputObject", InputObject.Get(context));
            }

            if (PassThru.Expression != null)
            {
                targetCommand.AddParameter("PassThru", PassThru.Get(context));
            }

            if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", PSComputerName.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Esempio n. 16
0
        public void SetToDefault()
        {
            //render config
            useMultiSample   = true;
            useVSync         = true;
            lightShadowLevel = LightShadowLevel.HIGH;
            drawInterval     = DrawInterval.ONE;

            //startup config
            startupType  = StartupType.WINDOW_640_480;
            askEveryTime = true;
        }
Esempio n. 17
0
        public static bool Unregister(StartupType regtype, string applicationName)
        {
            if (regtype == StartupType.Null)
            {
                return(false);
            }
            switch (regtype)
            {
            case StartupType.DefaultStartupFolder:
                string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup),
                                           applicationName + ".lnk");
                if (File.Exists(path))
                {
                    File.Delete(path);
                    return(true);
                }
                return(false);

            case StartupType.MachineStartupRegistry:
                RegistryKey add = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
                    @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
                if (add == null)
                {
                    throw new Exception("Invalid registery path.");
                }
                add.DeleteValue(applicationName, true);
                return(true);

            case StartupType.LocalUserStartupRegistry:
                var ad = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.Delete);
                try {
                    Microsoft.Win32.Registry.CurrentUser.DeleteValue(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" +
                                                                     applicationName);
                }
                catch (ArgumentException e) {
                    if (e.Message.Contains("No value exists"))
                    {
                        return(false);
                    }
                }
                if (ad == null)
                {
                    throw new Exception("Invalid registery path.");
                }
                ad.DeleteValue(applicationName, true);
                return(true);
            }
            return(false);
        }
Esempio n. 18
0
 private int ConvertStartupType(StartupType startupType)
 {
     if (startupType == StartupType.Normal)
     {
         return(0);
     }
     else if (startupType == StartupType.Medium)
     {
         return(1);
     }
     else
     {
         return(2);
     }
 }
Esempio n. 19
0
    void Awake()
    {
        StartCoroutine(OnGameStateChange(GameState));
        StartCoroutine(OnStartupDoneEvent());
        StartCoroutine(OnCocktailModes(selectedCocktailModes.Count));
        StartCoroutine(OnSequenceChangement(ModeSequenceType));
        StartCoroutine(OnEnvironementChromaChangement(environementChroma));

        SetupRewiredPlayers();

        ReInput.ControllerConnectedEvent    += (ControllerStatusChangedEventArgs obj) => UpdateGamepadList();
        ReInput.ControllerDisconnectedEvent += (ControllerStatusChangedEventArgs obj) => UpdateGamepadList();

        //OnPlaying += UpdateGamepadList;
        OnMenu += UpdateGamepadList;

        LoadModeManager.Instance.OnLevelUnloaded += UpdateGamepadList;

        OnPlaying     += () => SetMouseVisibility();
        OnRestartMode += () => SetMouseVisibility();
        OnPlaying     += UpdatePlayedModes;
        OnMenu        += () => Startup = StartupType.Wave;
        OnEndMode     += () => Startup = StartupType.Delayed;
        OnEnvironementChromaChange += SetPlayerMouseCursor;

        MenuManager.Instance.OnStartModeClick += UpdateGamepadList;
        MenuManager.Instance.OnStartModeClick += CreateAIs;

        SetPlayerMouseCursor();

        mainCamera         = GameObject.FindGameObjectWithTag("MainCamera");
        screenShakeCamera  = mainCamera.GetComponent <ScreenShakeCamera>();
        zoomCamera         = mainCamera.GetComponent <ZoomCamera>();
        dynamicCamera      = mainCamera.GetComponent <DynamicCamera>();
        menuCameraMovement = mainCamera.GetComponent <MenuCameraMovement>();
        slowMotionCamera   = mainCamera.GetComponent <SlowMotionCamera>();

        fixedDeltaTime   = Time.fixedDeltaTime;
        fixedDeltaFactor = 1 / fixedDeltaTime;

        GraphicsQualityManager.Instance.OnFixedDeltaTimeChange += (x) =>
        {
            fixedDeltaTime   = x;
            fixedDeltaFactor = 1 / fixedDeltaTime;
        };

        LoadEnvironementChroma();
    }
Esempio n. 20
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if (BinaryPathName.Expression != null)
            {
                targetCommand.AddParameter("BinaryPathName", BinaryPathName.Get(context));
            }

            if (ServiceDisplayName.Expression != null)
            {
                targetCommand.AddParameter("DisplayName", ServiceDisplayName.Get(context));
            }

            if (Description.Expression != null)
            {
                targetCommand.AddParameter("Description", Description.Get(context));
            }

            if (StartupType.Expression != null)
            {
                targetCommand.AddParameter("StartupType", StartupType.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if (DependsOn.Expression != null)
            {
                targetCommand.AddParameter("DependsOn", DependsOn.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
 private void SetupServiceStartup(ServiceInstaller serviceInstaller, StartupType startupType)
 {
     switch (startupType)
     {
         case StartupType.Disabled:
             serviceInstaller.StartType = ServiceStartMode.Disabled;
             break;
         case StartupType.Manual:
             serviceInstaller.StartType = ServiceStartMode.Manual;
             break;
         case StartupType.Automatic:
             serviceInstaller.StartType = ServiceStartMode.Automatic;
             break;
         case StartupType.AutomaticDelayedStart:
             serviceInstaller.DelayedAutoStart = true;
             goto case StartupType.Automatic;
     }
 }
Esempio n. 22
0
        private List <StartupObject> EnumerateKey(RegistryKey key, StartupType type)
        {
            List <StartupObject> objList = new List <StartupObject>();

            foreach (string name in key.GetValueNames())
            {
                StartupObject obj = new StartupObject();
                obj.Name = name;
                obj.Path = FilterPath(key.GetValue(name).ToString());
                obj.Type = type;

                Debug.WriteLine(Path.GetDirectoryName(obj.Path));

                objList.Add(obj);
            }

            return(objList);
        }
        private void SetupServiceStartup(ServiceInstaller serviceInstaller, StartupType startupType)
        {
            switch (startupType)
            {
            case StartupType.Disabled:
                serviceInstaller.StartType = ServiceStartMode.Disabled;
                break;

            case StartupType.Manual:
                serviceInstaller.StartType = ServiceStartMode.Manual;
                break;

            case StartupType.Automatic:
                serviceInstaller.StartType = ServiceStartMode.Automatic;
                break;

            case StartupType.AutomaticDelayedStart:
                serviceInstaller.DelayedAutoStart = true;
                goto case StartupType.Automatic;
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Validates that the starttype supplied on the command line is an allowable <see cref="StartUpType"/>.
 /// </summary>
 /// <returns>true if action is valid, otherwise false.</returns>
 private bool ValidateStartType()
 {
     bool validStartType = true;
     if (string.Compare(starttype, "automatic", true) == 0)
     {
         _startupType = StartupType.Automatic;
     }
     else if (string.Compare(starttype, "manual", true) == 0)
     {
         _startupType = StartupType.Manual;
     }
     else if (string.Compare(starttype, "disabled", true) == 0)
     {
         _startupType = StartupType.Disabled;
     }
     else
     {
         Console.WriteLine("Unrecognized value specified for Action: {0}", action);
         Console.WriteLine(Parser.ArgumentsUsage(this.GetType()));
         validStartType = false;
     }
     return validStartType;
 }
Esempio n. 25
0
        public ModularStartupActivator(IConfiguration configuration)
        {
            Configuration = configuration;
            var ci = StartupType !.GetConstructor(new[] { typeof(IConfiguration) });

            if (ci != null)
            {
                Instance = (ModularStartup)ci.Invoke(new[] { Configuration });
            }
            else
            {
                ci = StartupType.GetConstructor(Type.EmptyTypes);
                if (ci != null)
                {
                    Instance = (ModularStartup)ci.Invoke(TypeConstants.EmptyObjectArray);
                    Instance.Configuration = configuration;
                }
                else
                {
                    throw new NotSupportedException($"{StartupType.Name} does not have a {StartupType.Name}(IConfiguration) constructor");
                }
            }
        }
Esempio n. 26
0
        ///<summary>
        ///Translate StartupType into a human readable string.
        ///</summary>
        private string TranslateType(StartupType type)
        {
            switch (type)
            {
            case StartupType.FOLDER:
                return("Startup Folder");

            case StartupType.REGISTRY32_CU:
                return("Registry32 Current User");

            case StartupType.REGISTRY32_LM:
                return("Registry32 Local Machine");

            case StartupType.REGISTRY64_CU:
                return("Registry64 Current User");

            case StartupType.REGISTRY64_LM:
                return("Registry64 Local Machine");

            default:
                return("Undefined");
            }
        }
        private static StartupMethods PrepareStartup(IServiceCollection serviceCollection)
        {
            StartupMethods startupMethods = null;

            if (StartupType != null)
            {
                startupMethods = StartupLoader.LoadMethods(
                    serviceCollection.BuildServiceProvider(),
                    StartupType,
                    Environment.EnvironmentName);

                if (typeof(IStartup).GetTypeInfo().IsAssignableFrom(StartupType.GetTypeInfo()))
                {
                    serviceCollection.AddSingleton(typeof(IStartup), StartupType);
                }
                else
                {
                    serviceCollection.AddSingleton(typeof(IStartup), sp => new ConventionBasedStartup(startupMethods));
                }
            }

            return(startupMethods);
        }
Esempio n. 28
0
        private async void InstallUdpRx()
        {
            var         startTypeString = (string)App.Current.Properties["serviceStartType"];
            StartupType stype           = StartupType.Manual;

            if (startTypeString == "Manual")
            {
                stype = StartupType.Manual;
            }
            else if (startTypeString == "Automatic - Delayed")
            {
                stype = StartupType.AutomaticDelayed;
            }
            else if (startTypeString == "Automatic")
            {
                stype = StartupType.Automatic;
            }
            var ir = new udp_rx_install_runner();

            ir.StartType = stype;
            await Task.Run(() => ir.RunInstaller("", "", ""));

            this.NavigationService.Navigate(new Finished());
        }
Esempio n. 29
0
        public void UnpackRegionInfoData(OSDMap args)
        {
            if (args.ContainsKey("region_id"))
                RegionID = args["region_id"].AsUUID();
            if (args.ContainsKey("region_name"))
                RegionName = args["region_name"].AsString();
            if (args.ContainsKey("http_port"))
                UInt32.TryParse(args["http_port"].AsString(), out m_httpPort);
            if (args.ContainsKey("region_xloc"))
            {
                int locx;
                Int32.TryParse(args["region_xloc"].AsString(), out locx);
                RegionLocX = locx;
            }
            if (args.ContainsKey("region_yloc"))
            {
                int locy;
                Int32.TryParse(args["region_yloc"].AsString(), out locy);
                RegionLocY = locy;
            }
            IPAddress ip_addr = null;
            if (args.ContainsKey("internal_ep_address"))
            {
                IPAddress.TryParse(args["internal_ep_address"].AsString(), out ip_addr);
            }
            int port = 0;
            if (args.ContainsKey("internal_ep_port"))
            {
                Int32.TryParse(args["internal_ep_port"].AsString(), out port);
            }
            InternalEndPoint = new IPEndPoint(ip_addr, port);
            if (args.ContainsKey("region_type"))
                m_regionType = args["region_type"].AsString();

            if (args.ContainsKey("scope_id"))
                ScopeID = args["scope_id"].AsUUID();
            if (args.ContainsKey("all_scope_ids"))
                AllScopeIDs = ((OSDArray) args["all_scope_ids"]).ConvertAll<UUID>(o => o);

            if (args.ContainsKey("region_size_x"))
                RegionSizeX = args["region_size_x"].AsInteger();
            if (args.ContainsKey("region_size_y"))
                RegionSizeY = args["region_size_y"].AsInteger();
            if (args.ContainsKey("region_size_z"))
                RegionSizeZ = args["region_size_z"].AsInteger();

            if (args.ContainsKey("object_capacity"))
                m_objectCapacity = args["object_capacity"].AsInteger();
            if (args.ContainsKey("region_type"))
                RegionType = args["region_type"].AsString();
            if (args.ContainsKey("see_into_this_sim_from_neighbor"))
                SeeIntoThisSimFromNeighbor = args["see_into_this_sim_from_neighbor"].AsBoolean();
            if (args.ContainsKey("startupType"))
                Startup = (StartupType) args["startupType"].AsInteger();
            if (args.ContainsKey("InfiniteRegion"))
                InfiniteRegion = args["InfiniteRegion"].AsBoolean();
            if (args.ContainsKey("RegionSettings"))
            {
                RegionSettings = new RegionSettings();
                RegionSettings.FromOSD((OSDMap) args["RegionSettings"]);
            }
            if (args.ContainsKey("GridSecureSessionID"))
                GridSecureSessionID = args["GridSecureSessionID"];
            if (args.ContainsKey("OpenRegionSettings"))
            {
                OpenRegionSettings = new OpenRegionSettings();
                OpenRegionSettings.FromOSD((OSDMap) args["OpenRegionSettings"]);
            }
            else
                OpenRegionSettings = new OpenRegionSettings();
            if (args.ContainsKey("EnvironmentSettings"))
                EnvironmentSettings = args["EnvironmentSettings"];
        }
Esempio n. 30
0
 private int ConvertStartupType (StartupType startupType2)
 {
     return startupType2 == StartupType.Normal ? 0 : 1;
 }
Esempio n. 31
0
        public void UnpackRegionInfoData(OSDMap args)
        {
            if (args.ContainsKey("region_id"))
                RegionID = args["region_id"].AsUUID();
            if (args.ContainsKey("region_name"))
                RegionName = args["region_name"].AsString();
            if (args.ContainsKey("external_host_name"))
                ExternalHostName = args["external_host_name"].AsString();
            if (args.ContainsKey("http_port"))
                UInt32.TryParse(args["http_port"].AsString(), out m_httpPort);
            if (args.ContainsKey("region_xloc"))
            {
                int locx;
                Int32.TryParse(args["region_xloc"].AsString(), out locx);
                RegionLocX = locx;
            }
            if (args.ContainsKey("region_yloc"))
            {
                int locy;
                Int32.TryParse(args["region_yloc"].AsString(), out locy);
                RegionLocY = locy;
            }
            IPAddress ip_addr = null;
            if (args.ContainsKey("internal_ep_address"))
            {
                IPAddress.TryParse(args["internal_ep_address"].AsString(), out ip_addr);
            }
            int port = 0;
            if (args.ContainsKey("internal_ep_port"))
            {
                Int32.TryParse(args["internal_ep_port"].AsString(), out port);
            }
            InternalEndPoint = new IPEndPoint(ip_addr, port);
            if (args.ContainsKey("allow_alt_ports"))
                m_allow_alternate_ports = args["allow_alt_ports"].AsBoolean();
            if (args.ContainsKey("region_type"))
                m_regionType = args["region_type"].AsString();
            if (args.ContainsKey("password"))
                Password = args["password"].AsUUID();

            if (args.ContainsKey("disabled"))
                Disabled = args["disabled"].AsBoolean();
            if (args.ContainsKey("scope_id"))
                ScopeID = args["scope_id"].AsUUID();

            if (args.ContainsKey("region_size_x"))
                RegionSizeX = args["region_size_x"].AsInteger();
            if (args.ContainsKey("region_size_y"))
                RegionSizeY = args["region_size_y"].AsInteger();
            if (args.ContainsKey("region_size_z"))
                RegionSizeZ = args["region_size_z"].AsInteger();

            if (args.ContainsKey("object_capacity"))
                m_objectCapacity = args["object_capacity"].AsInteger();
            if (args.ContainsKey("region_type"))
                RegionType = args["region_type"].AsString();
            if (args.ContainsKey("see_into_this_sim_from_neighbor"))
                SeeIntoThisSimFromNeighbor = args["see_into_this_sim_from_neighbor"].AsBoolean();
            if (args.ContainsKey("trust_binaries_from_foreign_sims"))
                TrustBinariesFromForeignSims = args["trust_binaries_from_foreign_sims"].AsBoolean();
            if (args.ContainsKey("allow_script_crossing"))
                AllowScriptCrossing = args["allow_script_crossing"].AsBoolean();
            if (args.ContainsKey("allow_physical_prims"))
                AllowPhysicalPrims = args["allow_physical_prims"].AsBoolean();
            if(args.ContainsKey("number_startup"))
                NumberStartup = args["number_startup"].AsInteger();
            if (args.ContainsKey ("startupType"))
                Startup = (StartupType)args["startupType"].AsInteger();
            FindExternalAutomatically = args["FindExternalIP"].AsBoolean();
            if (args.ContainsKey("RegionSettings"))
            {
                RegionSettings = new RegionSettings();
                RegionSettings.FromOSD((OSDMap)args["RegionSettings"]);
            }
        }
Esempio n. 32
0
        /// <summary>
        /// Regions startup selection.
        /// </summary>
        /// <returns>The startup selection.</returns>
        /// <param name="translator">Translator.</param>
        /// <param name="selStartup">Sel startup.</param>
        public static List<Dictionary<string, object>> RegionStartupSelection (ITranslator translator, StartupType selStartup)
        {
            var args = new List<Dictionary<string, object>> ();
            args.Add (new Dictionary<string, object> {
                {"Value", translator.GetTranslatedString("NormalText")},
                {"Index","n"},
                { "selected", selStartup == StartupType.Normal ? "selected" : "" }
            });
            args.Add (new Dictionary<string, object> {
                {"Value", translator.GetTranslatedString("DelayedText")},
                {"Index","m"},
                { "selected", selStartup == StartupType.Medium ? "selected" : "" }
            });

            return args;
        }
Esempio n. 33
0
        public void UnpackRegionInfoData(OSDMap args)
        {
            if (args.ContainsKey("region_id"))
                RegionID = args["region_id"].AsUUID();
            if (args.ContainsKey("region_name"))
                RegionName = args["region_name"].AsString();
            if (args.ContainsKey("http_port"))
                UInt32.TryParse(args["http_port"].AsString(), out m_httpPort);
            if (args.ContainsKey("region_xloc"))
            {
                int locx;
                Int32.TryParse(args["region_xloc"].AsString(), out locx);
                RegionLocX = locx;
            }
            if (args.ContainsKey("region_yloc"))
            {
                int locy;
                Int32.TryParse(args["region_yloc"].AsString(), out locy);
                RegionLocY = locy;
            }
            IPAddress ip_addr = null;
            if (args.ContainsKey("internal_ep_address"))
            {
                IPAddress.TryParse(args["internal_ep_address"].AsString(), out ip_addr);
            }
            int port = 0;
            if (args.ContainsKey("internal_ep_port"))
            {
                Int32.TryParse(args["internal_ep_port"].AsString(), out port);
            }
            InternalEndPoint = new IPEndPoint(ip_addr, port);
            if (args.ContainsKey("region_type"))
                m_regionType = args["region_type"].AsString();
            if (args.ContainsKey("password"))
                Password = args["password"].AsUUID();

            if (args.ContainsKey("disabled"))
                Disabled = args["disabled"].AsBoolean();
            if (args.ContainsKey("scope_id"))
                ScopeID = args["scope_id"].AsUUID();
            if (args.ContainsKey("all_scope_ids"))
                AllScopeIDs = ((OSDArray)args["all_scope_ids"]).ConvertAll<UUID>(o => o);

            if (args.ContainsKey("region_size_x"))
                RegionSizeX = args["region_size_x"].AsInteger();
            if (args.ContainsKey("region_size_y"))
                RegionSizeY = args["region_size_y"].AsInteger();
            if (args.ContainsKey("region_size_z"))
                RegionSizeZ = args["region_size_z"].AsInteger();

            if (args.ContainsKey("object_capacity"))
                m_objectCapacity = args["object_capacity"].AsInteger();
            if (args.ContainsKey("region_type"))
                RegionType = args["region_type"].AsString();
            if (args.ContainsKey("see_into_this_sim_from_neighbor"))
                SeeIntoThisSimFromNeighbor = args["see_into_this_sim_from_neighbor"].AsBoolean();
            if (args.ContainsKey("trust_binaries_from_foreign_sims"))
                TrustBinariesFromForeignSims = args["trust_binaries_from_foreign_sims"].AsBoolean();
            if (args.ContainsKey("allow_script_crossing"))
                AllowScriptCrossing = args["allow_script_crossing"].AsBoolean();
            if (args.ContainsKey("allow_physical_prims"))
                AllowPhysicalPrims = args["allow_physical_prims"].AsBoolean();
            if (args.ContainsKey ("startupType"))
                Startup = (StartupType)args["startupType"].AsInteger();
            if(args.ContainsKey("InfiniteRegion"))
                InfiniteRegion = args["InfiniteRegion"].AsBoolean();
            if (args.ContainsKey("RegionSettings"))
            {
                RegionSettings = new RegionSettings();
                RegionSettings.FromOSD((OSDMap)args["RegionSettings"]);
            }
            if (args.ContainsKey ("UDPPorts"))
            {
                OSDArray ports = (OSDArray)args["UDPPorts"];
                foreach (OSD p in ports)
                    m_UDPPorts.Add (p.AsInteger ());
            }
            if (!m_UDPPorts.Contains (InternalEndPoint.Port))
                m_UDPPorts.Add (InternalEndPoint.Port);
        }
Esempio n. 34
0
        public void UnpackRegionInfoData(OSDMap args)
        {
            if (args.ContainsKey("region_id"))
            {
                RegionID = args["region_id"].AsUUID();
            }
            if (args.ContainsKey("region_name"))
            {
                RegionName = args["region_name"].AsString();
            }
            if (args.ContainsKey("http_port"))
            {
                UInt32.TryParse(args["http_port"].AsString(), out m_httpPort);
            }
            if (args.ContainsKey("region_xloc"))
            {
                int locx;
                Int32.TryParse(args["region_xloc"].AsString(), out locx);
                RegionLocX = locx;
            }
            if (args.ContainsKey("region_yloc"))
            {
                int locy;
                Int32.TryParse(args["region_yloc"].AsString(), out locy);
                RegionLocY = locy;
            }
            IPAddress ip_addr = null;

            if (args.ContainsKey("internal_ep_address"))
            {
                IPAddress.TryParse(args["internal_ep_address"].AsString(), out ip_addr);
            }
            int port = 0;

            if (args.ContainsKey("internal_ep_port"))
            {
                Int32.TryParse(args["internal_ep_port"].AsString(), out port);
            }
            InternalEndPoint = new IPEndPoint(ip_addr, port);
            if (args.ContainsKey("region_type"))
            {
                m_regionType = args["region_type"].AsString();
            }
            if (args.ContainsKey("password"))
            {
                Password = args["password"].AsUUID();
            }

            if (args.ContainsKey("disabled"))
            {
                Disabled = args["disabled"].AsBoolean();
            }
            if (args.ContainsKey("scope_id"))
            {
                ScopeID = args["scope_id"].AsUUID();
            }

            if (args.ContainsKey("region_size_x"))
            {
                RegionSizeX = args["region_size_x"].AsInteger();
            }
            if (args.ContainsKey("region_size_y"))
            {
                RegionSizeY = args["region_size_y"].AsInteger();
            }
            if (args.ContainsKey("region_size_z"))
            {
                RegionSizeZ = args["region_size_z"].AsInteger();
            }

            if (args.ContainsKey("object_capacity"))
            {
                m_objectCapacity = args["object_capacity"].AsInteger();
            }
            if (args.ContainsKey("region_type"))
            {
                RegionType = args["region_type"].AsString();
            }
            if (args.ContainsKey("see_into_this_sim_from_neighbor"))
            {
                SeeIntoThisSimFromNeighbor = args["see_into_this_sim_from_neighbor"].AsBoolean();
            }
            if (args.ContainsKey("trust_binaries_from_foreign_sims"))
            {
                TrustBinariesFromForeignSims = args["trust_binaries_from_foreign_sims"].AsBoolean();
            }
            if (args.ContainsKey("allow_script_crossing"))
            {
                AllowScriptCrossing = args["allow_script_crossing"].AsBoolean();
            }
            if (args.ContainsKey("allow_physical_prims"))
            {
                AllowPhysicalPrims = args["allow_physical_prims"].AsBoolean();
            }
            if (args.ContainsKey("number_startup"))
            {
                NumberStartup = args["number_startup"].AsInteger();
            }
            if (args.ContainsKey("startupType"))
            {
                Startup = (StartupType)args["startupType"].AsInteger();
            }
            if (args.ContainsKey("InfiniteRegion"))
            {
                InfiniteRegion = args["InfiniteRegion"].AsBoolean();
            }
            if (args.ContainsKey("RegionSettings"))
            {
                RegionSettings = new RegionSettings();
                RegionSettings.FromOSD((OSDMap)args["RegionSettings"]);
            }
            if (args.ContainsKey("UDPPorts"))
            {
                OSDArray ports = (OSDArray)args["UDPPorts"];
                foreach (OSD p in ports)
                {
                    m_UDPPorts.Add(p.AsInteger());
                }
            }
            if (!m_UDPPorts.Contains(InternalEndPoint.Port))
            {
                m_UDPPorts.Add(InternalEndPoint.Port);
            }
        }
Esempio n. 35
0
 private int ConvertStartupType(StartupType startupType2)
 {
     return(startupType2 == StartupType.Normal ? 0 : 1);
 }
Esempio n. 36
0
 private int ConvertStartupType (StartupType startupType)
 {
     if (startupType == StartupType.Normal)
         return 0;
     else 
         return 1;
 }
Esempio n. 37
0
        /// <summary>
        ///     Provides 3 different methods\types to register program's
        /// startup to the computer.
        /// </summary>
        /// <param name="regtype">One of the three methods you will</param>
        /// <param name="folder">The folder that the file is located in (w/o the file name itself) for e.g. @"C:\Program Files\"</param>
        /// <param name="file">The file that the shortcut refers to, for e.g. "game.exe" or "2girls1cup.mkv"</param>
        /// <param name="applicationName">Represents the name of the shortcut or the program name in the registry</param>
        public static void Register(StartupType regtype, string folder, string file, string applicationName)
        {
            if (applicationName == null)
            {
                applicationName = AppDomain.CurrentDomain.FriendlyName;
            }
            folder = folder.Replace("file:\\", "");
            string path = Path.Combine(folder, file);

            if (string.IsNullOrEmpty(Path.GetFileName(path)))
            {
                throw new InvalidOperationException("Could not find a file name at the combined path \"" + path + "\"");
            }


            switch (regtype)
            {
            case StartupType.DefaultStartupFolder:
                if (File.Exists(path) == false)
                {
                    throw new IOException("Could not find file for shortcut creation at/in \"" + path + "\"");
                }
                var link = (IShellLink) new ShellLink();
                link.SetDescription("My Description");
                link.SetPath(path);
                string targetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup),
                                                 ((string.IsNullOrEmpty(applicationName)
                                                           ? ((file.Contains(".") ? file.Split('.')[0] : file))
                                                           : applicationName) + ".lnk"));
                if (File.Exists(targetPath))
                {
                    throw new IOException("Shortcut already exists at/as \"" + targetPath + "\"");
                }
                ((IPersistFile)link).Save(targetPath, false);
                return;


            case StartupType.MachineStartupRegistry:
                RegistryKey add = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
                    @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
                if (add == null)
                {
                    throw new Exception("Invalid registery path.");
                }
                add.SetValue(string.IsNullOrEmpty(applicationName) ? file : applicationName, "\"" + path + "\"");
                return;


            case StartupType.LocalUserStartupRegistry:
                RegistryKey ad = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",
                                                                                 true);
                if (ad == null)
                {
                    throw new Exception("Invalid registery path.");
                }
                ad.SetValue(string.IsNullOrEmpty(applicationName) ? file : applicationName, "\"" + path + "\"");
                return;


            default:
                throw new ArgumentOutOfRangeException("regtype");
            }
        }
Esempio n. 38
0
 public AppStartupRegisteration(StartupType type, string path, string name)
 {
     Name = name;
     Path = path;
     Type = type;
 }
Esempio n. 39
0
    private string GetAppSecretString(string appSecret, string transmissionTargetToken, StartupType startupType)
    {
#if UNITY_WSA_10_0
        return(appSecret);
#else
        switch (startupType)
        {
        default:
        case StartupType.AppCenter:
            return(appSecret);

        case StartupType.NoSecret:
            return(string.Empty);

        case StartupType.OneCollector:
            return(string.Format("target={0}", transmissionTargetToken));

        case StartupType.Both:
            return(string.Format("appsecret={0};target={1}", appSecret, transmissionTargetToken));
        }
#endif
    }