コード例 #1
0
        public int UpdateShare(Guid shareId, ResourcePath baseResourcePath, string shareName,
                               IEnumerable <string> mediaCategories, RelocationMode relocationMode)
        {
            CpAction       action       = GetAction("UpdateShare");
            IList <object> inParameters = new List <object>
            {
                MarshallingHelper.SerializeGuid(shareId),
                baseResourcePath.Serialize(),
                shareName,
                StringUtils.Join(",", mediaCategories)
            };
            string relocationModeStr;

            switch (relocationMode)
            {
            case RelocationMode.Relocate:
                relocationModeStr = "Relocate";
                break;

            case RelocationMode.ClearAndReImport:
                relocationModeStr = "ClearAndReImport";
                break;

            case RelocationMode.None:
                relocationModeStr = "None";
                break;

            default:
                throw new NotImplementedException(string.Format("RelocationMode '{0}' is not implemented", relocationMode));
            }
            inParameters.Add(relocationModeStr);
            IList <object> outParameters = action.InvokeAction(inParameters);

            return((int)outParameters[0]);
        }
コード例 #2
0
 /// <summary>
 /// Sends a message that a share was changed (<see cref="MessageType.ShareChanged"/>).
 /// </summary>
 /// <param name="share">Share which was changed.</param>
 /// <param name="relocationMode">Controls how the data of the changed share should be adapted at the server.</param>
 public static void SendShareChangedMessage(Share share, RelocationMode relocationMode)
 {
   SystemMessage msg = new SystemMessage(MessageType.ShareChanged);
   msg.MessageData[SHARE] = share;
   msg.MessageData[RELOCATION_MODE] = relocationMode;
   ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);
 }
コード例 #3
0
 /// <summary>Initializes a new instance of the <see cref="TargetMachine"/> class.</summary>
 /// <param name="triple">Triple for the target machine</param>
 /// <param name="cpu">CPU options for the machine</param>
 /// <param name="features">CPU features for the machine</param>
 /// <param name="optLevel">General optimization level for machine code generation</param>
 /// <param name="relocationMode">Relocation mode for machine code generation</param>
 /// <param name="codeModel">Code model for machine code generation</param>
 public TargetMachine(Triple triple
                      , string?cpu                    = null
                      , string?features               = null
                      , CodeGenOpt optLevel           = CodeGenOpt.Default
                      , RelocationMode relocationMode = RelocationMode.Default
                      , CodeModel codeModel           = CodeModel.Default
                      )
     : this(Target.InternalCreateTargetMachine(Target.FromTriple(triple), triple, cpu, features, optLevel, relocationMode, codeModel))
 {
 }
コード例 #4
0
        /// <summary>Creates a <see cref="TargetMachine"/> for the triple and specified parameters</summary>
        /// <param name="triple">Target triple for this machine (e.g. -mtriple)</param>
        /// <param name="cpu">CPU for this machine (e.g. -mcpu)</param>
        /// <param name="features">Features for this machine (e.g. -mattr...)</param>
        /// <param name="optLevel">Optimization level</param>
        /// <param name="relocationMode">Relocation mode for generated code</param>
        /// <param name="codeModel"><see cref="CodeModel"/> to use for generated code</param>
        /// <returns><see cref="TargetMachine"/> based on the specified parameters</returns>
        public static TargetMachine FromTriple(Triple triple
                                               , string?cpu                    = null
                                               , string?features               = null
                                               , CodeGenOpt optLevel           = CodeGenOpt.Default
                                               , RelocationMode relocationMode = RelocationMode.Default
                                               , CodeModel codeModel           = CodeModel.Default
                                               )
        {
            var target = Target.FromTriple(triple);

            return(target.CreateTargetMachine(triple, cpu, features, optLevel, relocationMode, codeModel));
        }
コード例 #5
0
        /// <summary>Creates a <see cref="TargetMachine"/> for the target and specified parameters</summary>
        /// <param name="triple">Target triple for this machine (e.g. -mtriple)</param>
        /// <param name="cpu">CPU for this machine (e.g. -mcpu)</param>
        /// <param name="features">Features for this machine (e.g. -mattr...)</param>
        /// <param name="optLevel">Optimization level</param>
        /// <param name="relocationMode">Relocation mode for generated code</param>
        /// <param name="codeModel"><see cref="CodeModel"/> to use for generated code</param>
        /// <returns><see cref="TargetMachine"/> based on the specified parameters</returns>
        public TargetMachine CreateTargetMachine(string triple
                                                 , string cpu                    = null
                                                 , string features               = null
                                                 , CodeGenOpt optLevel           = CodeGenOpt.Default
                                                 , RelocationMode relocationMode = RelocationMode.Default
                                                 , CodeModel codeModel           = CodeModel.Default
                                                 )
        {
            LLVMTargetMachineRef targetMachineHandle = InternalCreateTargetMachine(this, triple, cpu, features, optLevel, relocationMode, codeModel);

            return(new TargetMachine(targetMachineHandle));
        }
