public MainWindow() { string filePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/TodoList/"; Directory.CreateDirectory(filePath); InitializeComponent(); IFormatter formatter = new BinaryFormatter(); try { Stream inStream = new FileStream(filePath + "todo.info", FileMode.Open, FileAccess.Read); lastFile = (String)formatter.Deserialize(inStream); } catch (Exception) { } if (!String.IsNullOrEmpty(lastFile)) { openFile(lastFile); } else { ph = new ProjectHolder(); projList.DataContext = ph; ph.UpdatePropertyHandlers(); } }
public void Export(ItemsBase itemBase, PixelSet[,] pixelArray) { if (pixelArray == null) { return; } ISaveable saveable = itemBase as ISaveable; ProjectHolder ph = ServiceLocator.Instance.GetService <ProjectHolder>(); string outputFileName = Path.Combine(ph.ProjectPath, saveable.GetFileName); string extension = Path.GetExtension(outputFileName); outputFileName = outputFileName.Replace(extension, string.Empty); int directions = 8; int frames = 4; for (int i = 0; i < directions; i++) { for (int j = 0; j < frames; j++) { Bitmap image = CreateImage(pixelArray[i, j]); string filename = $"{outputFileName}_{i}_{j}.png"; image.Save(filename); } } }
public ActionResult DeleteConfirmed(int id) { ProjectHolder projectHolder = db.ProjectHolders.Find(id); db.ProjectHolders.Remove(projectHolder); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,ProjectDescription,Screenshot,LinkToRepository,LanguagesUsed")] ProjectHolder projectHolder) { if (ModelState.IsValid) { db.Entry(projectHolder).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(projectHolder)); }
public ActionResult Create([Bind(Include = "Id,Name,ProjectDescription,Screenshot,LinkToRepository,LanguagesUsed")] ProjectHolder projectHolder) { if (ModelState.IsValid) { db.ProjectHolders.Add(projectHolder); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(projectHolder)); }
// GET: ProjectHolders/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProjectHolder projectHolder = db.ProjectHolders.Find(id); if (projectHolder == null) { return(HttpNotFound()); } return(View(projectHolder)); }
private void openFile(string file) { IFormatter formatter = new BinaryFormatter(); ph = new ProjectHolder(); try { Stream inStream = new FileStream(file, FileMode.Open, FileAccess.Read); ph = (ProjectHolder)formatter.Deserialize(inStream); inStream.Close(); } catch (Exception) { } DataContext = ph; projList.DataContext = ph; ph.UpdatePropertyHandlers(); }
private void AddCharacter(object sender, EventArgs e) { ProjectHolder.AddCharactor(this); }
private void AddAnimation(object sender, EventArgs e) { ProjectHolder.AddAnimation(this); }
private void InportFromUnity(object sender, EventArgs e) { string filename = @"C:\GitHub\eWolfPixel\Pixel\eWolfUnity3DParser.UnitTests\TestingData\Player04.png"; SpriteSheetData spriteSheetData = SpriteParser.ParseLoad(filename + ".meta"); // spin up a bitmap reader to read the image and create pixelSets for each sprite. PixelSet image = ServiceLocator.Instance.GetService <IPixelLoader>().LoadImage(filename); Dictionary <string, PixelSet> frames = image.CutFrames(spriteSheetData); ProjectHolder projectHolder = ServiceLocator.Instance.GetService <ProjectHolder>(); AnimationDetails ad = new AnimationDetails($"Walk", "\\Root\\Char1"); projectHolder.Items.Add(ad); ad.PostLoadFix(); // PL04_DownLeft_Walk0 List <PixelSet> leftWalk = new List <PixelSet>(); leftWalk.Add(frames["PL04_Left_Walk0"]); leftWalk.Add(frames["PL04_Left_Walk1"]); leftWalk.Add(frames["PL04_Left_Walk0"]); leftWalk.Add(frames["PL04_Left_Walk2"]); AddFrameToAnim(Directions8Way.Left, ad, leftWalk); List <PixelSet> downLeftWalk = new List <PixelSet>(); downLeftWalk.Add(frames["PL04_DownLeft_Walk0"]); downLeftWalk.Add(frames["PL04_DownLeft_Walk1"]); downLeftWalk.Add(frames["PL04_DownLeft_Walk0"]); downLeftWalk.Add(frames["PL04_DownLeft_Walk2"]); AddFrameToAnim(Directions8Way.DownLeft, ad, downLeftWalk); List <PixelSet> downRightWalk = new List <PixelSet>(); downRightWalk.Add(frames["PL04_DownRight_Walk0"]); downRightWalk.Add(frames["PL04_DownRight_Walk1"]); downRightWalk.Add(frames["PL04_DownRight_Walk0"]); downRightWalk.Add(frames["PL04_DownRight_Walk2"]); AddFrameToAnim(Directions8Way.DownRight, ad, downRightWalk); List <PixelSet> rightWalk = new List <PixelSet>(); rightWalk.Add(frames["PL04_Right_Walk0"]); rightWalk.Add(frames["PL04_Right_Walk1"]); rightWalk.Add(frames["PL04_Right_Walk0"]); rightWalk.Add(frames["PL04_Right_Walk2"]); AddFrameToAnim(Directions8Way.Right, ad, rightWalk); List <PixelSet> upLeftWalk = new List <PixelSet>(); upLeftWalk.Add(frames["PL04_UpLeft_Walk0"]); upLeftWalk.Add(frames["PL04_UpLeft_Walk1"]); upLeftWalk.Add(frames["PL04_UpLeft_Walk0"]); upLeftWalk.Add(frames["PL04_UpLeft_Walk2"]); AddFrameToAnim(Directions8Way.UpLeft, ad, upLeftWalk); List <PixelSet> upWalk = new List <PixelSet>(); upWalk.Add(frames["PL04_Up_Walk0"]); upWalk.Add(frames["PL04_Up_Walk1"]); upWalk.Add(frames["PL04_Up_Walk0"]); upWalk.Add(frames["PL04_Up_Walk2"]); AddFrameToAnim(Directions8Way.Up, ad, upWalk); List <PixelSet> downWalk = new List <PixelSet>(); downWalk.Add(frames["PL04_Down_Walk0"]); downWalk.Add(frames["PL04_Down_Walk1"]); downWalk.Add(frames["PL04_Down_Walk0"]); downWalk.Add(frames["PL04_Down_Walk2"]); AddFrameToAnim(Directions8Way.Down, ad, downWalk); List <PixelSet> upRightWalk = new List <PixelSet>(); upRightWalk.Add(frames["PL04_UpRight_Walk0"]); upRightWalk.Add(frames["PL04_UpRight_Walk1"]); upRightWalk.Add(frames["PL04_UpRight_Walk0"]); upRightWalk.Add(frames["PL04_UpRight_Walk2"]); AddFrameToAnim(Directions8Way.UpRight, ad, upRightWalk); ad.Save(projectHolder.ProjectPath); }
private void MenuItem_Click_2(object sender, RoutedEventArgs e) { ph = new ProjectHolder(); projList.DataContext = ph; ph.UpdatePropertyHandlers(); }