public void Execute() { //Статус выполнения чтения данных _status = LoadStatus.ReadingData; try { if (_dataFileName == string.Empty) { Console.WriteLine("Имя файла не указано"); throw new Exception("Имя файла не указано"); } if (!(File.Exists(@"C:\Users\Ram\Desktop\КАИ\Конструирование ПО\" + _dataFileName))) { Console.WriteLine("Файла не существует"); throw new Exception("Файла " + _dataFileName + " не существует!"); } //Создание нового списка _carsList = new List <Car>(); //Чтение данных StreamReader sr = null; using (sr = new StreamReader(@"C:\Users\Ram\Desktop\КАИ\Конструирование ПО\" + _dataFileName)) { while (!sr.EndOfStream) { //Прочитать очередную строку string str = sr.ReadLine(); //Console.WriteLine(str); string[] arr = str.Split('|'); //Создать новый объект Car car = new Car() { Mark = arr[0], Model = arr[1], Price = arr[2] }; _carsList.Add(car); } } //Статус чтения данных успешно _status = LoadStatus.Succes; } catch (Exception ex) { _status = LoadStatus.ReadingError; Console.WriteLine("ExecuteError"); LogUtility.ErrorLog(ex); } }
private IEnumerator TransitionStateRoutine <TV>(TV gameStatePrefab, Action <TV> initializeState = null, Action onStateLoaded = null) where TV : GameState { PartyParrotManager.Instance.LoadingManager.ShowLoadingScreen(true); IEnumerator exitRunner = ExitCurrentStateRoutine(); while (exitRunner.MoveNext()) { yield return(null); } // TODO: this should enable the state from the set rather than allocating TV gameState = Instantiate(gameStatePrefab, transform); initializeState?.Invoke(gameState); PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(0.0f, "Loading scene..."); yield return(null); IEnumerator <float> runner = gameState.LoadSceneRoutine(); while (runner.MoveNext()) { PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(runner.Current * 0.5f, "Loading scene..."); yield return(null); } PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(0.5f, "Scene loaded!"); yield return(null); _currentGameState = gameState; IEnumerator <LoadStatus> enterRunner = _currentGameState.OnEnterRoutine(); while (enterRunner.MoveNext()) { LoadStatus status = enterRunner.Current; if (null != status) { PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(0.5f + status.LoadPercent * 0.5f, status.Status); } yield return(null); } PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(1.0f, "Done!"); yield return(null); PartyParrotManager.Instance.LoadingManager.ShowLoadingScreen(false); onStateLoaded?.Invoke(); }
private IEnumerator ExitCurrentStateRoutine() { while (null != _currentSubGameState || _subStateStack.Count > 0) { PopSubState(); } if (null == _currentGameState) { yield break; } _currentGameState.OnExit(); GameState gameState = _currentGameState; _currentGameState = null; PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(0.0f, "Unloading current scene..."); yield return(null); IEnumerator <float> runner = gameState.UnloadSceneRoutine(); while (runner.MoveNext()) { PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(runner.Current * 0.5f, "Unloading current scene..."); yield return(null); } PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(0.5f, "Unloading current scene..."); yield return(null); IEnumerator <LoadStatus> exitRunner = gameState.OnExitRoutine(); while (exitRunner.MoveNext()) { LoadStatus status = exitRunner.Current; if (null != status) { PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(0.5f + status.LoadPercent * 0.5f, status.Status); } yield return(null); } PartyParrotManager.Instance.LoadingManager.UpdateLoadingScreen(1.0f, "Current scene unloaded!"); yield return(null); // TODO: disable the state, don't destroy it Destroy(gameState.gameObject); }
public bool CancelLoading() { if (loadStatus == LoadStatus.Loading) { StopCoroutine(_coroutine); loadStatus = LoadStatus.Cancelled; return(true); } else { return(false); } }
public void Execute() { try { _status = LoadStatus.None; if (_filePath == "") { _status = LoadStatus.FileNameIsEmpty; throw new Exception("Неправильные входные параметры"); } if (!File.Exists(_filePath)) { _status = LoadStatus.FileNotExists; throw new Exception("Файл не существует"); } StreamReader sr = null; using (sr = new StreamReader(_filePath)) { while (!sr.EndOfStream) { string str = sr.ReadLine(); try { string[] arr = str.Split('|'); SemiConductor semiconductor = new SemiConductor { Substance_name = arr[0], ForbiddenZone_width = float.Parse(arr[1]) /*(float)0.15*/, Electron_move = int.Parse(arr[2]), Hole_move = int.Parse(arr[3]) }; _semiconductorList.Add(semiconductor); } catch (Exception ex) { _status = LoadStatus.GeneralError; LogUtility.ErrorLog(ex); } } } } catch (Exception ex) { LogUtility.ErrorLog(ex); } _status = LoadStatus.Success; }
/// <summary> /// Constructor /// </summary> public SplashScreen() { InitializeComponent(); CurrentState = State.DirectoryCheck; CurrentStatus = CheckStatus.Checking; CurrentAppStatus = LoadStatus.Loading; errorList = new List <string>(); AccessUtils.AppDirectoryPath = Configuration.AppDir; AccessUtils.DatabasePath = Configuration.DbPath; AccessUtils.AI = new AccessInfo { FileName = Configuration.DbPath }; }
public void OnCompletion(Exception optionalException) { if (optionalException != null) { LoadStatus = Controls.LoadStatus.Failed; } // else: could consider setting loaded, too... else if (IsLoadComplete == false) { //LoadStatus = Controls.LoadStatus.Loaded; // GIC probably! System.Diagnostics.Debug.WriteLine("Warning: this object should have perhaps manually set its bit... unless it's a delaying object."); // hmm should it have been set? } }
public void Load() { if (IsGhost) { status = LoadStatus.LOADING; var customer = load(); base.Name = customer.Name; base.ShippingAddress = customer.ShippingAddress; base.City = customer.City; base.PostalCode = customer.PostalCode; base.Country = customer.Country; } }
private void loadDta() { if (s == LoadStatus.GHOST) { s = LoadStatus.LOADING; var customer = load(); base.Name = customer.Name; base.ShippingAddress = customer.ShippingAddress; base.City = customer.City; base.PostalCode = customer.PostalCode; base.Country = customer.Country; s = LoadStatus.LOADED; } }
public void Execute() { _status = LoadStatus.None; if (_dataFileName == null) { _status = LoadStatus.FileNameIsEmpty; throw new Exception("Имя файла не задано"); } if (!File.Exists(Path.GetFullPath(_dataFileName))) { _status = LoadStatus.FileNotExists; throw new Exception("Файл не существует "); } StreamReader reader = null; _substances = new List <Substance>(); using (reader = new StreamReader(_dataFileName)) { while (!reader.EndOfStream) { try { string str = reader.ReadLine(); string[] array = str.Split('|'); Console.WriteLine(array[2]); _substances.Add(new Substance() { name = array[0], type = Convert.ToChar(array[1]), lowTemperature = (float)Convert.ToDouble(array[2]), highTemperature = (float)Convert.ToDouble(array[3]) }); } catch (Exception ex) { LogUtility.ErrorLog(ex.Message); _status = LoadStatus.GeneralError; var alert = new NSAlert(); alert.InformativeText = ex.Message; alert.MessageText = "Произошла ошибка"; alert.RunModal(); } } if (_status != LoadStatus.GeneralError) { _status = LoadStatus.Success; } } }
/// <summary> /// A timer used to check the current status of the applicaiton load. /// </summary> /// <param name="sender">The timer</param> /// <param name="e">the tick event</param> private void timer1_Tick(object sender, EventArgs e) { if (runningThread == false && CurrentAppStatus != LoadStatus.Complete) { runningThread = true; if (CurrentState == State.DirectoryCheck) { new Thread(() => { CheckApplicationFolderStructure(); }).Start(); } else if (CurrentState == State.FileCheck) { new Thread(() => { CheckApplicationFiles(); }).Start(); } else if (CurrentState == State.DatabaseCheck) { new Thread(() => { CheckDatabase(); }).Start(); } } else { if (CurrentStatus == CheckStatus.Complete) { if (CurrentState == State.DatabaseCheck) { CurrentAppStatus = LoadStatus.Complete; Thread thrd = new Thread(() => { loadMainThread(); }); thrd.SetApartmentState(ApartmentState.STA); Hide(); timer1.Stop(); thrd.Start(); thrd.Join(); // Wait here on this thread until the application is closed. Application.Exit(); // Close the splash screen (main thread) } else { runningThread = false; CurrentStatus = CheckStatus.Checking; CurrentState++; } } } }
public void LoadDatabase(string _RealmPath, DateTime?_HistoryEarliestDateTime = null) { lock (m_LockObj) { if (m_LoadStatus == LoadStatus.EverythingLoaded) { m_LoadStatus = LoadStatus.CurrentlyLoading; } else { return; } } m_LoaderThread = new System.Threading.Thread(() => Thread_LoadDatabase(_RealmPath, _HistoryEarliestDateTime)); m_LoaderThread.Start(); }
private IEnumerator BeginInitialize() { if (mStatus == LoadStatus.Done) { yield break; } else if (mStatus == LoadStatus.Loading) { yield return(new WaitUntil(() => mStatus >= LoadStatus.Done)); } else { mStatus = LoadStatus.Loading; //初始化资源列表 yield return(AssetPath.Initialize()); if (AssetPath.status == LoadStatus.Done) { if (AssetPath.mode == AssetMode.AssetBundle) { if (string.IsNullOrEmpty(AssetPath.list.manifest)) { mStatus = LoadStatus.Error; Debug.LogError("AssetPath.list.manifest is null !!!"); } else { BundleAsset bundle = GetOrCreateBundle <BundleAsset>(AssetPath.list.manifest); AssetLoadTask <AssetBundleManifest> task = new AssetLoadTask <AssetBundleManifest>(AssetPath.list.manifest, FinishInitialize); task.assetName = "AssetBundleManifest"; yield return(bundle.LoadAssetAsync(task)); } } else { FinishInitialize(null); } } else { mStatus = LoadStatus.Error; } } }
public void Execute() { try { { Accessory accessory = new Accessory() { name = "RT-11-24", type = "R", value = "100000", quantity = "12" }; accessoryList.Add(accessory); } { Accessory accessory = new Accessory() { name = "RT-11-24", type = "R", value = "50000", quantity = "10" }; accessoryList.Add(accessory); } { Accessory accessory = new Accessory() { name = "CGU-12K", type = "C", value = "17.5", quantity = "3" }; accessoryList.Add(accessory); } } catch (Exception ex) { LogUtility.ErrorLog(ex); } _status = LoadStatus.Success; }
public void Execute() { _status = LoadStatus.Reading; if (_dataFileName == "") { _status = LoadStatus.FileNameIsEmpty; onStatusChangedDelegate?.Invoke(_status); throw new Exception("Имя файла отсутствует"); } if (!File.Exists(_dataFileName)) { _status = LoadStatus.FileNotExists; onStatusChangedDelegate?.Invoke(_status); throw new FileNotFoundException(); } StreamReader sr = null; using (sr = new StreamReader(_dataFileName)) { while (!sr.EndOfStream) { try { string str = sr.ReadLine(); string[] arr = str.Split('|'); SearchProject newSearchProject = new SearchProject() { year = arr[0], director = arr[1], diamAntenna = Convert.ToInt32(arr[2]), frequency = Convert.ToInt32(arr[3]) }; _searchProjectList.Add(newSearchProject); } catch (Exception ex) { LogUtility.ErrorLog(ex); _status = LoadStatus.GeneralError; } } } _status = LoadStatus.Success; onStatusChangedDelegate?.Invoke(_status); }
public virtual bool Unload(bool force = false) { if (force == false) { Debug.Log("卸载Bundle:" + bundleName); } AssetLoader.RemoveBundle(this); if (bundle != null) { bundle.Unload(true); bundle = null; } status = LoadStatus.None; return(true); }
private void OnDestroy() { mBundleNameList.Clear(); mBundleNameList.AddRange(mAssetBundleDic.Keys); for (int i = 0; i < mBundleNameList.Count; ++i) { var bundleName = mBundleNameList[i]; if (mAssetBundleDic.TryGetValue(bundleName, out Bundle bundle)) { bundle.Unload(true); } } mBundleNameList.Clear(); mAssetBundleDic.Clear(); mAssetManifest = null; mStatus = LoadStatus.None; }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 8, Configuration.FieldSeparator), Id, LotNumber?.ToDelimitedString(), DeviceNumber?.ToDelimitedString(), DeviceName, DeviceDataState?.ToDelimitedString(), LoadStatus?.ToDelimitedString(), ControlCode.HasValue ? ControlCode.Value.ToString(Consts.NumericFormat, culture) : null, OperatorName ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public LoadStatus Load(string filename) { if (!File.Exists(filename)) { return(LoadStatus.FileDoesNotExists); } string[] lines = File.ReadAllLines(filename); if (lines.Length == 0) { scanmsg.Report("file is empty [" + filename + "]"); return(LoadStatus.FileIsEmpty); } //bool blank = File.ReadAllText( filename ).Last() == '\n'; uint number = 0; bool multi = false; //string last = ""; foreach (string fline in lines) { number++; string line = fline.Replace("\t", " "); LoadStatus status = LoadStatus.OK; string report = ""; if (!LoadLine(line, ref multi, ref status, ref report)) { scanmsg.Report(line); scanmsg.Report(report + " [" + filename + ":" + number + "]"); } //last = line; } //if( !blank ) //{ // scanmsg.Report( last ); // scanmsg.Report( new string( '-', last.Length ) + "^ blank line required [" + filename + ":" + number + "]" ); //} return(LoadStatus.OK); }
/// 値の設定 // @param x X座標 // @param y Y座標 // @param v 設定する値 public void Set(int x, int y, LoadStatus v) { if (IsOutOfRange(x, y)) { // 領域外を指定した return; } if (CommonFunction.IsNull(_values[y * Width + x]) == false) { _values[y * Width + x].Clear(); _values[y * Width + x].State = v; } else { _values[y * Width + x] = new DungeonUnitInfo(v); } }
public void Execute() { var filename = GlobalAppSettings.DataFileName; if (filename == null) { Status = LoadStatus.FileNameIsEmpty; throw new ArgumentException("Не указан путь к файлу для загрузки"); } if (!File.Exists(filename)) { Status = LoadStatus.FileNotExists; throw new ArgumentException("Указанный файл не существует"); } try { var lines = File.ReadAllLines(filename); Systems.Clear(); foreach (var line in lines) { var arr = line.Split('|'); var item = new InformationSystem { OperationSystem = arr[0], Database = arr[1], RamAmount = int.Parse(arr[2]), MemoryAmount = int.Parse(arr[3]), Cost = int.Parse(arr[4]) }; Systems.Add(item); } Status = LoadStatus.Success; } catch (Exception e) { Status = LoadStatus.GeneralError; Logger.Log(e); throw; } }
private IEnumerator LoadVCSInfoAsync() { string path = LocalPathProtocolHeader + InfoFilePath; using (WWW www = new WWW(path)) { _loadStatus = LoadStatus.Loading; yield return(www); if (!string.IsNullOrEmpty(www.error)) { Debug.LogWarningFormat("{0}->LoadVCSInfoAsync: load vcs info FAILED! [{1}]", GetType().Name, www.error); yield break; } _vcsInfo = JsonUtility.FromJson <CocoVCSInfo> (www.text); _loadStatus = _vcsInfo != null && !string.IsNullOrEmpty(_vcsInfo.CommitId) ? LoadStatus.Loaded : LoadStatus.LoadFailed; } }
public void Execute(OnLoadFileDelegate UpdateProgressBar) { try { if (filePath == "") { loadStatus = LoadStatus.FileNameIsEmpty; throw new Exception("Путь к файлу не указан"); } int sector = int.Parse(Math.Ceiling((double)(100 / File.ReadAllLines(filePath).Length)).ToString()); var file = File.Open(filePath, FileMode.Open, FileAccess.Read); string text; using (var sr = new StreamReader(file)) { int currentProgress = 0; while ((text = sr.ReadLine()) != "") { var enterpriceParts = text.Split('|'); enterpriseList.Add(new Enterprise() { Name = enterpriceParts[0], PropertyType = enterpriceParts[1], LandArea = int.Parse(enterpriceParts[2]), EmployeeQty = int.Parse(enterpriceParts[3]) }); currentProgress += sector; UpdateProgressBar(currentProgress); Thread.Sleep(1000); } } loadStatus = LoadStatus.Success; } catch (FileNotFoundException e) { enterpriseList = null; loadStatus = LoadStatus.FileNotExists; LogUtility.ErrorLog(e); } catch (Exception e) { loadStatus = LoadStatus.GeneralError; LogUtility.ErrorLog(e); } }
public override bool Load(Priority priority, out bool process) { process = this.process; if (loadStatus == LoadStatus.UNLOAD) { process = this.process; Action <UnityEngine.Object> onLoadCallBack = (abObject) => { this.loadStatus = LoadStatus.LOADEND; this.process = true; onLoadFinishCallBack.Invoke(abObject); }; switch (GameSetting.Instance.runType) { case RunType.PATCHER_SA_PS: AssetBundleLoader.LoadAsset(name, assetType, onLoadCallBack); break; case RunType.NOPATCHER_SA: AssetBundleLoader.LoadAsset(name, assetType, onLoadCallBack); break; case RunType.NOPATCHER_RES: ResourcesLoader.LoadAsset(name, assetType, onLoadCallBack); break; } loadStatus = LoadStatus.LOADING; } else if (loadStatus == LoadStatus.LOADING) { process = this.process; } else if (loadStatus == LoadStatus.LOADEND) { process = this.process; } return(true); }
public virtual IEnumerator LoadAsync() { #if UNITY_EDITOR if (AssetPath.mode == AssetMode.Editor) { yield break; } #endif if (status == LoadStatus.Done) { yield break; } else if (status == LoadStatus.Loading) { yield return(new WaitUntil(() => status >= LoadStatus.Done)); } else { string path = AssetPath.GetFullPath(bundleName); AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path); status = LoadStatus.Loading; yield return(request); status = LoadStatus.Done; if (bundle == null) { if (request.isDone && request.assetBundle) { bundle = request.assetBundle; } else { status = LoadStatus.Error; Debug.Log("Can't Load AssetBundle:" + bundleName + " from :" + path + "!!"); } } } }
public static IEnumerator Initialize() { if (status == LoadStatus.Done) { yield break; } else if (status == LoadStatus.Loading) { yield return(new WaitUntil(() => status >= LoadStatus.Done)); } else { string assetFile = GetAssetFile(); #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX //这两个平台用UnityWebRequest加载要加file:// assetFile = string.Format("file://{0}", assetFile); #endif Debug.Log("AssetMode:" + mode.ToString() + " assetFile:" + assetFile); using (UnityWebRequest request = UnityWebRequest.Get(assetFile)) { status = LoadStatus.Loading; UnityWebRequestAsyncOperation operation = request.SendWebRequest(); yield return(operation); if (string.IsNullOrEmpty(request.downloadHandler.text) == false) { list.FromXml(request.downloadHandler.text); status = LoadStatus.Done; } else { status = LoadStatus.Error; Debug.LogError(request.error); } } } }
private void OnLoadingDone(LoadStatus loadStatus) { for (var i = _loadCalls.Count - 1; i > 0; i--) { var loadCall = _loadCalls[i]; if (loadCall.Dependencies.Contains(loadStatus)) { loadCall.Dependencies.Remove(loadStatus); } if (loadCall.LoadStatus == loadStatus) { _loadCalls.RemoveAt(i); } } foreach (var loadCall in _loadCalls.Where(loadCall => loadCall.Dependencies.Contains(loadStatus))) { loadCall.Dependencies.Remove(loadStatus); } }
private void ShowFailureMessage(LoadStatus status, Uri uri) { switch (status) { case LoadStatus.PasswordNeeded: ActionRequired?.Invoke(new InvalidPasswordMessageArgs()); break; case LoadStatus.InvalidData: ActionRequired?.Invoke(new InvalidDataMessageArgs(uri.ToString())); break; case LoadStatus.NotSupported: ActionRequired?.Invoke(new NotSupportedMessageArgs(uri.ToString())); break; case LoadStatus.UnexpectedError: ActionRequired?.Invoke(new UnexpectedErrorMessageArgs(uri.ToString())); break; } }
public static void Initialize() { if (mInstance != null) { return; } if (mStatus == LoadStatus.Loading) { return; } mStatus = LoadStatus.Loading; AssetLoader.LoadAsset <GameObject>("assetprefab.prefab", (asset) => { if (asset != null) { mAsset = asset; mInstance = mAsset.assetObject.GetComponent <AssetPrefab>(); DontDestroyOnLoad(mAsset.assetObject); } mStatus = LoadStatus.Done; }); }
private void _InitializeStaticDb() { lock (this._syncRoot) { if (!this._applicationInstance.UseConnectedDatabase) { string dbFolder = this._applicationInstance.Server.MapPath("~/App_Data"); this.NounIndex = new WordNetDataReader.IndexFile(dbFolder, Common.PartOfSpeech.Noun); this.NounStatus = new LoadStatus(this.NounIndex); this.NounData = new WordNetDataReader.DataFile(dbFolder, Common.PartOfSpeech.Noun); this.VerbIndex = new WordNetDataReader.IndexFile(dbFolder, Common.PartOfSpeech.Verb); this.VerbStatus = new LoadStatus(this.VerbIndex); this.VerbData = new WordNetDataReader.DataFile(dbFolder, Common.PartOfSpeech.Verb); this.AdjectiveIndex = new WordNetDataReader.IndexFile(dbFolder, Common.PartOfSpeech.Adjective); this.AdjectiveStatus = new LoadStatus(this.AdjectiveIndex); this.AdjectiveData = new WordNetDataReader.DataFile(dbFolder, Common.PartOfSpeech.Adjective); this.AdverbIndex = new WordNetDataReader.IndexFile(dbFolder, Common.PartOfSpeech.Adverb); this.AdverbStatus = new LoadStatus(this.AdverbIndex); this.AdverbData = new WordNetDataReader.DataFile(dbFolder, Common.PartOfSpeech.Adverb); } } }
public void MarkLoading() { _status = LoadStatus.Loading; }
public void MarkLoaded() { _status = LoadStatus.Loaded; }