コード例 #1
0
        private void AddLocationInputImpl(SectionInput sectionInput, bool isIndirectLocation)
        {
            List <SectionInput> list = isIndirectLocation ? this._indirectLocationInputs : this._locationInputs;
            int num = isIndirectLocation ? 0x20 : 0x10;

            if (list == null)
            {
                list = new List <SectionInput>(1);
                if (isIndirectLocation)
                {
                    this._indirectLocationInputs = list;
                }
                else
                {
                    this._locationInputs = list;
                }
            }
            list.Insert(0, sectionInput);
            if (!sectionInput.HasErrors && !this._flags[num])
            {
                OverrideMode overrideMode = sectionInput.SectionXmlInfo.OverrideModeSetting.OverrideMode;
                if (overrideMode != OverrideMode.Inherit)
                {
                    this.ChangeLockSettings(overrideMode, overrideMode);
                    this._flags[num] = true;
                }
            }
        }
コード例 #2
0
        internal static object ToJsonModel(Site site, string path)
        {
            var urlSection = GetUrlCompressionSection(site, path);

            // Http Compression section has 'allowDefinition="AppHostOnly"' which means it can only be edited at webserver level
            // We factor this in when displaying the metadata
            var httpSection = GetHttpCompressionSection(site, path);

            bool         isLocal               = urlSection.IsLocallyStored || httpSection.IsLocallyStored;
            bool         isLocked              = urlSection.IsLocked;
            OverrideMode overrideMode          = urlSection.OverrideMode;
            OverrideMode overrideModeEffective = urlSection.OverrideModeEffective;


            CompressionId compressionId = new CompressionId(site?.Id, path, isLocal);

            var obj = new {
                id        = compressionId.Uuid,
                scope     = site == null ? string.Empty : site.Name + path,
                metadata  = ConfigurationUtility.MetadataToJson(isLocal, isLocked, overrideMode, overrideModeEffective),
                directory = httpSection.Directory,
                do_disk_space_limitting = httpSection.DoDiskSpaceLimiting,
                max_disk_space_usage    = httpSection.MaxDiskSpaceUsage,
                min_file_size           = httpSection.MinFileSizeForComp,
                do_dynamic_compression  = urlSection.DoDynamicCompression,
                do_static_compression   = urlSection.DoStaticCompression,
                website = SiteHelper.ToJsonModelRef(site)
            };

            return(Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
コード例 #3
0
        public static void SetForce(Vector2 force, int priority, OverrideMode overrideMode = OverrideMode.Both)
        {
            if (!HasInitialized)
            {
                Debug.LogError($"AirDriVRSystem SetForce failed: AirDriVRSystem has not yet been initialized.");
                return;
            }

            if (priority < 0)
            {
                Debug.LogError($"AirDriVRSystem SetForce failed: Priority must be greater than 0.");
                return;
            }

            if (priority < Instance.currentPriority)
            {
                return;
            }

            Instance.currentPriority = priority;
            if ((overrideMode & OverrideMode.XOnly) != 0)
            {
                Instance.currentForce.x = force.x;
            }
            if ((overrideMode & OverrideMode.YOnly) != 0)
            {
                Instance.currentForce.y = force.y;
            }
            Instance.buffer[0] = (byte)(int)Instance.adtMode; // Header
        }
コード例 #4
0
        // Environment variables are available from process start, so safe to do setup in a static constructor
        static BabysitterSupport()
        {
            string overrideModeString = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RUN_MODE");
            string overrideTestString = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RUN_TEST");

            if (overrideModeString == "RUN")
            {
                Override = OverrideMode.Run;
            }
            else if (overrideModeString == "EXCLUDE")
            {
                Override = OverrideMode.Exclude;
            }
            if (Override != OverrideMode.None)
            {
                string[] overrideTests = overrideTestString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in overrideTests)
                {
                    OverrideTests[s] = true;
                }
            }

            CurrentTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE");
            RanTestFile     = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RAN_TEST_FILE");
            FailedTestFile  = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE");
        }
コード例 #5
0
        internal static object ToJsonModel(Site site, string path)
        {
            if (site == null)
            {
                throw new ArgumentException("site");
            }

            var section = GetAccessSection(site, path);

            bool         isLocal               = section.IsLocallyStored;
            bool         isLocked              = section.IsLocked;
            OverrideMode overrideMode          = section.OverrideMode;
            OverrideMode overrideModeEffective = section.OverrideModeEffective;

            HttpAccessSslFlags        sslFlags = section.SslFlags;
            ClientCertificateSettings clientCertSettings;

            if (sslFlags.HasFlag(HttpAccessSslFlags.SslRequireCert))
            {
                clientCertSettings = ClientCertificateSettings.REQUIRE;
            }
            else if (sslFlags.HasFlag(HttpAccessSslFlags.SslNegotiateCert))
            {
                clientCertSettings = ClientCertificateSettings.ACCEPT;
            }
            else
            {
                clientCertSettings = ClientCertificateSettings.IGNORE;
            }

            bool hasHttpsBinding = false;

            if (!(site == null))
            {
                foreach (Binding binding in site.Bindings)
                {
                    if (binding.Protocol.Equals("https", StringComparison.OrdinalIgnoreCase))
                    {
                        hasHttpsBinding = true;
                        break;
                    }
                }
            }

            SslSettingId id = new SslSettingId(site?.Id, path, isLocal);

            var obj = new {
                id                  = id.Uuid,
                scope               = site == null ? string.Empty : site.Name + path,
                metadata            = ConfigurationUtility.MetadataToJson(isLocal, isLocked, overrideMode, overrideModeEffective),
                require_ssl         = sslFlags.HasFlag(HttpAccessSslFlags.Ssl) || sslFlags.HasFlag(HttpAccessSslFlags.Ssl128),
                client_certificates = Enum.GetName(typeof(ClientCertificateSettings), clientCertSettings).ToLower(),
                has_https_binding   = hasHttpsBinding,
                website             = SiteHelper.ToJsonModelRef(site)
            };

            return(Core.Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
コード例 #6
0
 public static object MetadataToJson(bool isLocal, bool isLocked, OverrideMode overrideMode, OverrideMode overrideModeEffective)
 {
     return(new {
         is_local = isLocal,
         is_locked = isLocked,
         override_mode = Enum.GetName(typeof(OverrideMode), overrideMode).ToLower(),
         override_mode_effective = Enum.GetName(typeof(OverrideMode), overrideModeEffective).ToLower()
     });
 }
コード例 #7
0
ファイル: OverrideModeSetting.cs プロジェクト: chcosta/corefx
        internal static OverrideModeSetting CreateFromXmlReadValue(OverrideMode mode)
        {
            OverrideModeSetting result = new OverrideModeSetting();

            result.SetMode(mode);
            result._mode |= XmlDefinedNewMode;

            return result;
        }
コード例 #8
0
        internal static OverrideModeSetting CreateFromXmlReadValue(OverrideMode mode)
        {
            OverrideModeSetting result = new OverrideModeSetting();

            result.SetMode(mode);
            result._mode |= XmlDefinedNewMode;

            return(result);
        }
コード例 #9
0
ファイル: FtpClient.cs プロジェクト: eimslab/Shove.Net.Fx2
        /// <summary>
        /// 异步下载文件
        /// </summary>
        /// <param name="localFileName"></param>
        /// <param name="remoteFileName"></param>
        /// <param name="mode"></param>
        public void AsynchronousDownload(string localFileName, string remoteFileName, OverrideMode mode)
        {
            Asynchronous_localFileName  = localFileName;
            Asynchronous_remoteFileName = remoteFileName;
            Asynchronous_mode           = mode;

            System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(this.AsynchronousDownload));
            thread.IsBackground = true;
            thread.Start();
        }
コード例 #10
0
 internal void ChangeLockSettings(OverrideMode forSelf, OverrideMode forChildren)
 {
     if (forSelf != OverrideMode.Inherit)
     {
         this._flags[1] = forSelf == OverrideMode.Deny;
         this._flags[2] = forSelf == OverrideMode.Deny;
     }
     if (forChildren != OverrideMode.Inherit)
     {
         this._flags[2] = (forSelf == OverrideMode.Deny) || (forChildren == OverrideMode.Deny);
     }
 }
コード例 #11
0
 internal void ChangeLockSettings(OverrideMode forSelf, OverrideMode forChildren)
 {
     if (forSelf != OverrideMode.Inherit)
     {
         this._flags[1] = forSelf == OverrideMode.Deny;
         this._flags[2] = forSelf == OverrideMode.Deny;
     }
     if (forChildren != OverrideMode.Inherit)
     {
         this._flags[2] = (forSelf == OverrideMode.Deny) || (forChildren == OverrideMode.Deny);
     }
 }
コード例 #12
0
        internal void ChangeLockSettings(OverrideMode forSelf, OverrideMode forChildren)
        {
            if (forSelf != OverrideMode.Inherit)
            {
                _flags[FlagLocked]       = forSelf == OverrideMode.Deny;
                _flags[FlagLockChildren] = forSelf == OverrideMode.Deny;
            }

            if (forChildren != OverrideMode.Inherit)
            {
                _flags[FlagLockChildren] = (forSelf == OverrideMode.Deny) || (forChildren == OverrideMode.Deny);
            }
        }
コード例 #13
0
        AddLocationInputImpl(SectionInput sectionInput, bool isIndirectLocation)
        {
            List <SectionInput> inputs = isIndirectLocation ?
                                         _indirectLocationInputs :
                                         _locationInputs;

            int flag = isIndirectLocation ?
                       Flag_IndirectLocationInputLockApplied :
                       Flag_LocationInputLockApplied;

            if (inputs == null)
            {
                inputs = new List <SectionInput>(1);

                if (isIndirectLocation)
                {
                    _indirectLocationInputs = inputs;
                }
                else
                {
                    _locationInputs = inputs;
                }
            }

            // The list of locationSections is traversed from child to parent,
            // so insert at the beginning of the list.
            inputs.Insert(0, sectionInput);

            // Only the overrideMode from the parent thats closest to the SectionRecord has effect
            //
            // For location input:
            // Remember that this method will be called for location inputs comming from the immediate parent first
            // and then walking the hierarchy up to the root level
            //
            // For indirect location input:
            // This method will be first called for indirect input closest to the location config
            if (!sectionInput.HasErrors)
            {
                if (!_flags[flag])
                {
                    OverrideMode modeLocation = sectionInput.SectionXmlInfo.OverrideModeSetting.OverrideMode;

                    if (modeLocation != OverrideMode.Inherit)
                    {
                        ChangeLockSettings(modeLocation, modeLocation);
                        _flags[flag] = true;
                    }
                }
            }
        }
コード例 #14
0
        public override bool Read(GH_IReader reader)
        {
            int readValue = -1;

            if (reader.ItemExists("recordingMode"))
            {
                reader.TryGetInt32("recordingMode", ref readValue);
                OverrideTypes = (OverrideMode)readValue;
            }

            if (reader.ItemExists("Write"))
            {
                this._isFirstTimeOpen = reader.GetBoolean("Write");
            }


            return(base.Read(reader));
        }
コード例 #15
0
		// Environment variables are available from process start, so safe to do setup in a static constructor
		static BabysitterSupport()
		{
			string overrideModeString = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RUN_MODE");
			string overrideTestString = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RUN_TEST");
			if (overrideModeString == "RUN")
				Override = OverrideMode.Run;
			else if (overrideModeString == "EXCLUDE")
				Override = OverrideMode.Exclude;
			if (Override != OverrideMode.None)
			{
				string[] overrideTests = overrideTestString.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries);
				foreach (string s in overrideTests)
					OverrideTests[s] = true;
			}

			CurrentTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE");
			RanTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_RAN_TEST_FILE");
			FailedTestFile = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE");
		}
コード例 #16
0
        internal static object ToJsonModel(Site site, string path)
        {
            var section          = GetTraceFailedRequestsSection(site, path);
            var providersSection = GetTraceProviderDefinitionSection(site, path);

            bool         isLocal               = section.IsLocallyStored;
            bool         isLocked              = section.IsLocked;
            OverrideMode overrideMode          = section.OverrideMode;
            OverrideMode overrideModeEffective = section.OverrideModeEffective;

            HttpRequestTracingId hrtId = new HttpRequestTracingId(site?.Id, path, isLocal);

            bool   enabled;
            string directory = null;
            long   maximumNumberTraceFiles;

            if (site != null)
            {
                enabled   = site.TraceFailedRequestsLogging.Enabled;
                directory = site.TraceFailedRequestsLogging.Directory;
                maximumNumberTraceFiles = site.TraceFailedRequestsLogging.MaxLogFiles;
            }
            else
            {
                var siteDefaults = ManagementUnit.ServerManager.SiteDefaults;
                enabled   = true;
                directory = siteDefaults.TraceFailedRequestsLogging.Directory;
                maximumNumberTraceFiles = siteDefaults.TraceFailedRequestsLogging.MaxLogFiles;
            }

            var obj = new {
                id        = hrtId.Uuid,
                scope     = site == null ? string.Empty : site.Name + path,
                metadata  = ConfigurationUtility.MetadataToJson(isLocal, isLocked, overrideMode, overrideModeEffective),
                enabled   = enabled,
                directory = directory,
                maximum_number_trace_files = maximumNumberTraceFiles,
                website = SiteHelper.ToJsonModelRef(site)
            };

            return(Environment.Hal.Apply(Defines.Resource.Guid, obj));
        }
コード例 #17
0
        public static object ToJsonModelRef(Site site, string path)
        {
            var section = GetSection(site, path);

            // Set up metadata, this feature has two configuration sections
            bool         isLocal               = section.IsLocallyStored;
            bool         isLocked              = section.IsLocked;
            OverrideMode overrideMode          = section.OverrideMode;
            OverrideMode overrideModeEffective = section.OverrideModeEffective;


            AuthorizationId id = new AuthorizationId(site?.Id, path, isLocal);

            var obj = new {
                id    = id.Uuid,
                scope = site == null ? string.Empty : site.Name + path
            };

            return(Core.Environment.Hal.Apply(Defines.AuthorizationResource.Guid, obj, false));
        }
コード例 #18
0
        public IteratorFlyParam(List <ColibriParam> sourceParams, IteratorSelection selections, string studyFolder, OverrideMode overrideFolderMode)
        {
            this._inputParams        = sourceParams;
            this._selections         = selections == null? new IteratorSelection(): selections;
            this._overrideFolderMode = overrideFolderMode;
            //this._studyFoler = studyFolder;

            this._totalCounts           = ColibriBase.CalTotalCounts(this._inputParams);
            this._selectedCounts        = _selections.SelectedCounts > 0 ? _selections.SelectedCounts : _totalCounts;
            this._allPositions          = ColibriBase.AllParamsPositions(this._inputParams);
            this._allSelectedPositions  = _selections.ParamsSelectedPositions == null? this._allPositions : _selections.ParamsSelectedPositions;
            this._currentPositionsIndex = Enumerable.Repeat(0, _inputParams.Count()).ToList();
            Count = 0;

            createWatchFile(studyFolder);

            //get studied Fly ID from folder
            if (this._overrideFolderMode == OverrideMode.FinishTheRest)
            {
                this._studiedFlyID = getStudiedFlyID(studyFolder);
            }
        }
コード例 #19
0
        internal static object ToJsonModel(Site site, string path)
        {
            var section = GetSection(site, path);

            // Set up metadata, this feature has two configuration sections
            bool         isLocal               = section.IsLocallyStored;
            bool         isLocked              = section.IsLocked;
            OverrideMode overrideMode          = section.OverrideMode;
            OverrideMode overrideModeEffective = section.OverrideModeEffective;


            AuthorizationId id = new AuthorizationId(site?.Id, path, isLocal);

            var obj = new {
                id                 = id.Uuid,
                scope              = site == null ? string.Empty : site.Name + path,
                metadata           = ConfigurationUtility.MetadataToJson(isLocal, isLocked, overrideMode, overrideModeEffective),
                bypass_login_pages = section.BypassLoginPages,
                website            = SiteHelper.ToJsonModelRef(site)
            };

            return(Core.Environment.Hal.Apply(Defines.AuthorizationResource.Guid, obj));
        }
コード例 #20
0
ファイル: OverridableFlag.cs プロジェクト: touky/Prateek
 public Overridable(bool value, OverrideMode mode)
 {
     this.value = value;
     this.mode  = mode;
 }
コード例 #21
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                Document document     = commandData.Application.ActiveUIDocument.Document;
                string   documentGuid = DocumentGuidUtils.GetDocumentGuidFromExtensibleStorage(document);

                string filePath = IOUtils.PromptUserToSelectFile(".json");
                if (string.IsNullOrWhiteSpace(filePath))
                {
                    new InfoWindowView
                    (
                        "Regular DataSpec",
                        "Rule Export Was Cancelled",
                        "The given file path was invalid.",
                        true
                    ).ShowDialog();
                    return(Result.Cancelled);
                }

                string           serialisedRegexRules = JSONFileUtils.ReadJSONFromFile(filePath);
                List <RegexRule> regexRules           = SerializationUtils.DeserializeRegexRules(serialisedRegexRules);

                if (regexRules == null || regexRules.Count < 1)
                {
                    new InfoWindowView
                    (
                        "Regular DataSpec",
                        "No Rules Found",
                        "No DataSpec rules were found in the document",
                        true
                    ).ShowDialog();
                    return(Result.Cancelled);
                }

                // Prompting the user to specify which rules are to be exported
                ObservableCollection <ObservableObject> observableObjects = new ObservableCollection <ObservableObject>();
                foreach (RegexRule regexRule in regexRules)
                {
                    observableObjects.Add(new ObservableObject(regexRule)
                    {
                        DisplayName = regexRule.RuleName,
                        IsChecked   = true,
                    });
                }

                SelectElementsInfo selectElementsInfo = new SelectElementsInfo
                {
                    Document          = document,
                    ObservableObjects = observableObjects,
                    UIDocument        = commandData.Application.ActiveUIDocument,
                    UserMessage       = "Select one or more DataSpec rules to export to the .json file format.",
                };

                SelectElementsView selectElementsView = new SelectElementsView(selectElementsInfo);
                selectElementsView.ShowDialog();

                if (selectElementsView.DialogResult != true)
                {
                    new InfoWindowView
                    (
                        "Regular DataSpec",
                        "Rule Export Was Cancelled",
                        "The user cancelled the export.",
                        true
                    ).ShowDialog();
                    return(Result.Cancelled);
                }

                List <RegexRule> selectedRulesToImport = selectElementsView.SelectElementsViewModel.InputObservableObjects
                                                         .Where(x => x.IsChecked)
                                                         .Select(x => x.OriginalObject)
                                                         .OfType <RegexRule>()
                                                         .ToList();

                List <RegexRule> existingRegexRules = RegularApp.RegexRuleCacheService
                                                      .GetDocumentRules(documentGuid)
                                                      .ToList();

                List <string> existingRegexRuleNames = existingRegexRules
                                                       .Select(x => x.RuleName)
                                                       .ToList();

                List <string> conflictingRegexRuleGuids = selectedRulesToImport
                                                          .Where(x => existingRegexRuleNames.Contains(x.RuleName))
                                                          .Select(x => x.RuleGuid)
                                                          .ToList();

                OverrideMode overrideMode = OverrideMode.None;

                foreach (RegexRule selectedRegexRule in selectedRulesToImport)
                {
                    // Resetting validation score
                    selectedRegexRule.ValidationScore = "";

                    // If there's no conflict then we save and iterate
                    if (!conflictingRegexRuleGuids.Contains(selectedRegexRule.RuleGuid))
                    {
                        RegexRule.Save(documentGuid, selectedRegexRule);
                        continue;
                    }

                    RegexRule conflictingRegexRule = existingRegexRules.FirstOrDefault(x => x.RuleName == selectedRegexRule.RuleName);

                    // Otherwise we can go one of 3 ways
                    switch (overrideMode)
                    {
                    case OverrideMode.None:
                        // Only used for the initial conflicting rule to fall through to the dialog
                        break;

                    case OverrideMode.ReplaceAll:
                        if (conflictingRegexRule == null)
                        {
                            continue;
                        }
                        RegexRule.ReplaceRegexRule(documentGuid, conflictingRegexRule, selectedRegexRule);
                        continue;

                    case OverrideMode.RenameAll:
                        RegexRule.SaveRenamedRegexRule(documentGuid, selectedRegexRule);
                        continue;

                    case OverrideMode.SkipAll:
                        continue;

                    default:
                        continue;
                    }

                    ImportRuleInfo importRuleInfo = new ImportRuleInfo
                    {
                        DocumentGuid      = documentGuid,
                        ExistingRegexRule = conflictingRegexRule,
                        NewRegexRule      = selectedRegexRule
                    };

                    ImportRuleView importRuleView = new ImportRuleView(importRuleInfo);
                    importRuleView.ShowDialog();

                    if (importRuleView.DialogResult != true)
                    {
                        break;
                    }
                    overrideMode = importRuleView.ImportRuleViewModel.OverrideMode;
                }

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(Result.Failed);
            }
        }