コード例 #6
0
 protected void UpdateShareAndFinish(RelocationMode relocationMode)
 {
     try
     {
         _shareProxy.UpdateShare(relocationMode);
         NavigateBackToOverview();
     }
     catch (NotConnectedException)
     {
         DisconnectedError();
     }
     catch (Exception e)
     {
         ErrorEditShare(e);
     }
 }
コード例 #7
0
        public Share UpdateShare(Guid shareId, ResourcePath baseResourcePath, string shareName,
                                 IEnumerable <string> mediaCategories, RelocationMode relocationMode)
        {
            Share result = GetShare(shareId);

            if (result == null)
            {
                return(null);
            }
            result.BaseResourcePath = baseResourcePath;
            result.Name             = shareName;
            result.MediaCategories.Clear();
            CollectionUtils.AddAll(result.MediaCategories, mediaCategories);
            SaveSharesToSettings();
            SharesMessaging.SendShareChangedMessage(result, relocationMode);
            return(result);
        }
コード例 #8
0
 protected void UpdateShareAndFinish(RelocationMode relocationMode)
 {
   try
   {
     _shareProxy.UpdateShare(relocationMode);
     NavigateBackToOverview();
   }
   catch (NotConnectedException)
   {
     DisconnectedError();
   }
   catch (Exception e)
   {
     ErrorEditShare(e);
   }
 }
コード例 #9
0
 public override void UpdateShare(RelocationMode relocationMode)
 {
   ILocalSharesManagement sharesManagement = ServiceRegistration.Get<ILocalSharesManagement>();
   sharesManagement.UpdateShare(_origShare.ShareId, ChoosenResourcePath, ShareName, GetMediaCategoriesCleanedUp(), relocationMode);
 }
コード例 #10
0
        public override void UpdateShare(RelocationMode relocationMode)
        {
            ILocalSharesManagement sharesManagement = ServiceRegistration.Get <ILocalSharesManagement>();

            sharesManagement.UpdateShare(_origShare.ShareId, ChoosenResourcePath, ShareName, GetMediaCategoriesCleanedUp(), relocationMode);
        }
コード例 #11
0
 public Share UpdateShare(Guid shareId, ResourcePath baseResourcePath, string shareName,
     IEnumerable<string> mediaCategories, RelocationMode relocationMode)
 {
   Share result = GetShare(shareId);
   if (result == null)
     return null;
   result.BaseResourcePath = baseResourcePath;
   result.Name = shareName;
   result.MediaCategories.Clear();
   CollectionUtils.AddAll(result.MediaCategories, mediaCategories);
   SaveSharesToSettings();
   SharesMessaging.SendShareChangedMessage(result, relocationMode);
   return result;
 }
コード例 #12
0
 public abstract void UpdateShare(RelocationMode relocationMode);
コード例 #13
0
 public int UpdateShare(Guid shareId, ResourcePath baseResourcePath, string shareName,
     IEnumerable<string> mediaCategories, RelocationMode relocationMode)
 {
   CpAction action = GetAction("UpdateShare");
   IList<object> inParameters = new List<object>
     {
         MarshallingHelper.SerializeGuid(shareId),
         baseResourcePath.Serialize(),
         shareName,
         StringUtils.Join(",", mediaCategories)
     };
   string relocationModeStr;
   switch (relocationMode)
   {
     case RelocationMode.Relocate:
       relocationModeStr = "Relocate";
       break;
     case RelocationMode.ClearAndReImport:
       relocationModeStr = "ClearAndReImport";
       break;
     case RelocationMode.None:
       relocationModeStr = "None";
       break;
     default:
       throw new NotImplementedException(string.Format("RelocationMode '{0}' is not implemented", relocationMode));
   }
   inParameters.Add(relocationModeStr);
   IList<object> outParameters = action.InvokeAction(inParameters);
   return (int) outParameters[0];
 }
コード例 #14
0
ファイル: ShareProxy.cs プロジェクト: chekiI/MediaPortal-2
 public abstract void UpdateShare(RelocationMode relocationMode);
コード例 #15
0
        internal static LLVMTargetMachineRef InternalCreateTargetMachine(Target target, string triple, string cpu, string features, CodeGenOpt optLevel, RelocationMode relocationMode, CodeModel codeModel)
        {
            triple.ValidateNotNullOrWhiteSpace(nameof(triple));
            optLevel.ValidateDefined(nameof(optLevel));
            relocationMode.ValidateDefined(nameof(relocationMode));
            codeModel.ValidateDefined(nameof(codeModel));

            var targetMachineHandle = LLVMCreateTargetMachine(target.TargetHandle
                                                              , triple
                                                              , cpu ?? string.Empty
                                                              , features ?? string.Empty
                                                              , ( LLVMCodeGenOptLevel )optLevel
                                                              , ( LLVMRelocMode )relocationMode
                                                              , ( LLVMCodeModel )codeModel
                                                              );

            return(targetMachineHandle);
        }