- Azonnali VGA-s kérdések órája
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Nagyon nem szokványos módon ment tönkre egy ASML gép Kínában…
- Mini-ITX
- Házimozi belépő szinten
- SONY LCD és LED TV-k
- AMD Navi Radeon™ RX 7xxx sorozat
- OLED TV topic
- AMD Navi Radeon™ RX 9xxx sorozat
- Milyen asztali (teljes vagy fél-) gépet vegyek?
Új hozzászólás Aktív témák
-
DrojDtroll
veterán
válasz
DrojDtroll
#8292
üzenetére
Ezt a problémát megoldottam úgy hogy csináltam egy osztály ami egyetlen color field-et tartalmaz.
Most a serializációval küszködök.
A Class amit el kellene menteni.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
namespace raw_data
{
[Serializable]
public class ColorPalette : Data.ISeriazable
{
private List<Imaging.RefColor> _colorList;
public string SerializedName { get; set; }
public ColorPalette()
{
ColorList = new List<Imaging.RefColor>();
ColorList.Add(new Imaging.RefColor(Settings.ColorPalette.Default.DefaultMin));
ColorList.Add(new Imaging.RefColor(Settings.ColorPalette.Default.DefaultMax));
SerializedName = Settings.Folder.Default.ColorPalette + Path.AltDirectorySeparatorChar + System.IO.Directory.GetFiles(Settings.Folder.Default.ColorPalette).Length;
}
public List<Imaging.RefColor> ColorList { get => _colorList; set => _colorList = value; }
public Lut lut { get; set; }
public string GetSerializedName()
{
return SerializedName;
}
}
}A serializálást végző függvény:
public static void SerializeObject(Data.ISeriazable obj)
{
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(obj.GetSerializedName(),
FileMode.Create,
FileAccess.Write, FileShare.None);
formatter.Serialize(stream, obj);
stream.Close();
}A visszatöltés metódusa
internal static void LoadSerializedPalettes(GroupBox colorPaletteGroupBox)
{
string[] serializedfilenames=Directory.GetFiles(Settings.Folder.Default.ColorPalette);
foreach (var item in serializedfilenames)
{
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(item,
FileMode.Open,
FileAccess.Read,
FileShare.Read);
ColorPalette cp = (ColorPalette)formatter.Deserialize(stream);
stream.Close();
ColorPaletteSettings.ColorPaletteList.Add(cp);
AddNewPalatte(colorPaletteGroupBox, cp);
}
}Nem töltődnek rendesen vissza az objektumok. A stream még rendesen megvan. Debugban látom, hogy a hossza olyan mint amilyennek lennie kell.
Mitől lehet, hogy mégis null-t kapok?
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Playstation 5 Slim Disc Edition 1TB, újra fémpasztázva, 6 hó garanciával, Bp-i üzletből eladó!
- CANON Objektív ZOOM Lencse EF-S 18-55mm 1:3.5-5.6 IS / 58
- Chieftec CTG-500-80P 500W 80+ minősítésű ATX tápegység
- Gigabyte GA-H110M-S2H (rev: 1.0 LGA 1151 alaplap, + i5-6600 CPU, + Garancia!
- Chieftec CHP-450A 450W ATX tápegység
- HIBÁTLAN iPhone 13 mini 128GB Midnight -1 ÉV GARANCIA - Kártyafüggetlen, MS3330
- Lenovo ThinkPad T14 Gen1 Ryzen5 4650U Sale.exe: 26.10.2025-ig Kedvezményes ár! 120.000ft!
- Dell Optiplex MT/SFF 3040, 3050, 3060, 3070, 5070, 7060/ Hp ProDesk /SZÁMLA- GARANCIA
- 152 - Lenovo LOQ (15IRH8) - Intel Core i5-12450H, RTX 4060
- Telefon felvásárlás!! Apple iPhone SE (2016), Apple iPhone SE2 (2020), Apple iPhone SE3 (2022)
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: NetGo.hu Kft.
Város: Gödöllő

Mitől lehet, hogy mégis null-t kapok?