コード例 #22
0
        private static void SetCompressionOverrideMode(HttpClient client, JObject feature, OverrideMode overrideMode)
        {
            JObject ret        = null;
            var     delegation = client.Get($"{Delegation.DelegationSectionsUri}?scope={feature.Value<string>("scope")}");
            var     sections   = delegation.Value <JArray>("sections").ToObject <IEnumerable <JObject> >();

            foreach (var sec in sections)
            {
                if (sec.Value <string>("name").Equals("system.webServer/urlCompression"))
                {
                    var o = JObject.FromObject(new
                    {
                        override_mode = overrideMode
                    });


                    ret = client.Patch(Utils.Self(sec), o);
                    break;
                }
            }

            Assert.NotNull(ret);
        }
コード例 #23
0
        internal void ChangeLockSettings(OverrideMode forSelf, OverrideMode forChildren) {

            if (forSelf != OverrideMode.Inherit) {
                _flags[Flag_Locked]         = (forSelf == OverrideMode.Deny);
                _flags[Flag_LockChildren]   = (forSelf == OverrideMode.Deny);
            }

            if (forChildren != OverrideMode.Inherit) {
                _flags[Flag_LockChildren] = ((forSelf == OverrideMode.Deny) || (forChildren == OverrideMode.Deny));
            }
        }
