コード例 #1
0
        private void savePicBitmaps()
        {
            string fileName = null;
            Bitmap saveBmp  = null;

            resetNewLibraryName();
            MapData.Notes = notesTextBox.Text;

            MapData.IsMatrix   = false;
            this.UseWaitCursor = true;
            foreach (PhonemeType phoneme in Enum.GetValues(typeof(PhonemeType)))
            {
                try
                {
                    fileName = phoneme.ToString() + ".bmp";
                    DirectoryInfo pictureDirInfo = new DirectoryInfo(PictureDirPath);
                    FileInfo[]    fi             = pictureDirInfo.GetFiles(fileName);

                    foreach (FileInfo file in fi)
                    {
                        fi[0].Delete();
                    }
                }
                catch (Exception e)
                {
                    String errorMsg = "Unable to delete LipSync bitmap " + fileName + " from Module Data Directory";
                    Logging.LogException(NLog.LogLevel.Warn, errorMsg, e);
                }

                try
                {
                    if (_pictureBitmaps.TryGetValue(phoneme.ToString(), out saveBmp))
                    {
                        saveBmp.Save(PictureDirPath + "\\" + fileName);
                        saveBmp.Dispose();
                        saveBmp          = null;
                        MapData.IsMatrix = true;
                    }
                }
                catch (Exception e)
                {
                    String errorMsg = "Unable to save copy of phoneme bitmap to Module Data Directory";
                    Logging.LogException(NLog.LogLevel.Warn, errorMsg, e);
                }
            }
            this.UseWaitCursor = false;
        }
コード例 #2
0
        private void openPicFile(string fileName, string phonemeString = null)
        {
            if (null == phonemeString)
            {
                phonemeString = CurrentPhonemeString;
            }

            try
            {
                Bitmap existingBmp = null;
                Bitmap saveBmp     = new Bitmap(fileName);
                if (_pictureBitmaps.TryGetValue(phonemeString, out existingBmp))
                {
                    _pictureBitmaps[phonemeString].Dispose();
                    _pictureBitmaps[phonemeString] = null;
                }
                _pictureBitmaps[phonemeString] = saveBmp;
            }
            catch (Exception err)
            {
                String errorMsg = "Unable to save copy of phoneme bitmap to Module Data Directory";
                Logging.LogException(NLog.LogLevel.Warn, errorMsg, err);
            }
        }
コード例 #3
0
ファイル: RepoCacheManager.cs プロジェクト: ahs-ckm/DAMBuddy2
        private void VerifyCacheState()
        {
            var repoCacheList = BorrowRepoCacheStates(null);

            try
            {
                for (int i = repoCacheList.Count - 1; i >= 0; i--)
                {
                    var cache = repoCacheList[i];

                    if (!Directory.Exists(cache.Path))
                    {
                        repoCacheList.RemoveAt(i);
                        continue;
                    }


                    if (!cache.CloneCompleted)
                    {
                        if (Directory.Exists(cache.Path))
                        {
                            // git repos sometimes have readonly files, particularly if the clone/pull has been not completed cleanly.
                            try
                            {
                                Utility.MakeAllWritable(cache.Path);
                                Directory.Delete(cache.Path, true);
                            } catch (Exception e)
                            {
                                Logger.LogException(NLog.LogLevel.Warn, $"Prblems when trying to delete cache {cache.Path}.", e);
                            }


                            repoCacheList.RemoveAt(i);
                        }
                    }
                }

                SaveCacheState(repoCacheList);
                return;
            }
            finally
            {
                ReturnRepoCacheState(null);
            }
        }
コード例 #4
0
 public ActionResult Add(Models.Resturant resturant)
 {
     try
     {
         bl.addResturant(resturant);
         //RedirectToAction("GetAll", "Home"); <-- doesn't work!
         Response.Redirect("~/Home/GetAll");
     }
     catch (Exception ex)
     {
         //NLog goes here
         logger.LogException(NLog.LogLevel.Error, "Controller: Function: Update: " + ex.Message, ex);
         return(View());
     }
     return(View());
 }