Example #1
0
        private void Init()
        {
            //RefreshImportFolders();

            ShokoService.CmdProcessorGeneral.OnQueueCountChangedEvent += CmdProcessorGeneral_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent += CmdProcessorGeneral_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorHasher.OnQueueCountChangedEvent += CmdProcessorHasher_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorHasher.OnQueueStateChangedEvent += CmdProcessorHasher_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorImages.OnQueueCountChangedEvent += CmdProcessorImages_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorImages.OnQueueStateChangedEvent += CmdProcessorImages_OnQueueStateChangedEvent;


            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (!plugin.Name.EqualsInvariantIgnoreCase("Local File System"))
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.Icon,
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }

            // TODO Hook into AniDBConnectionHandler
            //AniDBConnectionHandler.Instance.AniDBStateUpdate += OnAniDBStateUpdate;
        }
Example #2
0
        private void Init()
        {
            //RefreshImportFolders();

            ShokoService.CmdProcessorGeneral.OnQueueCountChangedEvent += CmdProcessorGeneral_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent += CmdProcessorGeneral_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorHasher.OnQueueCountChangedEvent += CmdProcessorHasher_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorHasher.OnQueueStateChangedEvent += CmdProcessorHasher_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorImages.OnQueueCountChangedEvent += CmdProcessorImages_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorImages.OnQueueStateChangedEvent += CmdProcessorImages_OnQueueStateChangedEvent;


            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (plugin.Name.Equals("Local File System", StringComparison.InvariantCultureIgnoreCase))
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.Icon,
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
Example #3
0
 public void Validate(ValidationResult result)
 {
     /* Temporary...can remove, need a mechanism to add cloud providers tied to products, KDW 12/7/2017 */
     if (CloudProviders != null)
     {
         CloudProviders.Clear();
     }
 }
Example #4
0
        public string GetEcosystemObjects(Step oStep)
        {
            string    sStepID   = oStep.ID;
            string    sFunction = oStep.Function.Name;
            XDocument xd        = oStep.FunctionXDoc;

            XElement xObjectType = xd.XPathSelectElement("//object_type");
            string   sObjectType = (xObjectType == null ? "" : xObjectType.Value);

            string sHTML = "";

            sHTML += "Select Object Type:" + Environment.NewLine;
            sHTML += "<select " + CommonAttribs(sStepID, sFunction, true, "object_type", "") + ">" + Environment.NewLine;
            sHTML += "  <option " + SetOption("", sObjectType) + " value=\"\"></option>" + Environment.NewLine;


            //temporary, waiting on issue #111/#128
            CloudProviders cp = ui.GetCloudProviders();

            if (cp != null)
            {
                foreach (Provider p in cp.Values)
                {
                    Dictionary <string, CloudObjectType> cots = p.GetAllObjectTypes();
                    foreach (CloudObjectType cot in cots.Values)
                    {
                        sHTML += "<option " + SetOption(cot.ID, sObjectType) + " value=\"" + cot.ID + "\">" + p.Name + " - " + cot.Label + "</option>" + Environment.NewLine;
                    }
                }
            }


            sHTML += "</select>" + Environment.NewLine;

            XElement xCloudFilter = xd.XPathSelectElement("//cloud_filter");
            string   sCloudFilter = (xCloudFilter == null ? "" : xCloudFilter.Value);

            sHTML += "Cloud Filter: " + Environment.NewLine + "<input type=\"text\" " +
                     CommonAttribs(sStepID, sFunction, false, "cloud_filter", "") +
                     " help=\"Enter all or part of a cloud name to filter the results.\" value=\"" + sCloudFilter + "\" />" + Environment.NewLine;

            XElement xResultName = xd.XPathSelectElement("//result_name");
            string   sResultName = (xResultName == null ? "" : xResultName.Value);

            sHTML += "<br />Result Variable: " + Environment.NewLine + "<input type=\"text\" " +
                     CommonAttribs(sStepID, sFunction, false, "result_name", "") +
                     " help=\"This variable array will contain the ID of each Ecosystem Object.\" value=\"" + sResultName + "\" />" + Environment.NewLine;

            XElement xCloudName = xd.XPathSelectElement("//cloud_name");
            string   sCloudName = (xCloudName == null ? "" : xCloudName.Value);

            sHTML += " Cloud Name Variable: " + Environment.NewLine + "<input type=\"text\" " +
                     CommonAttribs(sStepID, sFunction, false, "cloud_name", "") +
                     " help=\"This variable array will contain the name of the Cloud for each Ecosystem Object.\" value=\"" + sCloudName + "\" />" + Environment.NewLine;

            return(sHTML);
        }
Example #5
0
 public static void EnableGalaxy(bool success)
 {
     if (success)
     {
         CloudProvider = CloudProviders.Galaxy;
         GameplayManager.CMCombinedLeaderboardNames[0] = "--COMBINED--";
         GameplayManager.CMCombinedLeaderboardNames[1] = "--COMBINED DLC--";
         Debug.Log("SignedIn: " + Galaxy.Api.GalaxyInstance.User().SignedIn());
         Debug.Log("LoggedOn: " + Galaxy.Api.GalaxyInstance.User().IsLoggedOn());
     }
     else
     {
         GameObject.Destroy(GameManager.m_gm.gameObject.GetComponent <GogGalaxyManager>());
     }
 }
Example #6
0
        public string GetProviders()
        {
            string sOptionHTML = "";

            CloudProviders cp = ui.GetCloudProviders();

            if (cp != null)
            {
                foreach (Provider p in cp.Values)
                {
                    sOptionHTML += "<option value=\"" + p.Name + "\">" + p.Name + "</option>";
                }
            }

            return(sOptionHTML);
        }
Example #7
0
        private async void OnProviderChanged(object sender, EventArgs e)
        {
            CurrentFolder = "";
            if (CurrentProvider != CloudProviders.NULL)
            {
                pi = await ProviderInfo.GetCloudProviderAsync(CurrentProvider);

                bool worked = await UpdateFolderList();

                if (!worked)
                {
                    CurrentProvider = lastProvider;
                }
            }

            lastProvider = CurrentProvider;
        }
Example #8
0
        private void Init()
        {
            //RefreshImportFolders();

            Queue.Instance.Subscribe((cmd) =>
            {
                if (cmd.WorkType == WorkTypes.Image)
                {
                    ImagesQueueState = cmd;
                }
                else if (cmd.WorkType == WorkTypes.Hashing)
                {
                    HasherQueueState = cmd;
                }
                else
                {
                    GeneralQueueState = cmd;
                }
            });

            Observable.Interval(TimeSpan.FromSeconds(1)).Subscribe((_) =>
            {
                if (Repo.Instance != null)
                {
                    ImagesQueueCount  = Queue.Instance.GetCommandCount(WorkTypes.AniDB);
                    HasherQueueCount  = Queue.Instance.GetCommandCount(WorkTypes.Hashing);
                    GeneralQueueCount = Queue.Instance.GetCommandCount() - ImagesQueueCount - HasherQueueCount;
                }
            });

            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (!plugin.Name.Equals("Local File System", StringComparison.InvariantCultureIgnoreCase))
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.Icon,
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
Example #9
0
        private void Init()
        {
            //RefreshImportFolders();

            ShokoService.CmdProcessorGeneral.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorGeneral.QueueCountChangedHandler(
                    CmdProcessorGeneral_OnQueueCountChangedEvent);
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorGeneral.QueueStateChangedHandler(
                    CmdProcessorGeneral_OnQueueStateChangedEvent);

            ShokoService.CmdProcessorHasher.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorHasher.QueueCountChangedHandler(
                    CmdProcessorHasher_OnQueueCountChangedEvent);
            ShokoService.CmdProcessorHasher.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorHasher.QueueStateChangedHandler(
                    CmdProcessorHasher_OnQueueStateChangedEvent);

            ShokoService.CmdProcessorImages.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorImages.QueueCountChangedHandler(
                    CmdProcessorImages_OnQueueCountChangedEvent);
            ShokoService.CmdProcessorImages.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorImages.QueueStateChangedHandler(
                    CmdProcessorImages_OnQueueStateChangedEvent);


            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (plugin.Name != "Local File System")
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.CreateIconImage(),
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
Example #10
0
File: UI.cs Project: you8/cato
 //this one takes a modified Cloud Providers class and puts it into the session
 public void UpdateCloudProviders(CloudProviders cp)
 {
     SetSessionObject("cloud_providers", cp, "Security");
 }
Example #11
0
File: UI.cs Project: you8/cato
        //this one shoves the Cloud Providers xml into the session
        public void SetCloudProviders(ref string sErr)
        {
            //load the cloud_providers.xml file into the session.  If it doesn't exist, we can't proceed.
            try
            {
                XDocument xProviders = XDocument.Load(HttpContext.Current.Server.MapPath("~/conf/cloud_providers.xml"));

                if (xProviders == null)
                {
                    sErr = "Error: Cloud Providers XML file is missing or unreadable.";
                }
                else
                {
                    CloudProviders cp = new CloudProviders(xProviders);
                    SetSessionObject("cloud_providers", cp, "Security");
                }
            } catch (Exception ex) {
                sErr = "Error: Unable to load Cloud Providers XML." + ex.Message;
            }
        }
Example #12
0
        static public void SetProvider(string project, string trackname, string date, CloudProviders provider)
        {
            string key = ProviderKey(project, trackname, date);

            Application.Current.Properties[key] = provider.ToString();
        }
Example #13
0
        public static string SaveCloud(string sMode, string sCloudID, string sCloudName, string sProvider, string sAPIUrl)
        {
            // for logging
            string sOriginalName = null;

            dataAccess dc = new dataAccess();

            acUI.acUI ui   = new acUI.acUI();
            string    sSql = null;
            string    sErr = null;


            //if we are editing get the original values
            if (sMode == "edit")
            {
            }

            try
            {
                dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                // update the user fields.
                if (sMode == "edit")
                {
                    sSql = "select cloud_name from clouds " +
                           "where cloud_id = '" + sCloudID + "'";
                    if (!dc.sqlGetSingleString(ref sOriginalName, sSql, ref sErr))
                    {
                        throw new Exception("Error getting original cloud name:" + sErr);
                    }

                    sSql = "update clouds set" +
                           " cloud_name = '" + sCloudName + "'," +
                           " provider = '" + sProvider + "'," +
                           " api_url = '" + sAPIUrl + "'" +
                           " where cloud_id = '" + sCloudID + "'";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception("Error updating cloud: " + sErr);
                    }

                    ui.WriteObjectChangeLog(Globals.acObjectTypes.Cloud, sCloudID, sCloudName, sOriginalName, sCloudName);
                }
                else
                {
                    sCloudID = ui.NewGUID();
                    sSql     = "insert into clouds (cloud_id, cloud_name, provider, api_url)" +
                               " values ('" + sCloudID + "'," +
                               "'" + sCloudName + "'," +
                               "'" + sProvider + "'," +
                               "'" + sAPIUrl + "')";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception("Error creating cloud: " + sErr);
                    }

                    ui.WriteObjectAddLog(Globals.acObjectTypes.Cloud, sCloudID, sCloudName, "Cloud Created");
                }

                oTrans.Commit();

                //update the cloud providers class in the session
                CloudProviders cp = ui.GetCloudProviders();
                cp[sProvider].RefreshClouds();
                ui.UpdateCloudProviders(cp);
            }
            catch (Exception ex)
            {
                throw new Exception("Error: General Exception: " + ex.Message);
            }

            // no errors to here, so return an empty string
            return("{'cloud_id':'" + sCloudID + "'}");
        }
Example #14
0
        public async static Task <ProviderInfo> GetCloudProviderAsync(CloudProviders cp)
        {
            ICloudStore cs = null;

            if (!providers.ContainsKey(cp))
            {
                ProviderInfo newProvider = null;

                switch (cp)
                {
                case CloudProviders.OneDrive:
                    cs = CloudStoreFactory.CreateCloudStore(CloudStorage.CloudProviders.OneDrive);
                    Dictionary <string, object> onedriveparams = new Dictionary <string, object>();
                    onedriveparams[CloudParams.ClientID.ToString()] = "7ba22c7f-29be-4dc7-a274-4209fe0b8b72";
                    onedriveparams[CloudParams.UIParent.ToString()] = App.UiParent;

                    if (cs.Initialize(onedriveparams))
                    {
                        bool worked = await cs.AuthenticateAsync();

                        if (worked)
                        {
                            newProvider = new ProviderInfo(cp, cs);
                        }
                    }
                    break;

                case CloudProviders.GoogleDrive:
                    cs = CloudStoreFactory.CreateCloudStore(CloudStorage.CloudProviders.GoogleDrive);

                    Dictionary <string, object> googledriveparams = new Dictionary <string, object>();
                    googledriveparams[CloudParams.ClientID.ToString()] = GetGoogleClientID();
                    // 133589155347-gj93njepme6jp96nh1erjmdi4q4c7d9k.apps.googleusercontent.com
                    // 133589155347-2he14os3etg7evt97pcu5jil1udh1klk.apps.googleusercontent.com
                    googledriveparams[CloudParams.RedirectURL.ToString()] = GetGoogleAuthRedirect();
                    googledriveparams[CloudParams.AppName.ToString()]     = "MyMixes";
                    googledriveparams[CloudParams.UIParent.ToString()]    = App.UiParent;
                    googledriveparams[CloudParams.GoogleToken.ToString()] = null;

                    if (cs.Initialize(googledriveparams))
                    {
                        bool worked = await cs.AuthenticateAsync();

                        AuthenticationState.Authenticator = cs.GetAuthenticator();
                        bool authCompletWorked = await cs.CompleteAuthenticateAsync(AuthenticationState.Authenticator);

                        if (authCompletWorked)
                        {
                            newProvider = new ProviderInfo(cp, cs);
                        }
                    }
                    break;

                default:
                    return(null);
                }

                if (newProvider != null)
                {
                    providers[cp] = newProvider;
                    return(newProvider);
                }
            }
            else
            {
                return(providers[cp]);
            }

            return(null);
        }
Example #15
0
 public ProviderInfo(CloudProviders cp, ICloudStore cs)
 {
     this.cs            = cs;
     this.CloudProvider = cp;
 }