public static void WriteToStream (Stream s, ComposerJobDefinition o)
        {
            var serializer = new JsonSerializer();
            serializer.Converters.Add(new JavaScriptDateTimeConverter());
            serializer.NullValueHandling = NullValueHandling.Ignore;

            using (var sr = new StreamWriter(s))
            using (var writer = new JsonTextWriter(sr))
            {
                serializer.Serialize(writer, o);
            }
        }
        public static ComposerJobDefinition CreateFromFile ( string path )
        {
            var r = new ComposerJobDefinition();

            try
            {
                return CreateFromStream(new FileStream(path, FileMode.Open));
            }
            catch (Exception )
            {
                return r;
            }
        }
        public static ComposerJobDefinition CreateFromStream( Stream s )
        {
            var d = new ComposerJobDefinition();

            var serializer = new JsonSerializer();
            serializer.Converters.Add(new JavaScriptDateTimeConverter());
            serializer.NullValueHandling = NullValueHandling.Ignore;

            using (var sr = new StreamReader(s))
            using (var reader = new JsonTextReader(sr))
            {
                return  serializer.Deserialize<ComposerJobDefinition>(reader);
            }
        }
        public MainWindow( )
        {
            App a = (composer_gui.App)App.Current;
            m_Runtime = a.Runtime;
            m_definition = a.Definition;

            InitializeComponent();

            m_InputFiles.ItemsSource = m_Files;
            m_FramesHorizontal.ItemsSource = m_FrameFiles;

            m_inputPath.Text = m_definition.InputDirectory;
            m_outputPath.Text = m_definition.OutputDirectory;
            m_framePath.Text = m_definition.FramesDirectory;
        }
Пример #5
0
        App()
        {
            taskArray[0] = Task.Run( 
                () =>
                {
                    m_Runtime = new Composer.Bridge.ComposerRuntime();
                });

            taskArray[1] = Task.Run(() =>
            {
                m_Definitiion = ComposerJobDefinitionFactory.CreateFromFile("composer_gui.json");

                //m_definition = ComposerJobDefinitionFactory.CreateFromFile("composer_gui.json");
                //var d = new ComposerJobDefinition(@"c:\", @"d:\", @"e:\");
                //ComposerJobDefinitionFactory.WriteToFile("composer_gui.json", d);
            }

            );

            Startup += new StartupEventHandler(this.ApplicationStartupHandler);
            Exit += new ExitEventHandler(this.ApplicationExitHandler);
        }
 public static void WriteToFile(string path, ComposerJobDefinition d)
 {
     WriteToStream(new FileStream(path, FileMode.OpenOrCreate), d);
 }