System.IO.Path.GetFileNameWithoutExtension(string)

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

5709 Examples 7

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

public static bool FindScene(SerializedProperty nameProperty, SerializedProperty pathProperty, ref UnityEngine.Object replacedet)
        {
            // Attempt to load via the scene path
            Scenereplacedet newScenereplacedet = replacedetDatabase.LoadreplacedetAtPath<Scenereplacedet>(pathProperty.stringValue);
            if (newScenereplacedet != null)
            {
                Debug.Log("Found missing scene at path " + pathProperty.stringValue);
                replacedet = newScenereplacedet;
                return true;
            }
            else
            {
                // If we didn't find it this way, search for all scenes in the project and try a name match
                foreach (string sceneGUID in replacedetDatabase.Findreplacedets("t:Scene"))
                {
                    string scenePath = replacedetDatabase.GUIDToreplacedetPath(sceneGUID);
                    string sceneName = System.IO.Path.GetFileNameWithoutExtension(scenePath);

                    if (sceneName == nameProperty.stringValue)
                    {
                        pathProperty.stringValue = scenePath;
                        newScenereplacedet = replacedetDatabase.LoadreplacedetAtPath<Scenereplacedet>(scenePath);
                        if (newScenereplacedet != null)
                        {
                            Debug.Log("Found missing scene at path " + scenePath);
                            replacedet = newScenereplacedet;
                            return true;
                        }
                    }
                }
            }

            return false;
        }

19 View Source File : BasicFileCacheManager.cs
License : Apache License 2.0
Project Creator : acarteas

public override IEnumerable<string> GetKeys(string regionName = null)
        {
            string region = "";
            if (string.IsNullOrEmpty(regionName) == false)
            {
                region = regionName;
            }
            string directory = Path.Combine(CacheDir, CacheSubFolder, region);
            if (Directory.Exists(directory))
            {
                foreach (string file in Directory.EnumerateFiles(directory))
                {
                    yield return Path.GetFileNameWithoutExtension(file);
                }
            }
        }

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

public void StartUp(Manga m, FrmStartPage startPage)
        {
            this.root = m.mangaDirectory;
            this.startPage = startPage;
            
            foreach (DirectoryInfo dir in root.GetDirectories("*", SearchOption.TopDirectoryOnly)) // chapters
            {
                FileInfo[] files = dir.GetFiles("*");
                ArrayList pages = new ArrayList();

                foreach (FileInfo fi in files) // pages
                {
                    string shortName = Path.GetFileNameWithoutExtension(fi.Name);
                    string num = Regex.Match(shortName, @"(\d+(\.\d+)?)|(\.\d+)").Value;
                    pages.Add(new Page(num, fi));
                }

                Chapter c = new Chapter(dir.Name, dir, SortPages((Page[])pages.ToArray(typeof(Page))));
                if (dir.Name == m.currentChapter)
                {
                    curChapter = c;
                } 
                chapters.Add(c);
            }

            UpdateChapters();
            UpdatePages(curChapter);
            cmboPage.SelectedItem = m.currentPage;
        }

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

public void SaveFile(InputField inputField)
		{
			var thisFilename = inputField.text;
			if (thisFilename != "")
			{
				thisFilename = Path.GetFileNameWithoutExtension(thisFilename.Replace(" ", ""));
				Debug.Log("Saved File with filename " + thisFilename);
				Avatar.saveFilename = thisFilename;

				DynamicCharacterAvatar.SaveOptions thisSaveOptions = DynamicCharacterAvatar.SaveOptions.useDefaults;
				if (_saveDNA || _saveWardrobe || _saveColors)
				{
					if (_saveDNA)
						thisSaveOptions |= DynamicCharacterAvatar.SaveOptions.saveDNA;
					if (_saveWardrobe)
						thisSaveOptions |= DynamicCharacterAvatar.SaveOptions.saveWardrobe;
					if (_saveColors)
						thisSaveOptions |= DynamicCharacterAvatar.SaveOptions.saveColors;

					thisSaveOptions &= ~DynamicCharacterAvatar.SaveOptions.useDefaults;
				}

				Avatar.DoSave(false,"", thisSaveOptions);
			}
			StartCoroutine(FinishSaveFile());
		}