コード例 #24
0
        static void Main(string[] args)
        {
            int[]  sizes            = new int[] { 16, 24, 32, 48, 256 };
            string outputPath       = "";
            bool   includeFileSizes = true;
            byte   cursorX          = 0;
            byte   cursorY          = 0;
            bool   autoStartCmd     = false;

            cDir = Path.GetTempPath() + "IconCreator\\"; //Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
            Directory.CreateDirectory(cDir);


            string help = @"options:
(path1) (path2) (path3) ... // source imgs for icon creation 
/d0  // downscale using nearest neighbour
/d1  // downscale using interpolation (std)
/i0  // only use specified sizes
/i1  // include all input files to the icon (std)
/out (path) // icon output path (std: replace path extension with .ico)
/o0  // override never
/o1  // override ask
/o2  // override always (std)
/s (size1) (size2) (size3) ... / // set included output sizes " + "\n" + @"         // (std: '/s 16 24 32 48 256 /')
/sd  // prefer downscaling (std)
/sn  // prefer nearest scaling
/su  // prefer upscaling
/u0  // upscale using nearest neighbour (std)
/u1  // upscale using interpolation
/x0  // after program is finished, wait for <Enter> to close program
/x1  // auto close program when finished (std)
/a   // auto start command (don't ask the user to add commands) only works when input paths are given
/cur (hotspotX) (hotspotY)   // generate .cur file (not std)";

            if (args.Length == 0)
            {
                Console.WriteLine(help);
            }

            List <string> argsList = args.ToList();

            string optionsCmd = "";

            if (File.Exists(Environment.CurrentDirectory + "\\iconoptions.txt"))
            {
                optionsCmd = File.ReadAllText(Environment.CurrentDirectory + "\\iconoptions.txt", Encoding.Default);
                if (optionsCmd != "")
                {
                    optionsCmd += " / "; // " / " for unused command to seperate commands with multiple parameters from input file paths (f.ex. /s 32 / "C:\\path")
                    if (args.Length > 0)
                    {
                        Console.WriteLine("\noptions loaded:\n" + optionsCmd);
                    }
                    argsList.AddRange(SplitCommandString(optionsCmd));
                }
            }

            autoStartCmd = argsList.Contains("/a");

            //if (args.Length == 0)
            if (!autoStartCmd)
            {
                Console.WriteLine("\ntype your command:");

                for (int i = 0; i < args.Length; i++)
                {
                    Console.Write(args[i] + " ");
                }

                if (optionsCmd != "")
                {
                    Console.Write(optionsCmd);
                }

                string cmd = Console.ReadLine();

                argsList.AddRange(SplitCommandString(cmd));
            }

            args = argsList.ToArray();


            argsList = new List <string>();
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].Length > 0 && args[i][0] == '/')
                {
                    //command
                    switch (args[i])
                    {
                    case "/?":
                        Console.WriteLine(help + "\n\nPress <Enter> to continue");
                        Console.ReadLine();
                        break;

                    case "/o0": overrideMode = OverrideMode.Never; break;

                    case "/o1": overrideMode = OverrideMode.Ask; break;

                    case "/o2": overrideMode = OverrideMode.Always; break;

                    case "/sd": preferScaling = PreferScaling.Down; break;    //down scaling

                    case "/su": preferScaling = PreferScaling.Up; break;      //up scaling

                    case "/sn": preferScaling = PreferScaling.Nearest; break; //nearest scaling

                    case "/x0": autoClose = false; break;

                    case "/x1": autoClose = true; break;

                    case "/out":
                        if (i + 1 < args.Length)
                        {
                            outputPath = args[++i];
                        }
                        break;

                    case "/i0": includeFileSizes = false; break;

                    case "/i1": includeFileSizes = true; break;

                    case "/u0": upscaleInterpolation = InterpolationMode.NearestNeighbor; break;

                    case "/u1": upscaleInterpolation = InterpolationMode.Default; break;

                    case "/d0": downscaleInterpolation = InterpolationMode.NearestNeighbor; break;

                    case "/d1": downscaleInterpolation = InterpolationMode.Default; break;

                    case "/s":
                        List <int> sizesList = new List <int>();
                        while (++i < args.Length)
                        {
                            if (args[i].Length > 0 && args[i][0] != '/')
                            {
                                //no command -> new size
                                int newSize;
                                if (int.TryParse(args[i], out newSize))
                                {
                                    sizesList.Add(newSize);
                                }
                                else
                                {
                                    i--;
                                    break;
                                }
                            }
                            else
                            {
                                i--;
                                break;
                            }
                        }
                        sizes = sizesList.ToArray();

                        break;

                    case "/cur":
                        cursor = true;
                        if (args.Length > ++i && args[i][0] != '/')
                        {
                            byte.TryParse(args[i], out cursorX);

                            if (args.Length > ++i && args[i][0] != '/')
                            {
                                byte.TryParse(args[i], out cursorY);
                            }
                        }

                        break;
                    }
                }
                else
                {
                    if (args[i].Length > 0)
                    {
                        if (args[i][0] == '"')
                        {
                            argsList.Add(args[i].Substring(1, args[i].Length - 2));
                        }
                        else
                        {
                            argsList.Add(args[i]);
                        }
                        Console.WriteLine(argsList[argsList.Count - 1]);
                    }
                }
            }

            args = argsList.ToArray();


            //CreateIcon("\\output.ico", "\\input5.png");//"\\input1.png", "\\input2.png", "\\input3.png", "\\input4.png", "\\input5.png");//, "input2.png", "input3.png");
            //CreateIconScaled256(outputPath, args);
            if (!cursor)
            {
                outputPath = GetOutputPath(args[0], outputPath);
                CreateIconScaled(outputPath, args, sizes, !includeFileSizes);
            }
            else
            {
                CreateCursors(args, cursorX, cursorY);
            }
            //min: 16, 32, 48, 256
            //all: 16, 20, 24, 32, 40, 48, 64, 96, 256

            Directory.Delete(cDir, true);

            if (!autoClose)
            {
                Console.WriteLine("\nIcon created!\n\nPress <Enter> to close program.");
                Console.ReadLine();
            }
        }
