Пример #1
0
        static void PluginModeInit()
        {
            Try(() =>
            {
                Ust = new Ust(args[0], Encoding);
                Ust.SetAtlas(Atlas);
                if (Ust.IsLoaded)
                {
                    Log("Ust loaded");
                }
                else
                {
                    Log($"Error reading UST");
                }
            }, "Error on reading Ust");

            Try(() =>
            {
                if (Ust.IsLoaded)
                {
                    Atlas = new Atlas(Ust.VoiceDir);
                    Ust.SetAtlas(Atlas);
                }
                if (Atlas.IsLoaded)
                {
                    Log("Atlas loaded");
                }
                else
                {
                    Log("Error reading Atlas");
                }
            }, "Error on reading Atlas");

            Try(() =>
            {
                var singer = new Singer(Ust.VoiceDir);
                if (singer.IsLoaded)
                {
                    Log("Singer loaded");
                }
                else
                {
                    Log($"Error reading singer {Ust.VoiceDir}");
                }
            }, "Error on reading Singer");

            Log("All files loaded successfully");

            Try(() =>
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
            }, "Error on end init");

            var window = new PluginWindow();

            window.Init(Ust, Atlas);
            Application.Run(window);
        }
 void Reset()
 {
     Ust.Reload(Program.Encoding);
     Settings.IsParsed   = false;
     Settings.IsUnparsed = false;
     CheckAccess();
     SetLyric();
     SetLang();
     Ust.SetAtlas(Atlas);
     SetTitle();
 }
Пример #3
0
        static void Main(string[] args)
        {
            Args = args;
#if DEBUG
            IsDebug = true;
#endif

            AvisManager manager = null;
            Try(() =>
            {
                NFI = new CultureInfo("en-US", false).NumberFormat;
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
                Encoding = Encoding.GetEncoding(932);

                var ust = new Ust(args[0], Encoding);
                if (!ust.IsLoaded)
                {
                    throw new Exception("Failed to read UST");
                }

                var singer = new Singer(ust.VoiceDir);
                if (!singer.IsLoaded)
                {
                    throw new Exception("Failed to read Singer");
                }

                var atlas = new Atlas(ust.VoiceDir);
                if (!atlas.IsLoaded)
                {
                    throw new Exception("Failed to read Atlas");
                }
                ust.SetAtlas(atlas);

                manager = new AvisManager(ust, atlas, singer);

                Errors.Log("Ust loaded");
            }, "Failed to load data");

            if (manager == null)
            {
                return;
            }
            Manager = manager;
            Manager.Start();
        }