19 View Source File : TestAmf0Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadNumber()
        {
            var reader = new Amf0Reader();

            var files = Directory.GetFiles("../../../../samples/amf0/number");

            foreach (var file in files)
            {
                var value = double.Parse(Path.GetFileNameWithoutExtension(file));
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetNumber(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

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

public static void ExportExcelJson(XSSFWorkbook xssfWorkbook, string name, ConfigType configType)
        {
            string exportPath = $"{PathUtil.GetPath(PathType.DataPath, GetJsonPath(configType))}/{Path.GetFileNameWithoutExtension(name)}.txt";
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.Append("{\n\t\"list\" : [");
            for (int i = 0; i < xssfWorkbook.NumberOfSheets; i++)
            {
                ExportSheetJson(xssfWorkbook.GetSheetAt(i), stringBuilder);
            }
            stringBuilder.Append("]\n}");
            FileUtil.Savereplacedet(exportPath, stringBuilder.ToString());
        }

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

public static async Task<GltfObject> ImportGltfObjectFromPathAsync(string uri)
        {
            if (!SyncContextUtility.IsMainThread)
            {
                Debug.LogError("ImportGltfObjectFromPathAsync must be called from the main thread!");
                return null;
            }

            if (string.IsNullOrWhiteSpace(uri))
            {
                Debug.LogError("Uri is not valid.");
                return null;
            }

            GltfObject gltfObject;
            bool useBackgroundThread = Application.isPlaying;

            if (useBackgroundThread) { await BackgroundThread; }

            if (uri.EndsWith(".gltf", StringComparison.OrdinalIgnoreCase))
            {
                string gltfJson = File.ReadAllText(uri);

                gltfObject = GetGltfObjectFromJson(gltfJson);

                if (gltfObject == null)
                {
                    Debug.LogError("Failed load Gltf Object from json schema.");
                    return null;
                }
            }
            else if (uri.EndsWith(".glb", StringComparison.OrdinalIgnoreCase))
            {
                byte[] glbData;

#if WINDOWS_UWP

                if (useBackgroundThread)
                {
                    try
                    {
                        var storageFile = await StorageFile.GetFileFromPathAsync(uri);

                        if (storageFile == null)
                        {
                            Debug.LogError($"Failed to locate .glb file at {uri}");
                            return null;
                        }

                        var buffer = await FileIO.ReadBufferAsync(storageFile);

                        using (DataReader dataReader = DataReader.FromBuffer(buffer))
                        {
                            glbData = new byte[buffer.Length];
                            dataReader.ReadBytes(glbData);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.LogError(e.Message);
                        return null;
                    }
                }
                else
                {
                    glbData = UnityEngine.Windows.File.ReadAllBytes(uri);
                }
#else
                using (FileStream stream = File.Open(uri, FileMode.Open))
                {
                    glbData = new byte[stream.Length];

                    if (useBackgroundThread)
                    {
                        await stream.ReadAsync(glbData, 0, (int)stream.Length);
                    }
                    else
                    {
                        stream.Read(glbData, 0, (int)stream.Length);
                    }
                }
#endif

                gltfObject = GetGltfObjectFromGlb(glbData);

                if (gltfObject == null)
                {
                    Debug.LogError("Failed to load GlTF Object from .glb!");
                    return null;
                }
            }
            else
            {
                Debug.LogError("Unsupported file name extension.");
                return null;
            }

            gltfObject.Uri = uri;

            try
            {
                gltfObject.Name = Path.GetFileNameWithoutExtension(uri);
            }
            catch (ArgumentException)
            {
                Debug.LogWarning("Uri contained invalid character");
                gltfObject.Name = DefaultObjectName;
            }

            gltfObject.UseBackgroundThread = useBackgroundThread;
            await gltfObject.ConstructAsync();

            if (gltfObject.GameObjectReference == null)
            {
                Debug.LogError("Failed to construct Gltf Object.");
            }

            if (useBackgroundThread) { await Update; }

            return gltfObject;
        }

19 View Source File : SlnTest.cs
License : MIT License
Project Creator : 3F

[Fact]
        public void SlnResultTest1()
        {
            using(var sln = new Sln(SlnItems.Projects, SlnSamplesResource.vsSolutionBuildEvent))
            {
                replacedert.Equal("\\", sln.Result.SolutionDir);
                replacedert.Equal(SlnParser.MEM_FILE, sln.Result.Properties[PropertyNames.SLN_PATH]);

                replacedert.Equal(sln.Result.SolutionDir, sln.Result.Properties[PropertyNames.SLN_DIR]);
                replacedert.Equal(Path.GetExtension(SlnParser.MEM_FILE), sln.Result.Properties[PropertyNames.SLN_EXT]);
                replacedert.Equal(Path.GetFileName(SlnParser.MEM_FILE), sln.Result.Properties[PropertyNames.SLN_FNAME]);
                replacedert.Equal(Path.GetFileNameWithoutExtension(SlnParser.MEM_FILE), sln.Result.Properties[PropertyNames.SLN_NAME]);
                replacedert.Null(sln.Result.Properties[PropertyNames.CONFIG]);
                replacedert.Null(sln.Result.Properties[PropertyNames.PLATFORM]);
            }
        }

19 View Source File : HashedFileCacheManager.cs
License : Apache License 2.0
Project Creator : acarteas

private string GetFileName(string key, string regionName = null)
        {
            if (regionName == null)
            {
                regionName = "";
            }

            //CacheItemPolicies have references to the original key, which is why we look there.  This implies that
            //manually deleting a policy in the file system has dire implications for any keys that probe after
            //the policy.  It also means that deleting a policy file makes the related .dat "invisible" to FC.
            string directory = Path.Combine(CacheDir, PolicySubFolder, regionName);

            string hash = ComputeHash(key);
            int hashCounter = 0;
            string fileName = Path.Combine(directory, string.Format("{0}_{1}.policy", hash, hashCounter));
            bool found = false;
            while (found == false)
            {
                fileName = Path.Combine(directory, string.Format("{0}_{1}.policy", hash, hashCounter));
                if (File.Exists(fileName) == true)
                {
                    //check for correct key
                    try
                    {
                        SerializableCacheItemPolicy policy = DeserializePolicyData(fileName);
                        if (key.CompareTo(policy.Key) == 0)
                        {
                            //correct key found!
                            found = true;
                        }
                        else
                        {
                            //wrong key, try again
                            hashCounter++;
                        }
                    }
                    catch
                    {
                        //Corrupt file?  replacedume usable for current key.
                        found = true;
                    }

                }
                else
                {
                    //key not found, must not exist.  Return last generated file name.
                    found = true;
                }

            }

            return Path.GetFileNameWithoutExtension(fileName);
        }

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

public static bool BuildDll(string csprojName, string path, BuildType buildType, bool isUseDefine)
        {
            bool isDebug = buildType == BuildType.Debug ? true : false;
            //项目相关所有宏
            List<string> defineList = new List<string>();
            //项目相关所有dll
            List<string> dllFilePathList = new List<string>();
            //项目本身cs文件
            List<string> csFilePathList = ReadCSPROJ(csprojName, ref defineList, ref dllFilePathList);
            List<Microsoft.Codereplacedysis.SyntaxTree> csFileList = new List<Microsoft.Codereplacedysis.SyntaxTree>();
            List<MetadataReference> dllFileList = new List<MetadataReference>();
            CSharpParseOptions parseOptions;
            //宏是否开启
            if (isUseDefine)
            {
                parseOptions = new CSharpParseOptions(LanguageVersion.Latest, preprocessorSymbols: defineList);
            }
            else
            {
                parseOptions = new CSharpParseOptions(LanguageVersion.Latest);
            }
            //增加dll文件
            foreach (string item in dllFilePathList)
            {
                PortableExecutableReference dll = MetadataReference.CreateFromFile(item);
                if (dll == null)
                {
                    continue;
                }
                dllFileList.Add(dll);
            }
            //增加cs文件
            foreach (string item in csFilePathList)
            {
                if (File.Exists(item))
                {
                    Microsoft.Codereplacedysis.SyntaxTree cs = CSharpSyntaxTree.ParseText(FileUtil.Getreplacedet(item).GetString(), parseOptions, item, Encoding.UTF8);
                    if (cs == null)
                    {
                        continue;
                    }
                    csFileList.Add(cs);
                }
            }
            //设置编译参数
            CSharpCompilationOptions compilationOptions;
            if (isDebug)
            {
                compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Debug, warningLevel: 4, allowUnsafe: true);
            }
            else
            {
                compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release, warningLevel: 4, allowUnsafe: true);
            }
            string replacedemblyName = Path.GetFileNameWithoutExtension(path);
            //开始编译
            CSharpCompilation compilation = CSharpCompilation.Create(replacedemblyName, csFileList, dllFileList, compilationOptions);
            EmitResult result;
            if (isDebug)
            {
                string pdbPath = path.Replace(".dll", ".pdb");
                EmitOptions emitOptions = new EmitOptions(debugInformationFormat: DebugInformationFormat.PortablePdb, pdbFilePath: pdbPath);
                using (MemoryStream dllStream = new MemoryStream())
                {
                    using (MemoryStream pdbStream = new MemoryStream())
                    {
                        result = compilation.Emit(dllStream, pdbStream, options: emitOptions);
                        FileUtil.Savereplacedet(path, dllStream.GetBuffer());
                        FileUtil.Savereplacedet(pdbPath, pdbStream.GetBuffer());
                    }
                }
            }
            else
            {
                result = compilation.Emit(path);
            }
            if (result.Success)
            {
                LogUtil.Log("编译成功");
            }
            else
            {
                List<Diagnostic> failureList = (from diagnostic in result.Diagnostics where diagnostic.IsWarningAsError || diagnostic.Severity == DiagnosticSeverity.Error select diagnostic).ToList();
                foreach (Diagnostic item in failureList)
                {
                    LogUtil.Log(item.ToString());
                }
            }
            return result.Success;
        }

19 View Source File : TestAmf3Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadBoolean()
        {
            var reader = new Amf3Reader();

            var files = Directory.GetFiles("../../../../samples/amf3/boolean");

            foreach (var file in files)
            {
                var value = bool.Parse(Path.GetFileNameWithoutExtension(file));
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetBoolean(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

19 View Source File : TestAmf3Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadInteger()
        {
            var reader = new Amf3Reader();

            var files = Directory.GetFiles("../../../../samples/amf3/intenger");

            foreach (var file in files)
            {
                var value = uint.Parse(Path.GetFileNameWithoutExtension(file));
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetUInt29(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

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

public Object CreatereplacedetFormTemplate(string pathName, string resourceFile)
        {
            //获取要创建资源的绝对路径
            string fullName = Path.GetFullPath(pathName);
            //获取资源的文件名
            string fileName = Path.GetFileNameWithoutExtension(pathName);
            //读取本地模版文件 替换默认的文件名
            string content = FileUtil.Getreplacedet(resourceFile).GetString().Replace("(Clreplaced)", fileName).Replace("(ViewModel)", fileName.Replace("Panel", string.Empty));
            //写入新文件
            FileUtil.Savereplacedet(fullName, content);
            //刷新本地资源
            replacedetDatabase.Refresh();
            return replacedetDatabase.LoadreplacedetAtPath(pathName, typeof(Object));
        }

19 View Source File : RepositorySaveData.cs
License : Apache License 2.0
Project Creator : AantCoder

public void SavePlayerData(string login, byte[] data, bool single)
        {
            if (data == null || data.Length < 10) return;

            var fileNameBase = GetFileNameBase(login);
            var pFiles = GetListPlayerFiles(login);
            if (single)
            {
                if (pFiles.Count > 0)
                {
                    if (File.Exists(pFiles[0] + ".bak")) File.Delete(pFiles[0] + ".bak");
                    File.Move(pFiles[0], pFiles[0] + ".bak");
                }
                for (int i = 1; i < pFiles.Count; i++) File.Delete(pFiles[i]);
            }
            else
            {
                //Делаем так, чтобы в pFiles[pFiles.Count - 1] было имя файла которого нет
                if (pFiles.Count == CountSaveDataPlayer)
                {
                    File.Delete(pFiles[pFiles.Count - 1]);
                }
                else
                {
                    pFiles.Add(fileNameBase + (pFiles.Count + 1).ToString());
                }
                for (int i = pFiles.Count - 2; i >= 0 ; i--)
                {
                    File.Move(pFiles[i], pFiles[i + 1]);
                }
            }

            var fileName = fileNameBase + "1";

            byte[] dataToSave;
            if (true)
            {
                dataToSave = GZip.ZipByteByte(data);
            }
            else
            {
                dataToSave = data;
            }

            File.WriteAllBytes(fileName, dataToSave);
            Loger.Log("Server User " + Path.GetFileNameWithoutExtension(fileName) + " saved.");
        }

19 View Source File : XProjectEnv.cs
License : MIT License
Project Creator : 3F

private Projecreplacedem GetProjecreplacedem(string file, IDictionary<string, string> props)
        {
            var ret = new Projecreplacedem()
            {
                fullPath    = file,
                pGuid       = props.GetOrDefault(PropertyNames.PRJ_GUID) ?? Guid.Empty.ToString(),
                EpType      = FileExt.GetProjectTypeByFile(file),
                name        = Path.GetFileNameWithoutExtension(file),
            };
            ret.pType = Guids.GuidBy(ret.EpType);

            if(Sln == null)
            {
                return ret;
            }

            var found = Sln.Projecreplacedems.FirstOrDefault(p => p.fullPath == file);
            if(found.path != null)
            {
                return found;
            }

            ret.path = Sln.SolutionDir.MakeRelativePath(file);
            return ret;
        }

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

public static string GetSceneNameFromScenePath(string scenePath)
        {
            return System.IO.Path.GetFileNameWithoutExtension(scenePath);
        }

19 View Source File : AssemblyLoading.cs
License : MIT License
Project Creator : 71

private static replacedembly Resolving(replacedemblyLoadContext ctx, replacedemblyName replacedemblyName)
        {
            var compilation = CurrentCompilation;

            if (Loaded.TryGetValue(replacedemblyName.Name, out replacedembly result))
                return result;

            if (compilation == null)
                return null;

            foreach (var reference in compilation.References)
            {
                if (!(reference is PortableExecutableReference pe) ||
                    !Path.GetFileNameWithoutExtension(pe.Display).Equals(replacedemblyName.Name, StringComparison.OrdinalIgnoreCase))
                    continue;

                try
                {
                    replacedembly replacedembly = LoadCore(ctx, pe.FilePath);

                    Loaded[replacedemblyName.Name] = replacedembly;

                    return replacedembly;
                }
                catch
                {
                    // ReSharper disable once RedundantJumpStatement
                    continue;
                }
            }

            return null;
        }

19 View Source File : OVRSceneLoader.cs
License : MIT License
Project Creator : absurd-joy

private void LoadScene(SceneInfo sceneInfo)
	{
		replacedetBundle mainSceneBundle = null;
		Debug.Log("[OVRSceneLoader] Loading main scene: " + sceneInfo.scenes[0] + " with version " + sceneInfo.version.ToString());

		logTextBox.text += "Target Scene: " + sceneInfo.scenes[0] + "\n";
		logTextBox.text += "Version: " + sceneInfo.version.ToString() + "\n";

		// Load main scene and dependent additive scenes (if any)
		Debug.Log("[OVRSceneLoader] Loading scene bundle files.");
		// Fetch all files under scene cache path, excluding unnecessary files such as scene metadata file
		string[] bundles = Directory.GetFiles(scenePath, "*_*");
		logTextBox.text += "Loading " + bundles.Length + " bundle(s) . . . ";
		string mainSceneBundleFileName = "scene_" + sceneInfo.scenes[0].ToLower();
		try
		{
			foreach (string b in bundles)
			{
				var replacedetBundle = replacedetBundle.LoadFromFile(b);
				if (replacedetBundle != null)
				{
					Debug.Log("[OVRSceneLoader] Loading file bundle: " + replacedetBundle.name == null ? "null" : replacedetBundle.name);
					loadedreplacedetBundles.Add(replacedetBundle);
				}
				else
				{
					Debug.LogError("[OVRSceneLoader] Loading file bundle failed");
				}

				if (replacedetBundle.name == mainSceneBundleFileName)
				{
					mainSceneBundle = replacedetBundle;
				}

				if (replacedetBundle.name == resourceBundleName)
				{
					OVRResources.SetResourceBundle(replacedetBundle);
				}
			}
		}
		catch(Exception e)
		{
			logTextBox.text += "<color=red>" + e.Message + "</color>";
			return;
		}
		logTextBox.text += "<color=green>DONE\n</color>";

		if (mainSceneBundle != null)
		{
			logTextBox.text += "Loading Scene: {0:P0}\n";
			formattedLogText = logTextBox.text;
			string[] scenePaths = mainSceneBundle.GetAllScenePaths();
			string sceneName = Path.GetFileNameWithoutExtension(scenePaths[0]);
			
			loadSceneOperation = SceneManager.LoadSceneAsync(sceneName);
			loadSceneOperation.completed += LoadSceneOperation_completed;
		}
		else
		{
			logTextBox.text += "<color=red>Failed to get main scene bundle.\n</color>";
		}
	}

19 View Source File : MainForm.cs
License : MIT License
Project Creator : 13xforever

private void FindMatchingIrdFinished(object sender, RunWorkerCompletedEventArgs e)
        {
            var dumper = (Dumper)e.Result;
            if (e.Cancelled || dumper.Cts.IsCancellationRequested)
                return;

            settingsButton.Enabled = true;
            if (dumper.DiscKeyFilename == null)
            {
                irdMatchLabel.Text = "No match found";
                step2StatusLabel.Text = "❌";
                step2Label.Text = "Select a disc key file...";
                selectIrdButton.Enabled = true;
                selectIrdButton.Visible = true;
            }
            else
            {
                step2StatusLabel.Text = "✔";
                step2Label.Text = "Matched disc key selected";
                step3StatusLabel.Text = "▶";
                step3Label.Text = "Start disc decryption...";
                step3Label.Enabled = true;
                label3.Text = $"Matching {(dumper.DiscKeyType == KeyType.Ird ? "IRD" : "Key")}:";
                irdMatchLabel.Text = Path.GetFileNameWithoutExtension(dumper.DiscKeyFilename);
                rescanDiscsButton.Visible = false;
                rescanDiscsButton.Enabled = false;
                startDumpingButton.Enabled = true;
                startDumpingButton.Visible = true;
                discBackgroundWorker.DoWork -= FindMatchingIrd;
                discBackgroundWorker.RunWorkerCompleted -= FindMatchingIrdFinished;
            }
        }

19 View Source File : BasicFileCacheManager.cs
License : Apache License 2.0
Project Creator : acarteas

public override string GetPolicyPath(string key, string regionName = null)
        {
            if (regionName == null)
            {
                regionName = "";
            }
            string directory = Path.Combine(CacheDir, PolicySubFolder, regionName);
            string filePath = Path.Combine(directory, Path.GetFileNameWithoutExtension(key) + ".policy");
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            return filePath;
        }

19 View Source File : TestAmf0Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadBoolean()
        {
            var reader = new Amf0Reader();

            var files = Directory.GetFiles("../../../../samples/amf0/boolean");

            foreach (var file in files)
            {
                var value = bool.Parse(Path.GetFileNameWithoutExtension(file));
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetBoolean(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

19 View Source File : TestAmf3Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadString()
        {
            var reader = new Amf3Reader();

            var files = Directory.GetFiles("../../../../samples/amf3/string");

            foreach (var file in files)
            {
                var value = Path.GetFileNameWithoutExtension(file);
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetString(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

19 View Source File : BuildWindow.cs
License : MIT License
Project Creator : 1ZouLTReX1

static void KillAllProcesses()
    {
        foreach (GameLoopMode loopMode in Enum.GetValues(typeof(GameLoopMode)))
        {
            if (loopMode.Equals(GameLoopMode.Undefined))
                continue;

            var buildExe = GetBuildExe(loopMode);

            var processName = Path.GetFileNameWithoutExtension(buildExe);
            var processes = System.Diagnostics.Process.GetProcesses();
            foreach (var process in processes)
            {
                if (process.HasExited)
                    continue;

                try
                {
                    if (process.ProcessName != null && process.ProcessName == processName)
                    {
                        process.Kill();
                    }
                }
                catch (InvalidOperationException)
                {

                }
            }
        }
    }

19 View Source File : TestAmf3Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadNumber()
        {
            var reader = new Amf3Reader();

            var files = Directory.GetFiles("../../../../samples/amf3/number");

            foreach (var file in files)
            {
                var value = double.Parse(Path.GetFileNameWithoutExtension(file));
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetDouble(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

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

public static void BuildreplacedetBundle(replacedetBundleSetting replacedetBundleSetting)
        {
            Dictionary<string, replacedetBundleData> replacedetBundleDataDict = new Dictionary<string, replacedetBundleData>();
            Dictionary<string, replacedetBundleRuleType> replacedetBundleRuleTypeDict = new Dictionary<string, replacedetBundleRuleType>();
            string path = PathUtil.GetPath(PathType.DataPath, replacedetBundleSetting.outputPath, GetPlatformForreplacedetBundle(EditorUserBuildSettings.activeBuildTarget));
            foreach (DirectoryInfo item in DirectoryUtil.GetDirectorys(new DirectoryInfo(path), new List<DirectoryInfo>()))
            {
                item.Delete();
            }
            foreach (FileInfo item in FileUtil.GetFiles(new DirectoryInfo(path), new List<FileInfo>()))
            {
                item.Delete();
            }
            List<replacedetBundleBuild> replacedetBundleBuildList = new List<replacedetBundleBuild>();
            foreach (replacedetBundleRule item in replacedetBundleSetting.replacedetBundleRuleList)
            {
                if (item.replacedetBundleRuleType == replacedetBundleRuleType.File)
                {
                    FileInfo[] fileInfos = FileUtil.GetFiles(new DirectoryInfo(item.path), new List<FileInfo>());
                    if (fileInfos.Length == 0) continue;
                    List<FileInfo> fileInfoList = (from fileInfo in fileInfos where !string.IsNullOrEmpty(Path.GetExtension(fileInfo.Name)) && Path.GetExtension(fileInfo.Name) != ".meta" select fileInfo).ToList();
                    foreach (FileInfo fileInfo in fileInfoList)
                    {
                        replacedetBundleRuleTypeDict.Add(fileInfo.FullName.Substring(fileInfo.FullName.IndexOf("replacedets")).Replace("\\", "/"), replacedetBundleRuleType.File);
                    }
                }
                if (item.replacedetBundleRuleType == replacedetBundleRuleType.Directory)
                {
                    DirectoryInfo[] directoryInfos = DirectoryUtil.GetDirectorys(new DirectoryInfo(item.path), new List<DirectoryInfo>());
                    if (directoryInfos.Length == 0) continue;
                    foreach (DirectoryInfo directoryInfo in directoryInfos)
                    {
                        FileInfo[] fileInfos = directoryInfo.GetFiles();
                        if (fileInfos.Length == 0) continue;
                        List<FileInfo> fileInfoList = (from fileInfo in fileInfos where !string.IsNullOrEmpty(Path.GetExtension(fileInfo.Name)) && Path.GetExtension(fileInfo.Name) != ".meta" select fileInfo).ToList();
                        foreach (FileInfo fileInfo in fileInfoList)
                        {
                            replacedetBundleRuleTypeDict.Add(fileInfo.FullName.Substring(fileInfo.FullName.IndexOf("replacedets")).Replace("\\", "/"), replacedetBundleRuleType.Directory);
                        }
                    }
                }
            }
            foreach (replacedetBundleData item in replacedetBundleSetting.replacedetBundleDataList)
            {
                replacedetBundleBuildList.Add(new replacedetBundleBuild()
                {
                    replacedetBundleName = item.replacedetBundleName,
                    replacedetNames = item.replacedetNames,
                });
            }
            replacedetBundleManifest replacedetBundleManifest = BuildPipeline.BuildreplacedetBundles(path, replacedetBundleBuildList.ToArray(), BuildreplacedetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
            foreach (replacedetBundleData item in replacedetBundleSetting.replacedetBundleDataList)
            {
                item.replacedetBundleHash = replacedetBundleManifest.GetreplacedetBundleHash(item.replacedetBundleName).ToString();
                BuildPipeline.GetCRCForreplacedetBundle($"{path}/{item.replacedetBundleName}", out item.replacedetBundleCRC);
                item.fileSize = FileUtil.GetFileSize($"{path}/{item.replacedetBundleName}");
                replacedetBundleDataDict.Add(Path.GetFileNameWithoutExtension(item.replacedetBundleName), item);
            }
            replacedetBundleConfig replacedetBundleConfig = new replacedetBundleConfig(replacedetBundleSetting.buildId, replacedetBundleDataDict, replacedetBundleRuleTypeDict);
            FileUtil.Savereplacedet(path, "replacedetBundleConfig.json", JsonUtil.ToJson(replacedetBundleConfig));
            if (replacedetBundleSetting.isCopyStreamingreplacedets)
            {
                string copyPath = PathUtil.GetPath(PathType.StreamingreplacedetsPath, "Res", GetPlatformForreplacedetBundle(EditorUserBuildSettings.activeBuildTarget));
                foreach (DirectoryInfo item in DirectoryUtil.GetDirectorys(new DirectoryInfo(copyPath), new List<DirectoryInfo>()))
                {
                    item.Delete();
                }
                foreach (FileInfo item in FileUtil.GetFiles(new DirectoryInfo(copyPath), new List<FileInfo>()))
                {
                    item.Delete();
                }
                foreach (FileInfo item in FileUtil.GetFiles(new DirectoryInfo(path), new List<FileInfo>()))
                {
                    if (Path.GetExtension(item.Name) == ".meta") continue;
                    File.Copy(item.FullName, $"{PathUtil.GetPath(PathType.StreamingreplacedetsPath, "Res", GetPlatformForreplacedetBundle(EditorUserBuildSettings.activeBuildTarget))}/{item.Name}");
                }
            }
            replacedetDatabase.Refresh();
        }

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

[MenuItem("UMA/Runtime/Save Selected Avatars generated textures to PNG")]
      public static void SaveSelectedAvatarsPNG()
      {
         if (!Application.isPlaying)
         {
            EditorUtility.DisplayDialog("Notice", "This function is only available at runtime", "Got it");
            return;
         }

         if (Selection.gameObjects.Length != 1)
         {
            EditorUtility.DisplayDialog("Notice", "Only one Avatar can be selected.", "OK");
            return;
         }

         var selectedTransform = Selection.gameObjects[0].transform;
         var avatar = selectedTransform.GetComponent<UMAAvatarBase>();

         if (avatar == null)
         {
            EditorUtility.DisplayDialog("Notice", "An Avatar must be selected to use this function", "OK");
            return;
         }

         SkinnedMeshRenderer smr = avatar.gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
         if (smr == null)
         {
            EditorUtility.DisplayDialog("Warning", "Could not find SkinnedMeshRenderer in Avatar hierarchy", "OK");
            return;
         }

         string path = EditorUtility.SaveFilePanelInProject("Save Texture(s)", "Texture.png", "png", "Base Filename to save PNG files to.");
         if (!string.IsNullOrEmpty(path))
         {
            string basename = System.IO.Path.GetFileNameWithoutExtension(path);
            string pathname = System.IO.Path.GetDirectoryName(path);
            // save the diffuse texture
            for (int i = 0; i < smr.materials.Length; i++)
            {
               string PathBase = System.IO.Path.Combine(pathname, basename + "_material_" + i.ToString());
               string DiffuseName = PathBase + "_Diffuse.PNG";
               SaveTexture(smr.materials[i].GetTexture("_MainTex"), DiffuseName);
            }
         }
      }

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

public IEnumerator Dump(string sceneName = null)
		{

			List<string> scenes = new List<string>();
			for (int j = 0; j < USceneManager.sceneCountInBuildSettings; j++)
			{
				string scenePath = SceneUtility.GetScenePathByBuildIndex(j);
				string name = Path.GetFileNameWithoutExtension(scenePath);
				scenes.Add(name);
				var load = USceneManager.LoadSceneAsync(j, LoadSceneMode.Single);
				while (!load.isDone)
				{
					yield return new WaitForEndOfFrame();
				}
				yield return new WaitForSeconds(0.2f);
				Scene s = USceneManager.GetActiveScene();
				StringBuilder sb = new StringBuilder();
				foreach (var g in s.GetRootGameObjects())
                {
					Visit(g.transform, 0, null,sb);
                }
				try
				{
					var fs = File.Create($"Z:\\1\\{s.name}.txt");
					StreamWriter sw = new StreamWriter(fs);
					sw.Write(sb.ToString());
					sw.Close();
					fs.Close();
				}
				catch { }
				
				//
			}
			var load_ = USceneManager.LoadSceneAsync(2, LoadSceneMode.Single);
			while (!load_.isDone)
			{
				yield return new WaitForEndOfFrame();
			}
			yield return USceneManager.LoadSceneAsync("Quit_To_Menu");
			while (USceneManager.GetActiveScene().name != Constants.MENU_SCENE)
			{
				yield return new WaitForEndOfFrame();
			}

			
			
		}

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

public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            LccView lccView = (LccView)target;
            if (GUILayout.Button(lccView.clreplacedName))
            {
                string directoryName = string.Empty;
                switch (Path.GetFileNameWithoutExtension(lccView.type.GetType().replacedembly.ManifestModule.Name))
                {
                    case "Unity.Model":
                        directoryName = "Scripts";
                        break;
                    case "Unity.Hotfix":
                        directoryName = "Hotfix";
                        break;
                    case "ILRuntime":
                        directoryName = "Hotfix";
                        break;
                }
                string fileName = lccView.clreplacedName;
                string[] filePaths = Directory.GetFiles($"replacedets/{directoryName}", "*.cs", SearchOption.AllDirectories);
                foreach (string item in filePaths)
                {
                    if (item.Substring(item.LastIndexOf(@"\") + 1) == $"{fileName}.cs")
                    {
                        EditorGUIUtility.PingObject(replacedetDatabase.LoadreplacedetAtPath<Textreplacedet>(item));
                        replacedetDatabase.Openreplacedet(replacedetDatabase.LoadreplacedetAtPath<Object>(item), 0);
                    }
                }
            }
            ObjectTypeUtil.Draw(lccView.type, 0);
        }

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

public void ListLoadableFiles(ScrollRect ItemList)
		{
			var thisSubFolder = Avatar.loadPath.TrimStart('\\', '/').TrimEnd('\\', '/').Trim();//trim this at the start and the end of slashes. And then we may need to switch any slashes in the middle depending on the platform- for explode on them or something
																							//we can find things in resources/thisSubFolder and in persistentDataPath/thisSubFolder
																							//Clear the item list
			ItemList.content.GetComponent<VerticalLayoutGroup>().enabled = false;//dont seem to be able to clear the content with this on...
			foreach (Transform child in ItemList.content.transform)
			{
				Destroy(child.gameObject);
			}
			ItemList.content.GetComponent<VerticalLayoutGroup>().enabled = true;
			//- I need to basically get rid of the other oprions in CharacterAvatars enumerator since they are effectively useless apart from in the editor
			var persistentPath = Path.Combine(Application.persistentDataPath, thisSubFolder);
			if (Directory.Exists(persistentPath))
			{
				string[] persistentDataFiles = Directory.GetFiles(persistentPath, "*.txt");
				foreach (string path in persistentDataFiles)
				{
					GameObject thisLoadableItem = Instantiate(loadableItemPrefab) as GameObject;
					thisLoadableItem.transform.SetParent(ItemList.content.transform, false);
					thisLoadableItem.GetComponent<CSLoadableItem>().customizerScript = this;
					thisLoadableItem.GetComponent<CSLoadableItem>().filepath = path;
					thisLoadableItem.GetComponent<CSLoadableItem>().filename = Path.GetFileNameWithoutExtension(path);
					thisLoadableItem.GetComponentInChildren<Text>().text = Path.GetFileNameWithoutExtension(path);
				}
			}
			foreach (KeyValuePair<string, string> kp in (UMAContext.Instance.dynamicCharacterSystem as DynamicCharacterSystem).CharacterRecipes)
			{
				GameObject thisLoadableItem = Instantiate(loadableItemPrefab) as GameObject;
				thisLoadableItem.transform.SetParent(ItemList.content.transform, false);
				thisLoadableItem.GetComponent<CSLoadableItem>().customizerScript = this;
				thisLoadableItem.GetComponent<CSLoadableItem>().filename = Path.GetFileNameWithoutExtension(kp.Key);
				thisLoadableItem.GetComponentInChildren<Text>().text = Path.GetFileNameWithoutExtension(kp.Key);
			}
		}

19 View Source File : BuildUtils.cs
License : MIT License
Project Creator : 1ZouLTReX1

public static void KillAllProcesses()
    {
        foreach (GameLoopMode loopMode in Enum.GetValues(typeof(GameLoopMode)))
        {
            if (loopMode.Equals(GameLoopMode.Undefined))
                continue;

            var buildExe = GetBuildExe(loopMode);

            var processName = Path.GetFileNameWithoutExtension(buildExe);
            var processes = System.Diagnostics.Process.GetProcesses();

            foreach (var process in processes)
            {
                if (process.HasExited)
                    continue;

                try
                {
                    if (process.ProcessName != null && process.ProcessName == processName)
                    {
                        process.Kill();
                    }
                }
                catch (InvalidOperationException)
                {

                }
            }
        }
    }

19 View Source File : UI.cs
License : MIT License
Project Creator : aaaddress1

private void refreshUi(object sender, EventArgs e)
        {
            /* i'm too lazy to make a editor for C/C++ :P,
             * and this editor is really useful!!
             * https://github.com/PavelTorgashov/FastColoredTextBox */
            fastColoredTextBox.Language = FastColoredTextBoxNS.Language.CSharp;

            if (srcPath == "")
                srcPath = Path.Combine(Application.StartupPath, "main.cpp");

            if (!File.Exists(srcPath))
                File.WriteAllText(srcPath, Properties.Resources.templateSrc);

            fastColoredTextBox.InsertText(File.ReadAllText(srcPath));

            asmPath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + ".s");
            obfAsmPath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + "_obf.s");
            exePath = Path.Combine(Path.GetDirectoryName(srcPath), Path.GetFileNameWithoutExtension(srcPath) + ".exe");
            this.Text = string.Format("puzzCode [{0}] by [email protected]", new FileInfo(srcPath).Name);

            logBox.Clear();
            logMsg(demostr, Color.Blue);

            compiler.logText = this.logBox;
            obfuscator.logText = this.logBox;

            this.splitContainer.Panel2Collapsed = true;

            if (!new DirectoryInfo(Properties.Settings.Default.gwPath).Exists)
            {
                MessageBox.Show("please choose your MinGW path.");
                (new config()).ShowDialog();
                if (!new DirectoryInfo(Properties.Settings.Default.gwPath).Exists)
                {
                    MessageBox.Show("sorry, MinGW not found :(");
                    Application.Exit();
                }
            }
        }

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

public static void ExportClreplacedAndJson()
        {
            content = FileUtil.Getreplacedet(templatePath).GetString();
            foreach (string item in Directory.GetFiles(excelPath, "*.xlsx"))
            {
                ExportExcelClreplaced(new XSSFWorkbook(item), Path.GetFileNameWithoutExtension(item), ConfigType.Model);
                ExportExcelClreplaced(new XSSFWorkbook(item), Path.GetFileNameWithoutExtension(item), ConfigType.Hotfix);
                ExportExcelJson(new XSSFWorkbook(item), Path.GetFileNameWithoutExtension(item), ConfigType.Model);
                ExportExcelJson(new XSSFWorkbook(item), Path.GetFileNameWithoutExtension(item), ConfigType.Hotfix);
            }
            replacedetDatabase.Refresh();
        }

19 View Source File : Shapefile.cs
License : Microsoft Public License
Project Creator : abfo

private void OpenDb()
        {
            // The drivers for DBF files throw an exception if the filename 
            // is longer than 8 characters - in this case create a temp file
            // for the DB
            string safeDbasePath = _shapefileDbasePath;
            if (Path.GetFileNameWithoutExtension(safeDbasePath).Length > 8)
            {
                // create/delete temp file (we just want a safe path)
                string initialTempFile = Path.GetTempFileName();
                try
                {
                    File.Delete(initialTempFile);
                }
                catch { }

                // set the correct extension
                _shapefileTempDbasePath = Path.ChangeExtension(initialTempFile, DbasePathExtension);

                // copy over the DB
                File.Copy(_shapefileDbasePath, _shapefileTempDbasePath, true);
                safeDbasePath = _shapefileTempDbasePath;
            }

            string connectionString = string.Format(ConnectionStringTemplate,
                Path.GetDirectoryName(safeDbasePath));
            _selectString = string.Format(DbSelectStringTemplate,
                Path.GetFileNameWithoutExtension(safeDbasePath));

            _dbConnection = new OleDbConnection(connectionString);
            _dbConnection.Open();
            
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : 0xd4d

static (int bitness, DisasmInfo[] methods, KnownSymbols knownSymbols) GetMethodsToDisreplacedemble(int pid, string moduleName, MemberFilter typeFilter, MemberFilter methodFilter, bool heapSearch) {
			var methods = new List<DisasmInfo>();
			var knownSymbols = new KnownSymbols();
			int bitness;
			using (var dataTarget = DataTarget.AttachToProcess(pid, 0, AttachFlag.Preplacedive)) {
				if (dataTarget.ClrVersions.Count == 0)
					throw new ApplicationException("Couldn't find CLR/CoreCLR");
				if (dataTarget.ClrVersions.Count > 1)
					throw new ApplicationException("Found more than one CLR/CoreCLR");
				var clrInfo = dataTarget.ClrVersions[0];
				var clrRuntime = clrInfo.CreateRuntime(clrInfo.LocalMatchingDac);
				bitness = clrRuntime.PointerSize * 8;

				// Per https://github.com/microsoft/clrmd/issues/303
				dataTarget.DataReader.Flush();

				var module = clrRuntime.Modules.FirstOrDefault(a =>
					StringComparer.OrdinalIgnoreCase.Equals(a.Name, moduleName) ||
					StringComparer.OrdinalIgnoreCase.Equals(Path.GetFileNameWithoutExtension(a.Name), moduleName) ||
					StringComparer.OrdinalIgnoreCase.Equals(a.FileName, moduleName));
				if (module is null)
					throw new ApplicationException($"Couldn't find module '{moduleName}'");

				module.Runtime.Flush();

				foreach (var type in EnumerateTypes(module, heapSearch)) {
					if (!typeFilter.IsMatch(type.Name, type.MetadataToken))
						continue;
					foreach (var method in type.Methods) {
						if (!IsSameType(method.Type, type))
							continue;
						if (method.CompilationType == MethodCompilationType.None)
							continue;
						if (!methodFilter.IsMatch(method.Name, method.MetadataToken))
							continue;
						var disasmInfo = CreateDisasmInfo(dataTarget, method);
						DecodeInstructions(knownSymbols, clrRuntime, disasmInfo);
						methods.Add(disasmInfo);
					}
				}
			}
			return (bitness, methods.ToArray(), knownSymbols);
		}

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

public static FileInfo[] FindFilesInreplacedets(string fileName)
        {
            // Findreplacedets doesn't take a file extension
            string[] replacedetGuids = replacedetDatabase.Findreplacedets(Path.GetFileNameWithoutExtension(fileName));

            List<FileInfo> fileInfos = new List<FileInfo>();
            for (int i = 0; i < replacedetGuids.Length; i++)
            {
                string replacedetPath = replacedetDatabase.GUIDToreplacedetPath(replacedetGuids[i]);
                // Since this is an replacedet search without extension, some filenames may contain parts of other filenames.
                // Therefore, double check that the path actually contains the filename with extension.
                if (replacedetPath.Contains(fileName))
                {
                    fileInfos.Add(new FileInfo(replacedetPath));
                }
            }

            return fileInfos.ToArray();
        }

19 View Source File : AdaptationBaseDrawer.cs
License : MIT License
Project Creator : 5argon

void CreateAnimator(bool forPortrait)
        {
            AdaptationBase adaptation = (AdaptationBase)target;
            Animator animator = adaptation.gameObject.GetComponent<Animator>();

            var incompletePath = GetSaveControllerPath(adaptation.gameObject);
            if (string.IsNullOrEmpty(incompletePath)) return;
            var prefix = Path.GetFileNameWithoutExtension(incompletePath);
            var path = $"{Path.GetDirectoryName(incompletePath)}{Path.DirectorySeparatorChar}{prefix}Adaptation.controller";
            var controller = AnimatorController.CreateAnimatorControllerAtPath(path);
            replacedetDatabase.Importreplacedet(path);


            animator.runtimeAnimatorController = controller;

            var normalStateClip = AnimatorController.AllocateAnimatorClip($"{prefix}NormalState");
            var adaptedStateClip = AnimatorController.AllocateAnimatorClip($"{prefix}AdaptedState");

            replacedetDatabase.AddObjectToreplacedet(normalStateClip, controller);
            replacedetDatabase.AddObjectToreplacedet(adaptedStateClip, controller);
            replacedetDatabase.Importreplacedet(path);
            adaptation.replacedignAdaptationClips(normalStateClip, adaptedStateClip, forPortrait);


            var ly = controller.layers[0].stateMachine;
            var emptyState = ly.AddState("Empty State");
            ly.defaultState = emptyState;

            var normalGraphState = controller.AddMotion(normalStateClip, 0);
            var adaptedGraphState = controller.AddMotion(adaptedStateClip, 0);

            string GetSaveControllerPath(GameObject go)
            {
                var defaultName = go.name;
                var message = $"Create a new adaptation replacedets for the game object '{defaultName}'\nThis name will be a prefix for all replacedets.";
                return EditorUtility.SaveFilePanelInProject("New Animation Contoller", defaultName, "", message);
            }
        }

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

public static bool FindScene(string sceneName, out Scene scene, out int sceneIndex)
        {
            scene = default(Scene);
            sceneIndex = -1;
            // This is the only method to get all scenes (including unloaded)
            // This absurdity is necessary due to a long-standing Unity bug
            // https://issuetracker.unity3d.com/issues/scenemanager-dot-getscenebybuildindex-dot-name-returns-an-empty-string-if-scene-is-not-loaded
            List<Scene> allScenesInProject = new List<Scene>();
            for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
            {
                string pathToScene = SceneUtility.GetScenePathByBuildIndex(i);
                string checkSceneName = System.IO.Path.GetFileNameWithoutExtension(pathToScene);
                if (checkSceneName == sceneName)
                {
                    scene = SceneManager.GetSceneByBuildIndex(i);
                    sceneIndex = i;
                    return true;
                }
            }
            return false;
        }

19 View Source File : StringExtension.cs
License : MIT License
Project Creator : 3F

public static Dictionary<string, string> GetFileProperties(this string file)
        {
            if(string.IsNullOrEmpty(file))
            {
                return new Dictionary<string, string>()
                {
                    [PropertyNames.SLN_DIR]     = PropertyNames.UNDEFINED,
                    [PropertyNames.SLN_EXT]     = PropertyNames.UNDEFINED,
                    [PropertyNames.SLN_FNAME]   = PropertyNames.UNDEFINED,
                    [PropertyNames.SLN_NAME]    = PropertyNames.UNDEFINED,
                    [PropertyNames.SLN_PATH]    = PropertyNames.UNDEFINED,
                };
            }

            return new Dictionary<string, string>()
            {
                [PropertyNames.SLN_DIR]     = GetDirectoryFromFile(file),
                [PropertyNames.SLN_EXT]     = Path.GetExtension(file),
                [PropertyNames.SLN_FNAME]   = Path.GetFileName(file),
                [PropertyNames.SLN_NAME]    = Path.GetFileNameWithoutExtension(file),
                [PropertyNames.SLN_PATH]    = file,
            };
        }

19 View Source File : StartMenu.cs
License : MIT License
Project Creator : absurd-joy

void Start()
    {
        DebugUIBuilder.instance.AddLabel("Select Sample Scene");
        
        int n = UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings;
        for (int i = 0; i < n; ++i)
        {
            string path = UnityEngine.SceneManagement.SceneUtility.GetScenePathByBuildIndex(i);
            var sceneIndex = i;
            DebugUIBuilder.instance.AddButton(Path.GetFileNameWithoutExtension(path), () => LoadScene(sceneIndex));
        }
        
        DebugUIBuilder.instance.Show();
    }

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

public string GetID()
        {
            return Path.GetFileNameWithoutExtension(filepath);
        }

19 View Source File : AutomationTestBase.cs
License : MIT License
Project Creator : ABTSoftware

public void SaveDiffImages(string resourceName, WriteableBitmap expectedBitmap, WriteableBitmap actualBitmap)
        {
            string expectedPath = Path.Combine(ExportActualPath,
                Path.GetFileNameWithoutExtension(resourceName) + "-expected.png");

            string actualPath = Path.Combine(ExportActualPath,
                Path.GetFileNameWithoutExtension(resourceName) + "-actual.png");

            SaveToPng(expectedPath, expectedBitmap);
            Console.WriteLine(@"Expected bitmap saved to " + expectedPath);

            SaveToPng(actualPath, actualBitmap);
            Console.WriteLine(@"Actual bitmap saved to " + actualPath);

            var byteExpected = expectedBitmap.ToByteArray();
            var byteActual = actualBitmap.ToByteArray();
            if (byteExpected.Length == byteActual.Length)
            {
                var byteDiff = new byte[byteExpected.Length];
                for (int i = 0; i < byteExpected.Length; i++)
                {
                    // For alpha use the average of both images (otherwise pixels with the same alpha won't be visible)
                    if ((i + 1) % 4 == 0)
                        byteDiff[i] = (byte)((byteActual[i] + byteExpected[i]) / 2);
                    else
                        byteDiff[i] = (byte)Math.Abs(byteActual[i] - byteExpected[i]);
                }
                var diffBmp = new WriteableBitmap(expectedBitmap.PixelWidth, expectedBitmap.PixelHeight, expectedBitmap.DpiX,
                    expectedBitmap.DpiY, expectedBitmap.Format, expectedBitmap.Palette);
                diffBmp.WritePixels(new Int32Rect(0, 0, expectedBitmap.PixelWidth, expectedBitmap.PixelHeight), byteDiff,
                    expectedBitmap.BackBufferStride, 0);

                string diffPath = Path.Combine(ExportActualPath, Path.GetFileNameWithoutExtension(resourceName) + "-diff.png");

                SaveToPng(diffPath, diffBmp);
                Console.WriteLine(@"Difference bitmap saved to " + diffPath);
            }
        }

19 View Source File : FileSystemUserData.cs
License : MIT License
Project Creator : 0x0ade

public override void CopyTo(UserData other) {
            using UserDataBatchContext batch = other.OpenBatch();
            lock (GlobalLock) {
                Global global = LoadRaw<Global>(GlobalPath);

                Dictionary<string, Type?> types = new();
                replacedembly[] asms = AppDomain.CurrentDomain.Getreplacedemblies();

                foreach (string uid in GetAll()) {
                    PrivateUserInfo info = Load<PrivateUserInfo>(uid);
                    other.Insert(uid, info.Key, info.KeyFull, !info.KeyFull.IsNullOrEmpty());

                    foreach (string path in Directory.GetFiles(Path.Combine(UserRoot, uid))) {
                        string name = Path.GetFileNameWithoutExtension(path);
                        if (name == typeof(PrivateUserInfo).FullName)
                            continue;

                        if (!types.TryGetValue(name, out Type? type)) {
                            foreach (replacedembly asm in asms)
                                if ((type = asm.GetType(name)) != null)
                                    break;
                            types[name] = type;
                        }

                        using Stream stream = File.OpenRead(path);
                        other.InsertData(uid, name, type, stream);
                    }

                    string dir = Path.Combine(UserRoot, uid, "data");
                    if (Directory.Exists(dir)) {
                        foreach (string path in Directory.GetFiles(dir)) {
                            string name = Path.GetFileName(path);
                            using Stream stream = File.OpenRead(path);
                            other.InsertFile(uid, name, stream);
                        }
                    }
                }
            }
        }

19 View Source File : BasicFileCacheManager.cs
License : Apache License 2.0
Project Creator : acarteas

public override string GetCachePath(string FileName, string regionName = null)
        {
            if (regionName == null)
            {
                regionName = "";
            }
            string directory = Path.Combine(CacheDir, CacheSubFolder, regionName);
            string filePath = Path.Combine(directory, Path.GetFileNameWithoutExtension(FileName) + ".dat");
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            return filePath;
        }

19 View Source File : TestAmf0Reader.cs
License : MIT License
Project Creator : a1q123456

[TestMethod]
        public void TestReadString()
        {
            var reader = new Amf0Reader();

            var files = Directory.GetFiles("../../../../samples/amf0/string");

            foreach (var file in files)
            {
                var value = Path.GetFileNameWithoutExtension(file);
                using (var f = new FileStream(file, FileMode.Open))
                {
                    var data = new byte[f.Length];
                    f.Read(data);
                    replacedert.IsTrue(reader.TryGetString(data, out var dataRead, out var consumed));
                    replacedert.AreEqual(dataRead, value);
                    replacedert.AreEqual(consumed, f.Length);
                }
            }
        }

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

public static void Draw(object obj, int indentLevel)
        {
            EditorGUILayout.BeginVertical();
            EditorGUI.indentLevel = indentLevel;
            string replacedemblyName = string.Empty;
            switch (Path.GetFileNameWithoutExtension(obj.GetType().replacedembly.ManifestModule.Name))
            {
                case "Unity.Model":
                    replacedemblyName = "Unity.Model";
                    break;
                case "Unity.Hotfix":
                    replacedemblyName = "Unity.Hotfix";
                    break;
                case "ILRuntime":
                    replacedemblyName = "Unity.Hotfix";
                    break;
            }
            if (replacedemblyName == "Unity.Model")
            {
                FieldInfo[] fieldInfos = obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
                foreach (FieldInfo item in fieldInfos)
                {
                    object value = item.GetValue(obj);
                    Type type = item.FieldType;
                    if (item.IsDefined(typeof(HideInInspector), false))
                    {
                        continue;
                    }
                    if (type.IsDefined(typeof(HideInInspector), false))
                    {
                        continue;
                    }
                    if (objectObjectTypes.ContainsKey((obj, item)))
                    {
                        ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(obj, item)];
                        objectObjectType.Draw(type, item.Name, value, null, indentLevel);
                        continue;
                    }
                    if ((item.IsDefined(typeof(SerializeField), false) || type.IsDefined(typeof(SerializeField), false)) && type.replacedembly.ManifestModule.Name == "Unity.Model.dll")
                    {
                        ObjectObjectType objectObjectType = new ObjectObjectType();
                        if (value == null)
                        {
                            object instance = Activator.CreateInstance(type);
                            objectObjectType.Draw(type, item.Name, instance, null, indentLevel);
                            item.SetValue(obj, instance);
                        }
                        else
                        {
                            objectObjectType.Draw(type, item.Name, value, null, indentLevel);
                        }
                        objectObjectTypes.Add((obj, item), objectObjectType);
                        continue;
                    }
                    if (listObjectTypes.ContainsKey((obj, item)))
                    {
                        ListObjectType listObjectType = (ListObjectType)listObjectTypes[(obj, item)];
                        listObjectType.Draw(type, item.Name, value, null, indentLevel);
                        continue;
                    }
                    if (type.GetInterface("IList") != null)
                    {
                        ListObjectType listObjectType = new ListObjectType();
                        if (value == null)
                        {
                            continue;
                        }
                        listObjectType.Draw(type, item.Name, value, null, indentLevel);
                        listObjectTypes.Add((obj, item), listObjectType);
                        continue;
                    }
                    foreach (IObjectType objectTypeItem in objectList)
                    {
                        if (!objectTypeItem.IsType(type))
                        {
                            continue;
                        }
                        string fieldName = item.Name;
                        if (fieldName.Contains("clrInstance") || fieldName.Contains("Boxed"))
                        {
                            continue;
                        }
                        if (fieldName.Length > 17 && fieldName.Contains("k__BackingField"))
                        {
                            fieldName = fieldName.Substring(1, fieldName.Length - 17);
                        }
                        value = objectTypeItem.Draw(type, fieldName, value, null);
                        item.SetValue(obj, value);
                    }
                }
            }
            else
            {
#if ILRuntime
                FieldInfo[] fieldInfos = ILRuntimeManager.Instance.appdomain.LoadedTypes[obj.ToString()].ReflectionType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
                foreach (FieldInfo item in fieldInfos)
                {
                    object value = item.GetValue(obj);
                    if (item.FieldType is ILRuntimeWrapperType)
                    {
                        //基础类型绘制
                        Type type = ((ILRuntimeWrapperType)item.FieldType).RealType;
                        if (item.IsDefined(typeof(HideInInspector), false))
                        {
                            continue;
                        }
                        if (type.IsDefined(typeof(HideInInspector), false))
                        {
                            continue;
                        }
                        if (listObjectTypes.ContainsKey((obj, item)))
                        {
                            ListObjectType listObjectType = (ListObjectType)listObjectTypes[(obj, item)];
                            listObjectType.Draw(type, item.Name, value, null, indentLevel);
                            continue;
                        }
                        if (type.GetInterface("IList") != null)
                        {
                            ListObjectType listObjectType = new ListObjectType();
                            if (value == null)
                            {
                                continue;
                            }
                            listObjectType.Draw(type, item.Name, value, null, indentLevel);
                            listObjectTypes.Add((obj, item), listObjectType);
                            continue;
                        }
                        foreach (IObjectType objectTypeItem in objectList)
                        {
                            if (!objectTypeItem.IsType(type))
                            {
                                continue;
                            }
                            string fieldName = item.Name;
                            if (fieldName.Contains("clrInstance") || fieldName.Contains("Boxed"))
                            {
                                continue;
                            }
                            if (fieldName.Length > 17 && fieldName.Contains("k__BackingField"))
                            {
                                fieldName = fieldName.Substring(1, fieldName.Length - 17);
                            }
                            value = objectTypeItem.Draw(type, fieldName, value, null);
                            item.SetValue(obj, value);
                        }
                    }
                    else
                    {
                        //自定义类型绘制
                        Type type = item.FieldType;
                        if (item.IsDefined(typeof(HideInInspector), false))
                        {
                            continue;
                        }
                        if (type.IsDefined(typeof(HideInInspector), false))
                        {
                            continue;
                        }
                        if (objectObjectTypes.ContainsKey((obj, item)))
                        {
                            ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(obj, item)];
                            objectObjectType.Draw(type, item.Name, value, null, indentLevel);
                            continue;
                        }
                        if ((item.IsDefined(typeof(SerializeField), false) || type.IsDefined(typeof(SerializeField), false)) && type.replacedembly.ManifestModule.Name == "ILRuntime.dll")
                        {
                            ObjectObjectType objectObjectType = new ObjectObjectType();
                            if (value == null)
                            {
                                object instance = ILRuntimeManager.Instance.appdomain.Instantiate(type.ToString());
                                objectObjectType.Draw(type, item.Name, instance, null, indentLevel);
                                item.SetValue(obj, instance);
                            }
                            else
                            {
                                objectObjectType.Draw(type, item.Name, value, null, indentLevel);
                            }
                            objectObjectTypes.Add((obj, item), objectObjectType);
                            continue;
                        }
                    }
                }
#else
                FieldInfo[] fieldInfos = obj.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
                foreach (FieldInfo item in fieldInfos)
                {
                    object value = item.GetValue(obj);
                    Type type = item.FieldType;
                    if (item.IsDefined(typeof(HideInInspector), false))
                    {
                        continue;
                    }
                    if (type.IsDefined(typeof(HideInInspector), false))
                    {
                        continue;
                    }
                    if (objectObjectTypes.ContainsKey((obj, item)))
                    {
                        ObjectObjectType objectObjectType = (ObjectObjectType)objectObjectTypes[(obj, item)];
                        objectObjectType.Draw(type, item.Name, value, null, indentLevel);
                        continue;
                    }
                    if ((item.IsDefined(typeof(SerializeField), false) || type.IsDefined(typeof(SerializeField), false)) && type.replacedembly.ManifestModule.Name == "Unity.Hotfix.dll")
                    {
                        ObjectObjectType objectObjectType = new ObjectObjectType();
                        if (value == null)
                        {
                            object instance = Activator.CreateInstance(type);
                            objectObjectType.Draw(type, item.Name, instance, null, indentLevel);
                            item.SetValue(obj, instance);
                        }
                        else
                        {
                            objectObjectType.Draw(type, item.Name, value, null, indentLevel);
                        }
                        objectObjectTypes.Add((obj, item), objectObjectType);
                        continue;
                    }
                    if (listObjectTypes.ContainsKey((obj, item)))
                    {
                        ListObjectType listObjectType = (ListObjectType)listObjectTypes[(obj, item)];
                        listObjectType.Draw(type, item.Name, value, null, indentLevel);
                        continue;
                    }
                    if (type.GetInterface("IList") != null)
                    {
                        ListObjectType listObjectType = new ListObjectType();
                        if (value == null)
                        {
                            continue;
                        }
                        listObjectType.Draw(type, item.Name, value, null, indentLevel);
                        listObjectTypes.Add((obj, item), listObjectType);
                        continue;
                    }
                    foreach (IObjectType objectTypeItem in objectList)
                    {
                        if (!objectTypeItem.IsType(type))
                        {
                            continue;
                        }
                        string fieldName = item.Name;
                        if (fieldName.Contains("clrInstance") || fieldName.Contains("Boxed"))
                        {
                            continue;
                        }
                        if (fieldName.Length > 17 && fieldName.Contains("k__BackingField"))
                        {
                            fieldName = fieldName.Substring(1, fieldName.Length - 17);
                        }
                        value = objectTypeItem.Draw(type, fieldName, value, null);
                        item.SetValue(obj, value);
                    }
                }
#endif
                EditorGUI.indentLevel = indentLevel;
                EditorGUILayout.EndVertical();
            }
        }

19 View Source File : EdisFace.cs
License : MIT License
Project Creator : 0ffffffffh

private void RequestHandler(IAsyncResult result)
        {
            Dictionary<string, string> form;

            string objectName,path;
            HttpListenerContext ctx;

            if (!this.httpListener.IsListening)
                return;

            try
            {
                ctx = this.httpListener.EndGetContext(result);
            }
            catch (Exception e)
            {
                Log.Error("request completion error: " + e.Message);
                RegisterRequestWaiter(null);
                return;
            }

            form = BuildForm(ctx);

            objectName = ctx.Request.Url.LocalPath;

            var ext = Path.GetExtension(objectName);
            objectName = Path.GetFileNameWithoutExtension(objectName);

            objectName = objectName.
                Replace(".", "").
                Replace("/","").
                Replace("\\","");

            if (string.IsNullOrEmpty(objectName))
                objectName = "\\";
            else
                objectName = "\\" + objectName + ext;

            path = Config.Get().HtmlContentRoot + objectName;
            
            RegisterRequestWaiter(null);

            if (objectName == "\\")
            {
                if (ctx.Request.HttpMethod.ToLower() == "post")
                {
                    HandlePost(ctx, form);
                }
                else
                    ReplyIndex(ctx, string.Empty);
            }
            else
            {
                ReplyWithFile(ctx, path);
            }
            
            ctx.Response.Close();
        }

19 View Source File : CommandLineParser.cs
License : MIT License
Project Creator : 0xd4d

public static void ShowHelp() {
			var exe = Path.GetFileNameWithoutExtension(replacedembly.GetEntryreplacedembly()!.Location);
			var msg = [email protected]"Disreplacedembles jitted methods in .NET processes

-p, --pid <pid>                 Process id
-pn, --process <name>           Process name
-m, --module <name>             Name of module to disreplacedemble
-l, --load <module>             Load module (for execution) into this process and jit every method
--no-run-cctor                  Don't run all .cctors before jitting methods (used with -l)
--filename-format <fmt>         Filename format. <fmt>:
    name            => (default) member name
    tokname         => token + member name
    token           => token
-f, --file <kind>               Output file. <kind>:
    stdout          => (default) stdout
    file            => One file, use -o to set filename
    type            => One file per type, use -o to set directory
    method          => One file per method, use -o to set directory
-d, --disasm <kind>            Disreplacedembler. <kind>:
    masm            => (default) MASM syntax
    nasm            => NASM syntax
    gas             => GNU replacedembler (AT&T) syntax
    att             => same as gas
    intel           => Intel (XED) syntax
-o, --output <path>             Output filename or directory
--type <tok-or-name>            Disreplacedemble this type (wildcards supported) or type token
--type-exclude <tok-or-name>    Don't disreplacedemble this type (wildcards supported) or type token
--method <tok-or-name>          Disreplacedemble this method (wildcards supported) or method token
--method-exclude <tok-or-name>  Don't disreplacedemble this method (wildcards supported) or method token
--diffable                      Create diffable disreplacedembly
--no-addr                       Don't show instruction addresses
--no-bytes                      Don't show instruction bytes
--no-source                     Don't show source code
--heap-search                   Check the GC heap for instantiated generic types
-s, --search <path>             Add replacedembly search paths (used with -l), {Path.PathSeparator}-delimited
-h, --help                      Show this help message

<tok-or-name> can be semicolon separated or multiple options can be used. Names support wildcards.
Token ranges are also supported eg. 0x06000001-0x06001234.

Generic methods and methods in generic types aren't 100% supported. Try --heap-search.

Examples:
    {exe} -m MyModule -pn myexe -f type -o c:\out\dir --method Decode
    {exe} -p 1234 -m System.Private.CoreLib -o C:\out\dir --diffable -f type
    {exe} -l c:\path\to\mymodule.dll
";
			Console.Write(msg);
		}

19 View Source File : DiscordRPforVSPackage.cs
License : GNU Affero General Public License v3.0
Project Creator : 1thenikita

public async System.Threading.Tasks.Task UpdatePresenceAsync(Doreplacedent doreplacedent, Boolean overrideTimestampReset = false)
        {
            try
            {
                await this.JoinableTaskFactory.SwitchToMainThreadAsync();

                if (!Settings.enabled)
                {
                    if (!this.Discord.IsInitialized && !this.Discord.IsDisposed)
                        if (!this.Discord.Initialize())
                            ActivityLog.LogError("DiscordRPforVS", $"{Translates.LogError(Settings.Default.translates)}");

                    this.Discord.ClearPresence();
                    return;
                }

                this.Presence.Details = this.Presence.State = this.replacedets.LargeImageKey = this.replacedets.LargeImageText = this.replacedets.SmallImageKey = this.replacedets.SmallImageText = String.Empty;

                if (Settings.secretMode)
                {
                    this.Presence.Details = Translates.PresenceDetails(Settings.Default.translates);
                    this.Presence.State = Translates.PresenceState(Settings.Default.translates);
                    this.replacedets.LargeImageKey = this.versionImageKey;
                    this.replacedets.LargeImageText = this.versionString;
                    this.replacedets.SmallImageKey = this.replacedets.SmallImageText = "";
                    goto finish;
                }

                this.Presence.Details = this.Presence.State = "";
                String[] language = Array.Empty<String>();

                if (doreplacedent != null)
                {
                    String filename = Path.GetFileName(path: doreplacedent.FullName).ToUpperInvariant(), ext = Path.GetExtension(filename);
                    List<KeyValuePair<String[], String[]>> list = Constants.Languages.Where(lang => Array.IndexOf(lang.Key, filename) > -1 || Array.IndexOf(lang.Key, ext) > -1).ToList();
                    language = list.Count > 0 ? list[0].Value : Array.Empty<String>();
                }

                Boolean supported = language.Length > 0;
                this.replacedets.LargeImageKey = Settings.largeLanguage ? supported ? language[0] : "text" : this.versionImageKey;
                this.replacedets.LargeImageText = Settings.largeLanguage ? supported ? language[1] + " " + Translates.File(Settings.Default.translates) : Translates.UnrecognizedExtension(Settings.Default.translates) : this.versionString;
                this.replacedets.SmallImageKey = Settings.largeLanguage ? this.versionImageKey : supported ? language[0] : "text";
                this.replacedets.SmallImageText = Settings.largeLanguage ? this.versionString : supported ? language[1] + " " + Translates.File(Settings.Default.translates) : Translates.UnrecognizedExtension(Settings.Default.translates);

                if (Settings.showFileName)
                    this.Presence.Details = !(doreplacedent is null) ? Path.GetFileName(doreplacedent.FullName) : Translates.NoFile(Settings.Default.translates);

                if (Settings.showSolutionName)
                {
                    Boolean idling = ide.Solution is null || String.IsNullOrEmpty(ide.Solution.FullName);
                    this.Presence.State = idling ? Translates.Idling(Settings.Default.translates) : $"{Translates.Developing(Settings.Default.translates)} {Path.GetFileNameWithoutExtension(ide.Solution.FileName)}";

                    if (idling)
                    {
                        this.replacedets.LargeImageKey = this.versionImageKey;
                        this.replacedets.LargeImageText = this.versionString;
                        this.replacedets.SmallImageKey = this.replacedets.SmallImageText = "";
                    }
                }

                if (Settings.showTimestamp && doreplacedent != null)
                {
                    if (!this.InitializedTimestamp)
                    {
                        this.InitialTimestamps = this.Presence.Timestamps = new Timestamps() { Start = DateTime.UtcNow };
                        this.InitializedTimestamp = true;
                    }

                    if (Settings.resetTimestamp && !overrideTimestampReset)
                        this.Presence.Timestamps = new Timestamps() { Start = DateTime.UtcNow };
                    else if (Settings.resetTimestamp && overrideTimestampReset)
                        this.Presence.Timestamps = this.CurrentTimestamps;
                    else if (!Settings.resetTimestamp && !overrideTimestampReset)
                        this.Presence.Timestamps = this.InitialTimestamps;

                    this.CurrentTimestamps = this.Presence.Timestamps;
                }

                finish:;
                this.Presence.replacedets = this.replacedets;

                if (!this.Discord.IsInitialized && !this.Discord.IsDisposed)
                    if (!this.Discord.Initialize())
                        ActivityLog.LogError("DiscordRPforVS", Translates.LogError(Settings.Default.translates));

                this.Discord.SetPresence(this.Presence);
            }
            catch (ArgumentException e)
            {
                ActivityLog.LogError(e.Source, e.Message);
            }
        }

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

public static void ExportExcelProtobuf(ConfigType configType)
        {
            string exportPath = PathUtil.GetPath(PathType.DataPath, GetProtobufPath(configType));
            string clreplacedPath = PathUtil.GetPath(PathType.DataPath, GetClreplacedPath(configType));
            string jsonPath = PathUtil.GetPath(PathType.DataPath, GetJsonPath(configType));
            List<string> protoNameList = new List<string>();
            foreach (string item in Directory.GetFiles(clreplacedPath, "*.cs"))
            {
                protoNameList.Add(Path.GetFileNameWithoutExtension(item));
            }
            foreach (string item in protoNameList)
            {
                string json = FileUtil.Getreplacedet($"{jsonPath}/{item}.txt").GetString();
                object obj;
                if (configType == ConfigType.Model)
                {
                    obj = JsonUtil.ToObject(typeof(Manager).replacedembly.GetType($"{typeof(Manager).Namespace}.{item}Category"), json);
                }
                else
                {
                    obj = JsonUtil.ToObject(typeof(LccHotfix.Manager).replacedembly.GetType($"{typeof(LccHotfix.Manager).Namespace}.{item}Category"), json);
                }
                FileUtil.Savereplacedet($"{exportPath}/{item}Category.bytes", ProtobufUtil.Serialize(obj));
            }
        }

19 View Source File : SelectFm.cs
License : GNU General Public License v3.0
Project Creator : a4004

private async Task ListSoftwareOptions(string option)
        {
            string[] availableFiles = API.GithubManager.GetReleaseNames("spacehuhntech/esp8266_deauther", option);

            if (availableFiles == null || availableFiles.Length < 1)
            {
                MessageBox.Show("The version you selected does not have any precompiled binaries available for it, to use this version you will" +
                    " need to build the software from source and flash it as a local image from this PC.", "No Files Available", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                return;
            }

            foreach (string file in availableFiles)
            {
                try
                {
                    string type = Path.GetExtension(file).Replace(".", "").ToUpper();

                    Invoke(new Action(() =>
                    {
                        listView.Items.Add(new ListViewItem(new string[] { "SpacehuhnTech", Path.GetFileNameWithoutExtension(file), type}));
                    }));                
                }
                catch (Exception e)
                {
                    Program.Debug("selectfm", $"Failed to parse filename: {file}, error: {e.Message}", Event.Critical);
                    await Task.Delay(100);
                }
            }
        }

See More Examples