System.Collections.Generic.List.Contains(string)

Here are the examples of the csharp api System.Collections.Generic.List.Contains(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4947 Examples 7

19 View Source File : XnaToFnaUtil.cs
License : zlib License
Project Creator : 0x0ade

public void ScanPath(string path) {
            if (Directory.Exists(path)) {
                // Use the directory as "dependency directory" and scan in it.
                if (Directories.Contains(path))
                    // No need to scan the dir if the dir is scanned...
                    return;

                RestoreBackup(path);

                Log($"[ScanPath] Scanning directory {path}");
                Directories.Add(path);
                replacedemblyResolver.AddSearchDirectory(path); // Needs to be added manually as DependencyDirs was already added

                // Most probably the actual game directory - let's just copy XnaToFna.exe to there to be referenced properly.
                string xtfPath = Path.Combine(path, Path.GetFileName(Thisreplacedembly.Location));
                if (Path.GetDirectoryName(Thisreplacedembly.Location) != path) {
                    Log($"[ScanPath] Found separate game directory - copying XnaToFna.exe and FNA.dll");
                    File.Copy(Thisreplacedembly.Location, xtfPath, true);

                    string dbExt = null;
                    if (File.Exists(Path.ChangeExtension(Thisreplacedembly.Location, "pdb")))
                        dbExt = "pdb";
                    if (File.Exists(Path.ChangeExtension(Thisreplacedembly.Location, "mdb")))
                        dbExt = "mdb";
                    if (dbExt != null)
                        File.Copy(Path.ChangeExtension(Thisreplacedembly.Location, dbExt), Path.ChangeExtension(xtfPath, dbExt), true);

                    if (File.Exists(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll")))
                        File.Copy(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll"), Path.Combine(path, "FNA.dll"), true);
                    else if (File.Exists(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll.tmp")))
                        File.Copy(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll.tmp"), Path.Combine(path, "FNA.dll"), true);

                }

                ScanPaths(Directory.GetFiles(path));
                return;
            }

            if (File.Exists(path + ".xex")) {
                if (!ExtractedXEX.Contains(path)) {
                    // Remove the original file - let XnaToFna unpack and handle it later.
                    File.Delete(path);
                } else {
                    // XnaToFna will handle the .xex instead.
                }
                return;
            }

            if (path.EndsWith(".xex")) {
                string pathTarget = path.Substring(0, path.Length - 4);
                if (string.IsNullOrEmpty(Path.GetExtension(pathTarget)))
                    return;

                using (Stream streamXEX = File.OpenRead(path))
                using (BinaryReader reader = new BinaryReader(streamXEX))
                using (Stream streamRAW = File.OpenWrite(pathTarget)) {
                    XEXImageData data = new XEXImageData(reader);

                    int offset = 0;
                    int size = data.m_memorySize;

                    // Check if this file is a PE containing an embedded PE.
                    if (data.m_memorySize > 0x10000) { // One default segment alignment.
                        using (MemoryStream streamMEM = new MemoryStream(data.m_memoryData))
                        using (BinaryReader mem = new BinaryReader(streamMEM)) {
                            if (mem.ReadUInt32() != 0x00905A4D) // MZ
                                goto WriteRaw;
                            // This is horrible.
                            streamMEM.Seek(0x00000280, SeekOrigin.Begin);
                            if (mem.ReadUInt64() != 0x000061746164692E) // ".idata\0\0"
                                goto WriteRaw;
                            streamMEM.Seek(0x00000288, SeekOrigin.Begin);
                            mem.ReadInt32(); // Virtual size; It's somewhat incorrect?
                            offset = mem.ReadInt32(); // Virtual offset.
                            // mem.ReadInt32(); // Raw size; Still incorrect.
                            // Let's just write everything...
                            size = data.m_memorySize - offset;
                        }
                    }

                    WriteRaw:
                    streamRAW.Write(data.m_memoryData, offset, size);
                }

                path = pathTarget;
                ExtractedXEX.Add(pathTarget);
            } else if (!path.EndsWith(".dll") && !path.EndsWith(".exe"))
                return;

            // Check if .dll is CLR replacedembly
            replacedemblyName name;
            try {
                name = replacedemblyName.GetreplacedemblyName(path);
            } catch {
                return;
            }

            ReaderParameters modReaderParams = Modder.GenReaderParameters(false);
            // Don't ReadWrite if the module being read is XnaToFna or a relink target.
            bool isReadWrite =
#if !CECIL0_9
            modReaderParams.ReadWrite =
#endif
                path != Thisreplacedembly.Location &&
                !Mappings.Exists(mappings => name.Name == mappings.Target);
            // Only read debug info if it exists
            if (!File.Exists(path + ".mdb") && !File.Exists(Path.ChangeExtension(path, "pdb")))
                modReaderParams.ReadSymbols = false;
            Log($"[ScanPath] Checking replacedembly {name.Name} ({(isReadWrite ? "rw" : "r-")})");
            ModuleDefinition mod;
            try {
                mod = MonoModExt.ReadModule(path, modReaderParams);
            } catch (Exception e) {
                Log($"[ScanPath] WARNING: Cannot load replacedembly: {e}");
                return;
            }
            bool add = !isReadWrite || name.Name == ThisreplacedemblyName;

            if ((mod.Attributes & ModuleAttributes.ILOnly) != ModuleAttributes.ILOnly) {
                // Mono.Cecil can't handle mixed mode replacedemblies.
                Log($"[ScanPath] WARNING: Cannot handle mixed mode replacedembly {name.Name}");
                if (MixedDeps == MixedDepAction.Stub) {
                    ModulesToStub.Add(mod);
                    add = true;
                } else {
                    if (MixedDeps == MixedDepAction.Remove) {
                        RemoveDeps.Add(name.Name);
                    }
#if !CECIL0_9
                    mod.Dispose();
#endif
                    return;
                }
            }

            if (add && !isReadWrite) { // XNA replacement
                foreach (XnaToFnaMapping mapping in Mappings)
                    if (name.Name == mapping.Target) {
                        mapping.IsActive = true;
                        mapping.Module = mod;
                        foreach (string from in mapping.Sources) {
                            Log($"[ScanPath] Mapping {from} -> {name.Name}");
                            Modder.RelinkModuleMap[from] = mod;
                        }
                    }
            } else if (!add) {
                foreach (XnaToFnaMapping mapping in Mappings)
                    if (mod.replacedemblyReferences.Any(dep => mapping.Sources.Contains(dep.Name))) {
                        add = true;
                        Log($"[ScanPath] XnaToFna-ing {name.Name}");
                        goto BreakMappings;
                    }
            }
            BreakMappings:

            if (add) {
                Modules.Add(mod);
                ModulePaths[mod] = path;
            } else {
#if !CECIL0_9
                mod.Dispose();
#endif
            }

        }

19 View Source File : XnaToFnaUtil.cs
License : zlib License
Project Creator : 0x0ade

public void ApplyCommonChanges(ModuleDefinition mod, string tag = "Relink") {
            if (DestroyPublicKeyTokens.Contains(mod.replacedembly.Name.Name)) {
                Log($"[{tag}] Destroying public key token for module {mod.replacedembly.Name.Name}");
                mod.replacedembly.Name.PublicKeyToken = new byte[0];
            }

            Log($"[{tag}] Updating dependencies");
            for (int i = 0; i < mod.replacedemblyReferences.Count; i++) {
                replacedemblyNameReference dep = mod.replacedemblyReferences[i];

                // Main mapping mreplaced.
                foreach (XnaToFnaMapping mapping in Mappings)
                    if (mapping.Sources.Contains(dep.Name) &&
                        // Check if the target module has been found and cached
                        Modder.DependencyCache.ContainsKey(mapping.Target)) {
                        // Check if module already depends on the remap
                        if (mod.replacedemblyReferences.Any(existingDep => existingDep.Name == mapping.Target)) {
                            // If so, just remove the dependency.
                            mod.replacedemblyReferences.RemoveAt(i);
                            i--;
                            goto NextDep;
                        }
                        Log($"[{tag}] Replacing dependency {dep.Name} -> {mapping.Target}");
                        // Replace the dependency.
                        mod.replacedemblyReferences[i] = Modder.DependencyCache[mapping.Target].replacedembly.Name;
                        // Only check until first match found.
                        goto NextDep;
                    }

                // Didn't remap; Check for RemoveDeps
                if (RemoveDeps.Contains(dep.Name)) {
                    // Remove any unwanted (f.e. mixed) dependencies.
                    Log($"[{tag}] Removing unwanted dependency {dep.Name}");
                    mod.replacedemblyReferences.RemoveAt(i);
                    i--;
                    goto NextDep;
                }

                // Didn't remove

                // Check for DestroyPublicKeyTokens
                if (DestroyPublicKeyTokens.Contains(dep.Name)) {
                    Log($"[{tag}] Destroying public key token for dependency {dep.Name}");
                    dep.PublicKeyToken = new byte[0];
                }

                // Check for ModulesToStub (formerly managed references)
                if (ModulesToStub.Any(stub => stub.replacedembly.Name.Name == dep.Name)) {
                    // Fix stubbed dependencies.
                    Log($"[{tag}] Fixing stubbed dependency {dep.Name}");
                    dep.IsWindowsRuntime = false;
                    dep.HasPublicKey = false;
                }

                // Check for .NET compact (X360) version
                if (dep.Version == DotNetX360Version) {
                    // Replace public key token.
                    dep.PublicKeyToken = DotNetFrameworkKeyToken;
                    // Technically .NET 2(?), but let's just bump the version.
                    dep.Version = DotNetFramework4Version;
                }

                NextDep:
                continue;
            }
            if (AddreplacedemblyReference && !mod.replacedemblyReferences.Any(dep => dep.Name == ThisreplacedemblyName)) {
                // Add XnaToFna as dependency
                Log($"[{tag}] Adding dependency XnaToFna");
                mod.replacedemblyReferences.Add(Modder.DependencyCache[ThisreplacedemblyName].replacedembly.Name);
            }

            if (mod.Runtime < TargetRuntime.Net_4_0) {
                // XNA 3.0 / 3.1 and X360 games depend on a .NET Framework pre-4.0
                mod.Runtime = TargetRuntime.Net_4_0;
                // TODO: What about the System.*.dll dependencies?
            }

            Log($"[{tag}] Updating module attributes");
            mod.Attributes &= ~ModuleAttributes.StrongNameSigned;
            if (PreferredPlatform != ILPlatform.Keep) {
                // "Clear" to AnyCPU.
                mod.Architecture = TargetArchitecture.I386;
                mod.Attributes &= ~ModuleAttributes.Required32Bit & ~ModuleAttributes.Preferred32Bit;

                switch (PreferredPlatform) {
                    case ILPlatform.x86:
                        mod.Architecture = TargetArchitecture.I386;
                        mod.Attributes |= ModuleAttributes.Required32Bit;
                        break;
                    case ILPlatform.x64:
                        mod.Architecture = TargetArchitecture.AMD64;
                        break;
                    case ILPlatform.x86Pref:
                        mod.Architecture = TargetArchitecture.I386;
                        mod.Attributes |= ModuleAttributes.Preferred32Bit;
                        break;
                }
            }

            bool mixed = (mod.Attributes & ModuleAttributes.ILOnly) != ModuleAttributes.ILOnly;
            if (ModulesToStub.Count != 0 || mixed) {
                Log($"[{tag}] Making replacedembly unsafe");
                mod.Attributes |= ModuleAttributes.ILOnly;
                for (int i = 0; i < mod.replacedembly.CustomAttributes.Count; i++) {
                    CustomAttribute attrib = mod.replacedembly.CustomAttributes[i];
                    if (attrib.AttributeType.FullName == "System.CLSCompliantAttribute") {
                        mod.replacedembly.CustomAttributes.RemoveAt(i);
                        i--;
                    }
                }
                if (!mod.CustomAttributes.Any(ca => ca.AttributeType.FullName == "System.Security.UnverifiableCodeAttribute"))
                    mod.AddAttribute(mod.ImportReference(m_UnverifiableCodeAttribute_ctor));
            }

            // MonoMod needs to relink some types (f.e. XnaToFnaHelper) via FindType, which requires a dependency map.
            Log($"[{tag}] Mapping dependencies for MonoMod");
            Modder.MapDependencies(mod);
        }

19 View Source File : AppConfig.cs
License : Apache License 2.0
Project Creator : 214175590

public void SaveConfig(int type = 0)
        {
            if(type == 0 || type == 1){
                try
                {
                    string mconfig = JsonConvert.SerializeObject(MConfig, Formatting.Indented);
                    if (!string.IsNullOrWhiteSpace(mconfig))
                    {
                        YSTools.YSFile.writeFileByString(MainForm.CONF_DIR + MC_NAME, mconfig, false, CONFIG_KEY);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("保存Main配置文件异常:" + ex.Message);
                    logger.Error("--->" + MC_NAME);
                }
            }

            if (type == 0 || type == 2)
            {
                string sconfig = null, scname = null;
                int index = 0;
                List<string> newFiles = new List<string>();
                foreach (KeyValuePair<string, SessionConfig> item in SessionConfigDict)
                {
                    try
                    {
                        sconfig = JsonConvert.SerializeObject(item.Value, Formatting.Indented);
                        if (!string.IsNullOrWhiteSpace(sconfig))
                        {
                            scname = string.Format("session{0}.json", index);
                            YSTools.YSFile.writeFileByString(MainForm.SESSION_DIR + scname, sconfig, false, CONFIG_KEY);
                            newFiles.Add(scname);
                            index++;
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error("保存Session配置文件异常:" + ex.Message);
                        logger.Error("--->" + item.Key);
                    }
                }

                DirectoryInfo dirs = new DirectoryInfo(MainForm.SESSION_DIR);
                FileInfo[] files = dirs.GetFiles();
                foreach(FileInfo file in files){
                    if (!newFiles.Contains(file.Name))
                    {
                        file.Delete();
                    }
                }
            }
            
        }

19 View Source File : DefaultConfig.cs
License : Apache License 2.0
Project Creator : 214175590

public static void InitDefaultShellList(List<string> shellList)
        {
            if (!shellList.Contains(SHELL_1))
            {
                shellList.Add(SHELL_1);
            }
            if (!shellList.Contains(SHELL_2))
            {
                shellList.Add(SHELL_2);
            }
            if (!shellList.Contains(SHELL_3))
            {
                shellList.Add(SHELL_3);
            }
            if (!shellList.Contains(SHELL_4))
            {
                shellList.Add(SHELL_4);
            }
            if (!shellList.Contains(SHELL_5))
            {
                shellList.Add(SHELL_5);
            }

            AppConfig.Instance.SaveConfig(2);
        }

19 View Source File : DefaultConfig.cs
License : Apache License 2.0
Project Creator : 214175590

public static void UpdateShellLisreplacedem(List<string> shellList, int index, string cmd)
        {
            if (index < shellList.Count)
            {
                shellList[index] = cmd;
            }
            else if (!shellList.Contains(cmd))
            {
                shellList.Add(cmd);
            }

            AppConfig.Instance.SaveConfig(2);
        }

19 View Source File : TextFindForm.cs
License : Apache License 2.0
Project Creator : 214175590

private void addFindHisItem(string str) {
            if (null != str && str.Length > 0 && !findHisList.Contains(str))
            {
                findHisList.Add(str);

                text_res.Items.Add(str);
            }
        }

19 View Source File : TsCreator.cs
License : MIT License
Project Creator : 279328316

private string GetTsType(string typeName)
        {
            string tsTypeStr = "";

            List<string> numberTypeList =
                ("int,int?,int16,int16?,int32,int32?,int64,int64?,decimal,decimal?," +
                "double,double?,byte,byte?,long,long?,single,single?").Split(',').ToList();
            
            List<string> boolTypeList = ("bool,bool?,boolean,boolean?").Split(',').ToList();
            List<string> stringTypeList =
                ("string,guid,guid?").Split(',').ToList();
            List<string> dateTimeTypeList =
                ("datetime,datetime?").Split(',').ToList();

            if (boolTypeList.Contains(typeName.ToLower()))
            {
                tsTypeStr = "boolean";
            }
            else if (stringTypeList.Contains(typeName.ToLower()))
            {
                tsTypeStr = "string";
            }
            else if (dateTimeTypeList.Contains(typeName.ToLower()))
            {
                tsTypeStr = "Date";
            }
            else if (numberTypeList.Contains(typeName.ToLower()))
            {
                tsTypeStr = "number";
            }
            else
            {
                tsTypeStr = typeName;
                #region 去掉Dto,Model命名
                if (tsTypeStr.EndsWith("Dto"))
                {   //参数类型名称 去掉末尾Dto,Model命名
                    tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Dto"));
                }
                else if (tsTypeStr.EndsWith("Dto>"))
                {
                    tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Dto")) + ">";
                }
                else if (tsTypeStr.EndsWith("Model"))
                {
                    tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Model"));
                }
                else if (tsTypeStr.EndsWith("Model>"))
                {
                    tsTypeStr = tsTypeStr.Substring(0, tsTypeStr.LastIndexOf("Model")) + ">";
                }
                #endregion
            }
            return tsTypeStr;
        }

19 View Source File : TypeExtension.cs
License : MIT License
Project Creator : 2881099

public static IEnumerable<MethodInfo> GetApis(this Type type)
        {
            var addMethods = type.GetEvents().Select(_event => _event.GetAddMethod());
            var removeMethods = type.GetEvents().Select(_event => _event.GetRemoveMethod());
            var getMethods = type.GetProperties().Select(_propety => _propety.GetGetMethod());
            var setMethods = type.GetProperties().Select(_propety => _propety.GetSetMethod());

            var enumerable = addMethods
                .Concat(removeMethods)
                .Concat(getMethods)
                .Concat(setMethods)
                .Where(_method=>_method != null)
                .Select(_method => _method.Name);

            var methods = enumerable.ToList();
            methods.Add("Dispose");

            return type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).Where(_method=> !methods.Contains(_method.Name));
        }

19 View Source File : Utils.cs
License : MIT License
Project Creator : 39M

public static string RemoveExtensionName(string path)
    {
        int index = path.LastIndexOf('.');
        if (index >= 0)
        {
            if (extensionNameList.Contains(path.Substring(index)))
            {
                path = path.Remove(index);
            }
        }
        return path;
    }

19 View Source File : Program.cs
License : GNU Affero General Public License v3.0
Project Creator : 3CORESec

public static void Main(string[] args)
        {

            int ruleCount = 0;
            int gradientMax = 0;
            Parser.Default.ParseArguments<Options>(args)
                .WithParsed(o =>
                {
                    LoadConfig(o);
                    if (!o.Suricata)
                    {
                        LoadMismatchSearchMatrix(o);
                        foreach (var ruleFilePath in Directory.EnumerateFiles(o.RulesDirectory, "*.yml", SearchOption.AllDirectories))
                        {
                            try
                            {
                                var dict = DeserializeYamlFile(ruleFilePath, o);
                                if (dict != null && dict.ContainsKey("tags"))
                                {
                                    ruleCount++;
                                    var tags = dict["tags"];
                                    var categories = new List<string>();
                                    string lastEntry = null;
                                    foreach (string tag in tags)
                                    {
                                        //If its the technique id entry, then this adds the file name to the techniques map
                                        if (tag.ToLower().StartsWith("attack.t"))
                                        {
                                            var techniqueId = tag.Replace("attack.", "").ToUpper();
                                            if (!techniques.ContainsKey(techniqueId))
                                                techniques[techniqueId] = new List<string>();
                                            techniques[techniqueId].Add(ruleFilePath.Split("\\").Last());
                                            if (techniques.Count > gradientMax)
                                                gradientMax = techniques.Count;
                                            //then if there are any categories so far, it checks for a mismatch for each one
                                            if (categories.Count > 0 && o.Warning)
                                            {
                                                foreach (string category in categories)
                                                    if (!(mismatchSearchMatrix.ContainsKey(techniqueId) && mismatchSearchMatrix[techniqueId].Contains(category)))
                                                        mismatchWarnings.Add($"MITRE ATT&CK technique ({techniqueId}) and tactic ({category}) mismatch in rule: {ruleFilePath.Split("\\").Last()}");
                                            }
                                        }
                                        else
                                        {
                                            //if its the start of a new technique block, then clean categories and adds first category
                                            if (lastEntry == null || lastEntry.StartsWith("attack.t"))
                                                categories = new List<string>();
                                            categories.Add(
                                                tag.Replace("attack.", "")
                                                .Replace("_", "-")
                                                .ToLower());
                                        }
                                        lastEntry = tag;
                                    }
                                }
                            }
                            catch (YamlException e)
                            {
                                Console.Error.WriteLine($"Ignoring rule {ruleFilePath} (parsing failed)");
                            }
                        }

                        WriteSigmaFileResult(o, gradientMax, ruleCount, techniques);
                        PrintWarnings();
                    }
                    else
                    {

                        List<Dictionary<string, List<string>>> res = new List<Dictionary<string, List<string>>>();

                        foreach (var ruleFilePath in Directory.EnumerateFiles(o.RulesDirectory, "*.rules", SearchOption.AllDirectories))
                        {
                            res.Add(ParseRuleFile(ruleFilePath));
                        }

                        WriteSuricataFileResult(o,
                            res
                                .SelectMany(dict => dict)
                                .ToLookup(pair => pair.Key, pair => pair.Value)
                                .ToDictionary(group => group.Key,
                                              group => group.SelectMany(list => list).ToList()));
                    }

                });
        }

19 View Source File : HotfixEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("ILRuntime模式"), Button]
        public void ILRuntime()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (!defineList.Contains("ILRuntime"))
            {
                define += ";ILRuntime";
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : HotfixEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Mono模式"), Button]
        public void Mono()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (defineList.Contains("ILRuntime"))
            {
                defineList.Remove("ILRuntime");
                define = string.Empty;
                foreach (string item in defineList)
                {
                    define += $"{item};";
                }
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : HotfixEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Debug模式"), Button]
        public void Debug()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (defineList.Contains("Release"))
            {
                defineList.Remove("Release");
                define = string.Empty;
                foreach (string item in defineList)
                {
                    define += $"{item};";
                }
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : AssetEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Resources模式"), Button]
        public void Resources()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (defineList.Contains("replacedetBundle"))
            {
                defineList.Remove("replacedetBundle");
                define = string.Empty;
                foreach (string item in defineList)
                {
                    define += $"{item};";
                }
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : HotfixEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Release模式"), Button]
        public void Release()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (!defineList.Contains("Release"))
            {
                define += ";Release";
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : AssetEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("replacedetBundle模式"), Button]
        public void replacedetBundle()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (!defineList.Contains("replacedetBundle"))
            {
                define += ";replacedetBundle";
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : Modifier_Publishing.cs
License : MIT License
Project Creator : 5minlab

public void Apply() {
            if (android_useApkExpansion.Flag) {
                PlayerSettings.Android.useAPKExpansionFiles = android_useApkExpansion;
            }

            var capabilityList = uwp_capability.ToList();
            var table = StringEnumConverter.Get<PlayerSettings.WSACapability>();
            foreach(var kv in table) {
                var flag = capabilityList.Contains(kv.Key);
                PlayerSettings.WSA.SetCapability(kv.Value, flag);
            }

            if (ps4_attribExclusiveVR.Flag) {
                PlayerSettings.PS4.attribExclusiveVR = ps4_attribExclusiveVR;
            }
            if (ps4_attribShareSupport.Flag) {
                PlayerSettings.PS4.attribShareSupport = ps4_attribShareSupport;
            }
            if (ps4_attribMoveSupport.Flag) {
                PlayerSettings.PS4.attribMoveSupport = ps4_attribMoveSupport;
            }
            if (ps4_category.Flag) {
                PlayerSettings.PS4.category = ps4_category;
            }
            if (ps4_masterVersion.Flag) {
                PlayerSettings.PS4.masterVersion = ps4_masterVersion;
            }
            if (ps4_contentID.Flag) {
                PlayerSettings.PS4.contentID = ps4_contentID;
            }
            if (ps4_applicationParameter1.Flag) {
                PlayerSettings.PS4.applicationParameter1 = ps4_applicationParameter1;
            }
            if (ps4_applicationParameter2.Flag) {
                PlayerSettings.PS4.applicationParameter1 = ps4_applicationParameter2;
            }
            if (ps4_applicationParameter3.Flag) {
                PlayerSettings.PS4.applicationParameter1 = ps4_applicationParameter3;
            }
            if (ps4_applicationParameter4.Flag) {
                PlayerSettings.PS4.applicationParameter1 = ps4_applicationParameter4;
            }
            if (ps4_enterButtonreplacedignment.Flag) {
                PlayerSettings.PS4.enterButtonreplacedignment = ps4_enterButtonreplacedignment;
            }
        }

19 View Source File : ExtendableEnums.cs
License : MIT License
Project Creator : 7ark

public override void OnGUI(Rect position)
        {
            EditorGUILayout.LabelField("New Value", EditorStyles.wordWrappedLabel);

            newValueText = GUILayout.TextField(newValueText).Trim();

            float exitSize = 18;
            if (GUI.Button(new Rect(position.width - exitSize, 0, exitSize, exitSize), "X"))
            {
                this.editorWindow.Close();
            }
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Confirm"))
            {
                List<string> names = enumNames;
                for (int i = 0; i < names.Count; i++)
                {
                    names[i] = names[i].ToLower();
                }
                if (!names.Contains(newValueText.ToLower()))
                {
                    //This sends our enum to go get created. Be safe little enum.
                    FindClreplacedFile(GetEnumName(currentProperty), newValueText);
                    this.editorWindow.Close();
                }
                else
                {
                    newValueText = newValueText + "_Copy";
                }
            }
            if (GUILayout.Button("Cancel"))
            {
                this.editorWindow.Close();
            }
            GUILayout.EndHorizontal();
            GUIStyle small = new GUIStyle(EditorStyles.wordWrappedLabel);
            small.fontSize = 9;
            EditorGUILayout.LabelField("(To add multiple, separate with commas)", small);
        }

19 View Source File : PropertyExtension.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826

public static string ComparisonTo<T1, T2>(this T1 source, T2 current)
        {
            string diff = "";
            try
            {
                Type t1 = source.GetType();
                Type t2 = current.GetType();
                PropertyInfo[] property2 = t2.GetProperties();
                //排除主键和基础字段
                List<string> exclude = new List<string>() { "Id" };
                foreach (PropertyInfo p in property2)
                {
                    string name = p.Name;
                    if (exclude.Contains(name)) { continue; }
                    var value1 = t1.GetProperty(name)?.GetValue(source, null)?.ToString();
                    var value2 = p.GetValue(current, null)?.ToString();
                    if (value1 != value2)
                    {
                        diff += $"[{name}]:'{value1}'=>'{value2}';\r\n";
                    }
                }
            }
            catch(Exception)
            {
              
            }
            return diff;
        }

19 View Source File : MangaDex.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override string[] GetGroups(string langCode)
        {
            List<string> result = new List<string>();
            string jsonText = MangaDexHelper.GetMangaJSON(MangaDexHelper.GetMangaUrl(GetID()));
            JObject jobj = JObject.Parse(jsonText);

            foreach (JProperty p in jobj["chapter"])
            {
                JToken value = p.Value;
                if (value.Type == JTokenType.Object)
                {
                    JObject o = (JObject)value;
                    if (((string)o["lang_code"]).Equals(langCode))
                    {
                        string groupName = (String)o["group_name"];
                        if (!result.Contains(groupName))
                        {
                            result.Add(groupName);
                        }
                    }
                }
            }
            return result.ToArray();
        }

19 View Source File : MangaDex.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override string[] GetLangs()
        {
            List<string> result = new List<string>();
            string jsonText = MangaDexHelper.GetMangaJSON(MangaDexHelper.GetMangaUrl(GetID()));
            JObject jobj = JObject.Parse(jsonText);

            foreach (JProperty p in jobj["chapter"])
            {
                JToken value = p.Value;
                if (value.Type == JTokenType.Object)
                {
                    JObject o = (JObject)value;
                    string langCode = (string)o["lang_code"];
                    if (!result.Contains(langCode))
                    {
                        result.Add(langCode);
                    }
                }
            }
            return result.ToArray();
        }

19 View Source File : AbstractCollisionCallbacks.cs
License : MIT License
Project Creator : a3geek

protected void OnCollision(GameObject obj, string prefix)
        {
            var layer = obj.GetComponent<AbstractCollisionCallbacks>();
            if(layer == null)
            {
                return;
            }

            var layerName = layer.LayerName;
            var log = prefix + this.LayerName + " => " + (layer == null ? "" : layerName);
            
            if(layer != null && this.ignoreLayers.Contains(layerName) == true)
            {
                Debug.LogWarning(prefix + " >>> Caution collision : " + this.LayerName + " <-> " + layerName);
            }

            this.AddLog(log);
        }

19 View Source File : DownloadingAssetsList.cs
License : Apache License 2.0
Project Creator : A7ocin

public void Update()
		{
			List<Downloadingreplacedereplacedem> finishedItems = new List<Downloadingreplacedereplacedem>();
			if (downloadingItems.Count > 0)
			{
				areDownloadedItemsReady = false;
				List<string> finishedBundles = new List<string>();
				foreach (Downloadingreplacedereplacedem dli in downloadingItems)
				{
					bool canProcessBatch = true;
					dli.UpdateProgress();
					string error = "";
					if (finishedBundles.Contains(dli.containingBundle))
					{
						if (dli.flagForRemoval == false)
						{
							dli.flagForRemoval = true;
						}
						else
						{
							if (dli.isBeingRemoved)
								canProcessBatch = false;
						}
					}
					else if (replacedetBundleManager.GetLoadedreplacedetBundle(dli.containingBundle, out error) != null)
					{
						finishedBundles.Add(dli.containingBundle);
						if (dli.flagForRemoval == false)
						{
							dli.flagForRemoval = true;
						}
						else
						{
							if (dli.isBeingRemoved)
								canProcessBatch = false;
						}
					}
					else
					{
						canProcessBatch = false;
					}
					if (canProcessBatch)
					{
						finishedItems.Add(dli);
					}
				}
			}
			//send the finished downloads to be processed
			if (finishedItems.Count > 0)
			{
				DynamicreplacedetLoader.Instance.StartCoroutine(RemoveDownload(finishedItems));
			}
		}

19 View Source File : DynamicDNAConverterBehaviourEditor.cs
License : Apache License 2.0
Project Creator : A7ocin

private void AddDNAConverterHashes(DynamicDNAConverterBehaviour tempDNAreplacedet, int addMethod)
		{
			bool addedHashes = false;
			var currentHashes = addMethod == 0 ? (target as DynamicDNAConverterBehaviour).hashList : new List<DynamicDNAConverterBehaviour.HashLisreplacedem>();
			for(int i = 0; i < tempDNAreplacedet.hashList.Count; i++)
			{
				bool existed = false;
				for (int ci = 0; ci < currentHashes.Count; ci++)
				{
					if(currentHashes[ci].hash == tempDNAreplacedet.hashList[i].hash)
					{
						existed = true;
						break;
					}
				}
				if (!existed)
				{
					var canAdd = !minimalMode ? true : (bonesInSkeleton.Contains(tempDNAreplacedet.hashList[i].hashName) ? true : false);
					if (canAdd)
					{
						addedHashes = true;
						currentHashes.Add(new DynamicDNAConverterBehaviour.HashLisreplacedem(tempDNAreplacedet.hashList[i].hashName, tempDNAreplacedet.hashList[i].hash));
					}
				}
			}
			(target as DynamicDNAConverterBehaviour).hashList = currentHashes;
			serializedObject.Update();
			if (addedHashes)
				UpdateHashNames();

		}

19 View Source File : AssetBundleManager.cs
License : Apache License 2.0
Project Creator : A7ocin

static public bool AreBundlesDownloading(string replacedetBundleName = "")
		{
			if (replacedetBundleName == "")
			{
				return (m_DownloadingBundles.Count > 0 && m_InProgressOperations.Count > 0);
			}
			else
			{
				if (m_DownloadingBundles.Contains(replacedetBundleName))
				{
					return true;
				}
				else
				{
					foreach (string key in m_DownloadingBundles)
					{
						if (key.IndexOf(replacedetBundleName + "/") > -1)
						{
							return true;
						}
					}
					return false;
				}
			}
		}

19 View Source File : AssetBundleManager.cs
License : Apache License 2.0
Project Creator : A7ocin

static protected bool LoadreplacedetBundleInternal(string replacedetBundleToFind, bool isLoadingreplacedetBundleIndex = false, bool useJsonIndex = false, string jsonIndexUrl = "")
		{
			//encrypted bundles have the suffix 'encrypted' appended to the name TODO this should probably go in the index though and be settable in the UMAreplacedetBundleManagerSettings window
			//string encryptedSuffix = BundleEncryptionKey != "" ? "encrypted" : "";
			string replacedetBundleToGet = replacedetBundleToFind;
			if(BundleEncryptionKey != "" && m_replacedetBundleIndex != null)
			{
				replacedetBundleToGet = m_replacedetBundleIndex.GetreplacedetBundleEncryptedName(replacedetBundleToFind);
				Debug.Log("replacedetBundleToFind was " + replacedetBundleToFind + " replacedetBundleToGet was " + replacedetBundleToGet);
            }
			else if(BundleEncryptionKey != "" && m_replacedetBundleIndex == null)
			{
				replacedetBundleToGet = replacedetBundleToFind + "encrypted";
			}

			// Already loaded.
			LoadedreplacedetBundle bundle = null;
			m_LoadedreplacedetBundles.TryGetValue(replacedetBundleToFind, out bundle);//encrypted or not this will have the replacedetbundlename without the 'encrypted' suffix
			if (bundle != null && bundle.m_replacedetBundle != null)
			{
				bundle.m_ReferencedCount++;
				return true;
			}

			// @TODO: Do we need to consider the referenced count of WWWs?
			// users can call LoadreplacedetAsync()/LoadLevelAsync() several times then wait them to be finished which might have duplicate WWWs.
			if (m_DownloadingBundles.Contains(replacedetBundleToFind))
				return true;

			string bundleBaseDownloadingURL = GetreplacedetBundleBaseDownloadingURL(replacedetBundleToFind);

			//TODO These dont support encrypted bundles yet
			if (bundleBaseDownloadingURL.ToLower().StartsWith("odr://"))
			{
#if ENABLE_IOS_ON_DEMAND_RESOURCES
				Log(LogType.Info, "Requesting bundle " + replacedetBundleToGet + " through ODR");
                m_InProgressOperations.Add(new replacedetBundleDownloadFromODROperation(replacedetBundleToGet));
#else
				new ApplicationException("Can't load bundle " + replacedetBundleToFind + " through ODR: this Unity version or build target doesn't support it.");
#endif
			}
			else if (bundleBaseDownloadingURL.ToLower().StartsWith("res://"))
			{
#if ENABLE_IOS_APP_SLICING
				Log(LogType.Info, "Requesting bundle " + replacedetBundleToGet + " through replacedet catalog");
                m_InProgressOperations.Add(new replacedetBundleOpenFromreplacedetCatalogOperation(replacedetBundleToGet));
#else
				new ApplicationException("Can't load bundle " + replacedetBundleToFind + " through replacedet catalog: this Unity version or build target doesn't support it.");
#endif
			}
			else
			{
				if (!bundleBaseDownloadingURL.EndsWith("/"))
					bundleBaseDownloadingURL += "/";

				string url = bundleBaseDownloadingURL + replacedetBundleToGet;

				WWW download = null;
				// For index replacedetbundle, always download it as we don't have hash for it.
				//TODO make something to test if there is and internet connection and if not try to get a cached version of this so we can still access the stuff that has been previously cached
				//TODO2 Make the index cache somewhere when it is downloaded.
				if (isLoadingreplacedetBundleIndex)
				{
					if (useJsonIndex && jsonIndexUrl != "")
					{
						url = jsonIndexUrl.Replace("[PLATFORM]", Utility.GetPlatformName());
					}
					else if (useJsonIndex)
					{
						url = url+ ".json";
					}
					download = new WWW(url);
					if (!String.IsNullOrEmpty(download.error) || download == null)
					{
						if (!String.IsNullOrEmpty(download.error))
							Log(LogType.Warning, download.error);
						else
							Log(LogType.Warning, " index new WWW(url) was NULL");
					}
				}
				else
				{
					download = WWW.LoadFromCacheOrDownload(url, m_replacedetBundleIndex.GetreplacedetBundleHash(replacedetBundleToFind), 0);
				}
				m_InProgressOperations.Add(new replacedetBundleDownloadFromWebOperation(replacedetBundleToFind/* + encryptedSuffix*/, download, useJsonIndex));
			}

			m_DownloadingBundles.Add(replacedetBundleToFind);

			return false;
		}

19 View Source File : pRaceData.cs
License : Apache License 2.0
Project Creator : A7ocin

public bool IsCrossCompatibleWith(RaceData compatibleRace)
		{
			return GetCrossCompatibleRaces().Contains(compatibleRace.raceName);
		}

19 View Source File : pRaceData.cs
License : Apache License 2.0
Project Creator : A7ocin

public bool IsCrossCompatibleWith(string compatibleString)
		{
			return GetCrossCompatibleRaces().Contains(compatibleString);
		}

19 View Source File : pRaceData.cs
License : Apache License 2.0
Project Creator : A7ocin

public bool IsCrossCompatibleWith(List<string> compatibleStrings)
		{
			foreach (string val in compatibleStrings)
			{
				if (GetCrossCompatibleRaces().Contains(val))
				{
					return true;
				}
			}
			return false;
		}

19 View Source File : pRaceData.cs
License : Apache License 2.0
Project Creator : A7ocin

public void SetCrossCompatibleRaces(List<string> ccRaces)
		{
			for (int i = 0; i < ccRaces.Count; i++)
				_crossCompatibilitySettings.Add(ccRaces[i]);
			//then remove any that were not in the list
			List<string> racesToRemove = new List<string>();
			for (int i = 0; i < _crossCompatibilitySettings.settingsData.Count; i++)
			{
				if (!ccRaces.Contains(_crossCompatibilitySettings.settingsData[i].ccRace))
					racesToRemove.Add(_crossCompatibilitySettings.settingsData[i].ccRace);
			}
			_crossCompatibilitySettings.Remove(racesToRemove);
		}

19 View Source File : FsmUtil.cs
License : GNU General Public License v3.0
Project Creator : a2659802

public static void ReplaceStringVariable(PlayMakerFSM fsm, List<string> states, Dictionary<string, string> dict)
        {
            foreach (FsmState t in fsm.FsmStates)
            {
                bool found = false;
                if (!states.Contains(t.Name)) continue;
                foreach (FsmString str in (List<FsmString>) FsmStringParamsField.GetValue(t.ActionData))
                {
                    List<FsmString> val = new List<FsmString>();
                    if (dict.ContainsKey(str.Value))
                    {
                        val.Add(dict[str.Value]);
                        found = true;
                    }
                    else
                    {
                        val.Add(str);
                    }

                    if (val.Count > 0)
                    {
                        FsmStringParamsField.SetValue(t.ActionData, val);
                    }
                }

                if (found)
                {
                    t.LoadActions();
                }
            }
        }

19 View Source File : DynamicCharacterSystem.cs
License : Apache License 2.0
Project Creator : A7ocin

public string GetOriginatingreplacedetBundle(string recipeName)
		{
			string originatingreplacedetBundle = "";
			if (replacedetBundlesUsedDict.Count == 0)
				return originatingreplacedetBundle;
			else
			{
				foreach (KeyValuePair<string, List<string>> kp in replacedetBundlesUsedDict)
				{
					if (kp.Value.Contains(recipeName))
					{
						originatingreplacedetBundle = kp.Key;
						break;
					}
				}
			}
			if (originatingreplacedetBundle == "")
			{
				Debug.Log(recipeName + " was not found in any loaded replacedetBundle");
			}
			else
			{
				Debug.Log("originatingreplacedetBundle for " + recipeName + " was " + originatingreplacedetBundle);
			}
			return originatingreplacedetBundle;
		}

19 View Source File : DynamicOverlayLibrary.cs
License : Apache License 2.0
Project Creator : A7ocin

public string GetOriginatingreplacedetBundle(string overlayName)
        {
            string originatingreplacedetBundle = "";
            if (replacedetBundlesUsedDict.Count > 0)
            {
                foreach (KeyValuePair<string, List<string>> kp in replacedetBundlesUsedDict)
                {
                    if (kp.Value.Contains(overlayName))
                    {
                        originatingreplacedetBundle = kp.Key;
                        break;
                    }
                }
            }
            if (originatingreplacedetBundle == "")
            {
                Debug.Log(overlayName + " has not been loaded from any replacedetBundle");
            }
            else
            {
                Debug.Log("originatingreplacedetBundle for " + overlayName + " was " + originatingreplacedetBundle);
            }
            return originatingreplacedetBundle;
        }

19 View Source File : DynamicRaceLibrary.cs
License : Apache License 2.0
Project Creator : A7ocin

public string GetOriginatingreplacedetBundle(string raceName)
		{
			string originatingreplacedetBundle = "";
			if (replacedetBundlesUsedDict.Count > 0)
			{
				foreach (KeyValuePair<string, List<string>> kp in replacedetBundlesUsedDict)
				{
					if (kp.Value.Contains(raceName))
					{
						originatingreplacedetBundle = kp.Key;
						break;
					}
				}
			}
			if (originatingreplacedetBundle == "")
			{
				Debug.Log(raceName + " was not found in any loaded replacedetBundle");
			}
			else
			{
				Debug.Log("originatingreplacedetBundle for " + raceName + " was " + originatingreplacedetBundle);
			}
			return originatingreplacedetBundle;
		}

19 View Source File : DynamicSlotLibrary.cs
License : Apache License 2.0
Project Creator : A7ocin

public string GetOriginatingreplacedetBundle(string slotName)
        {
            string originatingreplacedetBundle = "";
            if (replacedetBundlesUsedDict.Count > 0)
            {
                foreach (KeyValuePair<string, List<string>> kp in replacedetBundlesUsedDict)
                {
                    if (kp.Value.Contains(slotName) || kp.Value.Contains(slotName.Replace("_Slot", "")))//just try without '_Slot' as well since autogenerated slot.slotname doesn't end with autogenrated '_Slot'
                    {
                        originatingreplacedetBundle = kp.Key;
                        break;
                    }
                }
            }
            if (originatingreplacedetBundle == "")
            {
                Debug.Log(slotName + " was not found in any loaded replacedetBundle");
            }
            else
            {
                Debug.Log("originatingreplacedetBundle for " + slotName + " was " + originatingreplacedetBundle);
            }
            return originatingreplacedetBundle;
        }

19 View Source File : TestCustomizerDD.cs
License : Apache License 2.0
Project Creator : A7ocin

public void InitializeWardrobeDropDowns()
		{
			List<string> slotsFromAllRaces = new List<string>();
			foreach (string race in characterSystem.Recipes.Keys)
			{
				int i = 0;
				foreach (string slot in characterSystem.Recipes[race].Keys)
				{
					if (!slotsFromAllRaces.Contains(slot) && ((limitWardrobeOptions.Count == 0 || limitWardrobeOptions.Contains(slot)) && !hideWardrobeOptions.Contains(slot)))
					{
						slotsFromAllRaces.Insert(i, slot);
						i++;
					}
				}
			}
			foreach (string slot in slotsFromAllRaces)
			{
				if (slot == "None")
					continue;
				if (wardrobeDropdownPanel.transform.Find(slot + "DropdownHolder") == null)
				{
					GameObject thisWardrobeDropdown = Instantiate(wardrobeDrodownPrefab) as GameObject;
					thisWardrobeDropdown.transform.SetParent(wardrobeDropdownPanel.transform, false);
					thisWardrobeDropdown.GetComponent<CSWardrobeSlotChangerDD>().customizerScript = this;
					thisWardrobeDropdown.GetComponent<CSWardrobeSlotChangerDD>().wardrobeSlotToChange = slot;
					thisWardrobeDropdown.name = slot + "DropdownHolder";
					thisWardrobeDropdown.transform.Find("SlotLabel").GetComponent<Text>().text = slot;
					thisWardrobeDropdown.GetComponent<Dropdown>().onValueChanged.AddListener(thisWardrobeDropdown.GetComponent<CSWardrobeSlotChangerDD>().ChangeWardrobeSlot);
				}
			}
		}

19 View Source File : TestCustomizerDD.cs
License : Apache License 2.0
Project Creator : A7ocin

public void SetUpWardrobeDropdowns()
		{
			if (Avatar != null)
				thisRace = Avatar.activeRace.name;
			InitializeWardrobeDropDowns();
			foreach (Transform child in wardrobeDropdownPanel.transform)
			{
				child.gameObject.SetActive(true);
				var thisDD = child.GetComponent<Dropdown>();
				thisDD.captionImage.overrideSprite = null;
				var thisSlot = child.GetComponent<CSWardrobeSlotChangerDD>().wardrobeSlotToChange;
				//We want to have the option of being able to write limitWardrobeOptions and hideWardrobeOptions like raceName:wrdrobeSlot
				bool showOption = false;
				if (!hideWardrobeOptions.Contains(thisSlot) && !hideWardrobeOptions.Contains(thisRace + ":" + thisSlot))
				{
					showOption = true;
				}
				if (limitWardrobeOptions.Contains(thisSlot) || limitWardrobeOptions.Contains(thisRace + ":" + thisSlot))
				{
					showOption = true;
				}
				if (characterSystem.Recipes.ContainsKey(thisRace) && characterSystem.Recipes[thisRace].ContainsKey(thisSlot) && showOption)
				{
					if (thisSlot == "WardrobeCollection")
					{
						SetUpWardrobeCollectionDropdown(child, thisDD);
					}
					else
					{
						thisDD.options.Clear();
						thisDD.onValueChanged.RemoveAllListeners();
						var wardrobeOptions = new List<UMATextRecipe>(characterSystem.Recipes[thisRace][thisSlot]);
						var thisUnsetThumb = Avatar.activeRace.racedata.raceThumbnails.GetThumbFor(thisSlot);
						var thisUnsetOption = new Dropdown.OptionData();
						thisUnsetOption.text = thisSlot == "Face" ? "Standard" : "None";
						thisUnsetOption.image = thisUnsetThumb;
						thisDD.options.Add(thisUnsetOption);
						for (int i = 0; i < wardrobeOptions.Count; i++)
						{
							var thisddOption = new Dropdown.OptionData();
							thisddOption.text = wardrobeOptions[i].DisplayValue != "" ? wardrobeOptions[i].DisplayValue : wardrobeOptions[i].name;
							thisddOption.image = wardrobeOptions[i].GetWardrobeRecipeThumbFor(thisRace);
							thisDD.options.Add(thisddOption);
						}
						int selected = 0;
						UMATextRecipe thisDDRecipe = null;
						if (Avatar.WardrobeRecipes.Count > 0)
						{
							foreach (KeyValuePair<string, UMATextRecipe> kp in Avatar.WardrobeRecipes)
							{
								var recipeSlotName = kp.Value.wardrobeSlot;
								if (recipeSlotName == thisSlot && kp.Value.compatibleRaces.Contains(thisRace))
								{
									for (int ri = 0; ri < characterSystem.Recipes[thisRace][recipeSlotName].Count; ri++)
									{
										if (characterSystem.Recipes[thisRace][recipeSlotName][ri].name == kp.Value.name)
										{
											//we could do alot more checks here to check equalness if this is the only way to make this work...
											selected = ri + 1;
										}
									}
									thisDDRecipe = kp.Value;
								}
								else if (recipeSlotName == thisSlot && (Avatar.activeRace.racedata.IsCrossCompatibleWith(kp.Value.compatibleRaces) && Avatar.activeRace.racedata.wardrobeSlots.Contains(thisSlot)))
								{
									//for cross compatible Races- races can be cross compatible with other races (set in the Race itself) and this enables one race to wear anothers wardrobe (if that race has the same wardrobe slots)
									selected = (characterSystem.Recipes[thisRace][recipeSlotName].FindIndex(s => s.Equals(kp.Value)) + 1);
									thisDDRecipe = kp.Value;
								}
							}
						}
						thisDD.value = selected;
						if (selected == 0)
						{
							thisDD.captionImage.sprite = thisUnsetThumb;
							thisDD.captionImage.enabled = true;
						}
						else
						{
							thisDD.captionImage.sprite = thisDDRecipe.GetWardrobeRecipeThumbFor(thisRace);
							thisDD.captionImage.enabled = true;
						}
						thisDD.onValueChanged.AddListener(child.GetComponent<CSWardrobeSlotChangerDD>().ChangeWardrobeSlot);
						var thisSuppressedTextGO = thisDD.gameObject.transform.Find("ActiveWSlot").Find("SuppressedIndicator");
						thisDD.interactable = true;
						if (thisSuppressedTextGO)
						{
							thisSuppressedTextGO.GetComponent<Image>().enabled = false;
							thisSuppressedTextGO.GetComponentInChildren<Text>().text = "";
						}
					}
				}
				else
				{
					child.gameObject.SetActive(false);
				}
			}
			if (Avatar != null)
				UpdateSuppressedWardrobeDropdowns();
		}

19 View Source File : Database.cs
License : Apache License 2.0
Project Creator : aadreja

internal virtual void CreateAddCommand(IDbCommand cmd, object enreplacedy, IAuditTrail audit = null, string columnNames = null, bool doNotAppendCommonFields = false, bool overrideCreatedUpdatedOn = false)
        {
            TableAttribute tableInfo = EnreplacedyCache.Get(enreplacedy.GetType());

            if (tableInfo.NeedsHistory && tableInfo.IsCreatedByEmpty(enreplacedy))
                throw new MissingFieldException("CreatedBy is required when Audit Trail is enabled");

            List<string> columns = new List<string>();

            if (!string.IsNullOrEmpty(columnNames)) columns.AddRange(columnNames.Split(','));
            else columns.AddRange(tableInfo.DefaultInsertColumns);//Get columns from Enreplacedy attributes loaded in TableInfo

            bool isPrimaryKeyEmpty = false;

            foreach(ColumnAttribute pkCol in tableInfo.Columns.Where(p=>p.Value.IsPrimaryKey).Select(p=>p.Value))
            {
                if (pkCol.PrimaryKeyInfo.IsIdenreplacedy && tableInfo.IsKeyIdEmpty(enreplacedy, pkCol))
                {
                    isPrimaryKeyEmpty = true;
                    //if idenreplacedy remove keyfield if added in field list
                    columns.Remove(pkCol.Name);
                }
                else if (pkCol.Property.PropertyType == typeof(Guid) && tableInfo.IsKeyIdEmpty(enreplacedy, pkCol))
                {
                    isPrimaryKeyEmpty = true;
                    //if not idenreplacedy and key not generated, generate before save
                    tableInfo.SetKeyId(enreplacedy, pkCol, Guid.NewGuid());
                }
            }

            #region append common columns

            if (!doNotAppendCommonFields)
            {
                if (!tableInfo.NoIsActive)
                {
                    if (!columns.Contains(Config.ISACTIVE_COLUMN.Name))
                        columns.Add(Config.ISACTIVE_COLUMN.Name);

                    bool isActive = tableInfo.GetIsActive(enreplacedy) ?? true;
                    //when IsActive is not set then true for insert
                    cmd.AddInParameter("@" + Config.ISACTIVE_COLUMN.Name, Config.ISACTIVE_COLUMN.ColumnDbType, isActive);

                    if (tableInfo.NeedsHistory)
                        audit.AppendDetail(Config.ISACTIVE_COLUMN.Name, isActive, DbType.Boolean, null);

                    tableInfo.SetIsActive(enreplacedy, isActive); //Set IsActive value
                }

                if (!tableInfo.NoVersionNo)
                {
                    int versionNo = tableInfo.GetVersionNo(enreplacedy) ?? 1;  //set defualt versionno 1 for Insert
                    if (versionNo == 0) versionNo = 1; //set defualt versionno 1 for Insert even if its zero or null

                    if (!columns.Contains(Config.VERSIONNO_COLUMN.Name))
                        columns.Add(Config.VERSIONNO_COLUMN.Name);

                    cmd.AddInParameter("@" + Config.VERSIONNO_COLUMN.Name, Config.VERSIONNO_COLUMN.ColumnDbType, versionNo);

                    tableInfo.SetVersionNo(enreplacedy, versionNo); //Set VersionNo value
                }

                if (!tableInfo.NoCreatedBy)
                {
                    if (!columns.Contains(Config.CREATEDBY_COLUMN.Name))
                        columns.Add(Config.CREATEDBY_COLUMN.Name);

                    cmd.AddInParameter("@" + Config.CREATEDBY_COLUMN.Name, Config.CREATEDBY_COLUMN.ColumnDbType, tableInfo.GetCreatedBy(enreplacedy));
                }

                if (!tableInfo.NoCreatedOn & !columns.Contains(Config.CREATEDON_COLUMN.Name))
                {
                    columns.Add(Config.CREATEDON_COLUMN.Name);
                }

                if (!tableInfo.NoUpdatedBy)
                {
                    if (!columns.Contains(Config.UPDATEDBY_COLUMN.Name))
                        columns.Add(Config.UPDATEDBY_COLUMN.Name);

                    cmd.AddInParameter("@" + Config.UPDATEDBY_COLUMN.Name, Config.UPDATEDBY_COLUMN.ColumnDbType, tableInfo.GetCreatedBy(enreplacedy));
                }

                if (!tableInfo.NoUpdatedOn & !columns.Contains(Config.UPDATEDON_COLUMN.Name))
                {
                    columns.Add(Config.UPDATEDON_COLUMN.Name);
                }
            }

            #endregion

            //append @ before each fields to add as parameter
            List<string> parameters = columns.Select(c => "@" + c).ToList();

            int pIndex = parameters.FindIndex(c => c == "@" + Config.CREATEDON_COLUMN.Name);
            if (pIndex >= 0)
            {
                var createdOn = Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetCreatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
                if (createdOn is string)
                {
                    parameters[pIndex] = (string)createdOn;
                }
                else
                {
                    cmd.AddInParameter(parameters[pIndex], Config.CREATEDON_COLUMN.ColumnDbType, createdOn);
                }
                //parameters[pIndex] = (string)Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetCreatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
            }

            pIndex = parameters.FindIndex(c => c == "@" + Config.UPDATEDON_COLUMN.Name);
            if (pIndex >= 0)
            {
                var updatedOn = Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetUpdatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
                if (updatedOn is string)
                {
                    parameters[pIndex] = (string)updatedOn;
                }
                else
                {
                    cmd.AddInParameter(parameters[pIndex], Config.CREATEDON_COLUMN.ColumnDbType, updatedOn);
                }
                //parameters[pIndex] = (string)Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetUpdatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
            }

            StringBuilder cmdText = new StringBuilder();
            cmdText.Append($"INSERT INTO {tableInfo.FullName} ({string.Join(",", columns)}) VALUES({string.Join(",", parameters)});");

            if (tableInfo.IsKeyIdenreplacedy() && isPrimaryKeyEmpty)
            {
                //add query to get inserted id
                cmdText.Append(LASTINSERTEDROWIDSQL);
            }

            //remove common columns and parameters already added above
            columns.RemoveAll(c => c == Config.CREATEDON_COLUMN.Name || c == Config.CREATEDBY_COLUMN.Name
                                    || c == Config.UPDATEDON_COLUMN.Name || c == Config.UPDATEDBY_COLUMN.Name
                                    || c == Config.VERSIONNO_COLUMN.Name || c == Config.ISACTIVE_COLUMN.Name);

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = cmdText.ToString();

            for (int i = 0; i < columns.Count(); i++)
            {
                tableInfo.Columns.TryGetValue(columns[i], out ColumnAttribute columnInfo); //find column attribute

                DbType dbType = DbType.Object;
                object columnValue = null;

                if (columnInfo != null && columnInfo.GetMethod != null)
                {
                    dbType = columnInfo.ColumnDbType;
                    columnValue = columnInfo.GetAction(enreplacedy);

                    if (tableInfo.NeedsHistory) audit.AppendDetail(columns[i], columnValue, dbType, null);
                }
                cmd.AddInParameter("@" + columns[i], dbType, columnValue);
            }
        }

19 View Source File : Database.cs
License : Apache License 2.0
Project Creator : aadreja

internal virtual bool CreateUpdateCommand(IDbCommand cmd, object enreplacedy, object oldEnreplacedy, IAuditTrail audit = null, string columnNames = null, bool doNotAppendCommonFields = false, bool overrideCreatedUpdatedOn = false)
        {
            bool isUpdateNeeded = false;

            TableAttribute tableInfo = EnreplacedyCache.Get(enreplacedy.GetType());

            if (!tableInfo.NoUpdatedBy && tableInfo.IsUpdatedByEmpty(enreplacedy))
                throw new MissingFieldException("Updated By is required");

            List<string> columns = new List<string>();

            if (!string.IsNullOrEmpty(columnNames)) columns.AddRange(columnNames.Split(','));
            else columns.AddRange(tableInfo.DefaultUpdateColumns);//Get columns from Enreplacedy attributes loaded in TableInfo

            StringBuilder cmdText = new StringBuilder();
            cmdText.Append($"UPDATE {tableInfo.FullName} SET ");

            //add default columns if doesn't exists
            if (!doNotAppendCommonFields)
            {
                if (!tableInfo.NoVersionNo && !columns.Contains(Config.VERSIONNO_COLUMN.Name))
                    columns.Add(Config.VERSIONNO_COLUMN.Name);

                if (!tableInfo.NoUpdatedBy && !columns.Contains(Config.UPDATEDBY_COLUMN.Name))
                    columns.Add(Config.UPDATEDBY_COLUMN.Name);

                if (!tableInfo.NoUpdatedOn && !columns.Contains(Config.UPDATEDON_COLUMN.Name))
                    columns.Add(Config.UPDATEDON_COLUMN.Name);
            }

            //remove primarykey, createdon and createdby columns if exists
            columns.RemoveAll(c => tableInfo.PkColumnList.Select(p=>p.Name).Contains(c));
            columns.RemoveAll(c => c == Config.CREATEDON_COLUMN.Name || 
                                    c == Config.CREATEDBY_COLUMN.Name);

            for (int i = 0; i < columns.Count(); i++)
            {
                if (columns[i].Equals(Config.VERSIONNO_COLUMN.Name, StringComparison.OrdinalIgnoreCase))
                {
                    cmdText.Append($"{columns[i]} = {columns[i]}+1");
                    cmdText.Append(",");
                }
                else if (columns[i].Equals(Config.UPDATEDBY_COLUMN.Name, StringComparison.OrdinalIgnoreCase))
                {
                    cmdText.Append($"{columns[i]} = @{columns[i]}");
                    cmdText.Append(",");
                    cmd.AddInParameter("@" + columns[i], Config.UPDATEDBY_COLUMN.ColumnDbType, tableInfo.GetUpdatedBy(enreplacedy));
                }
                else if (columns[i].Equals(Config.UPDATEDON_COLUMN.Name, StringComparison.OrdinalIgnoreCase))
                {
                    var updatedOn = Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetUpdatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
                    if (updatedOn is string)
                    {
                        cmdText.Append($"{columns[i]} = {CURRENTDATETIMESQL}");
                    }
                    else
                    {
                        cmdText.Append($"{columns[i]} = @{columns[i]}");
                        cmd.AddInParameter("@" + columns[i], Config.UPDATEDON_COLUMN.ColumnDbType, updatedOn);
                    }
                    cmdText.Append(",");
                }
                else
                {
                    bool includeInUpdate = true;
                    tableInfo.Columns.TryGetValue(columns[i], out ColumnAttribute columnInfo); //find column attribute

                    DbType dbType = DbType.Object;
                    object columnValue = null;

                    if (columnInfo != null && columnInfo.GetMethod != null)
                    {
                        dbType = columnInfo.ColumnDbType;
                        columnValue = columnInfo.GetAction(enreplacedy);

                        includeInUpdate = oldEnreplacedy == null; //include in update when oldEnreplacedy not available

                        //compare with old object to check whether update is needed or not
                        object oldColumnValue = null;
                        if (oldEnreplacedy != null)
                        {
                            oldColumnValue = columnInfo.GetAction(oldEnreplacedy);

                            if (oldColumnValue != null && columnValue != null)
                            {
                                if (!oldColumnValue.Equals(columnValue)) //add to history only if property is modified
                                {
                                    includeInUpdate = true;
                                }
                            }
                            else if (oldColumnValue == null && columnValue != null)
                            {
                                includeInUpdate = true;
                            }
                            else if (oldColumnValue != null)
                            {
                                includeInUpdate = true;
                            }
                        }

                        if (tableInfo.NeedsHistory && includeInUpdate) audit.AppendDetail(columns[i], columnValue, dbType, oldColumnValue);
                    }

                    if (includeInUpdate)
                    {
                        isUpdateNeeded = true;

                        cmdText.Append($"{columns[i]} = @{columns[i]}");
                        cmdText.Append(",");
                        cmd.AddInParameter("@" + columns[i], dbType, columnValue);
                    }
                }
            }
            cmdText.RemoveLastComma(); //Remove last comma if exists

            cmdText.Append(" WHERE ");
            if (tableInfo.PkColumnList.Count > 1)
            {
                int index = 0;
                foreach (ColumnAttribute pkCol in tableInfo.PkColumnList)
                {
                    cmdText.Append($" {(index > 0 ? " AND " : "")} {pkCol.Name}[email protected]{pkCol.Name}");
                    cmd.AddInParameter("@" + pkCol.Name, pkCol.ColumnDbType, tableInfo.GetKeyId(enreplacedy, pkCol));
                    index++;
                }
            }
            else
            {
                cmdText.Append($" {tableInfo.PkColumn.Name}[email protected]{tableInfo.PkColumn.Name}");
                cmd.AddInParameter("@" + tableInfo.PkColumn.Name, tableInfo.PkColumn.ColumnDbType, tableInfo.GetKeyId(enreplacedy));
            }

            if (Config.DbConcurrencyCheck && !tableInfo.NoVersionNo)
            {
                cmdText.Append($" AND {Config.VERSIONNO_COLUMN.Name}[email protected]{Config.VERSIONNO_COLUMN.Name}");
                cmd.AddInParameter("@" + Config.VERSIONNO_COLUMN.Name, Config.VERSIONNO_COLUMN.ColumnDbType, tableInfo.GetVersionNo(enreplacedy));
            }

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = cmdText.ToString();

            return isUpdateNeeded;
        }

19 View Source File : LeapMotionConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void AddAndUpdateAsmDefs()
        {
            string leapCoreAsmDefPath = Path.Combine(Application.dataPath, pathDifference, "LeapMotion", "LeapMotion.asmdef");

            // If the asmdef has already been created then do not create another one
            if (!File.Exists(leapCoreAsmDefPath))
            {
                // Create the asmdef that will be placed in the Leap Core replacedets when they are imported
                // A new asmdef needs to be created in order to reference it in the MRTK/Providers/LeapMotion/Microsoft.MixedReality.Toolkit.Providers.LeapMotion.asmdef file
                replacedemblyDefinition leapAsmDef = new replacedemblyDefinition
                {
                    Name = "LeapMotion",
                    AllowUnsafeCode = true,
                    References = new string[] { },
                    IncludePlatforms = new string[] { "Editor", "WindowsStandalone32", "WindowsStandalone64"}
                };

                leapAsmDef.Save(leapCoreAsmDefPath);

                // Get the MRTK/Providers/LeapMotion/Microsoft.MixedReality.Toolkit.Providers.LeapMotion.asmdef
                FileInfo[] leapDataProviderAsmDefFile = FileUtilities.FindFilesInreplacedets("Microsoft.MixedReality.Toolkit.Providers.LeapMotion.asmdef");

                // Add the newly created LeapMotion.asmdef to the references of the leap data provider asmdef
                replacedemblyDefinition leapDataProviderAsmDef = replacedemblyDefinition.Load(leapDataProviderAsmDefFile[0].FullName);

                List<string> references = leapDataProviderAsmDef.References.ToList();
                
                if (!references.Contains("LeapMotion"))
                {
                    references.Add("LeapMotion");
                }

                leapDataProviderAsmDef.References = references.ToArray();

                leapDataProviderAsmDef.Save(leapDataProviderAsmDefFile[0].FullName);
            }
        }

19 View Source File : InputMappingAxisUtility.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void RemoveAxis(string axis)
        {
            EnsureInputManagerReference();

            SerializedProperty axesProperty = inputManagerreplacedet.FindProperty("m_Axes");

            RefreshLocalAxesList();

            // This loop accounts for multiple axes with the same name.
            while (AxisNames.Contains(axis))
            {
                int index = AxisNames.IndexOf(axis);
                axesProperty.DeleteArrayElementAtIndex(index);
                AxisNames.RemoveAt(index);
            }
        }

19 View Source File : InputMappingAxisUtility.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public static bool DoesAxisNameExist(string axisName)
        {
            EnsureInputManagerReference();

            if (AxisNames.Count == 0 || inputManagerreplacedet.UpdateIfRequiredOrScript())
            {
                RefreshLocalAxesList();
            }

            return AxisNames.Contains(axisName);
        }

19 View Source File : LeapMotionConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

[MenuItem("Mixed Reality Toolkit/Utilities/Leap Motion/Configure CSC File for Leap Motion")]
        static void UpdateCSC()
        {
            // The csc file will always be in the root of replacedets
            string cscFilePath = Path.Combine(Application.dataPath, "csc.rsp");

            // Each line of the csc file
            List<string> cscFileLines = new List<string>();

            // List of the warning numbers after "-nowarn: " in the csc file
            List<string> warningNumbers = new List<string>();

            // List of new warning numbers to add to the csc file
            List<string> warningNumbersToAdd = new List<string>()
            {
                "618",
                "649"
            };

            using (StreamReader streamReader = new StreamReader(cscFilePath))
            {
                while (streamReader.Peek() > -1)
                {
                    string cscFileLine = streamReader.ReadLine();

                    if (cscFileLine.Contains("-nowarn"))
                    {
                        string[] currentWarningNumbers = cscFileLine.Split(',', ':');
                        warningNumbers = currentWarningNumbers.ToList();

                        // Remove "nowarn" from the warningNumbers list
                        warningNumbers.Remove("-nowarn");

                        foreach (string warningNumberToAdd in warningNumbersToAdd)
                        {
                            // Add the new warning numbers if they are not already in the file
                            if (!warningNumbers.Contains(warningNumberToAdd))
                            {
                                warningNumbers.Add(warningNumberToAdd);
                            }
                        }

                        cscFileLines.Add(string.Join(",", warningNumbers));
                    }
                    else
                    {
                        cscFileLines.Add(cscFileLine);
                    }
                }
            }

            using (StreamWriter streamWriter = new StreamWriter(cscFilePath))
            {
                foreach (string cscLine in cscFileLines)
                {
                    if (cscLine.StartsWith("1701"))
                    {
                        string warningNumbersJoined = string.Join(",", warningNumbers);
                        streamWriter.WriteLine(string.Concat("-nowarn:", warningNumbersJoined));
                    }
                    else
                    {
                        streamWriter.WriteLine(cscLine);
                    } 
                }
            }

            Debug.Log($"Saving {cscFilePath}");
        }

19 View Source File : LeapMotionConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void ConfigureLeapMotion(bool isLeapInProject)
        {
            FileInfo[] leapDataProviderAsmDefFile = FileUtilities.FindFilesInreplacedets("Microsoft.MixedReality.Toolkit.Providers.LeapMotion.asmdef");

            replacedemblyDefinition leapDataProviderAsmDef = replacedemblyDefinition.Load(leapDataProviderAsmDefFile[0].FullName);

            List<string> references = leapDataProviderAsmDef.References.ToList();

            if (isLeapInProject && !references.Contains("LeapMotion"))
            {
                // Get the location of the Leap Core replacedets relative to the root directory
                pathDifference = GetPathDifference();

                // Make sure the Leap Core replacedets imported are version 4.4.0
                bool isLeapCorereplacedetsVersionSupported = LeapCorereplacedetsVersionSupport();

                if (isLeapCorereplacedetsVersionSupported)
                {
                    RemoveTestingFolders();
                    AddAndUpdateAsmDefs();
                    AddLeapEditorAsmDefs();

                    // Refresh the database because tests were removed and 10 asmdefs were added
                    replacedetDatabase.Refresh();
                }
                else
                {
                    Debug.LogError("MRTK only supports the Leap Motion Core replacedets Version 4.4.0 and 4.5.0, the Leap Motion Core replacedets imported are not Version 4.4.0 or 4.5.0");
                }
            }
            
            if (!isLeapInProject && references.Contains("LeapMotion"))
            {
                references.Remove("LeapMotion");
                leapDataProviderAsmDef.References = references.ToArray();
                leapDataProviderAsmDef.Save(leapDataProviderAsmDefFile[0].FullName);
            }
        }

19 View Source File : UnityARConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void UpdateAsmDef(bool arFoundationPresent)
        {
            const string asmDefFileName = "Microsoft.MixedReality.Toolkit.Providers.UnityAR.asmdef";
            FileInfo[] asmDefFiles = FileUtilities.FindFilesInreplacedets(asmDefFileName);

            if (asmDefFiles.Length == 0)
            {
                Debug.LogWarning($"Unable to locate file: {asmDefFileName}");
                return;
            }
            if (asmDefFiles.Length > 1)
            {
                Debug.LogWarning($"Multiple ({asmDefFiles.Length}) {asmDefFileName} instances found. Modifying only the first.");
            }

            replacedemblyDefinition asmDef = replacedemblyDefinition.Load(asmDefFiles[0].FullName);
            if (asmDef == null)
            {
                Debug.LogWarning($"Unable to load file: {asmDefFileName}");
                return;
            }

            List<string> references = new List<string>();
            if (asmDef.References != null)
            {
                references.AddRange(asmDef.References);
            }

            // ARFoundation replacedembly names
            const string arFoundationReference = "Unity.XR.ARFoundation";
            const string spatialTrackingReference = "UnityEngine.SpatialTracking";
            bool changed = false;

            if (arFoundationPresent)
            {
#if UNITY_2018 || UNITY_2019_1_OR_NEWER
                if (!references.Contains(arFoundationReference))
                {
                    // Add a reference to the ARFoundation replacedembly
                    references.Add(arFoundationReference);
                    changed = true; 
                }
#endif
#if UNITY_2019_1_OR_NEWER
                if (!references.Contains(spatialTrackingReference))
                {
                    // Add a reference to the spatial tracking replacedembly
                    references.Add(spatialTrackingReference);
                    changed = true;
                }
#elif UNITY_2018
                if (references.Contains(spatialTrackingReference))
                {
                    // Remove the reference to the spatial tracking replacedembly
                    references.Remove(spatialTrackingReference);
                    changed = true;
                }
#endif
            }
            else
            {
                // Remove all ARFoundation related replacedembly references
                if (references.Contains(arFoundationReference))
                {
                    references.Remove(arFoundationReference);
                    changed = true;
                }
                if (references.Contains(spatialTrackingReference))
                {
                    references.Remove(spatialTrackingReference);
                    changed = true;
                }
            }

            if (changed)
            {
                asmDef.References = references.ToArray();
                asmDef.Save(asmDefFiles[0].FullName);
            }
        }

19 View Source File : WindowsMixedRealityXRSDKConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void UpdateAsmDef()
        {
            FileInfo[] asmDefFiles = FileUtilities.FindFilesInreplacedets(AsmDefFileName);

            if (asmDefFiles.Length == 0)
            {
                Debug.LogWarning($"Unable to locate file: {AsmDefFileName}");
                return;
            }
            if (asmDefFiles.Length > 1)
            {
                Debug.LogWarning($"Multiple ({asmDefFiles.Length}) {AsmDefFileName} instances found. Modifying only the first.");
            }

            replacedemblyDefinition asmDef = replacedemblyDefinition.Load(asmDefFiles[0].FullName);
            if (asmDef == null)
            {
                Debug.LogWarning($"Unable to load file: {AsmDefFileName}");
                return;
            }

            List<string> references = new List<string>();
            if (asmDef.References != null)
            {
                references.AddRange(asmDef.References);
            }

            bool changed = false;

#if UNITY_2019_3_OR_NEWER
            List<VersionDefine> versionDefines = new List<VersionDefine>();
            if (asmDef.VersionDefines != null)
            {
                versionDefines.AddRange(asmDef.VersionDefines);
            }

            if (!references.Contains(WindowsMixedRealityReference))
            {
                // Add a reference to the XR SDK WMR replacedembly
                references.Add(WindowsMixedRealityReference);
                changed = true; 
            }

            if (!versionDefines.Contains(WindowsMixedRealityDefine))
            {
                // Add the WMR #define
                versionDefines.Add(WindowsMixedRealityDefine);
                changed = true;
            }
#else
            if (references.Contains(WindowsMixedRealityReference))
            {
                // Remove the reference to the XR SDK WMR replacedembly
                references.Remove(WindowsMixedRealityReference);
                changed = true;
            }
#endif

            if (changed)
            {
                asmDef.References = references.ToArray();
#if UNITY_2019_3_OR_NEWER
                asmDef.VersionDefines = versionDefines.ToArray();
#endif // UNITY_2019_3_OR_NEWER
                asmDef.Save(asmDefFiles[0].FullName);
            }
        }

19 View Source File : XRSDKConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void UpdateAsmDef()
        {
            FileInfo[] asmDefFiles = FileUtilities.FindFilesInreplacedets(AsmDefFileName);

            if (asmDefFiles.Length == 0)
            {
                Debug.LogWarning($"Unable to locate file: {AsmDefFileName}");
                return;
            }
            if (asmDefFiles.Length > 1)
            {
                Debug.LogWarning($"Multiple ({asmDefFiles.Length}) {AsmDefFileName} instances found. Modifying only the first.");
            }

            replacedemblyDefinition asmDef = replacedemblyDefinition.Load(asmDefFiles[0].FullName);
            if (asmDef == null)
            {
                Debug.LogWarning($"Unable to load file: {AsmDefFileName}");
                return;
            }

            List<string> references = new List<string>();
            if (asmDef.References != null)
            {
                references.AddRange(asmDef.References);
            }

            bool changed = false;

#if UNITY_2019_3_OR_NEWER
            List<VersionDefine> versionDefines = new List<VersionDefine>();
            if (asmDef.VersionDefines != null)
            {
                versionDefines.AddRange(asmDef.VersionDefines);
            }

            if (!references.Contains(XRManagementReference))
            {
                // Add a reference to the ARFoundation replacedembly
                references.Add(XRManagementReference);
                changed = true; 
            }
            if (!references.Contains(SpatialTrackingReference))
            {
                // Add a reference to the spatial tracking replacedembly
                references.Add(SpatialTrackingReference);
                changed = true;
            }

            if (!versionDefines.Contains(XRManagementDefine))
            {
                // Add the XRManagement #define
                versionDefines.Add(XRManagementDefine);
                changed = true;
            }
            if (!versionDefines.Contains(SpatialTrackingDefine))
            {
                // Add the spatial tracking #define
                versionDefines.Add(SpatialTrackingDefine);
                changed = true;
            }
#else
            if (references.Contains(XRManagementReference))
            {
                // Remove the reference to the XRManagement replacedembly
                references.Remove(XRManagementReference);
                changed = true;
            }
            if (references.Contains(SpatialTrackingReference))
            {
                // Remove the reference to the spatial tracking replacedembly
                references.Remove(SpatialTrackingReference);
                changed = true;
            }
#endif

            if (changed)
            {
                asmDef.References = references.ToArray();
#if UNITY_2019_3_OR_NEWER
                asmDef.VersionDefines = versionDefines.ToArray();
#endif // UNITY_2019_3_OR_NEWER
                asmDef.Save(asmDefFiles[0].FullName);
            }
        }

19 View Source File : SheetCopierManager.cs
License : GNU Lesser General Public License v3.0
Project Creator : acnicholas

private List<string> GetAllParameterValuesInModel(string parameterName)
        {
            var result = new List<string>();
            result.Add(@"<None>");
            using (var collector = new FilteredElementCollector(doc))
            {
                collector.OfCategory(BuiltInCategory.OST_Sheets);
                foreach (var element in collector)
                {
                    var view = (View)element;
                    var sheetParameters = view.GetParameters(parameterName);
                    if (sheetParameters == null || sheetParameters.Count <= 0)
                    {
                        continue;
                    }
                    var sheetParameter = sheetParameters.First();
                    var s = sheetParameter.replacedtring();
                    if (!string.IsNullOrEmpty(s) && !result.Contains(s))
                    {
                        result.Add(s);
                    }
                }
            }
            return result;
        }

19 View Source File : SpellChecker.cs
License : GNU Lesser General Public License v3.0
Project Creator : acnicholas

public bool MoveNext()
        {
            // No point running if there are no elements to check.
            if (allTextParameters == null || allTextParameters.Count <= 0) {
                return false;
            }

            // Run till a spelling error is found.
            while (currentIndex < allTextParameters.Count) {
                if (currentIndex == -1)
                {
                    currentIndex = 0;
                }

                // Skip if type is in the ignore list.
                if (ignoreList.Contains(CurrentCandidate.TypeString)) {
                    currentIndex++;
                    continue;
                }

                if (!allTextParameters[currentIndex].MoveNext()) {
                    return false;
                }
                currentIndex++;
            }

            // A move to the next candiate is possible.
            return true;
        }

19 View Source File : ConstantGenerationL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Runner")]
        public void BuildConstantGenerateSucceed()
        {
            List<string> validPackageNames = new List<string>()
            {
                "win-x64",
                "win-x86",
                "linux-x64",
                "linux-arm",
                "linux-arm64",
                "osx-x64"
            };

            replacedert.True(BuildConstants.Source.CommitHash.Length == 40, $"CommitHash should be SHA-1 hash {BuildConstants.Source.CommitHash}");
            replacedert.True(validPackageNames.Contains(BuildConstants.RunnerPackage.PackageName), $"PackageName should be one of the following '{string.Join(", ", validPackageNames)}', current PackageName is '{BuildConstants.RunnerPackage.PackageName}'");
        }

See More Examples