コード例 #25
0
        /// <summary>
        /// Permet de jouer des sons par dessus les autres ou de les mettre en liste d'attente avant de les jouer.
        /// </summary>
        /// <param name="audioSource"></param>
        /// <param name="audio"></param>
        /// <param name="overrideMode"></param>
        public static void PlayAudioWithOverrideMode(AudioSource audioSource, AudioClip audio, OverrideMode overrideMode = OverrideMode.Replace)
        {
            if (audioSource == null || audio == null)
            {
                return;
            }

            switch (overrideMode)
            {
            case OverrideMode.Replace:
                audioSource.clip = audio;
                audioSource.Play();
                break;

            case OverrideMode.Queue:
                if (audioSource.isPlaying == true)
                {
                    audioQueue.Add(audio);
                }
                else if (audioQueue.Count > 0)
                {
                    audioSource.PlayOneShot(audioQueue[0]);
                    audioQueue.Remove(audioQueue[0]);
                }
                else
                {
                    audioSource.PlayOneShot(audio);
                }
                break;

            case OverrideMode.Simultaneous:
                audioSource.PlayOneShot(audio);
                break;
            }
        }
コード例 #26
0
 private void Menu_DoClick_AppendAll(object sender, EventArgs e)
 {
     this.setWriteFileToFalse();
     this.OverrideTypes = OverrideMode.AppendAllToTheEnd;
     updateMsg();
 }
