Exemple #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Util.Output    = (value) => InfoBox.Text = value.ToString();
            Util.Input     = () => { return("null"); };
            Util.FileInput = (path) =>
            {
                StreamReader reader = new StreamReader(new FileStream(path, FileMode.Open));
                String       var    = reader.ReadToEnd();
                reader.Close();
                return(var);
            };
            Util.BinaryInput = (path) =>
            {
                BinaryReader reader = new BinaryReader(new FileStream(path, FileMode.Open));
                byte[]       bytes  = reader.ReadBytes((int)reader.BaseStream.Length);
                reader.Close();
                return(bytes);
            };
            Util.BinaryOutput = (path, bytes) =>
            {
                BinaryWriter writer = new BinaryWriter(new FileStream(path, FileMode.OpenOrCreate));
                writer.Write(bytes);
                writer.Flush();
                writer.Close();
            };

            if (File.Exists(logoName))
            {
                TextLogo.Visibility = Visibility.Hidden;
                LogoBox.Source      = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + logoName, UriKind.Absolute));

                Width  = SystemParameters.PrimaryScreenWidth / Scale;
                Height = Width / LogoBox.Source.Width * LogoBox.Source.Height;
                Left   = (SystemParameters.PrimaryScreenWidth - Width) / 2;
                Top    = (SystemParameters.PrimaryScreenHeight - Height) / 2;
            }

            if (File.Exists(confName))
            {
                var code = Util.GetSegments(Util.Read(confName));
                loader = new ConfLoader(code);
                loader.Run();
                theTimer.Change(launchTimeout, Timeout.Infinite);
            }
        }
Exemple #2
0
 public void addConfFile(string fileName)
 {
     configs = ConfLoader.getInstance(fileName);
 }