public override int GetHashCode() { int hash = 1; if (ItemLotId != 0) { hash ^= ItemLotId.GetHashCode(); } if (ItemLotGroupId != 0) { hash ^= ItemLotGroupId.GetHashCode(); } if (TrainerId != 0L) { hash ^= TrainerId.GetHashCode(); } if (U4 != 0) { hash ^= U4.GetHashCode(); } if (LuaPath.Length != 0) { hash ^= LuaPath.GetHashCode(); } if (ItemLotItemId != 0) { hash ^= ItemLotItemId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private async Task DownLoadSelectedPath() { IsUpdating = true; try { if (!string.IsNullOrEmpty(LuaPath)) { if (RegExpressions.LuaRawPathRegex.Value.IsMatch(LuaPath) || RegExpressions.LuaPathRegex.Value.IsMatch(LuaPath)) { var fileName = Path.GetFileNameWithoutExtension(LuaPath); var scriptConfig = ScriptsData.FirstOrDefault(x => x.ScriptName == fileName); //if (scriptConfig != null && (File.Exists($@"scripts\{fileName}.lua") || File.Exists($@"scripts\{fileName}.bak"))) //{ // scriptConfig.ScriptPath = LuaPath; // UpdateScriptConfig(); // return; //} if ((LuaPath.StartsWith("http://github") || LuaPath.StartsWith("https://github")) && LuaPath.Contains("blob")) { LuaPath = LuaPath.Replace("http://github", "https://raw.githubusercontent"); LuaPath = LuaPath.Replace("https://github", "http://raw.githubusercontent"); LuaPath = LuaPath.Replace("blob/", ""); } LuaPath = LuaPath.Replace("https", "http"); fileWatcher.EnableRaisingEvents = false; var isEnabled = true; if (scriptConfig != null && !scriptConfig.IsEnabled) { isEnabled = false; } try { await DownLoadScript(LuaPath, isEnabled); } catch (WebException) { //if (scriptConfig != null) //{ // ScriptsData.Remove(scriptConfig); // if (File.Exists(scriptConfig.ScriptLocalPath)) // { // File.Delete(scriptConfig.ScriptLocalPath); // } //} } UpdateScriptConfig(); fileWatcher.EnableRaisingEvents = true; } else { if (LuaPath.Contains("tree/master")) { DotaViewModel.GameBrowserVm.MainViewModel.ShowError(Properties.Resources.IncorrectLuaPath); return; } if (LuaPath.StartsWith("http://github") || LuaPath.StartsWith("https://github")) { LuaPath = LuaPath.Replace("https", "http"); fileWatcher.EnableRaisingEvents = false; var scriptConfig = ScriptsData.FirstOrDefault(x => x.RepositoryPath == LuaPath); try { await DownLoadRepository(LuaPath); } catch (WebException) { if (scriptConfig != null) { ScriptsData.Remove(scriptConfig); if (File.Exists(MainViewModel.AssemblyPath + scriptConfig.ScriptLocalPath)) { File.Delete(MainViewModel.AssemblyPath + scriptConfig.ScriptLocalPath); } } } var zipPath = $@"{scriptDir}\master.zip"; if (File.Exists(zipPath)) { File.Delete(zipPath); } UpdateScriptConfig(); fileWatcher.EnableRaisingEvents = true; } } } } catch (Exception ex) { DotaViewModel.GameBrowserVm.MainViewModel.ShowError(ex.Message); Log.Error(ex, "null"); } finally { IsUpdating = false; fileWatcher.EnableRaisingEvents = true; } }