コード例 #27
0
ファイル: OverrideModeSetting.cs プロジェクト: chcosta/corefx
 private void SetMode(OverrideMode mode)
 {
     _mode = (byte)mode;
 }
コード例 #28
0
ファイル: OverrideModeSetting.cs プロジェクト: chcosta/corefx
 // Use this method to change only the value of the setting when not done through the public API
 internal void ChangeModeInternal(OverrideMode mode)
 {
     SetMode(mode);
 }
コード例 #29
0
        //Check if Aggregator exist, and if it is at the last
        private bool isAggregatorReady()
        {
            this._aggObj      = null;
            this._studyFolder = "";

            //var folder = "";
            bool isReady = true;

            var checkingMsg = new List <string>();

            checkingMsg = checkIfGetAggregatorObj();

            //Genome is not connected to Aggregator, then there is warning msg in checkingMsg
            if (!checkingMsg.IsNullOrEmpty())
            {
                var userClick = MessageBox.Show("Colibri detected some issues. \nStill continue?\n\n\n" + checkingMsg[0], "Attention", MessageBoxButtons.YesNo);
                if (userClick == DialogResult.Yes)
                {
                    return(true);
                }
                else
                {
                    // user doesn't want ot continue! return false to stop
                    return(false);
                }
            }
            else //this._aggObj exists
            {
                if (this._aggObj != null && this._aggObj.RuntimeMessageLevel != GH_RuntimeMessageLevel.Error)
                {
                    //check aggregator
                    checkingMsg = this._aggObj.CheckAggregatorIfReady();
                }
                else
                {
                    //clear _aggObj, when it has a warning runtime msg.
                    this._aggObj = null;
                    // this._aggObj doesn't exist, return true to start.
                    return(true);
                }
            }


            // checking messages from Aggregator
            if (checkingMsg.IsNullOrEmpty() || _ignoreAllWarningMsg)
            {
                isReady = true;
            }
            else
            {
                string warningMsg = "";
                foreach (var item in checkingMsg)
                {
                    warningMsg += "\n\n" + item;
                }
                var userClick = MessageBox.Show("Colibri detected some issues. \nStill continue?\n" + warningMsg, "Attention", MessageBoxButtons.YesNo);
                if (userClick == DialogResult.No)
                {
                    // user doesn't want ot continue! set isReady to false to stop
                    isReady = false;
                }
                else
                {
                    // user click yes to ignore all Aggregator's msgs
                    return(true);
                }
            }

            this._mode        = this._aggObj.OverrideTypes;
            this._studyFolder = this._aggObj.Folder;
            return(isReady);
        }
