Exemplo n.º 1
0
        public static DialogResult ShowDialog <T>(T obj, string title, SerializationMgr serializationMgr)
        {
            PropertyDlg dlg = new PropertyDlg(title);

            dlg.AddOption(new PropertyEnvelope <T>(obj));
            DialogResult result = dlg.ShowDialog();

            if (result == DialogResult.OK && serializationMgr != null)
            {
                serializationMgr.SaveProfile <T>(obj, title);
            }

            return(result);
        }
Exemplo n.º 2
0
        public override void Execute(SharedObjects shared)
        {
            string fileName = PopValueAssert(shared, true).ToString();

            AssertArgBottomAndConsume(shared);

            VolumeFile volumeFile = shared.VolumeMgr.CurrentVolume.Open(fileName);

            if (volumeFile == null)
            {
                throw new KOSException("File does not exist: " + fileName);
            }

            object read = new SerializationMgr(shared).Deserialize(volumeFile.ReadAll().String, JsonFormatter.ReaderInstance);

            ReturnValue = read;
        }
Exemplo n.º 3
0
        public override void Execute(SharedObjects shared)
        {
            object pathObject = PopValueAssert(shared, true);

            AssertArgBottomAndConsume(shared);

            GlobalPath path   = shared.VolumeMgr.GlobalPathFromObject(pathObject);
            Volume     volume = shared.VolumeMgr.GetVolumeFromPath(path);

            VolumeFile volumeFile = volume.Open(path) as VolumeFile;

            if (volumeFile == null)
            {
                throw new KOSException("File does not exist: " + path);
            }

            Structure read = new SerializationMgr(shared).Deserialize(volumeFile.ReadAll().String, JsonFormatter.ReaderInstance) as SerializableStructure;

            ReturnValue = read;
        }
Exemplo n.º 4
0
        public override void Execute(SharedObjects shared)
        {
            object pathObject = PopValueAssert(shared, true);
            SerializableStructure serialized = PopValueAssert(shared, true) as SerializableStructure;

            AssertArgBottomAndConsume(shared);

            if (serialized == null)
            {
                throw new KOSException("This type is not serializable");
            }

            string serializedString = new SerializationMgr(shared).Serialize(serialized, JsonFormatter.WriterInstance);

            FileContent fileContent = new FileContent(serializedString);

            GlobalPath path   = shared.VolumeMgr.GlobalPathFromObject(pathObject);
            Volume     volume = shared.VolumeMgr.GetVolumeFromPath(path);

            ReturnValue = volume.SaveFile(path, fileContent);
        }
Exemplo n.º 5
0
        public override void Execute(SharedObjects shared)
        {
            string fileName = PopValueAssert(shared, true).ToString();
            SerializableStructure serialized = PopValueAssert(shared, true) as SerializableStructure;

            AssertArgBottomAndConsume(shared);

            if (serialized == null)
            {
                throw new KOSException("This type is not serializable");
            }

            string serializedString = new SerializationMgr(shared).Serialize(serialized, JsonFormatter.WriterInstance);

            FileContent fileContent = new FileContent(serializedString);

            if (shared.VolumeMgr != null)
            {
                shared.VolumeMgr.CurrentVolume.Save(fileName, fileContent);
            }
        }