Ejemplo n.º 1
0
        public RunExpKai()
        {
            InitializeComponent();

            // Debug flag. Set to true only for debug builds.
            this.debug = false;

            // Read in api token, read in api_port, initialize the interfaces.
            Console.OutputEncoding = Encoding.Unicode;
            StreamReader reader         = new StreamReader(API_TOKEN_DIR);
            string       full_api_token = reader.ReadLine();

            reader.Close();

            this.flash.LoadMovie(0, API_PORT_DIR);
            this.eip = new ExternalInterfaceProxy(this.flash);
            this.kcp = new KanColleProxy(full_api_token);

            // Run once on program startup to fetch initial data.
            this.member_id    = int.Parse(this.kcp.GetBasic().api_member_id);
            this.port         = this.kcp.GetPort(this.member_id.ToString());
            this.mission_list = this.kcp.GetStart2().api_mst_mission;

            this.fleet_lists    = new int[4][];
            this.fleet_lists[0] = null;
            this.fleet_lists[1] = this.port.api_deck_port[1].api_ship;
            this.fleet_lists[2] = this.port.api_deck_port[2].api_ship;
            this.fleet_lists[3] = this.port.api_deck_port[3].api_ship;
            this.accumulated    = new int[4][];
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes FadeProxy on top of specified AxShockwaveFlash control.
        /// </summary>
        /// <param name="flashControl">AxShockwaveFlash control that contains Fade compatible SWF file.</param>
        public FadeProxy(AxShockwaveFlashObjects.AxShockwaveFlash flashControl)
        {
            proxy = new ExternalInterfaceProxy(flashControl);

            proxy.ExternalInterfaceCall += (s, e) =>
            {
                switch (e.FunctionCall.FunctionName)
                {
                case "checkStatus":
                    return(true);

                case "callbacksReady":
                    Ready?.Invoke(this, EventArgs.Empty);
                    return(null);

                case "stageOneInitialized":
                    _clients[(string)e.FunctionCall.Arguments[0]]?.HandleCall(e);
                    return(null);

                default:
                    Console.WriteLine(e.FunctionCall.FunctionName);
                    return(null);
                }
            };
        }
        // Stuff here taken from WPF tutorial
        // https://msdn.microsoft.com/en-us/library/ms751761%28v=vs.110%29.aspx
        private void RunExpKai_Loaded(object sender, RoutedEventArgs e)
        {
            // Create the interop host control.
            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();

            // Create Shockwave Flash control.
            AxShockwaveFlash flash = new AxShockwaveFlash();

            // Assign the shockwave flash control as the host control's child.
            host.Child = flash;

            // Add the interop host control to the Grid
            // control's collection of child controls.
            this.grid_winformshost.Children.Add(host);

            string swf_path = System.IO.Directory.GetCurrentDirectory() + "\\api_port.swf";

            flash.Location = new System.Drawing.Point(0, 0);
            flash.LoadMovie(0, swf_path);
            flash.AllowScriptAccess = "always";

            this.flashproxy = new ExternalInterfaceProxy(flash);

            //string msg = this.flashproxy.Call("api_mission", null).ToString();
        }
Ejemplo n.º 4
0
        public LiveFlashHandler(LiveWatchViewModel vm, AxShockwaveFlash flash)
        {
            Owner = vm;

            ShockwaveFlash = flash;
            Proxy          = new ExternalInterfaceProxy(ShockwaveFlash);
        }
Ejemplo n.º 5
0
        public KanColleConsole()
        {
            InitializeComponent();

            // Read in the swf file.
            string swfPath = System.IO.Directory.GetCurrentDirectory() + "\\api_port.swf";

            this.flash.LoadMovie(0, swfPath);

            // Set up the proxy for the flash file.
            this.proxy = new ExternalInterfaceProxy(this.flash);
        }
Ejemplo n.º 6
0
 public void PreInitialize(AxShockwaveFlash flash)
 {
     ShockwaveFlash  = flash;
     Proxy           = new ExternalInterfaceProxy(ShockwaveFlash);
     IsPreIntialized = true;
 }