Ejemplo n.º 1
0
        public override void Configure(CommandLineApplication command)
        {
            _app = command;
            command.Description = "Create a collaboration for a Box item.";
            _path              = FilePathOption.ConfigureOption(command);
            _bulkPath          = BulkFilePathOption.ConfigureOption(command);
            _save              = SaveOption.ConfigureOption(command);
            _fileFormat        = FileFormatOption.ConfigureOption(command);
            _fieldsOption      = FieldsOption.ConfigureOption(command);
            _editor            = command.Option("--editor", "Set the role to editor.", CommandOptionType.NoValue);
            _viewer            = command.Option("--viewer", "Set the role to viewer.", CommandOptionType.NoValue);
            _previewer         = command.Option("--previewer", "Set the role to previewer.", CommandOptionType.NoValue);
            _uploader          = command.Option("--uploader", "Set the role to uploader.", CommandOptionType.NoValue);
            _previewerUploader = command.Option("--previewer-uploader", "Set the role to previewer uploader.", CommandOptionType.NoValue);
            _viewerUploader    = command.Option("--viewer-uploader", "Set the role to viewer uploader.", CommandOptionType.NoValue);
            _coowner           = command.Option("--co-owner", "Set the role to co-owner.", CommandOptionType.NoValue);
            _role              = command.Option("-r|--role", "An option to manually enter the role", CommandOptionType.SingleValue);
            _userId            = command.Option("--user-id", "Id for user to collaborate", CommandOptionType.SingleValue);
            _groupId           = command.Option("--group-id", "Id for group to collaborate", CommandOptionType.SingleValue);
            _login             = command.Option("--login", "Login for user to collaborate", CommandOptionType.SingleValue);
            _canViewPath       = command.Option("--can-view-path", "Whether view path collaboration feature is enabled or not.", CommandOptionType.NoValue);
            _idOnly            = IdOnlyOption.ConfigureOption(command);
            _id = command.Argument("boxItemId",
                                   "Id of the Box item");
            if (base._t == BoxType.enterprise)
            {
                _type = command.Argument("boxItemType", "Type of Box item");
            }

            command.OnExecute(async() =>
            {
                return(await this.Execute());
            });
            base.Configure(command);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Verifica un file firmato e/o marcato
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="verifyDegree"></param>
        /// <param name="saveOptions"></param>
        /// <param name="saveTo"></param>
        /// <param name="signFormat"></param>
        /// <param name="timestampFormat"></param>
        /// <returns></returns>
        public VerifyResult Verify(string fileName, VerifyDegree verifyDegree = VerifyDegree.StandardVerify,
                                   SaveOption saveOptions              = SaveOption.DontSave, string saveTo = null,
                                   SignatureType signFormat            = SignatureType.EnvelopedDataSignature,
                                   TimeStampFileFormat timestampFormat = TimeStampFileFormat.UndefinedTimeStampFormat)
        {
            StringBuilder workPath = null;

            if (saveOptions != 0 || !string.IsNullOrEmpty(saveTo))
            {
                workPath = new StringBuilder(260);
            }

            if (!string.IsNullOrEmpty(saveTo))
            {
                workPath.Append(saveTo);
            }

            Violation tsViolation, signViolation;

            var success = NativeMethods.SvScVerifyCryptographicEnvelope(signSCHandle,
                                                                        timestampFormat, fileName, workPath,
                                                                        verifyDegree, signFormat, saveOptions,
                                                                        out tsViolation, out signViolation);

            CheckScResult(success || tsViolation != 0 || signViolation != 0);

            return(new VerifyResult
            {
                SignatureViolation = (signFormat == SignatureType.None && signViolation == Violation.Syntactic) ? (Violation?)null : signViolation,
                TimestampViolation = (timestampFormat == TimeStampFileFormat.UndefinedTimeStampFormat && tsViolation == Violation.Syntactic) ? (Violation?)null : tsViolation,
                ContentFileName = workPath?.ToString(),
            });
        }
Ejemplo n.º 3
0
        public IMessageRepository CreateRepository(SaveOption storageOption = SaveOption.Locally)
        {
            IMessageRepository repo;

            if (storageOption == SaveOption.None)
            {
                storageOption = GetSettings();
            }

            switch (storageOption)
            {
            case SaveOption.Locally:
                repo = new LocalRepository();
                break;

            case SaveOption.Database:
                repo = new DatabaseRepository();
                break;

            default:
                repo = new LocalRepository();
                break;
            }

            return(repo);
        }
Ejemplo n.º 4
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "Update a folder.";
     _folderId           = command.Argument("folderId",
                                            "Id of folder to update");
     _bulkFilePath   = BulkFilePathOption.ConfigureOption(command);
     _filePath       = FilePathOption.ConfigureOption(command);
     _fileFormat     = FileFormatOption.ConfigureOption(command);
     _save           = SaveOption.ConfigureOption(command);
     _parentFolderId = command.Option("--parent-folder-id",
                                      "Id of new parent folder <ID>", CommandOptionType.SingleValue);
     _name = command.Option("--name",
                            "New name for folder <NAME>", CommandOptionType.SingleValue);
     _description = command.Option("--description",
                                   "New description for folder <DESCRIPTION>", CommandOptionType.SingleValue);
     _notSynced = command.Option("--not-synced",
                                 "Set sync state to not synced", CommandOptionType.NoValue);
     _partiallySynced = command.Option("--partially-synced",
                                       "Set sync state to partially synced", CommandOptionType.NoValue);
     _synced = command.Option("--synced",
                              "Set sync state to synced", CommandOptionType.NoValue);
     _access                = command.Option("--folder-upload-email-access <ACCESS>", "Upload email access level", CommandOptionType.SingleValue);
     _sharedLinkAccess      = command.Option("--shared-link-access <ACCESS>", "Shared link access level", CommandOptionType.SingleValue);
     _sharedLinkPassword    = command.Option("--shared-link-password <PASSWORD>", "Shared link password", CommandOptionType.SingleValue);
     _sharedLinkUnsharedAt  = command.Option("--shared-link-unshared-at <TIME>", "Time that this link will become disabled, use formatting like 03w for 3 weeks.", CommandOptionType.SingleValue);
     _sharedLinkCanDownload = command.Option("--shared-link-can-download", "Whether the shared link allows downloads", CommandOptionType.NoValue);
     _tags = command.Option("--tags <TAGS>", "Comma seperated tags", CommandOptionType.SingleValue);
     _etag = command.Option("--etag <ETAG>", "Only move if etag value matches", CommandOptionType.SingleValue);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 5
0
        protected override bool DoSaveFile(SaveOption option, string filepath)
        {
            System.Diagnostics.Debug.WriteLine("SaveToFile");
            try
            {
                switch (option)
                {
                case SaveOption.SaveToExisting:
                    this.Editor.SaveToFile(this.File.FilePath);
                    return(true);

                case SaveOption.SaveAsCopy:
                    try
                    {
                        this.Editor.SaveToFile(filepath);
                        return(this.DiscardChanges());
                    }
                    catch (Exception)
                    {
                        return(false);
                    }

                case SaveOption.Rename:
                    throw new NotImplementedException();

                default:
                    throw new NotImplementedException();
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="calculator"></param>
        /// <param name="el"></param>
        /// <param name="option"></param>
        /// <returns></returns>
        public static CalculatorToken CreateCalculatorToken(Calculator calculator, XmlNode el, SaveOption option)
        {
            CalculatorToken token;

            CalculatorTokenType type = (CalculatorTokenType)int.Parse(el.Attributes["type"].Value);

            switch (type)
            {
                case CalculatorTokenType.BinaryOperator:
                    token = new CalculatorTokenBinaryOperator(calculator, el, option);
                    break;

                case CalculatorTokenType.Keyword:
                    token = new CalculatorTokenKeyword(calculator, el, option);
                    break;

                /*case CalculatorTokenType.UnaryOperator:
                    token = new CalculatorTokenUnaryOperator(el, option);
                    break;*/

                case CalculatorTokenType.Value:
                    token = new CalculatorTokenValue(calculator, el, option);
                    break;

                case CalculatorTokenType.Function:
                    token = new CalculatorTokenFunction(calculator, el, option);
                    break;

                default:
                    throw new InvalidOperationException("unknown CalculatorTokenType");
            }

            return token;
        }
Ejemplo n.º 7
0
        private bool IsInputOkay(SaveOption opt)
        {
            bool inputOkay = false;

            switch (opt)
            {
            case SaveOption.add:
                if (!acb_Zustand.Text.Equals(""))
                {
                    inputOkay = true;
                }
                break;

            case SaveOption.update:
                if (!tb_ID.Text.Equals("") && !acb_Zustand.Text.Equals(""))
                {
                    inputOkay = true;
                }
                break;

            case SaveOption.delete:
                if (!tb_ID.Text.Equals(""))
                {
                    inputOkay = true;
                }
                break;
            }
            return(inputOkay);
        }
Ejemplo n.º 8
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "Update a collaboration.";
     _id = command.Argument("collaborationId",
                            "ID of the collaboration");
     _path              = FilePathOption.ConfigureOption(command);
     _bulkPath          = BulkFilePathOption.ConfigureOption(command);
     _save              = SaveOption.ConfigureOption(command);
     _fileFormat        = FileFormatOption.ConfigureOption(command);
     _fieldsOption      = FieldsOption.ConfigureOption(command);
     _editor            = command.Option("--editor", "Set the role to editor.", CommandOptionType.NoValue);
     _viewer            = command.Option("--viewer", "Set the role to viewer.", CommandOptionType.NoValue);
     _previewer         = command.Option("--previewer", "Set the role to previewer.", CommandOptionType.NoValue);
     _uploader          = command.Option("--uploader", "Set the role to uploader.", CommandOptionType.NoValue);
     _previewerUploader = command.Option("--previewer-uploader", "Set the role to previewer uploader.", CommandOptionType.NoValue);
     _viewerUploader    = command.Option("--viewer-uploader", "Set the role to viewer uploader.", CommandOptionType.NoValue);
     _coowner           = command.Option("--co-owner", "Set the role to co-owner.", CommandOptionType.NoValue);
     _owner             = command.Option("--owner", "Set the role to owner.", CommandOptionType.NoValue);
     _role              = command.Option("-r|--role", "An option to manually enter the role", CommandOptionType.SingleValue);
     _status            = command.Option("--status", "Update the collaboration status", CommandOptionType.SingleValue);
     _canViewPath       = command.Option("--can-view-path", "Whether view path collaboration feature is enabled or not.", CommandOptionType.NoValue);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// shows a message to tell the user that the action was successful
        /// </summary>
        /// <param name="opt"></param>
        private void ShowMessage(SaveOption opt)
        {
            lb_Message.Text = "";
            var t = new System.Windows.Forms.Timer();

            t.Interval = 3000; // it will Tick in 3 seconds
            t.Tick    += (s, a) =>
            {
                lb_Message.Hide();
                t.Stop();
            };
            string message = "";

            switch (opt)
            {
            case SaveOption.add:
                message = "Das Exemplar wurde erfolgreich hinzugefügt.";
                break;

            case SaveOption.update:
                message = "Das Exemplar wurde erfolgreich aktualisiert.";
                break;

            case SaveOption.delete:
                message = "Das Exemplar mit seinen Exemplaren wurde erfolgreich gelöscht.";
                break;
            }
            lb_Message.Text    = message;
            lb_Message.Visible = true;
            t.Start();
        }
Ejemplo n.º 10
0
 public void TakeVideo(SaveOption saveOptions, VideoOption videoOptions)
 {
                 #if UNITY_IPHONE
     _NativeCamera_TakeVideo(
         new JsonData(saveOptions).ToString(),
         new JsonData(videoOptions).ToString()
         );
                 #endif
 }
Ejemplo n.º 11
0
 public void TakeVideo(SaveOption saveOption, VideoOption videoOption)
 {
                 #if UNITY_ANDROID
     camClass.CallStatic(
         "TakeVideo",
         new JsonData(saveOption).ToString(),
         new JsonData(videoOption).ToString()
         );
                 #endif
 }
Ejemplo n.º 12
0
 bool SvScVerifyCryptographicEnvelope(
     uint hSignSC,
     TimeStampFileFormat eTSFormat,
     string sTSFilePath,
     StringBuilder sFilePath,
     VerifyDegree eVerifyDegree,
     SignatureType eSignedContentFormat,
     SaveOption eSaveOptions,
     out Violation pTSVerifyResult,
     out Violation pContentVerifyResult);
Ejemplo n.º 13
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all pending collaborations for a user.";
     _save       = SaveOption.ConfigureOption(command);
     _fileFormat = FileFormatOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 14
0
        /* ----------------------------------------------------------------- */
        ///
        /// GetWarnMessage
        ///
        /// <summary>
        /// Gets an warning message from the specified arguments.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private static string GetWarnMessage(string src, SaveOption option)
        {
            var s0 = string.Format(Properties.Resources.MessageExists, src);

            new Dictionary <SaveOption, string>
            {
                { SaveOption.Overwrite, Properties.Resources.MessageOverwrite },
                { SaveOption.MergeHead, Properties.Resources.MessageMergeHead },
                { SaveOption.MergeTail, Properties.Resources.MessageMergeTail },
            }.TryGetValue(option, out var s1);
            return($"{s0} {s1}");
        }
Ejemplo n.º 15
0
 public void TakePhoto(SaveOption saveOption, CropOption cropOption)
 {
     lastSaveOption = saveOption;
     lastCropOption = cropOption;
                 #if UNITY_ANDROID
     camClass.CallStatic(
         "TakePhoto",
         new JsonData(saveOption).ToString(),
         new JsonData(cropOption).ToString()
         );
                 #endif
 }
Ejemplo n.º 16
0
        /* ----------------------------------------------------------------- */
        ///
        /// CreateMessage
        ///
        /// <summary>
        /// ユーザに表示するメッセージを生成します。
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private static string CreateMessage(string path, SaveOption option)
        {
            var s0 = string.Format(Properties.Resources.MessageExists, path);
            var ok = new Dictionary <SaveOption, string>
            {
                { SaveOption.Overwrite, Properties.Resources.MessageOverwrite },
                { SaveOption.MergeHead, Properties.Resources.MessageMergeHead },
                { SaveOption.MergeTail, Properties.Resources.MessageMergeTail },
            }.TryGetValue(option, out var s1);

            Debug.Assert(ok);
            return($"{s0} {s1}");
        }
Ejemplo n.º 17
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all webhooks.";
     _save       = SaveOption.ConfigureOption(command);
     _path       = FilePathOption.ConfigureOption(command);
     _fileFormat = FileFormatOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 18
0
        /* ----------------------------------------------------------------- */
        ///
        /// Add
        ///
        /// <summary>
        /// Adds the collection of Pages to the specified writer.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void Add(DocumentWriter src, string path, SaveOption condition)
        {
            if (Value.SaveOption != condition || !IO.Exists(path))
            {
                return;
            }

            var password = Value.Encryption.Enabled ?
                           Value.Encryption.OwnerPassword :
                           string.Empty;

            src.Add(new DocumentReader(path, password, true, IO));
        }
Ejemplo n.º 19
0
        public override void Configure(CommandLineApplication command)
        {
            _app = command;
            command.Description = "Get all metadata templates in your Enterprise.";

            _save       = SaveOption.ConfigureOption(command);
            _fileFormat = FileFormatOption.ConfigureOption(command);
            command.OnExecute(async() =>
            {
                return(await this.Execute());
            });
            base.Configure(command);
        }
Ejemplo n.º 20
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all collaborations on a Box item.";
     _id = command.Argument("boxItemId",
                            "Id of the Box item");
     _save       = SaveOption.ConfigureOption(command);
     _fileFormat = FileFormatOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 21
0
    public void Load()
    {
        string dataPath = Application.persistentDataPath;

        if (System.IO.File.Exists(dataPath + "/" + activeSave.saveName + ".save"))
        {
            var serializer = new XmlSerializer(typeof(SaveOption));
            var stream     = new FileStream(dataPath + "/" + activeSave.saveName + ".save", FileMode.Open);
            activeSave = serializer.Deserialize(stream) as SaveOption;
            stream.Close();
            Debug.Log("load");
            hasLoaded = true;
        }
    }
Ejemplo n.º 22
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all tasks on this file.";
     _fileId             = command.Argument("fileId",
                                            "Id of file on which to retrieve tasks");
     _save       = SaveOption.ConfigureOption(command);
     _path       = FilePathOption.ConfigureOption(command);
     _fileFormat = FileFormatOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 23
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List items in a folder.";
     _folderId           = command.Argument("folderId",
                                            "Id of folder to manage, use '0' for the root folder");
     _save       = SaveOption.ConfigureOption(command);
     _path       = FilePathOption.ConfigureOption(command);
     _fileFormat = FileFormatOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 24
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "Update a webhook";
     _path = BulkFilePathOption.ConfigureOption(command);
     _save = SaveOption.ConfigureOption(command);
     _id   = command.Argument("webhookId",
                              "Id of the webhook");
     _triggers = command.Option("-t|--triggers <TRIGGERS>", "Triggers for webhook, enter as comma separated list. For example: FILE.DELETED,FILE.PREVIEWED", CommandOptionType.SingleValue);
     _address  = command.Option("-a|--address", "URL for your webhook handler", CommandOptionType.SingleValue);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all collaborations for a group.";
     _save       = SaveOption.ConfigureOption(command);
     _fileFormat = FileFormatOption.ConfigureOption(command);
     _id         = command.Argument("groupId",
                                    "Id of the group");
     _limit        = LimitOption.ConfigureOption(command);
     _fieldsOption = FieldsOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 26
0
        /* ----------------------------------------------------------------- */
        ///
        /// Add
        ///
        /// <summary>
        /// Adds the collection of Pages to the specified writer.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private void Add(DocumentWriter src, string path, SaveOption so)
        {
            var io    = Settings.IO;
            var value = Settings.Value;

            if (value.SaveOption != so || !io.Exists(path))
            {
                return;
            }

            var password = value.Encryption.Enabled ?
                           value.Encryption.OwnerPassword :
                           string.Empty;

            src.Add(new DocumentReader(path, password, true, io));
        }
Ejemplo n.º 27
0
        public override void Configure(CommandLineApplication command)
        {
            _app = command;
            command.Description = "List all task assignments on a task.";
            _taskId             = command.Argument("taskId",
                                                   "Id of task");
            _save       = SaveOption.ConfigureOption(command);
            _path       = FilePathOption.ConfigureOption(command);
            _fileFormat = FileFormatOption.ConfigureOption(command);

            command.OnExecute(async() =>
            {
                return(await this.Execute());
            });
            base.Configure(command);
        }
Ejemplo n.º 28
0
        public override void Configure(CommandLineApplication command)
        {
            _app = command;
            command.Description = "Get events.";
            _enterprise = command.Option("-e|--enterprise", "Get enterprise events", CommandOptionType.NoValue);
            _createdBefore = command.Option("--created-before", "Return enterprise events that occured before a time. Use a timestamp or shorthand syntax 00t, like 05w for 5 weeks. If not used, defaults to now.", CommandOptionType.SingleValue);
            _createdAfter = command.Option("--created-after", "Return enterprise events that occured before a time. Use a timestamp or shorthand syntax 00t, like 05w for 5 weeks. If not used, defaults to 5 days ago.", CommandOptionType.SingleValue);
            _save = SaveOption.ConfigureOption(command);
            _path = FilePathOption.ConfigureOption(command);
            _fileFormat = FileFormatOption.ConfigureOption(command);

            command.OnExecute(async () =>
            {
                return await this.Execute();
            });
            base.Configure(command);
        }
Ejemplo n.º 29
0
        public void TakePhoto(SaveOption saveOptions, CropOption cropOptions)
        {
            lastSaveOption = saveOptions;
            lastCropOption = cropOptions;

            if (ShoudAlterSaveLocation)
            {
                AlterSaveLocation();
            }

                        #if UNITY_IPHONE
            _NativeCamera_TakePhoto(
                new JsonData(saveOptions).ToString(),
                new JsonData(cropOptions).ToString()
                );
                        #endif
        }
Ejemplo n.º 30
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all Box users.";
     _managedUsers       = ManagedUsersOnlyOption.ConfigureOption(command);
     _appUsers           = AppUsersOnlyOption.ConfigureOption(command);
     _save         = SaveOption.ConfigureOption(command);
     _path         = FilePathOption.ConfigureOption(command);
     _fileFormat   = FileFormatOption.ConfigureOption(command);
     _fieldsOption = FieldsOption.ConfigureOption(command);
     _limit        = LimitOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 31
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "Create a new webhook";
     _path   = BulkFilePathOption.ConfigureOption(command);
     _save   = SaveOption.ConfigureOption(command);
     _idOnly = IdOnlyOption.ConfigureOption(command);
     _id     = command.Argument("boxItemId",
                                "Id of the Box item");
     _type     = command.Argument("boxItemType", "Type of Box item");
     _triggers = command.Argument("triggers", "Triggers for webhook, enter as comma separated list. For example: FILE.DELETED,FILE.PREVIEWED");
     _address  = command.Argument("address", "URL for your webhook handler");
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Ejemplo n.º 32
0
 ///>
 public void Save(BinaryWriter bw, SaveOption option)
 {
     _root.Save(bw, option);
 }
Ejemplo n.º 33
0
 public abstract void Save(XmlNode el, SaveOption option);
Ejemplo n.º 34
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="el"></param>
 /// <param name="option"></param>
 public void Save(XmlNode el, SaveOption option)
 {
     _calculator.Save(el, option);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="el"></param>
        /// <param name="option"></param>
        public override void Load(XmlNode el, SaveOption option)
        {
            _operator = (BinaryOperator) int.Parse(el.Attributes["operator"].Value);

            XmlNode child = (XmlNode)el.SelectSingleNode("Left/Node");
            _left = Calculator.CreateCalculatorToken(Calculator, child, option);

            child = (XmlNode)el.SelectSingleNode("Right/Node");
            _right = Calculator.CreateCalculatorToken(Calculator, child, option);
        }
Ejemplo n.º 36
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="bw"></param>
 /// <param name="option"></param>
 public override void Save(BinaryWriter bw, SaveOption option)
 {
     bw.Write((int)CalculatorTokenType.Value);
     string value = _type == 0 ? _value.ToString(CultureInfo.InvariantCulture) : _string;
     bw.Write(value);
     bw.Write(_type);
 }
Ejemplo n.º 37
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="calculator"></param>
 /// <param name="br"></param>
 /// <param name="option"></param>
 public CalculatorTokenValue(Calculator calculator, BinaryReader br, SaveOption option)
     : base(calculator)
 {
     Load(br, option);
 }
Ejemplo n.º 38
0
        public void Save(SaveOption option)
		{
            SetVersionStatus(option);

            PolicyFileWriter fileWriter = new PolicyFileWriter();
			fileWriter.WriteFile(this, m_filename, false);
		}
Ejemplo n.º 39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="br"></param>
        /// <param name="option"></param>
        public override void Load(BinaryReader br, SaveOption option)
        {
            _type = br.ReadInt32();

            if (_type == 0)
            {
                _value = float.Parse(br.ReadString());
            }
            else
            {
                _string = br.ReadString();
            }
        }
Ejemplo n.º 40
0
		public void SaveAs(SaveOption option, string newname)
		{
			FileInfo fi = new FileInfo(m_filename);
			
			string newfilename = m_filename.Remove(m_filename.Length - fi.Extension.Length, fi.Extension.Length);
			newfilename = newfilename.Remove(newfilename.Length - m_id.Length, m_id.Length);
			newfilename += newname;
			newfilename += fi.Extension;

			m_filename = newfilename;
			Save(option);
		}
Ejemplo n.º 41
0
        private void SetVersionStatus(SaveOption option)
        {
            LocalPolicySetVersionCache ver = (LocalPolicySetVersionCache)LatestVersion;

            switch (option)
            {
                case SaveOption.Delete:
                    ver.Status = PolicySetVersionStatus.Deleted; break;
                case SaveOption.Disable:
                    {
                        DisableOldVersions();

                        if (ver.Status == PolicySetVersionStatus.Enabled)
                            ver.Status = PolicySetVersionStatus.Disabled;
                    }
                    break;
                case SaveOption.SaveOnly:
                    {
                        if (PolicySetVersionStatus.Enabled != ver.Status)
                            ver.Status = PolicySetVersionStatus.InProgress;
                    }
                    break;
                case SaveOption.SaveNew:
                    {
                        if (ver.Status == PolicySetVersionStatus.Enabled)
                            ver = NewVersionFromLatest(PolicySetVersionStatus.InProgress);
                        else
                            ver.Status = PolicySetVersionStatus.InProgress;
                    }
                    break;
                case SaveOption.Publish:
                    {
                        if (ver.Status == PolicySetVersionStatus.InProgress ||
                            ver.Status == PolicySetVersionStatus.Disabled)
                            ver.Status = PolicySetVersionStatus.Enabled;
                        else if (ver.Status == PolicySetVersionStatus.Enabled)
                            ver = NewVersionFromLatest(PolicySetVersionStatus.Enabled);

                        DisableOldVersions();
                    }
                    break;
                default:
                    {
                        ErrorMessage errorMessage = new ErrorMessage(
                            "STATUS_NOT_IMPL", "Workshare.Policy.ClientCache.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly());
						Logger.LogError(errorMessage.LogString);
						throw new Exception(errorMessage.DisplayString);
                    }
            }
        }
Ejemplo n.º 42
0
		public void SaveAs(SaveOption option, string newname)
		{
			throw new System.Exception("The method or operation is not implemented.");
		}
Ejemplo n.º 43
0
		public void Save(SaveOption option)
		{
			throw new System.Exception("The method or operation is not implemented.");
		}
Ejemplo n.º 44
0
 public abstract void Save(BinaryWriter bw, SaveOption option);
Ejemplo n.º 45
0
		public System.IO.Stream SaveToStream(SaveOption option)
		{
			throw new System.Exception("The method or operation is not implemented.");
		}
Ejemplo n.º 46
0
        public Stream SaveToStream(SaveOption option)
        {
            SetVersionStatus(option);

            PolicyFileWriter fileWriter = new PolicyFileWriter();
            return fileWriter.WriteToStream(this, false);
        }
Ejemplo n.º 47
0
 /// <summary>
 /// s
 /// </summary>
 /// <param name="bw"></param>
 /// <param name="option"></param>
 public void Save(BinaryWriter bw, SaveOption option)
 {
     _calculator.Save(bw, option);
 }
Ejemplo n.º 48
0
 /// <summary>
 /// Save the policy set
 /// </summary>
 public void SaveAs(SaveOption option, string newname)
 {
     throw (new NotImplementedException(Properties.Resources.NOT_IMPLEMENT));
 }
Ejemplo n.º 49
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="el"></param>
        /// <param name="option"></param>
        public override void Save(XmlNode el, SaveOption option)
        {
            XmlNode node = el.OwnerDocument.CreateElement("Node");
            el.AppendChild(node);
            node.AddAttribute("type", ((int)CalculatorTokenType.Value).ToString());

            string value = _type == 0 ? _value.ToString(CultureInfo.InvariantCulture) : _string;

            XmlNode valueNode = el.OwnerDocument.CreateElementWithText("Value", value);
            valueNode.AddAttribute("type", _type.ToString());
            node.AppendChild(valueNode);
        }
Ejemplo n.º 50
0
 /// <summary>
 /// Save the policy set
 /// </summary>
 public void Save(SaveOption option)
 {
     throw (new NotImplementedException(Properties.Resources.NOT_IMPLEMENT));
 }
Ejemplo n.º 51
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="calculator"></param>
 /// <param name="el"></param>
 /// <param name="option"></param>
 public CalculatorTokenValue(Calculator calculator, XmlNode el, SaveOption option)
     : base(calculator)
 {
     Load(el, option);
 }
Ejemplo n.º 52
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="el"></param>
 /// <param name="option"></param>
 public void Load(XmlNode el, SaveOption option)
 {
     _calculator.Load(el, option);
 }
Ejemplo n.º 53
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="el"></param>
        /// <param name="option"></param>
        public override void Load(XmlNode el, SaveOption option)
        {
            _type = int.Parse(el.SelectSingleNode("Value").Attributes["type"].Value);

            if (_type == 0)
            {
                _value = float.Parse(el.SelectSingleNode("Value").InnerText);
            }
            else
            {
                _string = el.SelectSingleNode("Value").InnerText;
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="calculator"></param>
 /// <param name="el"></param>
 /// <param name="option"></param>
 public CalculatorTokenBinaryOperator(Calculator calculator, XmlNode el, SaveOption option)
     : base(calculator)
 {
     Load(el, option);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="br"></param>
 /// <param name="option"></param>
 public override void Load(BinaryReader br, SaveOption option)
 {
     _operator = (BinaryOperator)br.ReadInt32();
     _left = Calculator.CreateCalculatorToken(Calculator, br, option);
     _right = Calculator.CreateCalculatorToken(Calculator, br, option);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="bw"></param>
 /// <param name="option"></param>
 public override void Save(BinaryWriter bw, SaveOption option)
 {
     bw.Write((int)CalculatorTokenType.BinaryOperator);
     bw.Write((int)_operator);
     _left.Save(bw, option);
     _right.Save(bw, option);
 }
Ejemplo n.º 57
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="el_"></param>
 /// <param name="option"></param>
 public void Load(BinaryReader br, SaveOption option)
 {
     //_calculator.Load(br_, option_);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="el"></param>
        /// <param name="option"></param>
        public override void Save(XmlNode el, SaveOption option)
        {
            XmlNode node = el.OwnerDocument.CreateElement("Node");
            el.AppendChild(node);
            node.AddAttribute("type", ((int)CalculatorTokenType.BinaryOperator).ToString());
            node.AddAttribute("operator", ((int)_operator).ToString());

            XmlNode child = el.OwnerDocument.CreateElement("Left");
            node.AppendChild(child);
            _left.Save(child, option);

            child = el.OwnerDocument.CreateElement("Right");
            node.AppendChild(child);
            _right.Save(child, option);
        }
Ejemplo n.º 59
0
 /// <summary>
 /// Saves the record with the options to close the form or open a new form after the save is completed
 /// </summary>
 public void Save(SaveOption SaveOption)
 {
 }
Ejemplo n.º 60
0
 public abstract void Load(BinaryReader br, SaveOption option);