コード例 #30
0
 // Use this method to change only the value of the setting when not done through the public API
 internal void ChangeModeInternal(OverrideMode mode)
 {
     SetMode(mode);
 }
コード例 #31
0
 private void SetMode(OverrideMode mode)
 {
     _mode = (byte)mode;
 }
コード例 #32
0
 private void Menu_DoClick_Default(object sender, EventArgs e)
 {
     this.setWriteFileToFalse();
     this.OverrideTypes = OverrideMode.AskEverytime;
     updateMsg();
 }
コード例 #33
0
 private void Menu_DoClick_Override(object sender, EventArgs e)
 {
     this.setWriteFileToFalse();
     this.OverrideTypes = OverrideMode.OverrideAll;
     updateMsg();
 }
コード例 #34
0
ファイル: OverridableFlag.cs プロジェクト: touky/Prateek
 ///---------------------------------------------------------------------
 protected bool CanUse(bool flagValue, OverrideMode overrideValue)
 {
     return((new Overridable(flagValue, overrideValue)).CanUse);
 }
コード例 #35
0
 private void Menu_DoClick_FinishRest(object sender, EventArgs e)
 {
     this.setWriteFileToFalse();
     this.OverrideTypes = OverrideMode.FinishTheRest;
     updateMsg();
 }
コード例 #36
0
ファイル: RestoreBackup.cs プロジェクト: AtjonTV/vocup
        private RestoreResult Restore(ZipArchive archive, string path, FileInfo destination, OverrideMode mode)
        {
            try
            {
                var entry = archive.GetEntry(path);
                if (entry == null)
                {
                    return(RestoreResult.Error);
                }

                if (destination.Exists &&
                    (mode == OverrideMode.Never ||
                     mode == OverrideMode.Older && destination.LastWriteTime > entry.LastWriteTime))
                {
                    return(RestoreResult.Skipped);
                }

                destination.Directory.Create();
                using (var file = destination.Open(FileMode.Create, FileAccess.Write))
                    using (var source = entry.Open())
                    {
                        source.CopyTo(file);
                    }

                destination.LastWriteTimeUtc = entry.LastWriteTime.UtcDateTime;
                return(RestoreResult.Success);
            }
            catch
            {
                return(RestoreResult.Error);
            }
        }